@deck.gl/extensions 9.3.0-alpha.6 → 9.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist.min.js CHANGED
@@ -4,13 +4,13 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['deck'] = factory();
6
6
  else root['deck'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var Vt=Object.create;var Q=Object.defineProperty;var jt=Object.getOwnPropertyDescriptor;var Ut=Object.getOwnPropertyNames;var Gt=Object.getPrototypeOf,Ht=Object.prototype.hasOwnProperty;var Ae=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Te=(r,e)=>{for(var t in e)Q(r,t,{get:e[t],enumerable:!0})},X=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ut(e))!Ht.call(r,i)&&i!==t&&Q(r,i,{get:()=>e[i],enumerable:!(o=jt(e,i))||o.enumerable});return r},y=(r,e,t)=>(X(r,e,"default"),t&&X(t,e,"default")),d=(r,e,t)=>(t=r!=null?Vt(Gt(r)):{},X(e||!r||!r.__esModule?Q(t,"default",{value:r,enumerable:!0}):t,r)),qt=r=>X(Q({},"__esModule",{value:!0}),r);var _=Ae((zo,Se)=>{Se.exports=globalThis.deck});var qe=Ae((qo,He)=>{He.exports=globalThis.luma});var Z={};Te(Z,{BrushingExtension:()=>Ne,ClipExtension:()=>yt,CollisionFilterExtension:()=>Ot,DataFilterExtension:()=>Xe,FillStyleExtension:()=>vt,Fp64Extension:()=>ct,MaskExtension:()=>It,PathStyleExtension:()=>dt,_TerrainExtension:()=>zt,project64:()=>oe});var x={},Le=d(_(),1);y(x,d(_(),1));if(!Le.Layer)throw new Error("@deck.gl/core is not found");y(Z,x);var Re=d(_(),1);var Ie=d(_(),1),Ce=`layout(std140) uniform brushingUniforms {
7
+ "use strict";var __exports__=(()=>{var Ut=Object.create;var X=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var qt=Object.getPrototypeOf,Wt=Object.prototype.hasOwnProperty;var Te=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ae=(r,e)=>{for(var t in e)X(r,t,{get:e[t],enumerable:!0})},Z=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ht(e))!Wt.call(r,o)&&o!==t&&X(r,o,{get:()=>e[o],enumerable:!(i=Gt(e,o))||i.enumerable});return r},y=(r,e,t)=>(Z(r,e,"default"),t&&Z(t,e,"default")),d=(r,e,t)=>(t=r!=null?Ut(qt(r)):{},Z(e||!r||!r.__esModule?X(t,"default",{value:r,enumerable:!0}):t,r)),Kt=r=>Z(X({},"__esModule",{value:!0}),r);var _=Te((Vi,Le)=>{Le.exports=globalThis.deck});var He=Te((Wi,Ge)=>{Ge.exports=globalThis.luma});var $={};Ae($,{BrushingExtension:()=>Ce,ClipExtension:()=>bt,CollisionFilterExtension:()=>Lt,DataFilterExtension:()=>Ze,FillStyleExtension:()=>xt,Fp64Extension:()=>ct,MaskExtension:()=>Rt,PathStyleExtension:()=>mt,_TerrainExtension:()=>jt,project64:()=>re});var x={},Oe=d(_(),1);y(x,d(_(),1));if(!Oe.Layer)throw new Error("@deck.gl/core is not found");y($,x);var Re=d(_(),1);var Se=d(_(),1),Ie=`layout(std140) uniform brushingUniforms {
8
8
  bool enabled;
9
9
  highp int target;
10
10
  vec2 mousePos;
11
11
  float radius;
12
12
  } brushing;
13
- `,Wt=`
13
+ `,Yt=`
14
14
  in vec2 brushingTargets;
15
15
 
16
16
  out float brushing_isVisible;
@@ -33,15 +33,15 @@
33
33
  void brushing_setVisible(bool visible) {
34
34
  brushing_isVisible = float(visible);
35
35
  }
36
- `,Yt=`
37
- ${Ce}
38
- ${Wt}
39
- `,Kt=`
40
- in float brushing_isVisible;
41
36
  `,$t=`
42
- ${Ce}
43
- ${Kt}
44
- `,Zt={source:0,target:1,custom:2,source_target:3},Xt={"vs:DECKGL_FILTER_GL_POSITION":`
37
+ ${Ie}
38
+ ${Yt}
39
+ `,Zt=`
40
+ in float brushing_isVisible;
41
+ `,Xt=`
42
+ ${Ie}
43
+ ${Zt}
44
+ `,Qt={source:0,target:1,custom:2,source_target:3},Jt={"vs:DECKGL_FILTER_GL_POSITION":`
45
45
  vec2 brushingTarget;
46
46
  vec2 brushingSource;
