team-10/venv/share/jupyter/nbextensions/pydeck/index.js

3703 lines
2.5 MiB
JavaScript
Raw Permalink Normal View History

2025-08-02 02:00:33 +02:00
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if (typeof define === 'function' && define.amd) define([], factory);
else {
var a = factory();
for (var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}})(globalThis, function () {
"use strict";var __exports__=(()=>{var sre=Object.create;var Nv=Object.defineProperty;var are=Object.getOwnPropertyDescriptor;var lre=Object.getOwnPropertyNames;var cre=Object.getPrototypeOf,ure=Object.prototype.hasOwnProperty;var fre=(t,e,r)=>e in t?Nv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var P6=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var It=(t,e)=>()=>(t&&(e=t(t=0)),e);var Qt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),As=(t,e)=>{for(var r in e)Nv(t,r,{get:e[r],enumerable:!0})},R6=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of lre(e))!ure.call(t,n)&&n!==r&&Nv(t,n,{get:()=>e[n],enumerable:!(i=are(e,n))||i.enumerable});return t};var ga=(t,e,r)=>(r=t!=null?sre(cre(t)):{},R6(e||!t||!t.__esModule?Nv(r,"default",{value:t,enumerable:!0}):r,t)),B6=t=>R6(Nv({},"__esModule",{value:!0}),t);var Yr=(t,e,r)=>(fre(t,typeof e!="symbol"?e+"":e,r),r);var c5=Qt((Y3,K3)=>{(function(t,e){typeof Y3=="object"&&typeof K3<"u"?K3.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self,t.mapboxgl=e())})(Y3,function(){"use strict";var t,e,r;function i(n,o){if(!t)t=o;else if(!e)e=o;else{var s="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",l={};t(l),r=o(l),typeof window<"u"&&(r.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}}return i(["exports"],function(n){"use strict";function o(a,c){return a(c={exports:{}},c.exports),c.exports}var s=l;function l(a,c,f,x){this.cx=3*a,this.bx=3*(f-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*c,this.by=3*(x-c)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=x,this.p2x=f,this.p2y=x}l.prototype.sampleCurveX=function(a){return((this.ax*a+this.bx)*a+this.cx)*a},l.prototype.sampleCurveY=function(a){return((this.ay*a+this.by)*a+this.cy)*a},l.prototype.sampleCurveDerivativeX=function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},l.prototype.solveCurveX=function(a,c){var f,x,S,I,D;for(c===void 0&&(c=1e-6),S=a,D=0;D<8;D++){if(I=this.sampleCurveX(S)-a,Math.abs(I)<c)return S;var H=this.sampleCurveDerivativeX(S);if(Math.abs(H)<1e-6)break;S-=I/H}if((S=a)<(f=0))return f;if(S>(x=1))return x;for(;f<x;){if(I=this.sampleCurveX(S),Math.abs(I-a)<c)return S;a>I?f=S:x=S,S=.5*(x-f)+f}return S},l.prototype.solve=function(a,c){return this.sampleCurveY(this.solveCurveX(a,c))};var u=h;function h(a,c){this.x=a,this.y=c}h.prototype={clone:function(){return new h(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,c){return this.clone()._rotateAround(a,c)},matMult:function(a){return this.clone()._matMult(a)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var c=a.x-this.x,f=a.y-this.y;return c*c+f*f},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,c){return Math.atan2(this.x*c-this.y*a,this.x*a+this.y*c)},_matMult:function(a){var c=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=c,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,t
precision mediump float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif`,`#ifdef GL_ES
precision highp float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}`),Xh=dt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),BA=dt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),OA=dt(`varying vec3 v_data;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main(void) {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),qf=dt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),op=dt(`uniform highp float u_intensity;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#define GAUSS_COEF 0.3989422804014327
void main() {
#pragma mapbox: initialize highp float weight
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius
const highp float ZERO=1.0/255.0/16.0;
#define GAUSS_COEF 0.3989422804014327
void main(void) {
#pragma mapbox: initialize highp float weight
#pragma mapbox: initialize mediump float radius
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),sp=dt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(0.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),ap=dt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),tf=dt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),lp=dt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),cp=dt(`#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_FragColor=color*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);}`),Xf=dt(`varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),Yf=dt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),DA=dt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),P=dt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define highp vec4 color
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize highp vec4 color
vec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),U=dt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
? a_pos
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),G=dt(`#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),Q=dt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
#define PI 3.141592653589793
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),le=dt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`),ce=dt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`),_e=dt(`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),Qe=dt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),qe=dt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),ct=dt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`),Nt=dt(`#define SDF_PX 8.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),jt=dt(`#define SDF_PX 8.0
#define SDF 1.0
#define ICON 0.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`);function dt(d,_){var p=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,b=_.match(/attribute ([\w]+) ([\w]+)/g),B=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),k=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),V=k?k.concat(B):B,q={};return{fragmentSource:d=d.replace(p,function(re,ue,Ee,Ce,Me){return q[Me]=!0,ue==="define"?`
#ifndef HAS_UNIFORM_u_`+Me+`
varying `+Ee+" "+Ce+" "+Me+`;
#else
uniform `+Ee+" "+Ce+" u_"+Me+`;
#endif
`:`
#ifdef HAS_UNIFORM_u_`+Me+`
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`}),vertexSource:_=_.replace(p,function(re,ue,Ee,Ce,Me){var He=Ce==="float"?"vec2":"vec4",Ue=Me.match(/color/)?"color":He;return q[Me]?ue==="define"?`
#ifndef HAS_UNIFORM_u_`+Me+`
uniform lowp float u_`+Me+`_t;
attribute `+Ee+" "+He+" a_"+Me+`;
varying `+Ee+" "+Ce+" "+Me+`;
#else
uniform `+Ee+" "+Ce+" u_"+Me+`;
#endif
`:Ue==="vec4"?`
#ifndef HAS_UNIFORM_u_`+Me+`
`+Me+" = a_"+Me+`;
#else
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`:`
#ifndef HAS_UNIFORM_u_`+Me+`
`+Me+" = unpack_mix_"+Ue+"(a_"+Me+", u_"+Me+`_t);
#else
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`:ue==="define"?`
#ifndef HAS_UNIFORM_u_`+Me+`
uniform lowp float u_`+Me+`_t;
attribute `+Ee+" "+He+" a_"+Me+`;
#else
uniform `+Ee+" "+Ce+" u_"+Me+`;
#endif
`:Ue==="vec4"?`
#ifndef HAS_UNIFORM_u_`+Me+`
`+Ee+" "+Ce+" "+Me+" = a_"+Me+`;
#else
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`:`
#ifndef HAS_UNIFORM_u_`+Me+`
`+Ee+" "+Ce+" "+Me+" = unpack_mix_"+Ue+"(a_"+Me+", u_"+Me+`_t);
#else
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`}),staticAttributes:b,staticUniforms:V}}var fr=Object.freeze({__proto__:null,prelude:uu,background:Xh,backgroundPattern:BA,circle:OA,clippingMask:qf,heatmap:op,heatmapTexture:sp,collisionBox:ap,collisionCircle:tf,debug:lp,fill:cp,fillOutline:Xf,fillOutlinePattern:Yf,fillPattern:DA,fillExtrusion:P,fillExtrusionPattern:U,hillshadePrepare:G,hillshade:Q,line:le,lineGradient:ce,linePattern:_e,lineSDF:Qe,raster:qe,symbolIcon:ct,symbolSDF:Nt,symbolTextAndIcon:jt}),mi=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function ut(d){for(var _=[],p=0;p<d.length;p++)if(d[p]!==null){var b=d[p].split(" ");_.push(b.pop())}return _}mi.prototype.bind=function(d,_,p,b,B,k,V,q){this.context=d;for(var re=this.boundPaintVertexBuffers.length!==b.length,ue=0;!re&&ue<b.length;ue++)this.boundPaintVertexBuffers[ue]!==b[ue]&&(re=!0);d.extVertexArrayObject&&this.vao&&this.boundProgram===_&&this.boundLayoutVertexBuffer===p&&!re&&this.boundIndexBuffer===B&&this.boundVertexOffset===k&&this.boundDynamicVertexBuffer===V&&this.boundDynamicVertexBuffer2===q?(d.bindVertexArrayOES.set(this.vao),V&&V.bind(),B&&B.dynamicDraw&&B.bind(),q&&q.bind()):this.freshBind(_,p,b,B,k,V,q)},mi.prototype.freshBind=function(d,_,p,b,B,k,V){var q,re=d.numAttributes,ue=this.context,Ee=ue.gl;if(ue.extVertexArrayObject)this.vao&&this.destroy(),this.vao=ue.extVertexArrayObject.createVertexArrayOES(),ue.bindVertexArrayOES.set(this.vao),q=0,this.boundProgram=d,this.boundLayoutVertexBuffer=_,this.boundPaintVertexBuffers=p,this.boundIndexBuffer=b,this.boundVertexOffset=B,this.boundDynamicVertexBuffer=k,this.boundDynamicVertexBuffer2=V;else{q=ue.currentNumAttributes||0;for(var Ce=re;Ce<q;Ce++)Ee.disableVertexAttribArray(Ce)}_.enableAttributes(Ee,d);for(var Me=0,He=p;Me<He.length;Me+=1)He[Me].enableAttributes(Ee,d);k&&k.enableAttributes(Ee,d),V&&V.enableAttributes(Ee,d),_.bind(),_.setVertexAttribPointers(Ee,d,B);for(var Ue=0,Ze=p;Ue<Ze.length;Ue+=1){var Ne=Ze[Ue];Ne.bind(),Ne.setVertexAttribPointers(Ee,d,B)}k&&(k.bind(),k.setVertexAttribPointers(Ee,d,B)),b&&b.bind(),V&&(V.bind(),V.setVertexAttribPointers(Ee,d,B)),ue.currentNumAttributes=re},mi.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var St=function(d,_,p,b,B,k){var V=d.gl;this.program=V.createProgram();for(var q=ut(p.staticAttributes),re=b?b.getBinderAttributes():[],ue=q.concat(re),Ee=p.staticUniforms?ut(p.staticUniforms):[],Ce=b?b.getBinderUniforms():[],Me=[],He=0,Ue=Ee.concat(Ce);He<Ue.length;He+=1){var Ze=Ue[He];Me.indexOf(Ze)<0&&Me.push(Ze)}var Ne=b?b.defines():[];k&&Ne.push("#define OVERDRAW_INSPECTOR;");var Ke=Ne.concat(uu.fragmentSource,p.fragmentSource).join(`
`),it=Ne.concat(uu.vertexSource,p.vertexSource).join(`
`),pt=V.createShader(V.FRAGMENT_SHADER);if(V.isContextLost())this.failedToCreate=!0;else{V.shaderSource(pt,Ke),V.compileShader(pt),V.attachShader(this.program,pt);var Ct=V.createShader(V.VERTEX_SHADER);if(V.isContextLost())this.failedToCreate=!0;else{V.shaderSource(Ct,it),V.compileShader(Ct),V.attachShader(this.program,Ct),this.attributes={};var xt={};this.numAttributes=ue.length;for(var Rt=0;Rt<this.numAttributes;Rt++)ue[Rt]&&(V.bindAttribLocation(this.program,Rt,ue[Rt]),this.attributes[ue[Rt]]=Rt);V.linkProgram(this.program),V.deleteShader(Ct),V.deleteShader(pt);for(var Wt=0;Wt<Me.length;Wt++){var ar=Me[Wt];if(ar&&!xt[ar]){var ir=V.getUniformLocation(this.program,ar);ir&&(xt[ar]=ir)}}this.fixedUniforms=B(d,xt),this.binderUniforms=b?b.getUniforms(d,xt):[]}}};function cr(d,_,p){var b=1/pn(p,1,_.transform.tileZoom),B=Math.pow(2,p.tileID.overscaledZ),k=p.tileSize*Math.pow(2,_.transform.tileZoom)/B,V=k*(p.tileID.canonical.x+p.tileID.wrap*B),q=k*p.tileID.canonical.y;return{u_image:0,u_texsize:p.imageAtlasTexture.size,u_scale:[b,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[V>>16,q>>16],u_pixel_coord_lower:[65535&V,65535&q]}}St.prototype.draw=function(d,_,p,b,B,k,V,q,re,ue,Ee,Ce,Me,He,Ue,Ze){var Ne,Ke=d.gl;if(!this.failedToCreate){for(var it in d.program.set(this.program),d.setDepthMode(p),d.setStencilMode(b),d.setColorMode(B),d.setCullFace(k),this.fixedUniforms)this.fixedUniforms[it].set(V[it]);He&&He.setUniforms(d,this.binderUniforms,Ce,{zoom:Me});for(var pt=(Ne={},Ne[Ke.LINES]=2,Ne[Ke.TRIANGLES]=3,Ne[Ke.LINE_STRIP]=1,Ne)[_],Ct=0,xt=Ee.get();Ct<xt.length;Ct+=1){var Rt=xt[Ct],Wt=Rt.vaos||(Rt.vaos={});(Wt[q]||(Wt[q]=new mi)).bind(d,this,re,He?He.getPaintVertexBuffers():[],ue,Rt.vertexOffset,Ue,Ze),Ke.drawElements(_,Rt.primitiveLength*pt,Ke.UNSIGNED_SHORT,Rt.primitiveOffset*pt*2)}}};var Xr=function(d,_,p,b){var B=_.style.light,k=B.properties.get("position"),V=[k.x,k.y,k.z],q=n.create$1();B.properties.get("anchor")==="viewport"&&n.fromRotation(q,-_.transform.angle),n.transformMat3(V,V,q);var re=B.properties.get("color");return{u_matrix:d,u_lightpos:V,u_lightintensity:B.properties.get("intensity"),u_lightcolor:[re.r,re.g,re.b],u_vertical_gradient:+p,u_opacity:b}},g=function(d,_,p,b,B,k,V){return n.extend(Xr(d,_,p,b),cr(k,_,V),{u_height_factor:-Math.pow(2,B.overscaledZ)/V.tileSize/8})},ki=function(d){return{u_matrix:d}},Wr=function(d,_,p,b){return n.extend(ki(d),cr(p,_,b))},Re=function(d,_){return{u_matrix:d,u_world:_}},Ti=function(d,_,p,b,B){return n.extend(Wr(d,_,p,b),{u_world:B})},An=function(d,_,p,b){var B,k,V=d.transform;if(b.paint.get("circle-pitch-alignment")==="map"){var q=pn(p,1,V.zoom);B=!0,k=[q,q]}else B=!1,k=V.pixelsToGLUnits;return{u_camera_to_center_distance:V.cameraToCenterDistance,u_scale_with_map:+(b.paint.get("circle-pitch-scale")==="map"),u_matrix:d.translatePosMatrix(_.posMatrix,p,b.paint.get("circle-translate"),b.paint.get("circle-translate-anchor")),u_pitch_with_map:+B,u_device_pixel_ratio:n.browser.devicePixelRatio,u_extrude_scale:k}},Qn=function(d,_,p){var b=pn(p,1,_.zoom),B=Math.pow(2,_.zoom-p.tileID.overscaledZ),k=p.tileID.overscaleFactor();return{u_matrix:d,u_camera_to_center_distance:_.cameraToCenterDistance,u_pixels_to_tile_units:b,u_extrude_scale:[_.pixelsToGLUnits[0]/(b*B),_.pixelsToGLUnits[1]/(b*B)],u_overscale_factor:k}},En=function(d,_,p){return{u_matrix:d,u_inv_matrix:_,u_camera_to_center_distance:p.cameraToCenterDistance,u_viewport_size:[p.width,p.height]}},ln=function(d,_,p){return p===void 0&&(p=1),{u_matrix:d,u_color:_,u_overlay:0,u_overlay_scale:p}},$n=function(d){return{u_matrix:d}},ji=function(d,_,p,b){return{u_matrix:d,u_extrude_scale:pn(_,1,p),u_intensity:b}},Gi=function(d,_,p){var b=d.transform;return{u_matrix:Ko(d,_,p),u_ratio:1/pn(_,1,b.zoom),u_device_pixel_ratio:n.browser.devicePixelRatio,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},an=function(d,_,p,b){return n.extend(Gi(d,_,p),{u_image:0,u_image_height:b})},ea=function(d,_,p,b){var B=d.transform,k=Hs(_,B);return{u_matrix:Ko(d,_,p),u_texsize:_.imageAtlasTexture.size,u_ratio:1/pn(_,1,B.zoom),u_device
`+Je+` AT
`;return function(){var tr=new Error("get-stack-trace"),qr=tr&&tr.stack?tr.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",sn=t.console&&(t.console.warn||t.console.log);return sn&&sn.call(t.console,vt,qr),xe.apply(this,arguments)}}var O;typeof Object.assign!="function"?O=function(Be){if(Be===i||Be===null)throw new TypeError("Cannot convert undefined or null to object");for(var Je=Object(Be),vt=1;vt<arguments.length;vt++){var tr=arguments[vt];if(tr!==i&&tr!==null)for(var qr in tr)tr.hasOwnProperty(qr)&&(Je[qr]=tr[qr])}return Je}:O=Object.assign;var F=M(function(Be,Je,vt){for(var tr=Object.keys(Je),qr=0;qr<tr.length;)(!vt||vt&&Be[tr[qr]]===i)&&(Be[tr[qr]]=Je[tr[qr]]),qr++;return Be},"extend","Use `assign`."),z=M(function(Be,Je){return F(Be,Je,!0)},"merge","Use `assign`.");function W(xe,Be,Je){var vt=Be.prototype,tr;tr=xe.prototype=Object.create(vt),tr.constructor=xe,tr._super=vt,Je&&O(tr,Je)}function J(xe,Be){return function(){return xe.apply(Be,arguments)}}function K(xe,Be){return typeof xe==s?xe.apply(Be&&Be[0]||i,Be):xe}function ne(xe,Be){return xe===i?Be:xe}function ge(xe,Be,Je){E($(Be),function(vt){xe.addEventListener(vt,Je,!1)})}function j(xe,Be,Je){E($(Be),function(vt){xe.removeEventListener(vt,Je,!1)})}function me(xe,Be){for(;xe;){if(xe==Be)return!0;xe=xe.parentNode}return!1}function fe(xe,Be){return xe.indexOf(Be)>-1}function $(xe){return xe.trim().split(/\s+/g)}function Z(xe,Be,Je){if(xe.indexOf&&!Je)return xe.indexOf(Be);for(var vt=0;vt<xe.length;){if(Je&&xe[vt][Je]==Be||!Je&&xe[vt]===Be)return vt;vt++}return-1}function we(xe){return Array.prototype.slice.call(xe,0)}function Oe(xe,Be,Je){for(var vt=[],tr=[],qr=0;qr<xe.length;){var sn=Be?xe[qr][Be]:xe[qr];Z(tr,sn)<0&&vt.push(xe[qr]),tr[qr]=sn,qr++}return Je&&(Be?vt=vt.sort(function(ts,vs){return ts[Be]>vs[Be]}):vt=vt.sort()),vt}function he(xe,Be){for(var Je,vt,tr=Be[0].toUpperCase()+Be.slice(1),qr=0;qr<n.length;){if(Je=n[qr],vt=Je?Je+tr:Be,vt in xe)return vt;qr++}return i}var Le=1;function ft(){return Le++}function Vt(xe){var Be=xe.ownerDocument||xe;return Be.defaultView||Be.parentWindow||t}var Yt=/mobile|tablet|ip(ad|hone|od)|android/i,mr="ontouchstart"in t,Er=he(t,"PointerEvent")!==i,Jr=mr&&Yt.test(navigator.userAgent),or="touch",ai="pen",Jt="mouse",qt="kinect",wi=25,ae=1,be=2,je=4,lt=8,Ft=1,wt=2,$r=4,xi=8,Ki=16,kn=wt|$r,Zi=xi|Ki,Hi=kn|Zi,Un=["x","y"],No=["clientX","clientY"];function Ji(xe,Be){var Je=this;this.manager=xe,this.callback=Be,this.element=xe.element,this.target=xe.options.inputTarget,this.domHandler=function(vt){K(xe.options.enable,[xe])&&Je.handler(vt)},this.init()}Ji.prototype={handler:function(){},init:function(){this.evEl&&ge(this.element,this.evEl,this.domHandler),this.evTarget&&ge(this.target,this.evTarget,this.domHandler),this.evWin&&ge(Vt(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&j(this.element,this.evEl,this.domHandler),this.evTarget&&j(this.target,this.evTarget,this.domHandler),this.evWin&&j(Vt(this.element),this.evWin,this.domHandler)}};function Bi(xe){var Be,Je=xe.options.inputClass;return Je?Be=Je:Er?Be=Ml:Jr?Be=rt:mr?Be=Ht:Be=sl,new Be(xe,yn)}function yn(xe,Be,Je){var vt=Je.pointers.length,tr=Je.changedPointers.length,qr=Be&ae&&vt-tr===0,sn=Be&(je|lt)&&vt-tr===0;Je.isFirst=!!qr,Je.isFinal=!!sn,qr&&(xe.session={}),Je.eventType=Be,po(xe,Je),xe.emit("hammer.input",Je),xe.recognize(Je),xe.session.prevInput=Je}function po(xe,Be){var Je=xe.session,vt=Be.pointers,tr=vt.length;Je.firstInput||(Je.firstInput=Ur(Be)),tr>1&&!Je.firstMultiple?Je.firstMultiple=Ur(Be):tr===1&&(Je.firstMultiple=!1);var qr=Je.firstInput,sn=Je.firstMultiple,Co=sn?sn.center:qr.center,ts=Be.center=ci(vt);Be.timeStamp=h(),Be.deltaTime=Be.timeStamp-qr.timeStamp,Be.angle=Eo(Co,ts),Be.distance=To(Co,ts),kr(Je,Be),Be.offsetDirection=Dn(Be.deltaX,Be.deltaY);var vs=to(Be.deltaTime,Be.deltaX,Be.deltaY);Be.overallVelocityX=vs.x,Be.overallVelocityY=vs.y,Be.overallVelocity=u(vs.x)>u(vs.y)?vs.x:vs.y,Be.scale=sn?So(sn.pointers,vt):1,Be.rotation=sn?Xo(sn.pointers,
`&&t[o]!=="\r";o++)u+=t[o];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),o--),!lme(u)){let T;return u.trim().length===0?T="Invalid space after '<'.":T="Tag '"+u+"' is an invalid name.",ba("InvalidTag",T,Sc(t,o))}let h=ime(t,o);if(h===!1)return ba("InvalidAttr","Attributes for '"+u+"' have open quote.",Sc(t,o));let v=h.value;if(o=h.index,v[v.length-1]==="/"){let T=o-v.length;v=v.substring(0,v.length-1);let E=G7(v,e);if(E===!0)i=!0;else return ba(E.err.code,E.err.msg,Sc(t,T+E.err.line))}else if(l)if(h.tagClosed){if(v.trim().length>0)return ba("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",Sc(t,s));{let T=r.pop();if(u!==T.tagName){let E=Sc(t,T.tagStartPos);return ba("InvalidTag","Expected closing tag '"+T.tagName+"' (opened in line "+E.line+", col "+E.col+") instead of closing tag '"+u+"'.",Sc(t,s))}r.length==0&&(n=!0)}}else return ba("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",Sc(t,o));else{let T=G7(v,e);if(T!==!0)return ba(T.err.code,T.err.msg,Sc(t,o-v.length+T.err.line));if(n===!0)return ba("InvalidXml","Multiple possible root nodes found.",Sc(t,o));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:s}),i=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=j7(t,o);continue}else if(t[o+1]==="?"){if(o=H7(t,++o),o.err)return o}else break;else if(t[o]==="&"){let T=sme(t,o);if(T==-1)return ba("InvalidChar","char '&' is not expected.",Sc(t,o));o=T}else if(n===!0&&!V7(t[o]))return ba("InvalidXml","Extra text at the end",Sc(t,o));t[o]==="<"&&o--}}else{if(V7(t[o]))continue;return ba("InvalidChar","char '"+t[o]+"' is not expected.",Sc(t,o))}if(i){if(r.length==1)return ba("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Sc(t,r[0].tagStartPos));if(r.length>0)return ba("InvalidXml","Invalid '"+JSON.stringify(r.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ba("InvalidXml","Start tag expected.",1);return!0};function V7(t){return t===" "||t===" "||t===`
`||t==="\r"}function H7(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let i=t.substr(r,e-r);if(e>5&&i==="xml")return ba("InvalidXml","XML declaration allowed only at the start of the document.",Sc(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function j7(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var tme='"',rme="'";function ime(t,e){let r="",i="",n=!1;for(;e<t.length;e++){if(t[e]===tme||t[e]===rme)i===""?i=t[e]:i!==t[e]||(i="");else if(t[e]===">"&&i===""){n=!0;break}r+=t[e]}return i!==""?!1:{value:r,index:e,tagClosed:n}}var nme=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function G7(t,e){let r=lD.getAllMatches(t,nme),i={};for(let n=0;n<r.length;n++){if(r[n][1].length===0)return ba("InvalidAttr","Attribute '"+r[n][2]+"' has no space in starting.",fb(r[n]));if(r[n][3]!==void 0&&r[n][4]===void 0)return ba("InvalidAttr","Attribute '"+r[n][2]+"' is without value.",fb(r[n]));if(r[n][3]===void 0&&!e.allowBooleanAttributes)return ba("InvalidAttr","boolean attribute '"+r[n][2]+"' is not allowed.",fb(r[n]));let o=r[n][2];if(!ame(o))return ba("InvalidAttr","Attribute '"+o+"' is an invalid name.",fb(r[n]));if(!i.hasOwnProperty(o))i[o]=1;else return ba("InvalidAttr","Attribute '"+o+"' is repeated.",fb(r[n]))}return!0}function ome(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function sme(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,ome(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function ba(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function ame(t){return lD.isName(t)}function lme(t){return lD.isName(t)}function Sc(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function fb(t){return t.startIndex+t[1].length}});var X7=Qt(uD=>{var q7={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}},cme=function(t){return Object.assign({},q7,t)};uD.buildOptions=cme;uD.defaultOptions=q7});var K7=Qt((I$e,Y7)=>{"use strict";var fD=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,[":@"]:e[":@"]}):this.child.push({[e.tagname]:e.child})}};Y7.exports=fD});var J7=Qt((P$e,Z7)=>{var ume=kS();function fme(t,e){let r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let i=1,n=!1,o=!1,s="";for(;e<t.length;e++)if(t[e]==="<"&&!o){if(n&&pme(t,e))e+=7,[entityName,val,e]=hme(t,e+1),val.indexOf("&")===-1&&(r[_me(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(n&&Ame(t,e))e+=8;else if(n&&mme(t,e))e+=8;else if(n&&gme(t,e))e+=9;else if(dme)o=!0;else throw new Error("Invalid DOCTYPE");i++,s=""}else if(t[e]===">"){if(o?t[e-1]==="-"&&t[e-2]==="-"&&(o=!1,i--):i--,i===0)break}else t[e]==="
`);let e=new hb("!xml"),r=e,i="",n="";for(let o=0;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="/"){let l=$m(t,">",o,"Closing Tag is not closed."),u=t.substring(o+2,l).trim();if(this.options.removeNSPrefix){let T=u.indexOf(":");T!==-1&&(u=u.substr(T+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(i=this.saveTextToParentTag(i,r,n));let h=n.substring(n.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let v=0;h&&this.options.unpairedTags.indexOf(h)!==-1?(v=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):v=n.lastIndexOf("."),n=n.substring(0,v),r=this.tagsNodeStack.pop(),i="",o=l}else if(t[o+1]==="?"){let l=dD(t,o,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,r,n),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){let u=new hb(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,n,l.tagName)),this.addChild(r,u,n)}o=l.closeIndex+1}else if(t.substr(o+1,3)==="!--"){let l=$m(t,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(o+4,l-2);i=this.saveTextToParentTag(i,r,n),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}o=l}else if(t.substr(o+1,2)==="!D"){let l=Tme(t,o);this.docTypeEntities=l.entities,o=l.i}else if(t.substr(o+1,2)==="!["){let l=$m(t,"]]>",o,"CDATA is not closed.")-2,u=t.substring(o+9,l);i=this.saveTextToParentTag(i,r,n);let h=this.parseTextData(u,r.tagname,n,!0,!1,!0,!0);h==null&&(h=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,h),o=l+2}else{let l=dD(t,o,this.options.removeNSPrefix),u=l.tagName,h=l.rawTagName,v=l.tagExp,T=l.attrExpPresent,E=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&i&&r.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,r,n,!1));let M=r;if(M&&this.options.unpairedTags.indexOf(M.tagname)!==-1&&(r=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),u!==e.tagname&&(n+=n?"."+u:u),this.isItStopNode(this.options.stopNodes,n,u)){let O="";if(v.length>0&&v.lastIndexOf("/")===v.length-1)o=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)o=l.closeIndex;else{let z=this.readStopNodeData(t,h,E+1);if(!z)throw new Error(`Unexpected end of ${h}`);o=z.i,O=z.tagContent}let F=new hb(u);u!==v&&T&&(F[":@"]=this.buildAttributesMap(v,n,u)),O&&(O=this.parseTextData(O,u,n,!0,T,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),F.add(this.options.textNodeName,O),this.addChild(r,F,n)}else{if(v.length>0&&v.lastIndexOf("/")===v.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),n=n.substr(0,n.length-1),v=u):v=v.substr(0,v.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let O=new hb(u);u!==v&&T&&(O[":@"]=this.buildAttributesMap(v,n,u)),this.addChild(r,O,n),n=n.substr(0,n.lastIndexOf("."))}else{let O=new hb(u);this.tagsNodeStack.push(r),u!==v&&T&&(O[":@"]=this.buildAttributesMap(v,n,u)),this.addChild(r,O,n),r=O}i="",o=E}}else i+=t[o];return e.child};function Bme(t,e,r){let i=this.options.updateTag(e.tagname,r,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),t.addChild(e))}var Ome=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){let r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function Dme(t,e,r,i){return t&&(i===void 0&&(i=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,i),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Lme(t,e,r){let i="*."+r;for(let n in t){let o=t[n];if(i===o||e===o)return!0}return!1}function Fme(t,e,r=">"){let i,n="";fo
`;function Xme(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=qme),cG(t,e,"",r)}function cG(t,e,r,i){let n="",o=!1;for(let s=0;s<t.length;s++){let l=t[s],u=Yme(l);if(u===void 0)continue;let h="";if(r.length===0?h=u:h=`${r}.${u}`,u===e.textNodeName){let O=l[u];Kme(h,e)||(O=e.tagValueProcessor(u,O),O=uG(O,e)),o&&(n+=i),n+=O,o=!1;continue}else if(u===e.cdataPropName){o&&(n+=i),n+=`<![CDATA[${l[u][0][e.textNodeName]}]]>`,o=!1;continue}else if(u===e.commentPropName){n+=i+`<!--${l[u][0][e.textNodeName]}-->`,o=!0;continue}else if(u[0]==="?"){let O=lG(l[":@"],e),F=u==="?xml"?"":i,z=l[u][0][e.textNodeName];z=z.length!==0?" "+z:"",n+=F+`<${u}${z}${O}?>`,o=!0;continue}let v=i;v!==""&&(v+=e.indentBy);let T=lG(l[":@"],e),E=i+`<${u}${T}`,M=cG(l[u],e,h,v);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?n+=E+">":n+=E+"/>":(!M||M.length===0)&&e.suppressEmptyNode?n+=E+"/>":M&&M.endsWith(">")?n+=E+`>${M}${i}</${u}>`:(n+=E+">",M&&i!==""&&(M.includes("/>")||M.includes("</"))?n+=i+e.indentBy+M+i:n+=M,n+=`</${u}>`),o=!0}return n}function Yme(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=e[r];if(t.hasOwnProperty(i)&&i!==":@")return i}}function lG(t,e){let r="";if(t&&!e.ignoreAttributes)for(let i in t){if(!t.hasOwnProperty(i))continue;let n=e.attributeValueProcessor(i,t[i]);n=uG(n,e),n===!0&&e.suppressBooleanAttributes?r+=` ${i.substr(e.attributeNamePrefix.length)}`:r+=` ${i.substr(e.attributeNamePrefix.length)}="${n}"`}return r}function Kme(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===t||e.stopNodes[i]==="*."+r)return!0;return!1}function uG(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let i=e.entities[r];t=t.replace(i.regex,i.val)}return t}fG.exports=Xme});var pG=Qt((F$e,dG)=>{"use strict";var Zme=hG(),Jme={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function $p(t){this.options=Object.assign({},Jme,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ege),this.processTextOrObjNode=Qme,this.options.format?(this.indentate=$me,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}$p.prototype.build=function(t){return this.options.preserveOrder?Zme(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};$p.prototype.j2x=function(t,e){let r="",i="";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n))if(typeof t[n]>"u")this.isAttribute(n)&&(i+="");else if(t[n]===null)this.isAttribute(n)?i+="":n[0]==="?"?i+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+n+"/"+this.tagEndChar;else if(t[n]instanceof Date)i+=this.buildTextValNode(t[n],n,"",e);else if(typeof t[n]!="object"){let o=this.isAttribute(n);if(o)r+=this.buildAttrPairStr(o,""+t[n]);else if(n===this.options.textNodeName){let s=this.options.tagValueProcessor(n,""+t[n]);i+=this.replaceEntitiesValue(s)}else i+=this.buildTextValNode(t[n],n,"",e)}else if(Array.isArray(t[n])){let o=t[n].length,s="";for(let l=0;l<o;l++){let u=t[n][l];typeof u>"u"||(u===null?n[0]==="?"?i+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+n+"/"+this.tagEndChar:typeof u=="object"?this.options.oneListGroup?s+=this.j2x(u,e+1).val:s+=this.processTextOrObjNode(u,n,e):s+=this.buildTextValNode(u,n,"",e))}this.options.oneListGroup&&(s=this.buildObjectNode(s,n,"",e)),i+=s}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){let o=Object.keys(t[n]),s=o.length;for(let l=0;l<s;l++)r+=this.buildAttrPairStr(o[l],""+t[n][o[l]])}else i+=this.processTextOrObjNode(t[n],n,e);return{attrStr:r,val:i}};$p.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Qme(t,e,r){let i=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,r):this.buildObjectNode(i.val,e,i.attrStr,r)}$p.prototype.buildObjectNode=function(t,e,r,i){if(t==="")return e[0]==="?"?this.indentate(i)+"<"+e+r+"?"+this.tagEndChar:this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",n=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(i)+"<"+e+r+o+">"+t+n:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(i)+`<!--${t}-->`+this.newLine:this.indentate(i)+"<"+e+r+o+this.tagEndChar+t+this.indentate(i)+n}};$p.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};$p.prototype.buildTextValNode=function(t,e,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(i)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),n===""?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+n+"</"+e+this.tagEndChar}};$p.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function $me(t){return this.options.indentBy.repeat(t)}function ege(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}dG.exports=$p});var mG=Qt((N$e,AG)=>{"use strict";var tge=cD(),rge=aG(),ige=pG();AG.exports={XMLParser:rge,XMLValidator:tge,XMLBuilder:ige}});var ED=Qt((CG,gb)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof P6=="function"&&typeof gb=="object"&&gb&&gb.exports?gb.exports=e():(t.dcodeIO=t.dcodeIO||{}).Long=e()})(CG,function(){"use strict";function t($,Z,we){this.low=$|0,this.
`;break;case"r":dr+="\r";break;case"t":dr+=" ";break;case"b":dr+="\b";break;case"f":dr+="\f";break;case"v":dr+="\v";break;default:dr+=to}else dr+=to;return ci||me('Unclosed quote after "'+dr+'"',qt),{type:n,value:dr,raw:Ur+dr+Ur}},Hi=function(){var dr=je(qt),Ur=qt,ci;for(Er(dr)?qt++:me("Unexpected "+be(qt),qt);qt<lt&&(dr=je(qt),Jr(dr));)qt++;return ci=Jt.slice(Ur,qt),Le.hasOwnProperty(ci)?{type:n,value:Le[ci],raw:ci}:ci===ft?{type:o}:{type:r,name:ci}},Un=function(dr){for(var Ur,ci=[],to,Dn=!1,To=0;qt<lt;)if(Ft(),Ur=je(qt),Ur===dr){Dn=!0,qt++,dr===W&&To&&To>=ci.length&&me("Unexpected token "+String.fromCharCode(dr),qt);break}else if(Ur===M){if(qt++,To++,To!==ci.length){if(dr===W)me("Unexpected token ,",qt);else if(dr===K)for(var Eo=ci.length;Eo<To;Eo++)ci.push(null)}}else to=wt(),(!to||to.type===e)&&me("Expected comma",qt),ci.push(to);return Dn||me("Expected "+String.fromCharCode(dr),qt),ci},No=function(){var dr,Ur;for(dr=je(qt),dr===z?Ur=Ji():Ur=Hi(),Ft(),dr=je(qt);dr===E||dr===J||dr===z;)qt++,dr===E?(Ft(),Ur={type:i,computed:!1,object:Ur,property:Hi()}):dr===J?(Ur={type:i,computed:!0,object:Ur,property:wt()},Ft(),dr=je(qt),dr!==K&&me("Unclosed [",qt),qt++):dr===z&&(Ur={type:s,arguments:Un(W),callee:Ur}),Ft(),dr=je(qt);return Ur},Ji=function(){qt++;var dr=wt();if(Ft(),je(qt)===W)return qt++,dr;me("Unclosed (",qt)},Bi=function(){return qt++,{type:T,elements:Un(K)}},yn=[],po,kr;qt<lt;)po=je(qt),po===ge||po===M?qt++:(kr=wt())?yn.push(kr):qt<lt&&me('Unexpected "'+be(qt)+'"',qt);return yn.length===1?yn[0]:{type:e,body:yn}};if(or.version="0.3.5",or.toString=function(){return"JavaScript Expression Parser (JSEP) v"+or.version},or.addUnaryOp=function(Jt){return Oe=Math.max(Jt.length,Oe),$[Jt]=fe,this},or.addBinaryOp=function(Jt,qt){return he=Math.max(Jt.length,he),Z[Jt]=qt,this},or.addLiteral=function(Jt,qt){return Le[Jt]=qt,this},or.removeUnaryOp=function(Jt){return delete $[Jt],Jt.length===Oe&&(Oe=we($)),this},or.removeAllUnaryOps=function(){return $={},Oe=0,this},or.removeBinaryOp=function(Jt){return delete Z[Jt],Jt.length===he&&(he=we(Z)),this},or.removeAllBinaryOps=function(){return Z={},he=0,this},or.removeLiteral=function(Jt){return delete Le[Jt],this},or.removeAllLiterals=function(){return Le={},this},typeof Xb>"u"){var ai=t.jsep;t.jsep=or,or.noConflict=function(){return t.jsep===or&&(t.jsep=ai),or}}else typeof bM<"u"&&bM.exports?Xb=bM.exports=or:Xb.parse=or})(Xb)});var QY=Qt(MM=>{"use strict";MM.byteLength=Bwe;MM.toByteArray=Dwe;MM.fromByteArray=Nwe;var Vh=[],Ku=[],Rwe=typeof Uint8Array<"u"?Uint8Array:Array,LF="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tg=0,ZY=LF.length;Tg<ZY;++Tg)Vh[Tg]=LF[Tg],Ku[LF.charCodeAt(Tg)]=Tg;var Tg,ZY;Ku["-".charCodeAt(0)]=62;Ku["_".charCodeAt(0)]=63;function JY(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Bwe(t){var e=JY(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Owe(t,e,r){return(e+r)*3/4-r}function Dwe(t){var e,r=JY(t),i=r[0],n=r[1],o=new Rwe(Owe(t,i,n)),s=0,l=n>0?i-4:i,u;for(u=0;u<l;u+=4)e=Ku[t.charCodeAt(u)]<<18|Ku[t.charCodeAt(u+1)]<<12|Ku[t.charCodeAt(u+2)]<<6|Ku[t.charCodeAt(u+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return n===2&&(e=Ku[t.charCodeAt(u)]<<2|Ku[t.charCodeAt(u+1)]>>4,o[s++]=e&255),n===1&&(e=Ku[t.charCodeAt(u)]<<10|Ku[t.charCodeAt(u+1)]<<4|Ku[t.charCodeAt(u+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Lwe(t){return Vh[t>>18&63]+Vh[t>>12&63]+Vh[t>>6&63]+Vh[t&63]}function Fwe(t,e,r){for(var i,n=[],o=e;o<r;o+=3)i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),n.push(Lwe(i));return n.join("")}function Nwe(t){for(var e,r=t.length,i=r%3,n=[],o=16383,s=0,l=r-i;s<l;s+=o)n.push(Fwe(t,s,s+o>l?l:s+o));return i===1?(e=t[r-1],n.push(Vh[e>>2]+Vh[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(Vh[e>>10]+Vh[e>>4&63]+Vh[e<<2&63]+"=")),n.join("")}});var gy=Qt((IM,$Y)=>{(function(t,e){typeof IM=="object"&&typeof $Y<"u"?e(IM):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t
((__t=(`+v+`))==null?'':_.escape(__t))+
'`:T?o+=`'+
((__t=(`+T+`))==null?'':__t)+
'`:E&&(o+=`';
`+E+`
__p+='`),h}),o+=`';
`;var s=e.variable;if(s){if(!BMe.test(s))throw new Error("variable is not a bare identifier: "+s)}else o=`with(obj||{}){
`+o+`}
`,s="obj";o=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
`+o+`return __p;
`;var l;try{l=new Function(s,"_",o)}catch(h){throw h.source=o,h}var u=function(h){return l.call(this,h,dn)};return u.source="function("+s+`){
`+o+"}",u}var r4,IMe,PMe,BMe,I$=It(()=>{HN();Rc();t4();r4=/(.)^/,IMe={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},PMe=/\\|'|\r|\n|\u2028|\u2029/g;BMe=/^\s*(\w|\$)+\s*$/});function mI(t,e,r){e=Uf(e);var i=e.length;if(!i)return qo(r)?r.call(t):r;for(var n=0;n<i;n++){var o=t?.[e[n]];o===void 0&&(o=r,n=i),t=qo(o)?o.call(t):o}return t}var P$=It(()=>{ru();Uy()});function gI(t){var e=++OMe+"";return t?t+e:e}var OMe,R$=It(()=>{OMe=0});function _I(t){var e=dn(t);return e._chain=!0,e}var B$=It(()=>{Rc()});function ww(t,e,r,i,n){if(!(i instanceof e))return t.apply(r,n);var o=_w(t.prototype),s=t.apply(o,n);return jl(s)?s:o}var i4=It(()=>{jN();hA()});var n4,Qd,Tw=It(()=>{Pc();i4();Rc();n4=Lo(function(t,e){var r=n4.placeholder,i=function(){for(var n=0,o=e.length,s=Array(o),l=0;l<o;l++)s[l]=e[l]===r?arguments[n++]:e[l];for(;n<arguments.length;)s.push(arguments[n++]);return ww(t,i,this,this,s)};return i});n4.placeholder=dn;Qd=n4});var Ew,o4=It(()=>{Pc();ru();i4();Ew=Lo(function(t,e,r){if(!qo(t))throw new TypeError("Bind must be called on a function");var i=Lo(function(n){return ww(t,i,e,this,r.concat(n))});return i})});var ls,Oc=It(()=>{SN();iu();ls=hw(as)});function Dc(t,e,r,i){if(i=i||[],!e&&e!==0)e=1/0;else if(e<=0)return i.concat(t);for(var n=i.length,o=0,s=as(t);o<s;o++){var l=t[o];if(ls(l)&&(oc(l)||Mg(l)))if(e>1)Dc(l,e-1,r,i),n=i.length;else for(var u=0,h=l.length;u<h;)i[n++]=l[u++];else r||(i[n++]=l)}return i}var Fg=It(()=>{iu();Oc();pA();XM()});var s4,O$=It(()=>{Pc();Fg();o4();s4=Lo(function(t,e){e=Dc(e,!1,!1);var r=e.length;if(r<1)throw new Error("bindAll must be passed function names");for(;r--;){var i=e[r];t[i]=Ew(t[i],t)}return t})});function yI(t,e){var r=function(i){var n=r.cache,o=""+(e?e.apply(this,arguments):i);return Sl(n,o)||(n[o]=t.apply(this,arguments)),n[o]};return r.cache={},r}var D$=It(()=>{Zd()});var Sw,a4=It(()=>{Pc();Sw=Lo(function(t,e,r){return setTimeout(function(){return t.apply(null,r)},e)})});var l4,L$=It(()=>{Tw();a4();Rc();l4=Qd(Sw,dn,1)});function vI(t,e,r){var i,n,o,s,l=0;r||(r={});var u=function(){l=r.leading===!1?0:Jd(),i=null,s=t.apply(n,o),i||(n=o=null)},h=function(){var v=Jd();!l&&r.leading===!1&&(l=v);var T=e-(v-l);return n=this,o=arguments,T<=0||T>e?(i&&(clearTimeout(i),i=null),l=v,s=t.apply(n,o),i||(n=o=null)):!i&&r.trailing!==!1&&(i=setTimeout(u,T)),s};return h.cancel=function(){clearTimeout(i),l=0,i=n=o=null},h}var F$=It(()=>{dI()});function xI(t,e,r){var i,n,o,s,l,u=function(){var v=Jd()-n;e>v?i=setTimeout(u,e-v):(i=null,r||(s=t.apply(l,o)),i||(o=l=null))},h=Lo(function(v){return l=this,o=v,n=Jd(),i||(i=setTimeout(u,e),r&&(s=t.apply(l,o))),s});return h.cancel=function(){clearTimeout(i),i=o=l=null},h}var N$=It(()=>{Pc();dI()});function bI(t,e){return Qd(e,t)}var k$=It(()=>{Tw()});function _A(t){return function(){return!t.apply(this,arguments)}}var wI=It(()=>{});function TI(){var t=arguments,e=t.length-1;return function(){for(var r=e,i=t[e].apply(this,arguments);r--;)i=t[r].call(this,i);return i}}var U$=It(()=>{});function EI(t,e){return function(){if(--t<1)return e.apply(this,arguments)}}var z$=It(()=>{});function jy(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}}var c4=It(()=>{});var u4,V$=It(()=>{Tw();c4();u4=Qd(jy,2)});function Gy(t,e,r){e=Fo(e,r);for(var i=Gn(t),n,o=0,s=i.length;o<s;o++)if(n=i[o],e(t[n],n,t))return n}var f4=It(()=>{sc();rl()});function Cw(t){return function(e,r,i){r=Fo(r,i);for(var n=as(e),o=t>0?0:n-1;o>=0&&o<n;o+=t)if(r(e[o],o,e))return o;return-1}}var h4=It(()=>{sc();iu()});var Ng,SI=It(()=>{h4();Ng=Cw(1)});var Mw,d4=It(()=>{h4();Mw=Cw(-1)});function Wy(t,e,r,i){r=Fo(r,i,1);for(var n=r(e),o=0,s=as(t);o<s;){var l=Math.floor((o+s)/2);r(t[l])<n?o=l+1:s=l}return o}var p4=It(()=>{sc();iu()});function Iw(t,e,r){return function(i,n,o){var s=0,l=as(i);if(typeof o=="number")t>0?s=o>=0?o:Math.max(o+l,s):l=o>=0?Math.min(o+1,l):o+l+1;else if(r&&o&&l)return o=r(i,n),i[o]===n?o:-1;if(n!==n)return o=e(Gh.call(i,s,l),Oy),o>=0?o+s:-1;for(o=t>0?s:l-1;o>=0&&o<l;o+=t)if(i[o]===n)return o;return-1}}var A4=It(()=>{iu();_s(
`):P)),U};var Sa=/^(?:focusinfocus|focusoutblur)$/,np=function(P){P.stopPropagation()};j.extend(j.event,{trigger:function(P,U,G,Q){var le,ce,_e,Qe,qe,ct,Nt,jt,dt=[G||z],fr=v.call(P,"type")?P.type:P,mi=v.call(P,"namespace")?P.namespace.split("."):[];if(ce=jt=_e=G=G||z,!(G.nodeType===3||G.nodeType===8)&&!Sa.test(fr+j.event.triggered)&&(fr.indexOf(".")>-1&&(mi=fr.split("."),fr=mi.shift(),mi.sort()),qe=fr.indexOf(":")<0&&"on"+fr,P=P[j.expando]?P:new j.Event(fr,typeof P=="object"&&P),P.isTrigger=Q?2:3,P.namespace=mi.join("."),P.rnamespace=P.namespace?new RegExp("(^|\\.)"+mi.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,P.result=void 0,P.target||(P.target=G),U=U==null?[P]:j.makeArray(U,[P]),Nt=j.event.special[fr]||{},!(!Q&&Nt.trigger&&Nt.trigger.apply(G,U)===!1))){if(!Q&&!Nt.noBubble&&!F(G)){for(Qe=Nt.delegateType||fr,Sa.test(Qe+fr)||(ce=ce.parentNode);ce;ce=ce.parentNode)dt.push(ce),_e=ce;_e===(G.ownerDocument||z)&&dt.push(_e.defaultView||_e.parentWindow||t)}for(le=0;(ce=dt[le++])&&!P.isPropagationStopped();)jt=ce,P.type=le>1?Qe:Nt.bindType||fr,ct=(kr.get(ce,"events")||Object.create(null))[P.type]&&kr.get(ce,"handle"),ct&&ct.apply(ce,U),ct=qe&&ce[qe],ct&&ct.apply&&yn(ce)&&(P.result=ct.apply(ce,U),P.result===!1&&P.preventDefault());return P.type=fr,!Q&&!P.isDefaultPrevented()&&(!Nt._default||Nt._default.apply(dt.pop(),U)===!1)&&yn(G)&&qe&&O(G[fr])&&!F(G)&&(_e=G[qe],_e&&(G[qe]=null),j.event.triggered=fr,P.isPropagationStopped()&&jt.addEventListener(fr,np),G[fr](),P.isPropagationStopped()&&jt.removeEventListener(fr,np),j.event.triggered=void 0,_e&&(G[qe]=_e)),P.result}},simulate:function(P,U,G){var Q=j.extend(new j.Event,G,{type:P,isSimulated:!0});j.event.trigger(Q,null,U)}}),j.fn.extend({trigger:function(P,U){return this.each(function(){j.event.trigger(P,U,this)})},triggerHandler:function(P,U){var G=this[0];if(G)return j.event.trigger(P,U,G,!0)}});var $u=/\[\]$/,Wh=/\r?\n/g,Wf=/^(?:submit|button|image|reset|file)$/i,RA=/^(?:input|select|textarea|keygen)/i;function ef(P,U,G,Q){var le;if(Array.isArray(U))j.each(U,function(ce,_e){G||$u.test(P)?Q(P,_e):ef(P+"["+(typeof _e=="object"&&_e!=null?ce:"")+"]",_e,G,Q)});else if(!G&&K(U)==="object")for(le in U)ef(P+"["+le+"]",U[le],G,Q);else Q(P,U)}j.param=function(P,U){var G,Q=[],le=function(ce,_e){var Qe=O(_e)?_e():_e;Q[Q.length]=encodeURIComponent(ce)+"="+encodeURIComponent(Qe??"")};if(P==null)return"";if(Array.isArray(P)||P.jquery&&!j.isPlainObject(P))j.each(P,function(){le(this.name,this.value)});else for(G in P)ef(G,P[G],U,le);return Q.join("&")},j.fn.extend({serialize:function(){return j.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var P=j.prop(this,"elements");return P?j.makeArray(P):this}).filter(function(){var P=this.type;return this.name&&!j(this).is(":disabled")&&RA.test(this.nodeName)&&!Wf.test(P)&&(this.checked||!ca.test(P))}).map(function(P,U){var G=j(this).val();return G==null?null:Array.isArray(G)?j.map(G,function(Q){return{name:U.name,value:Q.replace(Wh,`\r
`)}}):{name:U.name,value:G.replace(Wh,`\r
`)}}).get()}});var ul=/%20/g,Nc=/#.*$/,kc=/([?&])_=[^&]*/,cu=/^(.*?):[ \t]*([^\r\n]*)$/mg,Uc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,zc=/^(?:GET|HEAD)$/,qh=/^\/\//,fa={},Mo={},uu="*/".concat("*"),Xh=z.createElement("a");Xh.href=Co.href;function BA(P){return function(U,G){typeof U!="string"&&(G=U,U="*");var Q,le=0,ce=U.toLowerCase().match(lt)||[];if(O(G))for(;Q=ce[le++];)Q[0]==="+"?(Q=Q.slice(1)||"*",(P[Q]=P[Q]||[]).unshift(G)):(P[Q]=P[Q]||[]).push(G)}}function OA(P,U,G,Q){var le={},ce=P===Mo;function _e(Qe){var qe;return le[Qe]=!0,j.each(P[Qe]||[],function(ct,Nt){var jt=Nt(U,G,Q);if(typeof jt=="string"&&!ce&&!le[jt])return U.dataTypes.unshift(jt),_e(jt),!1;if(ce)return!(qe=jt)}),qe}return _e(U.dataTypes[0])||!le["*"]&&_e("*")}function qf(P,U){var G,Q,le=j.ajaxSettings.flatOptions||{};for(G in U)U[G]!==void 0&&((le[G]?P:Q||(Q={}))[G]=U[G]);return Q&&j.extend(!0,P,Q),P}function op(P,U,G){for(var Q,le,ce,_e,Qe=P.contents,qe=P.dataTypes;qe[0]==="*";)qe.shift(),Q===void 0&&(Q=P.mimeType||U.getResponseHeader("Content-Type"));if(Q){for(le in Qe)if(Qe[le]&&Qe[le].test(Q)){qe.unshift(le);break}}if(qe[0]in G)ce=qe[0];else{for(le in G){if(!qe[0]||P.converters[le+" "+qe[0]]){ce=le;break}_e||(_e=le)}ce=ce||_e}if(ce)return ce!==qe[0]&&qe.unshift(ce),G[ce]}function sp(P,U,G,Q){var le,ce,_e,Qe,qe,ct={},Nt=P.dataTypes.slice();if(Nt[1])for(_e in P.converters)ct[_e.toLowerCase()]=P.converters[_e];for(ce=Nt.shift();ce;)if(P.responseFields[ce]&&(G[P.responseFields[ce]]=U),!qe&&Q&&P.dataFilter&&(U=P.dataFilter(U,P.dataType)),qe=ce,ce=Nt.shift(),ce){if(ce==="*")ce=qe;else if(qe!=="*"&&qe!==ce){if(_e=ct[qe+" "+ce]||ct["* "+ce],!_e){for(le in ct)if(Qe=le.split(" "),Qe[1]===ce&&(_e=ct[qe+" "+Qe[0]]||ct["* "+Qe[0]],_e)){_e===!0?_e=ct[le]:ct[le]!==!0&&(ce=Qe[0],Nt.unshift(Qe[1]));break}}if(_e!==!0)if(_e&&P.throws)U=_e(U);else try{U=_e(U)}catch(jt){return{state:"parsererror",error:_e?jt:"No conversion from "+qe+" to "+ce}}}}return{state:"success",data:U}}j.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Co.href,type:"GET",isLocal:Uc.test(Co.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":uu,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":j.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(P,U){return U?qf(qf(P,j.ajaxSettings),U):qf(j.ajaxSettings,P)},ajaxPrefilter:BA(fa),ajaxTransport:BA(Mo),ajax:function(P,U){typeof P=="object"&&(U=P,P=void 0),U=U||{};var G,Q,le,ce,_e,Qe,qe,ct,Nt,jt,dt=j.ajaxSetup({},U),fr=dt.context||dt,mi=dt.context&&(fr.nodeType||fr.jquery)?j(fr):j.event,ut=j.Deferred(),St=j.Callbacks("once memory"),cr=dt.statusCode||{},Xr={},g={},ki="canceled",Wr={readyState:0,getResponseHeader:function(Ti){var An;if(qe){if(!ce)for(ce={};An=cu.exec(le);)ce[An[1].toLowerCase()+" "]=(ce[An[1].toLowerCase()+" "]||[]).concat(An[2]);An=ce[Ti.toLowerCase()+" "]}return An==null?null:An.join(", ")},getAllResponseHeaders:function(){return qe?le:null},setRequestHeader:function(Ti,An){return qe==null&&(Ti=g[Ti.toLowerCase()]=g[Ti.toLowerCase()]||Ti,Xr[Ti]=An),this},overrideMimeType:function(Ti){return qe==null&&(dt.mimeType=Ti),this},statusCode:function(Ti){var An;if(Ti)if(qe)Wr.always(Ti[Wr.status]);else for(An in Ti)cr[An]=[cr[An],Ti[An]];return this},abort:function(Ti){var An=Ti||ki;return G&&G.abort(An),Re(0,An),this}};if(ut.promise(Wr),dt.url=((P||dt.url||Co.href)+"").replace(qh,Co.protocol+"//"),dt.type=U.method||U.type||dt.method||dt.type,dt.dataTypes=(dt.dataType||"*").toLowerCase().match(lt)||[""],dt.crossDomain==null){Qe=z.createElement("a");try{Qe.href=dt.url,Qe.href=Qe.href,dt.crossDomain=Xh.protocol+"//"+Xh.host!=Qe.protocol+"//"+Qe.host}catch{dt.crossDomain=!0}}if(dt.data&&dt.processData&&typeof dt.data!="string"&&(dt.data=j.param(dt.data,dt.traditional)),OA(fa,dt,
`,'"',k6],WORKERS_SUPPORTED:!1,NODE_STREAM_INPUT:1,LocalChunkSize:10485760,RemoteChunkSize:5242880,DefaultDelimiter:",",Parser:TP,ParserHandle:z6,ChunkStreamer:U6,StringStreamer:E0},S0=ph;function pre(t,e,r){e=e||{};var i=e.dynamicTyping||!1;if(Ql(i)&&(e.dynamicTypingFunction=i,i={}),e.dynamicTyping=i,e.transform=Ql(e.transform)?e.transform:!1,e.worker&&ph.WORKERS_SUPPORTED){var n=newWorker();n.userStep=e.step,n.userChunk=e.chunk,n.userComplete=e.complete,n.userError=e.error,e.step=Ql(e.step),e.chunk=Ql(e.chunk),e.complete=Ql(e.complete),e.error=Ql(e.error),delete e.worker,n.postMessage({input:t,config:e,workerId:n.id});return}var o=null;return typeof t=="string"&&(o=new E0(e)),o||(o=new r(e)),o.stream(t)}function Are(t,e){var r=!1,i=!0,n=",",o=`\r
`,s='"',l=s+s,u=!1,h=null;T();var v=new RegExp(Hv(s),"g");if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return M(null,t,u);if(typeof t[0]=="object")return M(h||E(t[0]),t,u)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:E(t.data[0])),!Array.isArray(t.data[0])&&typeof t.data[0]!="object"&&(t.data=[t.data])),M(t.fields||[],t.data||[],u);throw new Error("Unable to serialize unrecognized input");function T(){if(typeof e=="object"){if(typeof e.delimiter=="string"&&!ph.BAD_DELIMITERS.filter(function(z){return e.delimiter.indexOf(z)!==-1}).length&&(n=e.delimiter),(typeof e.quotes=="boolean"||Array.isArray(e.quotes))&&(r=e.quotes),(typeof e.skipEmptyLines=="boolean"||typeof e.skipEmptyLines=="string")&&(u=e.skipEmptyLines),typeof e.newline=="string"&&(o=e.newline),typeof e.quoteChar=="string"&&(s=e.quoteChar),typeof e.header=="boolean"&&(i=e.header),Array.isArray(e.columns)){if(e.columns.length===0)throw new Error("Option columns is empty");h=e.columns}e.escapeChar!==void 0&&(l=e.escapeChar+s)}}function E(z){if(typeof z!="object")return[];var W=[];for(var J in z)W.push(J);return W}function M(z,W,J){var K="";typeof z=="string"&&(z=JSON.parse(z)),typeof W=="string"&&(W=JSON.parse(W));var ne=Array.isArray(z)&&z.length>0,ge=!Array.isArray(W[0]);if(ne&&i){for(var j=0;j<z.length;j++)j>0&&(K+=n),K+=O(z[j],j);W.length>0&&(K+=o)}for(var me=0;me<W.length;me++){var fe=ne?z.length:W[me].length,$=!1,Z=ne?Object.keys(W[me]).length===0:W[me].length===0;if(J&&!ne&&($=J==="greedy"?W[me].join("").trim()==="":W[me].length===1&&W[me][0].length===0),J==="greedy"&&ne){for(var we=[],Oe=0;Oe<fe;Oe++){var he=ge?z[Oe]:Oe;we.push(W[me][he])}$=we.join("").trim()===""}if(!$){for(var Le=0;Le<fe;Le++){Le>0&&!Z&&(K+=n);var ft=ne&&ge?z[Le]:Le;K+=O(W[me][ft],Le)}me<W.length-1&&(!J||fe>0&&!Z)&&(K+=o)}}return K}function O(z,W){if(typeof z>"u"||z===null)return"";if(z.constructor===Date)return JSON.stringify(z).slice(1,25);z=z.toString().replace(v,l);var J=typeof r=="boolean"&&r||Array.isArray(r)&&r[W]||F(z,ph.BAD_DELIMITERS)||z.indexOf(n)>-1||z.charAt(0)===" "||z.charAt(z.length-1)===" ";return J?s+z+s:z}function F(z,W){for(var J=0;J<W.length;J++)if(z.indexOf(W[J])>-1)return!0;return!1}}function U6(t){this._handle=null,this._finished=!1,this._completed=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},e.call(this,t),this.parseChunk=function(r,i){if(this.isFirstChunk&&Ql(this._config.beforeFirstChunk)){var n=this._config.beforeFirstChunk(r);n!==void 0&&(r=n)}this.isFirstChunk=!1;var o=this._partialLine+r;this._partialLine="";var s=this._handle.parse(o,this._baseIndex,!this._finished);if(!(this._handle.paused()||this._handle.aborted())){var l=s.meta.cursor;this._finished||(this._partialLine=o.substring(l-this._baseIndex),this._baseIndex=l),s&&s.data&&(this._rowCount+=s.data.length);var u=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(Ql(this._config.chunk)&&!i){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return;s=void 0,this._completeResults=void 0}return!this._config.step&&!this._config.chunk&&(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),!this._completed&&u&&Ql(this._config.complete)&&(!s||!s.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),!u&&(!s||!s.meta.paused)&&this._nextChunk(),s}},this._sendError=function(r){Ql(this._config.error)&&this._config.error(r)};function e(r){var i=EP(r);i.chunkSize=parseInt(i.chunkSize),!r.step&&!r.chunk&&(i.chunkSize=null),this._handle=new z6(i),this._handle.streamer=this,this._config=i}}function E0(t){t=t||{},U6.call(this,t);var e;this.stream=function
`),he=Oe.length>1&&Oe[0].length<we[0].length;if(we.length===1||he)return`
`;for(var Le=0,ft=0;ft<we.length;ft++)we[ft][0]===`
`&&Le++;return Le>=we.length/2?`\r
`:"\r"}function me(fe,$,Z,we){E.errors.push({type:fe,code:$,message:Z,row:we})}}function Hv(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function TP(t){t=t||{};var e=t.delimiter,r=t.newline,i=t.comments,n=t.step,o=t.preview,s=t.fastMode,l;t.quoteChar===void 0?l='"':l=t.quoteChar;var u=l;if(t.escapeChar!==void 0&&(u=t.escapeChar),(typeof e!="string"||ph.BAD_DELIMITERS.indexOf(e)>-1)&&(e=","),i===e)throw new Error("Comment character same as delimiter");i===!0?i="#":(typeof i!="string"||ph.BAD_DELIMITERS.indexOf(i)>-1)&&(i=!1),r!==`
`&&r!=="\r"&&r!==`\r
`&&(r=`
`);var h=0,v=!1;this.parse=function(T,E,M){if(typeof T!="string")throw new Error("Input must be a string");var O=T.length,F=e.length,z=r.length,W=i.length,J=Ql(n);h=0;var K=[],ne=[],ge=[],j=0;if(!T)return or();if(s||s!==!1&&T.indexOf(l)===-1){for(var me=T.split(r),fe=0;fe<me.length;fe++){if(ge=me[fe],h+=ge.length,fe!==me.length-1)h+=r.length;else if(M)return or();if(!(i&&ge.substr(0,W)===i)){if(J){if(K=[],Yt(ge.split(e)),ai(),v)return or()}else Yt(ge.split(e));if(o&&fe>=o)return K=K.slice(0,o),or(!0)}}return or()}for(var $=T.indexOf(e,h),Z=T.indexOf(r,h),we=new RegExp(Hv(u)+Hv(l),"g"),Oe;;){if(T[h]===l){for(Oe=h,h++;;){if(Oe=T.indexOf(l,Oe+1),Oe===-1)return M||ne.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:K.length,index:h}),Er();if(Oe===O-1){var he=T.substring(h,Oe).replace(we,l);return Er(he)}if(l===u&&T[Oe+1]===u){Oe++;continue}if(!(l!==u&&Oe!==0&&T[Oe-1]===u)){var Le=Z===-1?$:Math.min($,Z),ft=mr(Le);if(T[Oe+1+ft]===e){if(ge.push(T.substring(h,Oe).replace(we,l)),h=Oe+1+ft+F,$=T.indexOf(e,h),Z=T.indexOf(r,h),J&&(ai(),v))return or();if(o&&K.length>=o)return or(!0);break}var Vt=mr(Z);if(T.substr(Oe+1+Vt,z)===r){if(ge.push(T.substring(h,Oe).replace(we,l)),Jr(Oe+1+Vt+z),$=T.indexOf(e,h),J&&(ai(),v))return or();if(o&&K.length>=o)return or(!0);break}ne.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:K.length,index:h}),Oe++}}if(J&&(ai(),v))return or();if(o&&K.length>=o)return or(!0);continue}if(i&&ge.length===0&&T.substr(h,W)===i){if(Z===-1)return or();h=Z+z,Z=T.indexOf(r,h),$=T.indexOf(e,h);continue}if($!==-1&&($<Z||Z===-1)){ge.push(T.substring(h,$)),h=$+F,$=T.indexOf(e,h);continue}if(Z!==-1){if(ge.push(T.substring(h,Z)),Jr(Z+z),J&&(ai(),v))return or();if(o&&K.length>=o)return or(!0);continue}break}return Er();function Yt(Jt){K.push(Jt),j=h}function mr(Jt){var qt=0;if(Jt!==-1){var wi=T.substring(Oe+1,Jt);wi&&wi.trim()===""&&(qt=wi.length)}return qt}function Er(Jt){return M||(typeof Jt>"u"&&(Jt=T.substr(h)),ge.push(Jt),h=O,Yt(ge),J&&ai()),or()}function Jr(Jt){h=Jt,Yt(ge),ge=[],Z=T.indexOf(r,h)}function or(Jt,qt){var wi=qt||!1;return{data:wi?K[0]:K,errors:ne,meta:{delimiter:e,linebreak:r,aborted:v,truncated:!!Jt,cursor:j+(E||0)}}}function ai(){n(or(void 0,!0)),K=[],ne=[]}},this.abort=function(){v=!0},this.getCharIndex=function(){return h}}function EP(t){if(typeof t!="object"||t===null)return t;var e=Array.isArray(t)?[]:{};for(var r in t)e[r]=EP(t[r]);return e}function Ql(t){return typeof t=="function"}var{ChunkStreamer:V6}=S0;function C0(t){t=t||{},V6.call(this,t),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=async function(e){this._input=e;try{for await(let r of e)this.parseChunk(this.getStringChunk(r));this._finished=!0,this.parseChunk("")}catch(r){this._sendError(r)}},this._nextChunk=function(){},this.getStringChunk=function(e){return typeof e=="string"?e:this.textDecoder.decode(e,{stream:!0})}}C0.prototype=Object.create(V6.prototype);C0.prototype.constructor=C0;var mre="4.2.0-beta.2",SP="object-row-table",jv={dataType:null,batchType:null,id:"csv",module:"csv",name:"CSV",version:mre,extensions:["csv","tsv","dsv"],mimeTypes:["text/csv","text/tab-separated-values","text/dsv"],category:"table",parse:async(t,e)=>H6(new TextDecoder().decode(t),e),parseText:(t,e)=>H6(t,e),parseInBatches:gre,options:{csv:{shape:SP,optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[","," ","|",";"]}}};async function H6(t,e){let r={...jv.options.csv,...e?.csv},i=_re(t),o=r.header==="auto"?j6(i):Boolean(r.header),s={...r,header:o,download:!1,transformHeader:o?G6():void 0,error:T=>{throw new Error(T)}},l=S0.parse(t,s),u=l.data,h=l.meta.fields||W6(r.columnPrefix,i.length),v=r.shape||SP;switch(v){case"object-row-table":return{shape:"object-row-table",data:u.map(T=>Array.isArray(T)?zv(T,h):T)};case"array-row-table":return{shape:"array-row-table",data:u.map(T=>Array.isArray(T)?T:Vv(T,h))};default:throw new Error(v)}}function gre(t,e){e={...e},e.
importScripts('${t}');
} catch (error) {
console.error(error);
throw error;
}`}function OP(t,e=!0,r){let i=r||new Set;if(t){if(cU(t))i.add(t);else if(cU(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)OP(t[n],e,i)}}return r===void 0?Array.from(i):[]}function cU(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var DP=()=>{},gp=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Za||typeof P0<"u"&&!Za}constructor(e){let{name:r,source:i,url:n}=e;vl(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=DP,this.onError=o=>console.log(o),this.worker=Za?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=DP,this.onError=DP,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,r){r=r||OP(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=aU({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new P0(i,{eval:!1})}else if(this.source)e=new P0(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var Kv=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return gp.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,r=(n,o,s)=>n.done(s),i=(n,o)=>n.error(o)){let n=new Promise(o=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:o}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new Yv(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Za||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new gp({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return sU?this.maxMobileConcurrency:this.maxConcurrency}};var Fre={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},KA=class{props;workerPools=new Map;static isSupported(){return gp.isSupported()}static getWorkerFarm(e={}){return KA._workerFarm=KA._workerFarm||new KA({}),KA._workerFarm.setProps(e),KA._workerFarm}constructor(e){this.props={...Fre},this.setProps(e),this.workerPools=ne
`:"";return`
${n}${o}${t.type.toUpperCase()}: ${t.message}
`}return i?.html?`<div class='luma-compiler-log-error' style="color:red;"><b> ${t.type.toUpperCase()}: ${t.message}</b></div>`:`${t.type.toUpperCase()}: ${t.message}`}function Gie(t,e,r){let i="";for(let n=e-2;n<=e;n++){let o=t[n-1];o!==void 0&&(i+=tz(o,e,r))}return i}function tz(t,e,r){let i=r?.html?qie(t):t;return`${Wie(String(e),4)}: ${i}${r?.html?"<br/>":`
`}`}function Wie(t,e){let r="";for(let i=t.length;i<e;++i)r+=" ";return r+t}function qie(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function c3(t,e){return{name:Xie(t,e),language:"glsl",version:Yie(t)}}function Xie(t,e="unnamed"){let i=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return i?i[1]:e}function Yie(t){let e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let i=parseInt(r[1],10);Number.isFinite(i)&&(e=i)}return e}var u3=class extends fn{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,r){super(e,{id:Kie(r),...r},u3.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(e=this.props.debug){switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let r=await this.getCompilationInfo();this.props.debug==="warnings"&&r?.length===0||this._displayShaderLog(r)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;let r=c3(this.source).name,i=`${this.stage} ${r}`,n=ez(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource();o&&(n+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${o}</pre></code>`);let s=document.createElement("Button");s.innerHTML=`
<h1>Shader Compilation Error in ${i}</h1><br /><br />
<code style="user-select:text;"><pre>
${n}
</pre></code>`,s.style.top="10px",s.style.left="10px",s.style.position="absolute",s.style.zIndex="9999",s.style.width="100%",s.style.textAlign="left",document.body.appendChild(s);let l=document.getElementsByClassName("luma-compiler-log-error");l[0]?.scrollIntoView&&l[0].scrollIntoView(),s.onclick=()=>{let u=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(u)}}},Sp=u3;Yr(Sp,"defaultProps",{...fn.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Kie(t){return c3(t.source).name||t.id||oa(`unnamed ${t.stage}-shader`)}var f3=class extends fn{get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){super(e,r,f3.defaultProps)}},Cp=f3;Yr(Cp,"defaultProps",{...fn.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var h3=class extends fn{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,r={}){super(e,r,h3.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let r=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];r=r||n!==this.height||i!==this.width,this.width=i,this.height=n}r&&(Kt.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(r=>{if(typeof r=="string"){let i=this.createColorTexture(r);return this.attachResource(i),i.view}return r instanceof bo?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof bo?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,r){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.device._createTexture({...this.colorAttachments[i].props,width:e,height:r});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.device._createTexture({...this.depthStencilAttachment.props,width:e,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}}},_h=h3;Yr(_h,"defaultProps",{...fn.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var d3=class extends fn{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,r){super(e,r,d3.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},Af=d3;Yr(Af,"defaultProps",{...fn.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var p3=class extends fn{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,r){super(e,r,p3.defaultProps)}},D0=p3;Yr(D0,"defaultProps",{...fn.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var A3=class extends fn{get[Symbol.toS
${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),Kt.level===0){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}Kt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Kt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var Gne=256,Wne=1024,qne=16384,G3=6144,Xne=[1,2,4,8],hT=class extends D0{device;glParameters;constructor(e,r){super(e,r),this.device=e,Mp(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){md(this.device.gl)}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={...this.glParameters};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=Xne.map(i=>Boolean(i&e.colorMask))),this.glParameters=r,mf(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=qne,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=Gne,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=Wne,e.clearStencil=this.props.clearStencil),r!==0&&Iu(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Iu(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(G3,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(G3,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(G3,e,r);break}})}};var Yne="Failed to deduce GL constant from typed array";function Vz(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(Yne)}}function _x(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var Kne={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Zne={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Ip=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return _x(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return Yi(e.size),_x(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new Ip(Kne,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}g
logdepth_adjustPosition(gl_Position);
#endif
`,P5=`#ifdef MODULE_MATERIAL
gl_FragColor = material_filterColor(gl_FragColor);
#endif
#ifdef MODULE_LIGHTING
gl_FragColor = lighting_filterColor(gl_FragColor);
#endif
#ifdef MODULE_FOG
gl_FragColor = fog_filterColor(gl_FragColor);
#endif
#ifdef MODULE_PICKING
gl_FragColor = picking_filterHighlightColor(gl_FragColor);
gl_FragColor = picking_filterPickingColor(gl_FragColor);
#endif
#ifdef MODULE_LOGDEPTH
logdepth_setFragDepth();
#endif
`;var nse={vertex:I5,fragment:P5},R5=/void\s+main\s*\([^)]*\)\s*\{\n?/,B5=/}\n?[^{}]*$/,sR=[],wx="__LUMA_INJECT_DECLARATIONS__";function O5(t){let e={vertex:{},fragment:{}};for(let r in t){let i=t[r],n=ose(r);typeof i=="string"&&(i={order:0,injection:i}),e[n][r]=i}return e}function ose(t){let e=t.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function Tx(t,e,r,i=!1){let n=e==="vertex";for(let o in r){let s=r[o];s.sort((u,h)=>u.order-h.order),sR.length=s.length;for(let u=0,h=s.length;u<h;++u)sR[u]=s[u].injection;let l=`${sR.join(`
`)}
`;switch(o){case"vs:#decl":n&&(t=t.replace(wx,l));break;case"vs:#main-start":n&&(t=t.replace(R5,u=>u+l));break;case"vs:#main-end":n&&(t=t.replace(B5,u=>l+u));break;case"fs:#decl":n||(t=t.replace(wx,l));break;case"fs:#main-start":n||(t=t.replace(R5,u=>u+l));break;case"fs:#main-end":n||(t=t.replace(B5,u=>l+u));break;default:t=t.replace(o,u=>u+l)}}return t=t.replace(wx,""),i&&(t=t.replace(/\}\s*$/,o=>o+nse[e])),t}var sse=1,Zc=class{name;vs;fs;getModuleUniforms;dependencies;deprecations;defines;injections;uniforms={};uniformTypes={};static instantiateModules(e){return e.map(r=>{if(r instanceof Zc)return r;Sh(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${sse++}`);let i=new Zc(r);return i.dependencies=Zc.instantiateModules(r.dependencies||[]),i})}constructor(e){let{name:r,vs:i,fs:n,dependencies:o=[],uniformTypes:s={},uniformPropTypes:l={},getUniforms:u,deprecations:h=[],defines:v={},inject:T={}}=e;Sh(typeof r=="string"),this.name=r,this.vs=i,this.fs=n,this.getModuleUniforms=u,this.dependencies=Zc.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(h),this.defines=v,this.injections=O5(T),this.uniformTypes=s,l&&(this.uniforms=C5(l))}getModuleSource(e){let r;switch(e){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:Sh(!1)}let i=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
#define MODULE_${i}
${r}
`}getUniforms(e,r){return this.getModuleUniforms?this.getModuleUniforms(e,r):M5(e,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(e,r){this.deprecations.forEach(i=>{i.regex?.test(e)&&(i.deprecated?r.deprecated(i.old,i.new)():r.removed(i.old,i.new)())})}_parseDeprecationDefinitions(e){return e.forEach(r=>{switch(r.type){case"function":r.regex=new RegExp(`\\b${r.old}\\(`);break;default:r.regex=new RegExp(`${r.type} ${r.old};`)}}),e}_defaultGetUniforms(e={}){let r={},i=this.uniforms;for(let n in i){let o=i[n];n in e&&!o.private?(o.validate&&Sh(o.validate(e[n],o),`${this.name}: invalid ${n}`),r[n]=e[n]):r[n]=o.value}return r}};function aR(t){if(t.source&&t.platformInfo.type==="webgpu")return{...t,vs:void 0,fs:void 0};if(!t.vs)throw new Error("no vertex shader");let e=D5(t.platformInfo,t.vs),r;return t.fs&&(r=D5(t.platformInfo,t.fs)),{...t,vs:e,fs:r}}function D5(t,e){if(typeof e=="string")return e;switch(t.type){case"webgpu":if(e?.wgsl)return e.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(e?.glsl)return e.glsl;throw new Error("WebGL does not support WGSL shaders")}}function sm(t){let e=Zc.instantiateModules(t);return ase(e)}function ase(t){let e={},r={};return L5({modules:t,level:0,moduleMap:e,moduleDepth:r}),Object.keys(r).sort((i,n)=>r[n]-r[i]).map(i=>e[i])}function L5(t){let{modules:e,level:r,moduleMap:i,moduleDepth:n}=t;if(r>=5)throw new Error("Possible loop in shader dependency graph");for(let o of e)i[o.name]=o,(n[o.name]===void 0||n[o.name]<r)&&(n[o.name]=r);for(let o of e)o.dependencies&&L5({modules:o.dependencies,level:r+1,moduleMap:i,moduleDepth:n})}function F5(t){switch(t?.gpu.toLowerCase()){case"apple":return`#define APPLE_GPU
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
`;case"nvidia":return`#define NVIDIA_GPU
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
`;case"intel":return`#define INTEL_GPU
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
`;case"amd":return`#define AMD_GPU
`;default:return`#define DEFAULT_GPU
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
`}}function k5(t,e){if(Number(t.match(/^#version[ \t]+(\d+)/m)?.[1]||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(e){case"vertex":return t=N5(t,lse),t;case"fragment":return t=N5(t,cse),t;default:throw new Error(e)}}var U5=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],lse=[...U5,[lR("attribute"),"in $1"],[lR("varying"),"out $1"]],cse=[...U5,[lR("varying"),"in $1"]];function N5(t,e){for(let[r,i]of e)t=t.replace(r,i);return t}function lR(t){return new RegExp(`\\b${t}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function cR(t,e){let r="";for(let i in t){let n=t[i];if(r+=`void ${n.signature} {
`,n.header&&(r+=` ${n.header}`),e[i]){let o=e[i];o.sort((s,l)=>s.order-l.order);for(let s of o)r+=` ${s.injection}
`}n.footer&&(r+=` ${n.footer}`),r+=`}
`}return r}function uR(t){let e={vertex:{},fragment:{}};for(let r of t){let i,n;typeof r!="string"?(i=r,n=i.hook):(i={},n=r),n=n.trim();let[o,s]=n.split(":"),l=n.replace(/\(.+/,""),u=Object.assign(i,{signature:s});switch(o){case"vs":e.vertex[l]=u;break;case"fs":e.fragment[l]=u;break;default:throw new Error(o)}}return e}function z5(t,e){return{name:use(t,e),language:"glsl",version:fse(t)}}function use(t,e="unnamed"){let i=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(t);return i?i[1]:e}function fse(t){let e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let i=parseInt(r[1],10);Number.isFinite(i)&&(e=i)}if(e!==100&&e!==300)throw new Error(`Invalid GLSL version ${e}`);return e}var H5=`
${wx}
`,hse=`precision highp float;
`;function j5(t){let e=sm(t.modules||[]);return{source:fR(t.platformInfo,{...t,source:t.source,stage:"vertex",modules:e}),getUniforms:hR(e)}}function G5(t){let e=sm(t.modules||[]);return{vs:fR(t.platformInfo,{...t,source:t.vs,stage:"vertex",modules:e}),fs:fR(t.platformInfo,{...t,source:t.fs,stage:"fragment",modules:e}),getUniforms:hR(e)}}function W5(t){let{vs:e,fs:r}=t,i=sm(t.modules||[]);return{vs:V5(t.platformInfo,{...t,source:e,stage:"vertex",modules:i}),fs:V5(t.platformInfo,{...t,source:r,stage:"fragment",modules:i}),getUniforms:hR(i)}}function fR(t,e){let{source:r,stage:i,modules:n,hookFunctions:o=[],inject:s={},log:l}=e;Sh(typeof r=="string","shader source must be a string");let u=r,h="",v=uR(o),T={},E={},M={};for(let F in s){let z=typeof s[F]=="string"?{injection:s[F],order:0}:s[F],W=/^(v|f)s:(#)?([\w-]+)$/.exec(F);if(W){let J=W[2],K=W[3];J?K==="decl"?E[F]=[z]:M[F]=[z]:T[F]=[z]}else M[F]=[z]}let O=t.type!=="webgpu"?n:[];for(let F of O){l&&F.checkDeprecations(u,l);let z=F.getModuleSource(i,"wgsl");h+=z;let W=F.injections[i];for(let J in W){let K=/^(v|f)s:#([\w-]+)$/.exec(J);if(K){let ge=K[2]==="decl"?E:M;ge[J]=ge[J]||[],ge[J].push(W[J])}else T[J]=T[J]||[],T[J].push(W[J])}}return h+=H5,h=Tx(h,i,E),h+=cR(v[i],T),h+=u,h=Tx(h,i,M),h}function V5(t,e){let{id:r,source:i,stage:n,language:o="glsl",modules:s,defines:l={},hookFunctions:u=[],inject:h={},prologue:v=!0,log:T}=e;Sh(typeof i=="string","shader source must be a string");let E=o==="glsl"?z5(i).version:-1,M=t.shaderLanguageVersion,O=E===100?"#version 100":"#version 300 es",z=i.split(`
`).slice(1).join(`
`),W={};s.forEach(me=>{Object.assign(W,me.getDefines())}),Object.assign(W,l);let J="";switch(o){case"wgsl":break;case"glsl":J=v?`${O}
// ----- PROLOGUE -------------------------
${dse({id:r,source:i,stage:n})}
${`#define SHADER_TYPE_${n.toUpperCase()}`}
${F5(t)}
${n==="fragment"?hse:""}
// ----- APPLICATION DEFINES -------------------------
${pse(W)}
`:`${O}
`;break}let K=uR(u),ne={},ge={},j={};for(let me in h){let fe=typeof h[me]=="string"?{injection:h[me],order:0}:h[me],$=/^(v|f)s:(#)?([\w-]+)$/.exec(me);if($){let Z=$[2],we=$[3];Z?we==="decl"?ge[me]=[fe]:j[me]=[fe]:ne[me]=[fe]}else j[me]=[fe]}for(let me of s){T&&me.checkDeprecations(z,T);let fe=me.getModuleSource(n);J+=fe;let $=me.injections[n];for(let Z in $){let we=/^(v|f)s:#([\w-]+)$/.exec(Z);if(we){let he=we[2]==="decl"?ge:j;he[Z]=he[Z]||[],he[Z].push($[Z])}else ne[Z]=ne[Z]||[],ne[Z].push($[Z])}}return J+="// ----- MAIN SHADER SOURCE -------------------------",J+=H5,J=Tx(J,n,ge),J+=cR(K[n],ne),J+=z,J=Tx(J,n,j),o==="glsl"&&E!==M&&(J=k5(J,n)),J.trim()}function hR(t){return function(r){let i={};for(let n of t){let o=n.getUniforms(r,i);Object.assign(i,o)}return i}}function dse(t){let{id:e,source:r,stage:i}=t;return e&&r.indexOf("SHADER_NAME")===-1?`
#define SHADER_NAME ${e}_${i}
`:""}function pse(t={}){let e="";for(let r in t){let i=t[r];(i||Number.isFinite(i))&&(e+=`#define ${r.toUpperCase()} ${t[r]}
`)}return e}var W0=class{_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return W0.defaultShaderAssembler=W0.defaultShaderAssembler||new W0,W0.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(r=>r.name===(typeof e=="string"?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){let r=typeof e=="string"?e:e.name;this._defaultModules=this._defaultModules.filter(i=>i.name!==r)}addShaderHook(e,r){r&&(e=Object.assign(r,{hook:e})),this._hookFunctions.push(e)}assembleShader(e){let r=this._getModuleList(e.modules),i=this._hookFunctions,n=aR(e);return{...j5({platformInfo:e.platformInfo,...n,modules:r,hookFunctions:i}),modules:r}}assembleShaderPair(e){let r=aR(e),i=this._getModuleList(e.modules),n=this._hookFunctions,{platformInfo:o}=e;return{...e.platformInfo.shaderLanguage==="wgsl"?G5({platformInfo:o,...r,modules:i,hookFunctions:n}):W5({platformInfo:o,...r,modules:i,hookFunctions:n}),modules:i}}_getModuleList(e=[]){let r=new Array(this._defaultModules.length+e.length),i={},n=0;for(let o=0,s=this._defaultModules.length;o<s;++o){let l=this._defaultModules[o],u=l.name;r[n++]=l,i[u]=!0}for(let o=0,s=e.length;o<s;++o){let l=e[o],u=l.name;i[u]||(r[n++]=l,i[u]=!0)}return r.length=n,Zc.instantiateModules(r)}},Pp=W0;Yr(Pp,"defaultShaderAssembler");function dR(t){if(!t.normalized&&(t.normalized=!0,t.uniformPropTypes&&!t.getUniforms)){let e=new Zc(t);t.getUniforms=e.getUniforms.bind(e)}return t}var Ase=`out vec4 transform_output;
void main() {
transform_output = vec4(0);
}`,mse=`#version 300 es
${Ase}`;function Ex(t){let{input:e,inputChannels:r,output:i}=t||{};if(!e)return mse;if(!r)throw new Error("inputChannels");let n=gse(r),o=q5(e,r);return`#version 300 es
in ${n} ${e};
out vec4 ${i};
void main() {
${i} = ${o};
}`}function gse(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${t}`)}}function q5(t,e){switch(e){case 1:return`vec4(${t}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${t}, 0.0, 1.0)`;case 3:return`vec4(${t}, 1.0)`;case 4:return t;default:throw new Error(`invalid channels: ${e}`)}}var pR=class{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}},_d=class{constructor(){}get isAstNode(){return!0}get astNodeType(){return""}evaluate(e){throw new Error("Cannot evaluate node")}evaluateString(e){return this.evaluate(e).toString()}},Ss=class extends _d{constructor(){super()}},bT=class extends Ss{constructor(e,r,i,n){super(),this.name=e,this.args=r,this.returnType=i,this.body=n}get astNodeType(){return"function"}},AR=class extends Ss{constructor(e){super(),this.expression=e}get astNodeType(){return"staticAssert"}},mR=class extends Ss{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"while"}},gR=class extends Ss{constructor(e){super(),this.body=e}get astNodeType(){return"continuing"}},_R=class extends Ss{constructor(e,r,i,n){super(),this.init=e,this.condition=r,this.increment=i,this.body=n}get astNodeType(){return"for"}},Bp=class extends Ss{constructor(e,r,i,n,o){super(),this.name=e,this.type=r,this.storage=i,this.access=n,this.value=o}get astNodeType(){return"var"}},wT=class extends Ss{constructor(e,r,i){super(),this.name=e,this.type=r,this.value=i}get astNodeType(){return"override"}},TT=class extends Ss{constructor(e,r,i,n,o){super(),this.name=e,this.type=r,this.storage=i,this.access=n,this.value=o}get astNodeType(){return"let"}},ET=class extends Ss{constructor(e,r,i,n,o){super(),this.name=e,this.type=r,this.storage=i,this.access=n,this.value=o}get astNodeType(){return"const"}evaluate(e){return this.value.evaluate(e)}},K0;(function(t){t.increment="++",t.decrement="--"})(K0||(K0={}));(function(t){function e(r){let i=r;if(i=="parse")throw new Error("Invalid value for IncrementOperator");return t[i]}t.parse=e})(K0||(K0={}));var yR=class extends Ss{constructor(e,r){super(),this.operator=e,this.variable=r}get astNodeType(){return"increment"}},Cx;(function(t){t.assign="=",t.addAssign="+=",t.subtractAssin="-=",t.multiplyAssign="*=",t.divideAssign="/=",t.moduloAssign="%=",t.andAssign="&=",t.orAssign="|=",t.xorAssign="^=",t.shiftLeftAssign="<<=",t.shiftRightAssign=">>="})(Cx||(Cx={}));(function(t){function e(r){let i=r;if(i=="parse")throw new Error("Invalid value for AssignOperator");return t[i]}t.parse=e})(Cx||(Cx={}));var vR=class extends Ss{constructor(e,r,i){super(),this.operator=e,this.variable=r,this.value=i}get astNodeType(){return"assign"}},xR=class extends Ss{constructor(e,r){super(),this.name=e,this.args=r}get astNodeType(){return"call"}},bR=class extends Ss{constructor(e,r){super(),this.body=e,this.continuing=r}get astNodeType(){return"loop"}},wR=class extends Ss{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"body"}},TR=class extends Ss{constructor(e,r,i,n){super(),this.condition=e,this.body=r,this.elseif=i,this.else=n}get astNodeType(){return"if"}},ER=class extends Ss{constructor(e){super(),this.value=e}get astNodeType(){return"return"}},SR=class extends Ss{constructor(e){super(),this.name=e}get astNodeType(){return"enable"}},ST=class extends Ss{constructor(e,r){super(),this.name=e,this.type=r}get astNodeType(){return"alias"}},CR=class extends Ss{constructor(){super()}get astNodeType(){return"discard"}},MR=class extends Ss{constructor(){super()}get astNodeType(){return"break"}},IR=class extends Ss{constructor(){super()}get astNodeType(){return"continue"}},yd=class extends Ss{constructor(e){super(),this.name=e}get astNodeType(){return"type"}get isStruct(){return!1}get isArray(){return!1}},gd=class extends yd{constructor(e,r){super(e),this.members=r}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(e){for(let r=0;r<this.members.length;r++)if(this.members[r].name==e)return r;return-1}},CT=class extends yd{constructor(e,r,i){super(e),this.f
`)return this._line++,!0;if(this._isWhitespace(e))return!0;if(e=="/"){if(this._peekAhead()=="/"){for(;e!=`
`;){if(this._isAtEnd())return!0;e=this._advance()}return this._line++,!0}else if(this._peekAhead()=="*"){this._advance();let i=1;for(;i>0;){if(this._isAtEnd())return!0;if(e=this._advance(),e==`
`)this._line++;else if(e=="*"){if(this._peekAhead()=="/"&&(this._advance(),i--,i==0))return!0}else e=="/"&&this._peekAhead()=="*"&&(this._advance(),i++)}return!0}}let r=We.none;for(;;){let i=this._findType(e),n=this._peekAhead();if(e==">"&&(n==">"||n=="=")){let o=!1,s=this._tokens.length-1;for(let l=0;l<5&&s>=0;++l,--s)if(this._tokens[s].type===We.tokens.less_than){s>0&&this._tokens[s-1].isArrayOrTemplateType()&&(o=!0);break}if(o)return this._addToken(i),!0}if(i===We.none){let o=e,s=0,l=2;for(let u=0;u<l;++u)if(o+=this._peekAhead(u),i=this._findType(o),i!==We.none){s=u;break}if(i===We.none)return r===We.none?!1:(this._current--,this._addToken(r),!0);e=o,this._current+=s+1}if(r=i,this._isAtEnd())break;e+=this._advance()}return r===We.none?!1:(this._addToken(r),!0)}_findType(e){for(let r in We.keywords){let i=We.keywords[r];if(this._match(e,i.rule))return i}for(let r in We.tokens){let i=We.tokens[r];if(this._match(e,i.rule))return i}return We.none}_match(e,r){if(typeof r=="string"){if(r==e)return!0}else{let i=r.exec(e);if(i&&i.index==0&&i[0]==e)return!0}return!1}_isAtEnd(){return this._current>=this._source.length}_isWhitespace(e){return e==" "||e==" "||e=="\r"}_advance(e=0){let r=this._source[this._current];return e=e||0,e++,this._current+=e,r}_peekAhead(e=0){return e=e||0,this._current+e>=this._source.length?"\0":this._source[this._current+e]}_addToken(e){let r=this._source.substring(this._start,this._current);this._tokens.push(new FT(e,r,this._line))}},HR=class{constructor(){this._tokens=[],this._current=0,this._context=new pR}parse(e){this._initialize(e);let r=[];for(;!this._isAtEnd();){let i=this._global_decl_or_directive();if(!i)break;r.push(i)}return r}_initialize(e){if(e)if(typeof e=="string"){let r=new VR(e);this._tokens=r.scanTokens()}else this._tokens=e;else this._tokens=[];this._current=0}_error(e,r){return console.error(e,r),{token:e,message:r,toString:function(){return`${r}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==We.eof}_match(e){if(e instanceof At)return this._check(e)?(this._advance(),!0):!1;for(let r=0,i=e.length;r<i;++r){let n=e[r];if(this._check(n))return this._advance(),!0}return!1}_consume(e,r){if(this._check(e))return this._advance();throw this._error(this._peek(),r)}_check(e){if(this._isAtEnd())return!1;let r=this._peek();if(e instanceof Array){let i=r.type;return e.indexOf(i)!=-1}return r.type==e}_advance(){return this._isAtEnd()||this._current++,this._previous()}_peek(){return this._tokens[this._current]}_previous(){return this._tokens[this._current-1]}_global_decl_or_directive(){for(;this._match(We.tokens.semicolon)&&!this._isAtEnd(););if(this._match(We.keywords.alias)){let r=this._type_alias();return this._consume(We.tokens.semicolon,"Expected ';'"),r}if(this._match(We.keywords.enable)){let r=this._enable_directive();return this._consume(We.tokens.semicolon,"Expected ';'"),r}let e=this._attribute();if(this._check(We.keywords.var)){let r=this._global_variable_decl();return r!=null&&(r.attributes=e),this._consume(We.tokens.semicolon,"Expected ';'."),r}if(this._check(We.keywords.override)){let r=this._override_variable_decl();return r!=null&&(r.attributes=e),this._consume(We.tokens.semicolon,"Expected ';'."),r}if(this._check(We.keywords.let)){let r=this._global_let_decl();return r!=null&&(r.attributes=e),this._consume(We.tokens.semicolon,"Expected ';'."),r}if(this._check(We.keywords.const)){let r=this._global_const_decl();return r!=null&&(r.attributes=e),this._consume(We.tokens.semicolon,"Expected ';'."),r}if(this._check(We.keywords.struct)){let r=this._struct_decl();return r!=null&&(r.attributes=e),r}if(this._check(We.keywords.fn)){let r=this._function_decl();return r!=null&&(r.attributes=e),r}return null}_function_decl(){if(!this._match(We.keywords.fn))return null;let e=this._consume(We.tokens.ident,"Expected function name.").toString();this._consume(We.tokens.paren_left,"Expected '(' for function arguments.");let r=[];if(!this._check(We.tokens.paren_right))do{if(this._check(We.tokens.paren_right))break;let o=this._attribute(),s=this._consume(We.tokens.ident,"E
const float TWO_PI = 6.2831854820251465;
const float PI_2 = 1.5707963705062866;
const float PI_16 = 0.1963495463132858;
const float SIN_TABLE_0 = 0.19509032368659973;
const float SIN_TABLE_1 = 0.3826834261417389;
const float SIN_TABLE_2 = 0.5555702447891235;
const float SIN_TABLE_3 = 0.7071067690849304;
const float COS_TABLE_0 = 0.9807852506637573;
const float COS_TABLE_1 = 0.9238795042037964;
const float COS_TABLE_2 = 0.8314695954322815;
const float COS_TABLE_3 = 0.7071067690849304;
const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;
const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;
const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;
const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;
float sin_taylor_fp32(float a) {
float r, s, t, x;
if (a == 0.0) {
return 0.0;
}
x = -a * a;
s = a;
r = a;
r = r * x;
t = r * INVERSE_FACTORIAL_3;
s = s + t;
r = r * x;
t = r * INVERSE_FACTORIAL_5;
s = s + t;
r = r * x;
t = r * INVERSE_FACTORIAL_7;
s = s + t;
r = r * x;
t = r * INVERSE_FACTORIAL_9;
s = s + t;
return s;
}
void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {
if (a == 0.0) {
sin_t = 0.0;
cos_t = 1.0;
}
sin_t = sin_taylor_fp32(a);
cos_t = sqrt(1.0 - sin_t * sin_t);
}
float tan_taylor_fp32(float a) {
float sin_a;
float cos_a;
if (a == 0.0) {
return 0.0;
}
float z = floor(a / TWO_PI);
float r = a - TWO_PI * z;
float t;
float q = floor(r / PI_2 + 0.5);
int j = int(q);
if (j < -2 || j > 2) {
return 1.0 / 0.0;
}
t = r - PI_2 * q;
q = floor(t / PI_16 + 0.5);
int k = int(q);
int abs_k = int(abs(float(k)));
if (abs_k > 4) {
return 1.0 / 0.0;
} else {
t = t - PI_16 * q;
}
float u = 0.0;
float v = 0.0;
float sin_t, cos_t;
float s, c;
sincos_taylor_fp32(t, sin_t, cos_t);
if (k == 0) {
s = sin_t;
c = cos_t;
} else {
if (abs(float(abs_k) - 1.0) < 0.5) {
u = COS_TABLE_0;
v = SIN_TABLE_0;
} else if (abs(float(abs_k) - 2.0) < 0.5) {
u = COS_TABLE_1;
v = SIN_TABLE_1;
} else if (abs(float(abs_k) - 3.0) < 0.5) {
u = COS_TABLE_2;
v = SIN_TABLE_2;
} else if (abs(float(abs_k) - 4.0) < 0.5) {
u = COS_TABLE_3;
v = SIN_TABLE_3;
}
if (k > 0) {
s = u * sin_t + v * cos_t;
c = u * cos_t - v * sin_t;
} else {
s = u * sin_t - v * cos_t;
c = u * cos_t + v * sin_t;
}
}
if (j == 0) {
sin_a = s;
cos_a = c;
} else if (j == 1) {
sin_a = c;
cos_a = -s;
} else if (j == -1) {
sin_a = -c;
cos_a = s;
} else {
sin_a = -s;
cos_a = -c;
}
return sin_a / cos_a;
}
#endif
float tan_fp32(float a) {
#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
return tan_taylor_fp32(a);
#else
return tan(a);
#endif
}
`,KR={name:"fp32",vs:yse};var vse=new Float32Array([0,1,1,1]),xse=`uniform pickingUniforms {
float isActive;
float isAttribute;
float isHighlightActive;
float useFloatColors;
vec3 highlightedObjectColor;
vec4 highlightColor;
} picking;
out vec4 picking_vRGBcolor_Avalid;
vec3 picking_normalizeColor(vec3 color) {
return picking.useFloatColors > 0.5 ? color : color / 255.0;
}
vec4 picking_normalizeColor(vec4 color) {
return picking.useFloatColors > 0.5 ? color : color / 255.0;
}
bool picking_isColorZero(vec3 color) {
return dot(color, vec3(1.0)) < 0.00001;
}
bool picking_isColorValid(vec3 color) {
return dot(color, vec3(1.0)) > 0.00001;
}
bool isVertexHighlighted(vec3 vertexColor) {
vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
return
bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor));
}
void picking_setPickingColor(vec3 pickingColor) {
pickingColor = picking_normalizeColor(pickingColor);
if (bool(picking.isActive)) {
picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));
if (!bool(picking.isAttribute)) {
picking_vRGBcolor_Avalid.rgb = pickingColor;
}
} else {
picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor));
}
}
void picking_setPickingAttribute(float value) {
if (bool(picking.isAttribute)) {
picking_vRGBcolor_Avalid.r = value;
}
}
void picking_setPickingAttribute(vec2 value) {
if (bool(picking.isAttribute)) {
picking_vRGBcolor_Avalid.rg = value;
}
}
void picking_setPickingAttribute(vec3 value) {
if (bool(picking.isAttribute)) {
picking_vRGBcolor_Avalid.rgb = value;
}
}
`,bse=`uniform pickingUniforms {
float isActive;
float isAttribute;
float isHighlightActive;
float useFloatColors;
vec3 highlightedObjectColor;
vec4 highlightColor;
} picking;
in vec4 picking_vRGBcolor_Avalid;
vec4 picking_filterHighlightColor(vec4 color) {
if (picking.isActive > 0.5) {
return color;
}
bool selected = bool(picking_vRGBcolor_Avalid.a);
if (selected) {
float highLightAlpha = picking.highlightColor.a;
float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);
float highLightRatio = highLightAlpha / blendedAlpha;
vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio);
return vec4(blendedRGB, blendedAlpha);
} else {
return color;
}
}
vec4 picking_filterPickingColor(vec4 color) {
if (bool(picking.isActive)) {
if (picking_vRGBcolor_Avalid.a == 0.0) {
discard;
}
return picking_vRGBcolor_Avalid;
}
return color;
}
vec4 picking_filterColor(vec4 color) {
vec4 highlightColor = picking_filterHighlightColor(color);
return picking_filterPickingColor(highlightColor);
}
`,zT={name:"picking",vs:xse,fs:bse,uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useFloatColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useFloatColors:!0,highlightedObjectColor:new Float32Array([0,0,0]),highlightColor:vse},getUniforms:wse};function wse(t={},e){let r={};if(t.highlightedObjectColor!==void 0)if(t.highlightedObjectColor===null)r.isHighlightActive=!1;else{r.isHighlightActive=!0;let i=t.highlightedObjectColor.slice(0,3);r.highlightedObjectColor=i}if(t.highlightColor){let i=Array.from(t.highlightColor,n=>n/255);Number.isFinite(i[3])||(i[3]=1),r.highlightColor=i}return t.isActive!==void 0&&(r.isActive=Boolean(t.isActive),r.isAttribute=Boolean(t.isAttribute)),t.useFloatColors!==void 0&&(r.useFloatColors=Boolean(t.useFloatColors)),r}function ZR(t,e=[],r=0){let i=Math.fround(t),n=t-i;return e[r]=i,e[r+1]=n,e}function Y5(t){return t-Math.fround(t)}function K5(t){let e=new Float32Array(32);for(let r=0;r<4;++r)for(let i=0;i<4;++i){let n=r*4+i;ZR(t[i*4+r],e,n*2)}return e}var Z5=`uniform float ONE;
vec2 split(float a) {
const float SPLIT = 4097.0;
float t = a * SPLIT;
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float a_hi = t * ONE - (t - a);
float a_lo = a * ONE - a_hi;
#else
float a_hi = t - (t - a);
float a_lo = a - a_hi;
#endif
return vec2(a_hi, a_lo);
}
vec2 split2(vec2 a) {
vec2 b = split(a.x);
b.y += a.y;
return b;
}
vec2 quickTwoSum(float a, float b) {
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float sum = (a + b) * ONE;
float err = b - (sum - a) * ONE;
#else
float sum = a + b;
float err = b - (sum - a);
#endif
return vec2(sum, err);
}
vec2 twoSum(float a, float b) {
float s = (a + b);
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float v = (s * ONE - a) * ONE;
float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);
#else
float v = s - a;
float err = (a - (s - v)) + (b - v);
#endif
return vec2(s, err);
}
vec2 twoSub(float a, float b) {
float s = (a - b);
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float v = (s * ONE - a) * ONE;
float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);
#else
float v = s - a;
float err = (a - (s - v)) - (b + v);
#endif
return vec2(s, err);
}
vec2 twoSqr(float a) {
float prod = a * a;
vec2 a_fp64 = split(a);
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *
a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;
#else
float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;
#endif
return vec2(prod, err);
}
vec2 twoProd(float a, float b) {
float prod = a * b;
vec2 a_fp64 = split(a);
vec2 b_fp64 = split(b);
float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +
a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;
return vec2(prod, err);
}
vec2 sum_fp64(vec2 a, vec2 b) {
vec2 s, t;
s = twoSum(a.x, b.x);
t = twoSum(a.y, b.y);
s.y += t.x;
s = quickTwoSum(s.x, s.y);
s.y += t.y;
s = quickTwoSum(s.x, s.y);
return s;
}
vec2 sub_fp64(vec2 a, vec2 b) {
vec2 s, t;
s = twoSub(a.x, b.x);
t = twoSub(a.y, b.y);
s.y += t.x;
s = quickTwoSum(s.x, s.y);
s.y += t.y;
s = quickTwoSum(s.x, s.y);
return s;
}
vec2 mul_fp64(vec2 a, vec2 b) {
vec2 prod = twoProd(a.x, b.x);
prod.y += a.x * b.y;
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
prod = split2(prod);
#endif
prod = quickTwoSum(prod.x, prod.y);
prod.y += a.y * b.x;
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
prod = split2(prod);
#endif
prod = quickTwoSum(prod.x, prod.y);
return prod;
}
vec2 div_fp64(vec2 a, vec2 b) {
float xn = 1.0 / b.x;
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
vec2 yn = mul_fp64(a, vec2(xn, 0));
#else
vec2 yn = a * xn;
#endif
float diff = (sub_fp64(a, mul_fp64(b, yn))).x;
vec2 prod = twoProd(xn, diff);
return sum_fp64(yn, prod);
}
vec2 sqrt_fp64(vec2 a) {
if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);
if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);
float x = 1.0 / sqrt(a.x);
float yn = a.x * x;
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
vec2 yn_sqr = twoSqr(yn) * ONE;
#else
vec2 yn_sqr = twoSqr(yn);
#endif
float diff = sub_fp64(a, yn_sqr).x;
vec2 prod = twoProd(x * 0.5, diff);
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
return sum_fp64(split(yn), prod);
#else
return sum_fp64(vec2(yn, 0.0), prod);
#endif
}
`;var Tse={ONE:1};function Ese(){return Tse}var Dp={name:"fp64-arithmetic",vs:Z5,getUniforms:Ese,fp64ify:ZR,fp64LowPart:Y5,fp64ifyMatrix4:K5};var Sse=1/Math.PI*180,Cse=1/180*Math.PI,Mse={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Mse}};var Do=globalThis.mathgl.config;function Mx(t,{precision:e=Do.precision}={}){return t=Ise(t),`${parseFloat(t.toPrecision(e))}`}function Jc(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function JR(t){return cm(t)}function QR(t){return va(t)}function cm(t,e){return $R(t,r=>r*Cse,e)}function va(t,e){return $R(t,r=>r*Sse,e)}function Zn(t,e,r){return $R(t,i=>Math.max(e,Math.min(r,i)))}function Oa(t,e,r){return Jc(t)?t.map((i,n)=>Oa(i,e[n],r)):r*e+(1-r)*t}function Cs(t,e,r){let i=Do.EPSILON;r&&(Do.EPSILON=r);try{if(t===e)return!0;if(Jc(t)&&Jc(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!Cs(t[n],e[n]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=Do.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{Do.EPSILON=i}}function Ise(t){return Math.round(t/Do.EPSILON)*Do.EPSILON}function Pse(t){return t.clone?t.clone():new Array(t.length)}function $R(t,e,r){if(Jc(t)){let i=t;r=r||Pse(i);for(let n=0;n<r.length&&n<i.length;++n){let o=typeof t=="number"?t:t[n];r[n]=e(o,n,r)}return r}return e(t)}var Lp=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=e[i+r];return this.check()}toArray(e=[],r=0){for(let i=0;i<this.ELEMENTS;++i)e[r+i]=this[i];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Jc(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Do)}formatString(e){let r="";for(let i=0;i<this.ELEMENTS;++i)r+=(i>0?", ":"")+Mx(this[i],e);return`${e.printTypes?this.constructor.name:""}[${r}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Cs(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,i){if(i===void 0)return this.lerp(this,e,r);for(let n=0;n<this.ELEMENTS;++n){let o=e[n],s=typeof r=="number"?r:r[n];this[n]=o+i*(s-o)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],e[i]),r[i]);return this.check()}add(...e){for(let r of e)for(let i=0;i<this.ELEMENTS;++i)this[i]+=r[i];return this.check()}subtract(...e){for(let r of e)for(let i=0;i<this.ELEMENTS;++i)this[i]-=r[i];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(Do.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],e),r);return this.check()}get elements(){return this}};function Rse(t,e){if
struct AmbientLight {
vec3 color;
};
struct PointLight {
vec3 color;
vec3 position;
vec3 attenuation;
};
struct DirectionalLight {
vec3 color;
vec3 direction;
};
uniform AmbientLight lighting_uAmbientLight;
uniform PointLight lighting_uPointLight[MAX_LIGHTS];
uniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];
uniform int lighting_uPointLightCount;
uniform int lighting_uDirectionalLightCount;
uniform bool lighting_uEnabled;
float getPointLightAttenuation(PointLight pointLight, float distance) {
return pointLight.attenuation.x
+ pointLight.attenuation.y * distance
+ pointLight.attenuation.z * distance * distance;
}
#endif
`;var vce={lightSources:{}};function zB(t={}){let{color:e=[0,0,0],intensity:r=1}=t;return e.map(i=>i*r/255)}function xce({ambientLight:t,pointLights:e=[],directionalLights:r=[]}){let i={};return t?i["lighting_uAmbientLight.color"]=zB(t):i["lighting_uAmbientLight.color"]=[0,0,0],e.forEach((n,o)=>{i[`lighting_uPointLight[${o}].color`]=zB(n),i[`lighting_uPointLight[${o}].position`]=n.position,i[`lighting_uPointLight[${o}].attenuation`]=n.attenuation||[1,0,0]}),i.lighting_uPointLightCount=e.length,r.forEach((n,o)=>{i[`lighting_uDirectionalLight[${o}].color`]=zB(n),i[`lighting_uDirectionalLight[${o}].direction`]=n.direction}),i.lighting_uDirectionalLightCount=r.length,i}function tV(t=vce){if("lightSources"in t){let{ambientLight:e,pointLights:r,directionalLights:i}=t.lightSources||{};return e||r&&r.length>0||i&&i.length>0?Object.assign({},xce({ambientLight:e,pointLights:r,directionalLights:i}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in t){let e={pointLights:[],directionalLights:[]};for(let r of t.lights||[])switch(r.type){case"ambient":e.ambientLight=r;break;case"directional":e.directionalLights?.push(r);break;case"point":e.pointLights?.push(r);break;default:}return tV({lightSources:e})}return{}}var Fx={name:"lights",vs:UB,fs:UB,getUniforms:tV,defines:{MAX_LIGHTS:3}};var VB=`uniform float lighting_uAmbient;
uniform float lighting_uDiffuse;
uniform float lighting_uShininess;
uniform vec3 lighting_uSpecularColor;
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {
vec3 halfway_direction = normalize(light_direction + view_direction);
float lambertian = dot(light_direction, normal_worldspace);
float specular = 0.0;
if (lambertian > 0.0) {
float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
specular = pow(specular_angle, lighting_uShininess);
}
lambertian = max(lambertian, 0.0);
return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;
}
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
vec3 lightColor = surfaceColor;
if (lighting_uEnabled) {
vec3 view_direction = normalize(cameraPosition - position_worldspace);
lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i >= lighting_uPointLightCount) {
break;
}
PointLight pointLight = lighting_uPointLight[i];
vec3 light_position_worldspace = pointLight.position;
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
}
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i >= lighting_uDirectionalLightCount) {
break;
}
DirectionalLight directionalLight = lighting_uDirectionalLight[i];
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
}
}
return lightColor;
}
vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
vec3 lightColor = vec3(0, 0, 0);
vec3 surfaceColor = vec3(0, 0, 0);
if (lighting_uEnabled) {
vec3 view_direction = normalize(cameraPosition - position_worldspace);
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i >= lighting_uPointLightCount) {
break;
}
PointLight pointLight = lighting_uPointLight[i];
vec3 light_position_worldspace = pointLight.position;
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
}
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i >= lighting_uDirectionalLightCount) {
break;
}
DirectionalLight directionalLight = lighting_uDirectionalLight[i];
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
}
}
return lightColor;
}
`;var bce={};function wce(t){let{ambient:e=.35,diffuse:r=.6,shininess:i=32,specularColor:n=[30,30,30]}=t;return{lighting_uAmbient:e,lighting_uDiffuse:r,lighting_uShininess:i,lighting_uSpecularColor:n.map(o=>o/255)}}function rV(t=bce){if(!("material"in t))return{};let{material:e}=t;return e?wce(e):{lighting_uEnabled:!1}}var Fu={name:"gouraud-lighting",dependencies:[Fx],vs:VB,defines:{LIGHTING_VERTEX:1},getUniforms:rV},kp={name:"phong-lighting",dependencies:[Fx],fs:VB,defines:{LIGHTING_FRAGMENT:1},getUniforms:rV};var iV=`uniform mat4 u_MVPMatrix;
uniform mat4 u_ModelMatrix;
uniform mat4 u_NormalMatrix;
out vec3 pbr_vPosition;
out vec2 pbr_vUV;
#ifdef HAS_NORMALS
# ifdef HAS_TANGENTS
out mat3 pbr_vTBN;
# else
out vec3 pbr_vNormal;
# endif
#endif
void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)
{
vec4 pos = u_ModelMatrix * position;
pbr_vPosition = vec3(pos.xyz) / pos.w;
#ifdef HAS_NORMALS
#ifdef HAS_TANGENTS
vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));
vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));
vec3 bitangentW = cross(normalW, tangentW) * tangent.w;
pbr_vTBN = mat3(tangentW, bitangentW, normalW);
#else
pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));
#endif
#endif
#ifdef HAS_UV
pbr_vUV = uv;
#else
pbr_vUV = vec2(0.,0.);
#endif
}
`;var nV=`precision highp float;
uniform bool pbr_uUnlit;
#ifdef USE_IBL
uniform samplerCube u_DiffuseEnvSampler;
uniform samplerCube u_SpecularEnvSampler;
uniform sampler2D u_brdfLUT;
uniform vec2 u_ScaleIBLAmbient;
#endif
#ifdef HAS_BASECOLORMAP
uniform sampler2D u_BaseColorSampler;
#endif
#ifdef HAS_NORMALMAP
uniform sampler2D u_NormalSampler;
uniform float u_NormalScale;
#endif
#ifdef HAS_EMISSIVEMAP
uniform sampler2D u_EmissiveSampler;
uniform vec3 u_EmissiveFactor;
#endif
#ifdef HAS_METALROUGHNESSMAP
uniform sampler2D u_MetallicRoughnessSampler;
#endif
#ifdef HAS_OCCLUSIONMAP
uniform sampler2D u_OcclusionSampler;
uniform float u_OcclusionStrength;
#endif
#ifdef ALPHA_CUTOFF
uniform float u_AlphaCutoff;
#endif
uniform vec2 u_MetallicRoughnessValues;
uniform vec4 u_BaseColorFactor;
uniform vec3 u_Camera;
#ifdef PBR_DEBUG
uniform vec4 u_ScaleDiffBaseMR;
uniform vec4 u_ScaleFGDSpec;
#endif
in vec3 pbr_vPosition;
in vec2 pbr_vUV;
#ifdef HAS_NORMALS
#ifdef HAS_TANGENTS
in mat3 pbr_vTBN;
#else
in vec3 pbr_vNormal;
#endif
#endif
struct PBRInfo
{
float NdotL;
float NdotV;
float NdotH;
float LdotH;
float VdotH;
float perceptualRoughness;
float metalness;
vec3 reflectance0;
vec3 reflectance90;
float alphaRoughness;
vec3 diffuseColor;
vec3 specularColor;
vec3 n;
vec3 v;
};
const float M_PI = 3.141592653589793;
const float c_MinRoughness = 0.04;
vec4 SRGBtoLINEAR(vec4 srgbIn)
{
#ifdef MANUAL_SRGB
#ifdef SRGB_FAST_APPROXIMATION
vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
#else
vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
#endif
return vec4(linOut,srgbIn.w);;
#else
return srgbIn;
#endif
}
vec3 getNormal()
{
#ifndef HAS_TANGENTS
vec3 pos_dx = dFdx(pbr_vPosition);
vec3 pos_dy = dFdy(pbr_vPosition);
vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));
vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));
vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
#ifdef HAS_NORMALS
vec3 ng = normalize(pbr_vNormal);
#else
vec3 ng = cross(pos_dx, pos_dy);
#endif
t = normalize(t - ng * dot(ng, t));
vec3 b = normalize(cross(ng, t));
mat3 tbn = mat3(t, b, ng);
#else
mat3 tbn = pbr_vTBN;
#endif
#ifdef HAS_NORMALMAP
vec3 n = texture(u_NormalSampler, pbr_vUV).rgb;
n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));
#else
vec3 n = normalize(tbn[2].xyz);
#endif
return n;
}
#ifdef USE_IBL
vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
{
float mipCount = 9.0;
float lod = (pbrInputs.perceptualRoughness * mipCount);
vec3 brdf = SRGBtoLINEAR(texture(u_brdfLUT,
vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
#ifdef USE_TEX_LOD
vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;
#else
vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;
#endif
vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
diffuse *= u_ScaleIBLAmbient.x;
specular *= u_ScaleIBLAmbient.y;
return diffuse + specular;
}
#endif
vec3 diffuse(PBRInfo pbrInputs)
{
return pbrInputs.diffuseColor / M_PI;
}
vec3 specularReflection(PBRInfo pbrInputs)
{
return pbrInputs.reflectance0 +
(pbrInputs.reflectance90 - pbrInputs.reflectance0) *
pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
}
float geometricOcclusion(PBRInfo pbrInputs)
{
float NdotL = pbrInputs.NdotL;
float NdotV = pbrInputs.NdotV;
float r = pbrInputs.alphaRoughness;
float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
return attenuationL * attenuationV;
}
float microfacetDistribution(PBRInfo pbrInputs)
{
float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
return roughnessSq / (M_PI * f * f);
}
void PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) {
pbrInputs.NdotL = 1.0;
pbrInputs.NdotH = 0.0;
pbrInputs.LdotH = 0.0;
pbrInputs.VdotH = 1.0;
}
void PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) {
vec3 n = pbrInputs.n;
vec3 v = pbrInputs.v;
vec3 l = normalize(lightDirection);
vec3 h = normalize(l+v);
pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);
pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);
pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);
pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);
}
void PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) {
vec3 light_direction = normalize(pointLight.position - pbr_vPosition);
PBRInfo_setDirectionalLight(pbrInputs, light_direction);
}
vec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) {
vec3 F = specularReflection(pbrInputs);
float G = geometricOcclusion(pbrInputs);
float D = microfacetDistribution(pbrInputs);
vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);
return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);
}
vec4 pbr_filterColor(vec4 colorUnused)
{
#ifdef HAS_BASECOLORMAP
vec4 baseColor = SRGBtoLINEAR(texture(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;
#else
vec4 baseColor = u_BaseColorFactor;
#endif
#ifdef ALPHA_CUTOFF
if (baseColor.a < u_AlphaCutoff) {
discard;
}
#endif
vec3 color = vec3(0, 0, 0);
if(pbr_uUnlit){
color.rgb = baseColor.rgb;
}
else{
float perceptualRoughness = u_MetallicRoughnessValues.y;
float metallic = u_MetallicRoughnessValues.x;
#ifdef HAS_METALROUGHNESSMAP
vec4 mrSample = texture(u_MetallicRoughnessSampler, pbr_vUV);
perceptualRoughness = mrSample.g * perceptualRoughness;
metallic = mrSample.b * metallic;
#endif
perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
metallic = clamp(metallic, 0.0, 1.0);
float alphaRoughness = perceptualRoughness * perceptualRoughness;
vec3 f0 = vec3(0.04);
vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
diffuseColor *= 1.0 - metallic;
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
vec3 specularEnvironmentR0 = specularColor.rgb;
vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
vec3 n = getNormal();
vec3 v = normalize(u_Camera - pbr_vPosition);
float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
vec3 reflection = -normalize(reflect(v, n));
PBRInfo pbrInputs = PBRInfo(
0.0,
NdotV,
0.0,
0.0,
0.0,
perceptualRoughness,
metallic,
specularEnvironmentR0,
specularEnvironmentR90,
alphaRoughness,
diffuseColor,
specularColor,
n,
v
);
#ifdef USE_LIGHTS
PBRInfo_setAmbientLight(pbrInputs);
color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);
for(int i = 0; i < lighting_uDirectionalLightCount; i++) {
if (i < lighting_uDirectionalLightCount) {
PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);
color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);
}
}
for(int i = 0; i < lighting_uPointLightCount; i++) {
if (i < lighting_uPointLightCount) {
PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);
float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));
color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);
}
}
#endif
#ifdef USE_IBL
color += getIBLContribution(pbrInputs, n, reflection);
#endif
#ifdef HAS_OCCLUSIONMAP
float ao = texture(u_OcclusionSampler, pbr_vUV).r;
color = mix(color, color * ao, u_OcclusionStrength);
#endif
#ifdef HAS_EMISSIVEMAP
vec3 emissive = SRGBtoLINEAR(texture(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;
color += emissive;
#endif
#ifdef PBR_DEBUG
color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);
color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);
color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
#endif
}
return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
}
`;var hm={name:"pbr",vs:iV,fs:nV,defines:{LIGHTING_FRAGMENT:1},dependencies:[Fx]};var oV="#define SMOOTH_EDGE_RADIUS 0.5",Tce=`
${oV}
struct VertexGeometry {
vec4 position;
vec3 worldPosition;
vec3 worldPositionAlt;
vec3 normal;
vec2 uv;
vec3 pickingColor;
} geometry = VertexGeometry(
vec4(0.0, 0.0, 1.0, 0.0),
vec3(0.0),
vec3(0.0),
vec3(0.0),
vec2(0.0),
vec3(0.0)
);
`,Ece=`
${oV}
struct FragmentGeometry {
vec2 uv;
} geometry;
float smoothedge(float edge, float x) {
return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
}
`,tE={name:"geometry",vs:Tce,fs:Ece};var Zr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Zr,"IDENTITY",{get:()=>(ur.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});var Nl={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},ms={common:0,meters:1,pixels:2},Nx={click:{handler:"onClick"},panstart:{handler:"onDragStart"},panmove:{handler:"onDrag"},panend:{handler:"onDragEnd"}},sV={DRAW:"draw",MASK:"mask",TERRAIN:"terrain"};var Sce=Object.keys(Zr).map(t=>`const int COORDINATE_SYSTEM_${t} = ${Zr[t]};`).join(""),Cce=Object.keys(Nl).map(t=>`const int PROJECTION_MODE_${t} = ${Nl[t]};`).join(""),Mce=Object.keys(ms).map(t=>`const int UNIT_${t.toUpperCase()} = ${ms[t]};`).join(""),aV=`${Sce}
${Cce}
${Mce}
uniform projectUniforms {
bool wrapLongitude;
int coordinateSystem;
vec3 commonUnitsPerMeter;
int projectionMode;
float scale;
vec3 commonUnitsPerWorldUnit;
vec3 commonUnitsPerWorldUnit2;
vec4 center;
mat4 modelMatrix;
mat4 viewProjectionMatrix;
vec2 viewportSize;
float devicePixelRatio;
float focalDistance;
vec3 cameraPosition;
vec3 coordinateOrigin;
vec3 commonOrigin;
bool pseudoMeters;
} project;
const float TILE_SIZE = 512.0;
const float PI = 3.1415926536;
const float WORLD_SCALE = TILE_SIZE / (PI * 2.0);
const vec3 ZERO_64_LOW = vec3(0.0);
const float EARTH_RADIUS = 6370972.0;
const float GLOBE_RADIUS = 256.0;
float project_size_at_latitude(float lat) {
float y = clamp(lat, -89.9, 89.9);
return 1.0 / cos(radians(y));
}
float project_size() {
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR &&
project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT &&
project.pseudoMeters == false) {
if (geometry.position.w == 0.0) {
return project_size_at_latitude(geometry.worldPosition.y);
}
float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
float y2 = y * y;
float y4 = y2 * y2;
float y6 = y4 * y2;
return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;
}
return 1.0;
}
float project_size_at_latitude(float meters, float lat) {
return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat);
}
float project_size(float meters) {
return meters * project.commonUnitsPerMeter.z * project_size();
}
vec2 project_size(vec2 meters) {
return meters * project.commonUnitsPerMeter.xy * project_size();
}
vec3 project_size(vec3 meters) {
return meters * project.commonUnitsPerMeter * project_size();
}
vec4 project_size(vec4 meters) {
return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w);
}
mat3 project_get_orientation_matrix(vec3 up) {
vec3 uz = normalize(up);
vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));
vec3 uy = cross(uz, ux);
return mat3(ux, uy, uz);
}
bool project_needs_rotation(vec3 commonPosition, out mat3 transform) {
if (project.projectionMode == PROJECTION_MODE_GLOBE) {
transform = project_get_orientation_matrix(commonPosition);
return true;
}
return false;
}
vec3 project_normal(vec3 vector) {
vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0);
vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter);
mat3 rotation;
if (project_needs_rotation(geometry.position.xyz, rotation)) {
n = rotation * n;
}
return n;
}
vec4 project_offset_(vec4 offset) {
float dy = offset.y;
vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy;
return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);
}
vec2 project_mercator_(vec2 lnglat) {
float x = lnglat.x;
if (project.wrapLongitude) {
x = mod(x + 180., 360.0) - 180.;
}
float y = clamp(lnglat.y, -89.9, 89.9);
return vec2(
radians(x) + PI,
PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))
) * WORLD_SCALE;
}
vec3 project_globe_(vec3 lnglatz) {
float lambda = radians(lnglatz.x);
float phi = radians(lnglatz.y);
float cosPhi = cos(phi);
float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;
return vec3(
sin(lambda) * cosPhi,
-cos(lambda) * cosPhi,
sin(phi)
) * D;
}
vec4 project_position(vec4 position, vec3 position64Low) {
vec4 position_world = project.modelMatrix * position;
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) {
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
return vec4(
project_mercator_(position_world.xy),
project_size_at_latitude(position_world.z, position_world.y),
position_world.w
);
}
if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
position_world.xyz += project.coordinateOrigin;
}
}
if (project.projectionMode == PROJECTION_MODE_GLOBE) {
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
return vec4(
project_globe_(position_world.xyz),
position_world.w
);
}
}
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) {
return vec4(
project_mercator_(position_world.xy) - project.commonOrigin.xy,
project_size(position_world.z),
position_world.w
);
}
}
}
if (project.projectionMode == PROJECTION_MODE_IDENTITY ||
(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&
(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {
position_world.xyz -= project.coordinateOrigin;
}
return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0));
}
vec4 project_position(vec4 position) {
return project_position(position, ZERO_64_LOW);
}
vec3 project_position(vec3 position, vec3 position64Low) {
vec4 projected_position = project_position(vec4(position, 1.0), position64Low);
return projected_position.xyz;
}
vec3 project_position(vec3 position) {
vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);
return projected_position.xyz;
}
vec2 project_position(vec2 position) {
vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);
return projected_position.xy;
}
vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {
return viewProjectionMatrix * position + center;
}
vec4 project_common_position_to_clipspace(vec4 position) {
return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center);
}
vec2 project_pixel_size_to_clipspace(vec2 pixels) {
vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0;
return offset * project.focalDistance;
}
float project_size_to_pixel(float meters) {
return project_size(meters) * project.scale;
}
float project_size_to_pixel(float size, int unit) {
if (unit == UNIT_METERS) return project_size_to_pixel(size);
if (unit == UNIT_COMMON) return size * project.scale;
return size;
}
float project_pixel_size(float pixels) {
return pixels / project.scale;
}
vec2 project_pixel_size(vec2 pixels) {
return pixels / project.scale;
}
`;function Ice(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}return!1}function Nu(t){let e={},r;return i=>{for(let n in i)if(!Ice(i[n],e[n])){r=t(i),e=i;break}return r}}var lV=[0,0,0,0],Pce=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],cV=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Rce=[0,0,0],uV=[0,0,0],Bce=Nu(Dce);function HB(t,e,r=uV){r.length<3&&(r=[r[0],r[1],0]);let i=r,n,o=!0;switch(e===Zr.LNGLAT_OFFSETS||e===Zr.METER_OFFSETS?n=r:n=t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case Nl.WEB_MERCATOR:(e===Zr.LNGLAT||e===Zr.CARTESIAN)&&(n=[0,0,0],o=!1);break;case Nl.WEB_MERCATOR_AUTO_OFFSET:e===Zr.LNGLAT?i=n:e===Zr.CARTESIAN&&(i=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],n=t.unprojectPosition(i),i[0]-=r[0],i[1]-=r[1],i[2]-=r[2]);break;case Nl.IDENTITY:i=t.position.map(Math.fround),i[2]=i[2]||0;break;case Nl.GLOBE:o=!1,n=null;break;default:o=!1}return{geospatialOrigin:n,shaderCoordinateOrigin:i,offsetMode:o}}function Oce(t,e,r){let{viewMatrixUncentered:i,projectionMatrix:n}=t,{viewMatrix:o,viewProjectionMatrix:s}=t,l=lV,u=lV,h=t.cameraPosition,{geospatialOrigin:v,shaderCoordinateOrigin:T,offsetMode:E}=HB(t,e,r);return E&&(u=t.projectPosition(v||T),h=[h[0]-u[0],h[1]-u[1],h[2]-u[2]],u[3]=1,l=tc.transformMat4([],u,s),o=i||o,s=Zs.multiply([],n,o),s=Zs.multiply([],s,Pce)),{viewMatrix:o,viewProjectionMatrix:s,projectionCenter:l,originCommon:u,cameraPosCommon:h,shaderCoordinateOrigin:T,geospatialOrigin:v}}function rE({viewport:t,devicePixelRatio:e=1,modelMatrix:r=null,coordinateSystem:i=Zr.DEFAULT,coordinateOrigin:n=uV,autoWrapLongitude:o=!1}){i===Zr.DEFAULT&&(i=t.isGeospatial?Zr.LNGLAT:Zr.CARTESIAN);let s=Bce({viewport:t,devicePixelRatio:e,coordinateSystem:i,coordinateOrigin:n});return s.wrapLongitude=o,s.modelMatrix=r||cV,s}function Dce({viewport:t,devicePixelRatio:e,coordinateSystem:r,coordinateOrigin:i}){let{projectionCenter:n,viewProjectionMatrix:o,originCommon:s,cameraPosCommon:l,shaderCoordinateOrigin:u,geospatialOrigin:h}=Oce(t,r,i),v=t.getDistanceScales(),T=[t.width*e,t.height*e],E=tc.transformMat4([],[0,0,-t.focalDistance,1],t.projectionMatrix)[3]||1,M={coordinateSystem:r,projectionMode:t.projectionMode,coordinateOrigin:u,commonOrigin:s.slice(0,3),center:n,pseudoMeters:Boolean(t._pseudoMeters),viewportSize:T,devicePixelRatio:e,focalDistance:E,commonUnitsPerMeter:v.unitsPerMeter,commonUnitsPerWorldUnit:v.unitsPerMeter,commonUnitsPerWorldUnit2:Rce,scale:t.scale,wrapLongitude:!1,viewProjectionMatrix:o,modelMatrix:cV,cameraPosition:l};if(h){let O=t.getDistanceScales(h);switch(r){case Zr.METER_OFFSETS:M.commonUnitsPerWorldUnit=O.unitsPerMeter,M.commonUnitsPerWorldUnit2=O.unitsPerMeter2;break;case Zr.LNGLAT:case Zr.LNGLAT_OFFSETS:t._pseudoMeters||(M.commonUnitsPerMeter=O.unitsPerMeter),M.commonUnitsPerWorldUnit=O.unitsPerDegree,M.commonUnitsPerWorldUnit2=O.unitsPerDegree2;break;case Zr.CARTESIAN:M.commonUnitsPerWorldUnit=[1,1,O.unitsPerMeter[2]],M.commonUnitsPerWorldUnit2=[0,0,O.unitsPerMeter2[2]];break;default:break}}return M}var Lce={};function Fce(t=Lce){return"viewport"in t?rE(t):{}}var dm={name:"project",dependencies:[KR,tE],vs:aV,getUniforms:Fce,uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3<f32>",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3<f32>",commonUnitsPerWorldUnit2:"vec3<f32>",center:"vec4<f32>",modelMatrix:"mat4x4<f32>",viewProjectionMatrix:"mat4x4<f32>",viewportSize:"vec2<f32>",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3<f32>",coordinateOrigin:"vec3<f32>",commonOrigin:"vec3<f32>",pseudoMeters:"f32"}};var Nce=`
vec4 project_position_to_clipspace(
vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition
) {
vec3 projectedPosition = project_position(position, position64Low);
mat3 rotation;
if (project_needs_rotation(projectedPosition, rotation)) {
// offset is specified as ENU
// when in globe projection, rotate offset so that the ground alighs with the surface of the globe
offset = rotation * offset;
}
commonPosition = vec4(projectedPosition + offset, 1.0);
return project_common_position_to_clipspace(commonPosition);
}
vec4 project_position_to_clipspace(
vec3 position, vec3 position64Low, vec3 offset
) {
vec4 commonPosition;
return project_position_to_clipspace(position, position64Low, offset, commonPosition);
}
`,Jn={name:"project32",dependencies:[dm],vs:Nce};function jB(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Up(t,e){let r=tc.transformMat4([],e,t);return tc.scale(r,r,1/r[3]),r}function GB(t,e){let r=t%e;return r<0?e+r:r}function fV(t,e,r){return r*e+(1-r)*t}function kx(t,e,r){return t<e?e:t>r?r:t}function kce(t){return Math.log(t)*Math.LOG2E}var $0=Math.log2||kce;function vf(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var xf=Math.PI,hV=xf/4,ku=xf/180,WB=180/xf,e_=512,iE=4003e4,t_=85.051129,dV=1.5;function Ux(t){return Math.pow(2,t)}function nE(t){return $0(t)}function La(t){let[e,r]=t;vf(Number.isFinite(e)),vf(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let i=e*ku,n=r*ku,o=e_*(i+xf)/(2*xf),s=e_*(xf+Math.log(Math.tan(hV+n*.5)))/(2*xf);return[o,s]}function xl(t){let[e,r]=t,i=e/e_*(2*xf)-xf,n=2*(Math.atan(Math.exp(r/e_*(2*xf)-xf))-hV);return[i*WB,n*WB]}function zx(t){let{latitude:e}=t;vf(Number.isFinite(e));let r=Math.cos(e*ku);return nE(iE*r)-9}function Vx(t){let e=Math.cos(t*ku);return e_/iE/e}function r_(t){let{latitude:e,longitude:r,highPrecision:i=!1}=t;vf(Number.isFinite(e)&&Number.isFinite(r));let n=e_,o=Math.cos(e*ku),s=n/360,l=s/o,u=n/iE/o,h={unitsPerMeter:[u,u,u],metersPerUnit:[1/u,1/u,1/u],unitsPerDegree:[s,l,u],degreesPerUnit:[1/s,1/l,1/u]};if(i){let v=ku*Math.tan(e*ku)/o,T=s*v/2,E=n/iE*v,M=E/l*u;h.unitsPerDegree2=[0,T,E],h.unitsPerMeter2=[M,0,M]}return h}function Hx(t,e){let[r,i,n]=t,[o,s,l]=e,{unitsPerMeter:u,unitsPerMeter2:h}=r_({longitude:r,latitude:i,highPrecision:!0}),v=La(t);v[0]+=o*(u[0]+h[0]*s),v[1]+=s*(u[1]+h[1]*s);let T=xl(v),E=(n||0)+(l||0);return Number.isFinite(n)||Number.isFinite(l)?[T[0],T[1],E]:T}function oE(t){let{height:e,pitch:r,bearing:i,altitude:n,scale:o,center:s}=t,l=jB();Zs.translate(l,l,[0,0,-n]),Zs.rotateX(l,l,-r*ku),Zs.rotateZ(l,l,i*ku);let u=o/e;return Zs.scale(l,l,[u,u,u]),s&&Zs.translate(l,l,Da.negate([],s)),l}function qB(t){let{width:e,height:r,altitude:i,pitch:n=0,offset:o,center:s,scale:l,nearZMultiplier:u=1,farZMultiplier:h=1}=t,{fovy:v=pm(dV)}=t;i!==void 0&&(v=pm(i));let T=v*ku,E=n*ku,M=Am(v),O=M;s&&(O+=s[2]*l/Math.cos(E)/r);let F=T*(.5+(o?o[1]:0)/r),z=Math.sin(F)*O/Math.sin(kx(Math.PI/2-E-F,.01,Math.PI-.01)),W=Math.sin(E)*z+O,J=O*10,K=Math.min(W*h,J);return{fov:T,aspect:e/r,focalDistance:M,near:u,far:K}}function pm(t){return 2*Math.atan(.5/t)*WB}function Am(t){return .5/Math.tan(.5*t*ku)}function i_(t,e){let[r,i,n=0]=t;return vf(Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(n)),Up(e,[r,i,n,1])}function Uu(t,e,r=0){let[i,n,o]=t;if(vf(Number.isFinite(i)&&Number.isFinite(n),"invalid pixel coordinate"),Number.isFinite(o))return Up(e,[i,n,o,1]);let s=Up(e,[i,n,0,1]),l=Up(e,[i,n,1,1]),u=s[2],h=l[2],v=u===h?0:((r||0)-u)/(h-u);return xa.lerp([],s,l,v)}function sE(t){let{width:e,height:r,bounds:i,minExtent:n=0,maxZoom:o=24,offset:s=[0,0]}=t,[[l,u],[h,v]]=i,T=Uce(t.padding),E=La([l,kx(v,-t_,t_)]),M=La([h,kx(u,-t_,t_)]),O=[Math.max(Math.abs(M[0]-E[0]),n),Math.max(Math.abs(M[1]-E[1]),n)],F=[e-T.left-T.right-Math.abs(s[0])*2,r-T.top-T.bottom-Math.abs(s[1])*2];vf(F[0]>0&&F[1]>0);let z=F[0]/O[0],W=F[1]/O[1],J=(T.right-T.left)/2/z,K=(T.top-T.bottom)/2/W,ne=[(M[0]+E[0])/2+J,(M[1]+E[1])/2+K],ge=xl(ne),j=Math.min(o,$0(Math.abs(Math.min(z,W))));return vf(Number.isFinite(j)),{longitude:ge[0],latitude:ge[1],zoom:j}}function Uce(t=0){return typeof t=="number"?{top:t,bottom:t,left:t,right:t}:(vf(Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)),t)}var pV=Math.PI/180;function aE(t,e=0){let{width:r,height:i,unproject:n}=t,o={targetZ:e},s=n([0,i],o),l=n([r,i],o),u,h,v=t.fovy?.5*t.fovy*pV:Math.atan(.5/t.altitude),T=(90-t.pitch)*pV;return v>T-.01?(u=AV(t,0,e),h=AV(t,r,e)):(u=n([0,0],o),h=n([r,0],o)),[s,l,h,u]}function AV(t,e,r){let{pixelUnprojectionMatrix:i}=t,n=Up(i,[e,0,1,1]),o=Up(i,[e,t.height,1,1]),l=(r*t.distanceScales.unitsPerMeter[2]-n[2])/(o[2]-n[2]),u=xa.lerp([],n,o,l),h=xl(u);return h.push(r),h}var mV=512;function XB(t){let{width:e,height:r,pitch:i=0}=t,{longitude:n,latitude:o,zoom:s,bear
const int max_lights = 2;
uniform mat4 shadow_uViewProjectionMatrices[max_lights];
uniform vec4 shadow_uProjectCenters[max_lights];
uniform bool shadow_uDrawShadowMap;
uniform bool shadow_uUseShadowMap;
uniform int shadow_uLightId;
uniform float shadow_uLightCount;
out vec3 shadow_vPosition[max_lights];
vec4 shadow_setVertexPosition(vec4 position_commonspace) {
if (shadow_uDrawShadowMap) {
return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);
}
if (shadow_uUseShadowMap) {
for (int i = 0; i < max_lights; i++) {
if(i < int(shadow_uLightCount)) {
vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);
shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;
}
}
}
return gl_Position;
}
`,Gce=`
const int max_lights = 2;
uniform bool shadow_uDrawShadowMap;
uniform bool shadow_uUseShadowMap;
uniform sampler2D shadow_uShadowMap0;
uniform sampler2D shadow_uShadowMap1;
uniform vec4 shadow_uColor;
uniform float shadow_uLightCount;
in vec3 shadow_vPosition[max_lights];
const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);
const vec4 bitUnpackShift = 1.0 / bitPackShift;
const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);
float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {
vec4 rgbaDepth = texture(shadowMap, position.xy);
float z = dot(rgbaDepth, bitUnpackShift);
return smoothstep(0.001, 0.01, position.z - z);
}
vec4 shadow_filterShadowColor(vec4 color) {
if (shadow_uDrawShadowMap) {
vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);
rgbaDepth -= rgbaDepth.gbaa * bitMask;
return rgbaDepth;
}
if (shadow_uUseShadowMap) {
float shadowAlpha = 0.0;
shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);
if(shadow_uLightCount > 1.0) {
shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);
}
shadowAlpha *= shadow_uColor.a / shadow_uLightCount;
float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);
return vec4(
mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),
blendedAlpha
);
}
return color;
}
`,Wce=Nu(Zce),qce=Nu(Jce),Xce=[0,0,0,1],Yce=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function Kce(t,e){let[r,i,n]=t,o=Uu([r,i,n],e);return Number.isFinite(n)?o:[o[0],o[1],0]}function Zce({viewport:t,center:e}){return new Kr(t.viewProjectionMatrix).invert().transform(e)}function Jce({viewport:t,shadowMatrices:e}){let r=[],i=t.pixelUnprojectionMatrix,n=t.isGeospatial?void 0:1,o=[[0,0,n],[t.width,0,n],[0,t.height,n],[t.width,t.height,n],[0,0,-1],[t.width,0,-1],[0,t.height,-1],[t.width,t.height,-1]].map(s=>Kce(s,i));for(let s of e){let l=s.clone().translate(new ot(t.center).negate()),u=o.map(v=>l.transform(v)),h=new Kr().ortho({left:Math.min(...u.map(v=>v[0])),right:Math.max(...u.map(v=>v[0])),bottom:Math.min(...u.map(v=>v[1])),top:Math.max(...u.map(v=>v[1])),near:Math.min(...u.map(v=>-v[2])),far:Math.max(...u.map(v=>-v[2]))});r.push(h.multiplyRight(s))}return r}function Qce(t,e){let{shadowEnabled:r=!0}=t;if(!r||!t.shadowMatrices||!t.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};let i={shadow_uDrawShadowMap:Boolean(t.drawToShadowMap),shadow_uUseShadowMap:t.shadowMaps?t.shadowMaps.length>0:!1,shadow_uColor:t.shadowColor||Xce,shadow_uLightId:t.shadowLightId||0,shadow_uLightCount:t.shadowMatrices.length},n=Wce({viewport:t.viewport,center:e.center}),o=[],s=qce({shadowMatrices:t.shadowMatrices,viewport:t.viewport}).slice();for(let l=0;l<t.shadowMatrices.length;l++){let u=s[l],h=u.clone().translate(new ot(t.viewport.center).negate());e.coordinateSystem===Zr.LNGLAT&&e.projectionMode===Nl.WEB_MERCATOR?(s[l]=h,o[l]=n):(s[l]=u.clone().multiplyRight(Yce),o[l]=h.transform(n))}for(let l=0;l<s.length;l++)i[`shadow_uViewProjectionMatrices[${l}]`]=s[l],i[`shadow_uProjectCenters[${l}]`]=o[l];for(let l=0;l<2;l++)i[`shadow_uShadowMap${l}`]=t.shadowMaps&&t.shadowMaps[l]||t.dummyShadowMap;return i}var n_={name:"shadow",dependencies:[dm],vs:jce,fs:Gce,inject:{"vs:DECKGL_FILTER_GL_POSITION":`
position = shadow_setVertexPosition(geometry.position);
`,"fs:DECKGL_FILTER_COLOR":`
color = shadow_filterShadowColor(color);
`},getUniforms:(t={},e={})=>"viewport"in t&&(t.drawToShadowMap||t.shadowMaps&&t.shadowMaps.length>0)?Qce(t,e):{}};var go={...zT,defaultUniforms:{...zT.defaultUniforms,useFloatColors:!1},inject:{"vs:DECKGL_FILTER_GL_POSITION":`
// for picking depth values
picking_setPickingAttribute(position.z / position.w);
`,"vs:DECKGL_FILTER_COLOR":`
picking_setPickingColor(geometry.pickingColor);
`,"fs:DECKGL_FILTER_COLOR":{order:99,injection:`
// use highlight color if this fragment belongs to the selected object.
color = picking_filterHighlightColor(color);
// use picking color if rendering to picking FBO.
color = picking_filterPickingColor(color);
`}}};var $ce=[tE],eue=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"];function o_(){let t=Pp.getDefaultShaderAssembler();for(let e of $ce)t.addDefaultModule(e);for(let e of eue)t.addShaderHook(e);return t}var tue=[255,255,255],rue=1,iue=0,s_=class{constructor(e={}){this.type="ambient";let{color:r=tue}=e,{intensity:i=rue}=e;this.id=e.id||`ambient-${iue++}`,this.color=r,this.intensity=i}};var nue=[255,255,255],oue=1,sue=[0,0,-1],aue=0,vd=class{constructor(e={}){this.type="directional";let{color:r=nue}=e,{intensity:i=oue}=e,{direction:n=sue}=e,{_shadow:o=!1}=e;this.id=e.id||`directional-${aue++}`,this.color=r,this.intensity=i,this.type="directional",this.direction=new ot(n).normalize().toArray(),this.shadow=o}getProjectedLight(e){return this}};var mm=class{constructor(e,r={id:"pass"}){let{id:i}=r;this.id=i,this.device=e,this.props={...r}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}};var bf=class extends mm{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){let[r,i]=this.device.canvasContext.getDrawingBufferSize(),n=e.clearCanvas??!0,o=e.clearColor??(n?[0,0,0,0]:!1),s=n?1:!1,l=n?0:!1,u=e.colorMask??15,h={viewport:[0,0,r,i]};e.colorMask&&(h.colorMask=u),e.scissorRect&&(h.scissorRect=e.scissorRect);let v=this.device.beginRenderPass({framebuffer:e.target,parameters:h,clearColor:o,clearDepth:s,clearStencil:l});try{return this._drawLayers(v,e)}finally{v.end()}}_drawLayers(e,r){let{target:i,moduleParameters:n,viewports:o,views:s,onViewportActive:l,clearStack:u=!0}=r;r.pass=r.pass||"unknown",u&&(this._lastRenderIndex=-1);let h=[];for(let v of o){let T=s&&s[v.id];l?.(v);let E=this._getDrawLayerParams(v,r),M=v.subViewports||[v];for(let O of M){let F=this._drawLayersInViewport(e,{target:i,moduleParameters:n,viewport:O,view:T,pass:r.pass,layers:r.layers},E);h.push(F)}}return h}_getDrawLayerParams(e,{layers:r,pass:i,isPicking:n=!1,layerFilter:o,cullRect:s,effects:l,moduleParameters:u},h=!1){let v=[],T=vV(this._lastRenderIndex+1),E={layer:r[0],viewport:e,isPicking:n,renderPass:i,cullRect:s},M={};for(let O=0;O<r.length;O++){let F=r[O],z=this._shouldDrawLayer(F,E,o,M),W={shouldDrawLayer:z};z&&!h&&(W.layerRenderIndex=T(F,z),W.moduleParameters=this._getModuleParameters(F,l,i,u),W.layerParameters={...F.context.deck?.props.parameters,...this.getLayerParameters(F,O,e)}),v[O]=W}return v}_drawLayersInViewport(e,{layers:r,moduleParameters:i,pass:n,target:o,viewport:s,view:l},u){let h=lue(this.device,{moduleParameters:i,target:o,viewport:s});if(l&&l.props.clear){let T=l.props.clear===!0?{color:!0,depth:!0}:l.props.clear;this.device.withParametersWebGL({scissorTest:!0,scissor:h},()=>this.device.clearWebGL(T))}let v={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:h});for(let T=0;T<r.length;T++){let E=r[T],{shouldDrawLayer:M,layerRenderIndex:O,moduleParameters:F,layerParameters:z}=u[T];if(M&&E.props.pickable&&v.pickableCount++,E.isComposite)v.compositeCount++;else if(M){v.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,O),F.viewport=s,E.context.renderPass=e;try{E._drawLayer({renderPass:e,moduleParameters:F,uniforms:{layerIndex:O},parameters:z})}catch(W){E.raiseError(W,`drawing ${E} to ${n}`)}}}return v}shouldDrawLayer(e){return!0}getModuleParameters(e,r){return null}getLayerParameters(e,r,i){return e.props.parameters}_shouldDrawLayer(e,r,i,n){if(!(e.props.visible&&this.shouldDrawLayer(e)))return!1;r.layer=e;let s=e.parent;for(;s;){if(!s.props.visible||!s.filterSubLayer(r))return!1;r.layer=s,s=s.parent}if(i){let l=r.layer.id;if(l in n||(n[l]=i(r)),!n[l])return!1}return e.activateViewport(r.viewport),!0}_getModuleParameters(e,r,i,n){let o=this.device.canvasContext.cssToDeviceRatio(),s=Object.assign(Object.create(e.internalState?.propsInTransition||e.props),{autoWrapLongitude:e.wrapLongitude,viewport:e.context.viewpo
in vec2 aClipSpacePosition;
in vec2 aTexCoord;
in vec2 aCoordinate;
out vec2 position;
out vec2 coordinate;
out vec2 uv;
void main(void) {
gl_Position = vec4(aClipSpacePosition, 0., 1.);
position = aClipSpacePosition;
coordinate = aCoordinate;
uv = aTexCoord;
}
`,DV=[-1,-1,1,-1,-1,1,1,1],Jx=class extends Ni{constructor(e,r){let i=DV.map(n=>n===-1?0:n);super(e,{...r,vs:Yue,vertexCount:4,geometry:new Fn({topology:"triangle-strip",vertexCount:4,attributes:{aClipSpacePosition:{size:2,value:new Float32Array(DV)},aTexCoord:{size:2,value:new Float32Array(i)},aCoordinate:{size:2,value:new Float32Array(i)}}})})}};var Vu=class{id;matrix=new Kr;display=!0;position=new ot;rotation=new ot;scale=new ot(1,1,1);userData={};props={};constructor(e={}){let{id:r}=e;this.id=r||oa(this.constructor.name),this._setScenegraphNodeProps(e)}getBounds(){return null}destroy(){}delete(){this.destroy()}setProps(e){return this._setScenegraphNodeProps(e),this}toString(){return`{type: ScenegraphNode, id: ${this.id})}`}setPosition(e){return Yi(e.length===3,"setPosition requires vector argument"),this.position=e,this}setRotation(e){return Yi(e.length===3,"setRotation requires vector argument"),this.rotation=e,this}setScale(e){return Yi(e.length===3,"setScale requires vector argument"),this.scale=e,this}setMatrix(e,r=!0){r?this.matrix.copy(e):this.matrix=e}setMatrixComponents(e){let{position:r,rotation:i,scale:n,update:o=!0}=e;return r&&this.setPosition(r),i&&this.setRotation(i),n&&this.setScale(n),o&&this.updateMatrix(),this}updateMatrix(){let e=this.position,r=this.rotation,i=this.scale;return this.matrix.identity(),this.matrix.translate(e),this.matrix.rotateXYZ(r),this.matrix.scale(i),this}update(e={}){let{position:r,rotation:i,scale:n}=e;return r&&this.setPosition(r),i&&this.setRotation(i),n&&this.setScale(n),this.updateMatrix(),this}getCoordinateUniforms(e,r){Yi(e),r=r||this.matrix;let i=new Kr(e).multiplyRight(r),n=i.invert(),o=n.transpose();return{viewMatrix:e,modelMatrix:r,objectMatrix:r,worldMatrix:i,worldInverseMatrix:n,worldInverseTransposeMatrix:o}}_setScenegraphNodeProps(e){"display"in e&&(this.display=e.display),"position"in e&&this.setPosition(e.position),"rotation"in e&&this.setRotation(e.rotation),"scale"in e&&this.setScale(e.scale),"matrix"in e&&this.setMatrix(e.matrix),Object.assign(this.props,e)}};var Qc=class extends Vu{children;constructor(e={}){e=Array.isArray(e)?{children:e}:e;let{children:r=[]}=e;Kt.assert(r.every(i=>i instanceof Vu),"every child must an instance of ScenegraphNode"),super(e),this.children=r}getBounds(){let e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse((r,{worldMatrix:i})=>{let n=r.getBounds();if(!n)return;let[o,s]=n,l=new ot(o).add(s).divide([2,2,2]);i.transformAsPoint(l,l);let u=new ot(s).subtract(o).divide([2,2,2]);i.transformAsVector(u,u);for(let h=0;h<8;h++){let v=new ot(h&1?-1:1,h&2?-1:1,h&4?-1:1).multiply(u).add(l);for(let T=0;T<3;T++)e[0][T]=Math.min(e[0][T],v[T]),e[1][T]=Math.max(e[1][T],v[T])}}),Number.isFinite(e[0][0])?e:null}destroy(){this.children.forEach(e=>e.destroy()),this.removeAll(),super.destroy()}add(...e){for(let r of e)Array.isArray(r)?this.add(...r):this.children.push(r);return this}remove(e){let r=this.children,i=r.indexOf(e);return i>-1&&r.splice(i,1),this}removeAll(){return this.children=[],this}traverse(e,{worldMatrix:r=new Kr}={}){let i=new Kr(r).multiplyRight(this.matrix);for(let n of this.children)n instanceof Qc?n.traverse(e,{worldMatrix:i}):e(n,{worldMatrix:i})}};var Ih=class extends Vu{model;bounds=null;managedResources;constructor(e){super(e),this.model=e.model,this.managedResources=e.managedResources||[],this.bounds=e.bounds||null,this.setProps(e)}getBounds(){return this.bounds}destroy(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(e=>e.destroy()),this.managedResources=[]}draw(e){return this.model.draw(e)}};var xd=class extends Fn{constructor(e={}){let{id:r=oa("cube-geometry"),indices:i=!0}=e;super(i?{...e,id:r,topology:"triangle-list",indices:{size:1,value:Kue},attributes:{...rfe,...e.attributes}}:{...e,id:r,topology:"triangle-list",indices:void 0,attributes:{...ife,...e.attributes}})}},Kue=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Zue=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1
uniform sampler2D texSrc;
uniform vec2 texSize;
in vec2 position;
in vec2 coordinate;
in vec2 uv;
out vec4 fragColor;
`,sfe=t=>`${LV}
void main() {
fragColor = texture(texSrc, coordinate);
fragColor = ${t}(fragColor, texSize, coordinate);
}
`,afe=t=>`${LV}
void main() {
fragColor = ${t}(texSrc, texSize, coordinate);
}
`;function lfe(t,e){if(e.filter){let r=typeof e.filter=="string"?e.filter:`${t.name}_filterColor`;return sfe(r)}if(e.sampler){let r=typeof e.sampler=="string"?e.sampler:`${t.name}_sampleColor`;return afe(r)}return""}var cfe={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant-alpha",blendAlphaDstFactor:"zero"},bd=class extends bf{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:o,pickingFBO:s,deviceRect:{x:l,y:u,width:h,height:v},cullRect:T,effects:E,pass:M="picking",pickZ:O,moduleParameters:F}){this.pickZ=O;let z=this._resetColorEncoder(O),W=[l,u,h,v],J=super.render({target:s,layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:o,cullRect:T,effects:E?.filter(ne=>ne.useInPicking),pass:M,isPicking:!0,moduleParameters:F,clearColor:[0,0,0,0],colorMask:15,scissorRect:W});return this._colorEncoderState=null,{decodePickingColor:z&&ffe.bind(null,z),stats:J}}shouldDrawLayer(e){let{pickable:r,operation:i}=e.props;return r&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getModuleParameters(){return{picking:{isActive:1,isAttribute:this.pickZ},lightSources:{}}}getLayerParameters(e,r,i){let n={depthMask:!0,depthTest:!0,depthRange:[0,1],...e.props.parameters},{pickable:o,operation:s}=e.props;return!this._colorEncoderState||s.includes("terrain")?n.blend=!1:o&&s.includes("draw")&&(Object.assign(n,cfe),n.blend=!0,n.blendColor=ufe(this._colorEncoderState,e,i)),n}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function ufe(t,e,r){let{byLayer:i,byAlpha:n}=t,o,s=i.get(e);return s?(s.viewports.push(r),o=s.a):(o=i.size+1,o<=255?(s={a:o,layer:e,viewports:[r]},i.set(e,s),n[o]=s):(ur.warn("Too many pickable layers, only picking the first 255")(),o=0)),[0,0,0,o/255]}function ffe(t,e){let r=t.byAlpha[e[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(e)}}var Hp={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},f_=Symbol.for("component"),Hu=Symbol.for("propTypes"),AE=Symbol.for("deprecatedProps"),wd=Symbol.for("asyncPropDefaults"),Ph=Symbol.for("asyncPropOriginal"),Tf=Symbol.for("asyncPropResolved");function Rh(t,e=()=>!0){return Array.isArray(t)?FV(t,e,[]):e(t)?[t]:[]}function FV(t,e,r){let i=-1;for(;++i<t.length;){let n=t[i];Array.isArray(n)?FV(n,e,r):e(n)&&r.push(n)}return r}function mE({target:t,source:e,start:r=0,count:i=1}){let n=e.length,o=i*n,s=0;for(let l=r;s<n;s++)t[l++]=e[s];for(;s<o;)s<o-s?(t.copyWithin(r+s,r,r+s),s*=2):(t.copyWithin(r+s,r,r+o-s),s=o);return t}var t1=class{constructor(e,r,i){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=i,this.setData(r)}subscribe(e){this._subscribers.add(e)}unsubscribe(e){this._subscribers.delete(e)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,r){if(e===this._data&&!r)return;this._data=e;let i=++this._loadCount,n=e;typeof e=="string"&&(n=_a(e)),n instanceof Promise?(this.isLoaded=!1,this._loader=n.then(o=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=o)}).catch(o=>{this._loadCount===i&&(this.isLoaded=!0,this._error=o||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(let o of this._subscribers)o.onChange(this.getData())}};var r1=class{constructor(e){this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:e.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._res
#define SHADER_NAME interpolation-transition-vertex-shader
uniform float time;
in ATTRIBUTE_TYPE aFrom;
in ATTRIBUTE_TYPE aTo;
out ATTRIBUTE_TYPE vCurrent;
void main(void) {
vCurrent = mix(aFrom, aTo, time);
gl_Position = vec4(0.0);
}
`,$fe=`#version 300 es
#define SHADER_NAME interpolation-transition-vertex-shader
uniform float time;
in ATTRIBUTE_TYPE aFrom;
in ATTRIBUTE_TYPE aFrom64Low;
in ATTRIBUTE_TYPE aTo;
in ATTRIBUTE_TYPE aTo64Low;
out ATTRIBUTE_TYPE vCurrent;
out ATTRIBUTE_TYPE vCurrent64Low;
vec2 mix_fp64(vec2 a, vec2 b, float x) {
vec2 range = sub_fp64(b, a);
return sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));
}
void main(void) {
for (int i=0; i<ATTRIBUTE_SIZE; i++) {
vec2 value = mix_fp64(vec2(aFrom[i], aFrom64Low[i]), vec2(aTo[i], aTo64Low[i]), time);
vCurrent[i] = value.x;
vCurrent64Low[i] = value.y;
}
gl_Position = vec4(0.0);
}
`;function x9(t){return t.doublePrecision&&t.value instanceof Float64Array}function ehe(t,e){let r=e.size,i=EE(r),n=SE(r),o=e.getBufferLayout();return x9(e)?new zu(t,{vs:$fe,bufferLayout:[{name:"aFrom",byteStride:8*r,attributes:[{attribute:"aFrom",format:n,byteOffset:0},{attribute:"aFrom64Low",format:n,byteOffset:4*r}]},{name:"aTo",byteStride:8*r,attributes:[{attribute:"aTo",format:n,byteOffset:0},{attribute:"aTo64Low",format:n,byteOffset:4*r}]}],modules:[Dp],defines:{ATTRIBUTE_TYPE:i,ATTRIBUTE_SIZE:r},moduleSettings:{},varyings:["vCurrent","vCurrent64Low"],bufferMode:35980,disableWarnings:!0}):new zu(t,{vs:Qfe,bufferLayout:[{name:"aFrom",format:n},{name:"aTo",format:o.attributes[0].format}],defines:{ATTRIBUTE_TYPE:i},varyings:["vCurrent"],disableWarnings:!0})}var v1=class extends A_{constructor({device:e,attribute:r,timeline:i}){super({device:e,attribute:r,timeline:i}),this.type="spring",this.texture=nhe(e),this.framebuffer=ohe(e,this.texture),this.transform=ihe(e,r)}start(e,r){let i=this.currentLength,n=this.currentStartIndices;super.start(e,r);let{buffers:o,attribute:s}=this;for(let u=0;u<2;u++)o[u]=IE({device:this.device,buffer:o[u],attribute:s,fromLength:i,toLength:this.currentLength,fromStartIndices:n,getData:e.enter});o[2]=ME({device:this.device,source:o[0],target:o[2]}),this.setBuffer(o[1]);let{model:l}=this.transform;l.setVertexCount(Math.floor(this.currentLength/s.size)),s.isConstant?l.setConstantAttributes({aTo:s.value}):l.setAttributes({aTo:s.getBuffer()})}onUpdate(){let{buffers:e,transform:r,framebuffer:i,transition:n}=this,o=this.settings;r.model.setAttributes({aPrev:e[0],aCur:e[1]}),r.transformFeedback.setBuffers({vNext:e[2]}),r.model.setUniforms({stiffness:o.stiffness,damping:o.damping}),r.run({framebuffer:i,discard:!1,parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]}),CE(e),this.setBuffer(e[1]),this.device.readPixelsToArrayWebGL(i)[0]>0||n.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}},the=`#version 300 es
#define SHADER_NAME spring-transition-vertex-shader
#define EPSILON 0.00001
uniform float stiffness;
uniform float damping;
in ATTRIBUTE_TYPE aPrev;
in ATTRIBUTE_TYPE aCur;
in ATTRIBUTE_TYPE aTo;
out ATTRIBUTE_TYPE vNext;
out float vIsTransitioningFlag;
ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {
ATTRIBUTE_TYPE velocity = cur - prev;
ATTRIBUTE_TYPE delta = dest - cur;
ATTRIBUTE_TYPE spring = delta * stiffness;
ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;
return spring + damper + velocity + cur;
}
void main(void) {
bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;
vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;
vNext = getNextValue(aCur, aPrev, aTo);
gl_Position = vec4(0, 0, 0, 1);
gl_PointSize = 100.0;
}
`,rhe=`#version 300 es
#define SHADER_NAME spring-transition-is-transitioning-fragment-shader
in float vIsTransitioningFlag;
out vec4 fragColor;
void main(void) {
if (vIsTransitioningFlag == 0.0) {
discard;
}
fragColor = vec4(1.0);
}`;function ihe(t,e){let r=EE(e.size),i=SE(e.size);return new zu(t,{vs:the,fs:rhe,bufferLayout:[{name:"aPrev",format:i},{name:"aCur",format:i},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],defines:{ATTRIBUTE_TYPE:r},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function nhe(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function ohe(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var she={interpolation:y1,spring:v1},x1=class{constructor(e,{id:r,timeline:i}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=r,this.device=e,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:r,numInstances:i}){this.numInstances=i||1;for(let n in e){let o=e[n],s=o.getTransitionSetting(r);s&&this._updateAttribute(n,o,s)}for(let n in this.transitions){let o=e[n];(!o||!o.getTransitionSetting(r))&&this._removeTransition(n)}}hasAttribute(e){let r=this.transitions[e];return r&&r.inProgress}getAttributes(){let e={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(e[r]=i.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,r,i){let n=this.transitions[e],o=!n||n.type!==i.type;if(o){n&&this._removeTransition(e);let s=she[i.type];s?this.transitions[e]=new s({attribute:r,timeline:this.timeline,device:this.device}):(ur.error(`unsupported transition type '${i.type}'`)(),o=!1)}(o||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(i,this.numInstances))}};var b9="attributeManager.invalidate",ahe="attributeManager.updateStart",lhe="attributeManager.updateEnd",che="attribute.updateStart",uhe="attribute.allocate",fhe="attribute.updateEnd",Mf=class{constructor(e,{id:r="attribute-manager",stats:i,timeline:n}={}){this.mergeBoundsMemoized=Nu(EV),this.id=r,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new x1(e,{id:`${r}-transitions`,timeline:n}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(let r of e)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(e,r){let i=this._invalidateTrigger(e,r);Ks(b9,this,e,i)}invalidateAll(e){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,e);Ks(b9,this,"all")}update({data:e,numInstances:r,startIndices:i=null,transitions:n,props:o={},buffers:s={},context:l={}}){let u=!1;Ks(ahe,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let h in this.attributes){let v=this.attributes[h],T=v.settings.accessor;v.startIndices=i,v.numInstances=r,o[h]&&ur.removed(`props.${h}`,`data.attributes.${h}`)(),v.setExternalBuffer(s[h])||v.setBinaryValue(typeof T=="string"?s[T]:void 0,e.startIndices)||typeof T=="string"&&!s[T]&&v.setConstantValue(o[T])||v.needsUpdate()&&(u=!0,this._updateAttribute({attribute:v,numInstances:r,data:e,props:o,context:l})),this.needsRedraw=this.needsRedraw||v.needsRedraw()}u&&Ks(lhe,this,r),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:n})}updateTransition(){let{attributeT
#define SHADER_NAME arc-layer-vertex-shader
in vec4 instanceSourceColors;
in vec4 instanceTargetColors;
in vec3 instanceSourcePositions;
in vec3 instanceSourcePositions64Low;
in vec3 instanceTargetPositions;
in vec3 instanceTargetPositions64Low;
in vec3 instancePickingColors;
in float instanceWidths;
in float instanceHeights;
in float instanceTilts;
uniform bool greatCircle;
uniform bool useShortestPath;
uniform float numSegments;
uniform float opacity;
uniform float widthScale;
uniform float widthMinPixels;
uniform float widthMaxPixels;
uniform int widthUnits;
out vec4 vColor;
out vec2 uv;
out float isValid;
float paraboloid(float distance, float sourceZ, float targetZ, float ratio) {
float deltaZ = targetZ - sourceZ;
float dh = distance * instanceHeights;
if (dh == 0.0) {
return sourceZ + deltaZ * ratio;
}
float unitZ = deltaZ / dh;
float p2 = unitZ * unitZ + 1.0;
float dir = step(deltaZ, 0.0);
float z0 = mix(sourceZ, targetZ, dir);
float r = mix(ratio, 1.0 - ratio, dir);
return sqrt(r * (p2 - r)) * dh + z0;
}
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
return dir_screenspace * offset_direction * width / 2.0;
}
float getSegmentRatio(float index) {
return smoothstep(0.0, 1.0, index / (numSegments - 1.0));
}
vec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {
float distance = length(source.xy - target.xy);
float z = paraboloid(distance, source.z, target.z, segmentRatio);
float tiltAngle = radians(instanceTilts);
vec2 tiltDirection = normalize(target.xy - source.xy);
vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);
return vec3(
mix(source.xy, target.xy, segmentRatio) + tilt,
z * cos(tiltAngle)
);
}
float getAngularDist (vec2 source, vec2 target) {
vec2 sourceRadians = radians(source);
vec2 targetRadians = radians(target);
vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);
vec2 shd_sq = sin_half_delta * sin_half_delta;
float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;
return 2.0 * asin(sqrt(a));
}
vec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {
vec2 lngLat;
if(abs(angularDist - PI) < 0.001) {
lngLat = (1.0 - t) * source.xy + t * target.xy;
} else {
float a = sin((1.0 - t) * angularDist);
float b = sin(t * angularDist);
vec3 p = source3D.yxz * a + target3D.yxz * b;
lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));
}
float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);
return vec3(lngLat, z);
}
void main(void) {
geometry.worldPosition = instanceSourcePositions;
geometry.worldPositionAlt = instanceTargetPositions;
float segmentIndex = float(gl_VertexID / 2);
float segmentSide = mod(float(gl_VertexID), 2.) == 0. ? -1. : 1.;
float segmentRatio = getSegmentRatio(segmentIndex);
float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));
float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0));
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
isValid = 1.0;
uv = vec2(segmentRatio, segmentSide);
geometry.uv = uv;
geometry.pickingColor = instancePickingColors;
vec4 curr;
vec4 next;
vec3 source;
vec3 target;
if ((greatCircle || project.projectionMode == PROJECTION_MODE_GLOBE) && project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));
target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));
float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);
vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);
vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);
vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);
if (abs(currPos.x - prevPos.x) > 180.0) {
indexDir = -1.0;
isValid = 0.0;
} else if (abs(currPos.x - nextPos.x) > 180.0) {
indexDir = 1.0;
isValid = 0.0;
}
nextPos = indexDir < 0.0 ? prevPos : nextPos;
nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
if (isValid == 0.0) {
nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;
float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);
currPos = mix(currPos, nextPos, t);
segmentRatio = mix(segmentRatio, nextSegmentRatio, t);
}
vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);
vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);
curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);
next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));
} else {
vec3 source_world = instanceSourcePositions;
vec3 target_world = instanceTargetPositions;
if (useShortestPath) {
source_world.x = mod(source_world.x + 180., 360.0) - 180.;
target_world.x = mod(target_world.x + 180., 360.0) - 180.;
float deltaLng = target_world.x - source_world.x;
if (deltaLng > 180.) target_world.x -= 360.;
if (deltaLng < -180.) source_world.x -= 360.;
}
source = project_position(source_world, instanceSourcePositions64Low);
target = project_position(target_world, instanceTargetPositions64Low);
float antiMeridianX = 0.0;
if (useShortestPath) {
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
antiMeridianX = -(project.coordinateOrigin.x + 180.) / 360. * TILE_SIZE;
}
float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);
if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {
isValid = 0.0;
indexDir = sign(segmentRatio - thresholdRatio);
segmentRatio = thresholdRatio;
}
}
nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
vec3 currPos = interpolateFlat(source, target, segmentRatio);
vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);
if (useShortestPath) {
if (nextPos.x < antiMeridianX) {
currPos.x += TILE_SIZE;
nextPos.x += TILE_SIZE;
}
}
curr = project_common_position_to_clipspace(vec4(currPos, 1.0));
next = project_common_position_to_clipspace(vec4(nextPos, 1.0));
geometry.position = vec4(currPos, 1.0);
}
float widthPixels = clamp(
project_size_to_pixel(instanceWidths * widthScale, widthUnits),
widthMinPixels, widthMaxPixels
);
vec3 offset = vec3(
getExtrusionOffset((next.xy - curr.xy) * indexDir, segmentSide, widthPixels),
0.0);
DECKGL_FILTER_SIZE(offset, geometry);
DECKGL_FILTER_GL_POSITION(curr, geometry);
gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);
vColor = vec4(color.rgb, color.a * opacity);
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var G9=`#version 300 es
#define SHADER_NAME arc-layer-fragment-shader
precision highp float;
in vec4 vColor;
in vec2 uv;
in float isValid;
out vec4 fragColor;
void main(void) {
if (isValid == 0.0) {
discard;
}
fragColor = vColor;
geometry.uv = uv;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var kE=[0,0,0,255],ede={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getSourceColor:{type:"accessor",value:kE},getTargetColor:{type:"accessor",value:kE},getWidth:{type:"accessor",value:1},getHeight:{type:"accessor",value:1},getTilt:{type:"accessor",value:0},greatCircle:!1,numSegments:{type:"number",value:50,min:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}},UE=class extends On{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:j9,fs:G9,modules:[Jn,go]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceSourceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getSourceColor",defaultValue:kE},instanceTargetColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getTargetColor",defaultValue:kE},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:"getHeight",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:"getTilt",defaultValue:0}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{widthUnits:r,widthScale:i,widthMinPixels:n,widthMaxPixels:o,greatCircle:s,wrapLongitude:l,numSegments:u}=this.props,h=this.state.model;h.setUniforms(e),h.setUniforms({numSegments:u,greatCircle:s,widthUnits:ms[r],widthScale:i,widthMinPixels:n,widthMaxPixels:o,useShortestPath:l}),h.setVertexCount(u*2),h.draw(this.context.renderPass)}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-strip",isInstanced:!0})}},Um=UE;(()=>{UE.layerName="ArcLayer"})(),(()=>{UE.defaultProps=ede})();var tde=new Uint32Array([0,2,1,0,3,2]),rde=new Float32Array([0,1,0,0,1,0,1,1]);function BO(t,e){if(!e)return ide(t);let r=Math.max(Math.abs(t[0][0]-t[3][0]),Math.abs(t[1][0]-t[2][0])),i=Math.max(Math.abs(t[1][1]-t[0][1]),Math.abs(t[2][1]-t[3][1])),n=Math.ceil(r/e)+1,o=Math.ceil(i/e)+1,s=(n-1)*(o-1)*6,l=new Uint32Array(s),u=new Float32Array(n*o*2),h=new Float64Array(n*o*3),v=0,T=0;for(let E=0;E<n;E++){let M=E/(n-1);for(let O=0;O<o;O++){let F=O/(o-1),z=nde(t,M,F);h[v*3+0]=z[0],h[v*3+1]=z[1],h[v*3+2]=z[2]||0,u[v*2+0]=M,u[v*2+1]=1-F,E>0&&O>0&&(l[T++]=v-o,l[T++]=v-o-1,l[T++]=v-1,l[T++]=v-o,l[T++]=v-1,l[T++]=v),v++}}return{vertexCount:s,positions:h,indices:l,texCoords:u}}function ide(t){let e=new Float64Array(12);for(let r=0;r<t.length;r++)e[r*3+0]=t[r][0],e[r*3+1]=t[r][1],e[r*3+2]=t[r][2]||0;return{vertexCount:6,positions:e,indices:tde,texCoords:rde}}function nde(t,e,r){return Oa(Oa(t[0],t[1],r),Oa(t[3],t[2],r),e)}var W9=`#version 300 es
#define SHADER_NAME bitmap-layer-vertex-shader
in vec2 texCoords;
in vec3 positions;
in vec3 positions64Low;
out vec2 vTexCoord;
out vec2 vTexPos;
uniform float coordinateConversion;
const vec3 pickingColor = vec3(1.0, 0.0, 0.0);
void main(void) {
geometry.worldPosition = positions;
geometry.uv = texCoords;
geometry.pickingColor = pickingColor;
gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
vTexCoord = texCoords;
if (coordinateConversion < -0.5) {
vTexPos = geometry.position.xy + project.commonOrigin.xy;
} else if (coordinateConversion > 0.5) {
vTexPos = geometry.worldPosition.xy;
}
vec4 color = vec4(0.0);
DECKGL_FILTER_COLOR(color, geometry);
}
`;var ode=`
vec3 packUVsIntoRGB(vec2 uv) {
// Extract the top 8 bits. We want values to be truncated down so we can add a fraction
vec2 uv8bit = floor(uv * 256.);
// Calculate the normalized remainders of u and v parts that do not fit into 8 bits
// Scale and clamp to 0-1 range
vec2 uvFraction = fract(uv * 256.);
vec2 uvFraction4bit = floor(uvFraction * 16.);
// Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates
float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;
return vec3(uv8bit, fractions) / 255.;
}
`,q9=`#version 300 es
#define SHADER_NAME bitmap-layer-fragment-shader
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D bitmapTexture;
in vec2 vTexCoord;
in vec2 vTexPos;
out vec4 fragColor;
uniform float desaturate;
uniform vec4 transparentColor;
uniform vec3 tintColor;
uniform float opacity;
uniform float coordinateConversion;
uniform vec4 bounds;
/* projection utils */
const float TILE_SIZE = 512.0;
const float PI = 3.1415926536;
const float WORLD_SCALE = TILE_SIZE / PI / 2.0;
// from degrees to Web Mercator
vec2 lnglat_to_mercator(vec2 lnglat) {
float x = lnglat.x;
float y = clamp(lnglat.y, -89.9, 89.9);
return vec2(
radians(x) + PI,
PI + log(tan(PI * 0.25 + radians(y) * 0.5))
) * WORLD_SCALE;
}
// from Web Mercator to degrees
vec2 mercator_to_lnglat(vec2 xy) {
xy /= WORLD_SCALE;
return degrees(vec2(
xy.x - PI,
atan(exp(xy.y - PI)) * 2.0 - PI * 0.5
));
}
/* End projection utils */
// apply desaturation
vec3 color_desaturate(vec3 color) {
float luminance = (color.r + color.g + color.b) * 0.333333333;
return mix(color, vec3(luminance), desaturate);
}
// apply tint
vec3 color_tint(vec3 color) {
return color * tintColor;
}
// blend with background color
vec4 apply_opacity(vec3 color, float alpha) {
if (transparentColor.a == 0.0) {
return vec4(color, alpha);
}
float blendedAlpha = alpha + transparentColor.a * (1.0 - alpha);
float highLightRatio = alpha / blendedAlpha;
vec3 blendedRGB = mix(transparentColor.rgb, color, highLightRatio);
return vec4(blendedRGB, blendedAlpha);
}
vec2 getUV(vec2 pos) {
return vec2(
(pos.x - bounds[0]) / (bounds[2] - bounds[0]),
(pos.y - bounds[3]) / (bounds[1] - bounds[3])
);
}
${ode}
void main(void) {
vec2 uv = vTexCoord;
if (coordinateConversion < -0.5) {
vec2 lnglat = mercator_to_lnglat(vTexPos);
uv = getUV(lnglat);
} else if (coordinateConversion > 0.5) {
vec2 commonPos = lnglat_to_mercator(vTexPos);
uv = getUV(commonPos);
}
vec4 bitmapColor = texture(bitmapTexture, uv);
fragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);
geometry.uv = uv;
DECKGL_FILTER_COLOR(fragColor, geometry);
if (bool(picking.isActive) && !bool(picking.isAttribute)) {
// Since instance information is not used, we can use picking color for pixel index
fragColor.rgb = packUVsIntoRGB(uv);
}
}
`;var sde={image:{type:"image",value:null,async:!0},bounds:{type:"array",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:Zr.DEFAULT,desaturate:{type:"number",min:0,max:1,value:0},transparentColor:{type:"color",value:[0,0,0,0]},tintColor:{type:"color",value:[255,255,255]},textureParameters:{type:"object",ignore:!0,value:null}},zE=class extends On{getShaders(){return super.getShaders({vs:W9,fs:q9,modules:[Jn,go]})}initializeState(){let e=this.getAttributeManager();e.remove(["instancePickingColors"]);let r=!0;e.add({indices:{size:1,isIndexed:!0,update:i=>i.value=this.state.mesh.indices,noAlloc:r},positions:{size:3,type:"float64",fp64:this.use64bitPositions(),update:i=>i.value=this.state.mesh.positions,noAlloc:r},texCoords:{size:2,update:i=>i.value=this.state.mesh.texCoords,noAlloc:r}})}updateState({props:e,oldProps:r,changeFlags:i}){let n=this.getAttributeManager();if(i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll()),e.bounds!==r.bounds){let o=this.state.mesh,s=this._createMesh();this.state.model.setVertexCount(s.vertexCount);for(let l in s)o&&o[l]!==s[l]&&n.invalidate(l);this.setState({mesh:s,...this._getCoordinateUniforms()})}else e._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(e){let{image:r}=this.props,i=e.info;if(!i.color||!r)return i.bitmap=null,i;let{width:n,height:o}=r;i.index=0;let s=ade(i.color);return i.bitmap={size:{width:n,height:o},uv:s,pixel:[Math.floor(s[0]*n),Math.floor(s[1]*o)]},i}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(e){super._updateAutoHighlight({...e,color:this.encodePickingColor(0)})}_createMesh(){let{bounds:e}=this.props,r=e;return X9(e)&&(r=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]]]),BO(r,this.context.viewport.resolution)}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-list",isInstanced:!1})}draw(e){let{uniforms:r,moduleParameters:i}=e,{model:n,coordinateConversion:o,bounds:s,disablePicking:l}=this.state,{image:u,desaturate:h,transparentColor:v,tintColor:T}=this.props;i.picking.isActive&&l||u&&n&&(n.setUniforms(r),n.setBindings({bitmapTexture:u}),n.setUniforms({desaturate:h,transparentColor:v.map(E=>E/255),tintColor:T.slice(0,3).map(E=>E/255),coordinateConversion:o,bounds:s}),n.draw(this.context.renderPass))}_getCoordinateUniforms(){let{LNGLAT:e,CARTESIAN:r,DEFAULT:i}=Zr,{_imageCoordinateSystem:n}=this.props;if(n!==i){let{bounds:o}=this.props;if(!X9(o))throw new Error("_imageCoordinateSystem only supports rectangular bounds");let s=this.context.viewport.resolution?e:r;if(n=n===e?e:r,n===e&&s===r)return{coordinateConversion:-1,bounds:o};if(n===r&&s===e){let l=La([o[0],o[1]]),u=La([o[2],o[3]]);return{coordinateConversion:1,bounds:[l[0],l[1],u[0],u[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}},zm=zE;(()=>{zE.layerName="BitmapLayer"})(),(()=>{zE.defaultProps=sde})();function ade(t){let[e,r,i]=t,n=(i&240)/256,o=(i&15)/16;return[(e+o)/256,(r+n)/256]}function X9(t){return Number.isFinite(t[0])}var Y9=`#version 300 es
#define SHADER_NAME icon-layer-vertex-shader
in vec2 positions;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in float instanceSizes;
in float instanceAngles;
in vec4 instanceColors;
in vec3 instancePickingColors;
in vec4 instanceIconFrames;
in float instanceColorModes;
in vec2 instanceOffsets;
in vec2 instancePixelOffset;
uniform float sizeScale;
uniform vec2 iconsTextureDim;
uniform float sizeMinPixels;
uniform float sizeMaxPixels;
uniform bool billboard;
uniform int sizeUnits;
out float vColorMode;
out vec4 vColor;
out vec2 vTextureCoords;
out vec2 uv;
vec2 rotate_by_angle(vec2 vertex, float angle) {
float angle_radian = angle * PI / 180.0;
float cos_angle = cos(angle_radian);
float sin_angle = sin(angle_radian);
mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
return rotationMatrix * vertex;
}
void main(void) {
geometry.worldPosition = instancePositions;
geometry.uv = positions;
geometry.pickingColor = instancePickingColors;
uv = positions;
vec2 iconSize = instanceIconFrames.zw;
float sizePixels = clamp(
project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),
sizeMinPixels, sizeMaxPixels
);
float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;
vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;
pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;
pixelOffset += instancePixelOffset;
pixelOffset.y *= -1.0;
if (billboard) {
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
vec3 offset = vec3(pixelOffset, 0.0);
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
} else {
vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
DECKGL_FILTER_SIZE(offset_common, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
}
vTextureCoords = mix(
instanceIconFrames.xy,
instanceIconFrames.xy + iconSize,
(positions.xy + 1.0) / 2.0
) / iconsTextureDim;
vColor = instanceColors;
DECKGL_FILTER_COLOR(vColor, geometry);
vColorMode = instanceColorModes;
}
`;var K9=`#version 300 es
#define SHADER_NAME icon-layer-fragment-shader
precision highp float;
uniform float opacity;
uniform sampler2D iconsTexture;
uniform float alphaCutoff;
in float vColorMode;
in vec4 vColor;
in vec2 vTextureCoords;
in vec2 uv;
out vec4 fragColor;
void main(void) {
geometry.uv = uv;
vec4 texColor = texture(iconsTexture, vTextureCoords);
vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);
float a = texColor.a * opacity * vColor.a;
if (a < alphaCutoff) {
discard;
}
fragColor = vec4(color, a);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var lde=1024,cde=4,Z9=()=>{},J9={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},ude={x:0,y:0,width:0,height:0};function fde(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function hde(t,e,r,i){let n=Math.min(r/e.width,i/e.height),o=Math.floor(e.width*n),s=Math.floor(e.height*n);return n===1?{data:e,width:o,height:s}:(t.canvas.height=s,t.canvas.width=o,t.clearRect(0,0,o,s),t.drawImage(e,0,0,e.width,e.height,0,0,o,s),{data:t.canvas,width:o,height:s})}function D1(t){return t&&(t.id||t.url)}function dde(t,e,r,i){let{width:n,height:o,device:s}=t,l=s.createTexture({format:"rgba8unorm",width:e,height:r,sampler:i}),u=s.createCommandEncoder();return u.copyTextureToTexture({source:t,destination:l,width:n,height:o}),u.finish(),t.destroy(),l}function Q9(t,e,r){for(let i=0;i<e.length;i++){let{icon:n,xOffset:o}=e[i],s=D1(n);t[s]={...n,x:o,y:r}}}function pde({icons:t,buffer:e,mapping:r={},xOffset:i=0,yOffset:n=0,rowHeight:o=0,canvasWidth:s}){let l=[];for(let u=0;u<t.length;u++){let h=t[u],v=D1(h);if(!r[v]){let{height:T,width:E}=h;i+E+e>s&&(Q9(r,l,n),i=0,n=o+n+e,o=0,l=[]),l.push({icon:h,xOffset:i}),i=i+E+e,o=Math.max(o,T)}}return l.length>0&&Q9(r,l,n),{mapping:r,rowHeight:o,xOffset:i,yOffset:n,canvasWidth:s,canvasHeight:fde(o+n+e)}}function Ade(t,e,r){if(!t||!e)return null;r=r||{};let i={},{iterable:n,objectInfo:o}=Js(t);for(let s of n){o.index++;let l=e(s,o),u=D1(l);if(!l)throw new Error("Icon is missing.");if(!l.url)throw new Error("Icon url is missing.");!i[u]&&(!r[u]||l.url!==r[u].url)&&(i[u]={...l,source:s,sourceIndex:o.index})}return i}var L1=class{constructor(e,{onUpdate:r=Z9,onError:i=Z9}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._samplerParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=cde,this._canvasWidth=lde,this._canvasHeight=0,this._canvas=null,this.device=e,this.onUpdate=r,this.onError=i}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(e){let r=this._autoPacking?D1(e):e;return this._mapping[r]||ude}setProps({loadOptions:e,autoPacking:r,iconAtlas:i,iconMapping:n,textureParameters:o}){e&&(this._loadOptions=e),r!==void 0&&(this._autoPacking=r),n&&(this._mapping=n),i&&(this._texture?.delete(),this._texture=null,this._externalTexture=i),o&&(this._samplerParameters=o)}get isLoaded(){return this._pendingCount===0}packIcons(e,r){if(!this._autoPacking||typeof document>"u")return;let i=Object.values(Ade(e,r,this._mapping)||{});if(i.length>0){let{mapping:n,xOffset:o,yOffset:s,rowHeight:l,canvasHeight:u}=pde({icons:i,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=l,this._mapping=n,this._xOffset=o,this._yOffset=s,this._canvasHeight=u,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",width:this._canvasWidth,height:this._canvasHeight,sampler:this._samplerParameters||J9})),this._texture.height!==this._canvasHeight&&(this._texture=dde(this._texture,this._canvasWidth,this._canvasHeight,this._samplerParameters||J9)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(i)}}_loadIcons(e){let r=this._canvas.getContext("2d",{willReadFrequently:!0});for(let i of e)this._pendingCount++,_a(i.url,this._loadOptions).then(n=>{let o=D1(i),s=this._mapping[o],{x:l,y:u,width:h,height:v}=s,{data:T,width:E,height:M}=hde(r,n,h,v);this._texture.setSubImageData({data:T,x:l+(h-E)/2,y:u+(v-M)/2,width:E,height:M}),s.width=E,s.height=M,this._texture.generateMipmap(),this.onUpdate()}).catch(n=>{this.onError({url:i.url,source:i.source,sourceIndex:i.sourceIndex,loadOptions:this._loadOptions,error:n})}).finally(()=>{this._pendingCount--})}};var $9=[0,0,0,255],mde={iconAtlas:{type:"image",value:null,async:!0},iconMapping:{type:"object",value:{},async:!0},sizeScale:{type:"number",value:1,min:0},billboard:!0,sizeUnits:"pixels",sizeMinPixels:{type
#define SHADER_NAME line-layer-vertex-shader
in vec3 positions;
in vec3 instanceSourcePositions;
in vec3 instanceTargetPositions;
in vec3 instanceSourcePositions64Low;
in vec3 instanceTargetPositions64Low;
in vec4 instanceColors;
in vec3 instancePickingColors;
in float instanceWidths;
uniform float opacity;
uniform float widthScale;
uniform float widthMinPixels;
uniform float widthMaxPixels;
uniform float useShortestPath;
uniform int widthUnits;
out vec4 vColor;
out vec2 uv;
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
return dir_screenspace * offset_direction * width / 2.0;
}
vec3 splitLine(vec3 a, vec3 b, float x) {
float t = (x - a.x) / (b.x - a.x);
return vec3(x, mix(a.yz, b.yz, t));
}
void main(void) {
geometry.worldPosition = instanceSourcePositions;
geometry.worldPositionAlt = instanceTargetPositions;
vec3 source_world = instanceSourcePositions;
vec3 target_world = instanceTargetPositions;
vec3 source_world_64low = instanceSourcePositions64Low;
vec3 target_world_64low = instanceTargetPositions64Low;
if (useShortestPath > 0.5 || useShortestPath < -0.5) {
source_world.x = mod(source_world.x + 180., 360.0) - 180.;
target_world.x = mod(target_world.x + 180., 360.0) - 180.;
float deltaLng = target_world.x - source_world.x;
if (deltaLng * useShortestPath > 180.) {
source_world.x += 360. * useShortestPath;
source_world = splitLine(source_world, target_world, 180. * useShortestPath);
source_world_64low = vec3(0.0);
} else if (deltaLng * useShortestPath < -180.) {
target_world.x += 360. * useShortestPath;
target_world = splitLine(source_world, target_world, 180. * useShortestPath);
target_world_64low = vec3(0.0);
} else if (useShortestPath < 0.) {
gl_Position = vec4(0.);
return;
}
}
vec4 source_commonspace;
vec4 target_commonspace;
vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace);
vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace);
float segmentIndex = positions.x;
vec4 p = mix(source, target, segmentIndex);
geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);
uv = positions.xy;
geometry.uv = uv;
geometry.pickingColor = instancePickingColors;
float widthPixels = clamp(
project_size_to_pixel(instanceWidths * widthScale, widthUnits),
widthMinPixels, widthMaxPixels
);
vec3 offset = vec3(
getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),
0.0);
DECKGL_FILTER_SIZE(offset, geometry);
DECKGL_FILTER_GL_POSITION(p, geometry);
gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var tH=`#version 300 es
#define SHADER_NAME line-layer-fragment-shader
precision highp float;
in vec4 vColor;
in vec2 uv;
out vec4 fragColor;
void main(void) {
geometry.uv = uv;
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var gde=[0,0,0,255],_de={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getColor:{type:"accessor",value:gde},getWidth:{type:"accessor",value:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}},HE=class extends On{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:eH,fs:tH,modules:[Jn,go]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:[0,0,0,255]},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{widthUnits:r,widthScale:i,widthMinPixels:n,widthMaxPixels:o,wrapLongitude:s}=this.props,l=this.state.model;l.setUniforms(e),l.setUniforms({widthUnits:ms[r],widthScale:i,widthMinPixels:n,widthMaxPixels:o,useShortestPath:s?1:0}),l.draw(this.context.renderPass),s&&(l.setUniforms({useShortestPath:-1}),l.draw(this.context.renderPass))}_getModel(){let e=[0,-1,0,0,1,0,1,-1,0,1,1,0];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}},Vm=HE;(()=>{HE.layerName="LineLayer"})(),(()=>{HE.defaultProps=_de})();var rH=`#version 300 es
#define SHADER_NAME point-cloud-layer-vertex-shader
in vec3 positions;
in vec3 instanceNormals;
in vec4 instanceColors;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in vec3 instancePickingColors;
uniform float opacity;
uniform float radiusPixels;
uniform int sizeUnits;
out vec4 vColor;
out vec2 unitPosition;
void main(void) {
geometry.worldPosition = instancePositions;
geometry.normal = project_normal(instanceNormals);
unitPosition = positions.xy;
geometry.uv = unitPosition;
geometry.pickingColor = instancePickingColors;
vec3 offset = vec3(positions.xy * project_size_to_pixel(radiusPixels, sizeUnits), 0.0);
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
vColor = vec4(lightColor, instanceColors.a * opacity);
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var iH=`#version 300 es
#define SHADER_NAME point-cloud-layer-fragment-shader
precision highp float;
in vec4 vColor;
in vec2 unitPosition;
out vec4 fragColor;
void main(void) {
geometry.uv = unitPosition;
float distToCenter = length(unitPosition);
if (distToCenter > 1.0) {
discard;
}
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var nH=[0,0,0,255],oH=[0,0,1],yde={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:t=>t.position},getNormal:{type:"accessor",value:oH},getColor:{type:"accessor",value:nH},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};function vde(t){let{header:e,attributes:r}=t;if(!(!e||!r)&&(t.length=e.vertexCount,r.POSITION&&(r.instancePositions=r.POSITION),r.NORMAL&&(r.instanceNormals=r.NORMAL),r.COLOR_0)){let{size:i,value:n}=r.COLOR_0;r.instanceColors={size:i,type:"unorm8",value:n}}}var jE=class extends On{getShaders(){return super.getShaders({vs:rH,fs:iH,modules:[Jn,Fu,go]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceNormals:{size:3,transition:!0,accessor:"getNormal",defaultValue:oH},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:nH}})}updateState(e){let{changeFlags:r,props:i}=e;super.updateState(e),r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll()),r.dataChanged&&vde(i.data)}draw({uniforms:e}){let{pointSize:r,sizeUnits:i}=this.props,n=this.state.model;n.setUniforms(e),n.setUniforms({sizeUnits:ms[i],radiusPixels:r}),n.draw(this.context.renderPass)}_getModel(){let e=[];for(let r=0;r<3;r++){let i=r/3*Math.PI*2;e.push(Math.cos(i)*2,Math.sin(i)*2,0)}return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-list",attributes:{positions:new Float32Array(e)}}),isInstanced:!0})}},Hm=jE;(()=>{jE.layerName="PointCloudLayer"})(),(()=>{jE.defaultProps=yde})();var sH=`#version 300 es
#define SHADER_NAME scatterplot-layer-vertex-shader
in vec3 positions;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in float instanceRadius;
in float instanceLineWidths;
in vec4 instanceFillColors;
in vec4 instanceLineColors;
in vec3 instancePickingColors;
uniform float opacity;
uniform float radiusScale;
uniform float radiusMinPixels;
uniform float radiusMaxPixels;
uniform float lineWidthScale;
uniform float lineWidthMinPixels;
uniform float lineWidthMaxPixels;
uniform float stroked;
uniform bool filled;
uniform bool antialiasing;
uniform bool billboard;
uniform int radiusUnits;
uniform int lineWidthUnits;
out vec4 vFillColor;
out vec4 vLineColor;
out vec2 unitPosition;
out float innerUnitRadius;
out float outerRadiusPixels;
void main(void) {
geometry.worldPosition = instancePositions;
outerRadiusPixels = clamp(
project_size_to_pixel(radiusScale * instanceRadius, radiusUnits),
radiusMinPixels, radiusMaxPixels
);
float lineWidthPixels = clamp(
project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),
lineWidthMinPixels, lineWidthMaxPixels
);
outerRadiusPixels += stroked * lineWidthPixels / 2.0;
float edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;
unitPosition = edgePadding * positions.xy;
geometry.uv = unitPosition;
geometry.pickingColor = instancePickingColors;
innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;
if (billboard) {
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
vec3 offset = edgePadding * positions * outerRadiusPixels;
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
} else {
vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
}
vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);
DECKGL_FILTER_COLOR(vFillColor, geometry);
vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);
DECKGL_FILTER_COLOR(vLineColor, geometry);
}
`;var aH=`#version 300 es
#define SHADER_NAME scatterplot-layer-fragment-shader
precision highp float;
uniform bool filled;
uniform float stroked;
uniform bool antialiasing;
in vec4 vFillColor;
in vec4 vLineColor;
in vec2 unitPosition;
in float innerUnitRadius;
in float outerRadiusPixels;
out vec4 fragColor;
void main(void) {
geometry.uv = unitPosition;
float distToCenter = length(unitPosition) * outerRadiusPixels;
float inCircle = antialiasing ?
smoothedge(distToCenter, outerRadiusPixels) :
step(distToCenter, outerRadiusPixels);
if (inCircle == 0.0) {
discard;
}
if (stroked > 0.5) {
float isLine = antialiasing ?
smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :
step(innerUnitRadius * outerRadiusPixels, distToCenter);
if (filled) {
fragColor = mix(vFillColor, vLineColor, isLine);
} else {
if (isLine == 0.0) {
discard;
}
fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);
}
} else if (!filled) {
discard;
} else {
fragColor = vFillColor;
}
fragColor.a *= inCircle;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var lH=[0,0,0,255],xde={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:t=>t.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:lH},getLineColor:{type:"accessor",value:lH},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}},GE=class extends On{getShaders(){return super.getShaders({vs:sH,fs:aH,modules:[Jn,go]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{radiusUnits:r,radiusScale:i,radiusMinPixels:n,radiusMaxPixels:o,stroked:s,filled:l,billboard:u,antialiasing:h,lineWidthUnits:v,lineWidthScale:T,lineWidthMinPixels:E,lineWidthMaxPixels:M}=this.props,O=this.state.model;O.setUniforms(e),O.setUniforms({stroked:s?1:0,filled:l,billboard:u,antialiasing:h,radiusUnits:ms[r],radiusScale:i,radiusMinPixels:n,radiusMaxPixels:o,lineWidthUnits:ms[v],lineWidthScale:T,lineWidthMinPixels:E,lineWidthMaxPixels:M}),O.draw(this.context.renderPass)}_getModel(){let e=[-1,-1,0,1,-1,0,-1,1,0,1,1,0];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}},jm=GE;(()=>{GE.defaultProps=xde})(),(()=>{GE.layerName="ScatterplotLayer"})();var __={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function Gm(t,e,r={}){return cH(t,r)!==e?(bde(t,r),!0):!1}function cH(t,e={}){return Math.sign(qp(t,e))}var F1={x:0,y:1,z:2};function qp(t,e={}){let{start:r=0,end:i=t.length,plane:n="xy"}=e,o=e.size||2,s=0,l=F1[n[0]],u=F1[n[1]];for(let h=r,v=i-o;h<i;h+=o)s+=(t[h+l]-t[v+l])*(t[h+u]+t[v+u]),v=h;return s/2}function bde(t,e){let{start:r=0,end:i=t.length,size:n=2}=e,o=(i-r)/n,s=Math.floor(o/2);for(let l=0;l<s;++l){let u=r+l*n,h=r+(o-1-l)*n;for(let v=0;v<n;++v){let T=t[u+v];t[u+v]=t[h+v],t[h+v]=T}}}function DO(t,e,r=2,i,n="xy"){let o=e&&e.length,s=o?e[0]*r:t.length,l=fH(t,0,s,r,!0,i&&i[0],n),u=[];if(!l||l.next===l.prev)return u;let h,v,T,E,M,O,F;if(o&&(l=Mde(t,e,l,r,i,n)),t.length>80*r){E=v=t[0],M=T=t[1];for(let z=r;z<s;z+=r)O=t[z],F=t[z+1],O<E&&(E=O),F<M&&(M=F),O>v&&(v=O),F>T&&(T=F);h=Math.max(v-E,T-M),h=h!==0?32767/h:0}return N1(l,u,r,E,M,h,0),u}function fH(t,e,r,i,n,o,s){let l,u;o===void 0&&(o=qp(t,{start:e,end:r,size:i,plane:s}));let h=F1[s[0]],v=F1[s[1]];if(n===o<0)for(l=e;l<r;l+=i)u=uH(l,t[l+h],t[l+v],u);else for(l=r-i;l>=e;l-=i)u=uH(l,t[l+h],t[l+v],u);return u&&XE(u,u.next)&&(U1(u),u=u.next),u}function Wm(t,e){if(!t)return t;e||(e=t);let r=t,i;do if(i=!1,!r.steiner&&(XE(r,r.next)||Fs(r.prev,r,r.next)===0)){if(U1(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function N1(t,e,r,i,n,o,s){if(!t)return;!s&&o&&Ode(t,i,n,o);let l=t,u,h;for(;t.prev!==t.next;){if(u=t.prev,h=t.next,o?Ede(t,i,n,o):Tde(t)){e.push(u.i/r|0),e.push(t.i/r|0),e.push(h.i/r|0),U1(t),t=h.next,l=h.next;continue}if(t
#define SHADER_NAME column-layer-vertex-shader
in vec3 positions;
in vec3 normals;
in vec3 instancePositions;
in float instanceElevations;
in vec3 instancePositions64Low;
in vec4 instanceFillColors;
in vec4 instanceLineColors;
in float instanceStrokeWidths;
in vec3 instancePickingColors;
uniform float opacity;
uniform float radius;
uniform float angle;
uniform vec2 offset;
uniform bool extruded;
uniform bool stroked;
uniform bool isStroke;
uniform float coverage;
uniform float elevationScale;
uniform float edgeDistance;
uniform float widthScale;
uniform float widthMinPixels;
uniform float widthMaxPixels;
uniform int radiusUnits;
uniform int widthUnits;
out vec4 vColor;
#ifdef FLAT_SHADING
out vec3 cameraPosition;
out vec4 position_commonspace;
#endif
void main(void) {
geometry.worldPosition = instancePositions;
vec4 color = isStroke ? instanceLineColors : instanceFillColors;
mat2 rotationMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));
float elevation = 0.0;
float strokeOffsetRatio = 1.0;
if (extruded) {
elevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;
} else if (stroked) {
float widthPixels = clamp(
project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),
widthMinPixels, widthMaxPixels) / 2.0;
float halfOffset = project_pixel_size(widthPixels) / project_size(edgeDistance * coverage * radius);
if (isStroke) {
strokeOffsetRatio -= sign(positions.z) * halfOffset;
} else {
strokeOffsetRatio -= halfOffset;
}
}
float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
float dotRadius = radius * coverage * shouldRender;
geometry.pickingColor = instancePickingColors;
vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);
vec3 centroidPosition64Low = instancePositions64Low;
vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius;
if (radiusUnits == UNIT_METERS) {
offset = project_size(offset);
}
vec3 pos = vec3(offset, 0.);
DECKGL_FILTER_SIZE(pos, geometry);
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
if (extruded && !isStroke) {
#ifdef FLAT_SHADING
cameraPosition = project.cameraPosition;
position_commonspace = geometry.position;
vColor = vec4(color.rgb, color.a * opacity);
#else
vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
vColor = vec4(lightColor, color.a * opacity);
#endif
} else {
vColor = vec4(color.rgb, color.a * opacity);
}
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var vH=`#version 300 es
#define SHADER_NAME column-layer-fragment-shader
precision highp float;
uniform bool extruded;
uniform bool isStroke;
out vec4 fragColor;
in vec4 vColor;
#ifdef FLAT_SHADING
in vec3 cameraPosition;
in vec4 position_commonspace;
#endif
void main(void) {
fragColor = vColor;
geometry.uv = vec2(0.);
#ifdef FLAT_SHADING
if (extruded && !isStroke && !bool(picking.isActive)) {
vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal);
}
#endif
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var ZE=[0,0,0,255],Xde={diskResolution:{type:"number",min:4,value:20},vertices:null,radius:{type:"number",min:0,value:1e3},angle:{type:"number",value:0},offset:{type:"array",value:[0,0]},coverage:{type:"number",min:0,max:1,value:1},elevationScale:{type:"number",min:0,value:1},radiusUnits:"meters",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,flatShading:!1,getPosition:{type:"accessor",value:t=>t.position},getFillColor:{type:"accessor",value:ZE},getLineColor:{type:"accessor",value:ZE},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}},JE=class extends On{getShaders(){let e={},{flatShading:r}=this.props;return r&&(e.FLAT_SHADING=1),super.getShaders({vs:yH,fs:vH,defines:e,modules:[Jn,r?kp:Fu,go]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:ZE},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:ZE},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(e){super.updateState(e);let{props:r,oldProps:i,changeFlags:n}=e,o=n.extensionsChanged||r.flatShading!==i.flatShading;o&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());let s=this.getNumInstances();this.state.fillModel.setInstanceCount(s),this.state.wireframeModel.setInstanceCount(s),(o||r.diskResolution!==i.diskResolution||r.vertices!==i.vertices||(r.extruded||r.stroked)!==(i.extruded||i.stroked))&&this._updateGeometry(r)}getGeometry(e,r,i){let n=new W1({radius:1,height:i?2:0,vertices:r,nradial:e}),o=0;if(r)for(let s=0;s<e;s++){let l=r[s],u=Math.sqrt(l[0]*l[0]+l[1]*l[1]);o+=u/e}else o=1;return this.setState({edgeDistance:Math.cos(Math.PI/e)*o}),n}_getModels(){let e=this.getShaders(),r=this.getAttributeManager().getBufferLayouts(),i=new Ni(this.context.device,{...e,id:`${this.props.id}-fill`,bufferLayout:r,isInstanced:!0}),n=new Ni(this.context.device,{...e,id:`${this.props.id}-wireframe`,bufferLayout:r,isInstanced:!0});return{fillModel:i,wireframeModel:n,models:[n,i]}}_updateGeometry({diskResolution:e,vertices:r,extruded:i,stroked:n}){let o=this.getGeometry(e,r,i||n);this.setState({fillVertexCount:o.attributes.POSITION.value.length/3});let s=this.state.fillModel,l=this.state.wireframeModel;s.setGeometry(o),s.setTopology("triangle-strip"),s.setIndexBuffer(null),l.setGeometry(o),l.setTopology("line-list")}draw({uniforms:e}){let{lineWidthUnits:r,lineWidthScale:i,lineWidthMinPixels:n,lineWidthMaxPixels:o,radiusUnits:s,elevationScale:l,extruded:u,filled:h,stroked:v,wireframe:T,offset:E,coverage:M,radius:O,angle:F}=this.props,z=this.state.fillModel,W=this.state.wireframeModel,{fillVertexCount:J,edgeDistance:K}=this.state,ne={...e,radius:O,angle:F/180*Math.PI,offset:E,extruded:u,stroked:v,coverage:M,elevationScale:l,edgeDistance:K,radiusUnits:ms[s],widthUnits:ms[r],widthScale:i,widthMinPixels:n,widthMaxPixels:o};u&&T&&(W.setUniforms(ne),W.setUniforms({isStroke:!0}),W.draw(this.context.renderPass)),z.setUniforms(ne),h&&(z.setVertexCount(J),z.setUniforms({isStroke:!1}),z.draw(this.context.renderPass)),!u&&v&&(z.setVertexCount(J*2/3),z.setUniforms({isStroke:!0}),z.draw(this.context.renderPass))}},If=JE;(()=>{JE.layerName="ColumnLayer"})(),(()=>{JE.defaultProps=Xde})();var Yde={cellSize:{type:"number",min:0,value:1e3},offset:{type:"array",value:[1,1]}},QE=class extends If{_updateGeometry(){let e=new xd;this.state.fillModel.setGeometry(e)}draw({uniforms:e}){let{elevationScale:r,extruded:i,offset:n,coverage:o,cellSize:s,angle:l,radiusUnits:u}=this.props,h=this.state.fillModel;h.setUniforms(e),h.setUniforms({radius:s
#define SHADER_NAME path-layer-vertex-shader
in vec2 positions;
in float instanceTypes;
in vec3 instanceStartPositions;
in vec3 instanceEndPositions;
in vec3 instanceLeftPositions;
in vec3 instanceRightPositions;
in vec3 instanceLeftPositions64Low;
in vec3 instanceStartPositions64Low;
in vec3 instanceEndPositions64Low;
in vec3 instanceRightPositions64Low;
in float instanceStrokeWidths;
in vec4 instanceColors;
in vec3 instancePickingColors;
uniform float widthScale;
uniform float widthMinPixels;
uniform float widthMaxPixels;
uniform float jointType;
uniform float capType;
uniform float miterLimit;
uniform bool billboard;
uniform int widthUnits;
uniform float opacity;
out vec4 vColor;
out vec2 vCornerOffset;
out float vMiterLength;
out vec2 vPathPosition;
out float vPathLength;
out float vJointType;
const float EPSILON = 0.001;
const vec3 ZERO_OFFSET = vec3(0.0);
float flipIfTrue(bool flag) {
return -(float(flag) * 2. - 1.);
}
vec3 getLineJoinOffset(
vec3 prevPoint, vec3 currPoint, vec3 nextPoint,
vec2 width
) {
bool isEnd = positions.x > 0.0;
float sideOfPath = positions.y;
float isJoint = float(sideOfPath == 0.0);
vec3 deltaA3 = (currPoint - prevPoint);
vec3 deltaB3 = (nextPoint - currPoint);
mat3 rotationMatrix;
bool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix);
if (needsRotation) {
deltaA3 = deltaA3 * rotationMatrix;
deltaB3 = deltaB3 * rotationMatrix;
}
vec2 deltaA = deltaA3.xy / width;
vec2 deltaB = deltaB3.xy / width;
float lenA = length(deltaA);
float lenB = length(deltaB);
vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);
vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);
vec2 perpA = vec2(-dirA.y, dirA.x);
vec2 perpB = vec2(-dirB.y, dirB.x);
vec2 tangent = dirA + dirB;
tangent = length(tangent) > 0. ? normalize(tangent) : perpA;
vec2 miterVec = vec2(-tangent.y, tangent.x);
vec2 dir = isEnd ? dirA : dirB;
vec2 perp = isEnd ? perpA : perpB;
float L = isEnd ? lenA : lenB;
float sinHalfA = abs(dot(miterVec, perp));
float cosHalfA = abs(dot(dirA, miterVec));
float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);
float cornerPosition = sideOfPath * turnDirection;
float miterSize = 1.0 / max(sinHalfA, EPSILON);
miterSize = mix(
min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),
miterSize,
step(0.0, cornerPosition)
);
vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))
* (sideOfPath + isJoint * turnDirection);
bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));
bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));
bool isCap = isStartCap || isEndCap;
if (isCap) {
offsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint);
vJointType = capType;
} else {
vJointType = jointType;
}
vPathLength = L;
vCornerOffset = offsetVec;
vMiterLength = dot(vCornerOffset, miterVec * turnDirection);
vMiterLength = isCap ? isJoint : vMiterLength;
vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);
vPathPosition = vec2(
dot(offsetFromStartOfPath, perp),
dot(offsetFromStartOfPath, dir)
);
geometry.uv = vPathPosition;
float isValid = step(instanceTypes, 3.5);
vec3 offset = vec3(offsetVec * width * isValid, 0.0);
if (needsRotation) {
offset = rotationMatrix * offset;
}
return offset;
}
void clipLine(inout vec4 position, vec4 refPosition) {
if (position.w < EPSILON) {
float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);
position = refPosition + (position - refPosition) * r;
}
}
void main() {
geometry.pickingColor = instancePickingColors;
vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);
float isEnd = positions.x;
vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);
vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);
vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);
vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);
vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);
vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);
geometry.worldPosition = currPosition;
vec2 widthPixels = vec2(clamp(
project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),
widthMinPixels, widthMaxPixels) / 2.0);
vec3 width;
if (billboard) {
vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);
vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);
vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);
clipLine(prevPositionScreen, currPositionScreen);
clipLine(nextPositionScreen, currPositionScreen);
clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));
width = vec3(widthPixels, 0.0);
DECKGL_FILTER_SIZE(width, geometry);
vec3 offset = getLineJoinOffset(
prevPositionScreen.xyz / prevPositionScreen.w,
currPositionScreen.xyz / currPositionScreen.w,
nextPositionScreen.xyz / nextPositionScreen.w,
project_pixel_size_to_clipspace(width.xy)
);
DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);
gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);
} else {
prevPosition = project_position(prevPosition, prevPosition64Low);
currPosition = project_position(currPosition, currPosition64Low);
nextPosition = project_position(nextPosition, nextPosition64Low);
width = vec3(project_pixel_size(widthPixels), 0.0);
DECKGL_FILTER_SIZE(width, geometry);
vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);
geometry.position = vec4(currPosition + offset, 1.0);
gl_Position = project_common_position_to_clipspace(geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
}
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var TH=`#version 300 es
#define SHADER_NAME path-layer-fragment-shader
precision highp float;
uniform float miterLimit;
in vec4 vColor;
in vec2 vCornerOffset;
in float vMiterLength;
in vec2 vPathPosition;
in float vPathLength;
in float vJointType;
out vec4 fragColor;
void main(void) {
geometry.uv = vPathPosition;
if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {
if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {
discard;
}
if (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) {
discard;
}
}
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var EH=[0,0,0,255],Jde={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:EH},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},kO={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},$E=class extends On{getShaders(){return super.getShaders({vs:wH,fs:TH,modules:[Jn,go]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){this.getAttributeManager().addInstanced({vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:kO,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:kO,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:kO,defaultValue:EH},instancePickingColors:{size:4,type:"uint8",accessor:(i,{index:n,target:o})=>this.encodePickingColor(i&&i.__source?i.__source.index:n,o)}}),this.setState({pathTesselator:new q1({fp64:this.use64bitPositions()})})}updateState(e){super.updateState(e);let{props:r,changeFlags:i}=e,n=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:s}=this.state,l=r.data.attributes||{};s.updateGeometry({data:r.data,geometryBuffer:l.getPath,buffers:l,normalize:!r._pathType,loop:r._pathType==="loop",getGeometry:r.getPath,positionFormat:r.positionFormat,wrapLongitude:r.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:s.instanceCount,startIndices:s.vertexStarts}),i.dataChanged||n.invalidateAll()}i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll())}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(o=>o.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{jointRounded:r,capRounded:i,billboard:n,miterLimit:o,widthUnits:s,widthScale:l,widthMinPixels:u,widthMaxPixels:h}=this.props,v=this.state.model;v.setUniforms(e),v.setUniforms({jointType:Number(r),capType:Number(i),billboard:n,widthUnits:ms[s],widthScale:l,miterLimit:o,widthMinPixels:u,widthMaxPixels:h}),v.draw(this.context.renderPass)}_getModel(){let e=[0,1,2,1,4,2,1,3,4,3,5,4],r=[0,0,0,-1,0,1,1,-1,1,1,1,0];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-list",attributes:{indices:new Uint16Array(e),positions:{value:new Float32Array(r),size:2}}}),isInstanced:!0})}calculatePositions(e){let{pathTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("positions")}calculateSegmentTypes(e){let{pathTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("segmentTypes")}},Pf=$E;(()=>{$E.defaultProps=Jde})(),(()=>{$E.layerName="PathLayer"})();var LH=ga(PH(),1);var nS=__.CLOCKWISE,RH=__.COUNTER_CLOCKWISE,Yp={isClosed:!0};function dpe(t){if(t=t&&t.positions||t,!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error("invalid polygon")}function x_(t){return"positions"in t?t.positions:t}function Z1(t){return"holeIndices"in t?t.holeIndices:null}function ppe(t){return Array.isArray(t[0])}function Ape(t){return t.length>=1&&t[0].length>=2&&Number.
uniform bool isWireframe;
uniform float elevationScale;
uniform float opacity;
in vec4 fillColors;
in vec4 lineColors;
in vec3 pickingColors;
out vec4 vColor;
struct PolygonProps {
vec3 positions;
vec3 positions64Low;
vec3 normal;
float elevations;
};
vec3 project_offset_normal(vec3 vector) {
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {
return normalize(vector * project.commonUnitsPerWorldUnit);
}
return project_normal(vector);
}
void calculatePosition(PolygonProps props) {
vec3 pos = props.positions;
vec3 pos64Low = props.positions64Low;
vec3 normal = props.normal;
vec4 colors = isWireframe ? lineColors : fillColors;
geometry.worldPosition = props.positions;
geometry.pickingColor = pickingColors;
if (extruded) {
pos.z += props.elevations * elevationScale;
}
gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
if (extruded) {
#ifdef IS_SIDE_VERTEX
normal = project_offset_normal(normal);
#else
normal = project_normal(normal);
#endif
geometry.normal = normal;
vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
vColor = vec4(lightColor, colors.a * opacity);
} else {
vColor = vec4(colors.rgb, colors.a * opacity);
}
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var UH=`#version 300 es
#define SHADER_NAME solid-polygon-layer-vertex-shader
in vec3 vertexPositions;
in vec3 vertexPositions64Low;
in float elevations;
${sS}
void main(void) {
PolygonProps props;
props.positions = vertexPositions;
props.positions64Low = vertexPositions64Low;
props.elevations = elevations;
props.normal = vec3(0.0, 0.0, 1.0);
calculatePosition(props);
}
`;var zH=`#version 300 es
#define SHADER_NAME solid-polygon-layer-vertex-shader-side
#define IS_SIDE_VERTEX
in vec2 positions;
in vec3 vertexPositions;
in vec3 nextVertexPositions;
in vec3 vertexPositions64Low;
in vec3 nextVertexPositions64Low;
in float elevations;
in float instanceVertexValid;
${sS}
void main(void) {
if(instanceVertexValid < 0.5){
gl_Position = vec4(0.);
return;
}
PolygonProps props;
vec3 pos;
vec3 pos64Low;
vec3 nextPos;
vec3 nextPos64Low;
#if RING_WINDING_ORDER_CW == 1
pos = vertexPositions;
pos64Low = vertexPositions64Low;
nextPos = nextVertexPositions;
nextPos64Low = nextVertexPositions64Low;
#else
pos = nextVertexPositions;
pos64Low = nextVertexPositions64Low;
nextPos = vertexPositions;
nextPos64Low = vertexPositions64Low;
#endif
props.positions = mix(pos, nextPos, positions.x);
props.positions64Low = mix(pos64Low, nextPos64Low, positions.x);
props.normal = vec3(
pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y),
nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x),
0.0);
props.elevations = elevations * positions.y;
calculatePosition(props);
}
`;var VH=`#version 300 es
#define SHADER_NAME solid-polygon-layer-fragment-shader
precision highp float;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
fragColor = vColor;
geometry.uv = vec2(0.);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var lS=[0,0,0,255],_pe={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:lS},getLineColor:{type:"accessor",value:lS},material:!0},aS={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},cS=class extends On{getShaders(e){return super.getShaders({vs:e==="top"?UH:zH,fs:VH,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[Jn,Fu,go]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{viewport:e}=this.context,{coordinateSystem:r}=this.props,{_full3d:i}=this.props;e.isGeospatial&&r===Zr.DEFAULT&&(r=Zr.LNGLAT);let n;r===Zr.LNGLAT&&(i?n=e.projectPosition.bind(e):n=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new J1({preproject:n,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let o=this.getAttributeManager(),s=!0;o.remove(["instancePickingColors"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:s},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:aS,accessor:"getPolygon",update:this.calculatePositions,noAlloc:s,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:s},elevations:{size:1,stepMode:"dynamic",transition:aS,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:aS,accessor:"getFillColor",defaultValue:lS},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:aS,accessor:"getLineColor",defaultValue:lS},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(l,{index:u,target:h})=>this.encodePickingColor(l&&l.__source?l.__source.index:u,h)}})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(o=>o.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:r,filled:i,wireframe:n,elevationScale:o}=this.props,{topModel:s,sideModel:l,wireframeModel:u,polygonTesselator:h}=this.state,v={...e,extruded:Boolean(r),elevationScale:o};u&&n&&(u.setInstanceCount(h.instanceCount-1),u.setUniforms(v),u.draw(this.context.renderPass)),l&&i&&(l.setInstanceCount(h.instanceCount-1),l.setUniforms(v),l.draw(this.context.renderPass)),s&&i&&(s.setVertexCount(h.vertexCount),s.setUniforms(v),s.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:r,oldProps:i,changeFlags:n}=e,o=this.getAttributeManager();(n.extensionsChanged||r.filled!==i.filled||r.extruded!==i.extruded)&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),o.invalidateAll())}updateGeometry({props:e,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:o}=this.state,s=e.data.attributes||{};o.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:s.getPolygon,buffers:s,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:e._full3d}),this.setState({numInstances:o.instanceCount,startIndices:o.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:e,filled:r,extruded:i}=this.props,n,o,s;if(r){let l=this.getShaders("top");l.defines.NON_INSTANCED_MODEL=1;let u=this.getAttributeManager().getBufferLayouts({isInstanced:!1});n=new Ni(this.context.device,{...l,id:`${e}-top`,topology:"triangle-list",uniforms:{isWireframe:!1},bufferLayout:u,isIn
#define SHADER_NAME multi-icon-layer-fragment-shader
precision highp float;
uniform float opacity;
uniform sampler2D iconsTexture;
uniform float gamma;
uniform bool sdf;
uniform float alphaCutoff;
uniform float sdfBuffer;
uniform float outlineBuffer;
uniform vec4 outlineColor;
in vec4 vColor;
in vec2 vTextureCoords;
in vec2 uv;
out vec4 fragColor;
void main(void) {
geometry.uv = uv;
if (!bool(picking.isActive)) {
float alpha = texture(iconsTexture, vTextureCoords).a;
vec4 color = vColor;
if (sdf) {
float distance = alpha;
alpha = smoothstep(sdfBuffer - gamma, sdfBuffer + gamma, distance);
if (outlineBuffer > 0.0) {
float inFill = alpha;
float inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance);
color = mix(outlineColor, vColor, inFill);
alpha = inBorder;
}
}
float a = alpha * color.a;
if (a < alphaCutoff) {
discard;
}
fragColor = vec4(color.rgb, a * opacity);
}
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var GO=192/256,qH=[],bpe={getIconOffsets:{type:"accessor",value:t=>t.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}},hS=class extends Od{getShaders(){return{...super.getShaders(),fs:WH}}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:"getIconOffsets"},instancePickingColors:{type:"uint8",size:3,accessor:(r,{index:i,target:n})=>this.encodePickingColor(i,n)}})}updateState(e){super.updateState(e);let{props:r,oldProps:i}=e,{outlineColor:n}=r;n!==i.outlineColor&&(n=n.map(o=>o/255),n[3]=Number.isFinite(n[3])?n[3]:1,this.setState({outlineColor:n})),!r.sdf&&r.outlineWidth&&ur.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(e){let{sdf:r,smoothing:i,outlineWidth:n}=this.props,{outlineColor:o}=this.state,s=n?Math.max(i,GO*(1-n)):-1;if(e.uniforms={...e.uniforms,sdfBuffer:GO,outlineBuffer:s,gamma:i,sdf:Boolean(r),outlineColor:o},super.draw(e),r&&n){let{iconManager:l}=this.state,u=l.getTexture(),h=this.state.model;u&&(h.setUniforms({outlineBuffer:GO}),h.draw(this.context.renderPass))}}getInstanceOffset(e){return e?Array.from(e).flatMap(r=>super.getInstanceOffset(r)):qH}getInstanceColorMode(e){return 1}getInstanceIconFrame(e){return e?Array.from(e).flatMap(r=>super.getInstanceIconFrame(r)):qH}},Ym=hS;(()=>{hS.defaultProps=bpe})(),(()=>{hS.layerName="MultiIconLayer"})();var Q1=class{constructor({fontSize:e=24,buffer:r=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:l="normal"}={}){this.buffer=r,this.cutoff=n,this.radius=i;let u=this.size=e+r*4,h=this._createCanvas(u),v=this.ctx=h.getContext("2d",{willReadFrequently:!0});v.font=`${l} ${s} ${e}px ${o}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(e){let r=document.createElement("canvas");return r.width=r.height=e,r}draw(e){let{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(e),l=Math.ceil(i),u=0,h=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-o))),v=Math.min(this.size-this.buffer,l+Math.ceil(n)),T=h+2*this.buffer,E=v+2*this.buffer,M=Math.max(T*E,0),O=new Uint8ClampedArray(M),F={data:O,width:T,height:E,glyphWidth:h,glyphHeight:v,glyphTop:l,glyphLeft:u,glyphAdvance:r};if(h===0||v===0)return F;let{ctx:z,buffer:W,gridInner:J,gridOuter:K}=this;z.clearRect(W,W,h,v),z.fillText(e,W,W+l);let ne=z.getImageData(W,W,h,v);K.fill(1e20,0,M),J.fill(0,0,M);for(let ge=0;ge<v;ge++)for(let j=0;j<h;j++){let me=ne.data[4*(ge*h+j)+3]/255;if(me===0)continue;let fe=(ge+W)*T+j+W;if(me===1)K[fe]=0,J[fe]=1e20;else{let $=.5-me;K[fe]=$>0?$*$:0,J[fe]=$<0?$*$:0}}XH(K,0,0,T,E,T,this.f,this.v,this.z),XH(J,W,W,h,v,T,this.f,this.v,this.z);for(let ge=0;ge<M;ge++){let j=Math.sqrt(K[ge])-Math.sqrt(J[ge]);O[ge]=Math.round(255-255*(j/this.radius+this.cutoff))}return F}};function XH(t,e,r,i,n,o,s,l,u){for(let h=e;h<e+i;h++)YH(t,r*o+h,o,n,s,l,u);for(let h=r;h<r+n;h++)YH(t,h*o+e,1,i,s,l,u)}function YH(t,e,r,i,n,o,s){o[0]=0,s[0]=-1e20,s[1]=1e20,n[0]=t[e];for(let l=1,u=0,h=0;l<i;l++){n[l]=t[e+l*r];let v=l*l;do{let T=o[u];h=(n[l]-n[T]+v-T*T)/(l-T)/2}while(h<=s[u]&&--u>-1);u++,o[u]=l,s[u]=h,s[u+1]=1e20}for(let l=0,u=0;l<i;l++){for(;s[u+1]<l;)u++;let h=o[u],v=l-h;t[e+l*r]=n[h]+v*v}}var wpe=32,Tpe=[];function Epe(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function KH({characterSet:t,getFontWidth:e,fontHeight:r,buffer:i,maxCanvasWidth:n,mapping:o={},xOffset:s=0,yOffset:l=0}){let u=0,h=s,v=r+i*2;for(let T of t)if(!o[T]){let E=e(T);h+E+i*2>n&&(h=0,u++),o[T]={x:h+i,y:l+u*v+i,width:E,height:v,layoutWidth:E,layoutHeight:r},h+=E+i*2}return{mapping:o,xOffset:h,yOffset:l+u*v,canvasHeight:Epe(l+(u+1)*v)}}function ZH(t,e,r,i){let n=0;for(let o=e;o<r;o++){let s=t[o];n+=i[s]?.layoutWidth||0}return n}function JH(t,e,r,i,n,o){let s=e,l=0;for(let u=e;u<r;u++){let h=ZH(t,u,u+1,n);l+h>i&&(s<u
`||z===s)&&(F=z),F>O){let J=v?Cpe(o,r,i,n,O,F):Tpe;for(let K=0;K<=J.length;K++){let ne=K===0?O:J[K-1],ge=K<J.length?J[K]:F;Mpe(o,ne,ge,n,l,E);for(let j=ne;j<ge;j++){let me=o[j],fe=n[me]?.layoutOffsetY||0;u[j]=M+E[1]/2+fe,h[j]=E[0]}M=M+E[1]*e,T[0]=Math.max(T[0],E[0])}O=F}W===`
`&&(l[O]=0,u[O]=0,h[O]=0,O++)}return T[1]=M,{x:l,y:u,rowWidth:h,size:T}}function $H({value:t,length:e,stride:r,offset:i,startIndices:n,characterSet:o}){let s=t.BYTES_PER_ELEMENT,l=r?r/s:1,u=i?i/s:0,h=n[e]||Math.ceil((t.length-u)/l),v=o&&new Set,T=new Array(e),E=t;if(l>1||u>0){let M=t.constructor;E=new M(h);for(let O=0;O<h;O++)E[O]=t[O*l+u]}for(let M=0;M<e;M++){let O=n[M],F=n[M+1]||h,z=E.subarray(O,F);T[M]=String.fromCodePoint.apply(null,z),v&&z.forEach(v.add,v)}if(v)for(let M of v)o.add(String.fromCodePoint(M));return{texts:T,characterCount:h}}var b_=class{constructor(e=5){this._cache={},this._order=[],this.limit=e}get(e){let r=this._cache[e];return r&&(this._deleteOrder(e),this._appendOrder(e)),r}set(e,r){this._cache[e]?(this.delete(e),this._cache[e]=r,this._appendOrder(e)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[e]=r,this._appendOrder(e))}delete(e){this._cache[e]&&(delete this._cache[e],this._deleteOrder(e))}_deleteOrder(e){let r=this._order.indexOf(e);r>=0&&this._order.splice(r,1)}_appendOrder(e){this._order.push(e)}};function Ipe(){let t=[];for(let e=32;e<128;e++)t.push(String.fromCharCode(e));return t}var Km={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:Ipe(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},ej=1024,tj=.9,rj=1.2,nj=3,dS=new b_(nj);function Ppe(t,e){let r;typeof e=="string"?r=new Set(Array.from(e)):r=new Set(e);let i=dS.get(t);if(!i)return r;for(let n in i.mapping)r.has(n)&&r.delete(n);return r}function Rpe(t,e){for(let r=0;r<t.length;r++)e.data[4*r+3]=t[r]}function ij(t,e,r,i){t.font=`${i} ${r}px ${e}`,t.fillStyle="#000",t.textBaseline="alphabetic",t.textAlign="left"}function oj(t){ur.assert(Number.isFinite(t)&&t>=nj,"Invalid cache limit"),dS=new b_(t)}var $1=class{constructor(){this.props={...Km}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){let{fontSize:e,buffer:r}=this.props;return(e*rj+r*2)/e}setProps(e={}){Object.assign(this.props,e),this._key=this._getKey();let r=Ppe(this._key,this.props.characterSet),i=dS.get(this._key);if(i&&r.size===0){this._atlas!==i&&(this._atlas=i);return}let n=this._generateFontAtlas(r,i);this._atlas=n,dS.set(this._key,n)}_generateFontAtlas(e,r){let{fontFamily:i,fontWeight:n,fontSize:o,buffer:s,sdf:l,radius:u,cutoff:h}=this.props,v=r&&r.data;v||(v=document.createElement("canvas"),v.width=ej);let T=v.getContext("2d",{willReadFrequently:!0});ij(T,i,o,n);let{mapping:E,canvasHeight:M,xOffset:O,yOffset:F}=KH({getFontWidth:z=>T.measureText(z).width,fontHeight:o*rj,buffer:s,characterSet:e,maxCanvasWidth:ej,...r&&{mapping:r.mapping,xOffset:r.xOffset,yOffset:r.yOffset}});if(v.height!==M){let z=T.getImageData(0,0,v.width,v.height);v.height=M,T.putImageData(z,0,0)}if(ij(T,i,o,n),l){let z=new Q1({fontSize:o,buffer:s,radius:u,cutoff:h,fontFamily:i,fontWeight:`${n}`});for(let W of e){let{data:J,width:K,height:ne,glyphTop:ge}=z.draw(W);E[W].width=K,E[W].layoutOffsetY=o*tj-ge;let j=T.createImageData(K,ne);Rpe(J,j),T.putImageData(j,E[W].x,E[W].y)}}else for(let z of e)T.fillText(z,E[z].x,E[z].y+s+o*tj);return{xOffset:O,yOffset:F,mapping:E,data:v,width:v.width,height:v.height}}_getKey(){let{fontFamily:e,fontWeight:r,fontSize:i,buffer:n,sdf:o,radius:s,cutoff:l}=this.props;return o?`${e} ${r} ${i} ${n} ${s} ${l}`:`${e} ${r} ${i} ${n}`}};var sj=`#version 300 es
#define SHADER_NAME text-background-layer-vertex-shader
in vec2 positions;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in vec4 instanceRects;
in float instanceSizes;
in float instanceAngles;
in vec2 instancePixelOffsets;
in float instanceLineWidths;
in vec4 instanceFillColors;
in vec4 instanceLineColors;
in vec3 instancePickingColors;
uniform bool billboard;
uniform float opacity;
uniform float sizeScale;
uniform float sizeMinPixels;
uniform float sizeMaxPixels;
uniform vec4 padding;
uniform int sizeUnits;
out vec4 vFillColor;
out vec4 vLineColor;
out float vLineWidth;
out vec2 uv;
out vec2 dimensions;
vec2 rotate_by_angle(vec2 vertex, float angle) {
float angle_radian = radians(angle);
float cos_angle = cos(angle_radian);
float sin_angle = sin(angle_radian);
mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
return rotationMatrix * vertex;
}
void main(void) {
geometry.worldPosition = instancePositions;
geometry.uv = positions;
geometry.pickingColor = instancePickingColors;
uv = positions;
vLineWidth = instanceLineWidths;
float sizePixels = clamp(
project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),
sizeMinPixels, sizeMaxPixels
);
dimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw;
vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions);
pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);
pixelOffset += instancePixelOffsets;
pixelOffset.y *= -1.0;
if (billboard) {
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
vec3 offset = vec3(pixelOffset, 0.0);
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
} else {
vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
DECKGL_FILTER_SIZE(offset_common, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
}
vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);
DECKGL_FILTER_COLOR(vFillColor, geometry);
vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);
DECKGL_FILTER_COLOR(vLineColor, geometry);
}
`;var aj=`#version 300 es
#define SHADER_NAME text-background-layer-fragment-shader
precision highp float;
uniform bool stroked;
in vec4 vFillColor;
in vec4 vLineColor;
in float vLineWidth;
in vec2 uv;
in vec2 dimensions;
out vec4 fragColor;
void main(void) {
geometry.uv = uv;
vec2 pixelPosition = uv * dimensions;
if (stroked) {
float distToEdge = min(
min(pixelPosition.x, dimensions.x - pixelPosition.x),
min(pixelPosition.y, dimensions.y - pixelPosition.y)
);
float isBorder = smoothedge(distToEdge, vLineWidth);
fragColor = mix(vFillColor, vLineColor, isBorder);
} else {
fragColor = vFillColor;
}
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var Bpe={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}},pS=class extends On{getShaders(){return super.getShaders({vs:sj,fs:aj,modules:[Jn,go]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e);let{changeFlags:r}=e;r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{billboard:r,sizeScale:i,sizeUnits:n,sizeMinPixels:o,sizeMaxPixels:s,getLineWidth:l}=this.props,{padding:u}=this.props;u.length<4&&(u=[u[0],u[1],u[0],u[1]]);let h=this.state.model;h.setUniforms(e),h.setUniforms({billboard:r,stroked:Boolean(l),padding:u,sizeUnits:ms[n],sizeScale:i,sizeMinPixels:o,sizeMaxPixels:s}),h.draw(this.context.renderPass)}_getModel(){let e=[0,0,1,0,0,1,1,1];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}},Zm=pS;(()=>{pS.defaultProps=Bpe})(),(()=>{pS.layerName="TextBackgroundLayer"})();var lj={start:1,middle:0,end:-1},cj={top:1,center:0,bottom:-1},WO=[0,0,0,255],Ope=1,Dpe={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:WO},getBorderWidth:{type:"accessor",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:Km.characterSet},fontFamily:Km.fontFamily,fontWeight:Km.fontWeight,lineHeight:Ope,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:WO},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:WO},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}},AS=class extends es{constructor(){super(...arguments),this.getBoundingRect=(e,r)=>{let{size:[i,n]}=this.transformParagraph(e,r),{fontSize:o}=this.state.fontAtlasManager.props;i/=o,n/=o;let{getTextAnchor:s,getAlignmentBaseline:l}=this.props,u=lj[typeof s=="function"?s(e,r):s],h=cj[typeof l=="function"?l(e,r):l];return[(u-1)*i/2,(h-1)*n/2,i,n]},this.getIconOffsets=(e,r)=>{let{getTextAnchor:i,getAlignmentBaseline:n}=this.props,{x:o,y:s,rowWidth:l,size:[u,h]}=this.transformParagraph(e,r),v=lj[typeof i=="function"?i(e,r):i],T=cj[typeof n=="function"?n(e,r):n],E=o.length,M=new Array(E*2),O=0;for(let F=0;F<E;F++){let z=(1-v)*(u-l[F])/2;M[O++]=(v-1)*u/2+z+o[F],M[O++]=(T-1)*h/2+s[F]}return M}}initializeState(){this.state={styleVersion:0,fontAtlasMan
#define SHADER_NAME gpu-aggregation-to-grid-vs
in vec3 positions;
in vec3 positions64Low;
in vec3 weights;
uniform vec2 cellSize;
uniform vec2 gridSize;
uniform bool projectPoints;
uniform vec2 translation;
uniform vec3 scaling;
out vec3 vWeights;
vec2 project_to_pixel(vec4 pos) {
vec4 result;
pos.xy = pos.xy/pos.w;
result = pos + vec4(translation, 0., 0.);
result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
return result.xy;
}
void main(void) {
vWeights = weights;
vec4 windowPos = vec4(positions, 1.);
if (projectPoints) {
windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
}
vec2 pos = project_to_pixel(windowPos);
vec2 pixelXY64[2];
pixelXY64[0] = vec2(pos.x, 0.);
pixelXY64[1] = vec2(pos.y, 0.);
vec2 gridXY64[2];
gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
float x = floor(gridXY64[0].x);
float y = floor(gridXY64[1].x);
pos = vec2(x, y);
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
vec2 offset = 1.0 / gridSize;
pos = pos + offset;
gl_Position = vec4(pos, 0.0, 1.0);
gl_PointSize = 1.0;
}
`;var bj=`#version 300 es
#define SHADER_NAME gpu-aggregation-to-grid-fs
precision highp float;
in vec3 vWeights;
out vec4 fragColor;
void main(void) {
fragColor = vec4(vWeights, 1.0);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var wj=`#version 300 es
#define SHADER_NAME gpu-aggregation-all-vs-64
in vec2 position;
uniform ivec2 gridSize;
out vec2 vTextureCoord;
void main(void) {
vec2 pos = vec2(-1.0, -1.0);
vec2 offset = 1.0 / vec2(gridSize);
pos = pos + offset;
gl_Position = vec4(pos, 0.0, 1.0);
int yIndex = gl_InstanceID / gridSize[0];
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
vec2 yIndexFP64 = vec2(float(yIndex), 0.);
vec2 xIndexFP64 = vec2(float(xIndex), 0.);
vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
gl_PointSize = 1.0;
}
`;var Tj=`#version 300 es
#define SHADER_NAME gpu-aggregation-all-fs
precision highp float;
in vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform bool combineMaxMin;
out vec4 fragColor;
void main(void) {
vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
if (textureColor.a == 0.) {
discard;
}
fragColor.rgb = textureColor.rgb;
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
}
`;var Ej=`#version 300 es
#define SHADER_NAME gpu-aggregation-transform-mean-vs
in vec4 aggregationValues;
out vec4 meanValues;
void main()
{
bool isCellValid = bool(aggregationValues.w > 0.);
meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
meanValues.w = aggregationValues.w;
gl_PointSize = 1.0;
}
`;var qpe={minFilter:"nearest",magFilter:"nearest"};function E_(t,e){let{width:r=1,height:i=1,data:n=null,sampler:o=qpe}=e;return t.createTexture({data:n,format:"rgba32float",mipmaps:!1,sampler:o,width:r,height:i})}function rb(t,e){let{id:r,width:i=1,height:n=1,texture:o}=e;return t.createFramebuffer({id:r,width:i,height:n,colorAttachments:[o]})}var Xpe=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],Sj={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},Ype=["float32-renderable-webgl","texture-blend-float-webgl"],Fa=class{static getAggregationData({aggregationData:e,maxData:r,minData:i,maxMinData:n,pixelIndex:o}){let s=o*vj,l={};return e&&(l.cellCount=e[s+3],l.cellWeight=e[s]),n?(l.maxCellWieght=n[0],l.minCellWeight=n[3]):(r&&(l.maxCellWieght=r[0],l.totalCount=r[3]),i&&(l.minCellWeight=i[0],l.totalCount=i[3])),l}static getCellData({countsData:e,size:r=1}){let i=e.length/4,n=new Float32Array(i*r),o=new Uint32Array(i);for(let s=0;s<i;s++){for(let l=0;l<r;l++)n[s*r+l]=e[s*4+l];o[s]=e[s*4+3]}return{cellCounts:o,cellWeights:n}}static isSupported(e){return Ype.every(r=>e.features.has(r))}constructor(e,r={}){this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=r.id||"gpu-grid-aggregator",this.device=e;let i=["float32-renderable-webgl"];this._hasGPUSupport=i.every(n=>e.features.has(n)),this._hasGPUSupport&&this._setupModels()}delete(){let{gridAggregationModel:e,allAggregationModel:r,meanTransform:i}=this,{textures:n,framebuffers:o,maxMinFramebuffers:s,minFramebuffers:l,maxFramebuffers:u,meanTextures:h,resources:v}=this.state;e?.destroy(),r?.destroy(),i?.destroy(),Zpe([o,n,s,l,u,h,v])}run(e={}){this.setState({results:{}});let r=this._normalizeAggregationParams(e);return this._runAggregation(r)}getData(e){let r={},i=this.state.results;i[e].aggregationData||(i[e].aggregationData=i[e].aggregationBuffer.getData()),r.aggregationData=i[e].aggregationData;for(let n in Sj){let o=Sj[n];(i[e][n]||i[e][o])&&(i[e][n]=i[e][n]||i[e][o].getData(),r[n]=i[e][n])}return r}updateShaders(e={}){this.setState({shaderOptions:e,modelDirty:!0})}_normalizeAggregationParams(e){let r={...gj,...e},{weights:i}=r;return i&&(r.weights=Kpe(i)),r}setState(e){Object.assign(this.state,e)}_getAggregateData(e){let r={},{textures:i,framebuffers:n,maxMinFramebuffers:o,minFramebuffers:s,maxFramebuffers:l,resources:u}=this.state,{weights:h}=e;for(let v in h){r[v]={};let{needMin:T,needMax:E,combineMaxMin:M}=h[v];r[v].aggregationTexture=i[v],r[v].aggregationBuffer=this.device.readPixelsToBufferWebGL(n[v],{target:h[v].aggregationBuffer,sourceType:5126}),T&&E&&M?(r[v].maxMinBuffer=this.device.readPixelsToBufferWebGL(o[v],{target:h[v].maxMinBuffer,sourceType:5126}),r[v].maxMinTexture=u[`${v}-maxMinTexture`]):(T&&(r[v].minBuffer=this.device.readPixelsToBufferWebGL(s[v],{target:h[v].minBuffer,sourceType:5126}),r[v].minTexture=u[`${v}-minTexture`]),E&&(r[v].maxBuffer=this.device.readPixelsToBufferWebGL(l[v],{target:h[v].maxBuffer,sourceType:5126}),r[v].maxTexture=u[`${v}-maxTexture`]))}return this._trackGPUResultBuffers(r,h),r}_renderAggregateData(e){let{cellSize:r,projectPoints:i,attributes:n,moduleSettings:o,numCol:s,numRow:l,weights:u,translation:h,scaling:v}=e,{maxMinFramebuffers:T,minFramebuffers:E,maxFramebuffers:M}=this.state,O=[s,l],F={blend:!0,depthTest:!1,blendFunc:[1,1]},z={cellSize:r,gridSize:O,projectPoints:i,translation:h,scaling:v};for(let W in u){let{needMin:J,needMax:K}=u[W],ne=J&&K&&u[W].combineMaxMin;this._renderToWeightsTexture({id:W,parameters:F,moduleSettings:o,uniforms:z,gridSize:O,attributes:n,weights:u}),ne?this._renderToMaxMinTexture({id:W,parameters:{...F,blendEquation:_j},gridSize:O,minOrMaxFb:T[W],clearParams:{clearColor:[0,0,0,Kp]},combineMaxMin:ne}):(J&&this._renderToMaxMinTexture({id:W,parameters:{...F,blendEquation:XO},gridSize:O,minOrMaxFb:E[W],clearParams:{clearColor:[Kp,Kp,Kp,0]},combineMaxMin:ne}),K&&this._renderToMaxMinTexture({id:W,parameters
#define SHADER_NAME screen-grid-layer-vertex-shader
#define RANGE_COUNT 6
in vec3 positions;
in vec3 instancePositions;
in vec4 instanceCounts;
in vec3 instancePickingColors;
uniform float opacity;
uniform vec3 cellScale;
uniform vec4 minColor;
uniform vec4 maxColor;
uniform vec4 colorRange[RANGE_COUNT];
uniform vec2 colorDomain;
uniform bool shouldUseMinMax;
uniform sampler2D maxTexture;
out vec4 vColor;
out float vSampleCount;
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
vec4 outColor = vec4(0., 0., 0., 0.);
if (value >= domain.x && value <= domain.y) {
float domainRange = domain.y - domain.x;
if (domainRange <= 0.) {
outColor = colorRange[0];
} else {
float rangeCount = float(RANGE_COUNT);
float rangeStep = domainRange / rangeCount;
float idx = floor((value - domain.x) / rangeStep);
idx = clamp(idx, 0., rangeCount - 1.);
int intIdx = int(idx);
outColor = colorRange[intIdx];
}
}
outColor = outColor / 255.;
return outColor;
}
void main(void) {
vSampleCount = instanceCounts.a;
float weight = instanceCounts.r;
float maxWeight = texture(maxTexture, vec2(0.5)).r;
float step = weight / maxWeight;
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
vec2 domain = colorDomain;
float domainMaxValid = float(colorDomain.y != 0.);
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
float rangeMinMax = float(shouldUseMinMax);
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
vColor = vec4(color.rgb, color.a * opacity);
picking_setPickingColor(instancePickingColors);
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
}
`;var Mj=`#version 300 es
#define SHADER_NAME screen-grid-layer-fragment-shader
precision highp float;
in vec4 vColor;
in float vSampleCount;
out vec4 fragColor;
void main(void) {
if (vSampleCount <= 0.0) {
discard;
}
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var eAe=[0,0,0,0],tAe=[0,255,0,255],rAe=["minColor","maxColor","colorRange","colorDomain"],iAe={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ju},vS=class extends On{getShaders(){return{vs:Cj,fs:Mj,modules:[Jn,go]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e);let{oldProps:r,props:i,changeFlags:n}=e,o=this.getAttributeManager();i.numInstances!==r.numInstances?o.invalidateAll():r.cellSizePixels!==i.cellSizePixels&&o.invalidate("instancePositions"),this._updateUniforms(r,i,n)}draw({uniforms:e}){let{parameters:r,maxTexture:i}=this.props,n=this.props.minColor||eAe,o=this.props.maxColor||tAe,s=this.props.colorDomain||[1,0],l=this.state.model;l.setUniforms(e),l.setBindings({maxTexture:i}),l.setUniforms({minColor:n,maxColor:o,colorDomain:s}),l.setParameters({depthWriteEnabled:!1,...r}),l.draw(this.context.renderPass)}calculateInstancePositions(e,{numInstances:r}){let{width:i,height:n}=this.context.viewport,{cellSizePixels:o}=this.props,s=Math.ceil(i/o),{value:l,size:u}=e;for(let h=0;h<r;h++){let v=h%s,T=Math.floor(h/s);l[h*u+0]=v*o/i*2-1,l[h*u+1]=1-T*o/n*2,l[h*u+2]=0}}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}}),isInstanced:!0})}_shouldUseMinMax(){let{minColor:e,maxColor:r,colorDomain:i,colorRange:n}=this.props;return e||r?(ur.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(i||n)}_updateUniforms(e,r,i){let n=this.state.model;if(rAe.some(o=>e[o]!==r[o])&&n.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),e.colorRange!==r.colorRange&&n.setUniforms({colorRange:Zp(r.colorRange)}),e.cellMarginPixels!==r.cellMarginPixels||e.cellSizePixels!==r.cellSizePixels||i.viewportChanged){let{width:o,height:s}=this.context.viewport,{cellSizePixels:l,cellMarginPixels:u}=this.props,h=l>u?u:0,v=new Float32Array([(l-h)/o*2,-(l-h)/s*2,1]);n.setUniforms({cellScale:v})}}},S_=vS;(()=>{vS.layerName="ScreenGridCellLayer"})(),(()=>{vS.defaultProps=iAe})();function Ij(t,e){let r={};for(let i in t)e.includes(i)||(r[i]=t[i]);return r}var ZO=class extends es{initializeAggregationLayer(e){super.initializeState(this.context),this.setState({ignoreProps:Ij(this.constructor._propTypes,e.data.props),dimensions:e})}updateState(e){super.updateState(e);let{changeFlags:r}=e;if(r.extensionsChanged){let i=this.getShaders({});i&&i.defines&&(i.defines.NON_INSTANCED_MODEL=1),this.updateShaders(i)}this._updateAttributes()}updateAttributes(e){this.setState({changedAttributes:e})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:e,mousePosition:r,device:i}=this.context;return Object.assign(Object.create(this.props),{viewport:e,mousePosition:r,picking:{isActive:0},devicePixelRatio:i.canvasContext.cssToDeviceRatio()})}updateShaders(e){}isAggregationDirty(e,r={}){let{props:i,oldProps:n,changeFlags:o}=e,{compareAll:s=!1,dimension:l}=r,{ignoreProps:u}=this.state,{props:h,accessors:v=[]}=l,{updateTriggersChanged:T}=o;if(o.dataChanged)return!0;if(T){if(T.all)return!0;for(let E of v)if(T[E])return!0}if(s)return o.extensionsChanged?!0:m_({oldProps:n,newProps:i,ignoreProps:u,propTypes:this.constructor._propTypes});for(let E of h)if(i[E]!==n[E])return!0;return!1}isAttributeChanged(e){let{changedAttributes:r}=this.state;return e?r&&r[e]!==void 0:!nAe(r)}_getAttributeManager(){return new Mf(this.context.device,{id:this.props.id,stats:this.context.stats})}},$c=ZO;(()=>{ZO.layerName="AggregationLayer"})();function nAe(t){let e=!0;for(let r in t){e=!1;break}return e}function xS(t,e,r){let i=r;return i.domain=()=>t,i.range=()=>e,i}function Pj(t,e)
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
#define RANGE_COUNT 6
in vec3 positions;
in vec3 normals;
in vec4 colors;
in vec4 elevations;
in vec3 instancePickingColors;
uniform vec2 offset;
uniform bool extruded;
uniform float cellSize;
uniform float coverage;
uniform float opacity;
uniform float elevationScale;
uniform ivec2 gridSize;
uniform vec2 gridOrigin;
uniform vec2 gridOriginLow;
uniform vec2 gridOffset;
uniform vec2 gridOffsetLow;
uniform vec4 colorRange[RANGE_COUNT];
uniform vec2 elevationRange;
uniform vec2 colorDomain;
uniform bool colorDomainValid;
uniform vec2 elevationDomain;
uniform bool elevationDomainValid;
layout(std140) uniform;
uniform ColorData
{
vec4 maxMinCount;
} colorData;
uniform ElevationData
{
vec4 maxMinCount;
} elevationData;
#define EPSILON 0.00001
out vec4 vColor;
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
vec4 outColor = vec4(0., 0., 0., 0.);
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
float domainRange = domain.y - domain.x;
if (domainRange <= 0.) {
outColor = colorRange[0];
} else {
float rangeCount = float(RANGE_COUNT);
float rangeStep = domainRange / rangeCount;
float idx = floor((value - domain.x) / rangeStep);
idx = clamp(idx, 0., rangeCount - 1.);
int intIdx = int(idx);
outColor = colorRange[intIdx];
}
}
return outColor;
}
float linearScale(vec2 domain, vec2 range, float value) {
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
}
return -1.;
}
void main(void) {
vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
float elevation = 0.0;
if (extruded) {
vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
elevation = linearScale(elvDomain, elevationRange, elevations.r);
elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
}
float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
float dotRadius = cellSize / 2. * coverage * shouldRender;
int yIndex = (gl_InstanceID / gridSize[0]);
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
geometry.worldPosition = centroidPosition;
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
picking_setPickingColor(instancePickingColors);
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
vec3 normals_commonspace = project_normal(normals);
if (extruded) {
vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, normals_commonspace);
vColor = vec4(lightColor, color.a * opacity) / 255.;
} else {
vColor = vec4(color.rgb, color.a * opacity) / 255.;
}
}
`;var C7=`#version 300 es
#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
precision highp float;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
fragColor = vColor;
fragColor = picking_filterColor(fragColor);
}
`;var tD=0,rD=1,zAe={colorDomain:null,colorRange:ju,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",value:[1,1]},gridOrigin:{type:"array",value:[0,0]},gridOffset:{type:"array",value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},OS=class extends On{getShaders(){return super.getShaders({vs:S7,fs:C7,modules:[Jn,Fu,go,Dp]})}initializeState(){this.getAttributeManager().addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});let r=this._getModel();this._setupUniformBuffer(r),this.setState({model:r})}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,geometry:new xd,isInstanced:!0})}draw({uniforms:e}){let{cellSize:r,offset:i,extruded:n,elevationScale:o,coverage:s,gridSize:l,gridOrigin:u,gridOffset:h,elevationRange:v,colorMaxMinBuffer:T,elevationMaxMinBuffer:E}=this.props,M=this.state.model,O=[Vp(u[0]),Vp(u[1])],F=[Vp(h[0]),Vp(h[1])],z=this.getDomainUniforms(),W=Zp(this.props.colorRange);this.bindUniformBuffers(T,E),M.setUniforms(e),M.setUniforms(z),M.setUniforms({cellSize:r,offset:i,extruded:n,elevationScale:o,coverage:s,gridSize:l,gridOrigin:u,gridOriginLow:O,gridOffset:h,gridOffsetLow:F,colorRange:W,elevationRange:v}),M.draw(this.context.renderPass),this.unbindUniformBuffers(T,E)}bindUniformBuffers(e,r){e.bind({target:35345,index:tD}),r.bind({target:35345,index:rD})}unbindUniformBuffers(e,r){e.unbind({target:35345,index:tD}),r.unbind({target:35345,index:rD})}getDomainUniforms(){let{colorDomain:e,elevationDomain:r}=this.props,i={};return e!==null?(i.colorDomainValid=!0,i.colorDomain=e):i.colorDomainValid=!1,r!==null?(i.elevationDomainValid=!0,i.elevationDomain=r):i.elevationDomainValid=!1,i}_setupUniformBuffer(e){let r=e.pipeline.handle,i=this.context.gl,n=i.getUniformBlockIndex(r,"ColorData"),o=i.getUniformBlockIndex(r,"ElevationData");i.uniformBlockBinding(r,n,tD),i.uniformBlockBinding(r,o,rD)}},ab=OS;(()=>{OS.layerName="GPUGridCellLayer"})(),(()=>{OS.defaultProps=zAe})();var VAe={colorDomain:null,colorRange:ju,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:t=>t.position},extruded:!1,material:!0},HAe={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},M7="positions",DS=class extends Ld{initializeState({device:e}){let r=Fa.isSupported(e);r||ur.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),super.initializeAggregationLayer({dimensions:HAe}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:r,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:e.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:e.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"}),this.getAttributeManager().add({[M7]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},color:{size:3,accessor:"getColorWeight"},elevation:{size:3,accessor:"getElevationWeight"}})}updateState(e){if(this.state.isSupported===!1)return;super.updateState(e);let{aggregationDirty:r}=this.state;r&&this.setState({gridHash:null})}getHashKeyForIndex(e){let{numRow:r,numCol:i,boundingBox:n,gridOffset:o}=this.state,s=[i,r],l=[n.xMin,n.yMin],u=[o.xOffset,o.yOffset],h=Math.floor(e/s[0]),v=e-h*s[0],T=Math.floor((h*u[1]+l[1]+90+u[1]/2)/u[1]),E=Math.floor((v*u[0]+l[0]+180+u[0]/2)/u[0]);return`${T}-${E}`}getPositionForIndex(e){let{numRow:r,numCol:i,boundingBox:n,gridOffset:o}=this.state,s=[i,r],l=[n.xMin,n.yMin],u=[o.xOffset,o.yOffset],h=Math.floor(e/s[0]),v=e-h*s[0],T=h*u[1]+l[1];return[v*u[0]+l[0],T]}getPickingInfo({info:e,mode:r}){let
#define SHADER_NAME heatp-map-layer-vertex-shader
uniform sampler2D maxTexture;
uniform float intensity;
uniform vec2 colorDomain;
uniform float threshold;
uniform float aggregationMode;
in vec3 positions;
in vec2 texCoords;
out vec2 vTexCoords;
out float vIntensityMin;
out float vIntensityMax;
void main(void) {
gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
vTexCoords = texCoords;
vec4 maxTexture = texture(maxTexture, vec2(0.5));
float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
float minValue = maxValue * threshold;
if (colorDomain[1] > 0.) {
maxValue = colorDomain[1];
minValue = colorDomain[0];
}
vIntensityMax = intensity / maxValue;
vIntensityMin = intensity / minValue;
}
`;var L7=`#version 300 es
#define SHADER_NAME triangle-layer-fragment-shader
precision highp float;
uniform float opacity;
uniform sampler2D weightsTexture;
uniform sampler2D colorTexture;
uniform float aggregationMode;
in vec2 vTexCoords;
in float vIntensityMin;
in float vIntensityMax;
out vec4 fragColor;
vec4 getLinearColor(float value) {
float factor = clamp(value * vIntensityMax, 0., 1.);
vec4 color = texture(colorTexture, vec2(factor, 0.5));
color.a *= min(value * vIntensityMin, 1.0);
return color;
}
void main(void) {
vec4 weights = texture(weightsTexture, vTexCoords);
float weight = weights.r;
if (aggregationMode > 0.5) {
weight /= max(1.0, weights.a);
}
if (weight <= 0.) {
discard;
}
vec4 linearColor = getLinearColor(weight);
linearColor.a *= opacity;
fragColor = linearColor;
}
`;var nD=class extends On{getShaders(){return{vs:D7,fs:L7,modules:[Jn]}}initializeState({device:e}){this.setState({model:this._getModel(e)})}_getModel(e){let{vertexCount:r,data:i,weightsTexture:n,maxTexture:o,colorTexture:s}=this.props;return new Ni(e,{...this.getShaders(),id:this.props.id,bindings:{weightsTexture:n,maxTexture:o,colorTexture:s},attributes:i.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-strip",vertexCount:r})}draw({uniforms:e}){let{model:r}=this.state,{intensity:i,threshold:n,aggregationMode:o,colorDomain:s}=this.props;r.setUniforms({...e,intensity:i,threshold:n,aggregationMode:o,colorDomain:s}),r.draw(this.context.renderPass)}},cb=nD;(()=>{nD.layerName="TriangleLayer"})();var oD=`#version 300 es
in vec3 positions;
in vec3 positions64Low;
in float weights;
out vec4 weightsTexture;
uniform float radiusPixels;
uniform float textureWidth;
uniform vec4 commonBounds;
uniform float weightsScale;
void main()
{
weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
gl_PointSize = radiusTexels * 2.;
vec3 commonPosition = project_position(positions, positions64Low);
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
gl_Position.w = 1.0;
}
`;var sD=`#version 300 es
in vec4 weightsTexture;
out vec4 fragColor;
float gaussianKDE(float u){
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
}
void main()
{
float dist = length(gl_PointCoord - vec2(0.5, 0.5));
if (dist > 0.5) {
discard;
}
fragColor = weightsTexture * gaussianKDE(2. * dist);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var F7=`#version 300 es
uniform sampler2D inTexture;
uniform float textureSize;
out vec4 outTexture;
void main()
{
int yIndex = gl_VertexID / int(textureSize);
int xIndex = gl_VertexID - (yIndex * int(textureSize));
vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
outTexture = texture(inTexture, uv);
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
gl_PointSize = 1.0;
}
`;var N7=`#version 300 es
in vec4 outTexture;
out vec4 fragColor;
void main() {
fragColor = outTexture;
fragColor.g = outTexture.r / max(1.0, outTexture.a);
}
`;var GAe=2,aD={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},k7=[0,0],WAe={SUM:0,MEAN:1},qAe={getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ju,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},XAe=["float32-renderable-webgl","texture-blend-float-webgl"],YAe={data:{props:["radiusPixels"]}},FS=class extends $c{initializeState(){super.initializeAggregationLayer(YAe),this.setState({colorDomain:k7}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:r,oldProps:i}=e,n=this._getChangeFlags(e);(n.dataChanged||n.viewportChanged)&&(n.boundsChanged=this._updateBounds(n.dataChanged),this._updateTextureRenderingBounds()),n.dataChanged||n.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):n.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:n,colorTexture:o,colorDomain:s}=this.state,{updateTriggers:l,intensity:u,threshold:h,aggregation:v}=this.props,T=this.getSubLayerClass("triangle",cb);return new T(this.getSubLayerProps({id:"triangle-layer",updateTriggers:l}),{coordinateSystem:Zr.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:n,colorTexture:o,aggregationMode:WAe[v]||0,weightsTexture:e,intensity:u,threshold:h,colorDomain:s})}finalizeState(e){super.finalizeState(e);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:n,maxWeightsTexture:o,triPositionBuffer:s,triTexCoordBuffer:l,colorTexture:u,updateTimer:h}=this.state;r?.destroy(),i?.destroy(),n?.destroy(),o?.destroy(),s?.destroy(),l?.destroy(),u?.destroy(),h&&clearTimeout(h)}_getAttributeManager(){return new Mf(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",r.viewportChanged=e.changeFlags.viewportChanged;let{zoom:n}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==n)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{textureSize:e,format:r}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...aD,width:e,height:e,format:r}),maxWeightsTexture:this.context.device.createTexture({...aD,width:1,height:1,format:r})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,e.limits.maxTextureDimension2D),n=XAe.every(l=>e.features.has(l)),o=n?"rgba32float":"rgba8unorm",s=n?1:1/255;this.setState({textureSize:i,format:o,weightsScale:s}),n||ur.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:r}=this.state,{weightsTexture:i}=this.state,n=this.getAttributeManager();r?.destroy(),r=new Mh(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:n.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-li
in float instanceTimestamps;
in float instanceNextTimestamps;
out float vTime;
`,"vs:#main-end":`vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength;
`,"fs:#decl":`uniform bool fadeTrail;
uniform float trailLength;
uniform float currentTime;
in float vTime;
`,"fs:#main-start":`if(vTime > currentTime || (fadeTrail && (vTime < currentTime - trailLength))) {
discard;
}
`,"fs:DECKGL_FILTER_COLOR":`if(fadeTrail) {
color.a *= 1.0 - (currentTime - vTime) / trailLength;
}
`},e}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(e){let{fadeTrail:r,trailLength:i,currentTime:n}=this.props;e.uniforms={...e.uniforms,fadeTrail:r,trailLength:i,currentTime:n},super.draw(e)}},wb=eC;(()=>{eC.layerName="TripsLayer"})(),(()=>{eC.defaultProps=m0e})();var uo=function(t){t=t||{};var e=typeof t<"u"?t:{},r={},i;for(i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);var n=[],o="";function s(ut){return e.locateFile?e.locateFile(ut,o):o+ut}var l;typeof document<"u"&&document.currentScript&&(o=document.currentScript.src),o.indexOf("blob:")!==0?o=o.substr(0,o.lastIndexOf("/")+1):o="",l=function(St,cr,Xr){var g=new XMLHttpRequest;g.open("GET",St,!0),g.responseType="arraybuffer",g.onload=function(){if(g.status==200||g.status==0&&g.response){cr(g.response);return}var Wr=de(St);if(Wr){cr(Wr.buffer);return}Xr()},g.onerror=Xr,g.send(null)};var u=e.print||console.log.bind(console),h=e.printErr||console.warn.bind(console);for(i in r)r.hasOwnProperty(i)&&(e[i]=r[i]);r=null,e.arguments&&(n=e.arguments);var v=0,T=function(ut){v=ut},E=function(){return v},M=8;function O(ut,St,cr,Xr){switch(cr=cr||"i8",cr.charAt(cr.length-1)==="*"&&(cr="i32"),cr){case"i1":Le[ut>>0]=St;break;case"i8":Le[ut>>0]=St;break;case"i16":Vt[ut>>1]=St;break;case"i32":mr[ut>>2]=St;break;case"i64":To=[St>>>0,(Dn=St,+Hi(Dn)>=1?Dn>0?(Ji(+No(Dn/4294967296),4294967295)|0)>>>0:~~+Un((Dn-+(~~Dn>>>0))/4294967296)>>>0:0)],mr[ut>>2]=To[0],mr[ut+4>>2]=To[1];break;case"float":Jr[ut>>2]=St;break;case"double":or[ut>>3]=St;break;default:mi("invalid type for setValue: "+cr)}}function F(ut,St,cr){switch(St=St||"i8",St.charAt(St.length-1)==="*"&&(St="i32"),St){case"i1":return Le[ut>>0];case"i8":return Le[ut>>0];case"i16":return Vt[ut>>1];case"i32":return mr[ut>>2];case"i64":return mr[ut>>2];case"float":return Jr[ut>>2];case"double":return or[ut>>3];default:mi("invalid type for getValue: "+St)}return null}var z=!1;function W(ut,St){ut||mi("Assertion failed: "+St)}function J(ut){var St=e["_"+ut];return W(St,"Cannot call unknown function "+ut+", make sure it is exported"),St}function K(ut,St,cr,Xr,g){var ki={string:function($n){var ji=0;if($n!=null&&$n!==0){var Gi=($n.length<<2)+1;ji=ce(Gi),$($n,ji,Gi)}return ji},array:function($n){var ji=ce($n.length);return we($n,ji),ji}};function Wr($n){return St==="string"?me($n):St==="boolean"?Boolean($n):$n}var Re=J(ut),Ti=[],An=0;if(Xr)for(var Qn=0;Qn<Xr.length;Qn++){var En=ki[cr[Qn]];En?(An===0&&(An=Qe()),Ti[Qn]=En(Xr[Qn])):Ti[Qn]=Xr[Qn]}var ln=Re.apply(null,Ti);return ln=Wr(ln),An!==0&&_e(An),ln}function ne(ut,St,cr,Xr){cr=cr||[];var g=cr.every(function(Wr){return Wr==="number"}),ki=St!=="string";return ki&&g&&!Xr?J(ut):function(){return K(ut,St,cr,arguments,Xr)}}var ge=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function j(ut,St,cr){for(var Xr=St+cr,g=St;ut[g]&&!(g>=Xr);)++g;if(g-St>16&&ut.subarray&&ge)return ge.decode(ut.subarray(St,g));for(var ki="";St<g;){var Wr=ut[St++];if(!(Wr&128)){ki+=String.fromCharCode(Wr);continue}var Re=ut[St++]&63;if((Wr&224)==192){ki+=String.fromCharCode((Wr&31)<<6|Re);continue}var Ti=ut[St++]&63;if((Wr&240)==224?Wr=(Wr&15)<<12|Re<<6|Ti:Wr=(Wr&7)<<18|Re<<12|Ti<<6|ut[St++]&63,Wr<65536)ki+=String.fromCharCode(Wr);else{var An=Wr-65536;ki+=String.fromCharCode(55296|An>>10,56320|An&1023)}}return ki}function me(ut,St){return ut?j(ft,ut,St):""}function fe(ut,St,cr,Xr){if(!(Xr>0))return 0;for(var g=cr,ki=cr+Xr-1,Wr=0;Wr<ut.length;++Wr){var Re=ut.charCodeAt(Wr);if(Re>=55296&&Re<=57343){var Ti=ut.charCodeAt(++Wr);Re=65536+((Re&1023)<<10)|Ti&1023}if(Re<=127){if(cr>=ki)break;St[cr++]=Re}else if(Re<=2047){if(cr+1>=ki)break;St[cr++]=192|Re>>6,St[cr++]=128|Re&63}else if(Re<=65535){if(cr+2>=ki)break;St[cr++]=224|Re>>12,St[cr++]=128|Re>>6&63,St[cr++]=128|Re&63}else{if(cr+3>=ki)break;St[cr++]=240|Re>>18,St[cr++]=128|Re>>12&63,St[cr++]=128|Re>>6&63,St[cr++]=128|Re&63}}return St[cr]=0,cr-g}function $(ut,St,cr){return fe(ut,ft,St,cr)}var Z=typeo
`+e.extraStackTrace()),So(ut)}function ql(ut,St,cr,Xr){mi("Assertion failed: "+me(ut)+", at: "+[St?me(St):"unknown filename",cr,Xr?me(Xr):"unknown function"])}function sl(){return Le.length}function Cl(ut,St,cr){ft.set(ft.subarray(St,St+cr),ut)}function al(ut){return e.___errno_location&&(mr[e.___errno_location()>>2]=ut),ut}function Ms(ut){mi("OOM")}function ca(ut){try{var St=new ArrayBuffer(ut);return St.byteLength!=ut?void 0:(new Int8Array(St).set(Le),zs(St),ai(St),1)}catch{}}function Ml(ut){var St=sl(),cr=16777216,Xr=2147483648-cr;if(ut>Xr)return!1;for(var g=16777216,ki=Math.max(St,g);ki<ut;)ki<=536870912?ki=Oe(2*ki,cr):ki=Math.min(Oe((3*ki+2147483648)/4,cr),Xr);var Wr=ca(ki);return!!Wr}var ao=typeof atob=="function"?atob:function(ut){var St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",cr="",Xr,g,ki,Wr,Re,Ti,An,Qn=0;ut=ut.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Wr=St.indexOf(ut.charAt(Qn++)),Re=St.indexOf(ut.charAt(Qn++)),Ti=St.indexOf(ut.charAt(Qn++)),An=St.indexOf(ut.charAt(Qn++)),Xr=Wr<<2|Re>>4,g=(Re&15)<<4|Ti>>2,ki=(Ti&3)<<6|An,cr=cr+String.fromCharCode(Xr),Ti!==64&&(cr=cr+String.fromCharCode(g)),An!==64&&(cr=cr+String.fromCharCode(ki));while(Qn<ut.length);return cr};function oe(ut){try{for(var St=ao(ut),cr=new Uint8Array(St.length),Xr=0;Xr<St.length;++Xr)cr[Xr]=St.charCodeAt(Xr);return cr}catch{throw new Error("Converting base64 string to bytes failed.")}}function de(ut){if(to(ut))return oe(ut.slice(ci.length))}var ve={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},Pe={a:mi,b:T,c:E,d:ql,e:al,f:sl,g:Cl,h:Ml,i:Ms,j:Xo,k:So,l:ca,m:Us,n:Fc,o:Eo,p:qt},ye=function(ut,St,cr){var Xr=new ut.Int8Array(cr),g=new ut.Int32Array(cr),ki=new ut.Uint8Array(cr),Wr=new ut.Float32Array(cr),Re=new ut.Float64Array(cr),Ti=St.o|0,An=St.p|0,Qn=ut.Math.floor,En=ut.Math.abs,ln=ut.Math.sqrt,$n=ut.Math.pow,ji=ut.Math.cos,Gi=ut.Math.sin,an=ut.Math.tan,ea=ut.Math.acos,Yh=ut.Math.asin,Hs=ut.Math.atan,Ko=ut.Math.atan2,fu=ut.Math.ceil,fl=ut.Math.imul,hu=ut.Math.min,Sn=ut.Math.max,ha=ut.Math.clz32,gi=St.b,Fe=St.c,_i=St.d,Kh=St.e,Vc=St.f,Is=St.g,Kf=St.h,Xl=St.i,Ie=24160;function hl(m){return Xr=new Int8Array(m),ki=new Uint8Array(m),g=new Int32Array(m),Wr=new Float32Array(m),Re=new Float64Array(m),cr=m,!0}function hc(m){m=m|0;var A=0;return A=Ie,Ie=Ie+m|0,Ie=Ie+15&-16,A|0}function Hc(){return Ie|0}function rf(m){m=m|0,Ie=m}function Zf(m,A){m=m|0,A=A|0,Ie=m}function Jf(m,A){m=m|0,A=A|0;var y=0,w=0,C=0;return(m|0)<0?(A=2,A|0):(m|0)>13780509?(A=Ct(15,A)|0,A|0):(y=((m|0)<0)<<31>>31,C=ma(m|0,y|0,3,0)|0,w=Fe()|0,y=bn(m|0,y|0,1,0)|0,y=ma(C|0,w|0,y|0,Fe()|0)|0,y=bn(y|0,Fe()|0,1,0)|0,m=Fe()|0,g[A>>2]=y,g[A+4>>2]=m,A=0,A|0)}function jc(m,A,y,w){return m=m|0,A=A|0,y=y|0,w=w|0,du(m,A,y,w,0)|0}function du(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0;if(X=Ie,Ie=Ie+16|0,L=X,!(Zh(m,A,y,w,C)|0))return w=0,Ie=X,w|0;do if((y|0)>=0){if((y|0)>13780509){if(R=Ct(15,L)|0,R|0)break;N=L,L=g[N>>2]|0,N=g[N+4>>2]|0}else R=((y|0)<0)<<31>>31,te=ma(y|0,R|0,3,0)|0,N=Fe()|0,R=bn(y|0,R|0,1,0)|0,R=ma(te|0,N|0,R|0,Fe()|0)|0,R=bn(R|0,Fe()|0,1,0)|0,N=Fe()|0,g[L>>2]=R,g[L+4>>2]=N,L=R;if(sd(w|0,0,L<<3|0)|0,C|0){sd(C|0,0,L<<2|0)|0,R=za(m,A,y,w,C,L,N,0)|0;break}R=Qo(L,4)|0,R?(te=za(m,A,y,w,R,L,N,0)|0,Mi(R),R=te):R=13}else R=2;while(0);return te=R,Ie=X,te|0}function Zh(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0;if(yt=Ie,Ie=Ie+16|0,nt=yt,Ye=yt+8|0,$e=nt,g[$e>>2]=m,g[$e+4>>2]=A,(y|0)<0)return Ye=2,Ie=yt,Ye|0;if(R=w,g[R>>2]=m,g[R+4>>2]=A,R=(C|0)!=0,R&&(g[C>>2]=0),mn(m,A)|0)return Ye=9,Ie=yt,Ye|0;g[Ye>>2]=0;e:do if((y|0)>=1)if(R)for(pe=1,te=0,De=0,$e=1,R=m;;){if(!(te|De)){if(R=Vo(R,A,4,Ye,nt)|0,R|0)break e;if(A=nt,R=g[A>>2]|0,A=g[A+4>>2]|0,mn(R,A)|0){R=9;break e}}if(R=Vo(R,A,g[22384+(De<<2)>>2]|0,Ye,nt)|0,R|0)break e;if(A=nt,R=g[A>>2]|0,A=g[A+4>>2]|0,m=w+(pe<<3)|0,g[m>>2]=R,g[m+4>>2]=A,g[C+(pe<<2)>>2]=$e,m=te+1|0,L=(m|0)==($e|0),N=De+1|0,X=(N|0)==6,mn(R,A)|0){R=9;break e}if($e=$e+(X&L&1)|0,($e|0)>(y|0)){R=0;break}else pe=pe+1|0,te=L?0:m,De=L?X?0:N:De}else for(pe=1,te=0,De=0,$e=1,R=m;;){
#define SHADER_NAME simple-mesh-layer-vs
uniform float sizeScale;
uniform bool composeModelMatrix;
in vec3 positions;
in vec3 normals;
in vec3 colors;
in vec2 texCoords;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in vec4 instanceColors;
in vec3 instancePickingColors;
in vec3 instanceModelMatrixCol0;
in vec3 instanceModelMatrixCol1;
in vec3 instanceModelMatrixCol2;
in vec3 instanceTranslation;
out vec2 vTexCoord;
out vec3 cameraPosition;
out vec3 normals_commonspace;
out vec4 position_commonspace;
out vec4 vColor;
void main(void) {
geometry.worldPosition = instancePositions;
geometry.uv = texCoords;
geometry.pickingColor = instancePickingColors;
vTexCoord = texCoords;
cameraPosition = project.cameraPosition;
vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
vec3 pos = (instanceModelMatrix * positions) * sizeScale + instanceTranslation;
if (composeModelMatrix) {
DECKGL_FILTER_SIZE(pos, geometry);
normals_commonspace = project_normal(instanceModelMatrix * normals);
geometry.worldPosition += pos;
gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace);
geometry.position = position_commonspace;
}
else {
pos = project_size(pos);
DECKGL_FILTER_SIZE(pos, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace);
geometry.position = position_commonspace;
normals_commonspace = project_normal(instanceModelMatrix * normals);
}
geometry.normal = normals_commonspace;
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var MW=`#version 300 es
#define SHADER_NAME simple-mesh-layer-fs
precision highp float;
uniform bool hasTexture;
uniform sampler2D sampler;
uniform bool flatShading;
uniform float opacity;
in vec2 vTexCoord;
in vec3 cameraPosition;
in vec3 normals_commonspace;
in vec4 position_commonspace;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
geometry.uv = vTexCoord;
vec3 normal;
if (flatShading) {
normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
} else {
normal = normals_commonspace;
}
vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
DECKGL_FILTER_COLOR(color, geometry);
vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
fragColor = vec4(lightColor, color.a * opacity);
}
`;function zD(t){let e=t.positions||t.POSITION;ur.assert(e,'no "postions" or "POSITION" attribute in mesh');let r=e.value.length/e.size,i=t.COLOR_0||t.colors;i||(i={size:3,value:new Float32Array(r*3).fill(1)});let n=t.NORMAL||t.normals;n||(n={size:3,value:new Float32Array(r*3).fill(0)});let o=t.TEXCOORD_0||t.texCoords;return o||(o={size:2,value:new Float32Array(r*2).fill(0)}),{positions:e,colors:i,normals:n,texCoords:o}}function IW(t){return t instanceof Fn?(t.attributes=zD(t.attributes),t):t.attributes?new Fn({...t,topology:"triangle-list",attributes:zD(t.attributes)}):new Fn({topology:"triangle-list",attributes:zD(t)})}var r_e=[0,0,0,255],i_e={mesh:{type:"object",value:null,async:!0},texture:{type:"image",value:null,async:!0},sizeScale:{type:"number",value:1,min:0},_instanced:!0,wireframe:!1,material:!0,getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:r_e},getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},textureParameters:{type:"object",ignore:!0,value:null}},cC=class extends On{getShaders(){return super.getShaders({vs:CW,fs:MW,modules:[Jn,kp,go]})}getBounds(){if(this.props._instanced)return super.getBounds();let e=this.state.positionBounds;if(e)return e;let{mesh:r}=this.props;if(!r)return null;if(e=r.header?.boundingBox,!e){let{attributes:i}=IW(r);i.POSITION=i.POSITION||i.positions,e=pd(i)}return this.state.positionBounds=e,e}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{transition:!0,type:"float64",fp64:this.use64bitPositions(),size:3,accessor:"getPosition"},instanceColors:{type:"unorm8",transition:!0,size:this.props.colorFormat.length,accessor:"getColor",defaultValue:[0,0,0,255]},instanceModelMatrix:aC}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState(e){super.updateState(e);let{props:r,oldProps:i,changeFlags:n}=e;if(r.mesh!==i.mesh||n.extensionsChanged){if(this.state.positionBounds=null,this.state.model?.destroy(),r.mesh){this.state.model=this.getModel(r.mesh);let o=r.mesh.attributes||r.mesh;this.setState({hasNormals:Boolean(o.NORMAL||o.normals)})}this.getAttributeManager().invalidateAll()}r.texture!==i.texture&&r.texture instanceof bo&&this.setTexture(r.texture),this.state.model&&this.state.model.setTopology(this.props.wireframe?"line-strip":"triangle-list")}finalizeState(e){super.finalizeState(e),this.state.emptyTexture.delete()}draw({uniforms:e}){let{model:r}=this.state;if(!r)return;let{viewport:i,renderPass:n}=this.context,{sizeScale:o,coordinateSystem:s,_instanced:l}=this.props;r.setUniforms(e),r.setUniforms({sizeScale:o,composeModelMatrix:!l||lC(i,s),flatShading:!this.state.hasNormals}),r.draw(n)}get isLoaded(){return Boolean(this.state?.model&&super.isLoaded)}getModel(e){let r=new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:IW(e),isInstanced:!0}),{texture:i}=this.props,{emptyTexture:n}=this.state;return r.setBindings({sampler:i||n}),r.setUniforms({hasTexture:Boolean(i)}),r}setTexture(e){let{emptyTexture:r,model:i}=this.state;i&&(i.setBindings({sampler:e||r}),i.setUniforms({hasTexture:Boolean(e)}))}},Nh=cC;(()=>{cC.defaultProps=i_e})(),(()=>{cC.layerName="SimpleMeshLayer"})();var Lf;(function(t){t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.LINEAR=9729]="LINEAR",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(Lf||(Lf={}));function Mb(t,e,r,i){let n={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};n.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:o}=i;return o&&(n.bindings.u_DiffuseEnvSampler=o.diffuseEnvSampler,n.bindings.u_Specula
#pragma vscode_glsllint_stage: vert
#if (__VERSION__ < 300)
#define _attr attribute
#else
#define _attr in
#endif
// _attr vec4 POSITION;
_attr vec4 positions;
#ifdef HAS_NORMALS
// _attr vec4 NORMAL;
_attr vec4 normals;
#endif
#ifdef HAS_TANGENTS
_attr vec4 TANGENT;
#endif
#ifdef HAS_UV
// _attr vec2 TEXCOORD_0;
_attr vec2 texCoords;
#endif
void main(void) {
vec4 _NORMAL = vec4(0.);
vec4 _TANGENT = vec4(0.);
vec2 _TEXCOORD_0 = vec2(0.);
#ifdef HAS_NORMALS
_NORMAL = normals;
#endif
#ifdef HAS_TANGENTS
_TANGENT = TANGENT;
#endif
#ifdef HAS_UV
_TEXCOORD_0 = texCoords;
#endif
pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
gl_Position = u_MVPMatrix * positions;
}
`,T_e=`
#pragma vscode_glsllint_stage: frag
#if (__VERSION__ < 300)
#define fragmentColor gl_FragColor
#else
out vec4 fragmentColor;
#endif
void main(void) {
vec3 pos = pbr_vPosition;
fragmentColor = pbr_filterColor(vec4(1.0));
}
`;function YW(t,e){let{id:r,geometry:i,material:n,vertexCount:o,materialOptions:s,modelOptions:l}=e,u=Mb(t,n,i.attributes,s);Kt.info(4,"createGLTFModel defines: ",u.defines)();let h=[],v={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},T={id:r,geometry:i,topology:i.topology,vertexCount:o,modules:[hm],vs:XW(t,w_e),fs:XW(t,T_e),...l,bindings:{...u.bindings,...l.bindings},defines:{...u.defines,...l.defines},parameters:{...v,...u.parameters,...l.parameters},uniforms:{...u.uniforms,...l.uniforms}},E=new Ni(t,T);return new Ih({managedResources:h,model:E})}function XW(t,e){return`#version 300 es
${e}`}var E_e={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1},pC=class{device;options;gltf;constructor(e,r={}){this.device=e,this.options={...E_e,...r}}instantiate(e){return this.gltf=e,(e.scenes||[]).map(i=>this.createScene(i))}createAnimator(){return Array.isArray(this.gltf.animations)?new dC(this.gltf):null}createScene(e){let i=(e.nodes||[]).map(o=>this.createNode(o));return new Qc({id:e.name||e.id,children:i})}createNode(e){if(!e._node){let i=(e.children||[]).map(o=>this.createNode(o));e.mesh&&i.push(this.createMesh(e.mesh));let n=new Qc({id:e.name||e.id,children:i});if(e.matrix)n.setMatrix(e.matrix);else{if(n.matrix.identity(),e.translation&&n.matrix.translate(e.translation),e.rotation){let o=new Kr().fromQuaternion(e.rotation);n.matrix.multiplyRight(o)}e.scale&&n.matrix.scale(e.scale)}e._node=n}return e._node}createMesh(e){if(!e._mesh){let i=(e.primitives||[]).map((o,s)=>this.createPrimitive(o,s,e)),n=new Qc({id:e.name||e.id,children:i});e._mesh=n}return e._mesh}createPrimitive(e,r,i){let n=e.name||`${i.name||i.id}-primitive-${r}`,o=S_e(e.mode||4),s=e.indices?e.indices.count:this.getVertexCount(e.attributes),l=YW(this.device,{id:n,geometry:this.createGeometry(n,e,o),material:e.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:s});return l.bounds=[e.attributes.POSITION.min,e.attributes.POSITION.max],l}getVertexCount(e){throw new Error("getVertexCount not implemented")}createGeometry(e,r,i){let n={};for(let[o,s]of Object.entries(r.attributes)){let{components:l,size:u,value:h}=s;n[o]={size:u??l,value:h}}return new Fn({id:e,topology:i,indices:r.indices.value,attributes:n})}createBuffer(e,r){e.bufferView||(e.bufferView={});let{bufferView:i}=e;return i.lumaBuffers||(i.lumaBuffers={}),i.lumaBuffers[r]||(i.lumaBuffers[r]=this.device.createBuffer({id:`from-${i.id}`,data:i.data||e.value})),i.lumaBuffers[r]}createSampler(e){return e}needsPOT(){return!1}},zd;(function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(zd||(zd={}));function S_e(t){switch(t){case zd.POINTS:return"point-list";case zd.LINES:return"line-list";case zd.LINE_STRIP:return"line-strip";case zd.LINE_LOOP:return"line-loop-webgl";case zd.TRIANGLES:return"triangle-list";case zd.TRIANGLE_STRIP:return"triangle-strip";case zd.TRIANGLE_FAN:return"triangle-fan-webgl";default:throw new Error(t)}}function KD(t,e,r){let i=new pC(t,r),n=i.instantiate(e),o=i.createAnimator();return{scenes:n,animator:o}}var ZD={};As(ZD,{decode:()=>k_e,name:()=>N_e});function Na(t,e){if(!t)throw new Error(e||"assert failed: gltf")}var AC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},mC={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var C_e=1.33,KW=["SCALAR","VEC2","VEC3","VEC4"],M_e=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],I_e=new Map(M_e),P_e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},R_e={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},B_e={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function gC(t){return KW[t-1]||KW[0]}function G_(t){let e=I_e.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function W_(t,e){let r=B_e[t.componentType],i=P_e[t.type],n=R_e[t.componentType],o=t.count*i,s=t.count*i*n;Na(s>=0&&s<=e.byteLength);let l=mC[t.componentType],u=AC[t.type];return{ArrayType:r,length:o,byteLength:s,componentByteSize:l,numberOfComponentsInElement:u}}function Ib(t){let{images:e,bufferViews:r}=t;e=e||[],r=r||[];let i=e.map(s=>s.bufferView);r=r.filter(s=>!i.includes(s));let n=r.reduce((s,l)=>s+l.byteLength,0),o=e.reduce((s,l)=>{let{width:u,height:h}=l.image;return s+u*h},0);return n+Math.ceil(4*o*C_e)}function ZW(t,e,r){let i=t.bufferViews[r];Na(i);let n=i.buffer,o=e[n];Na(o);let s=(i.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,s,i.byteLength)}func
#define SHADER_NAME scenegraph-layer-vertex-shader
in vec3 instancePositions;
in vec3 instancePositions64Low;
in vec4 instanceColors;
in vec3 instancePickingColors;
in vec3 instanceModelMatrixCol0;
in vec3 instanceModelMatrixCol1;
in vec3 instanceModelMatrixCol2;
in vec3 instanceTranslation;
uniform float sizeScale;
uniform float sizeMinPixels;
uniform float sizeMaxPixels;
uniform mat4 sceneModelMatrix;
uniform bool composeModelMatrix;
in vec3 positions;
#ifdef HAS_UV
in vec2 texCoords;
#endif
#ifdef MODULE_PBR
#ifdef HAS_NORMALS
in vec3 normals;
#endif
#endif
out vec4 vColor;
#ifndef MODULE_PBR
#ifdef HAS_UV
out vec2 vTEXCOORD_0;
#endif
#endif
void main(void) {
#if defined(HAS_UV) && !defined(MODULE_PBR)
vTEXCOORD_0 = texCoords;
geometry.uv = texCoords;
#endif
geometry.worldPosition = instancePositions;
geometry.pickingColor = instancePickingColors;
mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
vec3 normal = vec3(0.0, 0.0, 1.0);
#ifdef MODULE_PBR
#ifdef HAS_NORMALS
normal = instanceModelMatrix * (sceneModelMatrix * vec4(normals, 0.0)).xyz;
#endif
#endif
float originalSize = project_size_to_pixel(sizeScale);
float clampedSize = clamp(originalSize, sizeMinPixels, sizeMaxPixels);
vec3 pos = (instanceModelMatrix * (sceneModelMatrix * vec4(positions, 1.0)).xyz) * sizeScale * (clampedSize / originalSize) + instanceTranslation;
if(composeModelMatrix) {
DECKGL_FILTER_SIZE(pos, geometry);
geometry.normal = project_normal(normal);
geometry.worldPosition += pos;
gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
}
else {
pos = project_size(pos);
DECKGL_FILTER_SIZE(pos, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, geometry.position);
geometry.normal = project_normal(normal);
}
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
#ifdef MODULE_PBR
pbr_vPosition = geometry.position.xyz;
#ifdef HAS_NORMALS
pbr_vNormal = geometry.normal;
#endif
#ifdef HAS_UV
pbr_vUV = texCoords;
#else
pbr_vUV = vec2(0., 0.);
#endif
geometry.uv = pbr_vUV;
#endif
vColor = instanceColors;
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var Cq=`#version 300 es
#define SHADER_NAME scenegraph-layer-fragment-shader
uniform float opacity;
in vec4 vColor;
out vec4 fragColor;
#ifndef MODULE_PBR
#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)
in vec2 vTEXCOORD_0;
uniform sampler2D u_BaseColorSampler;
#endif
#endif
void main(void) {
#ifdef MODULE_PBR
fragColor = vColor * pbr_filterColor(vec4(0));
geometry.uv = pbr_vUV;
#else
#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)
fragColor = vColor * texture(u_BaseColorSampler, vTEXCOORD_0);
geometry.uv = vTEXCOORD_0;
#else
fragColor = vColor;
#endif
#endif
fragColor.a *= opacity;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var Mq=[255,255,255,255],Zve={scenegraph:{type:"object",value:null,async:!0},getScene:t=>t&&t.scenes?typeof t.scene=="object"?t.scene:t.scenes[t.scene||0]:t,getAnimator:t=>t&&t.animator,_animations:null,sizeScale:{type:"number",value:1,min:0},sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:Mq},_lighting:"flat",_imageBasedLightingEnvironment:void 0,getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},loaders:[Vd]},MC=class extends On{getShaders(){let e=[Jn,go];return this.props._lighting==="pbr"&&e.push(hm),super.getShaders({vs:Sq,fs:Cq,modules:e})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),accessor:"getPosition",transition:!0},instanceColors:{type:"unorm8",size:this.props.colorFormat.length,accessor:"getColor",defaultValue:Mq,transition:!0},instanceModelMatrix:aC})}updateState(e){super.updateState(e);let{props:r,oldProps:i}=e;r.scenegraph!==i.scenegraph?this._updateScenegraph():r._animations!==i._animations&&this._applyAnimationsProp(this.state.animator,r._animations)}finalizeState(e){super.finalizeState(e),this.state.scenegraph?.destroy()}get isLoaded(){return Boolean(this.state?.scenegraph&&super.isLoaded)}_updateScenegraph(){let e=this.props,{device:r}=this.context,i=null;if(e.scenegraph instanceof Vu)i={scenes:[e.scenegraph]};else if(e.scenegraph&&typeof e.scenegraph=="object"){let l=e.scenegraph,u=l.json?cg(l):l,h=KD(r,u,this._getModelOptions());i={gltf:u,...h},Eq(h).then(()=>{this.setNeedsRedraw()}).catch(v=>{this.raiseError(v,"loading glTF")})}let n={layer:this,device:this.context.device},o=e.getScene(i,n),s=e.getAnimator(i,n);if(o instanceof Qc){this.state.scenegraph?.destroy(),this._applyAnimationsProp(s,e._animations);let l=[];o.traverse(u=>{u instanceof Ih&&l.push(u.model)}),this.setState({scenegraph:o,animator:s,models:l}),this.getAttributeManager().invalidateAll()}else o!==null&&ur.warn("invalid scenegraph:",o)()}_applyAnimationsProp(e,r){if(!e||!r)return;let i=e.getAnimations();Object.keys(r).sort().forEach(n=>{let o=r[n];if(n==="*")i.forEach(s=>{Object.assign(s,o)});else if(Number.isFinite(Number(n))){let s=Number(n);s>=0&&s<i.length?Object.assign(i[s],o):ur.warn(`animation ${n} not found`)()}else{let s=i.find(({name:l})=>l===n);s?Object.assign(s,o):ur.warn(`animation ${n} not found`)()}})}_getModelOptions(){let{_imageBasedLightingEnvironment:e}=this.props,r;return e&&(typeof e=="function"?r=e({gl:this.context.gl,layer:this}):r=e),{imageBasedLightingEnvironment:r,modelOptions:{id:this.props.id,isInstanced:!0,bufferLayout:this.getAttributeManager().getBufferLayouts(),...this.getShaders()},useTangents:!1}}draw({context:e}){if(!this.state.scenegraph)return;this.props._animations&&this.state.animator&&(this.state.animator.animate(e.timeline.getTime()),this.setNeedsRedraw());let{viewport:r,renderPass:i}=this.context,{sizeScale:n,sizeMinPixels:o,sizeMaxPixels:s,opacity:l,coordinateSystem:u}=this.props,h=this.getNumInstances();this.state.scenegraph.traverse((v,{worldMatrix:T})=>{if(v instanceof Ih){let{model:E}=v;E.setInstanceCount(h),E.setUniforms({sizeScale:n,opacity:l,sizeMinPixels:o,sizeMaxPixels:s,composeModelMatrix:lC(r,u),sceneModelMatrix:T,u_Camera:E.uniforms.cameraPosition}),E.draw(i)}})}},ug=MC;(()=>{MC.defaultProps=Zve})(),(()=>{MC.layerName="ScenegraphLayer"})();var Iq=`#version 300 es
#define SHADER_NAME simple-mesh-layer-vs
uniform float sizeScale;
uniform bool composeModelMatrix;
uniform bool pickFeatureIds;
in vec3 positions;
in vec3 normals;
in vec3 colors;
in vec2 texCoords;
in vec4 uvRegions;
in vec3 featureIdsPickingColors;
in vec4 instanceColors;
in vec3 instancePickingColors;
in vec3 instanceModelMatrixCol0;
in vec3 instanceModelMatrixCol1;
in vec3 instanceModelMatrixCol2;
out vec2 vTexCoord;
out vec3 cameraPosition;
out vec3 normals_commonspace;
out vec4 position_commonspace;
out vec4 vColor;
vec2 applyUVRegion(vec2 uv) {
#ifdef HAS_UV_REGIONS
return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
#else
return uv;
#endif
}
void main(void) {
vec2 uv = applyUVRegion(texCoords);
geometry.uv = uv;
if (pickFeatureIds) {
geometry.pickingColor = featureIdsPickingColors;
} else {
geometry.pickingColor = instancePickingColors;
}
mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
vTexCoord = uv;
cameraPosition = project.cameraPosition;
vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
vec3 pos = (instanceModelMatrix * positions) * sizeScale;
vec3 projectedPosition = project_position(positions);
position_commonspace = vec4(projectedPosition, 1.0);
gl_Position = project_common_position_to_clipspace(position_commonspace);
geometry.position = position_commonspace;
normals_commonspace = project_normal(instanceModelMatrix * normals);
geometry.normal = normals_commonspace;
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
#ifdef MODULE_PBR
pbr_vPosition = geometry.position.xyz;
#ifdef HAS_NORMALS
pbr_vNormal = geometry.normal;
#endif
#ifdef HAS_UV
pbr_vUV = uv;
#else
pbr_vUV = vec2(0., 0.);
#endif
geometry.uv = pbr_vUV;
#endif
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var Pq=`#version 300 es
#define SHADER_NAME simple-mesh-layer-fs
precision highp float;
uniform bool hasTexture;
uniform sampler2D sampler;
uniform bool flatShading;
uniform float opacity;
in vec2 vTexCoord;
in vec3 cameraPosition;
in vec3 normals_commonspace;
in vec4 position_commonspace;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
#ifdef MODULE_PBR
fragColor = vColor * pbr_filterColor(vec4(0));
geometry.uv = pbr_vUV;
fragColor.a *= opacity;
#else
geometry.uv = vTexCoord;
vec3 normal;
if (flatShading) {
normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
} else {
normal = normals_commonspace;
}
vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
fragColor = vec4(lightColor, color.a * opacity);
#endif
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;function Jve(t){let e=t.positions||t.POSITION,r=e.value.length/e.size;t.COLOR_0||t.colors||(t.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var Qve={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},IC=class extends Nh{getShaders(){let e=super.getShaders();return e.modules.push(hm),{...e,vs:Iq,fs:Pq}}initializeState(){let{featureIds:e}=this.props;super.initializeState();let r=this.getAttributeManager();e&&r.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(e){super.updateState(e);let{props:r,oldProps:i}=e;r.pbrMaterial!==i.pbrMaterial&&this.updatePbrMaterialUniforms(r.pbrMaterial)}draw(e){let{featureIds:r}=this.props;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.cameraPosition,pickFeatureIds:Boolean(r)}),super.draw(e))}getModel(e){let{id:r,pbrMaterial:i}=this.props,n=this.parseMaterial(i,e);this.setState({parsedPBRMaterial:n});let o=this.getShaders();return Jve(e.attributes),new Ni(this.context.device,{...this.getShaders(),id:r,geometry:e,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...o.defines,...n?.defines,HAS_UV_REGIONS:e.attributes.uvRegions?1:0},parameters:n?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(e){let{model:r}=this.state;if(r){let{mesh:i}=this.props,n=this.parseMaterial(e,i);this.setState({parsedPBRMaterial:n}),r.setBindings(n.bindings),r.setUniforms(n.uniforms)}}parseMaterial(e,r){let i=Boolean(e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture);return Mb(this.context.device,{unlit:i,...e},{NORMAL:r.attributes.normals,TEXCOORD_0:r.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(e){let r=this.props.featureIds,i=new Uint8ClampedArray(r.length*e.size),n=[];for(let o=0;o<r.length;o++)this.encodePickingColor(r[o],n),i[o*3]=n[0],i[o*3+1]=n[1],i[o*3+2]=n[2];e.value=i}finalizeState(e){super.finalizeState(e),this.state.parsedPBRMaterial?.generatedTextures.forEach(r=>r.destroy()),this.setState({parsedPBRMaterial:null})}},Db=IC;(()=>{IC.layerName="MeshLayer"})(),(()=>{IC.defaultProps=Qve})();var Hd=6356752314245179e-9,$ve={radii:[6378137,6378137,Hd],radiiSquared:[6378137*6378137,6378137*6378137,Hd*Hd],oneOverRadii:[1/6378137,1/6378137,1/Hd],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Hd*Hd)],maximumRadius:Math.max(6378137,6378137,Hd),centerToleranceSquared:.1};function PC(t){return t}var fst=new ot;function exe(t,e=[],r=PC){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function Rq(t,e=[]){return exe(t,e,Do._cartographicRadians?PC:JR)}function txe(t,e,r=PC){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function Bq(t,e){return txe(t,e,Do._cartographicRadians?PC:QR)}var Oq=1e-14,rxe=new ot,Dq={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},xL={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Lb={east:new ot,north:new ot,up:new ot,west:new ot,south:new ot,down:new ot},ixe=new ot,nxe=new ot,oxe=new ot;function bL(t,e,r,i,n,o){let s=Dq[e]&&Dq[e][r];Ja(s&&(!i||i===s));let l,u,h,v=rxe.copy(n);if(Cs(v.x,0,Oq)&&Cs(v.y,0,Oq)){let E=Math.sign(v.z);l=ixe.fromArray(xL[e]),e!=="east"&&e!=="west"&&l.scale(E),u=nxe.fromArray(xL[r]),r!=="east"&&r!=="west"&&u.scale(E),h=oxe.fromArray(xL[i]),i!=="east"&&i!=="west"&&h.scale(E)}else{let{up:E,east:M,north:O}=Lb;M.set(-v.y,v.x,0).normalize(),t.geodeticSurfaceNormal(v,E),O.copy(E).cross(M);let{down:F,west:z,south:W}=Lb;F.copy(E).scale(-1),z.copy(M).scale(-1),W.copy(O).scale(-1)
uniform vec4 clip_bounds;
bool clip_isInBounds(vec2 position) {
return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
}
`,H1e={name:"clip-vs",vs:oY},j1e={"vs:#decl":`
out float clip_isVisible;
`,"vs:DECKGL_FILTER_GL_POSITION":`
clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
`,"fs:#decl":`
in float clip_isVisible;
`,"fs:DECKGL_FILTER_COLOR":`
if (clip_isVisible < 0.5) discard;
`},G1e={name:"clip-fs",fs:oY},W1e={"vs:#decl":`
out vec2 clip_commonPosition;
`,"vs:DECKGL_FILTER_GL_POSITION":`
clip_commonPosition = geometry.position.xy;
`,"fs:#decl":`
in vec2 clip_commonPosition;
`,"fs:DECKGL_FILTER_COLOR":`
if (!clip_isInBounds(clip_commonPosition)) discard;
`},aM=class extends Nm{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:[H1e],inject:j1e}:{modules:[G1e],inject:W1e}}draw({uniforms:e}){let{clipBounds:r}=this.props;if(this.state.clipByInstance)e.clip_bounds=r;else{let i=this.projectPosition([r[0],r[1],0]),n=this.projectPosition([r[2],r[3],0]);e.clip_bounds=[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[0],n[0]),Math.max(i[1],n[1])]}}},ay=aM;(()=>{aM.defaultProps=V1e})(),(()=>{aM.extensionName="ClipExtension"})();function fF(t,e,r){let i=q1e(t),n=Object.keys(i).filter(o=>i[o]!==Array);return X1e(t,{propArrayTypes:i,...e},{numericPropKeys:r&&r.numericPropKeys||n,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function q1e(t){let e={};for(let r of t)if(r.properties)for(let i in r.properties){let n=r.properties[i];e[i]=$1e(n,e[i])}return e}function X1e(t,e,r){let{pointPositionsCount:i,pointFeaturesCount:n,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:l,polygonPositionsCount:u,polygonObjectsCount:h,polygonRingsCount:v,polygonFeaturesCount:T,propArrayTypes:E,coordLength:M}=e,{numericPropKeys:O=[],PositionDataType:F=Float32Array,triangulate:z=!0}=r,W=t[0]&&"id"in t[0],J=t.length>65535?Uint32Array:Uint16Array,K={type:"Point",positions:new F(i*M),globalFeatureIds:new J(i),featureIds:n>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},ne={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new F(o*M),globalFeatureIds:new J(o),featureIds:l>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},ge={type:"Polygon",polygonIndices:u>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:u>65535?new Uint32Array(v+1):new Uint16Array(v+1),positions:new F(u*M),globalFeatureIds:new J(u),featureIds:T>65535?new Uint32Array(u):new Uint16Array(u),numericProps:{},properties:[],fields:[]};z&&(ge.triangles=[]);for(let me of[K,ne,ge])for(let fe of O){let $=E[fe];me.numericProps[fe]=new $(me.positions.length/M)}ne.pathIndices[s]=o,ge.polygonIndices[h]=u,ge.primitivePolygonIndices[v]=u;let j={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let me of t){let fe=me.geometry,$=me.properties||{};switch(fe.type){case"Point":Y1e(fe,K,j,M,$),K.properties.push(uF($,O)),W&&K.fields.push({id:me.id}),j.pointFeature++;break;case"LineString":K1e(fe,ne,j,M,$),ne.properties.push(uF($,O)),W&&ne.fields.push({id:me.id}),j.lineFeature++;break;case"Polygon":Z1e(fe,ge,j,M,$),ge.properties.push(uF($,O)),W&&ge.fields.push({id:me.id}),j.polygonFeature++;break;default:throw new Error("Invalid geometry type")}j.feature++}return Q1e(K,ne,ge,M)}function Y1e(t,e,r,i,n){e.positions.set(t.data,r.pointPosition*i);let o=t.data.length/i;hF(e,n,r.pointPosition,o),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function K1e(t,e,r,i,n){e.positions.set(t.data,r.linePosition*i);let o=t.data.length/i;hF(e,n,r.linePosition,o),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let s=0,l=t.indices.length;s<l;++s){let u=t.indices[s],h=s===l-1?t.data.length:t.indices[s+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(h-u)/i}}function Z1e(t,e,r,i,n){e.positions.set(t.data,r.polygonPosition*i);let o=t.data.length/i;hF(e,n,r.polygonPosition,o),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let s=0,l=t.indices.length;s<l;++s){let u=r.polygonPosition;e.polygonIndices[r.polygonObject++]=u;let h=t.areas[s],v=t.indices[s],T=t.indices[s+1];for(let M=0,O=v.length;M<O;++M){let F=v[M],z=M===O-1?T===void 0?t.data.length:T[0]:v[M+1];e.
Unknown `+e.method+` message on the Control channel
`);return}r=(J.buffers||[]).map(function(K){return K instanceof DataView?K:new DataView(K instanceof ArrayBuffer?K:K.buffer)}),z(null)}),i.on_close(function(){return W("Control comm was closed too early")}),i.send({method:"request_states"},{}),setTimeout(function(){return W("Control comm did not respond in time")},kQ)})];case 2:return F.sent(),i.close(),[3,4];case 3:return n=F.sent(),console.warn('Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason:',n),[2,this._loadFromKernelModels()];case 4:for(o=e.states,s={},l={},u=0;u<e.buffer_paths.length;u++)h=e.buffer_paths[u],v=h[0],T=h.slice(1),E=r[u],s[v]||(s[v]=[],l[v]=[]),s[v].push(T),l[v].push(E);return[4,Promise.all(Object.keys(o).map(function(z){return uA(O,void 0,void 0,function(){var W,J;return fA(this,function(K){switch(K.label){case 0:return this.has_model(z)?(J=void 0,[3,3]):[3,1];case 1:return[4,this._create_comm("jupyter.widget",z)];case 2:J=K.sent(),K.label=3;case 3:return W=J,[2,{widget_id:z,comm:W}]}})})}))];case 5:return M=F.sent(),[4,Promise.all(M.map(function(z){var W=z.widget_id,J=z.comm;return uA(O,void 0,void 0,function(){var K,ne,ge,j;return fA(this,function(me){switch(me.label){case 0:K=o[W],W in s&&cA(K,s[W],l[W]),me.label=1;case 1:return me.trys.push([1,7,,8]),J?[4,this.new_model({model_name:K.model_name,model_module:K.model_module,model_module_version:K.model_module_version,model_id:W,comm:J},K.state)]:[3,3];case 2:return me.sent(),[3,6];case 3:return[4,this.get_model(W)];case 4:return ne=me.sent(),[4,ne.constructor._deserialize_state(K.state,this)];case 5:ge=me.sent(),ne.set_state(ge),me.label=6;case 6:return[3,8];case 7:return j=me.sent(),console.error(j),[3,8];case 8:return[2]}})})}))];case 6:return F.sent(),[2]}})})},t.prototype._loadFromKernelModels=function(){return uA(this,void 0,void 0,function(){var e,r,i=this;return fA(this,function(n){switch(n.label){case 0:return[4,this._get_comm_info()];case 1:return e=n.sent(),[4,Promise.all(Object.keys(e).map(function(o){return uA(i,void 0,void 0,function(){var s,l,u;return fA(this,function(h){switch(h.label){case 0:return this.has_model(o)?[2]:[4,this._create_comm(this.comm_target_name,o)];case 1:return s=h.sent(),l="",u=new LQ.PromiseDelegate,s.on_msg(function(v){if(v.parent_header.msg_id===l&&v.header.msg_type==="comm_msg"&&v.content.data.method==="update"){var T=v.content.data,E=T.buffer_paths||[],M=v.buffers||[];cA(T.state,E,M),u.resolve({comm:s,msg:v})}}),l=s.send({method:"request_state"},this.callbacks(void 0)),[2,u.promise]}})})}))];case 2:return r=n.sent(),[4,Promise.all(r.map(function(o){return uA(i,void 0,void 0,function(){var s;return fA(this,function(l){switch(l.label){case 0:return o?(s=o.msg.content,[4,this.new_model({model_name:s.data.state._model_name,model_module:s.data.state._model_module,model_module_version:s.data.state._model_module_version,comm:o.comm},s.data.state)]):[2];case 1:return l.sent(),[2]}})})}))];case 3:return n.sent(),[2]}})})},t.prototype.clear_state=function(){var e=this;return My(this._models).then(function(r){Object.keys(r).forEach(function(i){return r[i].close()}),e._models=Object.create(null)})},t.prototype.get_state=function(e){var r=this;e===void 0&&(e={});var i=Object.keys(this._models).map(function(n){return r._models[n]});return Promise.all(i).then(function(n){return UQ(n,e)})},t.prototype.set_state=function(e){var r=this;if(!(e.version_major&&e.version_major<=2))throw"Unsupported widget state format";var i=e.state,n=this._get_comm_info().then(function(o){return Promise.all(Object.keys(i).map(function(s){var l={base64:nN,hex:rN},u=i[s],h=u.state;if(u.buffers){var v=u.buffers.map(function(M){return M.path}),T=u.buffers.map(function(M){return new DataView(l[M.encoding](M.data))});cA(u.state,v,T)}if(r.has_model(s))return r.get_model(s).then(function(M){return M.constructor._deserialize_state(h||{},r).then(function(O){return M.set_state(O),M})});var E={model_id:s,model_name:u.model_name,model_module:u.model_module,model_module_version:u.model_module_version};re
return __exports__;
});
//# sourceMappingURL=index.js.map