47
47
  if (brushing.target == 3) {
@@ -65,7 +65,7 @@ ${Kt}
65
65
  if (brushing.enabled && brushing_isVisible < 0.5) {
66
66
  discard;
67
67
  }
68
- `},ke={name:"brushing",dependencies:[Ie.project],vs:Yt,fs:$t,inject:Xt,getUniforms:r=>{if(!r||!("viewport"in r))return{};let{brushingEnabled:e=!0,brushingRadius:t=1e4,brushingTarget:o="source",mousePosition:i,viewport:s}=r;return{enabled:Boolean(e&&i&&s.containsPixel(i)),radius:t,target:Zt[o]||0,mousePos:i?s.unproject([i.x-s.x,i.y-s.y]):[0,0]}},uniformTypes:{enabled:"i32",target:"i32",mousePos:"vec2<f32>",radius:"f32"}};var Qt={getBrushingTarget:{type:"accessor",value:[0,0]},brushingTarget:"source",brushingEnabled:!0,brushingRadius:1e4},L=class extends Re.LayerExtension{getShaders(){return{modules:[ke]}}initializeState(e,t){let o=this.getAttributeManager();o&&o.add({brushingTargets:{size:2,stepMode:"dynamic",accessor:"getBrushingTarget"}});let i=()=>{this.getCurrentLayer()?.setNeedsRedraw()};this.state.onMouseMove=i,e.deck&&e.deck.eventManager.on({pointermove:i,pointerleave:i})}finalizeState(e,t){if(e.deck){let o=this.state.onMouseMove;e.deck.eventManager.off({pointermove:o,pointerleave:o})}}draw(e,t){let{viewport:o,mousePosition:i}=e.context,{brushingEnabled:s,brushingRadius:n,brushingTarget:a}=this.props,l={viewport:o,mousePosition:i,brushingEnabled:s,brushingRadius:n,brushingTarget:a};this.setShaderModuleProps({brushing:l})}};L.defaultProps=Qt;L.extensionName="BrushingExtension";var Ne=L;var E=d(_(),1);var we=`layout(std140) uniform dataFilterUniforms {
68
+ `},ke={name:"brushing",dependencies:[Se.project],vs:$t,fs:Xt,inject:Jt,getUniforms:r=>{if(!r||!("viewport"in r))return{};let{brushingEnabled:e=!0,brushingRadius:t=1e4,brushingTarget:i="source",mousePosition:o,viewport:s}=r;return{enabled:Boolean(e&&o&&s.containsPixel(o)),radius:t,target:Qt[i]||0,mousePos:o?s.unproject([o.x-s.x,o.y-s.y]):[0,0]}},uniformTypes:{enabled:"i32",target:"i32",mousePos:"vec2<f32>",radius:"f32"}};var er={getBrushingTarget:{type:"accessor",value:[0,0]},brushingTarget:"source",brushingEnabled:!0,brushingRadius:1e4},S=class extends Re.LayerExtension{getShaders(){return{modules:[ke]}}initializeState(e,t){let i=this.getAttributeManager();i&&i.add({brushingTargets:{size:2,stepMode:"dynamic",accessor:"getBrushingTarget"}});let o=()=>{this.getCurrentLayer()?.setNeedsRedraw()};this.state.onMouseMove=o,e.deck&&e.deck.eventManager.on({pointermove:o,pointerleave:o})}finalizeState(e,t){if(e.deck){let i=this.state.onMouseMove;e.deck.eventManager.off({pointermove:i,pointerleave:i})}}draw(e,t){let{viewport:i,mousePosition:o}=e.context,{brushingEnabled:s,brushingRadius:a,brushingTarget:n}=this.props,l={viewport:i,mousePosition:o,brushingEnabled:s,brushingRadius:a,brushingTarget:n};this.setShaderModuleProps({brushing:l})}};S.defaultProps=er;S.extensionName="BrushingExtension";var Ce=S;var E=d(_(),1);var we=`layout(std140) uniform dataFilterUniforms {
69
69
  bool useSoftMargin;
70
70
  bool enabled;
71
71
  bool transformSize;
@@ -78,7 +78,7 @@ ${Kt}
78
78
  vec4 max64High;
79
79
  highp uvec4 categoryBitMask;
80
80
  } dataFilter;
81
- `,Jt=`
81
+ `,tr=`
82
82
  #ifdef DATAFILTER_TYPE
83
83
  in DATAFILTER_TYPE filterValues;
84
84
  #ifdef DATAFILTER_DOUBLE
@@ -239,15 +239,15 @@ float dataFilter_reduceValue(vec4 value) {
239
239
  #endif
240
240
  }
241
241
  #endif
242
- `,Be=`
242
+ `,Ne=`
243
243
  ${we}
244
- ${Jt}
245
- `,er=`
244
+ ${tr}
245
+ `,rr=`
246
246
  in float dataFilter_value;
247
- `,De=`
247
+ `,Be=`
248
248
  ${we}
249
- ${er}
250
- `;function ze(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:o=!0,filterTransformColor:i=!0,categoryBitMask:s}=r,n=r.filterSoftRange||e,a=l=>Array.isArray(l)?[l[0]||0,l[1]||0,l[2]||0,l[3]||0]:[l,0,0,0];return{...Number.isFinite(e[0])?{min:a(e[0]),softMin:a(n[0]),softMax:a(n[1]),max:a(e[1])}:{min:a(e.map(l=>l[0])),softMin:a(n.map(l=>l[0])),softMax:a(n.map(l=>l[1])),max:a(e.map(l=>l[1]))},enabled:t,useSoftMargin:Boolean(r.filterSoftRange),transformSize:t&&o,transformColor:t&&i,...s&&{categoryBitMask:s}}}function tr(r){if(!r||!("extensions"in r))return{};let e=ze(r),t=e.min.map(Math.fround);e.min=e.min.map((i,s)=>i-t[s]),e.softMin=e.softMin.map((i,s)=>i-t[s]),e.min64High=t;let o=e.max.map(Math.fround);return e.max=e.max.map((i,s)=>i-o[s]),e.softMax=e.softMax.map((i,s)=>i-o[s]),e.max64High=o,e}var Ve={"vs:#main-start":`
249
+ ${rr}
250
+ `;function De(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:i=!0,filterTransformColor:o=!0,categoryBitMask:s}=r,a=r.filterSoftRange||e,n=l=>Array.isArray(l)?[l[0]||0,l[1]||0,l[2]||0,l[3]||0]:[l,0,0,0];return{...Number.isFinite(e[0])?{min:n(e[0]),softMin:n(a[0]),softMax:n(a[1]),max:n(e[1])}:{min:n(e.map(l=>l[0])),softMin:n(a.map(l=>l[0])),softMax:n(a.map(l=>l[1])),max:n(e.map(l=>l[1]))},enabled:t,useSoftMargin:Boolean(r.filterSoftRange),transformSize:t&&i,transformColor:t&&o,...s&&{categoryBitMask:s}}}function ir(r){if(!r||!("extensions"in r))return{};let e=De(r),t=e.min.map(Math.fround);e.min=e.min.map((o,s)=>o-t[s]),e.softMin=e.softMin.map((o,s)=>o-t[s]),e.min64High=t;let i=e.max.map(Math.fround);return e.max=e.max.map((o,s)=>o-i[s]),e.softMax=e.softMax.map((o,s)=>o-i[s]),e.max64High=i,e}var ze={"vs:#main-start":`
251
251
  dataFilter_value = 1.0;
252
252
  if (dataFilter.enabled) {
253
253
  #ifdef DATAFILTER_TYPE
@@ -278,7 +278,7 @@ ${er}
278
278
  if (dataFilter.transformColor) {
279
279
  color.a *= dataFilter_value;
280
280
  }
281
- `};function je(r){return{useSoftMargin:"i32",enabled:"i32",transformSize:"i32",transformColor:"i32",min:"vec4<f32>",softMin:"vec4<f32>",softMax:"vec4<f32>",max:"vec4<f32>",min64High:"vec4<f32>",max64High:"vec4<f32>",categoryBitMask:"vec4<u32>"}}var Ue={name:"dataFilter",vs:Be,fs:De,inject:Ve,getUniforms:ze,uniformTypesFromOptions:je},Ge={name:"dataFilter",vs:Be,fs:De,inject:Ve,getUniforms:tr,uniformTypesFromOptions:je};var We=d(qe(),1),rr=`#version 300 es
281
+ `};function Ve(r){return{useSoftMargin:"i32",enabled:"i32",transformSize:"i32",transformColor:"i32",min:"vec4<f32>",softMin:"vec4<f32>",softMax:"vec4<f32>",max:"vec4<f32>",min64High:"vec4<f32>",max64High:"vec4<f32>",categoryBitMask:"vec4<u32>"}}var je={name:"dataFilter",vs:Ne,fs:Be,inject:ze,getUniforms:De,uniformTypesFromOptions:Ve},Ue={name:"dataFilter",vs:Ne,fs:Be,inject:ze,getUniforms:ir,uniformTypesFromOptions:Ve};var qe=d(He(),1),or=`#version 300 es
282
282
  #define SHADER_NAME data-filter-vertex-shader
283
283
 
284
284
  #ifdef FLOAT_TARGET
@@ -309,7 +309,7 @@ void main() {
309
309
  #endif
310
310
  gl_PointSize = 1.0;
311
311
  }
312
- `,or=`#version 300 es
312
+ `,sr=`#version 300 es
313
313
  #define SHADER_NAME data-filter-fragment-shader
314
314
  precision highp float;
315
315
 
@@ -323,7 +323,7 @@ void main() {
323
323
  }
324
324
  fragColor = vColor;
325
325
  }
326
- `,ir=["float32-renderable-webgl","texture-blend-float-webgl"];function Ye(r){return ir.every(e=>r.features.has(e))}function Ke(r,e){return e?r.createFramebuffer({width:1,height:1,colorAttachments:[r.createTexture({format:"rgba32float",dimension:"2d",width:1,height:1})]}):r.createFramebuffer({width:256,height:64,colorAttachments:[r.createTexture({format:"rgba8unorm",dimension:"2d",width:256,height:64})]})}function $e(r,e,t,o){return t.defines.NON_INSTANCED_MODEL=1,o&&(t.defines.FLOAT_TARGET=1),new We.Model(r,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,topology:"point-list",disableWarnings:!0,vs:rr,fs:or,bufferLayout:e,...t})}var Ze={blend:!0,blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one",blendColorOperation:"add",blendAlphaOperation:"add",depthCompare:"never"};var nr={getFilterValue:{type:"accessor",value:0},getFilterCategory:{type:"accessor",value:0},onFilteredItemsChange:{type:"function",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterCategories:[0],filterTransformSize:!0,filterTransformColor:!0},ar={categorySize:0,filterSize:1,fp64:!1,countItems:!1},lr={1:"uint",2:"uvec2",3:"uvec3",4:"uvec4"},fr={1:"float",2:"vec2",3:"vec3",4:"vec4"},I=class extends E.LayerExtension{constructor(e={}){super({...ar,...e})}getShaders(e){let{categorySize:t,filterSize:o,fp64:i}=e.opts,s={};t&&(s.DATACATEGORY_TYPE=lr[t],s.DATACATEGORY_CHANNELS=t),o&&(s.DATAFILTER_TYPE=fr[o],s.DATAFILTER_DOUBLE=Boolean(i));let n=i?Ge:Ue;return n.uniformTypes=n.uniformTypesFromOptions(e.opts),{modules:[n],defines:s}}initializeState(e,t){let o=this.getAttributeManager(),{categorySize:i,filterSize:s,fp64:n}=t.opts;o&&(s&&o.add({filterValues:{size:s,type:n?"float64":"float32",stepMode:"dynamic",accessor:"getFilterValue"}}),i&&o.add({filterCategoryValues:{size:i,stepMode:"dynamic",accessor:"getFilterCategory",type:"uint32",transform:i===1?l=>t._getCategoryKey.call(this,l,0):l=>l.map((f,c)=>t._getCategoryKey.call(this,f,c))}}));let{device:a}=this.context;if(o&&t.opts.countItems){let l=Ye(a);o.add({filterVertexIndices:{size:l?1:2,vertexOffset:1,type:"unorm8",accessor:(p,{index:u})=>{let m=p&&p.__source?p.__source.index:u;return l?(m+1)%255:[(m+1)%255,Math.floor(m/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let f=Ke(a,l),c=$e(a,o.getBufferLayouts({isInstanced:!1}),t.getShaders.call(this,t),l);this.setState({filterFBO:f,filterModel:c})}}updateState({props:e,oldProps:t,changeFlags:o},i){let s=this.getAttributeManager(),{categorySize:n}=i.opts;if(this.state.filterModel){let a=s.attributes.filterValues?.needsUpdate()||s.attributes.filterCategoryValues?.needsUpdate()||e.filterEnabled!==t.filterEnabled||e.filterRange!==t.filterRange||e.filterSoftRange!==t.filterSoftRange||e.filterCategories!==t.filterCategories;a&&this.setState({filterNeedsUpdate:a})}s?.attributes.filterCategoryValues&&((s.attributes.filterCategoryValues.needsUpdate()||!(0,E._deepEqual)(e.filterCategories,t.filterCategories,2))&&this.setState({categoryBitMask:null}),o.dataChanged&&(this.setState({categoryMap:Array(n).fill(0).map(()=>({}))}),s.attributes.filterCategoryValues.setNeedsUpdate("categoryMap")))}draw(e,t){let o=this.state.filterFBO,i=this.state.filterModel,s=this.state.filterNeedsUpdate;this.state.categoryBitMask||t._updateCategoryBitMask.call(this,e,t);let{onFilteredItemsChange:n,extensions:a,filterEnabled:l,filterRange:f,filterSoftRange:c,filterTransformSize:p,filterTransformColor:u,filterCategories:m}=this.props,v={extensions:a,filterEnabled:l,filterRange:f,filterSoftRange:c,filterTransformSize:p,filterTransformColor:u,filterCategories:m};if(this.state.categoryBitMask&&(v.categoryBitMask=this.state.categoryBitMask),this.setShaderModuleProps({dataFilter:v}),s&&n&&i){let b=this.getAttributeManager(),{attributes:{filterValues:h,filterCategoryValues:S,filterVertexIndices:ce}}=b;i.setVertexCount(this.getNumInstances());let pe={...h?.getValue(),...S?.getValue(),...ce?.getValue()};i.setAttributes(pe),i.shaderInputs.setProps({dataFilter:v});let ue=[0,0,o.width,o.height],Me=i.device.beginRenderPass({id:"data-filter-aggregation",framebuffer:o,parameters:{viewport:ue},clearColor:[0,0,0,0]});i.setParameters(Ze),i.draw(Me),Me.end();let Fe=i.device.readPixelsToArrayWebGL(o),Oe=0;for(let de=0;de<Fe.length;de++)Oe+=Fe[de];n({id:this.id,count:Oe}),this.state.filterNeedsUpdate=!1}}finalizeState(){let e=this.state.filterFBO,t=this.state.filterModel;e?.destroy(),t?.destroy()}_updateCategoryBitMask(e,t){let{categorySize:o}=t.opts;if(!o)return;let{filterCategories:i}=this.props,s=new Uint32Array([0,0,0,0]),n=o===1?[i]:i,a=o===1?128:o===2?64:32;for(let l=0;l<n.length;l++){let f=n[l];for(let c of f){let p=t._getCategoryKey.call(this,c,l);if(p<a){let u=l*(a/32)+Math.floor(p/32);s[u]+=Math.pow(2,p%32)}else E.log.warn(`Exceeded maximum number of categories (${a})`)()}}this.state.categoryBitMask=s}_getCategoryKey(e,t){let o=this.state.categoryMap[t];return e in o||(o[e]=Object.keys(o).length),o[e]}};I.defaultProps=nr;I.extensionName="DataFilterExtension";var Xe=I;var N=d(_(),1);var Ko=1/Math.PI*180,$o=1/180*Math.PI,cr={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...cr}};var C=globalThis.mathgl.config;function _e(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function M(r,e,t){let o=C.EPSILON;t&&(C.EPSILON=t);try{if(r===e)return!0;if(_e(r)&&_e(e)){if(r.length!==e.length)return!1;for(let i=0;i<r.length;++i)if(!M(r[i],e[i]))return!1;return!0}return r&&r.equals?r.equals(e):e&&e.equals?e.equals(r):typeof r=="number"&&typeof e=="number"?Math.abs(r-e)<=C.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{C.EPSILON=o}}var k=typeof Float32Array<"u"?Float32Array:Array,me=Math.random;function J(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}var Xo=Math.PI/180;var R={};Te(R,{add:()=>hr,angle:()=>zr,bezier:()=>Ir,ceil:()=>vr,clone:()=>ur,copy:()=>_r,create:()=>Qe,cross:()=>Ar,dist:()=>Yr,distance:()=>ot,div:()=>Wr,divide:()=>rt,dot:()=>ve,equals:()=>Gr,exactEquals:()=>Ur,floor:()=>gr,forEach:()=>Xr,fromValues:()=>dr,hermite:()=>Lr,inverse:()=>Fr,len:()=>$r,length:()=>Je,lerp:()=>Tr,max:()=>yr,min:()=>xr,mul:()=>qr,multiply:()=>tt,negate:()=>Mr,normalize:()=>Or,random:()=>Cr,rotateX:()=>wr,rotateY:()=>Br,rotateZ:()=>Dr,round:()=>Pr,scale:()=>br,scaleAndAdd:()=>Er,set:()=>mr,slerp:()=>Sr,sqrDist:()=>Kr,sqrLen:()=>Zr,squaredDistance:()=>it,squaredLength:()=>st,str:()=>jr,sub:()=>Hr,subtract:()=>et,transformMat3:()=>Rr,transformMat4:()=>kr,transformQuat:()=>Nr,zero:()=>Vr});function Qe(){let r=new k(3);return k!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function ur(r){let e=new k(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Je(r){let e=r[0],t=r[1],o=r[2];return Math.sqrt(e*e+t*t+o*o)}function dr(r,e,t){let o=new k(3);return o[0]=r,o[1]=e,o[2]=t,o}function _r(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function mr(r,e,t,o){return r[0]=e,r[1]=t,r[2]=o,r}function hr(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function et(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function tt(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function rt(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function vr(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function gr(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function xr(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function yr(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function Pr(r,e){return r[0]=J(e[0]),r[1]=J(e[1]),r[2]=J(e[2]),r}function br(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function Er(r,e,t,o){return r[0]=e[0]+t[0]*o,r[1]=e[1]+t[1]*o,r[2]=e[2]+t[2]*o,r}function ot(r,e){let t=e[0]-r[0],o=e[1]-r[1],i=e[2]-r[2];return Math.sqrt(t*t+o*o+i*i)}function it(r,e){let t=e[0]-r[0],o=e[1]-r[1],i=e[2]-r[2];return t*t+o*o+i*i}function st(r){let e=r[0],t=r[1],o=r[2];return e*e+t*t+o*o}function Mr(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function Fr(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function Or(r,e){let t=e[0],o=e[1],i=e[2],s=t*t+o*o+i*i;return s>0&&(s=1/Math.sqrt(s)),r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r}function ve(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Ar(r,e,t){let o=e[0],i=e[1],s=e[2],n=t[0],a=t[1],l=t[2];return r[0]=i*l-s*a,r[1]=s*n-o*l,r[2]=o*a-i*n,r}function Tr(r,e,t,o){let i=e[0],s=e[1],n=e[2];return r[0]=i+o*(t[0]-i),r[1]=s+o*(t[1]-s),r[2]=n+o*(t[2]-n),r}function Sr(r,e,t,o){let i=Math.acos(Math.min(Math.max(ve(e,t),-1),1)),s=Math.sin(i),n=Math.sin((1-o)*i)/s,a=Math.sin(o*i)/s;return r[0]=n*e[0]+a*t[0],r[1]=n*e[1]+a*t[1],r[2]=n*e[2]+a*t[2],r}function Lr(r,e,t,o,i,s){let n=s*s,a=n*(2*s-3)+1,l=n*(s-2)+s,f=n*(s-1),c=n*(3-2*s);return r[0]=e[0]*a+t[0]*l+o[0]*f+i[0]*c,r[1]=e[1]*a+t[1]*l+o[1]*f+i[1]*c,r[2]=e[2]*a+t[2]*l+o[2]*f+i[2]*c,r}function Ir(r,e,t,o,i,s){let n=1-s,a=n*n,l=s*s,f=a*n,c=3*s*a,p=3*l*n,u=l*s;return r[0]=e[0]*f+t[0]*c+o[0]*p+i[0]*u,r[1]=e[1]*f+t[1]*c+o[1]*p+i[1]*u,r[2]=e[2]*f+t[2]*c+o[2]*p+i[2]*u,r}function Cr(r,e){e=e===void 0?1:e;let t=me()*2*Math.PI,o=me()*2-1,i=Math.sqrt(1-o*o)*e;return r[0]=Math.cos(t)*i,r[1]=Math.sin(t)*i,r[2]=o*e,r}function kr(r,e,t){let o=e[0],i=e[1],s=e[2],n=t[3]*o+t[7]*i+t[11]*s+t[15];return n=n||1,r[0]=(t[0]*o+t[4]*i+t[8]*s+t[12])/n,r[1]=(t[1]*o+t[5]*i+t[9]*s+t[13])/n,r[2]=(t[2]*o+t[6]*i+t[10]*s+t[14])/n,r}function Rr(r,e,t){let o=e[0],i=e[1],s=e[2];return r[0]=o*t[0]+i*t[3]+s*t[6],r[1]=o*t[1]+i*t[4]+s*t[7],r[2]=o*t[2]+i*t[5]+s*t[8],r}function Nr(r,e,t){let o=t[0],i=t[1],s=t[2],n=t[3],a=e[0],l=e[1],f=e[2],c=i*f-s*l,p=s*a-o*f,u=o*l-i*a,m=i*u-s*p,v=s*c-o*u,b=o*p-i*c,h=n*2;return c*=h,p*=h,u*=h,m*=2,v*=2,b*=2,r[0]=a+c+m,r[1]=l+p+v,r[2]=f+u+b,r}function wr(r,e,t,o){let i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[0],s[1]=i[1]*Math.cos(o)-i[2]*Math.sin(o),s[2]=i[1]*Math.sin(o)+i[2]*Math.cos(o),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Br(r,e,t,o){let i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[2]*Math.sin(o)+i[0]*Math.cos(o),s[1]=i[1],s[2]=i[2]*Math.cos(o)-i[0]*Math.sin(o),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Dr(r,e,t,o){let i=[],s=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],s[0]=i[0]*Math.cos(o)-i[1]*Math.sin(o),s[1]=i[0]*Math.sin(o)+i[1]*Math.cos(o),s[2]=i[2],r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function zr(r,e){let t=r[0],o=r[1],i=r[2],s=e[0],n=e[1],a=e[2],l=Math.sqrt((t*t+o*o+i*i)*(s*s+n*n+a*a)),f=l&&ve(r,e)/l;return Math.acos(Math.min(Math.max(f,-1),1))}function Vr(r){return r[0]=0,r[1]=0,r[2]=0,r}function jr(r){return`vec3(${r[0]}, ${r[1]}, ${r[2]})`}function Ur(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function Gr(r,e){let t=r[0],o=r[1],i=r[2],s=e[0],n=e[1],a=e[2];return Math.abs(t-s)<=1e-6*Math.max(1,Math.abs(t),Math.abs(s))&&Math.abs(o-n)<=1e-6*Math.max(1,Math.abs(o),Math.abs(n))&&Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))}var Hr=et,qr=tt,Wr=rt,Yr=ot,Kr=it,$r=Je,Zr=st,Xr=function(){let r=Qe();return function(e,t,o,i,s,n){let a,l;for(t||(t=3),o||(o=0),i?l=Math.min(i*t+o,e.length):l=e.length,a=o;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],r[2]=e[a+2],s(r,r,n),e[a]=r[0],e[a+1]=r[1],e[a+2]=r[2];return e}}();function ee(r,e=[],t=0){let o=Math.fround(r),i=r-o;return e[t]=o,e[t+1]=i,e}function ge(r){return r-Math.fround(r)}function xe(r){let e=new Float32Array(32);for(let t=0;t<4;++t)for(let o=0;o<4;++o){let i=t*4+o;ee(r[o*4+t],e,i*2)}return e}var ye=`
326
+ `,ar=["float32-renderable-webgl","texture-blend-float-webgl"];function We(r){return ar.every(e=>r.features.has(e))}function Ke(r,e){return e?r.createFramebuffer({width:1,height:1,colorAttachments:[r.createTexture({format:"rgba32float",dimension:"2d",width:1,height:1})]}):r.createFramebuffer({width:256,height:64,colorAttachments:[r.createTexture({format:"rgba8unorm",dimension:"2d",width:256,height:64})]})}function Ye(r,e,t,i){return t.defines.NON_INSTANCED_MODEL=1,i&&(t.defines.FLOAT_TARGET=1),new qe.Model(r,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,topology:"point-list",disableWarnings:!0,vs:or,fs:sr,bufferLayout:e,...t})}var $e={blend:!0,blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one",blendColorOperation:"add",blendAlphaOperation:"add",depthCompare:"never"};var lr={getFilterValue:{type:"accessor",value:0},getFilterCategory:{type:"accessor",value:0},onFilteredItemsChange:{type:"function",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterCategories:[0],filterTransformSize:!0,filterTransformColor:!0},fr={categorySize:0,filterSize:1,fp64:!1,countItems:!1},cr={1:"uint",2:"uvec2",3:"uvec3",4:"uvec4"},pr={1:"float",2:"vec2",3:"vec3",4:"vec4"},I=class extends E.LayerExtension{constructor(e={}){super({...fr,...e})}getShaders(e){let{categorySize:t,filterSize:i,fp64:o}=e.opts,s={};t&&(s.DATACATEGORY_TYPE=cr[t],s.DATACATEGORY_CHANNELS=t),i&&(s.DATAFILTER_TYPE=pr[i],s.DATAFILTER_DOUBLE=Boolean(o));let a=o?Ue:je;return a.uniformTypes=a.uniformTypesFromOptions(e.opts),{modules:[a],defines:s}}initializeState(e,t){let i=this.getAttributeManager(),{categorySize:o,filterSize:s,fp64:a}=t.opts;i&&(s&&i.add({filterValues:{size:s,type:a?"float64":"float32",stepMode:"dynamic",accessor:"getFilterValue"}}),o&&i.add({filterCategoryValues:{size:o,stepMode:"dynamic",accessor:"getFilterCategory",type:"uint32",transform:o===1?l=>t._getCategoryKey.call(this,l,0):l=>l.map((f,c)=>t._getCategoryKey.call(this,f,c))}}));let{device:n}=this.context;if(i&&t.opts.countItems){let l=We(n);i.add({filterVertexIndices:{size:l?1:2,vertexOffset:1,type:"unorm8",accessor:(p,{index:u})=>{let m=p&&p.__source?p.__source.index:u;return l?(m+1)%255:[(m+1)%255,Math.floor(m/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let f=Ke(n,l),c=Ye(n,i.getBufferLayouts({isInstanced:!1}),t.getShaders.call(this,t),l);this.setState({filterFBO:f,filterModel:c})}}updateState({props:e,oldProps:t,changeFlags:i},o){let s=this.getAttributeManager(),{categorySize:a}=o.opts;if(this.state.filterModel){let n=s.attributes.filterValues?.needsUpdate()||s.attributes.filterCategoryValues?.needsUpdate()||e.filterEnabled!==t.filterEnabled||e.filterRange!==t.filterRange||e.filterSoftRange!==t.filterSoftRange||e.filterCategories!==t.filterCategories;n&&this.setState({filterNeedsUpdate:n})}s?.attributes.filterCategoryValues&&((s.attributes.filterCategoryValues.needsUpdate()||!(0,E._deepEqual)(e.filterCategories,t.filterCategories,2))&&this.setState({categoryBitMask:null}),i.dataChanged&&(this.setState({categoryMap:Array(a).fill(0).map(()=>({}))}),s.attributes.filterCategoryValues.setNeedsUpdate("categoryMap")))}draw(e,t){let i=this.state.filterFBO,o=this.state.filterModel,s=this.state.filterNeedsUpdate;this.state.categoryBitMask||t._updateCategoryBitMask.call(this,e,t);let{onFilteredItemsChange:a,extensions:n,filterEnabled:l,filterRange:f,filterSoftRange:c,filterTransformSize:p,filterTransformColor:u,filterCategories:m}=this.props,v={extensions:n,filterEnabled:l,filterRange:f,filterSoftRange:c,filterTransformSize:p,filterTransformColor:u,filterCategories:m};if(this.state.categoryBitMask&&(v.categoryBitMask=this.state.categoryBitMask),this.setShaderModuleProps({dataFilter:v}),s&&a&&o){let b=this.getAttributeManager(),{attributes:{filterValues:h,filterCategoryValues:O,filterVertexIndices:fe}}=b;o.setVertexCount(this.getNumInstances());let ce={...h?.getValue(),...O?.getValue(),...fe?.getValue()};o.setAttributes(ce),o.shaderInputs.setProps({dataFilter:v});let pe=[0,0,i.width,i.height],Ee=o.device.beginRenderPass({id:"data-filter-aggregation",framebuffer:i,parameters:{viewport:pe},clearColor:[0,0,0,0]});o.setParameters($e),o.draw(Ee),Ee.end();let Me=o.device.readPixelsToArrayWebGL(i),Fe=0;for(let ue=0;ue<Me.length;ue++)Fe+=Me[ue];a({id:this.id,count:Fe}),this.state.filterNeedsUpdate=!1}}finalizeState(){let e=this.state.filterFBO,t=this.state.filterModel;e?.destroy(),t?.destroy()}_updateCategoryBitMask(e,t){let{categorySize:i}=t.opts;if(!i)return;let{filterCategories:o}=this.props,s=new Uint32Array([0,0,0,0]),a=i===1?[o]:o,n=i===1?128:i===2?64:32;for(let l=0;l<a.length;l++){let f=a[l];for(let c of f){let p=t._getCategoryKey.call(this,c,l);if(p<n){let u=l*(n/32)+Math.floor(p/32);s[u]+=Math.pow(2,p%32)}else E.log.warn(`Exceeded maximum number of categories (${n})`)()}}this.state.categoryBitMask=s}_getCategoryKey(e,t){let i=this.state.categoryMap[t];return e in i||(i[e]=Object.keys(i).length),i[e]}};I.defaultProps=lr;I.extensionName="DataFilterExtension";var Ze=I;var ft=d(_(),1);var $i=1/Math.PI*180,Zi=1/180*Math.PI,ur={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...ur}};var k=globalThis.mathgl.config;function de(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function M(r,e,t){let i=k.EPSILON;t&&(k.EPSILON=t);try{if(r===e)return!0;if(de(r)&&de(e)){if(r.length!==e.length)return!1;for(let o=0;o<r.length;++o)if(!M(r[o],e[o]))return!1;return!0}return r&&r.equals?r.equals(e):e&&e.equals?e.equals(r):typeof r=="number"&&typeof e=="number"?Math.abs(r-e)<=k.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{k.EPSILON=i}}var R=typeof Float32Array<"u"?Float32Array:Array,_e=Math.random;function Q(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}var Qi=Math.PI/180;var C={};Ae(C,{add:()=>gr,angle:()=>jr,bezier:()=>Rr,ceil:()=>xr,clone:()=>_r,copy:()=>hr,create:()=>Xe,cross:()=>Or,dist:()=>$r,distance:()=>rt,div:()=>Yr,divide:()=>tt,dot:()=>he,equals:()=>qr,exactEquals:()=>Hr,floor:()=>yr,forEach:()=>Jr,fromValues:()=>mr,hermite:()=>kr,inverse:()=>Ar,len:()=>Xr,length:()=>Qe,lerp:()=>Sr,max:()=>br,min:()=>Pr,mul:()=>Kr,multiply:()=>et,negate:()=>Tr,normalize:()=>Lr,random:()=>Cr,rotateX:()=>Dr,rotateY:()=>zr,rotateZ:()=>Vr,round:()=>Er,scale:()=>Mr,scaleAndAdd:()=>Fr,set:()=>vr,slerp:()=>Ir,sqrDist:()=>Zr,sqrLen:()=>Qr,squaredDistance:()=>it,squaredLength:()=>ot,str:()=>Gr,sub:()=>Wr,subtract:()=>Je,transformMat3:()=>Nr,transformMat4:()=>wr,transformQuat:()=>Br,zero:()=>Ur});function Xe(){let r=new R(3);return R!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function _r(r){let e=new R(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Qe(r){let e=r[0],t=r[1],i=r[2];return Math.sqrt(e*e+t*t+i*i)}function mr(r,e,t){let i=new R(3);return i[0]=r,i[1]=e,i[2]=t,i}function hr(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function vr(r,e,t,i){return r[0]=e,r[1]=t,r[2]=i,r}function gr(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function Je(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function et(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function tt(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function xr(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function yr(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function Pr(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function br(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function Er(r,e){return r[0]=Q(e[0]),r[1]=Q(e[1]),r[2]=Q(e[2]),r}function Mr(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function Fr(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r}function rt(r,e){let t=e[0]-r[0],i=e[1]-r[1],o=e[2]-r[2];return Math.sqrt(t*t+i*i+o*o)}function it(r,e){let t=e[0]-r[0],i=e[1]-r[1],o=e[2]-r[2];return t*t+i*i+o*o}function ot(r){let e=r[0],t=r[1],i=r[2];return e*e+t*t+i*i}function Tr(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function Ar(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function Lr(r,e){let t=e[0],i=e[1],o=e[2],s=t*t+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r}function he(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Or(r,e,t){let i=e[0],o=e[1],s=e[2],a=t[0],n=t[1],l=t[2];return r[0]=o*l-s*n,r[1]=s*a-i*l,r[2]=i*n-o*a,r}function Sr(r,e,t,i){let o=e[0],s=e[1],a=e[2];return r[0]=o+i*(t[0]-o),r[1]=s+i*(t[1]-s),r[2]=a+i*(t[2]-a),r}function Ir(r,e,t,i){let o=Math.acos(Math.min(Math.max(he(e,t),-1),1)),s=Math.sin(o),a=Math.sin((1-i)*o)/s,n=Math.sin(i*o)/s;return r[0]=a*e[0]+n*t[0],r[1]=a*e[1]+n*t[1],r[2]=a*e[2]+n*t[2],r}function kr(r,e,t,i,o,s){let a=s*s,n=a*(2*s-3)+1,l=a*(s-2)+s,f=a*(s-1),c=a*(3-2*s);return r[0]=e[0]*n+t[0]*l+i[0]*f+o[0]*c,r[1]=e[1]*n+t[1]*l+i[1]*f+o[1]*c,r[2]=e[2]*n+t[2]*l+i[2]*f+o[2]*c,r}function Rr(r,e,t,i,o,s){let a=1-s,n=a*a,l=s*s,f=n*a,c=3*s*n,p=3*l*a,u=l*s;return r[0]=e[0]*f+t[0]*c+i[0]*p+o[0]*u,r[1]=e[1]*f+t[1]*c+i[1]*p+o[1]*u,r[2]=e[2]*f+t[2]*c+i[2]*p+o[2]*u,r}function Cr(r,e){e=e===void 0?1:e;let t=_e()*2*Math.PI,i=_e()*2-1,o=Math.sqrt(1-i*i)*e;return r[0]=Math.cos(t)*o,r[1]=Math.sin(t)*o,r[2]=i*e,r}function wr(r,e,t){let i=e[0],o=e[1],s=e[2],a=t[3]*i+t[7]*o+t[11]*s+t[15];return a=a||1,r[0]=(t[0]*i+t[4]*o+t[8]*s+t[12])/a,r[1]=(t[1]*i+t[5]*o+t[9]*s+t[13])/a,r[2]=(t[2]*i+t[6]*o+t[10]*s+t[14])/a,r}function Nr(r,e,t){let i=e[0],o=e[1],s=e[2];return r[0]=i*t[0]+o*t[3]+s*t[6],r[1]=i*t[1]+o*t[4]+s*t[7],r[2]=i*t[2]+o*t[5]+s*t[8],r}function Br(r,e,t){let i=t[0],o=t[1],s=t[2],a=t[3],n=e[0],l=e[1],f=e[2],c=o*f-s*l,p=s*n-i*f,u=i*l-o*n,m=o*u-s*p,v=s*c-i*u,b=i*p-o*c,h=a*2;return c*=h,p*=h,u*=h,m*=2,v*=2,b*=2,r[0]=n+c+m,r[1]=l+p+v,r[2]=f+u+b,r}function Dr(r,e,t,i){let o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[0],s[1]=o[1]*Math.cos(i)-o[2]*Math.sin(i),s[2]=o[1]*Math.sin(i)+o[2]*Math.cos(i),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function zr(r,e,t,i){let o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[2]*Math.sin(i)+o[0]*Math.cos(i),s[1]=o[1],s[2]=o[2]*Math.cos(i)-o[0]*Math.sin(i),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Vr(r,e,t,i){let o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[0]*Math.cos(i)-o[1]*Math.sin(i),s[1]=o[0]*Math.sin(i)+o[1]*Math.cos(i),s[2]=o[2],r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function jr(r,e){let t=r[0],i=r[1],o=r[2],s=e[0],a=e[1],n=e[2],l=Math.sqrt((t*t+i*i+o*o)*(s*s+a*a+n*n)),f=l&&he(r,e)/l;return Math.acos(Math.min(Math.max(f,-1),1))}function Ur(r){return r[0]=0,r[1]=0,r[2]=0,r}function Gr(r){return`vec3(${r[0]}, ${r[1]}, ${r[2]})`}function Hr(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function qr(r,e){let t=r[0],i=r[1],o=r[2],s=e[0],a=e[1],n=e[2];return Math.abs(t-s)<=1e-6*Math.max(1,Math.abs(t),Math.abs(s))&&Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(o-n)<=1e-6*Math.max(1,Math.abs(o),Math.abs(n))}var Wr=Je,Kr=et,Yr=tt,$r=rt,Zr=it,Xr=Qe,Qr=ot,Jr=function(){let r=Xe();return function(e,t,i,o,s,a){let n,l;for(t||(t=3),i||(i=0),o?l=Math.min(o*t+i,e.length):l=e.length,n=i;n<l;n+=t)r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],s(r,r,a),e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2];return e}}();function J(r,e=[],t=0){let i=Math.fround(r),o=r-i;return e[t]=i,e[t+1]=o,e}function ve(r){return r-Math.fround(r)}function ge(r){let e=new Float32Array(32);for(let t=0;t<4;++t)for(let i=0;i<4;++i){let o=t*4+i;J(r[i*4+t],e,o*2)}return e}var xe=`
327
327
  layout(std140) uniform fp64arithmeticUniforms {
328
328
  uniform float ONE;
329
329
  uniform float SPLIT;
@@ -522,7 +522,7 @@ vec2 sqrt_fp64(vec2 a) {
522
522
  return sum_fp64(vec2(yn, 0.0), prod);
523
523
  #endif
524
524
  }
525
- `;var nt=`struct Fp64ArithmeticUniforms {
525
+ `;var st=`struct Fp64ArithmeticUniforms {
526
526
  ONE: f32,
527
527
  SPLIT: f32,
528
528
  };
@@ -1397,7 +1397,7 @@ void mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) {
1397
1397
  vec4_dot_fp64(a, tmp, out_val[i]);
1398
1398
  }
1399
1399
  }
1400
- `;var Qr={ONE:1,SPLIT:4097},lt={name:"fp64arithmetic",source:nt,fs:ye,vs:ye,defaultUniforms:Qr,uniformTypes:{ONE:"f32",SPLIT:"f32"},fp64ify:ee,fp64LowPart:ge,fp64ifyMatrix4:xe},te={name:"fp64",vs:at,dependencies:[lt],fp64ify:ee,fp64LowPart:ge,fp64ifyMatrix4:xe};var re=d(_(),1);var ft=`const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
1400
+ `;var ei={ONE:1,SPLIT:4097},nt={name:"fp64arithmetic",source:st,fs:xe,vs:xe,defaultUniforms:ei,uniformTypes:{ONE:"f32",SPLIT:"f32"},fp64ify:J,fp64LowPart:ve,fp64ifyMatrix4:ge},ee={name:"fp64",vs:at,dependencies:[nt],fp64ify:J,fp64LowPart:ve,fp64ifyMatrix4:ge};var te=d(_(),1);var lt=`const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
1401
1401
  layout(std140) uniform project64Uniforms {
1402
1402
  vec2 scale;
1403
1403
  mat4 viewProjectionMatrix;
@@ -1470,7 +1470,7 @@ return project_position_to_clipspace(
1470
1470
  position, position64xyLow, offset, commonPosition
1471
1471
  );
1472
1472
  }
1473
- `;var{fp64ify:Jr,fp64ifyMatrix4:eo}=te,oe={name:"project64",dependencies:[re.project,te],vs:ft,getUniforms:ro,uniformTypes:{scale:"vec2<f32>",viewProjectionMatrix:"mat4x4<f32>",viewProjectionMatrix64Low:"mat4x4<f32>"}},to=(0,re._memoize)(oo);function ro(r){if(r&&"viewport"in r){let{viewProjectionMatrix:e,scale:t}=r.viewport;return to({viewProjectionMatrix:e,scale:t})}return{}}function oo({viewProjectionMatrix:r,scale:e}){let t=eo(r),o=new Float32Array(16),i=new Float32Array(16);for(let s=0;s<4;s++)for(let n=0;n<4;n++){let a=4*s+n,l=4*n+s;o[l]=t[2*a],i[l]=t[2*a+1]}return{scale:Jr(e),viewProjectionMatrix:[...o],viewProjectionMatrix64Low:[...i]}}var ie=class extends N.LayerExtension{getShaders(){let{coordinateSystem:e}=this.props;if(e!==N.COORDINATE_SYSTEM.LNGLAT&&e!==N.COORDINATE_SYSTEM.DEFAULT)throw new Error("fp64: coordinateSystem must be LNGLAT");return{modules:[oe]}}draw(e,t){let{viewport:o}=e.context;this.setShaderModuleProps({project64:{viewport:o}})}};ie.extensionName="Fp64Extension";var ct=ie;var w=d(_(),1);var pt={inject:{"vs:#decl":`
1473
+ `;var{fp64ify:ti,fp64ifyMatrix4:ri}=ee,re={name:"project64",dependencies:[te.project,ee],vs:lt,getUniforms:oi,uniformTypes:{scale:"vec2<f32>",viewProjectionMatrix:"mat4x4<f32>",viewProjectionMatrix64Low:"mat4x4<f32>"}},ii=(0,te._memoize)(si);function oi(r){if(r&&"viewport"in r){let{viewProjectionMatrix:e,scale:t}=r.viewport;return ii({viewProjectionMatrix:e,scale:t})}return{}}function si({viewProjectionMatrix:r,scale:e}){let t=ri(r),i=new Float32Array(16),o=new Float32Array(16);for(let s=0;s<4;s++)for(let a=0;a<4;a++){let n=4*s+a,l=4*a+s;i[l]=t[2*n],o[l]=t[2*n+1]}return{scale:ti(e),viewProjectionMatrix:[...i],viewProjectionMatrix64Low:[...o]}}var ie=class extends ft.LayerExtension{getShaders(){let{coordinateSystem:e}=this.props;if(e!=="lnglat"&&e!=="default")throw new Error("fp64: coordinateSystem must be LNGLAT");return{modules:[re]}}draw(e,t){let{viewport:i}=e.context;this.setShaderModuleProps({project64:{viewport:i}})}};ie.extensionName="Fp64Extension";var ct=ie;var w=d(_(),1);var pt={inject:{"vs:#decl":`
1474
1474
  in vec2 instanceDashArrays;
1475
1475
  #ifdef HIGH_PRECISION_DASH
1476
1476
  in float instanceDashOffsets;
@@ -1523,6 +1523,170 @@ discard;
1523
1523
  }
1524
1524
  }
1525
1525
  `}},ut={inject:{"vs:#decl":`
1526
+ in vec2 instanceDashArrays;
1527
+ out vec2 vDashArray;
1528
+ `,"vs:#main-end":`
1529
+ vDashArray = instanceDashArrays;
1530
+ `,"fs:#decl":`
1531
+ layout(std140) uniform pathStyleUniforms {
1532
+ bool dashGapPickable;
1533
+ } pathStyle;
1534
+ in vec2 vDashArray;
1535
+ #define PI 3.141592653589793
1536
+ `,"fs:#main-start":`
1537
+ bool inDashGap = false;
1538
+ float dashUnitLength = vDashArray.x + vDashArray.y;
1539
+ if (dashUnitLength > 0.0 && scatterplot.stroked > 0.5) {
1540
+ float _distToCenter = length(unitPosition) * outerRadiusPixels;
1541
+ float innerRadius = innerUnitRadius * outerRadiusPixels;
1542
+ if (_distToCenter >= innerRadius) {
1543
+ float strokeWidth = (1.0 - innerUnitRadius) * outerRadiusPixels;
1544
+ float midStrokeRadius = (innerUnitRadius + 1.0) * 0.5 * outerRadiusPixels;
1545
+ float angle = atan(unitPosition.y, unitPosition.x) + PI;
1546
+ float circumference = 2.0 * PI * midStrokeRadius;
1547
+ float posAlongStroke = (angle / (2.0 * PI)) * circumference / strokeWidth;
1548
+ float unitOffset = mod(posAlongStroke, dashUnitLength);
1549
+ if (unitOffset > vDashArray.x) {
1550
+ if (scatterplot.filled > 0.5) {
1551
+ inDashGap = true;
1552
+ } else {
1553
+ if (!(pathStyle.dashGapPickable && bool(picking.isActive))) {
1554
+ discard;
1555
+ }
1556
+ }
1557
+ }
1558
+ }
1559
+ }
1560
+ `,"fs:#main-end":`
1561
+ if (inDashGap) {
1562
+ float alphaFactor = fragColor.a / max(vLineColor.a, 0.001);
1563
+ fragColor = vec4(vFillColor.rgb, vFillColor.a * alphaFactor);
1564
+ fragColor = picking_filterPickingColor(fragColor);
1565
+ fragColor = picking_filterHighlightColor(fragColor);
1566
+ }
1567
+ `}},dt={inject:{"vs:#decl":`
1568
+ in vec2 instanceDashArrays;
1569
+ out vec2 vDashArray;
1570
+ `,"vs:#main-end":`
1571
+ vDashArray = instanceDashArrays;
1572
+ `,"fs:#decl":`
1573
+ layout(std140) uniform pathStyleUniforms {
1574
+ bool dashGapPickable;
1575
+ } pathStyle;
1576
+ in vec2 vDashArray;
1577
+ #define PI 3.141592653589793
1578
+ float getPerimeterPosition(vec2 fragUV, vec2 dims, vec4 radii, float lineWidth) {
1579
+ float width = dims.x;
1580
+ float height = dims.y;
1581
+ float maxRadius = min(width, height) * 0.5;
1582
+ float rBL = min(radii.w, maxRadius);
1583
+ float rTL = min(radii.z, maxRadius);
1584
+ float rTR = min(radii.x, maxRadius);
1585
+ float rBR = min(radii.y, maxRadius);
1586
+ vec2 p = fragUV * dims;
1587
+ float leftLen = height - rBL - rTL;
1588
+ float topLen = width - rTL - rTR;
1589
+ float rightLen = height - rTR - rBR;
1590
+ float bottomLen = width - rBR - rBL;
1591
+ float arcBL = PI * 0.5 * rBL;
1592
+ float arcTL = PI * 0.5 * rTL;
1593
+ float arcTR = PI * 0.5 * rTR;
1594
+ float arcBR = PI * 0.5 * rBR;
1595
+ float pos = 0.0;
1596
+ float distLeft = p.x;
1597
+ float distRight = width - p.x;
1598
+ float distBottom = p.y;
1599
+ float distTop = height - p.y;
1600
+ float minDist = min(min(distLeft, distRight), min(distBottom, distTop));
1601
+ if (p.x < rBL && p.y < rBL) {
1602
+ vec2 c = vec2(rBL, rBL);
1603
+ vec2 d = p - c;
1604
+ float angle = atan(-d.x, -d.y);
1605
+ pos = angle / (PI * 0.5) * arcBL;
1606
+ } else if (p.x < rTL && p.y > height - rTL) {
1607
+ vec2 c = vec2(rTL, height - rTL);
1608
+ vec2 d = p - c;
1609
+ float angle = atan(d.y, -d.x);
1610
+ pos = arcBL + leftLen + angle / (PI * 0.5) * arcTL;
1611
+ } else if (p.x > width - rTR && p.y > height - rTR) {
1612
+ vec2 c = vec2(width - rTR, height - rTR);
1613
+ vec2 d = p - c;
1614
+ float angle = atan(d.x, d.y);
1615
+ pos = arcBL + leftLen + arcTL + topLen + angle / (PI * 0.5) * arcTR;
1616
+ } else if (p.x > width - rBR && p.y < rBR) {
1617
+ vec2 c = vec2(width - rBR, rBR);
1618
+ vec2 d = p - c;
1619
+ float angle = atan(-d.y, d.x);
1620
+ pos = arcBL + leftLen + arcTL + topLen + arcTR + rightLen + angle / (PI * 0.5) * arcBR;
1621
+ } else if (minDist == distLeft) {
1622
+ pos = arcBL + clamp(p.y - rBL, 0.0, leftLen);
1623
+ } else if (minDist == distTop) {
1624
+ pos = arcBL + leftLen + arcTL + clamp(p.x - rTL, 0.0, topLen);
1625
+ } else if (minDist == distRight) {
1626
+ pos = arcBL + leftLen + arcTL + topLen + arcTR + clamp(height - rTR - p.y, 0.0, rightLen);
1627
+ } else {
1628
+ pos = arcBL + leftLen + arcTL + topLen + arcTR + rightLen + arcBR + clamp(width - rBR - p.x, 0.0, bottomLen);
1629
+ }
1630
+ return pos / lineWidth;
1631
+ }
1632
+ float getRectPerimeterPosition(vec2 fragUV, vec2 dims, float lineWidth) {
1633
+ float width = dims.x;
1634
+ float height = dims.y;
1635
+ float distLeft = fragUV.x * width;
1636
+ float distRight = (1.0 - fragUV.x) * width;
1637
+ float distBottom = fragUV.y * height;
1638
+ float distTop = (1.0 - fragUV.y) * height;
1639
+ float minDist = min(min(distLeft, distRight), min(distBottom, distTop));
1640
+ float pos = 0.0;
1641
+ if (minDist == distLeft) {
1642
+ pos = fragUV.y * height;
1643
+ } else if (minDist == distTop) {
1644
+ pos = height + fragUV.x * width;
1645
+ } else if (minDist == distRight) {
1646
+ pos = height + width + (1.0 - fragUV.y) * height;
1647
+ } else {
1648
+ pos = 2.0 * height + width + (1.0 - fragUV.x) * width;
1649
+ }
1650
+ return pos / lineWidth;
1651
+ }
1652
+ `,"fs:#main-start":`
1653
+ bool inDashGap = false;
1654
+ float dashUnitLength = vDashArray.x + vDashArray.y;
1655
+ if (dashUnitLength > 0.0 && textBackground.stroked) {
1656
+ float distToEdge;
1657
+ bool hasRoundedCorners = textBackground.borderRadius != vec4(0.0);
1658
+ if (hasRoundedCorners) {
1659
+ distToEdge = round_rect(uv, dimensions, textBackground.borderRadius);
1660
+ } else {
1661
+ distToEdge = rect(uv, dimensions);
1662
+ }
1663
+ if (distToEdge <= vLineWidth && distToEdge >= 0.0) {
1664
+ float posAlongStroke;
1665
+ if (hasRoundedCorners) {
1666
+ posAlongStroke = getPerimeterPosition(uv, dimensions, textBackground.borderRadius, vLineWidth);
1667
+ } else {
1668
+ posAlongStroke = getRectPerimeterPosition(uv, dimensions, vLineWidth);
1669
+ }
1670
+ float unitOffset = mod(posAlongStroke, dashUnitLength);
1671
+ if (unitOffset > vDashArray.x) {
1672
+ if (vFillColor.a > 0.0) {
1673
+ inDashGap = true;
1674
+ } else {
1675
+ if (!(pathStyle.dashGapPickable && bool(picking.isActive))) {
1676
+ discard;
1677
+ }
1678
+ }
1679
+ }
1680
+ }
1681
+ }
1682
+ `,"fs:#main-end":`
1683
+ if (inDashGap) {
1684
+ float alphaFactor = fragColor.a / max(vLineColor.a, 0.001);
1685
+ fragColor = vec4(vFillColor.rgb, vFillColor.a * alphaFactor);
1686
+ fragColor = picking_filterPickingColor(fragColor);
1687
+ fragColor = picking_filterHighlightColor(fragColor);
1688
+ }
1689
+ `}},_t={inject:{"vs:#decl":`
1526
1690
  in float instanceOffsets;
1527
1691
  `,"vs:DECKGL_FILTER_SIZE":`
1528
1692
  float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
@@ -1539,14 +1703,14 @@ isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
1539
1703
  if (isInside == 0.0) {
1540
1704
  discard;
1541
1705
  }
1542
- `}};var io={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},B=class extends w.LayerExtension{constructor({dash:e=!1,offset:t=!1,highPrecisionDash:o=!1}={}){super({dash:e||o,offset:t,highPrecisionDash:o})}isEnabled(e){return"pathTesselator"in e.state}getShaders(e){if(!e.isEnabled(this))return null;let t={},o={};e.opts.dash&&(t=(0,w._mergeShaders)(t,pt),e.opts.highPrecisionDash&&(o.HIGH_PRECISION_DASH=!0)),e.opts.offset&&(t=(0,w._mergeShaders)(t,ut));let{inject:i}=t;return{modules:[{name:"pathStyle",inject:i,uniformTypes:{dashAlignMode:"f32",dashGapPickable:"i32"}}],defines:o}}initializeState(e,t){let o=this.getAttributeManager();!o||!t.isEnabled(this)||(t.opts.dash&&o.addInstanced({instanceDashArrays:{size:2,accessor:"getDashArray"},...t.opts.highPrecisionDash?{instanceDashOffsets:{size:1,accessor:"getPath",transform:t.getDashOffsets.bind(this)}}:{}}),t.opts.offset&&o.addInstanced({instanceOffsets:{size:1,accessor:"getOffset"}}))}updateState(e,t){if(t.isEnabled(this)&&t.opts.dash){let o={dashAlignMode:this.props.dashJustified?1:0,dashGapPickable:Boolean(this.props.dashGapPickable)};this.setShaderModuleProps({pathStyle:o})}}getDashOffsets(e){let t=[0],o=this.props.positionFormat==="XY"?2:3,i=Array.isArray(e[0]),s=i?e.length:e.length/o,n,a;for(let l=0;l<s-1;l++)n=i?e[l]:e.slice(l*o,l*o+o),n=this.projectPosition(n),l>0&&(t[l]=t[l-1]+R.dist(a,n)),a=n;return t[s-1]=0,t}};B.defaultProps=io;B.extensionName="PathStyleExtension";var dt=B;var ht=d(_(),1);var F=d(_(),1),_t=`layout(std140) uniform fillUniforms {
1706
+ `}};var ai={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},N=class extends w.LayerExtension{constructor({dash:e=!1,offset:t=!1,highPrecisionDash:i=!1}={}){super({dash:e||i,offset:t,highPrecisionDash:i})}getLayerType(e){if("pathTesselator"in e.state)return"path";let t=e.constructor.layerName;return t==="ScatterplotLayer"?"scatterplot":t==="TextBackgroundLayer"?"textBackground":null}isEnabled(e){return this.getLayerType(e)!==null}getShaders(e){let t=e.getLayerType(this);if(!t)return null;if(t==="scatterplot"||t==="textBackground")return e.opts.dash?{modules:[{name:"pathStyle",inject:t==="scatterplot"?ut.inject:dt.inject,uniformTypes:{dashGapPickable:"i32"}}]}:null;let i={},o={};e.opts.dash&&(i=(0,w._mergeShaders)(i,pt),e.opts.highPrecisionDash&&(o.HIGH_PRECISION_DASH=!0)),e.opts.offset&&(i=(0,w._mergeShaders)(i,_t));let{inject:s}=i;return{modules:[{name:"pathStyle",inject:s,uniformTypes:{dashAlignMode:"f32",dashGapPickable:"i32"}}],defines:o}}initializeState(e,t){let i=this.getAttributeManager(),o=t.getLayerType(this);!i||!o||(t.opts.dash&&i.addInstanced({instanceDashArrays:{size:2,accessor:"getDashArray"},...o==="path"&&t.opts.highPrecisionDash?{instanceDashOffsets:{size:1,accessor:"getPath",transform:t.getDashOffsets.bind(this)}}:{}}),o==="path"&&t.opts.offset&&i.addInstanced({instanceOffsets:{size:1,accessor:"getOffset"}}))}updateState(e,t){if(t.isEnabled(this)&&t.opts.dash){let i=t.getLayerType(this);if(i==="scatterplot"||i==="textBackground"){let o={dashGapPickable:Boolean(this.props.dashGapPickable)};this.setShaderModuleProps({pathStyle:o})}else{let o={dashAlignMode:this.props.dashJustified?1:0,dashGapPickable:Boolean(this.props.dashGapPickable)};this.setShaderModuleProps({pathStyle:o})}}}getDashOffsets(e){let t=[0],i=this.props.positionFormat==="XY"?2:3,o=Array.isArray(e[0]),s=o?e.length:e.length/i,a,n;for(let l=0;l<s-1;l++)a=o?e[l]:e.slice(l*i,l*i+i),a=this.projectPosition(a),l>0&&(t[l]=t[l-1]+C.dist(n,a)),n=a;return t[s-1]=0,t}};N.defaultProps=ai;N.extensionName="PathStyleExtension";var mt=N;var gt=d(_(),1);var F=d(_(),1),ht=`layout(std140) uniform fillUniforms {
1543
1707
  vec2 patternTextureSize;
1544
1708
  bool patternEnabled;
1545
1709
  bool patternMask;
1546
1710
  vec2 uvCoordinateOrigin;
1547
1711
  vec2 uvCoordinateOrigin64Low;
1548
1712
  } fill;
1549
- `,so=`
1713
+ `,ni=`
1550
1714
  in vec4 fillPatternFrames;
1551
1715
  in float fillPatternScales;
1552
1716
  in vec2 fillPatternOffsets;
@@ -1554,10 +1718,10 @@ in vec2 fillPatternOffsets;
1554
1718
  out vec2 fill_uv;
1555
1719
  out vec4 fill_patternBounds;
1556
1720
  out vec4 fill_patternPlacement;
1557
- `,no=`
1558
- ${_t}
1559
- ${so}
1560
- `,ao=`
1721
+ `,li=`
1722
+ ${ht}
1723
+ ${ni}
1724
+ `,fi=`
1561
1725
  uniform sampler2D fill_patternTexture;
1562
1726
 
1563
1727
  in vec4 fill_patternBounds;
@@ -1565,10 +1729,10 @@ in vec4 fill_patternPlacement;
1565
1729
  in vec2 fill_uv;
1566
1730
 
1567
1731
  const float FILL_UV_SCALE = 512.0 / 40000000.0;
1568
- `,lo=`
1569
- ${_t}
1570
- ${ao}
1571
- `,fo={"vs:DECKGL_FILTER_GL_POSITION":`
1732
+ `,ci=`
1733
+ ${ht}
1734
+ ${fi}
1735
+ `,pi={"vs:DECKGL_FILTER_GL_POSITION":`
1572
1736
  fill_uv = geometry.position.xy;
1573
1737
  `,"vs:DECKGL_FILTER_COLOR":`
1574
1738
  if (fill.patternEnabled) {
@@ -1590,7 +1754,7 @@ ${ao}
1590
1754
  color.rgb = patternColor.rgb;
1591
1755
  }
1592
1756
  }
1593
- `};function co(r){if(!r)return{};let e={};if("fillPatternTexture"in r){let{fillPatternTexture:t}=r;e.fill_patternTexture=t,e.patternTextureSize=[t.width,t.height]}if("project"in r){let{fillPatternMask:t=!0,fillPatternEnabled:o=!0}=r,i=F.project.getUniforms(r.project),{commonOrigin:s}=i,n=[(0,F.fp64LowPart)(s[0]),(0,F.fp64LowPart)(s[1])];e.uvCoordinateOrigin=s.slice(0,2),e.uvCoordinateOrigin64Low=n,e.patternMask=t,e.patternEnabled=o}return e}var mt={name:"fill",vs:no,fs:lo,inject:fo,dependencies:[F.project],getUniforms:co,uniformTypes:{patternTextureSize:"vec2<f32>",patternEnabled:"i32",patternMask:"i32",uvCoordinateOrigin:"vec2<f32>",uvCoordinateOrigin64Low:"vec2<f32>"}};var po={fillPatternEnabled:!0,fillPatternAtlas:{type:"image",value:null,async:!0,parameters:{lodMaxClamp:0}},fillPatternMapping:{type:"object",value:{},async:!0},fillPatternMask:!0,getFillPattern:{type:"accessor",value:r=>r.pattern},getFillPatternScale:{type:"accessor",value:1},getFillPatternOffset:{type:"accessor",value:[0,0]}},D=class extends ht.LayerExtension{constructor({pattern:e=!1}={}){super({pattern:e})}isEnabled(e){return e.getAttributeManager()!==null&&!("pathTesselator"in e.state)}getShaders(e){return e.isEnabled(this)?{modules:[e.opts.pattern&&mt].filter(Boolean)}:null}initializeState(e,t){if(!t.isEnabled(this))return;let o=this.getAttributeManager();t.opts.pattern&&o.add({fillPatternFrames:{size:4,stepMode:"dynamic",accessor:"getFillPattern",transform:t.getPatternFrame.bind(this)},fillPatternScales:{size:1,stepMode:"dynamic",accessor:"getFillPatternScale",defaultValue:1},fillPatternOffsets:{size:2,stepMode:"dynamic",accessor:"getFillPatternOffset"}}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState({props:e,oldProps:t},o){o.isEnabled(this)&&e.fillPatternMapping&&e.fillPatternMapping!==t.fillPatternMapping&&this.getAttributeManager().invalidate("getFillPattern")}draw(e,t){if(!t.isEnabled(this))return;let{fillPatternAtlas:o,fillPatternEnabled:i,fillPatternMask:s}=this.props,n={project:e.shaderModuleProps.project,fillPatternEnabled:i,fillPatternMask:s,fillPatternTexture:o||this.state.emptyTexture};this.setShaderModuleProps({fill:n})}finalizeState(){this.state.emptyTexture?.delete()}getPatternFrame(e){let{fillPatternMapping:t}=this.getCurrentLayer().props,o=t&&t[e];return o?[o.x,o.y,o.width,o.height]:[0,0,0,0]}};D.defaultProps=po;D.extensionName="FillStyleExtension";var vt=D;var gt=d(_(),1),uo={clipBounds:[0,0,1,1],clipByInstance:void 0},xt=`
1757
+ `};function ui(r){if(!r)return{};let e={};if("fillPatternTexture"in r){let{fillPatternTexture:t}=r;e.fill_patternTexture=t,e.patternTextureSize=[t.width,t.height]}if("project"in r){let{fillPatternMask:t=!0,fillPatternEnabled:i=!0}=r,o=F.project.getUniforms(r.project),{commonOrigin:s}=o,a=[(0,F.fp64LowPart)(s[0]),(0,F.fp64LowPart)(s[1])];e.uvCoordinateOrigin=s.slice(0,2),e.uvCoordinateOrigin64Low=a,e.patternMask=t,e.patternEnabled=i}return e}var vt={name:"fill",vs:li,fs:ci,inject:pi,dependencies:[F.project],getUniforms:ui,uniformTypes:{patternTextureSize:"vec2<f32>",patternEnabled:"i32",patternMask:"i32",uvCoordinateOrigin:"vec2<f32>",uvCoordinateOrigin64Low:"vec2<f32>"}};var di={fillPatternEnabled:!0,fillPatternAtlas:{type:"image",value:null,async:!0,parameters:{lodMaxClamp:0}},fillPatternMapping:{type:"object",value:{},async:!0},fillPatternMask:!0,getFillPattern:{type:"accessor",value:r=>r.pattern},getFillPatternScale:{type:"accessor",value:1},getFillPatternOffset:{type:"accessor",value:[0,0]}},B=class extends gt.LayerExtension{constructor({pattern:e=!1}={}){super({pattern:e})}isEnabled(e){return e.getAttributeManager()!==null&&!("pathTesselator"in e.state)}getShaders(e){return e.isEnabled(this)?{modules:[e.opts.pattern&&vt].filter(Boolean)}:null}initializeState(e,t){if(!t.isEnabled(this))return;let i=this.getAttributeManager();t.opts.pattern&&i.add({fillPatternFrames:{size:4,stepMode:"dynamic",accessor:"getFillPattern",transform:t.getPatternFrame.bind(this)},fillPatternScales:{size:1,stepMode:"dynamic",accessor:"getFillPatternScale",defaultValue:1},fillPatternOffsets:{size:2,stepMode:"dynamic",accessor:"getFillPatternOffset"}}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState({props:e,oldProps:t},i){i.isEnabled(this)&&e.fillPatternMapping&&e.fillPatternMapping!==t.fillPatternMapping&&this.getAttributeManager().invalidate("getFillPattern")}draw(e,t){if(!t.isEnabled(this))return;let{fillPatternAtlas:i,fillPatternEnabled:o,fillPatternMask:s}=this.props,a={project:e.shaderModuleProps.project,fillPatternEnabled:o,fillPatternMask:s,fillPatternTexture:i||this.state.emptyTexture};this.setShaderModuleProps({fill:a})}finalizeState(){this.state.emptyTexture?.delete()}getPatternFrame(e){let{fillPatternMapping:t}=this.getCurrentLayer().props,i=t&&t[e];return i?[i.x,i.y,i.width,i.height]:[0,0,0,0]}};B.defaultProps=di;B.extensionName="FillStyleExtension";var xt=B;var yt=d(_(),1),_i={clipBounds:[0,0,1,1],clipByInstance:void 0},Pt=`
1594
1758
  layout(std140) uniform clipUniforms {
1595
1759
  vec4 bounds;
1596
1760
  } clip;
@@ -1598,7 +1762,7 @@ layout(std140) uniform clipUniforms {
1598
1762
  bool clip_isInBounds(vec2 position) {
1599
1763
  return position.x >= clip.bounds[0] && position.y >= clip.bounds[1] && position.x < clip.bounds[2] && position.y < clip.bounds[3];
1600
1764
  }
1601
- `,_o={name:"clip",vs:xt,uniformTypes:{bounds:"vec4<f32>"}},mo={"vs:#decl":`
1765
+ `,mi={name:"clip",vs:Pt,uniformTypes:{bounds:"vec4<f32>"}},hi={"vs:#decl":`
1602
1766
  out float clip_isVisible;
1603
1767
  `,"vs:DECKGL_FILTER_GL_POSITION":`
1604
1768
  clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
@@ -1606,7 +1770,7 @@ out float clip_isVisible;
1606
1770
  in float clip_isVisible;
1607
1771
  `,"fs:DECKGL_FILTER_COLOR":`
1608
1772
  if (clip_isVisible < 0.5) discard;
1609
- `},ho={name:"clip",fs:xt,uniformTypes:{bounds:"vec4<f32>"}},vo={"vs:#decl":`
1773
+ `},vi={name:"clip",fs:Pt,uniformTypes:{bounds:"vec4<f32>"}},gi={"vs:#decl":`
1610
1774
  out vec2 clip_commonPosition;
1611
1775
  `,"vs:DECKGL_FILTER_GL_POSITION":`
1612
1776
  clip_commonPosition = geometry.position.xy;
@@ -1614,7 +1778,7 @@ out vec2 clip_commonPosition;
1614
1778
  in vec2 clip_commonPosition;
1615
1779
  `,"fs:DECKGL_FILTER_COLOR":`
1616
1780
  if (!clip_isInBounds(clip_commonPosition)) discard;
1617
- `},z=class extends gt.LayerExtension{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[_o],inject:mo}:{modules:[ho],inject:vo}}draw(){let{clipBounds:e}=this.props,t={};if(this.state.clipByInstance)t.bounds=e;else{let o=this.projectPosition([e[0],e[1],0]),i=this.projectPosition([e[2],e[3],0]);t.bounds=[Math.min(o[0],i[0]),Math.min(o[1],i[1]),Math.max(o[0],i[0]),Math.max(o[1],i[1])]}this.setShaderModuleProps({clip:t})}};z.defaultProps=uo;z.extensionName="ClipExtension";var yt=z;var Ft=d(_(),1);var Pt=d(_(),1),go=`
1781
+ `},D=class extends yt.LayerExtension{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[mi],inject:hi}:{modules:[vi],inject:gi}}draw(){let{clipBounds:e}=this.props,t={};if(this.state.clipByInstance)t.bounds=e;else{let i=this.projectPosition([e[0],e[1],0]),o=this.projectPosition([e[2],e[3],0]);t.bounds=[Math.min(i[0],o[0]),Math.min(i[1],o[1]),Math.max(i[0],o[0]),Math.max(i[1],o[1])]}this.setShaderModuleProps({clip:t})}};D.defaultProps=_i;D.extensionName="ClipExtension";var bt=D;var At=d(_(),1);var Et=d(_(),1),xi=`
1618
1782
  in float collisionPriorities;
1619
1783
 
1620
1784
  uniform sampler2D collision_texture;
@@ -1662,7 +1826,7 @@ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
1662
1826
  float W = 2.0 * floatN + 1.0;
1663
1827
  return pow(accumulator / (W * W), 2.2);
1664
1828
  }
1665
- `,xo={"vs:#decl":`
1829
+ `,yi={"vs:#decl":`
1666
1830
  float collision_fade = 1.0;
1667
1831
  `,"vs:DECKGL_FILTER_GL_POSITION":`
1668
1832
  if (collision.sort) {
@@ -1681,21 +1845,21 @@ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
1681
1845
  }
1682
1846
  `,"vs:DECKGL_FILTER_COLOR":`
1683
1847
  color.a *= collision_fade;
1684
- `},yo=r=>{if(!r||!("dummyCollisionMap"in r))return{};let{enabled:e,collisionFBO:t,drawToCollisionMap:o,dummyCollisionMap:i}=r;return{enabled:e&&!o,sort:Boolean(o),collision_texture:!o&&t?t.colorAttachments[0]:i}},bt={name:"collision",dependencies:[Pt.project],vs:go,inject:xo,getUniforms:yo,uniformTypes:{sort:"i32",enabled:"i32"}};var Mt=d(_(),1);var Et=d(_(),1),V=class extends Et._LayersPass{renderCollisionMap(e,t){let i=[0,0,0,0],s=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:i,scissorRect:s,target:e,pass:"collision"})}getLayerParameters(e,t,o){return{...e.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}getShaderModuleProps(){return{collision:{drawToCollisionMap:!0},picking:{isActive:1,isAttribute:!1},lighting:{enabled:!1}}}};var Pe=2,j=class{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}setup(e){this.context=e;let{device:t}=e;this.dummyCollisionMap=t.createTexture({width:1,height:1}),this.collisionFilterPass=new V(t,{id:"default-collision-filter"})}preRender({effects:e,layers:t,layerFilter:o,viewports:i,onViewportActive:s,views:n,isPicking:a,preRenderStats:l={}}){let{device:f}=this.context;if(a)return;let c=t.filter(({props:{visible:h,collisionEnabled:S}})=>h&&S);if(c.length===0){this.channels={};return}let p=e?.filter(h=>h.useInPicking&&l[h.id]),u=l["mask-effect"]?.didRender,m=this._groupByCollisionGroup(f,c),v=i[0],b=!this.lastViewport||!this.lastViewport.equals(v)||u;for(let h in m){let S=this.collisionFBOs[h],ce=m[h],[pe,ue]=f.canvasContext.getPixelSize();S.resize({width:pe/Pe,height:ue/Pe}),this._render(ce,{effects:p,layerFilter:o,onViewportActive:s,views:n,viewport:v,viewportChanged:b})}}_render(e,{effects:t,layerFilter:o,onViewportActive:i,views:s,viewport:n,viewportChanged:a}){let{collisionGroup:l}=e,f=this.channels[l];if(!f)return;let c=a||e===f||!(0,Mt._deepEqual)(f.layers,e.layers,1)||e.layerBounds.some((p,u)=>!M(p,f.layerBounds[u]))||e.allLayersLoaded!==f.allLayersLoaded||e.layers.some(p=>p.props.transitions);if(this.channels[l]=e,c){this.lastViewport=n;let p=this.collisionFBOs[l];this.collisionFilterPass.renderCollisionMap(p,{pass:"collision-filter",isPicking:!0,layers:e.layers,effects:t,layerFilter:o,viewports:n?[n]:[],onViewportActive:i,views:s,shaderModuleProps:{collision:{enabled:!0,dummyCollisionMap:this.dummyCollisionMap},project:{devicePixelRatio:p.device.canvasContext.getDevicePixelRatio()/Pe}}})}}_groupByCollisionGroup(e,t){let o={};for(let i of t){let s=i.props.collisionGroup,n=o[s];n||(n={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},o[s]=n),n.layers.push(i),n.layerBounds.push(i.getBounds()),i.isLoaded||(n.allLayersLoaded=!1)}for(let i of Object.keys(o))this.collisionFBOs[i]||this.createFBO(e,i),this.channels[i]||(this.channels[i]=o[i]);for(let i of Object.keys(this.collisionFBOs))o[i]||this.destroyFBO(i);return o}getShaderModuleProps(e){let{collisionGroup:t,collisionEnabled:o}=e.props,{collisionFBOs:i,dummyCollisionMap:s}=this,n=i[t];return{collision:{enabled:o&&Boolean(n),collisionFBO:n,dummyCollisionMap:s}}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let e of Object.keys(this.collisionFBOs))this.destroyFBO(e);this.collisionFBOs={},this.lastViewport=void 0}createFBO(e,t){let{width:o,height:i}=e.getDefaultCanvasContext().canvas,s=e.createTexture({format:"rgba8unorm",width:o,height:i,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),n=e.createTexture({format:"depth16unorm",width:o,height:i});this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:o,height:i,colorAttachments:[s],depthStencilAttachment:n})}destroyFBO(e){let t=this.collisionFBOs[e];t.colorAttachments[0]?.destroy(),t.depthStencilAttachment?.destroy(),t.destroy(),delete this.collisionFBOs[e]}};var Po={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},U=class extends Ft.LayerExtension{getShaders(){return{modules:[bt]}}draw({shaderModuleProps:e}){e.collision?.drawToCollisionMap&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(e,t){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new j),this.getAttributeManager().add({collisionPriorities:{size:1,stepMode:"dynamic",accessor:"getCollisionPriority"}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}};U.defaultProps=Po;U.extensionName="CollisionFilterExtension";var Ot=U;var P=d(_(),1);var At=d(_(),1),Tt=`layout(std140) uniform maskUniforms {
1848
+ `},Pi=r=>{if(!r||!("dummyCollisionMap"in r))return{};let{enabled:e,collisionFBO:t,drawToCollisionMap:i,dummyCollisionMap:o}=r;return{enabled:e&&!i,sort:Boolean(i),collision_texture:!i&&t?t.colorAttachments[0]:o}},Mt={name:"collision",dependencies:[Et.project],vs:xi,inject:yi,getUniforms:Pi,uniformTypes:{sort:"i32",enabled:"i32"}};var Tt=d(_(),1);var Ft=d(_(),1),z=class extends Ft._LayersPass{renderCollisionMap(e,t){let o=[0,0,0,0],s=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:o,scissorRect:s,target:e,pass:"collision"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}getShaderModuleProps(){return{collision:{drawToCollisionMap:!0},picking:{isActive:1,isAttribute:!1},lighting:{enabled:!1}}}};var ye=2,V=class{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}setup(e){this.context=e;let{device:t}=e;this.dummyCollisionMap=t.createTexture({width:1,height:1}),this.collisionFilterPass=new z(t,{id:"default-collision-filter"})}preRender({effects:e,layers:t,layerFilter:i,viewports:o,onViewportActive:s,views:a,isPicking:n,preRenderStats:l={}}){let{device:f}=this.context;if(n)return;let c=t.filter(({props:{visible:h,collisionEnabled:O}})=>h&&O);if(c.length===0){this.channels={};return}let p=e?.filter(h=>h.useInPicking&&l[h.id]),u=l["mask-effect"]?.didRender,m=this._groupByCollisionGroup(f,c),v=o[0],b=!this.lastViewport||!this.lastViewport.equals(v)||u;for(let h in m){let O=this.collisionFBOs[h],fe=m[h],[ce,pe]=f.canvasContext.getPixelSize();O.resize({width:ce/ye,height:pe/ye}),this._render(fe,{effects:p,layerFilter:i,onViewportActive:s,views:a,viewport:v,viewportChanged:b})}}_render(e,{effects:t,layerFilter:i,onViewportActive:o,views:s,viewport:a,viewportChanged:n}){let{collisionGroup:l}=e,f=this.channels[l];if(!f)return;let c=n||e===f||!(0,Tt._deepEqual)(f.layers,e.layers,1)||e.layerBounds.some((p,u)=>!M(p,f.layerBounds[u]))||e.allLayersLoaded!==f.allLayersLoaded||e.layers.some(p=>p.props.transitions);if(this.channels[l]=e,c){this.lastViewport=a;let p=this.collisionFBOs[l];this.collisionFilterPass.renderCollisionMap(p,{pass:"collision-filter",isPicking:!0,layers:e.layers,effects:t,layerFilter:i,viewports:a?[a]:[],onViewportActive:o,views:s,shaderModuleProps:{collision:{enabled:!0,dummyCollisionMap:this.dummyCollisionMap},project:{devicePixelRatio:p.device.canvasContext.getDevicePixelRatio()/ye}}})}}_groupByCollisionGroup(e,t){let i={};for(let o of t){let s=o.props.collisionGroup,a=i[s];a||(a={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},i[s]=a),a.layers.push(o),a.layerBounds.push(o.getBounds()),o.isLoaded||(a.allLayersLoaded=!1)}for(let o of Object.keys(i))this.collisionFBOs[o]||this.createFBO(e,o),this.channels[o]||(this.channels[o]=i[o]);for(let o of Object.keys(this.collisionFBOs))i[o]||this.destroyFBO(o);return i}getShaderModuleProps(e){let{collisionGroup:t,collisionEnabled:i}=e.props,{collisionFBOs:o,dummyCollisionMap:s}=this,a=o[t];return{collision:{enabled:i&&Boolean(a),collisionFBO:a,dummyCollisionMap:s}}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let e of Object.keys(this.collisionFBOs))this.destroyFBO(e);this.collisionFBOs={},this.lastViewport=void 0}createFBO(e,t){let{width:i,height:o}=e.getDefaultCanvasContext().canvas,s=e.createTexture({format:"rgba8unorm",width:i,height:o,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),a=e.createTexture({format:"depth16unorm",width:i,height:o});this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:i,height:o,colorAttachments:[s],depthStencilAttachment:a})}destroyFBO(e){let t=this.collisionFBOs[e];t.colorAttachments[0]?.destroy(),t.depthStencilAttachment?.destroy(),t.destroy(),delete this.collisionFBOs[e]}};var bi={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},j=class extends At.LayerExtension{getShaders(){return{modules:[Mt]}}draw({shaderModuleProps:e}){e.collision?.drawToCollisionMap&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(e,t){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new V),this.getAttributeManager().add({collisionPriorities:{size:1,stepMode:"dynamic",accessor:"getCollisionPriority"}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}};j.defaultProps=bi;j.extensionName="CollisionFilterExtension";var Lt=j;var P=d(_(),1);var Ot=d(_(),1),St=`layout(std140) uniform maskUniforms {
1685
1849
  vec4 bounds;
1686
1850
  highp int channel;
1687
1851
  bool enabled;
1688
1852
  bool inverted;
1689
1853
  bool maskByInstance;
1690
1854
  } mask;
1691
- `,bo=`
1855
+ `,Ei=`
1692
1856
  vec2 mask_getCoords(vec4 position) {
1693
1857
  return (position.xy - mask.bounds.xy) / (mask.bounds.zw - mask.bounds.xy);
1694
1858
  }
1695
- `,Eo=`
1696
- ${Tt}
1697
- ${bo}
1698
- `,Mo=`
1859
+ `,Mi=`
1860
+ ${St}
1861
+ ${Ei}
1862
+ `,Fi=`
1699
1863
  uniform sampler2D mask_texture;
1700
1864
 
1701
1865
  bool mask_isInBounds(vec2 texCoords) {
@@ -1720,10 +1884,10 @@ bool mask_isInBounds(vec2 texCoords) {
1720
1884
  return maskValue < 0.5;
1721
1885
  }
1722
1886
  }
1723
- `,Fo=`
1724
- ${Tt}
1725
- ${Mo}
1726
- `,Oo={"vs:#decl":`
1887
+ `,Ti=`
1888
+ ${St}
1889
+ ${Fi}
1890
+ `,Ai={"vs:#decl":`
1727
1891
  out vec2 mask_texCoords;
1728
1892
  `,"vs:#main-end":`
1729
1893
  vec4 mask_common_position;
@@ -1745,15 +1909,15 @@ in vec2 mask_texCoords;
1745
1909
 
1746
1910
  if (!mask) discard;
1747
1911
  }
1748
- `},Ao=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:r||{},St={name:"mask",dependencies:[At.project],vs:Eo,fs:Fo,inject:Oo,getUniforms:Ao,uniformTypes:{bounds:"vec4<f32>",channel:"i32",enabled:"i32",inverted:"i32",maskByInstance:"i32"}};var be=d(_(),1);var Lt=d(_(),1),To={blendColorOperation:"subtract",blendColorSrcFactor:"zero",blendColorDstFactor:"one",blendAlphaOperation:"subtract",blendAlphaSrcFactor:"zero",blendAlphaDstFactor:"one"},G=class extends Lt._LayersPass{constructor(e,t){super(e,t);let{mapSize:o=2048}=t;this.maskMap=e.createTexture({format:"rgba8unorm",width:o,height:o,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.fbo=e.createFramebuffer({id:"maskmap",width:o,height:o,colorAttachments:[this.maskMap]})}render(e){let t=2**e.channel,o=[255,255,255,255];super.render({...e,clearColor:o,colorMask:t,target:this.fbo,pass:"mask"})}getLayerParameters(e,t,o){return{...e.props.parameters,blend:!0,depthCompare:"always",...To}}shouldDrawLayer(e){return e.props.operation.includes("mask")}delete(){this.fbo.delete(),this.maskMap.delete()}};var se=d(_(),1);function O(r,e){let t=[1/0,1/0,-1/0,-1/0];for(let o of r){let i=o.getBounds();if(i){let s=o.projectPosition(i[0],{viewport:e,autoOffset:!1}),n=o.projectPosition(i[1],{viewport:e,autoOffset:!1});t[0]=Math.min(t[0],s[0]),t[1]=Math.min(t[1],s[1]),t[2]=Math.max(t[2],n[0]),t[3]=Math.max(t[3],n[1])}}return Number.isFinite(t[0])?t:null}var So=2048;function A(r){let{bounds:e,viewport:t,border:o=0}=r,{isGeospatial:i}=t;if(e[2]<=e[0]||e[3]<=e[1])return null;let s=t.unprojectPosition([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),{width:n,height:a,zoom:l}=r;if(l===void 0){n=n-o*2,a=a-o*2;let f=Math.min(n/(e[2]-e[0]),a/(e[3]-e[1]));l=Math.min(Math.log2(f),20)}else if(!n||!a){let f=2**l;n=Math.round(Math.abs(e[2]-e[0])*f),a=Math.round(Math.abs(e[3]-e[1])*f);let c=So-o*2;if(n>c||a>c){let p=c/Math.max(n,a);n=Math.round(n*p),a=Math.round(a*p),l+=Math.log2(p)}}return i?new se.WebMercatorViewport({id:t.id,x:o,y:o,width:n,height:a,longitude:s[0],latitude:s[1],zoom:l,orthographic:!0}):new se.OrthographicViewport({id:t.id,x:o,y:o,width:n,height:a,target:s,zoom:l,flipY:!1})}function Lo(r,e){let t;if(e&&e.length===2){let[s,n]=e,a=r.getBounds({z:s}),l=r.getBounds({z:n});t=[Math.min(a[0],l[0]),Math.min(a[1],l[1]),Math.max(a[2],l[2]),Math.max(a[3],l[3])]}else t=r.getBounds();let o=r.projectPosition(t.slice(0,2)),i=r.projectPosition(t.slice(2,4));return[o[0],o[1],i[0],i[1]]}function T(r,e,t){if(!r)return[0,0,1,1];let o=Lo(e,t),i=Io(o);return r[2]-r[0]<=i[2]-i[0]&&r[3]-r[1]<=i[3]-i[1]?r:[Math.max(r[0],i[0]),Math.max(r[1],i[1]),Math.min(r[2],i[2]),Math.min(r[3],i[3])]}function Io(r){let e=r[2]-r[0],t=r[3]-r[1],o=(r[0]+r[2])/2,i=(r[1]+r[3])/2;return[o-e,i-t,o+e,i+t]}var H=class{constructor(){this.id="mask-effect",this.props=null,this.useInPicking=!0,this.order=0,this.channels=[],this.masks=null}setup({device:e}){this.dummyMaskMap=e.createTexture({width:1,height:1}),this.maskPass=new G(e,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap}preRender({layers:e,layerFilter:t,viewports:o,onViewportActive:i,views:s,isPicking:n}){let a=!1;if(n)return{didRender:a};let l=e.filter(u=>u.props.visible&&u.props.operation.includes("mask"));if(l.length===0)return this.masks=null,this.channels.length=0,{didRender:a};this.masks={};let f=this._sortMaskChannels(l),c=o[0],p=!this.lastViewport||!this.lastViewport.equals(c);if(c.resolution!==void 0)return be.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:a};for(let u in f){let m=this._renderChannel(f[u],{layerFilter:t,onViewportActive:i,views:s,viewport:c,viewportChanged:p});a||(a=m)}return{didRender:a}}_renderChannel(e,{layerFilter:t,onViewportActive:o,views:i,viewport:s,viewportChanged:n}){let a=!1,l=this.channels[e.index];if(!l)return a;let f=e===l||e.layers.length!==l.layers.length||e.layers.some((c,p)=>c!==l.layers[p]||c.props.transitions)||e.layerBounds.some((c,p)=>c!==l.layerBounds[p]);if(e.bounds=l.bounds,e.maskBounds=l.maskBounds,this.channels[e.index]=e,f||n){this.lastViewport=s;let c=O(e.layers,s);if(e.bounds=c&&T(c,s),f||!M(e.bounds,l.bounds)){let{maskPass:p,maskMap:u}=this,m=c&&A({bounds:e.bounds,viewport:s,width:u.width,height:u.height,border:1});e.maskBounds=m?m.getBounds():[0,0,1,1],p.render({pass:"mask",channel:e.index,layers:e.layers,layerFilter:t,viewports:m?[m]:[],onViewportActive:o,views:i,shaderModuleProps:{project:{devicePixelRatio:1}}}),a=!0}}return this.masks[e.id]={index:e.index,bounds:e.maskBounds,coordinateOrigin:e.coordinateOrigin,coordinateSystem:e.coordinateSystem},a}_sortMaskChannels(e){let t={},o=0;for(let i of e){let{id:s}=i.root,n=t[s];if(!n){if(++o>4){be.log.warn("Too many mask layers. The max supported is 4")();continue}n={id:s,index:this.channels.findIndex(a=>a?.id===s),layers:[],layerBounds:[],coordinateOrigin:i.root.props.coordinateOrigin,coordinateSystem:i.root.props.coordinateSystem},t[s]=n}n.layers.push(i),n.layerBounds.push(i.getBounds())}for(let i=0;i<4;i++){let s=this.channels[i];(!s||!(s.id in t))&&(this.channels[i]=null)}for(let i in t){let s=t[i];s.index<0&&(s.index=this.channels.findIndex(n=>!n),this.channels[s.index]=s)}return t}getShaderModuleProps(){return{mask:{maskMap:this.masks?this.maskMap:this.dummyMaskMap,maskChannels:this.masks}}}cleanup(){this.dummyMaskMap&&(this.dummyMaskMap.delete(),this.dummyMaskMap=void 0),this.maskPass&&(this.maskPass.delete(),this.maskPass=void 0,this.maskMap=void 0),this.lastViewport=void 0,this.masks=null,this.channels.length=0}};var Co={maskId:"",maskByInstance:void 0,maskInverted:!1},q=class extends P.LayerExtension{initializeState(){this.context.deck?._addDefaultEffect(new H)}getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.maskByInstance!==void 0&&(e=Boolean(this.props.maskByInstance)),this.state.maskByInstance=e,{modules:[St]}}draw({context:e,shaderModuleProps:t}){let o={};o.maskByInstance=Boolean(this.state.maskByInstance);let{maskId:i,maskInverted:s}=this.props,{maskChannels:n}=t.mask||{},{viewport:a}=e;if(n&&n[i]){let{index:l,bounds:f,coordinateOrigin:c}=n[i],{coordinateSystem:p}=n[i];o.enabled=!0,o.channel=l,o.inverted=s,p===P.COORDINATE_SYSTEM.DEFAULT&&(p=a.isGeospatial?P.COORDINATE_SYSTEM.LNGLAT:P.COORDINATE_SYSTEM.CARTESIAN);let u={modelMatrix:null,fromCoordinateOrigin:c,fromCoordinateSystem:p},m=this.projectPosition([f[0],f[1],0],u),v=this.projectPosition([f[2],f[3],0],u);o.bounds=[m[0],m[1],v[0],v[1]]}else i&&P.log.warn(`Could not find a mask layer with id: ${i}`)(),o.enabled=!1;this.setShaderModuleProps({mask:o})}};q.defaultProps=Co;q.extensionName="MaskExtension";var It=q;var Dt=d(_(),1);var Bt=d(_(),1);var Ee=d(_(),1),g={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},ko=Object.keys(g).map(r=>`const float TERRAIN_MODE_${r} = ${g[r]}.0;`).join(`
1749
- `),Ct=ko+`
1912
+ `},Li=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:r||{},It={name:"mask",dependencies:[Ot.project],vs:Mi,fs:Ti,inject:Ai,getUniforms:Li,uniformTypes:{bounds:"vec4<f32>",channel:"i32",enabled:"i32",inverted:"i32",maskByInstance:"i32"}};var Pe=d(_(),1);var kt=d(_(),1),Oi={blendColorOperation:"subtract",blendColorSrcFactor:"zero",blendColorDstFactor:"one",blendAlphaOperation:"subtract",blendAlphaSrcFactor:"zero",blendAlphaDstFactor:"one"},U=class extends kt._LayersPass{constructor(e,t){super(e,t);let{mapSize:i=2048}=t;this.maskMap=e.createTexture({format:"rgba8unorm",width:i,height:i,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.fbo=e.createFramebuffer({id:"maskmap",width:i,height:i,colorAttachments:[this.maskMap]})}render(e){let t=2**e.channel,i=[255,255,255,255];super.render({...e,clearColor:i,colorMask:t,target:this.fbo,pass:"mask"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthCompare:"always",...Oi}}shouldDrawLayer(e){return e.props.operation.includes("mask")}delete(){this.fbo.delete(),this.maskMap.delete()}};var oe=d(_(),1);function T(r,e){let t=[1/0,1/0,-1/0,-1/0];for(let i of r){let o=i.getBounds();if(o){let s=i.projectPosition(o[0],{viewport:e,autoOffset:!1}),a=i.projectPosition(o[1],{viewport:e,autoOffset:!1});t[0]=Math.min(t[0],s[0]),t[1]=Math.min(t[1],s[1]),t[2]=Math.max(t[2],a[0]),t[3]=Math.max(t[3],a[1])}}return Number.isFinite(t[0])?t:null}var Si=2048;function A(r){let{bounds:e,viewport:t,border:i=0}=r,{isGeospatial:o}=t;if(e[2]<=e[0]||e[3]<=e[1])return null;let s=t.unprojectPosition([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),{width:a,height:n,zoom:l}=r;if(l===void 0){a=a-i*2,n=n-i*2;let f=Math.min(a/(e[2]-e[0]),n/(e[3]-e[1]));l=Math.min(Math.log2(f),20)}else if(!a||!n){let f=2**l;a=Math.round(Math.abs(e[2]-e[0])*f),n=Math.round(Math.abs(e[3]-e[1])*f);let c=Si-i*2;if(a>c||n>c){let p=c/Math.max(a,n);a=Math.round(a*p),n=Math.round(n*p),l+=Math.log2(p)}}return o?new oe.WebMercatorViewport({id:t.id,x:i,y:i,width:a,height:n,longitude:s[0],latitude:s[1],zoom:l,orthographic:!0}):new oe.OrthographicViewport({id:t.id,x:i,y:i,width:a,height:n,target:s,zoom:l,flipY:!1})}function Ii(r,e){let t;if(e&&e.length===2){let[s,a]=e,n=r.getBounds({z:s}),l=r.getBounds({z:a});t=[Math.min(n[0],l[0]),Math.min(n[1],l[1]),Math.max(n[2],l[2]),Math.max(n[3],l[3])]}else t=r.getBounds();let i=r.projectPosition(t.slice(0,2)),o=r.projectPosition(t.slice(2,4));return[i[0],i[1],o[0],o[1]]}function L(r,e,t){if(!r)return[0,0,1,1];let i=Ii(e,t),o=ki(i);return r[2]-r[0]<=o[2]-o[0]&&r[3]-r[1]<=o[3]-o[1]?r:[Math.max(r[0],o[0]),Math.max(r[1],o[1]),Math.min(r[2],o[2]),Math.min(r[3],o[3])]}function ki(r){let e=r[2]-r[0],t=r[3]-r[1],i=(r[0]+r[2])/2,o=(r[1]+r[3])/2;return[i-e,o-t,i+e,o+t]}var G=class{constructor(){this.id="mask-effect",this.props=null,this.useInPicking=!0,this.order=0,this.channels=[],this.masks=null}setup({device:e}){this.dummyMaskMap=e.createTexture({width:1,height:1}),this.maskPass=new U(e,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap}preRender({layers:e,layerFilter:t,viewports:i,onViewportActive:o,views:s,isPicking:a}){let n=!1;if(a)return{didRender:n};let l=e.filter(u=>u.props.visible&&u.props.operation.includes("mask"));if(l.length===0)return this.masks=null,this.channels.length=0,{didRender:n};this.masks={};let f=this._sortMaskChannels(l),c=i[0],p=!this.lastViewport||!this.lastViewport.equals(c);if(c.resolution!==void 0)return Pe.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:n};for(let u in f){let m=this._renderChannel(f[u],{layerFilter:t,onViewportActive:o,views:s,viewport:c,viewportChanged:p});n||(n=m)}return{didRender:n}}_renderChannel(e,{layerFilter:t,onViewportActive:i,views:o,viewport:s,viewportChanged:a}){let n=!1,l=this.channels[e.index];if(!l)return n;let f=e===l||e.layers.length!==l.layers.length||e.layers.some((c,p)=>c!==l.layers[p]||c.props.transitions)||e.layerBounds.some((c,p)=>c!==l.layerBounds[p]);if(e.bounds=l.bounds,e.maskBounds=l.maskBounds,this.channels[e.index]=e,f||a){this.lastViewport=s;let c=T(e.layers,s);if(e.bounds=c&&L(c,s),f||!M(e.bounds,l.bounds)){let{maskPass:p,maskMap:u}=this,m=c&&A({bounds:e.bounds,viewport:s,width:u.width,height:u.height,border:1});e.maskBounds=m?m.getBounds():[0,0,1,1],p.render({pass:"mask",channel:e.index,layers:e.layers,layerFilter:t,viewports:m?[m]:[],onViewportActive:i,views:o,shaderModuleProps:{project:{devicePixelRatio:1}}}),n=!0}}return this.masks[e.id]={index:e.index,bounds:e.maskBounds,coordinateOrigin:e.coordinateOrigin,coordinateSystem:e.coordinateSystem},n}_sortMaskChannels(e){let t={},i=0;for(let o of e){let{id:s}=o.root,a=t[s];if(!a){if(++i>4){Pe.log.warn("Too many mask layers. The max supported is 4")();continue}a={id:s,index:this.channels.findIndex(n=>n?.id===s),layers:[],layerBounds:[],coordinateOrigin:o.root.props.coordinateOrigin,coordinateSystem:o.root.props.coordinateSystem},t[s]=a}a.layers.push(o),a.layerBounds.push(o.getBounds())}for(let o=0;o<4;o++){let s=this.channels[o];(!s||!(s.id in t))&&(this.channels[o]=null)}for(let o in t){let s=t[o];s.index<0&&(s.index=this.channels.findIndex(a=>!a),this.channels[s.index]=s)}return t}getShaderModuleProps(){return{mask:{maskMap:this.masks?this.maskMap:this.dummyMaskMap,maskChannels:this.masks}}}cleanup(){this.dummyMaskMap&&(this.dummyMaskMap.delete(),this.dummyMaskMap=void 0),this.maskPass&&(this.maskPass.delete(),this.maskPass=void 0,this.maskMap=void 0),this.lastViewport=void 0,this.masks=null,this.channels.length=0}};var Ri={maskId:"",maskByInstance:void 0,maskInverted:!1},H=class extends P.LayerExtension{initializeState(){this.context.deck?._addDefaultEffect(new G)}getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.maskByInstance!==void 0&&(e=Boolean(this.props.maskByInstance)),this.state.maskByInstance=e,{modules:[It]}}draw({context:e,shaderModuleProps:t}){let i={};i.maskByInstance=Boolean(this.state.maskByInstance);let{maskId:o,maskInverted:s}=this.props,{maskChannels:a}=t.mask||{},{viewport:n}=e;if(a&&a[o]){let{index:l,bounds:f,coordinateOrigin:c}=a[o],{coordinateSystem:p}=a[o];i.enabled=!0,i.channel=l,i.inverted=s,p===P.COORDINATE_SYSTEM.DEFAULT&&(p=n.isGeospatial?P.COORDINATE_SYSTEM.LNGLAT:P.COORDINATE_SYSTEM.CARTESIAN);let u={modelMatrix:null,fromCoordinateOrigin:c,fromCoordinateSystem:p},m=this.projectPosition([f[0],f[1],0],u),v=this.projectPosition([f[2],f[3],0],u);i.bounds=[m[0],m[1],v[0],v[1]]}else o&&P.log.warn(`Could not find a mask layer with id: ${o}`)(),i.enabled=!1;this.setShaderModuleProps({mask:i})}};H.defaultProps=Ri;H.extensionName="MaskExtension";var Rt=H;var Vt=d(_(),1);var zt=d(_(),1);var be=d(_(),1),g={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},Ci=Object.keys(g).map(r=>`const float TERRAIN_MODE_${r} = ${g[r]}.0;`).join(`
1913
+ `),Ct=Ci+`
1750
1914
  layout(std140) uniform terrainUniforms {
1751
1915
  float mode;
1752
1916
  vec4 bounds;
1753
1917
  } terrain;
1754
1918
 
1755
1919
  uniform sampler2D terrain_map;
1756
- `,W={name:"terrain",dependencies:[Ee.project],vs:Ct+"out vec3 commonPos;",fs:Ct+"in vec3 commonPos;",inject:{"vs:#main-start":`
1920
+ `,q={name:"terrain",dependencies:[be.project],vs:Ct+"out vec3 commonPos;",fs:Ct+"in vec3 commonPos;",inject:{"vs:#main-start":`
1757
1921
  if (terrain.mode == TERRAIN_MODE_SKIP) {
1758
1922
  gl_Position = vec4(0.0);
1759
1923
  return;
@@ -1793,6 +1957,6 @@ if ((terrain.mode == TERRAIN_MODE_USE_COVER) || (terrain.mode == TERRAIN_MODE_US
1793
1957
  }
1794
1958
  return;
1795
1959
  }
1796
- `},getUniforms:(r={})=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:e,heightMap:t,heightMapBounds:o,dummyHeightMap:i,terrainCover:s,useTerrainHeightMap:n,terrainSkipRender:a}=r,l=Ee.project.getUniforms(r.project),{commonOrigin:f}=l,c=a?g.SKIP:g.NONE,p=i,u=null;return e?(c=g.WRITE_HEIGHT_MAP,u=o):n&&t?(c=g.USE_HEIGHT_MAP,p=t,u=o):s&&(p=(r.isPicking?s.getPickingFramebuffer():s.getRenderFramebuffer())?.colorAttachments[0].texture,r.isPicking&&(c=g.SKIP),p?(c=c===g.SKIP?g.USE_COVER_ONLY:g.USE_COVER,u=s.bounds):(p=i,r.isPicking&&!a&&(c=g.NONE))),{mode:c,terrain_map:p,bounds:u?[u[0]-f[0],u[1]-f[1],u[2]-u[0],u[3]-u[1]]:[0,0,0,0]}}return{}},uniformTypes:{mode:"f32",bounds:"vec4<f32>"}};function Y(r,e){return r.createFramebuffer({id:e.id,colorAttachments:[r.createTexture({id:e.id,...e.float&&{format:"rgba32float",type:5126},dimension:"2d",width:1,height:1,sampler:e.interpolate===!1?{minFilter:"nearest",magFilter:"nearest"}:{minFilter:"linear",magFilter:"linear"}})]})}var ne=class{constructor(e){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=e,this.tile=kt(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:o,layerNeedsRedraw:i}){e&&(this.targetLayer=e);let s=t?this._updateViewport(t):!1,n=o?this._updateLayers(o):!1;if(i){for(let a of this.layers)if(i[a]){n=!0;break}}return n||s}_updateLayers(e){let t=!1;if(e=this.tile?Ro(this.tile,e):e,e.length!==this.layers.length)t=!0;else for(let o=0;o<e.length;o++)if(e[o].id!==this.layers[o]){t=!0;break}return t&&(this.layers=e.map(o=>o.id)),t}_updateViewport(e){let t=this.targetLayer,o=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){o=!0,this.targetBounds=this.tile.boundingBox;let s=e.projectPosition(this.targetBounds[0]),n=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[s[0],s[1],n[0],n[1]]}}else this.targetBounds!==t.getBounds()&&(o=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=O([t],e));if(!this.targetBoundsCommon)return!1;let i=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let s=this.renderViewport?.zoom;o=o||i!==s;let n=T(this.targetBoundsCommon,e),a=this.bounds;o=o||!a||n.some((l,f)=>l!==a[f]),this.bounds=n}return o&&(this.renderViewport=A({bounds:this.bounds,zoom:i,viewport:e})),o}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=Y(this.targetLayer.context.device,{id:this.id})),this.fbo)}getPickingFramebuffer(){return!this.renderViewport||this.layers.length===0&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=Y(this.targetLayer.context.device,{id:`${this.id}-picking`,interpolate:!1})),this.pickingFbo)}filterLayers(e){return e.filter(({id:t})=>this.layers.includes(t))}delete(){let{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}};function Ro(r,e){return e.filter(t=>{let o=kt(t);return o?No(r.boundingBox,o.boundingBox):!0})}function kt(r){for(;r;){let{tile:e}=r.props;if(e)return e;r=r.parent}return null}function No(r,e){return r&&e?r[0][0]<e[1][0]&&e[0][0]<r[1][0]&&r[0][1]<e[1][1]&&e[0][1]<r[1][1]:!1}var Rt=d(_(),1),wo={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},ae=class extends Rt._LayersPass{getRenderableLayers(e,t){let{layers:o}=t,i=[],s=this._getDrawLayerParams(e,t,!0);for(let n=0;n<o.length;n++){let a=o[n];!a.isComposite&&s[n].shouldDrawLayer&&i.push(a)}return i}renderHeightMap(e,t){let o=e.getRenderFramebuffer(),i=e.renderViewport;!o||!i||(o.resize(i),this.render({...t,target:o,pass:"terrain-height-map",layers:t.layers,viewports:[i],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){let o=e.getRenderFramebuffer(),i=e.renderViewport;if(!o||!i)return;let s=e.filterLayers(t.layers);o.resize(i),this.render({...t,target:o,pass:`terrain-cover-${e.id}`,layers:s,effects:[],viewports:[i],clearColor:[0,0,0,0]})}getLayerParameters(e,t,o){return{...e.props.parameters,blend:!0,depthCompare:"always",...e.props.operation.includes("terrain")&&wo}}getShaderModuleProps(e,t,o){return{terrain:{project:o.project}}}};var Nt=d(_(),1),le=class extends Nt._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){let{layers:o}=t,i=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);let s=this._getDrawLayerParams(e,t);for(let n=0;n<o.length;n++){let a=o[n];!a.isComposite&&s[n].shouldDrawLayer&&(i.push(a),this.drawParameters[a.id]=s[n].layerParameters)}return i}renderTerrainCover(e,t){let o=e.getPickingFramebuffer(),i=e.renderViewport;if(!o||!i)return;let s=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&s.unshift(n),o.resize(i);let l=this.drawParameters[n.id]?.blendColor?.[3]??0;this.render({...t,pickingFBO:o,pass:`terrain-cover-picking-${e.id}`,layers:s,effects:[],viewports:[i],cullRect:void 0,deviceRect:i,pickZ:!1,clearColor:[0,0,0,l]})}getLayerParameters(e,t,o){let i;return this.drawParameters[e.id]?i=this.drawParameters[e.id]:(i=super.getLayerParameters(e,t,o),i.blend=!0),{...i,depthCompare:"always",blendAlphaSrcFactor:"constant"}}getShaderModuleProps(e,t,o){return{...super.getShaderModuleProps(e,t,o),terrain:{project:o.project}}}};var wt=2048,K=class{static isSupported(e){return e.isTextureFormatRenderable("rgba32float")}constructor(e){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=Y(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){let o=e.length!==this.layers.length||e.some((s,n)=>s!==this.layers[n]||s.props.transitions||s.getBounds()!==this.layersBounds[n]);o&&(this.layers=e,this.layersBounds=e.map(s=>s.getBounds()),this.layersBoundsCommon=O(e,t));let i=!this.lastViewport||!t.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(o||i){let s=T(this.layersBoundsCommon,t);if(s[2]<=s[0]||s[3]<=s[1])return this.renderViewport=null,!1;this.bounds=s,this.lastViewport=t;let n=t.scale,a=(s[2]-s[0])*n,l=(s[3]-s[1])*n;return this.renderViewport=a>0||l>0?A({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(a,wt),height:Math.min(l,wt),viewport:t}):null,!0}return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}};var fe=class{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}setup({device:e,deck:t}){this.dummyHeightMap=e.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new ae(e,{id:"terrain"}),this.terrainPickingPass=new le(e,{id:"terrain-picking"}),K.isSupported(e)?this.heightMap=new K(e):Bt.log.warn("Terrain offset mode is not supported by this browser")(),t._addDefaultShaderModule(W)}preRender(e){if(e.pickZ){this.isDrapingEnabled=!1;return}let{viewports:t}=e,o=e.pass.startsWith("picking");this.isPicking=o,this.isDrapingEnabled=!0;let i=t[0],s=(o?this.terrainPickingPass:this.terrainPass).getRenderableLayers(i,e),n=s.filter(l=>l.props.operation.includes("terrain"));if(n.length===0)return;o||s.filter(f=>f.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(n,i,e);let a=s.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(n,a,i,e)}getShaderModuleProps(e,t){let{terrainDrawMode:o}=e.state,i=this.isDrapingEnabled?this.terrainCovers.get(e.id)??null:null;return this.isPicking&&e.props.operation.includes("terrain")&&(e.state._hasPickingCover=Boolean(i?.getPickingFramebuffer())),{terrain:{project:t.project,isPicking:this.isPicking,heightMap:this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture||null,heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:i,useTerrainHeightMap:o==="offset",terrainSkipRender:o==="drape"||!e.props.operation.includes("draw")}}}cleanup({deck:e}){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(let t of this.terrainCovers.values())t.delete();this.terrainCovers.clear(),e._removeDefaultShaderModule(W)}_updateHeightMap(e,t,o){!this.heightMap||!this.heightMap.shouldUpdate({layers:e,viewport:t})||this.terrainPass.renderHeightMap(this.heightMap,{...o,layers:e,shaderModuleProps:{terrain:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,drawToTerrainHeightMap:!0},project:{devicePixelRatio:1}}})}_updateTerrainCovers(e,t,o,i){let s={};for(let n of t)n.state.terrainCoverNeedsRedraw&&(s[n.id]=!0,n.state.terrainCoverNeedsRedraw=!1);for(let n of this.terrainCovers.values())n.isDirty=n.isDirty||n.shouldUpdate({layerNeedsRedraw:s});for(let n of e)this._updateTerrainCover(n,t,o,i);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,o,i){let s=this.isPicking?this.terrainPickingPass:this.terrainPass,n=this.terrainCovers.get(e.id);n||(n=new ne(e),this.terrainCovers.set(e.id,n));try{let a=n.shouldUpdate({targetLayer:e,viewport:o,layers:t});(this.isPicking||n.isDirty||a)&&(s.renderTerrainCover(n,{...i,layers:t,shaderModuleProps:{terrain:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1},project:{devicePixelRatio:1}}}),this.isPicking||(n.isDirty=!1))}catch(a){e.raiseError(a,`Error rendering terrain cover ${n.id}`)}}_pruneTerrainCovers(){let e=[];for(let[t,o]of this.terrainCovers)o.isActive||e.push(t);for(let t of e)this.terrainCovers.delete(t)}};var Bo={terrainDrawMode:void 0},$=class extends Dt.LayerExtension{getShaders(){return{modules:[W]}}initializeState(){this.context.deck?._addDefaultEffect(new fe)}updateState(e){let{props:t,oldProps:o}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===o.terrainDrawMode&&t.extruded===o.extruded)return;let{terrainDrawMode:i}=t;if(!i){let s=this.props.extruded,n=this.getAttributeManager()?.attributes,a=n&&"instancePositions"in n;i=s||a?"offset":"drape"}this.setState({terrainDrawMode:i})}onNeedsRedraw(){let e=this.state;e.terrainDrawMode==="drape"&&(e.terrainCoverNeedsRedraw=!0)}};$.defaultProps=Bo;$.extensionName="TerrainExtension";var zt=$;return qt(Z);})();
1960
+ `},getUniforms:(r={})=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:e,heightMap:t,heightMapBounds:i,dummyHeightMap:o,terrainCover:s,useTerrainHeightMap:a,terrainSkipRender:n}=r,l=be.project.getUniforms(r.project),{commonOrigin:f}=l,c=n?g.SKIP:g.NONE,p=o,u=null;return e?(c=g.WRITE_HEIGHT_MAP,u=i):a&&t?(c=g.USE_HEIGHT_MAP,p=t,u=i):s&&(p=(r.isPicking?s.getPickingFramebuffer():s.getRenderFramebuffer())?.colorAttachments[0].texture,r.isPicking&&(c=g.SKIP),p?(c=c===g.SKIP?g.USE_COVER_ONLY:g.USE_COVER,u=s.bounds):(p=o,r.isPicking&&!n&&(c=g.NONE))),{mode:c,terrain_map:p,bounds:u?[u[0]-f[0],u[1]-f[1],u[2]-u[0],u[3]-u[1]]:[0,0,0,0]}}return{}},uniformTypes:{mode:"f32",bounds:"vec4<f32>"}};function W(r,e){return r.createFramebuffer({id:e.id,colorAttachments:[r.createTexture({id:e.id,...e.float&&{format:"rgba32float",type:5126},dimension:"2d",width:1,height:1,sampler:e.interpolate===!1?{minFilter:"nearest",magFilter:"nearest"}:{minFilter:"linear",magFilter:"linear"}})]})}var se=class{constructor(e){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=e,this.tile=wt(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:i,layerNeedsRedraw:o}){e&&(this.targetLayer=e);let s=t?this._updateViewport(t):!1,a=i?this._updateLayers(i):!1;if(o){for(let n of this.layers)if(o[n]){a=!0;break}}return a||s}_updateLayers(e){let t=!1;if(e=this.tile?wi(this.tile,e):e,e.length!==this.layers.length)t=!0;else for(let i=0;i<e.length;i++)if(e[i].id!==this.layers[i]){t=!0;break}return t&&(this.layers=e.map(i=>i.id)),t}_updateViewport(e){let t=this.targetLayer,i=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){i=!0,this.targetBounds=this.tile.boundingBox;let s=e.projectPosition(this.targetBounds[0]),a=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[s[0],s[1],a[0],a[1]]}}else this.targetBounds!==t.getBounds()&&(i=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=T([t],e));if(!this.targetBoundsCommon)return!1;let o=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let s=this.renderViewport?.zoom;i=i||o!==s;let a=L(this.targetBoundsCommon,e),n=this.bounds;i=i||!n||a.some((l,f)=>l!==n[f]),this.bounds=a}return i&&(this.renderViewport=A({bounds:this.bounds,zoom:o,viewport:e})),i}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=W(this.targetLayer.context.device,{id:this.id})),this.fbo)}getPickingFramebuffer(){return!this.renderViewport||this.layers.length===0&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=W(this.targetLayer.context.device,{id:`${this.id}-picking`,interpolate:!1})),this.pickingFbo)}filterLayers(e){return e.filter(({id:t})=>this.layers.includes(t))}delete(){let{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}};function wi(r,e){return e.filter(t=>{let i=wt(t);return i?Ni(r.boundingBox,i.boundingBox):!0})}function wt(r){for(;r;){let{tile:e}=r.props;if(e)return e;r=r.parent}return null}function Ni(r,e){return r&&e?r[0][0]<e[1][0]&&e[0][0]<r[1][0]&&r[0][1]<e[1][1]&&e[0][1]<r[1][1]:!1}var Nt=d(_(),1),Bi={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},ae=class extends Nt._LayersPass{getRenderableLayers(e,t){let{layers:i}=t,o=[],s=this._getDrawLayerParams(e,t,!0);for(let a=0;a<i.length;a++){let n=i[a];!n.isComposite&&s[a].shouldDrawLayer&&o.push(n)}return o}renderHeightMap(e,t){let i=e.getRenderFramebuffer(),o=e.renderViewport;!i||!o||(i.resize(o),this.render({...t,target:i,pass:"terrain-height-map",layers:t.layers,viewports:[o],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){let i=e.getRenderFramebuffer(),o=e.renderViewport;if(!i||!o)return;let s=e.filterLayers(t.layers);i.resize(o),this.render({...t,target:i,pass:`terrain-cover-${e.id}`,layers:s,effects:[],viewports:[o],clearColor:[0,0,0,0]})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthCompare:"always",...e.props.operation.includes("terrain")&&Bi}}getShaderModuleProps(e,t,i){return{terrain:{project:i.project}}}};var Bt=d(_(),1),ne=class extends Bt._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){let{layers:i}=t,o=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);let s=this._getDrawLayerParams(e,t);for(let a=0;a<i.length;a++){let n=i[a];!n.isComposite&&s[a].shouldDrawLayer&&(o.push(n),this.drawParameters[n.id]=s[a].layerParameters)}return o}renderTerrainCover(e,t){let i=e.getPickingFramebuffer(),o=e.renderViewport;if(!i||!o)return;let s=e.filterLayers(t.layers),a=e.targetLayer;a.props.pickable&&s.unshift(a),i.resize(o);let l=this.drawParameters[a.id]?.blendColor?.[3]??0;this.render({...t,pickingFBO:i,pass:`terrain-cover-picking-${e.id}`,layers:s,effects:[],viewports:[o],cullRect:void 0,deviceRect:o,pickZ:!1,clearColor:[0,0,0,l]})}getLayerParameters(e,t,i){let o;return this.drawParameters[e.id]?o=this.drawParameters[e.id]:(o=super.getLayerParameters(e,t,i),o.blend=!0),{...o,depthCompare:"always",blendAlphaSrcFactor:"constant"}}getShaderModuleProps(e,t,i){return{...super.getShaderModuleProps(e,t,i),terrain:{project:i.project}}}};var Dt=2048,K=class{static isSupported(e){return e.isTextureFormatRenderable("rgba32float")}constructor(e){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=W(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){let i=e.length!==this.layers.length||e.some((s,a)=>s!==this.layers[a]||s.props.transitions||s.getBounds()!==this.layersBounds[a]);i&&(this.layers=e,this.layersBounds=e.map(s=>s.getBounds()),this.layersBoundsCommon=T(e,t));let o=!this.lastViewport||!t.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(i||o){let s=L(this.layersBoundsCommon,t);if(s[2]<=s[0]||s[3]<=s[1])return this.renderViewport=null,!1;this.bounds=s,this.lastViewport=t;let a=t.scale,n=(s[2]-s[0])*a,l=(s[3]-s[1])*a;return this.renderViewport=n>0||l>0?A({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(n,Dt),height:Math.min(l,Dt),viewport:t}):null,!0}return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}};var le=class{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}setup({device:e,deck:t}){this.dummyHeightMap=e.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new ae(e,{id:"terrain"}),this.terrainPickingPass=new ne(e,{id:"terrain-picking"}),K.isSupported(e)?this.heightMap=new K(e):zt.log.warn("Terrain offset mode is not supported by this browser")(),t._addDefaultShaderModule(q)}preRender(e){if(e.pickZ){this.isDrapingEnabled=!1;return}let{viewports:t}=e,i=e.pass.startsWith("picking");this.isPicking=i,this.isDrapingEnabled=!0;let o=t[0],s=(i?this.terrainPickingPass:this.terrainPass).getRenderableLayers(o,e),a=s.filter(l=>l.props.operation.includes("terrain"));if(a.length===0)return;i||s.filter(f=>f.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(a,o,e);let n=s.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(a,n,o,e)}getShaderModuleProps(e,t){let{terrainDrawMode:i}=e.state,o=this.isDrapingEnabled?this.terrainCovers.get(e.id)??null:null;return this.isPicking&&e.props.operation.includes("terrain")&&(e.state._hasPickingCover=Boolean(o?.getPickingFramebuffer())),{terrain:{project:t.project,isPicking:this.isPicking,heightMap:this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture||null,heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:o,useTerrainHeightMap:i==="offset",terrainSkipRender:i==="drape"||!e.props.operation.includes("draw")}}}cleanup({deck:e}){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(let t of this.terrainCovers.values())t.delete();this.terrainCovers.clear(),e._removeDefaultShaderModule(q)}_updateHeightMap(e,t,i){!this.heightMap||!this.heightMap.shouldUpdate({layers:e,viewport:t})||this.terrainPass.renderHeightMap(this.heightMap,{...i,layers:e,shaderModuleProps:{terrain:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,drawToTerrainHeightMap:!0},project:{devicePixelRatio:1}}})}_updateTerrainCovers(e,t,i,o){let s={};for(let a of t)a.state.terrainCoverNeedsRedraw&&(s[a.id]=!0,a.state.terrainCoverNeedsRedraw=!1);for(let a of this.terrainCovers.values())a.isDirty=a.isDirty||a.shouldUpdate({layerNeedsRedraw:s});for(let a of e)this._updateTerrainCover(a,t,i,o);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,i,o){let s=this.isPicking?this.terrainPickingPass:this.terrainPass,a=this.terrainCovers.get(e.id);a||(a=new se(e),this.terrainCovers.set(e.id,a));try{let n=a.shouldUpdate({targetLayer:e,viewport:i,layers:t});(this.isPicking||a.isDirty||n)&&(s.renderTerrainCover(a,{...o,layers:t,shaderModuleProps:{terrain:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1},project:{devicePixelRatio:1}}}),this.isPicking||(a.isDirty=!1))}catch(n){e.raiseError(n,`Error rendering terrain cover ${a.id}`)}}_pruneTerrainCovers(){let e=[];for(let[t,i]of this.terrainCovers)i.isActive||e.push(t);for(let t of e)this.terrainCovers.delete(t)}};var Di={terrainDrawMode:void 0},Y=class extends Vt.LayerExtension{getShaders(){return{modules:[q]}}initializeState(){this.context.deck?._addDefaultEffect(new le)}updateState(e){let{props:t,oldProps:i}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===i.terrainDrawMode&&t.extruded===i.extruded)return;let{terrainDrawMode:o}=t;if(!o){let s=this.props.extruded,a=this.getAttributeManager()?.attributes,n=a&&"instancePositions"in a;o=s||n?"offset":"drape"}this.setState({terrainDrawMode:o})}onNeedsRedraw(){let e=this.state;e.terrainDrawMode==="drape"&&(e.terrainCoverNeedsRedraw=!0)}};Y.defaultProps=Di;Y.extensionName="TerrainExtension";var jt=Y;return Kt($);})();
1797
1961
  return __exports__;
1798
1962
  });