@deck.gl/aggregation-layers 9.0.0-alpha.7 → 9.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +3345 -340
- package/dist/es5/aggregation-layer.js +3 -1
- package/dist/es5/aggregation-layer.js.map +1 -1
- package/dist/es5/contour-layer/contour-layer.js +2 -2
- package/dist/es5/contour-layer/contour-layer.js.map +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
- package/dist/es5/grid-layer/grid-layer.js +2 -2
- package/dist/es5/grid-layer/grid-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -15
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer.js +103 -97
- package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/max-vs.glsl.js +1 -1
- package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +1 -1
- package/dist/es5/heatmap-layer/triangle-layer.js +26 -27
- package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/weights-vs.glsl.js +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer.js +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/es5/utils/cpu-aggregator.js.map +1 -1
- package/dist/es5/utils/resource-utils.js +0 -2
- package/dist/es5/utils/resource-utils.js.map +1 -1
- package/dist/esm/aggregation-layer.js +3 -1
- package/dist/esm/aggregation-layer.js.map +1 -1
- package/dist/esm/contour-layer/contour-layer.js +2 -2
- package/dist/esm/contour-layer/contour-layer.js.map +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
- package/dist/esm/grid-layer/grid-layer.js +2 -2
- package/dist/esm/grid-layer/grid-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -13
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer.js +99 -87
- package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/max-vs.glsl.js +11 -5
- package/dist/esm/heatmap-layer/max-vs.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +2 -2
- package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer.js +21 -23
- package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/weights-vs.glsl.js +4 -2
- package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer.js +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/esm/utils/cpu-aggregator.js.map +1 -1
- package/dist/esm/utils/resource-utils.js +0 -1
- package/dist/esm/utils/resource-utils.js.map +1 -1
- package/dist.min.js +85 -75
- package/package.json +7 -7
- package/src/aggregation-layer.ts +3 -1
- package/src/contour-layer/contour-layer.ts +3 -3
- package/src/gpu-grid-layer/gpu-grid-layer.ts +1 -1
- package/src/grid-layer/grid-layer.ts +4 -2
- package/src/heatmap-layer/heatmap-layer-utils.ts +0 -23
- package/src/heatmap-layer/heatmap-layer.ts +87 -105
- package/src/heatmap-layer/max-vs.glsl.ts +11 -5
- package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +2 -2
- package/src/heatmap-layer/triangle-layer.ts +17 -24
- package/src/heatmap-layer/weights-vs.glsl.ts +4 -2
- package/src/screen-grid-layer/screen-grid-layer.ts +1 -1
- package/src/utils/cpu-aggregator.ts +1 -1
- package/src/utils/resource-utils.ts +2 -8
- package/typed/aggregation-layer.d.ts.map +1 -1
- package/typed/contour-layer/contour-layer.d.ts.map +1 -1
- package/typed/grid-layer/grid-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts +0 -9
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
- package/typed/heatmap-layer/heatmap-layer.d.ts +4 -4
- package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/max-vs.glsl.d.ts +1 -1
- package/typed/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
- package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
- package/typed/heatmap-layer/triangle-layer.d.ts +10 -2
- package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/weights-vs.glsl.d.ts +1 -1
- package/typed/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
- package/typed/utils/resource-utils.d.ts.map +1 -1
package/dist.min.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var lf=Object.create;var Tr=Object.defineProperty;var ff=Object.getOwnPropertyDescriptor;var uf=Object.getOwnPropertyNames;var cf=Object.getPrototypeOf,df=Object.prototype.hasOwnProperty;var In=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gf=(e,t)=>{for(var r in t)Tr(e,r,{get:t[r],enumerable:!0})},Ar=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of uf(t))!df.call(e,i)&&i!==r&&Tr(e,i,{get:()=>t[i],enumerable:!(n=ff(t,i))||n.enumerable});return e},Pe=(e,t,r)=>(Ar(e,t,"default"),r&&Ar(r,t,"default")),P=(e,t,r)=>(r=e!=null?lf(cf(e)):{},Ar(t||!e||!e.__esModule?Tr(r,"default",{value:e,enumerable:!0}):r,e)),hf=e=>Ar(Tr({},"__esModule",{value:!0}),e);var rt=In((d_,Wi)=>{Wi.exports=globalThis.deck});var $=In((h_,Vi)=>{Vi.exports=globalThis.deck});var I=In((T_,Xi)=>{Xi.exports=globalThis.luma});var gr={};gf(gr,{AGGREGATION_OPERATION:()=>w,CPUGridLayer:()=>Qe,ContourLayer:()=>An,GPUGridLayer:()=>et,GridLayer:()=>En,HeatmapLayer:()=>Mn,HexagonLayer:()=>un,ScreenGridLayer:()=>nn,_AggregationLayer:()=>de,_BinSorter:()=>mt,_CPUAggregator:()=>yt,_GPUGridAggregator:()=>ee});var he={},Hi=P(rt());Pe(he,P(rt()));if(!Hi.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Pe(gr,he);var mi=P($());var ze=function(e){return e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e}(ze||{});var Sr=P(I(),1),z=P(I(),1),So=P(I(),1);var X=e=>`${e}`;function _e(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Dn={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function zi(e){let t={};for(let[r,n]of Object.entries(e))t[r]=_f(n);return t}function ji(e,t,r){let n={};for(let[i,o]of Object.entries(t))e&&i in e&&!o.private?(o.validate&&_e(o.validate(e[i],o),`${r}: invalid ${i}`),n[i]=e[i]):n[i]=o.value;return n}function _f(e){let t=Li(e);if(t!=="object")return{value:e,...Dn[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Dn[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=Li(e.value),{...e,...Dn[t],type:t}):{type:"object",value:null};throw new Error("props")}function Li(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var ki=X`\
|
|
7
|
+
"use strict";var __exports__=(()=>{var Fc=Object.create;var Lr=Object.defineProperty;var Bc=Object.getOwnPropertyDescriptor;var Uc=Object.getOwnPropertyNames;var kc=Object.getPrototypeOf,Wc=Object.prototype.hasOwnProperty;var Ai=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vc=(e,t)=>{for(var r in t)Lr(e,r,{get:t[r],enumerable:!0})},zr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Uc(t))!Wc.call(e,i)&&i!==r&&Lr(e,i,{get:()=>t[i],enumerable:!(n=Bc(t,i))||n.enumerable});return e},Ve=(e,t,r)=>(zr(e,t,"default"),r&&zr(r,t,"default")),M=(e,t,r)=>(r=e!=null?Fc(kc(e)):{},zr(t||!e||!e.__esModule?Lr(r,"default",{value:e,enumerable:!0}):r,e)),Hc=e=>zr(Lr({},"__esModule",{value:!0}),e);var At=Ai((Hp,ds)=>{ds.exports=globalThis.deck});var Q=Ai((zp,_s)=>{_s.exports=globalThis.deck});var B=Ai((Kp,gs)=>{gs.exports=globalThis.luma});var Wr={};Vc(Wr,{AGGREGATION_OPERATION:()=>W,CPUGridLayer:()=>mt,ContourLayer:()=>si,GPUGridLayer:()=>yt,GridLayer:()=>_i,HeatmapLayer:()=>yi,HexagonLayer:()=>Gn,ScreenGridLayer:()=>Kn,_AggregationLayer:()=>ye,_BinSorter:()=>Lt,_CPUAggregator:()=>Yt,_GPUGridAggregator:()=>oe});var Te={},hs=M(At());Ve(Te,M(At()));if(!hs.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Ve(Wr,Te);var $o=M(Q());var st=function(e){return e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e}(st||{});var je=M(B(),1),V=M(B(),1),Js=M(B(),1);var K=e=>`${e}`;function Se(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Ti={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function ms(e){let t={};for(let[r,n]of Object.entries(e))t[r]=Xc(n);return t}function vs(e,t,r){let n={};for(let[i,o]of Object.entries(t))e&&i in e&&!o.private?(o.validate&&Se(o.validate(e[i],o),`${r}: invalid ${i}`),n[i]=e[i]):n[i]=o.value;return n}function Xc(e){let t=ps(e);if(t!=="object")return{value:e,...Ti[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Ti[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=ps(e.value),{...e,...Ti[t],type:t}):{type:"object",value:null};throw new Error("props")}function ps(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var bs=K`\
|
|
8
8
|
#ifdef MODULE_LOGDEPTH
|
|
9
9
|
logdepth_adjustPosition(gl_Position);
|
|
10
10
|
#endif
|
|
11
|
-
|
|
11
|
+
`,ys=K`\
|
|
12
12
|
#ifdef MODULE_MATERIAL
|
|
13
13
|
gl_FragColor = material_filterColor(gl_FragColor);
|
|
14
14
|
#endif
|
|
@@ -29,25 +29,25 @@
|
|
|
29
29
|
#ifdef MODULE_LOGDEPTH
|
|
30
30
|
logdepth_setFragDepth();
|
|
31
31
|
#endif
|
|
32
|
-
`;var
|
|
32
|
+
`;var zc={vertex:bs,fragment:ys},As=/void\s+main\s*\([^)]*\)\s*\{\n?/,Ts=/}\n?[^{}]*$/,Si=[],fr="__LUMA_INJECT_DECLARATIONS__";function Ss(e){let t={vertex:{},fragment:{}};for(let r in e){let n=e[r],i=Lc(r);typeof n=="string"&&(n={order:0,injection:n}),t[i][r]=n}return t}function Lc(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function dr(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=t==="vertex";for(let o in r){let s=r[o];s.sort((l,u)=>l.order-u.order),Si.length=s.length;for(let l=0,u=s.length;l<u;++l)Si[l]=s[l].injection;let a=`${Si.join(`
|
|
33
33
|
`)}
|
|
34
|
-
`;switch(o){case"vs:#decl":i&&(e=e.replace(
|
|
34
|
+
`;switch(o){case"vs:#decl":i&&(e=e.replace(fr,a));break;case"vs:#main-start":i&&(e=e.replace(As,l=>l+a));break;case"vs:#main-end":i&&(e=e.replace(Ts,l=>a+l));break;case"fs:#decl":i||(e=e.replace(fr,a));break;case"fs:#main-start":i||(e=e.replace(As,l=>l+a));break;case"fs:#main-end":i||(e=e.replace(Ts,l=>a+l));break;default:e=e.replace(o,l=>l+a)}}return e=e.replace(fr,""),n&&(e=e.replace(/\}\s*$/,o=>o+zc[t])),e}var jc=1,pe=class{static instantiateModules(t){return t.map(r=>{if(r instanceof pe)return r;Se(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-${jc++}`);let n=new pe(r);return n.dependencies=pe.instantiateModules(r.dependencies||[]),n})}constructor(t){this.name=void 0,this.vs=void 0,this.fs=void 0,this.getModuleUniforms=void 0,this.dependencies=void 0,this.deprecations=void 0,this.defines=void 0,this.injections=void 0,this.uniforms={},this.uniformTypes={};let{name:r,vs:n,fs:i,dependencies:o=[],uniformPropTypes:s={},getUniforms:a,deprecations:l=[],defines:u={},inject:c={}}=t;Se(typeof r=="string"),this.name=r,this.vs=n,this.fs=i,this.getModuleUniforms=a,this.dependencies=pe.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(l),this.defines=u,this.injections=Ss(c),s&&(this.uniforms=ms(s))}getModuleSource(t){let r;switch(t){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:Se(!1)}let n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
|
|
35
35
|
|
|
36
36
|
#define MODULE_${n}
|
|
37
37
|
${r}
|
|
38
38
|
|
|
39
|
-
`}getUniforms(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):
|
|
39
|
+
`}getUniforms(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):vs(t,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(t,r){this.deprecations.forEach(n=>{var i;(i=n.regex)!==null&&i!==void 0&&i.test(t)&&(n.deprecated?r.deprecated(n.old,n.new)():r.removed(n.old,n.new)())})}_parseDeprecationDefinitions(t){return t.forEach(r=>{switch(r.type){case"function":r.regex=new RegExp(`\\b${r.old}\\(`);break;default:r.regex=new RegExp(`${r.type} ${r.old};`)}}),t}_defaultGetUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},n=this.uniforms;for(let i in n){let o=n[i];i in t&&!o.private?(o.validate&&Se(o.validate(t[i],o),`${this.name}: invalid ${i}`),r[i]=t[i]):r[i]=o.value}return r}};function hr(e){let t=pe.instantiateModules(e);return $c(t)}function $c(e){let t={},r={};return xs({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((n,i)=>r[i]-r[n]).map(n=>t[n])}function xs(e){let{modules:t,level:r,moduleMap:n,moduleDepth:i}=e;if(r>=5)throw new Error("Possible loop in shader dependency graph");for(let o of t)n[o.name]=o,(i[o.name]===void 0||i[o.name]<r)&&(i[o.name]=r);for(let o of t)o.dependencies&&xs({modules:o.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}function Rs(e){switch(e?.gpu.toLowerCase()){case"apple":return K`\
|
|
40
40
|
#define APPLE_GPU
|
|
41
41
|
// Apple optimizes away the calculation necessary for emulated fp64
|
|
42
42
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
43
43
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
44
44
|
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
|
|
45
45
|
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
46
|
-
`;case"nvidia":return
|
|
46
|
+
`;case"nvidia":return K`\
|
|
47
47
|
#define NVIDIA_GPU
|
|
48
48
|
// Nvidia optimizes away the calculation necessary for emulated fp64
|
|
49
49
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
50
|
-
`;case"intel":return
|
|
50
|
+
`;case"intel":return K`\
|
|
51
51
|
#define INTEL_GPU
|
|
52
52
|
// Intel optimizes away the calculation necessary for emulated fp64
|
|
53
53
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
@@ -55,9 +55,9 @@ ${r}
|
|
|
55
55
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
56
56
|
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
|
|
57
57
|
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
58
|
-
`;case"amd":return
|
|
58
|
+
`;case"amd":return K`\
|
|
59
59
|
#define AMD_GPU
|
|
60
|
-
`;default:return
|
|
60
|
+
`;default:return K`\
|
|
61
61
|
#define DEFAULT_GPU
|
|
62
62
|
// Prevent driver from optimizing away the calculation necessary for emulated fp64
|
|
63
63
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
@@ -65,12 +65,12 @@ ${r}
|
|
|
65
65
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
66
66
|
// If the GPU doesn't have full 32 bits precision, will causes overflow
|
|
67
67
|
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
68
|
-
`}}function
|
|
68
|
+
`}}function Es(e){let t="";return e.features.has("webgl2")&&(t+=K`\
|
|
69
69
|
# define FEATURE_GLSL_DERIVATIVES
|
|
70
70
|
# define FEATURE_GLSL_DRAW_BUFFERS
|
|
71
71
|
# define FEATURE_GLSL_FRAG_DEPTH
|
|
72
72
|
# define FEATURE_GLSL_TEXTURE_LOD
|
|
73
|
-
`),e.features.has("webgl2")||(e.features.has("glsl-frag-depth")&&(t+=
|
|
73
|
+
`),e.features.has("webgl2")||(e.features.has("glsl-frag-depth")&&(t+=K`\
|
|
74
74
|
|
|
75
75
|
// FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available
|
|
76
76
|
#ifdef GL_EXT_frag_depth
|
|
@@ -79,71 +79,74 @@ ${r}
|
|
|
79
79
|
# define FRAG_DEPTH
|
|
80
80
|
# define gl_FragDepth gl_FragDepthEXT
|
|
81
81
|
#endif
|
|
82
|
-
`),e!=null&&e.features.has("glsl-derivatives")&&(t+=
|
|
82
|
+
`),e!=null&&e.features.has("glsl-derivatives")&&(t+=K`\
|
|
83
83
|
|
|
84
84
|
// FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available
|
|
85
85
|
#if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES)
|
|
86
86
|
# extension GL_OES_standard_derivatives : enable
|
|
87
87
|
# define FEATURE_GLSL_DERIVATIVES
|
|
88
88
|
#endif
|
|
89
|
-
`),e!=null&&e.features.has("glsl-frag-data")&&(t+=
|
|
89
|
+
`),e!=null&&e.features.has("glsl-frag-data")&&(t+=K`\
|
|
90
90
|
|
|
91
91
|
// FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available
|
|
92
92
|
#ifdef GL_EXT_draw_buffers
|
|
93
93
|
# extension GL_EXT_draw_buffers : require
|
|
94
94
|
# define FEATURE_GLSL_DRAW_BUFFERS
|
|
95
95
|
#endif
|
|
96
|
-
`),e!=null&&e.features.has("glsl-texture-lod")&&(t+=
|
|
96
|
+
`),e!=null&&e.features.has("glsl-texture-lod")&&(t+=K`\
|
|
97
97
|
// TEXTURE_LOD => texture2DLod etc are available
|
|
98
98
|
#ifdef GL_EXT_shader_texture_lod
|
|
99
99
|
# extension GL_EXT_shader_texture_lod : enable
|
|
100
100
|
# define FEATURE_GLSL_TEXTURE_LOD
|
|
101
101
|
# define TEXTURE_LOD
|
|
102
102
|
#endif
|
|
103
|
-
`)),t}function
|
|
104
|
-
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],
|
|
105
|
-
`,i.header&&(r+=` ${i.header}`),t[n]){let o=t[n];o.sort((a
|
|
103
|
+
`)),t}function ws(e,t,r){var n;if(Number(((n=e.match(/^#version[ \t]+(\d+)/m))===null||n===void 0?void 0:n[1])||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case 300:switch(r){case"vertex":return e=_r(e,Kc),e;case"fragment":return e=_r(e,Yc),e;default:throw new Error(r)}case 100:switch(r){case"vertex":return e=_r(e,qc),e;case"fragment":return e=_r(e,Ps),e=Qc(e),e;default:throw new Error(r)}default:throw new Error(String(t))}}var Cs=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
|
|
104
|
+
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Kc=[...Cs,[Tt("attribute"),"in $1"],[Tt("varying"),"out $1"]],Yc=[...Cs,[Tt("varying"),"in $1"]],Ns=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],qc=[...Ns,[Tt("in"),"attribute $1"],[Tt("out"),"varying $1"]],Ps=[...Ns,[Tt("in"),"varying $1"]],Zc="gl_FragColor",Os=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function _r(e,t){for(let[r,n]of t)e=e.replace(r,n);return e}function Qc(e){e=_r(e,Ps);let t=Os.exec(e);if(t){let r=t[1];e=e.replace(Os,"").replace(new RegExp(`\\b${r}\\b`,"g"),Zc)}return e}function Tt(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function xi(e,t){let r="";for(let n in e){let i=e[n];if(r+=`void ${i.signature} {
|
|
105
|
+
`,i.header&&(r+=` ${i.header}`),t[n]){let o=t[n];o.sort((s,a)=>s.order-a.order);for(let s of o)r+=` ${s.injection}
|
|
106
106
|
`}i.footer&&(r+=` ${i.footer}`),r+=`}
|
|
107
|
-
`}return r}function
|
|
107
|
+
`}return r}function Ri(e){let t={vertex:{},fragment:{}};for(let r of e){let n,i;typeof r!="string"?(n=r,i=n.hook):(n={},i=r),i=i.trim();let[o,s]=i.split(":"),a=i.replace(/\(.+/,""),l=Object.assign(n,{signature:s});switch(o){case"vs":t.vertex[a]=l;break;case"fs":t.fragment[a]=l;break;default:throw new Error(o)}}return t}function Is(e,t){return{name:Jc(e,t),language:"glsl",version:Gc(e)}}function Jc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return n?n[1]:t}function Gc(e){let t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}if(t!==100&&t!==300)throw new Error(`Invalid GLSL version ${t}`);return t}var Bs=`
|
|
108
108
|
|
|
109
|
-
${
|
|
110
|
-
`,
|
|
109
|
+
${fr}
|
|
110
|
+
`,ef=K`\
|
|
111
111
|
precision highp float;
|
|
112
|
-
`;function
|
|
112
|
+
`;function Us(e){let{vs:t,fs:r}=e,n=hr(e.modules||[]);switch(e.platformInfo.shaderLanguage){case"glsl":return{vs:Ds(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:Ds(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:Fs(n)};case"wgsl":return{vs:Ms(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:Ms(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:Fs(n)}}}function Ms(e,t){let{source:r,stage:n,modules:i,defines:o={},hookFunctions:s=[],inject:a={},log:l}=t;Se(typeof r=="string","shader source must be a string");let u=r,c={};i.forEach(v=>{Object.assign(c,v.getDefines())}),Object.assign(c,o);let f="",h=Ri(s),_={},m={},y={};for(let v in a){let S=typeof a[v]=="string"?{injection:a[v],order:0}:a[v],T=/^(v|f)s:(#)?([\w-]+)$/.exec(v);if(T){let x=T[2],O=T[3];x?O==="decl"?m[v]=[S]:y[v]=[S]:_[v]=[S]}else y[v]=[S]}for(let v of i){l&&v.checkDeprecations(u,l);let S=v.getModuleSource(n,"wgsl");f+=S;let T=v.injections[n];for(let x in T){let O=/^(v|f)s:#([\w-]+)$/.exec(x);if(O){let I=O[2]==="decl"?m:y;I[x]=I[x]||[],I[x].push(T[x])}else _[x]=_[x]||[],_[x].push(T[x])}}return f+=Bs,f=dr(f,n,m),f+=xi(h[n],_),f+=u,f=dr(f,n,y),f}function Ds(e,t){let{id:r,source:n,stage:i,language:o="glsl",modules:s,defines:a={},hookFunctions:l=[],inject:u={},prologue:c=!0,log:f}=t;Se(typeof n=="string","shader source must be a string");let h=o==="glsl"?Is(n).version:-1,_=e.shaderLanguageVersion,m=h===100?"#version 100":"#version 300 es",v=n.split(`
|
|
113
113
|
`).slice(1).join(`
|
|
114
|
-
`),
|
|
114
|
+
`),S={};s.forEach(D=>{Object.assign(S,D.getDefines())}),Object.assign(S,a);let T="";switch(o){case"wgsl":break;case"glsl":T=c?`${m}
|
|
115
115
|
|
|
116
116
|
// ----- PROLOGUE -------------------------
|
|
117
|
-
${
|
|
117
|
+
${tf({id:r,source:n,stage:i})}
|
|
118
118
|
${`#define SHADER_TYPE_${i.toUpperCase()}`}
|
|
119
|
-
${
|
|
120
|
-
${
|
|
121
|
-
${i==="fragment"?
|
|
119
|
+
${Rs(e)}
|
|
120
|
+
${Es(e)}
|
|
121
|
+
${i==="fragment"?ef:""}
|
|
122
122
|
|
|
123
123
|
// ----- APPLICATION DEFINES -------------------------
|
|
124
124
|
|
|
125
|
-
${
|
|
125
|
+
${rf(S)}
|
|
126
126
|
|
|
127
|
-
`:`${
|
|
128
|
-
`;break}let
|
|
127
|
+
`:`${m}
|
|
128
|
+
`;break}let x=Ri(l),O={},P={},I={};for(let D in u){let F=typeof u[D]=="string"?{injection:u[D],order:0}:u[D],X=/^(v|f)s:(#)?([\w-]+)$/.exec(D);if(X){let L=X[2],q=X[3];L?q==="decl"?P[D]=[F]:I[D]=[F]:O[D]=[F]}else I[D]=[F]}for(let D of s){f&&D.checkDeprecations(v,f);let F=D.getModuleSource(i);T+=F;let X=D.injections[i];for(let L in X){let q=/^(v|f)s:#([\w-]+)$/.exec(L);if(q){let fe=q[2]==="decl"?P:I;fe[L]=fe[L]||[],fe[L].push(X[L])}else O[L]=O[L]||[],O[L].push(X[L])}}return T+="// ----- MAIN SHADER SOURCE -------------------------",T+=Bs,T=dr(T,i,P),T+=xi(x[i],O),T+=v,T=dr(T,i,I),o==="glsl"&&h!==_&&(T=ws(T,_,i)),T.trim()}function Fs(e){return function(r){let n={};for(let i of e){let o=i.getUniforms(r,n);Object.assign(n,o)}return n}}function tf(e){let{id:t,source:r,stage:n}=e;return t&&r.indexOf("SHADER_NAME")===-1?`
|
|
129
129
|
#define SHADER_NAME ${t}_${n}
|
|
130
130
|
|
|
131
|
-
`:""}function
|
|
132
|
-
`)}return t}function
|
|
131
|
+
`:""}function rf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t="";for(let r in e){let n=e[r];(n||Number.isFinite(n))&&(t+=`#define ${r.toUpperCase()} ${e[r]}
|
|
132
|
+
`)}return t}function Ws(e){if(!e.vs)throw new Error("no vertex shader");let t=ks(e.platformInfo,e.vs),r;return e.fs&&(r=ks(e.platformInfo,e.fs)),{...e,vs:t,fs:r}}function ks(e,t){if(typeof t=="string")return t;switch(e.type){case"webgpu":if(t!=null&&t.wgsl)return t.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(t!=null&&t.glsl)return t.glsl;throw new Error("WebGL does not support WGSL shaders")}}var me=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return me.defaultShaderAssembler=me.defaultShaderAssembler||new me,me.defaultShaderAssembler}addDefaultModule(t){this._defaultModules.find(r=>r.name===(typeof t=="string"?t:t.name))||this._defaultModules.push(t)}removeDefaultModule(t){let r=typeof t=="string"?t:t.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==r)}addShaderHook(t,r){r&&(t=Object.assign(r,{hook:t})),this._hookFunctions.push(t)}assembleShaders(t){let r=this._getModuleList(t.modules),n=this._hookFunctions,i=Ws(t);return{...Us({platformInfo:t.platformInfo,...i,modules:r,hookFunctions:n}),modules:r}}_getModuleList(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+t.length),n={},i=0;for(let o=0,s=this._defaultModules.length;o<s;++o){let a=this._defaultModules[o],l=a.name;r[i++]=a,n[l]=!0}for(let o=0,s=t.length;o<s;++o){let a=t[o],l=a.name;n[l]||(r[i++]=a,n[l]=!0)}return r.length=i,pe.instantiateModules(r)}};me.defaultShaderAssembler=void 0;var nf=K`void main() {gl_FragColor = vec4(0);}`,Vs=K`\
|
|
133
133
|
out vec4 transform_output;
|
|
134
134
|
void main() {
|
|
135
135
|
transform_output = vec4(0);
|
|
136
|
-
}`,
|
|
137
|
-
${
|
|
138
|
-
${
|
|
136
|
+
}`,of=`#version 300 es
|
|
137
|
+
${Vs}`;function Ei(e){let{version:t=100,input:r,inputChannels:n,output:i}=e||{};if(!r)return t===300?of:t>300?`#version ${t}
|
|
138
|
+
${Vs}`:nf;if(!n)throw new Error("inputChannels");let o=sf(n),s=Hs(r,n);return t>=300?`#version ${t} ${t===300?"es":""}
|
|
139
139
|
in ${o} ${r};
|
|
140
140
|
out vec4 ${i};
|
|
141
141
|
void main() {
|
|
142
|
-
${i} = ${
|
|
142
|
+
${i} = ${s};
|
|
143
143
|
}`:`varying ${o} ${r};
|
|
144
144
|
void main() {
|
|
145
|
-
gl_FragColor = ${
|
|
146
|
-
}`}function If(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${e}`)}}function ho(e,t){switch(t){case 1:return`vec4(${e}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${e}, 0.0, 1.0)`;case 3:return`vec4(${e}, 1.0)`;case 4:return e;default:throw new Error(`invalid channels: ${t}`)}}function Wn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Math.fround(e),i=e-n;return t[r]=n,t[r+1]=i,t}function _o(e){return e-Math.fround(e)}function po(e){let t=new Float32Array(32);for(let r=0;r<4;++r)for(let n=0;n<4;++n){let i=r*4+n;Wn(e[n*4+r],t,i*2)}return t}var Ao=X`\
|
|
145
|
+
gl_FragColor = ${s};
|
|
146
|
+
}`}function sf(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${e}`)}}function Hs(e,t){switch(t){case 1:return`vec4(${e}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${e}, 0.0, 1.0)`;case 3:return`vec4(${e}, 1.0)`;case 4:return e;default:throw new Error(`invalid channels: ${t}`)}}var Oi=class{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}},Me=class{constructor(){}get isAstNode(){return!0}get astNodeType(){return""}evaluate(t){throw new Error("Cannot evaluate node")}evaluateString(t){return this.evaluate(t).toString()}},z=class extends Me{constructor(){super()}},jr=class extends z{constructor(t,r,n,i){super(),this.name=t,this.args=r,this.returnType=n,this.body=i}get astNodeType(){return"function"}},wi=class extends z{constructor(t){super(),this.expression=t}get astNodeType(){return"staticAssert"}},Ci=class extends z{constructor(t,r){super(),this.condition=t,this.body=r}get astNodeType(){return"while"}},Ni=class extends z{constructor(t){super(),this.body=t}get astNodeType(){return"continuing"}},Pi=class extends z{constructor(t,r,n,i){super(),this.init=t,this.condition=r,this.increment=n,this.body=i}get astNodeType(){return"for"}},Xe=class extends z{constructor(t,r,n,i,o){super(),this.name=t,this.type=r,this.storage=n,this.access=i,this.value=o}get astNodeType(){return"var"}},$r=class extends z{constructor(t,r,n){super(),this.name=t,this.type=r,this.value=n}get astNodeType(){return"override"}},Kr=class extends z{constructor(t,r,n,i,o){super(),this.name=t,this.type=r,this.storage=n,this.access=i,this.value=o}get astNodeType(){return"let"}},Yr=class extends z{constructor(t,r,n,i,o){super(),this.name=t,this.type=r,this.storage=n,this.access=i,this.value=o}get astNodeType(){return"const"}evaluate(t){return this.value.evaluate(t)}},Et;(function(e){e.increment="++",e.decrement="--"})(Et||(Et={}));(function(e){function t(r){let n=r;if(n=="parse")throw new Error("Invalid value for IncrementOperator");return e[n]}e.parse=t})(Et||(Et={}));var Ii=class extends z{constructor(t,r){super(),this.operator=t,this.variable=r}get astNodeType(){return"increment"}},pr;(function(e){e.assign="=",e.addAssign="+=",e.subtractAssin="-=",e.multiplyAssign="*=",e.divideAssign="/=",e.moduloAssign="%=",e.andAssign="&=",e.orAssign="|=",e.xorAssign="^=",e.shiftLeftAssign="<<=",e.shiftRightAssign=">>="})(pr||(pr={}));(function(e){function t(r){let n=r;if(n=="parse")throw new Error("Invalid value for AssignOperator");return e[n]}e.parse=t})(pr||(pr={}));var Mi=class extends z{constructor(t,r,n){super(),this.operator=t,this.variable=r,this.value=n}get astNodeType(){return"assign"}},Di=class extends z{constructor(t,r){super(),this.name=t,this.args=r}get astNodeType(){return"call"}},Fi=class extends z{constructor(t,r){super(),this.body=t,this.continuing=r}get astNodeType(){return"loop"}},Bi=class extends z{constructor(t,r){super(),this.condition=t,this.body=r}get astNodeType(){return"body"}},Ui=class extends z{constructor(t,r,n,i){super(),this.condition=t,this.body=r,this.elseif=n,this.else=i}get astNodeType(){return"if"}},ki=class extends z{constructor(t){super(),this.value=t}get astNodeType(){return"return"}},Wi=class extends z{constructor(t){super(),this.name=t}get astNodeType(){return"enable"}},qr=class extends z{constructor(t,r){super(),this.name=t,this.type=r}get astNodeType(){return"alias"}},Vi=class extends z{constructor(){super()}get astNodeType(){return"discard"}},Hi=class extends z{constructor(){super()}get astNodeType(){return"break"}},Xi=class extends z{constructor(){super()}get astNodeType(){return"continue"}},De=class extends z{constructor(t){super(),this.name=t}get astNodeType(){return"type"}get isStruct(){return!1}get isArray(){return!1}},Ie=class extends De{constructor(t,r){super(t),this.members=r}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(t){for(let r=0;r<this.members.length;r++)if(this.members[r].name==t)return r;return-1}},Zr=class extends De{constructor(t,r,n){super(t),this.format=r,this.access=n}get astNodeType(){return"template"}},zi=class extends De{constructor(t,r,n,i){super(t),this.storage=r,this.type=n,this.access=i}get astNodeType(){return"pointer"}},Qr=class extends De{constructor(t,r,n,i){super(t),this.attributes=r,this.format=n,this.count=i}get astNodeType(){return"array"}get isArray(){return!0}},at=class extends De{constructor(t,r,n){super(t),this.format=r,this.access=n}get astNodeType(){return"sampler"}},_e=class extends Me{constructor(){super()}},Jr=class extends _e{constructor(t){super(),this.value=t}get astNodeType(){return"stringExpr"}toString(){return this.value}evaluateString(){return this.value}},lt=class extends _e{constructor(t,r){super(),this.type=t,this.args=r}get astNodeType(){return"createExpr"}},Li=class extends _e{constructor(t,r){super(),this.name=t,this.args=r}get astNodeType(){return"callExpr"}evaluate(t){switch(this.name){case"abs":return Math.abs(this.args[0].evaluate(t));case"acos":return Math.acos(this.args[0].evaluate(t));case"acosh":return Math.acosh(this.args[0].evaluate(t));case"asin":return Math.asin(this.args[0].evaluate(t));case"asinh":return Math.asinh(this.args[0].evaluate(t));case"atan":return Math.atan(this.args[0].evaluate(t));case"atan2":return Math.atan2(this.args[0].evaluate(t),this.args[1].evaluate(t));case"atanh":return Math.atanh(this.args[0].evaluate(t));case"ceil":return Math.ceil(this.args[0].evaluate(t));case"clamp":return Math.min(Math.max(this.args[0].evaluate(t),this.args[1].evaluate(t)),this.args[2].evaluate(t));case"cos":return Math.cos(this.args[0].evaluate(t));case"degrees":return this.args[0].evaluate(t)*180/Math.PI;case"distance":return Math.sqrt(Math.pow(this.args[0].evaluate(t)-this.args[1].evaluate(t),2));case"dot":case"exp":return Math.exp(this.args[0].evaluate(t));case"exp2":return Math.pow(2,this.args[0].evaluate(t));case"floor":return Math.floor(this.args[0].evaluate(t));case"fma":return this.args[0].evaluate(t)*this.args[1].evaluate(t)+this.args[2].evaluate(t);case"fract":return this.args[0].evaluate(t)-Math.floor(this.args[0].evaluate(t));case"inverseSqrt":return 1/Math.sqrt(this.args[0].evaluate(t));case"log":return Math.log(this.args[0].evaluate(t));case"log2":return Math.log2(this.args[0].evaluate(t));case"max":return Math.max(this.args[0].evaluate(t),this.args[1].evaluate(t));case"min":return Math.min(this.args[0].evaluate(t),this.args[1].evaluate(t));case"mix":return this.args[0].evaluate(t)*(1-this.args[2].evaluate(t))+this.args[1].evaluate(t)*this.args[2].evaluate(t);case"modf":return this.args[0].evaluate(t)-Math.floor(this.args[0].evaluate(t));case"pow":return Math.pow(this.args[0].evaluate(t),this.args[1].evaluate(t));case"radians":return this.args[0].evaluate(t)*Math.PI/180;case"round":return Math.round(this.args[0].evaluate(t));case"sign":return Math.sign(this.args[0].evaluate(t));case"sin":return Math.sin(this.args[0].evaluate(t));case"sinh":return Math.sinh(this.args[0].evaluate(t));case"saturate":return Math.min(Math.max(this.args[0].evaluate(t),0),1);case"smoothstep":return this.args[0].evaluate(t)*this.args[0].evaluate(t)*(3-2*this.args[0].evaluate(t));case"sqrt":return Math.sqrt(this.args[0].evaluate(t));case"step":return this.args[0].evaluate(t)<this.args[1].evaluate(t)?0:1;case"tan":return Math.tan(this.args[0].evaluate(t));case"tanh":return Math.tanh(this.args[0].evaluate(t));case"trunc":return Math.trunc(this.args[0].evaluate(t));default:throw new Error("Non const function: "+this.name)}}},ji=class extends _e{constructor(t){super(),this.name=t}get astNodeType(){return"varExpr"}},Gr=class extends _e{constructor(t,r){super(),this.name=t,this.initializer=r}get astNodeType(){return"constExpr"}evaluate(t){var r,n;if(this.initializer instanceof lt){let i=(r=this.postfix)===null||r===void 0?void 0:r.evaluateString(t),o=(n=this.initializer.type)===null||n===void 0?void 0:n.name,s=t.structs.get(o),a=s?.getMemberIndex(i);if(a!=-1)return this.initializer.args[a].evaluate(t);console.log(a)}return this.initializer.evaluate(t)}},en=class extends _e{constructor(t){super(),this.value=t}get astNodeType(){return"literalExpr"}evaluate(){return this.value}},$i=class extends _e{constructor(t,r){super(),this.type=t,this.value=r}get astNodeType(){return"bitcastExpr"}},Ki=class extends _e{constructor(t,r){super(),this.type=t,this.args=r}get astNodeType(){return"typecastExpr"}evaluate(t){return this.args[0].evaluate(t)}},tn=class extends _e{constructor(t){super(),this.contents=t}get astNodeType(){return"groupExpr"}evaluate(t){return this.contents[0].evaluate(t)}},rn=class extends _e{constructor(){super()}},Yi=class extends rn{constructor(t,r){super(),this.operator=t,this.right=r}get astNodeType(){return"unaryOp"}evaluate(t){switch(this.operator){case"+":return this.right.evaluate(t);case"-":return-this.right.evaluate(t);case"!":return this.right.evaluate(t)?0:1;case"~":return~this.right.evaluate(t);default:throw new Error("Unknown unary operator: "+this.operator)}}},de=class extends rn{constructor(t,r,n){super(),this.operator=t,this.left=r,this.right=n}get astNodeType(){return"binaryOp"}evaluate(t){switch(this.operator){case"+":return this.left.evaluate(t)+this.right.evaluate(t);case"-":return this.left.evaluate(t)-this.right.evaluate(t);case"*":return this.left.evaluate(t)*this.right.evaluate(t);case"/":return this.left.evaluate(t)/this.right.evaluate(t);case"%":return this.left.evaluate(t)%this.right.evaluate(t);case"==":return this.left.evaluate(t)==this.right.evaluate(t)?1:0;case"!=":return this.left.evaluate(t)!=this.right.evaluate(t)?1:0;case"<":return this.left.evaluate(t)<this.right.evaluate(t)?1:0;case">":return this.left.evaluate(t)>this.right.evaluate(t)?1:0;case"<=":return this.left.evaluate(t)<=this.right.evaluate(t)?1:0;case">=":return this.left.evaluate(t)>=this.right.evaluate(t)?1:0;case"&&":return this.left.evaluate(t)&&this.right.evaluate(t)?1:0;case"||":return this.left.evaluate(t)||this.right.evaluate(t)?1:0;default:throw new Error(`Unknown operator ${this.operator}`)}}},nn=class extends Me{constructor(){super()}},qi=class extends nn{constructor(t,r){super(),this.selector=t,this.body=r}get astNodeType(){return"case"}},Zi=class extends nn{constructor(t){super(),this.body=t}get astNodeType(){return"default"}},Qi=class extends Me{constructor(t,r,n){super(),this.name=t,this.type=r,this.attributes=n}get astNodeType(){return"argument"}},Ji=class extends Me{constructor(t,r){super(),this.condition=t,this.body=r}get astNodeType(){return"elseif"}},Gi=class extends Me{constructor(t,r,n){super(),this.name=t,this.type=r,this.attributes=n}get astNodeType(){return"member"}},on=class extends Me{constructor(t,r){super(),this.name=t,this.value=r}get astNodeType(){return"attribute"}},A,p;(function(e){e[e.token=0]="token",e[e.keyword=1]="keyword",e[e.reserved=2]="reserved"})(p||(p={}));var g=class{constructor(t,r,n){this.name=t,this.type=r,this.rule=n}toString(){return this.name}},d=class{};A=d;d.none=new g("",p.reserved,"");d.eof=new g("EOF",p.token,"");d.reserved={asm:new g("asm",p.reserved,"asm"),bf16:new g("bf16",p.reserved,"bf16"),do:new g("do",p.reserved,"do"),enum:new g("enum",p.reserved,"enum"),f16:new g("f16",p.reserved,"f16"),f64:new g("f64",p.reserved,"f64"),handle:new g("handle",p.reserved,"handle"),i8:new g("i8",p.reserved,"i8"),i16:new g("i16",p.reserved,"i16"),i64:new g("i64",p.reserved,"i64"),mat:new g("mat",p.reserved,"mat"),premerge:new g("premerge",p.reserved,"premerge"),regardless:new g("regardless",p.reserved,"regardless"),typedef:new g("typedef",p.reserved,"typedef"),u8:new g("u8",p.reserved,"u8"),u16:new g("u16",p.reserved,"u16"),u64:new g("u64",p.reserved,"u64"),unless:new g("unless",p.reserved,"unless"),using:new g("using",p.reserved,"using"),vec:new g("vec",p.reserved,"vec"),void:new g("void",p.reserved,"void")};d.keywords={array:new g("array",p.keyword,"array"),atomic:new g("atomic",p.keyword,"atomic"),bool:new g("bool",p.keyword,"bool"),f32:new g("f32",p.keyword,"f32"),i32:new g("i32",p.keyword,"i32"),mat2x2:new g("mat2x2",p.keyword,"mat2x2"),mat2x3:new g("mat2x3",p.keyword,"mat2x3"),mat2x4:new g("mat2x4",p.keyword,"mat2x4"),mat3x2:new g("mat3x2",p.keyword,"mat3x2"),mat3x3:new g("mat3x3",p.keyword,"mat3x3"),mat3x4:new g("mat3x4",p.keyword,"mat3x4"),mat4x2:new g("mat4x2",p.keyword,"mat4x2"),mat4x3:new g("mat4x3",p.keyword,"mat4x3"),mat4x4:new g("mat4x4",p.keyword,"mat4x4"),ptr:new g("ptr",p.keyword,"ptr"),sampler:new g("sampler",p.keyword,"sampler"),sampler_comparison:new g("sampler_comparison",p.keyword,"sampler_comparison"),struct:new g("struct",p.keyword,"struct"),texture_1d:new g("texture_1d",p.keyword,"texture_1d"),texture_2d:new g("texture_2d",p.keyword,"texture_2d"),texture_2d_array:new g("texture_2d_array",p.keyword,"texture_2d_array"),texture_3d:new g("texture_3d",p.keyword,"texture_3d"),texture_cube:new g("texture_cube",p.keyword,"texture_cube"),texture_cube_array:new g("texture_cube_array",p.keyword,"texture_cube_array"),texture_multisampled_2d:new g("texture_multisampled_2d",p.keyword,"texture_multisampled_2d"),texture_storage_1d:new g("texture_storage_1d",p.keyword,"texture_storage_1d"),texture_storage_2d:new g("texture_storage_2d",p.keyword,"texture_storage_2d"),texture_storage_2d_array:new g("texture_storage_2d_array",p.keyword,"texture_storage_2d_array"),texture_storage_3d:new g("texture_storage_3d",p.keyword,"texture_storage_3d"),texture_depth_2d:new g("texture_depth_2d",p.keyword,"texture_depth_2d"),texture_depth_2d_array:new g("texture_depth_2d_array",p.keyword,"texture_depth_2d_array"),texture_depth_cube:new g("texture_depth_cube",p.keyword,"texture_depth_cube"),texture_depth_cube_array:new g("texture_depth_cube_array",p.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new g("texture_depth_multisampled_2d",p.keyword,"texture_depth_multisampled_2d"),texture_external:new g("texture_external",p.keyword,"texture_external"),u32:new g("u32",p.keyword,"u32"),vec2:new g("vec2",p.keyword,"vec2"),vec3:new g("vec3",p.keyword,"vec3"),vec4:new g("vec4",p.keyword,"vec4"),bitcast:new g("bitcast",p.keyword,"bitcast"),block:new g("block",p.keyword,"block"),break:new g("break",p.keyword,"break"),case:new g("case",p.keyword,"case"),continue:new g("continue",p.keyword,"continue"),continuing:new g("continuing",p.keyword,"continuing"),default:new g("default",p.keyword,"default"),discard:new g("discard",p.keyword,"discard"),else:new g("else",p.keyword,"else"),enable:new g("enable",p.keyword,"enable"),fallthrough:new g("fallthrough",p.keyword,"fallthrough"),false:new g("false",p.keyword,"false"),fn:new g("fn",p.keyword,"fn"),for:new g("for",p.keyword,"for"),function:new g("function",p.keyword,"function"),if:new g("if",p.keyword,"if"),let:new g("let",p.keyword,"let"),const:new g("const",p.keyword,"const"),loop:new g("loop",p.keyword,"loop"),while:new g("while",p.keyword,"while"),private:new g("private",p.keyword,"private"),read:new g("read",p.keyword,"read"),read_write:new g("read_write",p.keyword,"read_write"),return:new g("return",p.keyword,"return"),storage:new g("storage",p.keyword,"storage"),switch:new g("switch",p.keyword,"switch"),true:new g("true",p.keyword,"true"),alias:new g("alias",p.keyword,"alias"),type:new g("type",p.keyword,"type"),uniform:new g("uniform",p.keyword,"uniform"),var:new g("var",p.keyword,"var"),override:new g("override",p.keyword,"override"),workgroup:new g("workgroup",p.keyword,"workgroup"),write:new g("write",p.keyword,"write"),r8unorm:new g("r8unorm",p.keyword,"r8unorm"),r8snorm:new g("r8snorm",p.keyword,"r8snorm"),r8uint:new g("r8uint",p.keyword,"r8uint"),r8sint:new g("r8sint",p.keyword,"r8sint"),r16uint:new g("r16uint",p.keyword,"r16uint"),r16sint:new g("r16sint",p.keyword,"r16sint"),r16float:new g("r16float",p.keyword,"r16float"),rg8unorm:new g("rg8unorm",p.keyword,"rg8unorm"),rg8snorm:new g("rg8snorm",p.keyword,"rg8snorm"),rg8uint:new g("rg8uint",p.keyword,"rg8uint"),rg8sint:new g("rg8sint",p.keyword,"rg8sint"),r32uint:new g("r32uint",p.keyword,"r32uint"),r32sint:new g("r32sint",p.keyword,"r32sint"),r32float:new g("r32float",p.keyword,"r32float"),rg16uint:new g("rg16uint",p.keyword,"rg16uint"),rg16sint:new g("rg16sint",p.keyword,"rg16sint"),rg16float:new g("rg16float",p.keyword,"rg16float"),rgba8unorm:new g("rgba8unorm",p.keyword,"rgba8unorm"),rgba8unorm_srgb:new g("rgba8unorm_srgb",p.keyword,"rgba8unorm_srgb"),rgba8snorm:new g("rgba8snorm",p.keyword,"rgba8snorm"),rgba8uint:new g("rgba8uint",p.keyword,"rgba8uint"),rgba8sint:new g("rgba8sint",p.keyword,"rgba8sint"),bgra8unorm:new g("bgra8unorm",p.keyword,"bgra8unorm"),bgra8unorm_srgb:new g("bgra8unorm_srgb",p.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new g("rgb10a2unorm",p.keyword,"rgb10a2unorm"),rg11b10float:new g("rg11b10float",p.keyword,"rg11b10float"),rg32uint:new g("rg32uint",p.keyword,"rg32uint"),rg32sint:new g("rg32sint",p.keyword,"rg32sint"),rg32float:new g("rg32float",p.keyword,"rg32float"),rgba16uint:new g("rgba16uint",p.keyword,"rgba16uint"),rgba16sint:new g("rgba16sint",p.keyword,"rgba16sint"),rgba16float:new g("rgba16float",p.keyword,"rgba16float"),rgba32uint:new g("rgba32uint",p.keyword,"rgba32uint"),rgba32sint:new g("rgba32sint",p.keyword,"rgba32sint"),rgba32float:new g("rgba32float",p.keyword,"rgba32float"),static_assert:new g("static_assert",p.keyword,"static_assert")};d.tokens={decimal_float_literal:new g("decimal_float_literal",p.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|([0-9]+f)/),hex_float_literal:new g("hex_float_literal",p.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new g("int_literal",p.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new g("uint_literal",p.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new g("ident",p.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new g("and",p.token,"&"),and_and:new g("and_and",p.token,"&&"),arrow:new g("arrow ",p.token,"->"),attr:new g("attr",p.token,"@"),attr_left:new g("attr_left",p.token,"[["),attr_right:new g("attr_right",p.token,"]]"),forward_slash:new g("forward_slash",p.token,"/"),bang:new g("bang",p.token,"!"),bracket_left:new g("bracket_left",p.token,"["),bracket_right:new g("bracket_right",p.token,"]"),brace_left:new g("brace_left",p.token,"{"),brace_right:new g("brace_right",p.token,"}"),colon:new g("colon",p.token,":"),comma:new g("comma",p.token,","),equal:new g("equal",p.token,"="),equal_equal:new g("equal_equal",p.token,"=="),not_equal:new g("not_equal",p.token,"!="),greater_than:new g("greater_than",p.token,">"),greater_than_equal:new g("greater_than_equal",p.token,">="),shift_right:new g("shift_right",p.token,">>"),less_than:new g("less_than",p.token,"<"),less_than_equal:new g("less_than_equal",p.token,"<="),shift_left:new g("shift_left",p.token,"<<"),modulo:new g("modulo",p.token,"%"),minus:new g("minus",p.token,"-"),minus_minus:new g("minus_minus",p.token,"--"),period:new g("period",p.token,"."),plus:new g("plus",p.token,"+"),plus_plus:new g("plus_plus",p.token,"++"),or:new g("or",p.token,"|"),or_or:new g("or_or",p.token,"||"),paren_left:new g("paren_left",p.token,"("),paren_right:new g("paren_right",p.token,")"),semicolon:new g("semicolon",p.token,";"),star:new g("star",p.token,"*"),tilde:new g("tilde",p.token,"~"),underscore:new g("underscore",p.token,"_"),xor:new g("xor",p.token,"^"),plus_equal:new g("plus_equal",p.token,"+="),minus_equal:new g("minus_equal",p.token,"-="),times_equal:new g("times_equal",p.token,"*="),division_equal:new g("division_equal",p.token,"/="),modulo_equal:new g("modulo_equal",p.token,"%="),and_equal:new g("and_equal",p.token,"&="),or_equal:new g("or_equal",p.token,"|="),xor_equal:new g("xor_equal",p.token,"^="),shift_right_equal:new g("shift_right_equal",p.token,">>="),shift_left_equal:new g("shift_left_equal",p.token,"<<=")};d.storage_class=[A.keywords.function,A.keywords.private,A.keywords.workgroup,A.keywords.uniform,A.keywords.storage];d.access_mode=[A.keywords.read,A.keywords.write,A.keywords.read_write];d.sampler_type=[A.keywords.sampler,A.keywords.sampler_comparison];d.sampled_texture_type=[A.keywords.texture_1d,A.keywords.texture_2d,A.keywords.texture_2d_array,A.keywords.texture_3d,A.keywords.texture_cube,A.keywords.texture_cube_array];d.multisampled_texture_type=[A.keywords.texture_multisampled_2d];d.storage_texture_type=[A.keywords.texture_storage_1d,A.keywords.texture_storage_2d,A.keywords.texture_storage_2d_array,A.keywords.texture_storage_3d];d.depth_texture_type=[A.keywords.texture_depth_2d,A.keywords.texture_depth_2d_array,A.keywords.texture_depth_cube,A.keywords.texture_depth_cube_array,A.keywords.texture_depth_multisampled_2d];d.texture_external_type=[A.keywords.texture_external];d.any_texture_type=[...A.sampled_texture_type,...A.multisampled_texture_type,...A.storage_texture_type,...A.depth_texture_type,...A.texture_external_type];d.texel_format=[A.keywords.r8unorm,A.keywords.r8snorm,A.keywords.r8uint,A.keywords.r8sint,A.keywords.r16uint,A.keywords.r16sint,A.keywords.r16float,A.keywords.rg8unorm,A.keywords.rg8snorm,A.keywords.rg8uint,A.keywords.rg8sint,A.keywords.r32uint,A.keywords.r32sint,A.keywords.r32float,A.keywords.rg16uint,A.keywords.rg16sint,A.keywords.rg16float,A.keywords.rgba8unorm,A.keywords.rgba8unorm_srgb,A.keywords.rgba8snorm,A.keywords.rgba8uint,A.keywords.rgba8sint,A.keywords.bgra8unorm,A.keywords.bgra8unorm_srgb,A.keywords.rgb10a2unorm,A.keywords.rg11b10float,A.keywords.rg32uint,A.keywords.rg32sint,A.keywords.rg32float,A.keywords.rgba16uint,A.keywords.rgba16sint,A.keywords.rgba16float,A.keywords.rgba32uint,A.keywords.rgba32sint,A.keywords.rgba32float];d.const_literal=[A.tokens.int_literal,A.tokens.uint_literal,A.tokens.decimal_float_literal,A.tokens.hex_float_literal,A.keywords.true,A.keywords.false];d.literal_or_ident=[A.tokens.ident,A.tokens.int_literal,A.tokens.uint_literal,A.tokens.decimal_float_literal,A.tokens.hex_float_literal];d.element_count_expression=[A.tokens.int_literal,A.tokens.uint_literal,A.tokens.ident];d.template_types=[A.keywords.vec2,A.keywords.vec3,A.keywords.vec4,A.keywords.mat2x2,A.keywords.mat2x3,A.keywords.mat2x4,A.keywords.mat3x2,A.keywords.mat3x3,A.keywords.mat3x4,A.keywords.mat4x2,A.keywords.mat4x3,A.keywords.mat4x4,A.keywords.atomic,A.keywords.bitcast,...A.any_texture_type];d.attribute_name=[A.tokens.ident,A.keywords.block];d.assignment_operators=[A.tokens.equal,A.tokens.plus_equal,A.tokens.minus_equal,A.tokens.times_equal,A.tokens.division_equal,A.tokens.modulo_equal,A.tokens.and_equal,A.tokens.or_equal,A.tokens.xor_equal,A.tokens.shift_right_equal,A.tokens.shift_left_equal];d.increment_operators=[A.tokens.plus_plus,A.tokens.minus_minus];var sn=class{constructor(t,r,n){this.type=t,this.lexeme=r,this.line=n}toString(){return this.lexeme}isTemplateType(){return d.template_types.indexOf(this.type)!=-1}isArrayType(){return this.type==d.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}},eo=class{constructor(t){this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=t??""}scanTokens(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw`Invalid syntax at line ${this._line}`;return this._tokens.push(new sn(d.eof,"",this._line)),this._tokens}scanToken(){let t=this._advance();if(t==`
|
|
147
|
+
`)return this._line++,!0;if(this._isWhitespace(t))return!0;if(t=="/"){if(this._peekAhead()=="/"){for(;t!=`
|
|
148
|
+
`;){if(this._isAtEnd())return!0;t=this._advance()}return this._line++,!0}else if(this._peekAhead()=="*"){this._advance();let n=1;for(;n>0;){if(this._isAtEnd())return!0;if(t=this._advance(),t==`
|
|
149
|
+
`)this._line++;else if(t=="*"){if(this._peekAhead()=="/"&&(this._advance(),n--,n==0))return!0}else t=="/"&&this._peekAhead()=="*"&&(this._advance(),n++)}return!0}}let r=d.none;for(;;){let n=this._findType(t),i=this._peekAhead();if(t==">"&&(i==">"||i=="=")){let o=!1,s=this._tokens.length-1;for(let a=0;a<5&&s>=0;++a,--s)if(this._tokens[s].type===d.tokens.less_than){s>0&&this._tokens[s-1].isArrayOrTemplateType()&&(o=!0);break}if(o)return this._addToken(n),!0}if(n===d.none){let o=t,s=0,a=2;for(let l=0;l<a;++l)if(o+=this._peekAhead(l),n=this._findType(o),n!==d.none){s=l;break}if(n===d.none)return r===d.none?!1:(this._current--,this._addToken(r),!0);t=o,this._current+=s+1}if(r=n,this._isAtEnd())break;t+=this._advance()}return r===d.none?!1:(this._addToken(r),!0)}_findType(t){for(let r in d.keywords){let n=d.keywords[r];if(this._match(t,n.rule))return n}for(let r in d.tokens){let n=d.tokens[r];if(this._match(t,n.rule))return n}return d.none}_match(t,r){if(typeof r=="string"){if(r==t)return!0}else{let n=r.exec(t);if(n&&n.index==0&&n[0]==t)return!0}return!1}_isAtEnd(){return this._current>=this._source.length}_isWhitespace(t){return t==" "||t==" "||t=="\r"}_advance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=this._source[this._current];return t=t||0,t++,this._current+=t,r}_peekAhead(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t=t||0,this._current+t>=this._source.length?"\0":this._source[this._current+t]}_addToken(t){let r=this._source.substring(this._start,this._current);this._tokens.push(new sn(t,r,this._line))}},to=class{constructor(){this._tokens=[],this._current=0,this._context=new Oi}parse(t){this._initialize(t);let r=[];for(;!this._isAtEnd();){let n=this._global_decl_or_directive();if(!n)break;r.push(n)}return r}_initialize(t){if(t)if(typeof t=="string"){let r=new eo(t);this._tokens=r.scanTokens()}else this._tokens=t;else this._tokens=[];this._current=0}_error(t,r){return console.error(t,r),{token:t,message:r,toString:function(){return`${r}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==d.eof}_match(t){if(t instanceof g)return this._check(t)?(this._advance(),!0):!1;for(let r=0,n=t.length;r<n;++r){let i=t[r];if(this._check(i))return this._advance(),!0}return!1}_consume(t,r){if(this._check(t))return this._advance();throw this._error(this._peek(),r)}_check(t){if(this._isAtEnd())return!1;let r=this._peek();if(t instanceof Array){let n=r.type;return t.indexOf(n)!=-1}return r.type==t}_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(d.tokens.semicolon)&&!this._isAtEnd(););if(this._match(d.keywords.alias)){let r=this._type_alias();return this._consume(d.tokens.semicolon,"Expected ';'"),r}if(this._match(d.keywords.enable)){let r=this._enable_directive();return this._consume(d.tokens.semicolon,"Expected ';'"),r}let t=this._attribute();if(this._check(d.keywords.var)){let r=this._global_variable_decl();return r!=null&&(r.attributes=t),this._consume(d.tokens.semicolon,"Expected ';'."),r}if(this._check(d.keywords.override)){let r=this._override_variable_decl();return r!=null&&(r.attributes=t),this._consume(d.tokens.semicolon,"Expected ';'."),r}if(this._check(d.keywords.let)){let r=this._global_let_decl();return r!=null&&(r.attributes=t),this._consume(d.tokens.semicolon,"Expected ';'."),r}if(this._check(d.keywords.const)){let r=this._global_const_decl();return r!=null&&(r.attributes=t),this._consume(d.tokens.semicolon,"Expected ';'."),r}if(this._check(d.keywords.struct)){let r=this._struct_decl();return r!=null&&(r.attributes=t),r}if(this._check(d.keywords.fn)){let r=this._function_decl();return r!=null&&(r.attributes=t),r}return null}_function_decl(){if(!this._match(d.keywords.fn))return null;let t=this._consume(d.tokens.ident,"Expected function name.").toString();this._consume(d.tokens.paren_left,"Expected '(' for function arguments.");let r=[];if(!this._check(d.tokens.paren_right))do{if(this._check(d.tokens.paren_right))break;let o=this._attribute(),s=this._consume(d.tokens.ident,"Expected argument name.").toString();this._consume(d.tokens.colon,"Expected ':' for argument type.");let a=this._attribute(),l=this._type_decl();l!=null&&(l.attributes=a,r.push(new Qi(s,l,o)))}while(this._match(d.tokens.comma));this._consume(d.tokens.paren_right,"Expected ')' after function arguments.");let n=null;if(this._match(d.tokens.arrow)){let o=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=o)}let i=this._compound_statement();return new jr(t,r,n,i)}_compound_statement(){let t=[];for(this._consume(d.tokens.brace_left,"Expected '{' for block.");!this._check(d.tokens.brace_right);){let r=this._statement();r!==null&&t.push(r)}return this._consume(d.tokens.brace_right,"Expected '}' for block."),t}_statement(){for(;this._match(d.tokens.semicolon)&&!this._isAtEnd(););if(this._check(d.keywords.if))return this._if_statement();if(this._check(d.keywords.switch))return this._switch_statement();if(this._check(d.keywords.loop))return this._loop_statement();if(this._check(d.keywords.for))return this._for_statement();if(this._check(d.keywords.while))return this._while_statement();if(this._check(d.keywords.continuing))return this._continuing_statement();if(this._check(d.keywords.static_assert))return this._static_assert_statement();if(this._check(d.tokens.brace_left))return this._compound_statement();let t=null;return this._check(d.keywords.return)?t=this._return_statement():this._check([d.keywords.var,d.keywords.let,d.keywords.const])?t=this._variable_statement():this._match(d.keywords.discard)?t=new Vi:this._match(d.keywords.break)?t=new Hi:this._match(d.keywords.continue)?t=new Xi:t=this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement(),t!=null&&this._consume(d.tokens.semicolon,"Expected ';' after statement."),t}_static_assert_statement(){if(!this._match(d.keywords.static_assert))return null;let t=this._optional_paren_expression();return new wi(t)}_while_statement(){if(!this._match(d.keywords.while))return null;let t=this._optional_paren_expression(),r=this._compound_statement();return new Ci(t,r)}_continuing_statement(){if(!this._match(d.keywords.continuing))return null;let t=this._compound_statement();return new Ni(t)}_for_statement(){if(!this._match(d.keywords.for))return null;this._consume(d.tokens.paren_left,"Expected '('.");let t=this._check(d.tokens.semicolon)?null:this._for_init();this._consume(d.tokens.semicolon,"Expected ';'.");let r=this._check(d.tokens.semicolon)?null:this._short_circuit_or_expression();this._consume(d.tokens.semicolon,"Expected ';'.");let n=this._check(d.tokens.paren_right)?null:this._for_increment();this._consume(d.tokens.paren_right,"Expected ')'.");let i=this._compound_statement();return new Pi(t,r,n,i)}_for_init(){return this._variable_statement()||this._func_call_statement()||this._assignment_statement()}_for_increment(){return this._func_call_statement()||this._increment_decrement_statement()||this._assignment_statement()}_variable_statement(){if(this._check(d.keywords.var)){let t=this._variable_decl();if(t===null)throw this._error(this._peek(),"Variable declaration expected.");let r=null;return this._match(d.tokens.equal)&&(r=this._short_circuit_or_expression()),new Xe(t.name,t.type,t.storage,t.access,r)}if(this._match(d.keywords.let)){let t=this._consume(d.tokens.ident,"Expected name for let.").toString(),r=null;if(this._match(d.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}this._consume(d.tokens.equal,"Expected '=' for let.");let n=this._short_circuit_or_expression();return new Kr(t,r,null,null,n)}if(this._match(d.keywords.const)){let t=this._consume(d.tokens.ident,"Expected name for const.").toString(),r=null;if(this._match(d.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}this._consume(d.tokens.equal,"Expected '=' for const.");let n=this._short_circuit_or_expression();return new Yr(t,r,null,null,n)}return null}_increment_decrement_statement(){let t=this._current,r=this._unary_expression();if(r==null)return null;if(!this._check(d.increment_operators))return this._current=t,null;let n=this._consume(d.increment_operators,"Expected increment operator");return new Ii(n.type===d.tokens.plus_plus?Et.increment:Et.decrement,r)}_assignment_statement(){let t=null;if(this._check(d.tokens.brace_right))return null;let r=this._match(d.tokens.underscore);if(r||(t=this._unary_expression()),!r&&t==null)return null;let n=this._consume(d.assignment_operators,"Expected assignment operator."),i=this._short_circuit_or_expression();return new Mi(pr.parse(n.lexeme),t,i)}_func_call_statement(){if(!this._check(d.tokens.ident))return null;let t=this._current,r=this._consume(d.tokens.ident,"Expected function name."),n=this._argument_expression_list();return n===null?(this._current=t,null):new Di(r.lexeme,n)}_loop_statement(){if(!this._match(d.keywords.loop))return null;this._consume(d.tokens.brace_left,"Expected '{' for loop.");let t=[],r=this._statement();for(;r!==null;){if(Array.isArray(r))for(let i of r)t.push(i);else t.push(r);r=this._statement()}let n=null;return this._match(d.keywords.continuing)&&(n=this._compound_statement()),this._consume(d.tokens.brace_right,"Expected '}' for loop."),new Fi(t,n)}_switch_statement(){if(!this._match(d.keywords.switch))return null;let t=this._optional_paren_expression();this._consume(d.tokens.brace_left,"Expected '{' for switch.");let r=this._switch_body();if(r==null||r.length==0)throw this._error(this._previous(),"Expected 'case' or 'default'.");return this._consume(d.tokens.brace_right,"Expected '}' for switch."),new Bi(t,r)}_switch_body(){let t=[];if(this._match(d.keywords.case)){let r=this._case_selectors();this._match(d.tokens.colon),this._consume(d.tokens.brace_left,"Exected '{' for switch case.");let n=this._case_body();this._consume(d.tokens.brace_right,"Exected '}' for switch case."),t.push(new qi(r,n))}if(this._match(d.keywords.default)){this._match(d.tokens.colon),this._consume(d.tokens.brace_left,"Exected '{' for switch default.");let r=this._case_body();this._consume(d.tokens.brace_right,"Exected '}' for switch default."),t.push(new Zi(r))}if(this._check([d.keywords.default,d.keywords.case])){let r=this._switch_body();t.push(r[0])}return t}_case_selectors(){var t,r,n,i;let o=[(r=(t=this._shift_expression())===null||t===void 0?void 0:t.evaluate(this._context).toString())!==null&&r!==void 0?r:""];for(;this._match(d.tokens.comma);)o.push((i=(n=this._shift_expression())===null||n===void 0?void 0:n.evaluate(this._context).toString())!==null&&i!==void 0?i:"");return o}_case_body(){if(this._match(d.keywords.fallthrough))return this._consume(d.tokens.semicolon,"Expected ';'"),[];let t=this._statement();if(t==null)return[];t instanceof Array||(t=[t]);let r=this._case_body();return r.length==0?t:[...t,r[0]]}_if_statement(){if(!this._match(d.keywords.if))return null;let t=this._optional_paren_expression(),r=this._compound_statement(),n=[];this._match_elseif()&&(n=this._elseif_statement(n));let i=null;return this._match(d.keywords.else)&&(i=this._compound_statement()),new Ui(t,r,n,i)}_match_elseif(){return this._tokens[this._current].type===d.keywords.else&&this._tokens[this._current+1].type===d.keywords.if?(this._advance(),this._advance(),!0):!1}_elseif_statement(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=this._optional_paren_expression(),n=this._compound_statement();return t.push(new Ji(r,n)),this._match_elseif()&&this._elseif_statement(t),t}_return_statement(){if(!this._match(d.keywords.return))return null;let t=this._short_circuit_or_expression();return new ki(t)}_short_circuit_or_expression(){let t=this._short_circuit_and_expr();for(;this._match(d.tokens.or_or);)t=new de(this._previous().toString(),t,this._short_circuit_and_expr());return t}_short_circuit_and_expr(){let t=this._inclusive_or_expression();for(;this._match(d.tokens.and_and);)t=new de(this._previous().toString(),t,this._inclusive_or_expression());return t}_inclusive_or_expression(){let t=this._exclusive_or_expression();for(;this._match(d.tokens.or);)t=new de(this._previous().toString(),t,this._exclusive_or_expression());return t}_exclusive_or_expression(){let t=this._and_expression();for(;this._match(d.tokens.xor);)t=new de(this._previous().toString(),t,this._and_expression());return t}_and_expression(){let t=this._equality_expression();for(;this._match(d.tokens.and);)t=new de(this._previous().toString(),t,this._equality_expression());return t}_equality_expression(){let t=this._relational_expression();return this._match([d.tokens.equal_equal,d.tokens.not_equal])?new de(this._previous().toString(),t,this._relational_expression()):t}_relational_expression(){let t=this._shift_expression();for(;this._match([d.tokens.less_than,d.tokens.greater_than,d.tokens.less_than_equal,d.tokens.greater_than_equal]);)t=new de(this._previous().toString(),t,this._shift_expression());return t}_shift_expression(){let t=this._additive_expression();for(;this._match([d.tokens.shift_left,d.tokens.shift_right]);)t=new de(this._previous().toString(),t,this._additive_expression());return t}_additive_expression(){let t=this._multiplicative_expression();for(;this._match([d.tokens.plus,d.tokens.minus]);)t=new de(this._previous().toString(),t,this._multiplicative_expression());return t}_multiplicative_expression(){let t=this._unary_expression();for(;this._match([d.tokens.star,d.tokens.forward_slash,d.tokens.modulo]);)t=new de(this._previous().toString(),t,this._unary_expression());return t}_unary_expression(){return this._match([d.tokens.minus,d.tokens.bang,d.tokens.tilde,d.tokens.star,d.tokens.and])?new Yi(this._previous().toString(),this._unary_expression()):this._singular_expression()}_singular_expression(){let t=this._primary_expression(),r=this._postfix_expression();return r&&(t.postfix=r),t}_postfix_expression(){if(this._match(d.tokens.bracket_left)){let t=this._short_circuit_or_expression();this._consume(d.tokens.bracket_right,"Expected ']'.");let r=this._postfix_expression();return r&&(t.postfix=r),t}if(this._match(d.tokens.period)){let t=this._consume(d.tokens.ident,"Expected member name."),r=this._postfix_expression(),n=new Jr(t.lexeme);return r&&(n.postfix=r),n}return null}_getStruct(t){return this._context.aliases.has(t)?this._context.aliases.get(t).type:this._context.structs.has(t)?this._context.structs.get(t):null}_primary_expression(){if(this._match(d.tokens.ident)){let n=this._previous().toString();if(this._check(d.tokens.paren_left)){let i=this._argument_expression_list(),o=this._getStruct(n);return o!=null?new lt(o,i):new Li(n,i)}if(this._context.constants.has(n)){let i=this._context.constants.get(n);return new Gr(n,i.value)}return new ji(n)}if(this._match(d.const_literal))return new en(parseFloat(this._previous().toString()));if(this._check(d.tokens.paren_left))return this._paren_expression();if(this._match(d.keywords.bitcast)){this._consume(d.tokens.less_than,"Expected '<'.");let n=this._type_decl();this._consume(d.tokens.greater_than,"Expected '>'.");let i=this._paren_expression();return new $i(n,i)}let t=this._type_decl(),r=this._argument_expression_list();return new Ki(t,r)}_argument_expression_list(){if(!this._match(d.tokens.paren_left))return null;let t=[];do{if(this._check(d.tokens.paren_right))break;let r=this._short_circuit_or_expression();t.push(r)}while(this._match(d.tokens.comma));return this._consume(d.tokens.paren_right,"Expected ')' for agument list"),t}_optional_paren_expression(){this._match(d.tokens.paren_left);let t=this._short_circuit_or_expression();return this._match(d.tokens.paren_right),new tn([t])}_paren_expression(){this._consume(d.tokens.paren_left,"Expected '('.");let t=this._short_circuit_or_expression();return this._consume(d.tokens.paren_right,"Expected ')'."),new tn([t])}_struct_decl(){if(!this._match(d.keywords.struct))return null;let t=this._consume(d.tokens.ident,"Expected name for struct.").toString();this._consume(d.tokens.brace_left,"Expected '{' for struct body.");let r=[];for(;!this._check(d.tokens.brace_right);){let i=this._attribute(),o=this._consume(d.tokens.ident,"Expected variable name.").toString();this._consume(d.tokens.colon,"Expected ':' for struct member type.");let s=this._attribute(),a=this._type_decl();a!=null&&(a.attributes=s),this._check(d.tokens.brace_right)?this._match(d.tokens.comma):this._consume(d.tokens.comma,"Expected ',' for struct member."),r.push(new Gi(o,a,i))}this._consume(d.tokens.brace_right,"Expected '}' after struct body.");let n=new Ie(t,r);return this._context.structs.set(t,n),n}_global_variable_decl(){let t=this._variable_decl();return t&&this._match(d.tokens.equal)&&(t.value=this._const_expression()),t}_override_variable_decl(){let t=this._override_decl();return t&&this._match(d.tokens.equal)&&(t.value=this._const_expression()),t}_global_const_decl(){if(!this._match(d.keywords.const))return null;let t=this._consume(d.tokens.ident,"Expected variable name"),r=null;if(this._match(d.tokens.colon)){let o=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=o)}let n=null;if(this._match(d.tokens.equal)){let o=this._short_circuit_or_expression();if(o instanceof lt)n=o;else if(o instanceof Gr&&o.initializer instanceof lt)n=o.initializer;else try{let s=o.evaluate(this._context);n=new en(s)}catch{n=o}}let i=new Yr(t.toString(),r,"","",n);return this._context.constants.set(i.name,i),i}_global_let_decl(){if(!this._match(d.keywords.let))return null;let t=this._consume(d.tokens.ident,"Expected variable name"),r=null;if(this._match(d.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}let n=null;return this._match(d.tokens.equal)&&(n=this._const_expression()),new Kr(t.toString(),r,"","",n)}_const_expression(){if(this._match(d.const_literal))return new Jr(this._previous().toString());let t=this._type_decl();this._consume(d.tokens.paren_left,"Expected '('.");let r=[];for(;!this._check(d.tokens.paren_right)&&(r.push(this._const_expression()),!!this._check(d.tokens.comma));)this._advance();return this._consume(d.tokens.paren_right,"Expected ')'."),new lt(t,r)}_variable_decl(){if(!this._match(d.keywords.var))return null;let t="",r="";this._match(d.tokens.less_than)&&(t=this._consume(d.storage_class,"Expected storage_class.").toString(),this._match(d.tokens.comma)&&(r=this._consume(d.access_mode,"Expected access_mode.").toString()),this._consume(d.tokens.greater_than,"Expected '>'."));let n=this._consume(d.tokens.ident,"Expected variable name"),i=null;if(this._match(d.tokens.colon)){let o=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=o)}return new Xe(n.toString(),i,t,r,null)}_override_decl(){if(!this._match(d.keywords.override))return null;let t=this._consume(d.tokens.ident,"Expected variable name"),r=null;if(this._match(d.tokens.colon)){let n=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=n)}return new $r(t.toString(),r,null)}_enable_directive(){let t=this._consume(d.tokens.ident,"identity expected.");return new Wi(t.toString())}_type_alias(){let t=this._consume(d.tokens.ident,"identity expected.");this._consume(d.tokens.equal,"Expected '=' for type alias.");let r=this._type_decl();if(r===null)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(r.name)&&(r=this._context.aliases.get(r.name).type);let n=new qr(t.toString(),r);return this._context.aliases.set(n.name,n),n}_type_decl(){if(this._check([d.tokens.ident,...d.texel_format,d.keywords.bool,d.keywords.f32,d.keywords.i32,d.keywords.u32])){let n=this._advance(),i=n.toString();return this._context.structs.has(i)?this._context.structs.get(i):this._context.aliases.has(i)?this._context.aliases.get(i).type:new De(n.toString())}let t=this._texture_sampler_types();if(t)return t;if(this._check(d.template_types)){let n=this._advance().toString(),i=null,o=null;return this._match(d.tokens.less_than)&&(i=this._type_decl(),o=null,this._match(d.tokens.comma)&&(o=this._consume(d.access_mode,"Expected access_mode for pointer").toString()),this._consume(d.tokens.greater_than,"Expected '>' for type.")),new Zr(n,i,o)}if(this._match(d.keywords.ptr)){let n=this._previous().toString();this._consume(d.tokens.less_than,"Expected '<' for pointer.");let i=this._consume(d.storage_class,"Expected storage_class for pointer");this._consume(d.tokens.comma,"Expected ',' for pointer.");let o=this._type_decl(),s=null;return this._match(d.tokens.comma)&&(s=this._consume(d.access_mode,"Expected access_mode for pointer").toString()),this._consume(d.tokens.greater_than,"Expected '>' for pointer."),new zi(n,i.toString(),o,s)}let r=this._attribute();if(this._match(d.keywords.array)){let n=null,i=-1,o=this._previous();if(this._match(d.tokens.less_than)){n=this._type_decl(),this._context.aliases.has(n.name)&&(n=this._context.aliases.get(n.name).type);let s="";this._match(d.tokens.comma)&&(s=this._shift_expression().evaluate(this._context).toString()),this._consume(d.tokens.greater_than,"Expected '>' for array."),i=s?parseInt(s):0}return new Qr(o.toString(),r,n,i)}return null}_texture_sampler_types(){if(this._match(d.sampler_type))return new at(this._previous().toString(),null,null);if(this._match(d.depth_texture_type))return new at(this._previous().toString(),null,null);if(this._match(d.sampled_texture_type)||this._match(d.multisampled_texture_type)){let t=this._previous();this._consume(d.tokens.less_than,"Expected '<' for sampler type.");let r=this._type_decl();return this._consume(d.tokens.greater_than,"Expected '>' for sampler type."),new at(t.toString(),r,null)}if(this._match(d.storage_texture_type)){let t=this._previous();this._consume(d.tokens.less_than,"Expected '<' for sampler type.");let r=this._consume(d.texel_format,"Invalid texel format.").toString();this._consume(d.tokens.comma,"Expected ',' after texel format.");let n=this._consume(d.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(d.tokens.greater_than,"Expected '>' for sampler type."),new at(t.toString(),r,n)}return null}_attribute(){let t=[];for(;this._match(d.tokens.attr);){let r=this._consume(d.attribute_name,"Expected attribute name"),n=new on(r.toString(),null);if(this._match(d.tokens.paren_left)){if(n.value=this._consume(d.literal_or_ident,"Expected attribute value").toString(),this._check(d.tokens.comma)){this._advance();do{let i=this._consume(d.literal_or_ident,"Expected attribute value").toString();n.value instanceof Array||(n.value=[n.value]),n.value.push(i)}while(this._match(d.tokens.comma))}this._consume(d.tokens.paren_right,"Expected ')'")}t.push(n)}for(;this._match(d.tokens.attr_left);){if(!this._check(d.tokens.attr_right))do{let r=this._consume(d.attribute_name,"Expected attribute name"),n=new on(r.toString(),null);if(this._match(d.tokens.paren_left)){if(n.value=[this._consume(d.literal_or_ident,"Expected attribute value").toString()],this._check(d.tokens.comma)){this._advance();do{let i=this._consume(d.literal_or_ident,"Expected attribute value").toString();n.value.push(i)}while(this._match(d.tokens.comma))}this._consume(d.tokens.paren_right,"Expected ')'")}t.push(n)}while(this._match(d.tokens.comma));this._consume(d.tokens.attr_right,"Expected ']]' after attribute declarations")}return t.length==0?null:t}},ze=class{constructor(t,r){this.name=t,this.attributes=r,this.size=0}get isArray(){return!1}get isStruct(){return!1}get isTemplate(){return!1}},an=class{constructor(t,r,n){this.name=t,this.type=r,this.attributes=n,this.offset=0,this.size=0}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},St=class extends ze{constructor(t,r){super(t,r),this.members=[],this.align=0}get isStruct(){return!0}},gr=class extends ze{constructor(t,r){super(t,r),this.count=0,this.stride=0}get isArray(){return!0}},ln=class extends ze{constructor(t,r,n,i){super(t,n),this.format=r,this.access=i}get isTemplate(){return!0}},He;(function(e){e[e.Uniform=0]="Uniform",e[e.Storage=1]="Storage",e[e.Texture=2]="Texture",e[e.Sampler=3]="Sampler",e[e.StorageTexture=4]="StorageTexture"})(He||(He={}));var xt=class{constructor(t,r,n,i,o,s,a){this.name=t,this.type=r,this.group=n,this.binding=i,this.attributes=o,this.resourceType=s,this.access=a}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},ro=class{constructor(t,r){this.name=t,this.type=r}},Rt=class{constructor(t,r){this.align=t,this.size=r}},no=class{constructor(t,r,n,i){this.name=t,this.type=r,this.locationType=n,this.location=i,this.interpolation=null}},un=class{constructor(t,r,n,i){this.name=t,this.type=r,this.locationType=n,this.location=i}},io=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.stage=null,this.inputs=[],this.outputs=[],this.name=t,this.stage=r}},oo=class{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}},so=class{constructor(t,r,n,i){this.name=t,this.type=r,this.attributes=n,this.id=i}},he=class{constructor(t){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new oo,this._types=new Map,t&&this.update(t)}_isStorageTexture(t){return t.name=="texture_storage_1d"||t.name=="texture_storage_2d"||t.name=="texture_storage_2d_array"||t.name=="texture_storage_3d"}update(t){let n=new to().parse(t);for(let i of n){if(i instanceof Ie){let o=this._getTypeInfo(i,null);o instanceof St&&this.structs.push(o);continue}if(i instanceof qr){this.aliases.push(this._getAliasInfo(i));continue}if(i instanceof $r){let o=i,s=this._getAttributeNum(o.attributes,"id",0),a=o.type!=null?this._getTypeInfo(o.type,o.attributes):null;this.overrides.push(new so(o.name,a,o.attributes,s));continue}if(this._isUniformVar(i)){let o=i,s=this._getAttributeNum(o.attributes,"group",0),a=this._getAttributeNum(o.attributes,"binding",0),l=this._getTypeInfo(o.type,o.attributes),u=new xt(o.name,l,s,a,o.attributes,He.Uniform,o.access);this.uniforms.push(u);continue}if(this._isStorageVar(i)){let o=i,s=this._getAttributeNum(o.attributes,"group",0),a=this._getAttributeNum(o.attributes,"binding",0),l=this._getTypeInfo(o.type,o.attributes),u=this._isStorageTexture(l),c=new xt(o.name,l,s,a,o.attributes,u?He.StorageTexture:He.Storage,o.access);this.storage.push(c);continue}if(this._isTextureVar(i)){let o=i,s=this._getAttributeNum(o.attributes,"group",0),a=this._getAttributeNum(o.attributes,"binding",0),l=this._getTypeInfo(o.type,o.attributes),u=this._isStorageTexture(l),c=new xt(o.name,l,s,a,o.attributes,u?He.StorageTexture:He.Texture,o.access);u?this.storage.push(c):this.textures.push(c);continue}if(this._isSamplerVar(i)){let o=i,s=this._getAttributeNum(o.attributes,"group",0),a=this._getAttributeNum(o.attributes,"binding",0),l=this._getTypeInfo(o.type,o.attributes),u=new xt(o.name,l,s,a,o.attributes,He.Sampler,o.access);this.samplers.push(u);continue}if(i instanceof jr){let o=this._getAttribute(i,"vertex"),s=this._getAttribute(i,"fragment"),a=this._getAttribute(i,"compute"),l=o||s||a;if(l){let u=new io(i.name,l.name);u.inputs=this._getInputs(i.args),u.outputs=this._getOutputs(i.returnType),this.entry[l.name].push(u)}continue}}}getBindGroups(){let t=[];function r(n,i){n>=t.length&&(t.length=n+1),t[n]===void 0&&(t[n]=[]),i>=t[n].length&&(t[n].length=i+1)}for(let n of this.uniforms){r(n.group,n.binding);let i=t[n.group];i[n.binding]=n}for(let n of this.storage){r(n.group,n.binding);let i=t[n.group];i[n.binding]=n}for(let n of this.textures){r(n.group,n.binding);let i=t[n.group];i[n.binding]=n}for(let n of this.samplers){r(n.group,n.binding);let i=t[n.group];i[n.binding]=n}return t}_getOutputs(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;if(r===void 0&&(r=[]),t instanceof Ie)this._getStructOutputs(t,r);else{let n=this._getOutputInfo(t);n!==null&&r.push(n)}return r}_getStructOutputs(t,r){for(let n of t.members)if(n.type instanceof Ie)this._getStructOutputs(n.type,r);else{let i=this._getAttribute(n,"location")||this._getAttribute(n,"builtin");if(i!==null){let o=this._getTypeInfo(n.type,n.type.attributes),s=this._parseInt(i.value),a=new un(n.name,o,i.name,s);r.push(a)}}}_getOutputInfo(t){let r=this._getAttribute(t,"location")||this._getAttribute(t,"builtin");if(r!==null){let n=this._getTypeInfo(t,t.attributes),i=this._parseInt(r.value);return new un("",n,r.name,i)}return null}_getInputs(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;r===void 0&&(r=[]);for(let n of t)if(n.type instanceof Ie)this._getStructInputs(n.type,r);else{let i=this._getInputInfo(n);i!==null&&r.push(i)}return r}_getStructInputs(t,r){for(let n of t.members)if(n.type instanceof Ie)this._getStructInputs(n.type,r);else{let i=this._getInputInfo(n);i!==null&&r.push(i)}}_getInputInfo(t){let r=this._getAttribute(t,"location")||this._getAttribute(t,"builtin");if(r!==null){let n=this._getAttribute(t,"interpolation"),i=this._getTypeInfo(t.type,t.attributes),o=this._parseInt(r.value),s=new no(t.name,i,r.name,o);return n!==null&&(s.interpolation=this._parseString(n.value)),s}return null}_parseString(t){return t instanceof Array&&(t=t[0]),t}_parseInt(t){t instanceof Array&&(t=t[0]);let r=parseInt(t);return isNaN(r)?t:r}_getAlias(t){for(let r of this.aliases)if(r.name==t)return r.type;return null}_getAliasInfo(t){return new ro(t.name,this._getTypeInfo(t.type,null))}_getTypeInfo(t,r){if(this._types.has(t))return this._types.get(t);if(t instanceof Qr){let i=t,o=this._getTypeInfo(i.format,i.attributes),s=new gr(i.name,r);return s.format=o,s.count=i.count,this._types.set(t,s),this._updateTypeInfo(s),s}if(t instanceof Ie){let i=t,o=new St(i.name,r);for(let s of i.members){let a=this._getTypeInfo(s.type,s.attributes);o.members.push(new an(s.name,a,s.attributes))}return this._types.set(t,o),this._updateTypeInfo(o),o}if(t instanceof at){let i=t,o=i.format instanceof De,s=i.format?o?this._getTypeInfo(i.format,null):new ze(i.format,null):null,a=new ln(i.name,s,r,i.access);return this._types.set(t,a),this._updateTypeInfo(a),a}if(t instanceof Zr){let i=t,o=i.format?this._getTypeInfo(i.format,null):null,s=new ln(i.name,o,r,i.access);return this._types.set(t,s),this._updateTypeInfo(s),s}let n=new ze(t.name,r);return this._types.set(t,n),this._updateTypeInfo(n),n}_updateTypeInfo(t){var r,n;let i=this._getTypeSize(t);if(t.size=(r=i?.size)!==null&&r!==void 0?r:0,t instanceof gr){let o=this._getTypeSize(t.format);t.stride=(n=o?.size)!==null&&n!==void 0?n:0,this._updateTypeInfo(t.format)}t instanceof St&&this._updateStructInfo(t)}_updateStructInfo(t){var r;let n=0,i=0,o=0,s=0;for(let a=0,l=t.members.length;a<l;++a){let u=t.members[a],c=this._getTypeSize(u);if(!c)continue;(r=this._getAlias(u.type.name))!==null&&r!==void 0||u.type;let f=c.align,h=c.size;n=this._roundUp(f,n+i),i=h,o=n,s=Math.max(s,f),u.offset=n,u.size=h,this._updateTypeInfo(u.type)}t.size=this._roundUp(s,o+i),t.align=s}_getTypeSize(t){var r;if(t==null)return null;let n=this._getAttributeNum(t.attributes,"size",0),i=this._getAttributeNum(t.attributes,"align",0);if(t instanceof an&&(t=t.type),t instanceof ze){let o=this._getAlias(t.name);o!==null&&(t=o)}{let o=he._typeInfo[t.name];if(o!==void 0){let s=t.format==="f16"?2:1;return new Rt(Math.max(i,o.align/s),Math.max(n,o.size/s))}}{let o=he._typeInfo[t.name.substring(0,t.name.length-1)];if(o){let s=t.name[t.name.length-1]==="h"?2:1;return new Rt(Math.max(i,o.align/s),Math.max(n,o.size/s))}}if(t instanceof gr){let o=t,s=8,a=8,l=this._getTypeSize(o.format);l!==null&&(a=l.size,s=l.align);let u=o.count,c=this._getAttributeNum((r=t?.attributes)!==null&&r!==void 0?r:null,"stride",this._roundUp(s,a));return a=u*c,n&&(a=n),new Rt(Math.max(i,s),Math.max(n,a))}if(t instanceof St){let o=0,s=0,a=0,l=0,u=0;for(let c of t.members){let f=this._getTypeSize(c.type);f!==null&&(o=Math.max(f.align,o),a=this._roundUp(f.align,a+l),l=f.size,u=a)}return s=this._roundUp(o,u+l),new Rt(Math.max(i,o),Math.max(n,s))}return null}_isUniformVar(t){return t instanceof Xe&&t.storage=="uniform"}_isStorageVar(t){return t instanceof Xe&&t.storage=="storage"}_isTextureVar(t){return t instanceof Xe&&t.type!==null&&he._textureTypes.indexOf(t.type.name)!=-1}_isSamplerVar(t){return t instanceof Xe&&t.type!==null&&he._samplerTypes.indexOf(t.type.name)!=-1}_getAttribute(t,r){let n=t;if(!n||!n.attributes)return null;let i=n.attributes;for(let o of i)if(o.name==r)return o;return null}_getAttributeNum(t,r,n){if(t===null)return n;for(let i of t)if(i.name==r){let o=i!==null&&i.value!==null?i.value:n;return o instanceof Array&&(o=o[0]),typeof o=="number"?o:typeof o=="string"?parseInt(o):n}return n}_roundUp(t,r){return Math.ceil(r/t)*t}};he._typeInfo={f16:{align:2,size:2},i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},atomic:{align:4,size:4},vec2:{align:8,size:8},vec3:{align:16,size:12},vec4:{align:16,size:16},mat2x2:{align:8,size:16},mat3x2:{align:8,size:24},mat4x2:{align:8,size:32},mat2x3:{align:16,size:32},mat3x3:{align:16,size:48},mat4x3:{align:16,size:64},mat2x4:{align:16,size:32},mat3x4:{align:16,size:48},mat4x4:{align:16,size:64}};he._textureTypes=d.any_texture_type.map(e=>e.name);he._samplerTypes=d.sampler_type.map(e=>e.name);function cn(e){let t={attributes:[],bindings:[]},r=af(e);for(let o of r.uniforms){let s=[];for(let a of o.type.members)s.push({name:a.name,type:Xs(a.type)});t.bindings.push({type:"uniform",name:o.name,location:o.binding,group:o.group,members:s})}let n=r.entry.vertex[0],i=n.inputs.length;for(let o=0;o<i;o++){let s=n.inputs[o];if(s.locationType==="location"){let a=Xs(s.type);t.attributes.push({name:s.name,location:s.location,type:a})}}return t}function Xs(e){return e.format?`${e.name}<${e.format.name}>`:e.name}function af(e){try{return new he(e)}catch(t){if(t instanceof Error)throw t;let r="WGSL parse error";throw typeof t=="object"&&t!==null&&t!==void 0&&t.message&&(r+=`: ${t.message} `),typeof t=="object"&&t!==null&&t!==void 0&&t.token&&(r+=t.token.line||""),new Error(r,{cause:t})}}function ao(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Math.fround(e),i=e-n;return t[r]=n,t[r+1]=i,t}function zs(e){return e-Math.fround(e)}function Ls(e){let t=new Float32Array(32);for(let r=0;r<4;++r)for(let n=0;n<4;++n){let i=r*4+n;ao(e[n*4+r],t,i*2)}return t}var js=K`\
|
|
147
150
|
uniform float ONE;
|
|
148
151
|
|
|
149
152
|
/*
|
|
@@ -309,9 +312,9 @@ vec2 sqrt_fp64(vec2 a) {
|
|
|
309
312
|
return sum_fp64(vec2(yn, 0.0), prod);
|
|
310
313
|
#endif
|
|
311
314
|
}
|
|
312
|
-
`;var Df={ONE:1};function Ff(){return Df}var it={name:"fp64-arithmetic",vs:Ao,getUniforms:Ff,fp64ify:Wn,fp64LowPart:_o,fp64ifyMatrix4:po};var Hn=P(I(),1);var vr=class{constructor(t){this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;let r=zt(Object.values(t));Hn.log.log(1,"Creating ShaderInputs with modules",r.map(n=>n.name))(),this.modules=t,this.moduleUniforms={},this.moduleBindings={};for(let[n,i]of Object.entries(t)){let o=n;this.moduleUniforms[o]=i.defaultUniforms||{},this.moduleBindings[o]={}}}destroy(){}setProps(t){for(let n of Object.keys(t)){var r;let i=n,o=t[i],a=this.modules[i];if(!a){Hn.log.warn(`Module ${n} not found`)();continue}let s=this.moduleUniforms[i],l=((r=a.getUniforms)===null||r===void 0?void 0:r.call(a,o,this.moduleUniforms[i]))||o;this.moduleUniforms[i]={...s,...l}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let t={};for(let r of Object.values(this.moduleBindings))Object.assign(t,r);return t}getDebugTable(){let t={};for(let[n,i]of Object.entries(this.moduleUniforms))for(let[o,a]of Object.entries(i)){var r;t[`${n}.${o}`]={type:(r=this.modules[n].uniformTypes)===null||r===void 0?void 0:r[o],value:String(a)}}return t}};var Se=P(I(),1),mr=class{constructor(t){this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=t.id||(0,Se.uid)("geometry"),this.topology=t.topology,this.indices=t.indices||null,this.attributes=t.attributes,this.vertexCount=t.vertexCount,this.bufferLayout=t.bufferLayout||[],this.indices&&(0,Se.assert)(this.indices.usage===Se.Buffer.INDEX)}destroy(){var t;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(t=this.attributes.colors)===null||t===void 0||t.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(t){return t.byteLength/12}};function To(e,t){if(t instanceof mr)return t;let r=wf(e,t),{attributes:n,bufferLayout:i}=Bf(e,t);return new mr({topology:t.topology||"triangle-list",bufferLayout:i,vertexCount:t.vertexCount,indices:r,attributes:n})}function wf(e,t){if(!t.indices)return;let r=t.indices.value;return e.createBuffer({usage:Se.Buffer.INDEX,data:r})}function Bf(e,t){let r=[],n={};for(let[o,a]of Object.entries(t.attributes)){let s=o;switch(o){case"POSITION":s="positions";break;case"NORMAL":s="normals";break;case"TEXCOORD_0":s="texCoords";break;case"COLOR_0":s="colors";break}n[s]=e.createBuffer({data:a.value,id:`${o}-buffer`});let{value:l,size:f,normalized:u}=a;r.push({name:s,format:(0,Se.getVertexFormatFromAttribute)(l,f,u)})}let i=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:i}}var vo=P(I(),1),Ne=class{static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new Ne(t),t._lumaData.defaultPipelineFactory}constructor(t){this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=t}createRenderPipeline(t){let r={...Ne.defaultProps,...t},n=this._hashRenderPipeline({...r});if(!this._pipelineCache[n]){let i=this.device.createRenderPipeline({...r,vs:this.device.createShader({stage:"vertex",source:r.vs}),fs:r.fs?this.device.createShader({stage:"fragment",source:r.fs}):null});i.hash=n,this._pipelineCache[n]=i,this._useCounts[n]=0}return this._useCounts[n]++,this._pipelineCache[n]}release(t){let r=t.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._pipelineCache[r].destroy(),delete this._pipelineCache[r],delete this._useCounts[r])}_createRenderPipeline(t){if(!t.fs)throw new Error("fs");return this.device.createRenderPipeline({...t,vs:this.device.createShader({stage:"vertex",source:t.vs}),fs:t.fs?this.device.createShader({stage:"fragment",source:t.fs}):null})}_hashRenderPipeline(t){let r=this._getHash(t.vs),n=t.fs?this._getHash(t.fs):0,i="-";switch(this.device.info.type){case"webgpu":let o=this._getHash(JSON.stringify(t.parameters)),a=this._getHash(JSON.stringify(t.bufferLayout));return`${r}/${n}V${i}T${t.topology}P${o}BL${a}}`;default:return`${r}/${n}V${i}`}}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}};Ne.defaultProps={...vo.RenderPipeline.defaultProps,vs:void 0,fs:void 0};function mo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r={},n=`Shader Layout for ${t}`;for(let i of e.attributes)if(i){let o=`${i.location} ${i.name}: ${i.type}`;r[`in ${o}`]={[n]:i.stepMode||"vertex"}}for(let i of e.varyings||[]){let o=`${i.location} ${i.name}`;r[`out ${o}`]={[n]:JSON.stringify(i.accessor)}}return r}var br=2,Uf=1e4,Y=class{constructor(t,r){var n,i,o;this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.vertexArray=void 0,this.transformFeedback=null,this.pipeline=void 0,this.shaderInputs=void 0,this._uniformStore=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this._lastLogTime=0,this._logOpen=!1,this.props={...Y.defaultProps,...r},r=this.props,this.id=r.id||(0,z.uid)("model"),this.device=t,Object.assign(this.userData,r.userData);let a=Object.fromEntries(((n=this.props.modules)===null||n===void 0?void 0:n.map(d=>[d.name,d]))||[]);this.setShaderInputs(r.shaderInputs||new vr(a));let s=Wf(t),l=(((i=this.props.modules)===null||i===void 0?void 0:i.length)>0?this.props.modules:(o=this.shaderInputs)===null||o===void 0?void 0:o.getModules())||[],{vs:f,fs:u,getUniforms:c}=this.props.shaderAssembler.assembleShaders({platformInfo:s,...this.props,modules:l});if(this.vs=f,this.fs=u,this._getModuleUniforms=c,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&(this._gpuGeometry=this.setGeometry(r.geometry)),this.pipelineFactory=r.pipelineFactory||Ne.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=t.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),r.vertexCount&&this.setVertexCount(r.vertexCount),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&(z.log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")(),this.updateModuleSettings(r.moduleSettings)),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this.pipelineFactory.release(this.pipeline),this._uniformStore.destroy()}predraw(){this.updateShaderInputs()}draw(t){this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:t,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,transformFeedback:this.transformFeedback})}finally{this._logDrawCallEnd()}}setGeometry(t){let r=t&&To(this.device,t);return this.setTopology(r.topology||"triangle-list"),this.bufferLayout=bo(this.bufferLayout,r.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r),r}_setGeometryAttributes(t){this.vertexCount=t.vertexCount,this.setAttributes(t.attributes,"ignore-unknown"),this.setIndexBuffer(t.indices)}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){this.bufferLayout=this._gpuGeometry?bo(t,this._gpuGeometry.bufferLayout):t,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(t){(0,z.deepEqual)(t,this.parameters,2)||(this.parameters=t,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(t){this.vertexCount=t}setInstanceCount(t){this.instanceCount=t}setShaderInputs(t){this.shaderInputs=t,this._uniformStore=new Sr.UniformStore(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let n=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=n}}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues())}updateModuleSettings(t){z.log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();let{bindings:r,uniforms:n}=(0,z.splitUniformsAndBindings)(this._getModuleUniforms(t));Object.assign(this.bindings,r),Object.assign(this.uniforms,n)}setBindings(t){Object.assign(this.bindings,t)}setUniforms(t){this.pipeline.setUniforms(t),Object.assign(this.uniforms,t)}setIndexBuffer(t){this.vertexArray.setIndexBuffer(t)}setTransformFeedback(t){this.transformFeedback=t}setAttributes(t,r){t.indices&&z.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[i,o]of Object.entries(t)){var n;let a=this.bufferLayout.find(f=>f.name===i);if(!a){z.log.warn(`Model(${this.id}): Missing layout for buffer "${i}".`)();continue}let s=a.attributes?(n=a.attributes)===null||n===void 0?void 0:n.map(f=>f.attribute):[a.name],l=!1;for(let f of s){let u=this._attributeInfos[f];u&&(this.vertexArray.setBuffer(u.location,o),l=!0)}!l&&r!=="ignore-unknown"&&z.log.warn(`Model(${this.id}): Ignoring buffer "${o.id}" for unknown attribute "${i}"`)()}}setConstantAttributes(t){for(let[r,n]of Object.entries(t)){let i=this._attributeInfos[r];i?this.vertexArray.setConstant(i.location,n):z.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${r}"`)()}}_setPipelineNeedsUpdate(t){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||t}_updatePipeline(){return this._pipelineNeedsUpdate&&(this.pipeline&&z.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null}),this._attributeInfos=(0,So.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline}_logDrawCallStart(){let t=z.log.level>3?0:Uf;Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,z.log.group(br,`>>> DRAWING MODEL ${this.id}`,{collapsed:z.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let t=mo(this.pipeline.shaderLayout);z.log.table(br,t)();let r=this.shaderInputs.getDebugTable();for(let[n,i]of Object.entries(this.uniforms))r[n]={value:i};z.log.table(br,r)(),z.log.groupEnd(br)(),this._logOpen=!1}}};Y.defaultProps={...Sr.RenderPipeline.defaultProps,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,transformFeedback:void 0,shaderAssembler:le.getDefaultShaderAssembler()};function bo(e,t){let r=[...e];for(let n of t){let i=r.findIndex(o=>o.name===n.name);i<0?r.push(n):r[i]=n}return r}function Wf(e){return{type:e.info.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,features:e.features}}var Hf="transform_output",Me=class{constructor(t,r){this.device=void 0,this.model=void 0,this.sampler=void 0,this.currentIndex=0,this.samplerTextureMap=null,this.bindings=[],this.resources={},this.device=t,this.sampler=t.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new Y(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Un({version:300,input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:Hf}),vertexCount:r.vertexCount,...r}),this._initialize(r),Object.seal(this)}destroy(){}delete(){this.destroy()}run(t){let{framebuffer:r}=this.bindings[this.currentIndex],n=this.device.beginRenderPass({framebuffer:r,...t});this.model.draw(n),n.end()}update(){console.warn("TextureTransform#update() not implemented")}getData(){let{packed:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("getData() not implemented")}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(t){this._updateBindings(t)}_updateBindings(t){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t)}_updateBinding(t,r){let{sourceBuffers:n,sourceTextures:i,targetTexture:o}=r;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,i),Object.assign(t.sourceBuffers,n),o){t.targetTexture=o;let{width:a,height:s}=o;t.framebuffer&&t.framebuffer.destroy(),t.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:a,height:s,colorAttachments:[o]}),t.framebuffer.resize({width:a,height:s})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:r}=this.bindings[t];for(let n in r)r[n].sampler=this.sampler}};var ot=P(I(),1),Re=class{constructor(t){this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};let{attributes:r={},indices:n=null,vertexCount:i=null}=t;this.id=t.id||(0,ot.uid)("geometry"),this.topology=t.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(let[o,a]of Object.entries(r)){let s=ArrayBuffer.isView(a)?{value:a}:a;(0,ot.assert)(ArrayBuffer.isView(s.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!s.size&&(s.size=3),o==="indices"?((0,ot.assert)(!this.indices),this.indices=s):this.attributes[o]=s}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=i||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,r){return this}_calculateVertexCount(t,r){if(r)return r.value.length;let n=1/0;for(let i of Object.values(t)){let{value:o,size:a,constant:s}=i;!s&&o&&a>=1&&(n=Math.min(n,o.length/a))}return(0,ot.assert)(Number.isFinite(n)),n}};var Ro=P(I(),1);var kt=class extends Re{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=(0,Ro.uid)("cube-geometry"),indices:n=!0}=t;super(n?{...t,id:r,topology:"triangle-list",indices:{size:1,value:Vf},attributes:{...Kf,...t.attributes}}:{...t,id:r,topology:"triangle-list",indices:void 0,attributes:{...Yf,...t.attributes}})}},Vf=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]),Xf=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,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,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),Lf=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),zf=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),jf=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,-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,-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,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,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]),kf=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),$f=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),Kf={POSITION:{size:3,value:Xf},NORMAL:{size:3,value:Lf},TEXCOORD_0:{size:2,value:zf}},Yf={POSITION:{size:4,value:jf},TEXCOORD_0:{size:2,value:kf},COLOR_0:{size:3,value:$f}};var Zf="Failed to create WebGL context in Node.js, headless gl returned null",qf=" luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL contexts can not be created. This may not be an error. For example, this is a typical configuration for isorender applications running on the server.",Qf={width:1,height:1,debug:!0,throwOnError:!1},Vn=null;function yo(){return Vn!==null}function Eo(e){e={...Qf,...e};let{width:t,height:r,webgl1:n,webgl2:i}=e;if(i&&!n)throw new Error("headless-gl does not support WebGL2");if(!Vn)throw new Error(qf);let o=Vn(t,r,e);if(!o)throw new Error(Zf);return o}var H=P(I(),1);function $t(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function fe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||$t()}var Xp=globalThis.self||globalThis.window||globalThis.global,Lp=globalThis.window||globalThis.self||globalThis.global,zp=globalThis.document||{},jp=globalThis.process||{},kp=globalThis.console,xo=globalThis.navigator||{};var Xn=globalThis;function Rr(e){if(!e&&!fe())return"Node";if($t(e))return"Electron";let t=e||xo.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Xn.chrome?"Chrome":Xn.safari?"Safari":Xn.mozInnerScreenX?"Firefox":"Unknown"}var wo=P(I(),1);var Kt={};function Jf(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function Gf(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function eu(e,t){Kt[e]=!0,t!==void 0&&Jf(t)}function tu(e){let t=e.getError;e.getError=function(){let n;do n=t.apply(e),n!==0&&(Kt[n]=!0);while(n!==0);for(n in Kt)if(Kt[n])return delete Kt[n],parseInt(n,10);return 0}}var Yt=function e(t){let r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let n=0;n<this.attribs.length;n++){let i=new e.VertexAttrib(r);this.attribs[n]=i}this.maxAttrib=0};Yt.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()};Yt.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var je=function(t){let r=this;this.gl=t,tu(t);let n=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(o){return o===r.VERTEX_ARRAY_BINDING_OES?r.currentVertexArrayObject===r.defaultVertexArrayObject?null:r.currentVertexArrayObject:n.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(o){let a=r.currentVertexArrayObject;a.maxAttrib=Math.max(a.maxAttrib,o);let s=a.attribs[o];return s.enabled=!0,n.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(o){let a=r.currentVertexArrayObject;a.maxAttrib=Math.max(a.maxAttrib,o);let s=a.attribs[o];return s.enabled=!1,n.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(o,a){switch(o){case 34962:r.currentArrayBuffer=a;break;case 34963:r.currentVertexArrayObject.elementArrayBuffer=a;break;default:}return n.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(o,a){let l=r.currentVertexArrayObject.attribs[o];switch(a){case 34975:return l.buffer;case 34338:return l.enabled;case 34339:return l.size;case 34340:return l.stride;case 34341:return l.type;case 34922:return l.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(o,a,s,l,f,u){let c=r.currentVertexArrayObject;c.maxAttrib=Math.max(c.maxAttrib,o);let d=c.attribs[o];return d.buffer=r.currentArrayBuffer,d.size=a,d.type=s,d.normalized=l,d.stride=f,d.offset=u,d.recache(),n.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",()=>{Gf("OESVertexArrayObject emulation library context restored"),r.reset_()},!0),this.reset_()};je.prototype.VERTEX_ARRAY_BINDING_OES=34229;je.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let n=0;n<this.vertexArrayObjects.length;++n)this.vertexArrayObjects.isAlive=!1;let r=this.gl;this.maxVertexAttribs=r.getParameter(34921),this.defaultVertexArrayObject=new Yt(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};je.prototype.createVertexArrayOES=function(){let t=new Yt(this);return this.vertexArrayObjects.push(t),t};je.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};je.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof Yt&&t.hasBeenBound&&t.ext===this)};je.prototype.bindVertexArrayOES=function(t){let r=this.gl;if(t&&!t.isAlive){eu(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject");return}let n=this.original,i=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;let o=this.currentVertexArrayObject;if(i===o)return;(!i||o.elementArrayBuffer!==i.elementArrayBuffer)&&n.bindBuffer.call(r,34963,o.elementArrayBuffer);let a=this.currentArrayBuffer,s=Math.max(i?i.maxAttrib:0,o.maxAttrib);for(let l=0;l<=s;l++){let f=o.attribs[l],u=i?i.attribs[l]:null;if((!i||f.enabled!==u.enabled)&&(f.enabled?n.enableVertexAttribArray.call(r,l):n.disableVertexAttribArray.call(r,l)),f.enabled){let c=!1;(!i||f.buffer!==u.buffer)&&(a!==f.buffer&&(n.bindBuffer.call(r,34962,f.buffer),a=f.buffer),c=!0),(c||f.cached!==u.cached)&&n.vertexAttribPointer.call(r,l,f.size,f.type,f.normalized,f.stride,f.offset)}}this.currentArrayBuffer!==a&&n.bindBuffer.call(r,34962,this.currentArrayBuffer)};function Oo(e){if(typeof e.createVertexArray=="function")return;let t=e.getSupportedExtensions;e.getSupportedExtensions=function(){let i=t.call(this)||[];return i.indexOf("OES_vertex_array_object")<0&&i.push("OES_vertex_array_object"),i};let r=e.getExtension;e.getExtension=function(i){let o=r.call(this,i);return o||(i!=="OES_vertex_array_object"?null:(e.__OESVertexArrayObject||(this.__OESVertexArrayObject=new je(this)),this.__OESVertexArrayObject))}}var ke=P(I(),1);var Co=P(I(),1),ru="Invalid WebGLRenderingContext";function nu(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function D(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Ln(e){return D(e)?e:null}function Po(e){return(0,Co.assert)(nu(e),ru),e}var No="OES_element_index",Mo="WEBGL_draw_buffers",iu="EXT_disjoint_timer_query",ou="EXT_disjoint_timer_query_webgl2",au="EXT_texture_filter_anisotropic",Io="WEBGL_debug_renderer_info",su=35723,lu=4352,fu=36795,uu=34047,cu=37445,du=37446,B=e=>D(e)?void 0:0,gu={[3074]:e=>D(e)?void 0:36064,[su]:e=>D(e)?void 0:lu,[35977]:B,[32937]:B,[fu]:(e,t)=>{let r=D(e)?e.getExtension(ou):e.getExtension(iu);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[cu]:(e,t)=>{let r=e.getExtension(Io);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[du]:(e,t)=>{let r=e.getExtension(Io);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[uu]:(e,t)=>{var r;let n=((r=e.luma)===null||r===void 0||(r=r.extensions)===null||r===void 0?void 0:r[au])||e.getExtension("EXT_texture_filter_anisotropic");return n?t(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},[32883]:B,[35071]:B,[37447]:B,[36063]:(e,t)=>{if(!D(e)){let r=e.getExtension(Mo);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},[35379]:B,[35374]:B,[35377]:B,[34852]:e=>{if(!D(e)){let t=e.getExtension(Mo);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},[36203]:e=>e.getExtension(No)?2147483647:65535,[33001]:e=>e.getExtension(No)?16777216:65535,[33e3]:e=>16777216,[37157]:B,[35373]:B,[35657]:B,[36183]:B,[37137]:B,[34045]:B,[35978]:B,[35979]:B,[35968]:B,[35376]:B,[35375]:B,[35659]:B,[37154]:B,[35371]:B,[35658]:B,[35076]:B,[35077]:B,[35380]:B};function Do(e,t,r){let n=gu[r],i=typeof n=="function"?n(e,t,r):n;return i!==void 0?i:t(r)}function at(e){if(!e.luma){let r={_polyfilled:!1,_extensions:{}};e.luma=r}return e.luma}var hu="OES_vertex_array_object",Fo="ANGLE_instanced_arrays",_u="WEBGL_draw_buffers",pu="EXT_disjoint_timer_query",Au="EXT_texture_filter_anisotropic",Tu="VertexArray requires WebGL2 or OES_vertex_array_object extension";function vu(e,t){return{webgl2:D(e),ext:e.getExtension(t)}}var zn={[hu]:{meta:{suffix:"OES"},createVertexArray:()=>{(0,ke.assert)(!1,Tu)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[Fo]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(e,t){(0,ke.assert)(t===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[_u]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{(0,ke.assert)(!1)}},[pu]:{meta:{suffix:"EXT"},createQuery:()=>{(0,ke.assert)(!1)},deleteQuery:()=>{(0,ke.assert)(!1)},beginQuery:()=>{(0,ke.assert)(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:(e,t)=>{}}},yr={readBuffer:(e,t,r)=>{D(e)&&t(r)},getVertexAttrib:(e,t,r,n)=>{let{webgl2:i,ext:o}=vu(e,Fo),a;switch(n){case 35069:a=i?void 0:!1;break;case 35070:a=!i&&!o?0:void 0;break;default:}return a!==void 0?a:t(r,n)},getProgramParameter:(e,t,r,n)=>{if(!D(e))switch(n){case 35967:return 35981;case 35971:return 0;case 35382:return 0;default:}return t(r,n)},getInternalformatParameter:(e,t,r,n,i)=>{if(!D(e))switch(i){case 32937:return new Int32Array([0]);default:}return e.getInternalformatParameter(r,n,i)},getTexParameter(e,t,r,n){switch(n){case 34046:let i=at(e),{_extensions:o}=i,a=o[Au];n=a&&a.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,n)},getParameter:Do,hint(e,t,r,n){return t(r,n)}};function Bo(e){let t=at(e);return t._polyfilled||(Oo(e),mu(e),bu(e,zn),Ru(e,{target:t,target2:e}),t._polyfilled=!0),e}function mu(e){let t=at(e),r=e.getSupportedExtensions()||[],n=["WEBGL_polygon_mode"];for(let i of r)if(!n.includes(i)){let o=e.getExtension(i);t._extensions[i]=o}}function bu(e,t){let r=at(e);for(let n of Object.getOwnPropertyNames(t))n!=="overrides"&&Su(e,{extension:n,target:r,target2:e})}function Su(e,t){let{extension:r,target:n,target2:i}=t,o=zn[r];(0,wo.assert)(o);let{meta:a={}}=o,{suffix:s=""}=a,l=e.getExtension(r);for(let f of Object.keys(o)){let u=`${f}${s}`,c=null;f==="meta"||typeof e[f]=="function"||(l&&typeof l[u]=="function"?c=function(){return l[u](...arguments)}:typeof o[f]=="function"&&(c=o[f].bind(n))),c&&(n[f]=c,i[f]=c)}}function Ru(e,t){let{target:r,target2:n}=t;Object.keys(yr).forEach(i=>{if(typeof yr[i]=="function"){let o=e[i]?e[i].bind(e):()=>{},a=yr[i].bind(null,e,o);r[i]=a,n[i]=a}})}var qt=P(I(),1);var Er={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},pe=(e,t,r)=>t?e.enable(r):e.disable(r),Uo=(e,t,r)=>e.hint(r,t),ne=(e,t,r)=>e.pixelStorei(r,t),Wo=(e,t,r)=>{let n;return r===36006?n=D(e)?36009:36160:n=36008,e.bindFramebuffer(n,t)},Zt=(e,t,r)=>{let i={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];e.bindBuffer(i,t)};function jn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}var Ho={[3042]:pe,[32773]:(e,t)=>e.blendColor(...t),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(e,t)=>e.clearColor(...t),[3107]:(e,t)=>e.colorMask(...t),[2884]:pe,[2885]:(e,t)=>e.cullFace(t),[2929]:pe,[2931]:(e,t)=>e.clearDepth(t),[2932]:(e,t)=>e.depthFunc(t),[2928]:(e,t)=>e.depthRange(...t),[2930]:(e,t)=>e.depthMask(t),[3024]:pe,[35723]:Uo,[35725]:(e,t)=>e.useProgram(t),[36007]:(e,t)=>e.bindRenderbuffer(36161,t),[36389]:(e,t)=>{var r,n;return(r=(n=e).bindTransformFeedback)===null||r===void 0?void 0:r.call(n,36386,t)},[34229]:(e,t)=>e.bindVertexArray(t),[36006]:Wo,[36010]:Wo,[34964]:Zt,[36662]:Zt,[36663]:Zt,[35053]:Zt,[35055]:Zt,[2886]:(e,t)=>e.frontFace(t),[33170]:Uo,[2849]:(e,t)=>e.lineWidth(t),[32823]:pe,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:pe,[32926]:pe,[32928]:pe,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:pe,[3088]:(e,t)=>e.scissor(...t),[2960]:pe,[2961]:(e,t)=>e.clearStencil(t),[2968]:(e,t)=>e.stencilMaskSeparate(1028,t),[36005]:(e,t)=>e.stencilMaskSeparate(1029,t),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(e,t)=>e.viewport(...t),[3333]:ne,[3317]:ne,[37440]:ne,[37441]:ne,[37443]:ne,[3330]:ne,[3332]:ne,[3331]:ne,[3314]:ne,[32878]:ne,[3316]:ne,[3315]:ne,[32877]:ne,framebuffer:(e,t)=>{let r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{let r=typeof t=="number"?[t,t]:t;e.blendEquationSeparate(...r)},blendFunc:(e,t)=>{let r=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...r)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(...t),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=jn(t)?t:[t,t];let[r,n]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,n)},stencilFunc:(e,t)=>{t=jn(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,a,s]=t;e.stencilFuncSeparate(1028,r,n,i),e.stencilFuncSeparate(1029,o,a,s)},stencilOp:(e,t)=>{t=jn(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,a,s]=t;e.stencilOpSeparate(1028,r,n,i),e.stencilOpSeparate(1029,o,a,s)},viewport:(e,t)=>e.viewport(...t)};function V(e,t,r){return t[e]!==void 0?t[e]:r[e]}var Vo={blendEquation:(e,t,r)=>e.blendEquationSeparate(V(32777,t,r),V(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(V(32969,t,r),V(32968,t,r),V(32971,t,r),V(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(V(32824,t,r),V(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(V(32938,t,r),V(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,V(2962,t,r),V(2967,t,r),V(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,V(34816,t,r),V(36003,t,r),V(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,V(2964,t,r),V(2965,t,r),V(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,V(34817,t,r),V(34818,t,r),V(34819,t,r))},kn={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),useProgram:(e,t)=>e({[35725]:t}),bindRenderbuffer:(e,t,r)=>e({[36007]:r}),bindTransformFeedback:(e,t,r)=>e({[36389]:r}),bindVertexArray:(e,t)=>e({[34229]:t}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({[36006]:r,[36010]:r});case 36009:return e({[36006]:r});case 36008:return e({[36010]:r});default:return null}},bindBuffer:(e,t,r)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[t];return n?e({[n]:r}):{valueChanged:!0}},blendColor:(e,t,r,n,i)=>e({[32773]:new Float32Array([t,r,n,i])}),blendEquation:(e,t)=>e({[32777]:t,[34877]:t}),blendEquationSeparate:(e,t,r)=>e({[32777]:t,[34877]:r}),blendFunc:(e,t,r)=>e({[32969]:t,[32968]:r,[32971]:t,[32970]:r}),blendFuncSeparate:(e,t,r,n,i)=>e({[32969]:t,[32968]:r,[32971]:n,[32970]:i}),clearColor:(e,t,r,n,i)=>e({[3106]:new Float32Array([t,r,n,i])}),clearDepth:(e,t)=>e({[2931]:t}),clearStencil:(e,t)=>e({[2961]:t}),colorMask:(e,t,r,n,i)=>e({[3107]:[t,r,n,i]}),cullFace:(e,t)=>e({[2885]:t}),depthFunc:(e,t)=>e({[2932]:t}),depthRange:(e,t,r)=>e({[2928]:new Float32Array([t,r])}),depthMask:(e,t)=>e({[2930]:t}),frontFace:(e,t)=>e({[2886]:t}),lineWidth:(e,t)=>e({[2849]:t}),polygonOffset:(e,t,r)=>e({[32824]:t,[10752]:r}),sampleCoverage:(e,t,r)=>e({[32938]:t,[32939]:r}),scissor:(e,t,r,n,i)=>e({[3088]:new Int32Array([t,r,n,i])}),stencilMask:(e,t)=>e({[2968]:t,[36005]:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,n)=>e({[2962]:t,[2967]:r,[2963]:n,[34816]:t,[36003]:r,[36004]:n}),stencilFuncSeparate:(e,t,r,n,i)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:n,[t===1028?2963:36004]:i}),stencilOp:(e,t,r,n)=>e({[2964]:t,[2965]:r,[2966]:n,[34817]:t,[34818]:r,[34819]:n}),stencilOpSeparate:(e,t,r,n,i)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:n,[t===1028?2966:34819]:i}),viewport:(e,t,r,n,i)=>e({[2978]:[t,r,n,i]})},Ae=(e,t)=>e.isEnabled(t),$n={[3042]:Ae,[2884]:Ae,[2929]:Ae,[3024]:Ae,[32823]:Ae,[32926]:Ae,[32928]:Ae,[3089]:Ae,[2960]:Ae,[35977]:Ae},Xo=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function ye(e,t){let n=k.attach(e).gl;if(yu(t))return;let i={};for(let a in t){let s=Number(a),l=Ho[a];l&&(typeof l=="string"?i[l]=!0:l(n,t[a],s))}let o=n.state&&n.state.cache;if(o)for(let a in i){let s=Vo[a];s(n,t,o)}}function Lo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Er,n=k.attach(e).gl;if(typeof t=="number"){let a=t,s=$n[a];return s?s(n,a):n.getParameter(a)}let i=Array.isArray(t)?t:Object.keys(t),o={};for(let a of i){let s=$n[a];o[a]=s?s(n,Number(a)):n.getParameter(Number(a))}return o}function yu(e){for(let t in e)return!1;return!0}function zo(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),n=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&n&&e.length===t.length){for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}var Kn=class{constructor(t){let{copyState:r=!1,log:n=()=>{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=void 0,this.program=null,this.stateStack=[],this.enable=!0,this.cache=void 0,this.log=void 0,this.gl=t,this.cache=r?Lo(t):Object.assign({},Er),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})}pop(){(0,qt.assert)(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];ye(this.gl,t),this.stateStack.pop()}_updateCache(t){let r=!1,n,i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in t){(0,qt.assert)(o!==void 0);let a=t[o],s=this.cache[o];zo(a,s)||(r=!0,n=s,i&&!(o in i)&&(i[o]=s),this.cache[o]=a)}return{valueChanged:r,oldValue:n}}};function $e(e){return e.state}function Yn(e,t){let{enable:r=!0,copyState:n}=t;if((0,qt.assert)(n!==void 0),!e.state){e.state=new Kn(e,{copyState:n}),xu(e);for(let o in kn){let a=kn[o];Eu(e,o,a)}jo(e,"getParameter"),jo(e,"isEnabled")}let i=$e(e);return i.enable=r,e}function Ie(e){let t=$e(e);t||(Yn(e,{copyState:!1}),t=$e(e)),t.push()}function Ee(e){let t=$e(e);(0,qt.assert)(t),t.pop()}function jo(e,t){let r=e[t].bind(e);e[t]=function(i){if(i===void 0||Xo.has(i))return r(i);let o=$e(e);return i in o.cache||(o.cache[i]=r(i)),o.enable?o.cache[i]:r(i)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function Eu(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(){let o=$e(e);for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];let{valueChanged:f,oldValue:u}=r(o._updateCache,...s);return f&&n(...s),u},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function xu(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let i=$e(e);i.program!==n&&(t(n),i.program=n)}}var Ou={webgl2:!0,webgl1:!0,powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function ko(e,t){t={...Ou,...t};let r=null,n=o=>r=o.statusMessage||r;e.addEventListener("webglcontextcreationerror",n,!1);let i=null;if(t.type==="webgl2"&&(t={...t,webgl1:!1}),t.type==="webgl1"&&(t={...t,webgl2:!1}),!i&&t.webgl2&&(i=e.getContext("webgl2",t)),!i&&t.webgl1&&(i=e.getContext("webgl",t)),e.removeEventListener("webglcontextcreationerror",n,!1),!i)throw new Error(`Failed to create ${t.webgl2&&!t.webgl1?"WebGL2":"WebGL"} context: ${r||"Unknown error"}`);if(t.onContextLost){let{onContextLost:o}=t;e.addEventListener("webglcontextlost",a=>o(a),!1)}if(t.onContextRestored){let{onContextRestored:o}=t;e.addEventListener("webglcontextrestored",a=>o(a),!1)}return i}function $o(e){let t=e.getParameter(7936),r=e.getParameter(7937),n=e.getExtension("WEBGL_debug_renderer_info"),i=e.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),o=e.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),a=i||t,s=o||r,l=e.getParameter(7938),f=Ko(a,s),u=Cu(a,s),c=Pu(a,s),d="glsl",g=D(e)?300:100;return{type:D(e)?"webgl2":"webgl",gpu:f,gpuType:c,gpuBackend:u,vendor:a,renderer:s,version:l,shadingLanguage:d,shadingLanguageVersion:g}}function Ko(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function Cu(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function Pu(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(Ko(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Yo(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<"u"?window.navigator||{}:{},r=e.userAgent||t.userAgent||"",n=r.indexOf("MSIE ")!==-1,i=r.indexOf("Trident/")!==-1;return n||i}var Qn=P(I(),1);function xr(e){switch(e){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(e))}var q="texture-compression-bc",F="texture-compression-astc",Te="texture-compression-etc2",Nu="texture-compression-etc1-webgl",Or="texture-compression-pvrtc-webgl",Zn="texture-compression-atc-webgl",Qt="WEBGL_compressed_texture_s3tc",Jt="WEBGL_compressed_texture_s3tc_srgb",st="EXT_texture_compression_rgtc",Gt="EXT_texture_compression_bptc",Mu="WEBGL_compressed_texture_etc",Iu="WEBGL_compressed_texture_astc",Du="WEBGL_compressed_texture_etc1",Fu="WEBGL_compressed_texture_pvrtc",wu="WEBGL_compressed_texture_atc",Zo="EXT_sRGB",xe="EXT_texture_norm16",Bu="WEBGL_color_buffer_float",Uu="EXT_color_buffer_float",ue=(e,t)=>e.getExtension(t),Ke=(e,t)=>t.every(r=>e.getExtension(r)),qn={"texture-blend-float-webgl1":e=>D(e)?!0:ue(e,"EXT_float_blend"),"texture-formats-srgb-webgl1":e=>D(e)?!0:ue(e,Zo),"texture-formats-depth-webgl1":e=>D(e)?!0:ue(e,"WEBGL_depth_texture"),"texture-formats-float32-webgl1":e=>D(e)?!0:ue(e,"OES_texture_float"),"texture-formats-float16-webgl1":e=>D(e)?!0:ue(e,"OES_texture_half_float"),"texture-formats-norm16-webgl":e=>D(e)?ue(e,xe):!1,"texture-filter-linear-float32-webgl":e=>ue(e,"OES_texture_float_linear"),"texture-filter-linear-float16-webgl":e=>ue(e,"OES_texture_half_float_linear"),"texture-filter-anisotropic-webgl":e=>ue(e,"EXT_texture_filter_anisotropic"),"texture-renderable-float32-webgl":e=>ue(e,"EXT_color_buffer_float"),"texture-renderable-float16-webgl":e=>ue(e,"EXT_color_buffer_half_float"),"texture-compression-bc":e=>Ke(e,[Qt,Jt,st,Gt]),"texture-compression-bc5-webgl":e=>Ke(e,[st]),"texture-compression-etc2":e=>Ke(e,[Mu]),"texture-compression-astc":e=>Ke(e,[Iu]),"texture-compression-etc1-webgl":e=>Ke(e,[Du]),"texture-compression-pvrtc-webgl":e=>Ke(e,[Fu]),"texture-compression-atc-webgl":e=>Ke(e,[wu])};function Wu(e,t){var r;return((r=qn[t])===null||r===void 0?void 0:r.call(qn,e))||!1}function qo(e){return Object.keys(qn).filter(r=>Wu(e,r))}var er={"rgb8unorm-unsized":{gl:6407,gl1:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,gl1:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,renderbuffer:!0},r8snorm:{gl:36756,b:1,c:1},r8uint:{gl:33330,b:1,c:1,renderbuffer:!0},r8sint:{gl:33329,b:1,c:1,renderbuffer:!0},rg8unorm:{gl:33323,b:2,c:2,renderbuffer:!0},rg8snorm:{gl:36757,b:2,c:2},rg8uint:{gl:33336,b:2,c:2,renderbuffer:!0},rg8sint:{gl:33335,b:2,c:2,renderbuffer:!0},r16uint:{gl:33332,b:2,c:1,renderbuffer:!0},r16sint:{gl:33331,b:2,c:1,renderbuffer:!0},r16float:{gl:33325,b:2,c:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:xe},"r16snorm-webgl":{gl:36760,b:2,c:1,f:"texture-formats-norm16-webgl",x:xe},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,gl1:6408,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,gl1:35906,b:4,c:4,gl1ext:Zo,bpp:4},rgba8snorm:{gl:36759,b:4,c:4},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,f:"texture-formats-norm16-webgl",x:xe},"rg16snorm-webgl":{gl:36761,b:2,c:2,f:"texture-formats-norm16-webgl",x:xe},r32uint:{gl:33334,b:4,c:1,bpp:4,renderbuffer:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,renderbuffer:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl"},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:"texture-renderable-float32-webgl",renderbuffer:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,renderbuffer:!0},"rgb10a2unorm-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,renderbuffer:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:"texture-formats-norm16-webgl",x:xe},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:"texture-formats-norm16-webgl",x:xe},rg32uint:{gl:33340,b:8,c:2,renderbuffer:!0},rg32sint:{gl:33339,b:8,c:2,renderbuffer:!0},rg32float:{gl:33328,b:8,c:2,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},rgba16uint:{gl:36214,b:8,c:4,renderbuffer:!0},rgba16sint:{gl:36232,b:8,c:4,renderbuffer:!0},rgba16float:{gl:34842,gl1:6408,b:8,c:4,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},"rgba16unorm-webgl":{gl:32859,b:2,c:4,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:xe},"rgba16snorm-webgl":{gl:36763,b:2,c:4,f:"texture-formats-norm16-webgl",x:xe},"rgb32float-webgl":{gl:34837,gl1:6407,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",gl2ext:Uu,gl1ext:Bu,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,renderbuffer:!0},rgba32sint:{gl:36226,b:16,c:4,renderbuffer:!0},rgba32float:{gl:34836,b:16,c:4,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},stencil8:{gl:36168,gl1:36168,b:1,c:1,attachment:36128,renderbuffer:!0},depth16unorm:{gl:33189,gl1:33189,b:2,c:1,attachment:36096,renderbuffer:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096},depth32float:{gl:36012,b:4,c:1,attachment:36096,renderbuffer:!0},"depth24plus-stencil8":{gl:34041,gl1:34041,b:4,c:2,p:1,attachment:33306,renderbuffer:!0,depthTexture:!0},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,renderbuffer:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,renderbuffer:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Qt,f:q},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:Jt,f:q},"bc1-rgba-unorm":{gl:33777,x:Qt,f:q},"bc1-rgba-unorm-srgb":{gl:35916,x:Jt,f:q},"bc2-rgba-unorm":{gl:33778,x:Qt,f:q},"bc2-rgba-unorm-srgb":{gl:35918,x:Jt,f:q},"bc3-rgba-unorm":{gl:33779,x:Qt,f:q},"bc3-rgba-unorm-srgb":{gl:35919,x:Jt,f:q},"bc4-r-unorm":{gl:36283,x:st,f:q},"bc4-r-snorm":{gl:36284,x:st,f:q},"bc5-rg-unorm":{gl:36285,x:st,f:q},"bc5-rg-snorm":{gl:36286,x:st,f:q},"bc6h-rgb-ufloat":{gl:36495,x:Gt,f:q},"bc6h-rgb-float":{gl:36494,x:Gt,f:q},"bc7-rgba-unorm":{gl:36492,x:Gt,f:q},"bc7-rgba-unorm-srgb":{gl:36493,x:Gt,f:q},"etc2-rgb8unorm":{gl:37492,f:Te},"etc2-rgb8unorm-srgb":{gl:37494,f:Te},"etc2-rgb8a1unorm":{gl:37496,f:Te},"etc2-rgb8a1unorm-srgb":{gl:37497,f:Te},"etc2-rgba8unorm":{gl:37493,f:Te},"etc2-rgba8unorm-srgb":{gl:37495,f:Te},"eac-r11unorm":{gl:37488,f:Te},"eac-r11snorm":{gl:37489,f:Te},"eac-rg11unorm":{gl:37490,f:Te},"eac-rg11snorm":{gl:37491,f:Te},"astc-4x4-unorm":{gl:37808,f:F},"astc-4x4-unorm-srgb":{gl:37840,f:F},"astc-5x4-unorm":{gl:37809,f:F},"astc-5x4-unorm-srgb":{gl:37841,f:F},"astc-5x5-unorm":{gl:37810,f:F},"astc-5x5-unorm-srgb":{gl:37842,f:F},"astc-6x5-unorm":{gl:37811,f:F},"astc-6x5-unorm-srgb":{gl:37843,f:F},"astc-6x6-unorm":{gl:37812,f:F},"astc-6x6-unorm-srgb":{gl:37844,f:F},"astc-8x5-unorm":{gl:37813,f:F},"astc-8x5-unorm-srgb":{gl:37845,f:F},"astc-8x6-unorm":{gl:37814,f:F},"astc-8x6-unorm-srgb":{gl:37846,f:F},"astc-8x8-unorm":{gl:37815,f:F},"astc-8x8-unorm-srgb":{gl:37847,f:F},"astc-10x5-unorm":{gl:37819,f:F},"astc-10x5-unorm-srgb":{gl:37851,f:F},"astc-10x6-unorm":{gl:37817,f:F},"astc-10x6-unorm-srgb":{gl:37849,f:F},"astc-10x8-unorm":{gl:37818,f:F},"astc-10x8-unorm-srgb":{gl:37850,f:F},"astc-10x10-unorm":{gl:37819,f:F},"astc-10x10-unorm-srgb":{gl:37851,f:F},"astc-12x10-unorm":{gl:37820,f:F},"astc-12x10-unorm-srgb":{gl:37852,f:F},"astc-12x12-unorm":{gl:37821,f:F},"astc-12x12-unorm-srgb":{gl:37853,f:F},"pvrtc-rgb4unorm-webgl":{gl:35840,f:Or},"pvrtc-rgba4unorm-webgl":{gl:35842,f:Or},"pvrtc-rbg2unorm-webgl":{gl:35841,f:Or},"pvrtc-rgba2unorm-webgl":{gl:35843,f:Or},"etc1-rbg-unorm-webgl":{gl:36196,f:Nu},"atc-rgb-unorm-webgl":{gl:35986,f:Zn},"atc-rgba-unorm-webgl":{gl:35986,f:Zn},"atc-rgbai-unorm-webgl":{gl:34798,f:Zn}},Hu={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},Vu={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function tr(e,t){let r=rr(t),n=er[r];if(!n||(D(e)?n.gl===void 0:n.gl1===void 0))return!1;let i=n.x||D(e)&&n.gl2ext||n.gl1ext;return i?Boolean(e.getExtension(i)):!0}function Qo(e,t){var r;return tr(e,t)&&((r=er[t])===null||r===void 0?void 0:r.renderbuffer)}function rr(e){if(typeof e=="string")return e;let t=Object.entries(er).find(r=>{let[,n]=r;return n.gl===e||n.gl1===e});if(!t)throw new Error(`Unknown texture format ${e}`);return t[0]}function nr(e,t){let r=er[e],n=t?r?.gl:r?.gl1;if(n===void 0)throw new Error(`Unsupported texture format ${e}`);return n}function Jo(e,t){let r=rr(t);if(!tr(e,r))return!1;try{if((0,Qn.decodeTextureFormat)(r).signed)return!1}catch{return!1}return r.endsWith("32float")?Boolean(e.getExtension("OES_texture_float_linear")):r.endsWith("16float")?Boolean(e.getExtension("OES_texture_half_float_linear")):!0}function Go(e,t){let r=rr(t);return!(!tr(e,r)||typeof r=="number")}function lt(e,t){let r=rr(e),n=nr(r,t),i=(0,Qn.decodeTextureFormat)(r);return{format:n,dataFormat:Xu(i.format,i.integer,i.normalized,n),type:i.dataType?xr(i.dataType):5121,compressed:i.compressed}}function ea(e){let t=er[e];if(!(t!=null&&t.attachment))throw new Error(`${e} is not a depth stencil format`);return t.attachment}function ta(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6408,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6408,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5121,i=null,o=null;try{i=e.createTexture(),e.bindTexture(3553,i);let a=0,s=1,l=1,f=0,u=new Uint8Array([0,0,255,255]);e.texImage2D(3553,a,t,s,l,f,r,n,u),o=e.createFramebuffer(),e.bindFramebuffer(36160,o),e.framebufferTexture2D(36160,36064,3553,i,0);let c=e.checkFramebufferStatus(36160)===36053;return e.bindTexture(3553,null),c}finally{e.deleteTexture(i),e.deleteFramebuffer(o)}}function ir(e,t){let r=rr(e),n=lt(r,t),i=Hu[n.dataFormat]||4,o=Vu[n.type]||1;return i*o}function Xu(e,t,r,n){if(n===6408||n===6407)return n;switch(e){case"r":return t&&!r?36244:6403;case"rg":return t&&!r?33320:33319;case"rgb":return t&&!r?36248:6407;case"rgba":return t&&!r?36249:6408;default:return 6408}}function ra(e){let t=Lu(e);for(let r of qo(e))t.add(r);return t}function Lu(e){e.getExtension("EXT_color_buffer_float"),e.getExtension("WEBGL_color_buffer_float"),e.getExtension("EXT_float_blend");let t=new Set;for(let r of Object.keys(na))zu(e,r)&&t.add(r);return t}function zu(e,t){let r=na[t];if(!r)return!1;let[n,i]=r||[],o=D(e)?i:n;if(typeof o=="boolean")return o;switch(t){case"texture-renderable-rgba32float-webgl":return D(e)?Boolean(e.getExtension(o)):ta(e);case"glsl-derivatives":return Gn(e,o);case"glsl-frag-data":return Gn(e,o,{behavior:"require"});case"glsl-frag-depth":return Gn(e,o);default:return Boolean(e.getExtension(o))}}var Jn={};function Gn(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!Yo(r))return!0;if(t in Jn)return Jn[t];let n=r.behavior||"enable",i=`#extension GL_${t} : ${n}
|
|
313
|
-
void main(void) {}`,o=e.createShader(35633);if(!o)throw new Error("shader");e.shaderSource(o,i),e.compileShader(o);let a=e.getShaderParameter(o,35713);return e.deleteShader(o),Jn[t]=a,a}var na={webgl:[!0,!0],webgl2:[!1,!0],"timer-query-webgl":["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],"transform-feedback-webgl2":[!1,!0],"vertex-array-object-webgl1":["OES_vertex_array_object",!0],"instanced-rendering-webgl1":["ANGLE_instanced_arrays",!0],"multiple-render-targets-webgl1":["WEBGL_draw_buffers",!0],"index-uint32-webgl1":["OES_element_index_uint",!0],"blend-minmax-webgl1":["EXT_blend_minmax",!0],"texture-blend-float-webgl1":["EXT_float_blend","EXT_float_blend"],"texture-formats-srgb-webgl1":["EXT_sRGB",!0],"texture-formats-depth-webgl1":["WEBGL_depth_texture",!0],"texture-formats-float32-webgl1":["OES_texture_float",!0],"texture-formats-float16-webgl1":["OES_texture_half_float",!0],"texture-filter-linear-float32-webgl":["OES_texture_float_linear","OES_texture_float_linear"],"texture-filter-linear-float16-webgl":["OES_texture_half_float_linear","OES_texture_half_float_linear"],"texture-filter-anisotropic-webgl":["EXT_texture_filter_anisotropic","EXT_texture_filter_anisotropic"],"texture-renderable-rgba32float-webgl":["WEBGL_color_buffer_float","EXT_color_buffer_float"],"texture-renderable-float32-webgl":[!1,"EXT_color_buffer_float"],"texture-renderable-float16-webgl":["EXT_color_buffer_half_float","EXT_color_buffer_half_float"],"glsl-frag-data":["WEBGL_draw_buffers",!0],"glsl-frag-depth":["EXT_frag_depth",!0],"glsl-derivatives":["OES_standard_derivatives",!0],"glsl-texture-lod":["EXT_shader_texture_lod",!0]};function ia(e){let t=Ln(e);return{maxTextureDimension1D:0,maxTextureDimension2D:e.getParameter(3379),maxTextureDimension3D:t?t.getParameter(32883):0,maxTextureArrayLayers:t?t.getParameter(35071):0,maxBindGroups:1,maxDynamicUniformBuffersPerPipelineLayout:0,maxDynamicStorageBuffersPerPipelineLayout:0,maxSampledTexturesPerShaderStage:e.getParameter(35660),maxSamplersPerShaderStage:e.getParameter(35661),maxStorageBuffersPerShaderStage:0,maxStorageTexturesPerShaderStage:0,maxUniformBuffersPerShaderStage:t?t.getParameter(35375):0,maxUniformBufferBindingSize:t?t.getParameter(35376):0,maxStorageBufferBindingSize:0,minUniformBufferOffsetAlignment:t?t.getParameter(35380):0,minStorageBufferOffsetAlignment:0,maxVertexBuffers:0,maxVertexAttributes:e.getParameter(34921),maxVertexBufferArrayStride:2048,maxInterStageShaderComponents:t?t.getParameter(35659):0,maxComputeWorkgroupStorageSize:0,maxComputeInvocationsPerWorkgroup:0,maxComputeWorkgroupSizeX:0,maxComputeWorkgroupSizeY:0,maxComputeWorkgroupSizeZ:0,maxComputeWorkgroupsPerDimension:0}}function oa(e){let t=Ln(e);function r(i){return e.getParameter(i)}function n(i,o){return t?t.getParameter(i):o||0}return{[33902]:r(33902),[33901]:r(33901),[3379]:r(3379),[34076]:r(34076),[34930]:r(34930),[35661]:r(35661),[35660]:r(35660),[34024]:r(34024),[36348]:r(36348),[34921]:r(34921),[36347]:r(36347),[36349]:r(36349),[3386]:r(3386),[34047]:r(34047),[32883]:n(32883),[35071]:n(35071),[37447]:n(37447),[36063]:n(36063),[35379]:n(35379),[35374]:n(35374),[35377]:n(35377),[34852]:n(34852),[36203]:n(36203),[33001]:n(33001),[33e3]:n(33e3),[37157]:n(37157),[35373]:n(35373),[35657]:n(35657),[36183]:n(36183),[37137]:n(37137),[34045]:n(34045),[35978]:n(35978),[35979]:n(35979),[35968]:n(35968),[35376]:n(35376),[35375]:n(35375),[35659]:n(35659),[37154]:n(37154),[35371]:n(35371),[35658]:n(35658),[35076]:n(35076),[35077]:n(35077),[35380]:n(35380)}}var ha=P(I(),1);var wr=P(I(),1);var L=P(I(),1);function Q(e,t,r){let i=k.attach(e).gl;if(ju(t))return r(e);let{nocatch:o=!0}=t;Ie(i),ye(i,t);let a;if(o)a=r(i),Ee(i);else try{a=r(i)}finally{Ee(i)}return a}function ju(e){for(let t in e)return!1;return!0}var Nr=P(I(),1);function sa(e,t,r,n){if((0,Nr.isObjectEmpty)(t))return n(e);Ie(e.gl);try{return ku(e,t),ye(e,r),n(e)}finally{Ee(e.gl)}}function ku(e,t){let r=k.attach(e),{gl:n}=r;if(t.cullMode)switch(t.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(t.frontFace&&n.frontFace(or("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.depthBias!==void 0&&n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0),t.depthWriteEnabled!==void 0&&n.depthMask(Ku("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(Pr("depthCompare",t.depthCompare))),t.stencilWriteMask){let i=t.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(t.stencilReadMask&&Nr.log.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let i=t.stencilReadMask||4294967295,o=Pr("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,o,0,i),n.stencilFuncSeparate(1029,o,0,i)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let i=ei("stencilPassOperation",t.stencilPassOperation),o=ei("stencilFailOperation",t.stencilFailOperation),a=ei("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,a,i),n.stencilOpSeparate(1029,o,a,i)}if(t.blendColorOperation||t.blendAlphaOperation){n.enable(3042);let i=aa("blendColorOperation",t.blendColorOperation||"add"),o=aa("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let a=Cr("blendColorSrcFactor",t.blendColorSrcFactor||"one"),s=Cr("blendColorDstFactor",t.blendColorDstFactor||"zero"),l=Cr("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),f=Cr("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(a,s,l,f)}}function Pr(e,t){return or(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function ei(e,t){return or(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function aa(e,t){return or(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function Cr(e,t){return or(e,t,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773})}function $u(e,t){return`Illegal parameter ${t} for ${e}`}function or(e,t,r){if(!(t in r))throw new Error($u(e,t));return r[t]}function Ku(e,t){return t}function Mr(e){let t={};return e.addressModeU&&(t[10242]=ti(e.addressModeU)),e.addressModeV&&(t[10243]=ti(e.addressModeV)),e.addressModeW&&(t[32882]=ti(e.addressModeW)),e.magFilter&&(t[10240]=fa(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=Yu(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=Pr("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function la(e){let t={...e};return e[10241]!==9728&&(t[10241]=9729),t[10242]=33071,t[10243]=33071,t}function ti(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function fa(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function Yu(e,t){if(!t)return fa(e);switch(e){case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}var ce=P(I(),1),Zu=10,te=class extends ce.Buffer{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.glTarget=void 0,this.glUsage=void 0,this.glIndexType=5123,this.byteLength=void 0,this.bytesUsed=void 0,this.debugData=null,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),t.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=qu(this.props.usage),this.glUsage=Qu(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,this.debugData=null,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r;(0,ce.assert)(ArrayBuffer.isView(t));let i=this._getWriteTarget();return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,r,t),this.gl.bindBuffer(i,null),this.debugData=t.slice(0,Zu),this.bytesUsed=n,this.byteLength=n,this.trackAllocatedMemory(n),this}_initWithByteLength(t){(0,ce.assert)(t>=0);let r=t;t===0&&(r=new Float32Array(0));let n=this._getWriteTarget();return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.debugData=null,this.bytesUsed=t,this.byteLength=t,this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=0,i=void 0,o=this.device.isWebGL2?36663:this.glTarget;this.gl.bindBuffer(o,this.handle),n!==0||i!==void 0?(this.device.assertWebGL2(),this.gl2.bufferSubData(o,r,t,n,i)):this.gl.bufferSubData(o,r,t),this.gl.bindBuffer(o,null)}async readAsync(){var t;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0;this.device.assertWebGL2(),n=(t=n)!==null&&t!==void 0?t:this.byteLength;let i=new Uint8Array(n),o=0;return this.gl.bindBuffer(36662,this.handle),this.gl2.getBufferSubData(36662,r,i,o,n),this.gl.bindBuffer(36662,null),i}_invalidateDebugData(){this.debugData=null}_getWriteTarget(){return this.glTarget}_getReadTarget(){return this.glTarget}};function qu(e){return e&ce.Buffer.INDEX?34963:e&ce.Buffer.VERTEX?34962:e&ce.Buffer.UNIFORM?35345:34962}function Qu(e){return e&ce.Buffer.INDEX||e&ce.Buffer.VERTEX?35044:e&ce.Buffer.UNIFORM?35048:35044}var ua=P(I(),1);var Ye=class extends ua.Sampler{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.parameters=void 0,this.device=t,this.parameters=Mr(r),this.device.isWebGL2&&(this.handle=this.handle||this.device.gl2.createSampler(),this._setSamplerParameters(this.parameters))}destroy(){this.handle&&(this.device.gl2.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(t){for(let[r,n]of Object.entries(t)){let i=Number(r);switch(i){case 33082:case 33083:this.device.gl2.samplerParameterf(this.handle,i,n);break;default:this.device.gl2.samplerParameteri(this.handle,i,n);break}}}};var Ju={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},K=class extends L.Texture{constructor(t,r){var n;super(t,{...Ju,format:"rgba8unorm",...r}),this.MAX_ATTRIBUTES=void 0,this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.sampler=void 0,this.glFormat=void 0,this.type=void 0,this.dataFormat=void 0,this.mipmaps=void 0,this.target=void 0,this.textureUnit=void 0,this.loaded=!1,this._video=void 0,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Gu(this.props),this.loaded=!1,typeof((n=this.props)===null||n===void 0?void 0:n.data)=="string"&&Object.assign(this.props,{data:(0,L.loadImage)(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.props.dimension==="cube")return this.initializeCube(t);let r=t.data;if(r instanceof Promise)return r.then(_=>this.initialize(Object.assign({},t,{pixels:_,data:_}))),this;let n=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(n&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(t)),this;let{parameters:i={}}=t,{pixels:o=null,pixelStore:a={},textureUnit:s=void 0}=t;r||(r=o);let{width:l,height:f,dataFormat:u,type:c,compressed:d=!1,mipmaps:g=!0}=t,{depth:h=0}=t,A=nr(t.format,this.device.isWebGL2);return{width:l,height:f,compressed:d,dataFormat:u,type:c}=this._deduceParameters({format:t.format,type:c,dataFormat:u,compressed:d,data:r,width:l,height:f}),this.width=l,this.height=f,this.glFormat=A,this.type=c,this.dataFormat=u,this.textureUnit=s,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),g&&this.device.isWebGL1&&Ir(this.width,this.height)&&(L.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaps`)(),g=!1),this.mipmaps=g,this.setImageData({data:r,width:l,height:f,depth:h,format:A,type:c,dataFormat:u,parameters:a,compressed:d}),this.setSampler(t.sampler),this._setSamplerParameters(i),g&&this.generateMipmap(),n&&(this._video={video:r,parameters:i,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(t){let{mipmaps:r=!0,parameters:n={}}=t;return this.setCubeMapImageData(t).then(()=>{this.loaded=!0,r&&this.generateMipmap(t),this.setSampler(t.sampler),this._setSamplerParameters(n)}),this}setSampler(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r;t instanceof Ye?(this.sampler=t,r=t.props):(this.sampler=new Ye(this.device,t),r=t);let n=Mr(r);return this._setSamplerParameters(n),this}resize(t){let{height:r,width:n,mipmaps:i=!1}=t;return n!==this.width||r!==this.height?this.initialize({width:n,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:i}):this}update(){if(this._video){let{video:t,parameters:r,lastTime:n}=this._video;if(n===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}generateMipmap(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.device.isWebGL1&&Ir(this.width,this.height)?(L.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Q(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(t);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:n=null,level:i=0,glFormat:o=this.glFormat,offset:a=0,parameters:s={}}=t,{data:l=null,type:f=this.type,width:u=this.width,height:c=this.height,dataFormat:d=this.dataFormat,compressed:g=!1}=t;l||(l=n),{type:f,dataFormat:d,compressed:g,width:u,height:c}=this._deduceParameters({format:this.props.format,type:f,dataFormat:d,compressed:g,data:l,width:u,height:c});let{gl:h}=this;h.bindTexture(this.target,this.handle);let A=null;({data:l,dataType:A}=this._getDataType({data:l,compressed:g}));let _;if(Q(this.gl,s,()=>{switch(A){case"null":h.texImage2D(r,i,o,u,c,0,d,f,l);break;case"typed-array":h.texImage2D(r,i,o,u,c,0,d,f,l,a);break;case"buffer":_=this.device.assertWebGL2(),_.bindBuffer(35052,l.handle||l),_.texImage2D(r,i,o,u,c,0,d,f,a),_.bindBuffer(35052,null);break;case"browser-object":this.device.isWebGL2?h.texImage2D(r,i,o,u,c,0,d,f,l):h.texImage2D(r,i,o,d,f,l);break;case"compressed":for(let[v,T]of l.entries())h.compressedTexImage2D(r,v,T.format,T.width,T.height,0,T.data);break;default:(0,L.assert)(!1,"Unknown image data type")}}),l&&l.byteLength)this.trackAllocatedMemory(l.byteLength,"Texture");else{let v=ir(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*v,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:n=null,data:i=null,x:o=0,y:a=0,width:s=this.width,height:l=this.height,level:f=0,glFormat:u=this.glFormat,type:c=this.type,dataFormat:d=this.dataFormat,compressed:g=!1,offset:h=0,parameters:A={}}=t;if({type:c,dataFormat:d,compressed:g,width:s,height:l}=this._deduceParameters({format:this.props.format,type:c,dataFormat:d,compressed:g,data:i,width:s,height:l}),(0,L.assert)(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=n),i&&i.data){let _=i;i=_.data,s=_.shape[0],l=_.shape[1]}i instanceof te&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Q(this.gl,A,()=>{if(g)this.gl.compressedTexSubImage2D(r,f,o,a,s,l,u,i);else if(i===null)this.gl.texSubImage2D(r,f,o,a,s,l,d,c,null);else if(ArrayBuffer.isView(i))this.gl.texSubImage2D(r,f,o,a,s,l,d,c,i,h);else if(typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer){let _=this.device.assertWebGL2();_.bindBuffer(35052,i),_.texSubImage2D(r,f,o,a,s,l,d,c,h),_.bindBuffer(35052,null)}else this.device.isWebGL2?this.device.assertWebGL2().texSubImage2D(r,f,o,a,s,l,d,c,i):this.gl.texSubImage2D(r,f,o,a,d,c,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return L.log.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,null),t}_getDataType(t){let{data:r,compressed:n=!1}=t;return n?{data:r,dataType:"compressed"}:r===null?{data:r,dataType:"null"}:ArrayBuffer.isView(r)?{data:r,dataType:"typed-array"}:r instanceof te?{data:r.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&r instanceof WebGLBuffer?{data:r,dataType:"buffer"}:{data:r,dataType:"browser-object"}}_deduceParameters(t){let{format:r,data:n}=t,{width:i,height:o,dataFormat:a,type:s,compressed:l}=t,f=lt(r,this.device.isWebGL2);return a=a||f.dataFormat,s=s||f.type,l=l||f.compressed,{width:i,height:o}=this._deduceImageSize(n,i,o),{dataFormat:a,type:s,compressed:l,width:i,height:o,format:r,data:n}}_deduceImageSize(t,r,n){let i;return typeof ImageData<"u"&&t instanceof ImageData?i={width:t.width,height:t.height}:typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement?i={width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?i={width:t.width,height:t.height}:typeof ImageBitmap<"u"&&t instanceof ImageBitmap?i={width:t.width,height:t.height}:typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?i={width:t.videoWidth,height:t.videoHeight}:t?i={width:r,height:n}:i={width:r>=0?r:1,height:n>=0?n:1},(0,L.assert)(i,"Could not deduced texture size"),(0,L.assert)(r===void 0||i.width===r,"Deduced texture width does not match supplied width"),(0,L.assert)(n===void 0||i.height===n,"Deduced texture height does not match supplied height"),i}async setCubeMapImageData(t){let{gl:r}=this,{width:n,height:i,pixels:o,data:a,format:s=6408,type:l=5121}=t,f=o||a,u=await Promise.all(K.FACES.map(c=>{let d=f[c];return Promise.all(Array.isArray(d)?d:[d])}));this.bind(),K.FACES.forEach((c,d)=>{u[d].length>1&&this.props.mipmaps!==!1&&L.log.warn(`${this.id} has mipmap and multiple LODs.`)(),u[d].forEach((g,h)=>{n&&i?r.texImage2D(c,h,s,n,i,0,s,l,g):r.texImage2D(c,h,s,s,l,g)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:n,height:i,pixels:o,data:a,format:s=6408,type:l=5121}=t,{gl:f}=this,u=o||a;return this.bind(),u instanceof Promise?u.then(c=>this.setImageDataForFace(Object.assign({},t,{face:r,data:c,pixels:c}))):this.width||this.height?f.texImage2D(r,0,s,n,i,0,s,l,u):f.texImage2D(r,0,s,s,l,u),this}setImageData3D(t){let{level:r=0,dataFormat:n,format:i,type:o,width:a,height:s,depth:l=1,offset:f=0,data:u,parameters:c={}}=t;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let d=lt(i,this.device.isWebGL2);if(Q(this.gl,c,()=>{ArrayBuffer.isView(u)&&this.gl.texImage3D(this.target,r,d.format,a,s,l,0,d.dataFormat,d.type,u),u instanceof te&&(this.gl.bindBuffer(35052,u.handle),this.gl.texImage3D(this.target,r,n,a,s,l,0,i,o,f))}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let g=ir(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*this.depth*g,"Texture")}return this.loaded=!0,this}_setSamplerParameters(t){if(this.device.isWebGL1&&Ir(this.width,this.height)&&(t=la(t)),!(0,L.isObjectEmpty)(t)){ec(t),this.gl.bindTexture(this.target,this.handle);for(let[r,n]of Object.entries(t)){let i=Number(r),o=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.target,i,o);break;default:this.gl.texParameteri(this.target,i,o);break}}this.gl.bindTexture(this.target,null)}}_getWebGL1NPOTParameterOverride(t,r){if(this.device.isWebGL1&&Ir(this.width,this.height))switch(t){case 10241:if(r!==9729&&r!==9728)return 9729;break;case 10242:case 10243:return 33071;default:break}return r}};K.FACES=[34069,34070,34071,34072,34073,34074];function Gu(e){switch(e.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(e.dimension)}}function Ir(e,t){return!e||!t?!1:!(0,L.isPowerOfTwo)(e)||!(0,L.isPowerOfTwo)(t)}function ec(e){L.log.log(1,"texture sampler parameters",e)()}var ga=P(I(),1);var Oe=P(I(),1);var ca=P(I(),1);function Dr(e,t){if(typeof t!="string")return t;let r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\./,"");let n=e[t];return(0,ca.assert)(n!==void 0,`Accessing undefined constant GL.${t}`),n}var ft="Resource subclass must define virtual methods",Fr=class extends Oe.Resource{constructor(t,r,n){super(t,r,n),this.device=void 0,this.gl=void 0,this.gl2=void 0,this._handle=void 0,this._bound=!1,this.byteLength=0,this.device=k.attach(t);let i=this.device.gl;Po(i);let{id:o}=r||{};this.gl=i,this.gl2=i,this.id=o||(0,Oe.uid)(this.constructor.name),this._handle=r?.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0}toString(){return`${this.constructor.name}(${this.id})`}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this.removeStats(),this._handle=null,r&&t&&r.filter(Boolean).forEach(n=>n.destroy()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this._bindHandle(t),this;let r;return this._bound?r=t():(this._bindHandle(this.handle),this._bound=!0,r=t(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}getParameter(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=Dr(this.gl,t),(0,Oe.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=D(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension)))){let s=i.webgl1,l="webgl2"in i?i.webgl2:i.webgl1;return o?l:s}}return this._getParameter(t,r)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{parameters:r,keys:n}=t,i=this.constructor.PARAMETERS||{},o=D(this.gl),a={},s=r||Object.keys(i);for(let l of s){let f=i[l];if(f&&(!("webgl2"in f)||o)&&(!("extension"in f)||this.gl.getExtension(f.extension))){let c=n?this.device.getGLKey(l):l;a[c]=this.getParameter(l,t),n&&f.type==="GLenum"&&(a[c]=this.device.getGLKey(a[c]))}}return a}setParameter(t,r){t=Dr(this.gl,t),(0,Oe.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=D(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension))))throw new Error("Parameter not available on this platform");i.type==="GLenum"&&(r=Dr(r))}return this._setParameter(t,r),this}setParameters(t){for(let r in t)this.setParameter(r,t[r]);return this}stubRemovedMethods(t,r,n){return(0,Oe.stubRemovedMethods)(this,t,r,n)}initialize(t){}_createHandle(){throw new Error(ft)}_deleteHandle(){throw new Error(ft)}_bindHandle(t){throw new Error(ft)}_getOptsFromHandle(){throw new Error(ft)}_getParameter(t,r){throw new Error(ft)}_setParameter(t,r){throw new Error(ft)}};var da;da=Symbol.toStringTag;var De=class extends Fr{get[da](){return"Renderbuffer"}get width(){return this.props.width}get height(){return this.props.height}get format(){return this.props.format}get samples(){return this.props.samples}get attachment(){}static isTextureFormatSupported(t,r){return Qo(t.gl,r)}constructor(t,r){if(typeof r.format=="number")throw new Error("Renderbuffer");super(t,r,De.defaultProps),this.glFormat=void 0,this.glFormat=nr(this.props.format,t.isWebGL2),this._initialize(this.props)}resize(t){(t.width!==this.width||t.height!==this.height)&&(Object.assign(this.props,{...t,format:this.format,samples:this.samples}),this._initialize(this.props))}_initialize(t){let{format:r,width:n,height:i,samples:o}=t;(0,ga.assert)(r,"Needs format"),this.trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),o!==0&&this.device.isWebGL2?this.gl2.renderbufferStorageMultisample(36161,o,this.glFormat,n,i):this.gl.renderbufferStorage(36161,this.glFormat,n,i),this.gl.bindRenderbuffer(36161,null),this.trackAllocatedMemory(n*i*(o||1)*ir(this.glFormat,this.device.isWebGL2))}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this.trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}};De.defaultProps={id:void 0,handle:void 0,userData:void 0,format:void 0,width:1,height:1,samples:0};var ve=class extends wr.Framebuffer{get texture(){return this.colorAttachments[0]}constructor(t,r){super(t,r),this.device=void 0,this.gl=void 0,this.handle=void 0;let n=r.handle===null;if(this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),!n){t.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.gl.bindFramebuffer(36160,this.handle);for(let i=0;i<this.colorAttachments.length;++i){let o=this.colorAttachments[i],a=36064+i;o&&this._attachOne(a,o)}this.depthStencilAttachment&&this._attachOne(ea(this.depthStencilAttachment.format),this.depthStencilAttachment),this.gl.bindFramebuffer(36160,null)}r.check!==!1&&this._checkStatus()}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}_checkStatus(){let{gl:t}=this,r=t.bindFramebuffer(36160,this.handle),n=t.checkFramebufferStatus(36160);if(t.bindFramebuffer(36160,r||null),n!==36053)throw new Error(`Framebuffer ${rc(n)}`)}createDepthStencilTexture(t){return new De(this.device,{id:`${this.id}-depth-stencil`,format:t,width:this.width,height:this.height})}resizeAttachments(t,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;t===void 0&&(t=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let n of this.colorAttachments)n.resize({width:t,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.resize({width:t,height:r}),this}_attachOne(t,r){if(r instanceof De)return this._attachWEBGLRenderbuffer(t,r),r;if(Array.isArray(r)){let[n,i=0,o=0]=r;return this._attachTexture(t,n,i,o),n}else if(r instanceof K)return this._attachTexture(t,r,0,0),r;throw new Error("attach")}_attachWEBGLRenderbuffer(t,r){this.gl.framebufferRenderbuffer(36160,t,36161,r.handle)}_attachTexture(t,r,n,i){let{gl:o,gl2:a}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:this.device.assertWebGL2(),a?.framebufferTextureLayer(36160,t,r.target,i,n);break;case 34067:let s=tc(n);o.framebufferTexture2D(36160,t,s,r.handle,i);break;case 3553:o.framebufferTexture2D(36160,t,3553,r.handle,i);break;default:(0,wr.assert)(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function tc(e){return e<34069?e+34069:e}function rc(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${e}`}}var Br=class extends ha.CanvasContext{constructor(t,r){super(r),this.device=void 0,this.presentationSize=void 0,this._framebuffer=null,this.device=t,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new ve(this.device,{handle:null}),this._framebuffer}update(){let t=this.getPixelSize();(t[0]!==this.presentationSize[0]||t[1]!==this.presentationSize[1])&&(this.presentationSize=t)}resize(t){if(this.canvas){let n=this.getDevicePixelRatio(t?.useDevicePixels);this.setDevicePixelRatio(n,t);return}let r=this.device.gl.getExtension("STACKGL_resize_drawingbuffer");r&&t&&"width"in t&&"height"in t&&r.resize(t.width,t.height)}commit(){}};var me=P(I(),1),nc={spector:me.log.get("spector")||me.log.get("inspect")},ic="https://spectorcdn.babylonjs.com/spector.bundle.js",oc=1,re=null,_a=!1;async function pa(e){if(!globalThis.SPECTOR)try{await(0,me.loadScript)(ic)}catch(t){me.log.warn(String(t))}}function Aa(e){var t,r;if(e={...nc,...e},!((t=e)!==null&&t!==void 0&&t.spector)||(!re&&globalThis.SPECTOR&&(me.log.probe(oc,"SPECTOR found and initialized")(),re=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=re)),!re))return null;if(!_a){var n,i;_a=!0,re.spyCanvases(),(n=re)===null||n===void 0||n.onCaptureStarted.add(s=>me.log.info("Spector capture started:",s)()),(i=re)===null||i===void 0||i.onCapture.add(s=>{var l,f,u;me.log.info("Spector capture complete:",s)(),(l=re)===null||l===void 0||l.getResultUI(),(f=re)===null||f===void 0||f.resultView.display(),(u=re)===null||u===void 0||u.resultView.addCapture(s)})}if((r=e)!==null&&r!==void 0&&r.canvas){var o,a;if(typeof e.spector=="string"&&e.spector!==e.canvas.id)return re;(o=re)===null||o===void 0||o.startCapture((a=e)===null||a===void 0?void 0:a.canvas,500),new Promise(s=>setTimeout(s,2e3)).then(s=>{var l;me.log.info("Spector capture stopped after 2 seconds")(),(l=re)===null||l===void 0||l.stopCapture()})}return re}var Fe=P(I(),1);var ac="https://unpkg.com/webgl-debug@2.0.1/index.js";function Ta(e){return e.luma=e.luma||{},e.luma}async function va(){fe()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await(0,Fe.loadScript)(ac))}function ma(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?lc(e,t):sc(e):null}function sc(e){let t=Ta(e);return t.realContext?t.realContext:e}function lc(e,t){if(!globalThis.WebGLDebugUtils)return Fe.log.warn("webgl-debug not loaded")(),e;let r=Ta(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...ze,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,fc.bind(null,t),uc.bind(null,t));for(let a in ze)!(a in n)&&typeof ze[a]=="number"&&(n[a]=ze[a]);class i{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(i,n);let o=Object.create(i);return r.realContext=e,r.debugContext=o,o.debug=!0,o}function ri(e,t){t=Array.from(t).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${e}(${r})`}function fc(e,t,r,n){n=Array.from(n).map(l=>l===void 0?"undefined":l);let i=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),a=e.webgl2?"gl2":"gl1",s=`${i} in ${a}.${r}(${o})`;Fe.log.error(s)();debugger;if(e.throwOnError)throw new Error(s)}function uc(e,t,r){let n="";if(Fe.log.level>=1&&(n=ri(t,r),Fe.log.log(1,n)()),e.break&&e.break.length>0&&(n=n||ri(t,r),e.break.every(o=>n.indexOf(o)!==-1)))debugger;for(let i of r)if(i===void 0){if(n=n||ri(t,r),e.throwOnError)throw new Error(`Undefined argument: ${n}`);Fe.log.error(`Undefined argument: ${n}`)();debugger}}var Ra=P(I(),1);function Sa(e){let t=e.split(/\r?\n/),r=[];for(let n of t){if(n.length<=1)continue;let i=n.split(":");if(i.length===2){let[c,d]=i;r.push({message:d.trim(),type:ba(c),lineNum:0,linePos:0});continue}let[o,a,s,...l]=i,f=parseInt(s,10);isNaN(f)&&(f=0);let u=parseInt(a,10);isNaN(u)&&(u=0),r.push({message:l.join(":").trim(),type:ba(o),lineNum:f,linePos:u})}return r}function ba(e){let t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}var Ur=class extends Ra.Shader{constructor(t,r){switch(super(t,r),this.device=void 0,this.handle=void 0,this.device=t,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return this.getCompilationInfoSync()}getCompilationInfoSync(){let t=this.device.gl.getShaderInfoLog(this.handle);return Sa(t)}_compile(t){t=(i=>i.startsWith("#version ")?i:`#version 100
|
|
314
|
-
${i}`)(t);let{gl:n}=this.device;if(n.shaderSource(this.handle,t),n.compileShader(this.handle),this.compilationStatus=n.getShaderParameter(this.handle,35713)?"success":"error",this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`)}};var ya=P(I(),1);var cc=256,dc=1024,gc=16384,ni=6144,Wr=class extends ya.RenderPass{constructor(t,r){super(t,r),this.device=void 0,this.glParameters=void 0,this.device=t,Ie(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){Ee(this.device.gl),this.props.framebuffer&&ye(this.device,{framebuffer:null})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={};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,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),r.scissorTest=Boolean(t.scissorRect),t.scissorRect&&(r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=t.stencilReference),this.glParameters=r,ye(this.device,r)}clear(){let t={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=gc,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=cc,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=dc,t.clearStencil=this.props.clearStencil),r!==0&&Q(this.device,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];Q(this.device.gl2,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl2.clearBufferiv(ni,t,r);break;case Uint32Array:this.device.gl2.clearBufferuiv(ni,t,r);break;case Float32Array:default:this.device.gl2.clearBufferfv(ni,t,r);break}})}};var J=P(I(),1),Da=P(I(),1);var Hr=P(I(),1);function ii(e,t){let{clamped:r=!0}=t||{};switch(e){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 hc={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},_c={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},we=class{static getBytesPerElement(t){return ii(t.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(t){return(0,Hr.assert)(t.size),ii(t.type||5126).BYTES_PER_ELEMENT*t.size}static resolve(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return new we(hc,...r)}constructor(){this.offset=void 0,this.stride=void 0,this.type=void 0,this.size=void 0,this.divisor=void 0,this.normalized=void 0,this.integer=void 0,this.buffer=void 0,this.index=void 0;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(i=>this._assign(i)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return we.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return we.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=(0,Hr.checkProps)("Accessor",t,_c),t.type!==void 0&&(this.type=t.type,(t.type===5124||t.type===5125)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalize!==void 0&&(this.normalized=t.normalize),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index=="boolean"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function Ea(e){return pc.includes(e)}var pc=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],xa={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function oi(e){let t=xa[e];if(!t)throw new Error("uniform");let[r,n,,i]=t;return{format:i,components:n,glType:r}}function Oa(e){let t=xa[e];if(!t)throw new Error("attribute");let[,r,,n,i]=t;return{attributeType:n,vertexFormat:i,components:r}}function Ca(e,t){let r={attributes:[],bindings:[]};r.attributes=Ac(e,t);let n=mc(e,t);for(let s of n){let l=s.uniforms.map(f=>({name:f.name,format:f.format,byteOffset:f.byteOffset,byteStride:f.byteStride,arrayLength:f.arrayLength}));r.bindings.push({type:"uniform",name:s.name,location:s.location,visibility:(s.vertex?1:0)&(s.fragment?2:0),minBindingSize:s.byteLength,uniforms:l})}let i=vc(e,t),o=0;for(let s of i)if(Ea(s.type)){let{viewDimension:l,sampleType:f}=Sc(s.type);r.bindings.push({type:"texture",name:s.name,location:o,viewDimension:l,sampleType:f}),s.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let a=Tc(e,t);return a!=null&&a.length&&(r.varyings=a),r}function Ac(e,t){let r=[],n=e.getProgramParameter(t,35721);for(let i=0;i<n;i++){let o=e.getActiveAttrib(t,i);if(!o)throw new Error("activeInfo");let{name:a,type:s}=o,l=e.getAttribLocation(t,a);if(l>=0){let{attributeType:f}=Oa(s),u=/instance/i.test(a)?"instance":"vertex";r.push({name:a,location:l,stepMode:u,type:f})}}return r.sort((i,o)=>i.location-o.location),r}function Tc(e,t){if(!D(e))return[];let r=e,n=[],i=e.getProgramParameter(t,35971);for(let o=0;o<i;o++){let a=r.getTransformFeedbackVarying(t,o);if(!a)throw new Error("activeInfo");let{name:s,type:l,size:f}=a,{glType:u,components:c}=oi(l),d=new we({type:u,size:f*c}),g={location:o,name:s,accessor:d};n.push(g)}return n.sort((o,a)=>o.location-a.location),n}function vc(e,t){let r=[],n=e.getProgramParameter(t,35718);for(let i=0;i<n;i++){let o=e.getActiveUniform(t,i);if(!o)throw new Error("activeInfo");let{name:a,size:s,type:l}=o,{name:f,isArray:u}=Rc(a),c=e.getUniformLocation(t,f),d={location:c,name:f,size:s,type:l,isArray:u};if(r.push(d),d.size>1)for(let g=0;g<d.size;g++){let h=`${f}[${g}]`;c=e.getUniformLocation(t,h);let A={...d,name:h,location:c};r.push(A)}}return r}function mc(e,t){if(!D(e))return[];let r=e,n=(a,s)=>r.getActiveUniformBlockParameter(t,a,s),i=[],o=r.getProgramParameter(t,35382);for(let a=0;a<o;a++){let s={name:r.getActiveUniformBlockName(t,a)||"",location:n(a,35391),byteLength:n(a,35392),vertex:n(a,35396),fragment:n(a,35398),uniformCount:n(a,35394),uniforms:[]},l=n(a,35395)||[],f=r.getActiveUniforms(t,l,35383),u=r.getActiveUniforms(t,l,35384),c=r.getActiveUniforms(t,l,35387),d=r.getActiveUniforms(t,l,35388);for(let g=0;g<s.uniformCount;++g){let h=r.getActiveUniform(t,l[g]);if(!h)throw new Error("activeInfo");s.uniforms.push({name:h.name,format:oi(f[g]).format,type:f[g],arrayLength:u[g],byteOffset:c[g],byteStride:d[g]})}i.push(s)}return i.sort((a,s)=>a.location-s.location),i}var bc={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function Sc(e){let t=bc[e];if(!t)throw new Error("sampler");let[r,n]=t;return{viewDimension:r,sampleType:n}}function Rc(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function Pa(e,t,r,n){let i=e,o=n;o===!0&&(o=1),o===!1&&(o=0);let a=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case 5126:return e.uniform1fv(t,a);case 35664:return e.uniform2fv(t,a);case 35665:return e.uniform3fv(t,a);case 35666:return e.uniform4fv(t,a);case 5124:return e.uniform1iv(t,a);case 35667:return e.uniform2iv(t,a);case 35668:return e.uniform3iv(t,a);case 35669:return e.uniform4iv(t,a);case 35670:return e.uniform1iv(t,a);case 35671:return e.uniform2iv(t,a);case 35672:return e.uniform3iv(t,a);case 35673:return e.uniform4iv(t,a);case 5125:return i.uniform1uiv(t,a,1);case 36294:return i.uniform2uiv(t,a,2);case 36295:return i.uniform3uiv(t,a,3);case 36296:return i.uniform4uiv(t,a,4);case 35674:return e.uniformMatrix2fv(t,!1,a);case 35675:return e.uniformMatrix3fv(t,!1,a);case 35676:return e.uniformMatrix4fv(t,!1,a);case 35685:return i.uniformMatrix2x3fv(t,!1,a);case 35686:return i.uniformMatrix2x4fv(t,!1,a);case 35687:return i.uniformMatrix3x2fv(t,!1,a);case 35688:return i.uniformMatrix3x4fv(t,!1,a);case 35689:return i.uniformMatrix4x2fv(t,!1,a);case 35690:return i.uniformMatrix4x3fv(t,!1,a)}throw new Error("Illegal uniform")}function Na(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(e)}}function Ma(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(e)}}var Ia=4,Vr=class extends J.RenderPipeline{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.vs=void 0,this.fs=void 0,this.introspectedLayout=void 0,this.uniforms={},this.bindings={},this.varyings=null,this._uniformCount=0,this._uniformSetters={},this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=(0,J.cast)(r.vs),this.fs=(0,J.cast)(r.fs);let{varyings:n,bufferMode:i=35981}=r;if(n&&n.length>0){var o;this.device.assertWebGL2(),this.varyings=n,(o=this.device.gl2)===null||o===void 0||o.transformFeedbackVaryings(this.handle,n,i)}this._compileAndLink(),this.introspectedLayout=Ca(this.device.gl,this.handle),this.shaderLayout=(0,Da.mergeShaderLayout)(this.introspectedLayout,r.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(t){for(let[r,n]of Object.entries(t)){let i=this.shaderLayout.bindings.find(o=>o.name===r)||this.shaderLayout.bindings.find(o=>o.name===`${r}Uniforms`);if(!i){let o=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");J.log.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${o}`)();continue}switch(n||J.log.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(n instanceof te)&&!(n.buffer instanceof te))throw new Error("buffer value");break;case"texture":if(!(n instanceof K||n instanceof ve))throw new Error("texture value");break;case"sampler":J.log.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(i.type)}this.bindings[r]=n}}setUniforms(t){let{bindings:r}=(0,J.splitUniformsAndBindings)(t);Object.keys(r).forEach(n=>{J.log.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,t)}draw(t){var r;let{renderPass:n,vertexArray:i,vertexCount:o,instanceCount:a,firstVertex:s=0,transformFeedback:l}=t,f=Na(this.props.topology),u=Boolean(i.indexBuffer),c=(r=i.indexBuffer)===null||r===void 0?void 0:r.glIndexType,d=Number(a)>0;if(!this._areTexturesRenderable()||o===0)return!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(n),l&&l.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let g=n;return sa(this.device,this.props.parameters,g.glParameters,()=>{if(u&&d){var h;(h=this.device.gl2)===null||h===void 0||h.drawElementsInstanced(f,o||0,c,s,a||0)}else if(u)this.device.gl.drawElements(f,o||0,c,s);else if(d){var A;(A=this.device.gl2)===null||A===void 0||A.drawArraysInstanced(f,s,o||0,a||0)}else this.device.gl.drawArrays(f,s,o||0);l&&l.end()}),i.unbindAfterRender(n),!0}_compileAndLink(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),J.log.time(Ia,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),J.log.timeEnd(Ia,`linkProgram for ${this.id}`)(),!t.debug&&J.log.level,!t.getProgramParameter(this.handle,35714))throw new Error(`Error linking: ${t.getProgramInfoLog(this.handle)}`);if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error(`Error validating: ${t.getProgramInfoLog(this.handle)}`)}_areTexturesRenderable(){let t=!0;for(let[,r]of Object.entries(this.bindings))r instanceof K&&(r.update(),t=t&&r.loaded);return t}_applyBindings(){this.device.gl.useProgram(this.handle);let{gl2:t}=this.device;if(!t)throw new Error("bindings");let r=0,n=0;for(let i of this.shaderLayout.bindings){let o=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:a}=i,s=t.getUniformBlockIndex(this.handle,a);if(s===4294967295)throw new Error(`Invalid uniform block name ${a}`);t.uniformBlockBinding(this.handle,n,s),o instanceof te?t.bindBufferBase(35345,n,o.handle):t.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),n+=1;break;case"texture":if(!(o instanceof K||o instanceof ve))throw new Error("texture");let l;if(o instanceof K)l=o;else if(o instanceof ve&&o.colorAttachments[0]instanceof K)J.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=o.colorAttachments[0];else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(l.target,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let r of this.shaderLayout.uniforms||[]){var t;let{name:n,location:i,type:o,textureUnit:a}=r,s=(t=this.uniforms[n])!==null&&t!==void 0?t:a;s!==void 0&&Pa(this.device.gl,i,o,s)}}};var wa=P(I(),1);var Lr=P(I(),1);var Xr=class extends Lr.CommandBuffer{constructor(t){super(t,{}),this.device=void 0,this.commands=[],this.device=t}submitCommands(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.commands;for(let r of t)switch(r.name){case"copy-buffer-to-buffer":yc(this.device,r.options);break;case"copy-buffer-to-texture":Ec(this.device,r.options);break;case"copy-texture-to-buffer":xc(this.device,r.options);break;case"copy-texture-to-texture":Oc(this.device,r.options);break}}};function yc(e,t){let r=t.source,n=t.destination,i=e.assertWebGL2();if(i){var o,a;i.bindBuffer(36662,r.handle),i.bindBuffer(36663,n.handle),i.copyBufferSubData(36662,36663,(o=t.sourceOffset)!==null&&o!==void 0?o:0,(a=t.destinationOffset)!==null&&a!==void 0?a:0,t.size),i.bindBuffer(36662,null),i.bindBuffer(36663,null)}else throw new Error("copyBufferToBuffer not implemented in WebGL1")}function Ec(e,t){throw new Error("Not implemented")}function xc(e,t){let{source:r,mipLevel:n=0,aspect:i="all",width:o=t.source.width,height:a=t.source.height,depthOrArrayLayers:s=0,origin:l=[0,0],destination:f,byteOffset:u=0,bytesPerRow:c,rowsPerImage:d}=t;if(i!=="all")throw new Error("not supported");if(n!==0||s!==0||c||d)throw new Error("not implemented");let g=e.assertWebGL2(),{framebuffer:h,destroyFramebuffer:A}=Fa(r);try{let _=f,v=o||h.width,T=a||h.height,m=lt(h.texture.format,!0),E=m.dataFormat,O=m.type;g.bindBuffer(35051,_.handle),g.bindFramebuffer(36160,h.handle),g.readPixels(l[0],l[1],v,T,E,O,u)}finally{g.bindBuffer(35051,null),g.bindFramebuffer(36160,null),A&&h.destroy()}}function Oc(e,t){let{source:r,origin:n=[0,0],destination:i}=t,{width:o=t.destination.width,height:a=t.destination.width}=t,s=0,l=6408,{framebuffer:f,destroyFramebuffer:u}=Fa(r),[c,d]=n,g=!1;e.gl.bindFramebuffer(36160,f.handle);let h=null,A;if(i instanceof K)h=i,o=Number.isFinite(o)?o:h.width,a=Number.isFinite(a)?a:h.height,h.bind(0),A=h.destination;else throw new Error("whoops");return g||e.gl.copyTexImage2D(A,s,l,c,d,o,a,0),h&&h.unbind(),u&&f.destroy(),h}function Fa(e){if(e instanceof Lr.Texture){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var zr=class extends wa.CommandEncoder{constructor(t,r){super(t,r),this.device=void 0,this.commandBuffer=void 0,this.device=t,this.commandBuffer=new Xr(t)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}};var ct=P(I(),1);var Ba;Ba=Symbol.toStringTag;var ut=class extends ct.VertexArray{get[Ba](){return"VertexArray"}static isConstantAttributeZeroSupported(t){return t.info.type==="webgl2"||Rr()==="Chrome"}constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.buffer=null,this.bufferValue=null,this.init=!1,this.device=t,this.handle=this.device.gl2.createVertexArray()}destroy(){if(super.destroy(),this.buffer){var t;(t=this.buffer)===null||t===void 0||t.destroy()}this.handle&&(this.device.gl2.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(t){let r=t;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl2.bindVertexArray(this.handle),this.device.gl2.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r}setBuffer(t,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:i,type:o,stride:a,offset:s,normalized:l,integer:f,divisor:u}=this._getAccessor(t);this.device.gl2.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),f?(this.device.assertWebGL2(),this.device.gl2.vertexAttribIPointer(t,i,o,a,s)):this.device.gl.vertexAttribPointer(t,i,o,l,a,s),this.device.gl.enableVertexAttribArray(t),this.device.gl2.vertexAttribDivisor(t,u||0),this.attributes[t]=n}setConstant(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){if(this.device.gl2.bindVertexArray(this.handle),!this.init){let t=this.indexBuffer;this.device.gl2.bindBuffer(34963,t?.handle||null),this.init=!0}this._applyConstantAttributes()}unbindAfterRender(){this.device.gl2.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttribute(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=xr(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=ut.isConstantAttributeZeroSupported(this.device)||t!==0;(r||i)&&(t=Number(t),this.device.gl2.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl2.bindVertexArray(null))}getConstantBuffer(t,r){let n=Cc(r),i=n.byteLength*t,o=n.length*t;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let a=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),a=a||!Pc(n,this.bufferValue),a){let s=(0,ct.getScratchArray)(r.constructor,o);(0,ct.fillArray)({target:s,source:n,start:0,count:o}),this.buffer.write(s),this.bufferValue=r}return this.buffer}};function Cc(e){return Array.isArray(e)?new Float32Array(e):e}function Pc(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var kr=P(I(),1);var jr=class extends kr.TransformFeedback{constructor(t,r){super(t,r),this.device=void 0,this.gl2=void 0,this.handle=void 0,this.layout=void 0,this.buffers={},this.unusedBuffers={},this.bindOnUse=!0,this._bound=!1,t.assertWebGL2(),this.device=t,this.gl2=t.gl2,this.handle=this.props.handle||this.gl2.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl2.deleteTransformFeedback(this.handle),super.destroy()}begin(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"point-list";this.gl2.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl2.beginTransformFeedback(Ma(t))}end(){this.gl2.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl2.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])})}setBuffer(t,r){let n=this._getVaryingIndex(t),{buffer:i,byteLength:o,byteOffset:a}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=i,kr.log.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:a},this.bindOnUse||this._bindBuffer(n,i,a,o)}getBuffer(t){if(Ua(t))return this.buffers[t]||null;let r=this._getVaryingIndex(t);return r>=0?this.buffers[r]:null}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this.gl2.bindTransformFeedback(36386,t),this;let r;return this._bound?r=t():(this.gl2.bindTransformFeedback(36386,this.handle),this._bound=!0,r=t(),this._bound=!1,this.gl2.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof te)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=t.buffer.byteLength}=t;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(t){if(Ua(t))return Number(t);for(let r of this.layout.varyings)if(t===r.name)return r.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),r,i,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl2.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,o=r&&r.handle;!o||i===void 0?this.gl2.bindBufferBase(35982,t,o):this.gl2.bindBufferRange(35982,t,o,n,i)}};function Ua(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var ar=1,k=class extends H.Device{static isSupported(){return typeof WebGLRenderingContext<"u"||yo()}get features(){return this._features=this._features||ra(this.gl),this._features}get limits(){return this._limits=this._limits||ia(this.gl),this._limits}static attach(t){if(t instanceof k)return t;if(t?.device instanceof H.Device)return t.device;if(!Nc(t))throw new Error("Invalid WebGLRenderingContext");return new k({gl:t})}static async create(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};H.log.groupCollapsed(ar,"WebGLDevice created")(),typeof t.canvas=="string"&&await H.CanvasContext.pageLoaded,(H.log.get("debug")||t.debug)&&await va();let{spector:r}=t;if((H.log.get("spector")||r)&&await pa(),H.log.probe(ar+1,"DOM is loaded")(),t.gl&&t.gl.device)return k.attach(t.gl);let n=new k(t),i=`Created ${n.info.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return H.log.probe(ar,i)(),H.log.table(ar,n.info)(),H.log.groupEnd(ar)(),n}constructor(t){var r;super({...t,id:t.id||(0,H.uid)("webgl-device")}),this.info=void 0,this.canvasContext=void 0,this.handle=void 0,this.lost=void 0,this._resolveContextLost=void 0,this._features=void 0,this._limits=void 0,this.renderPass=null,this.gl=void 0,this.gl2=null,this.debug=!1,this.isWebGL1=void 0,this.isWebGL2=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this._extensions={},this._polyfilled=!1,this.spector=void 0,this._webglLimits=void 0,this._constants=void 0;let n=(r=t.gl)===null||r===void 0?void 0:r.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new Br(this,t),this.lost=new Promise(l=>{this._resolveContextLost=l});let i=l=>{var f;return(f=this._resolveContextLost)===null||f===void 0?void 0:f.call(this,{reason:"destroyed",message:"Computer entered sleep mode, or too many apps or browser tabs are using the GPU."})},o=t.gl||null;if(o=o||(fe()?ko(this.canvasContext.canvas,{...t,onContextLost:i}):null),o=o||(fe()?null:Eo({...t,onContextLost:i})),!o)throw new Error("WebGL context creation failed");this.handle=o,this.gl=this.handle,this.gl2=this.gl,this.isWebGL2=Mc(this.gl),this.isWebGL1=!this.isWebGL2,this.info=$o(this.gl),this.gl.device=this,this.gl._version=this.isWebGL2?2:1,Bo(this.gl);let{enable:a=!0,copyState:s=!1}=t;if(Yn(this.gl,{enable:a,copyState:s,log:function(){for(var l=arguments.length,f=new Array(l),u=0;u<l;u++)f[u]=arguments[u];return H.log.log(1,...f)()}}),fe()&&t.debug&&(this.gl=ma(this.gl,{...t,webgl2:this.isWebGL2,throwOnError:!0}),this.gl2=this.gl,this.debug=!0,H.log.level=Math.max(H.log.level,1),H.log.warn("WebGL debug mode activated. Performance reduced.")()),fe()&&t.spector){let l=this.handle.canvas||t.canvas;this.spector=Aa({...this.props,canvas:l})}}destroy(){let t=this.gl.getExtension("STACKGL_destroy_context");t&&t.destroy()}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(t){return tr(this.gl,t)}isTextureFormatFilterable(t){return Jo(this.gl,t)}isTextureFormatRenderable(t){return Go(this.gl,t)}assertWebGL2(){if(!this.gl2)throw new Error("Requires WebGL2");return this.gl2}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._getBufferProps(t);return new te(this,r)}_createTexture(t){return new K(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new Ye(this,t)}createShader(t){return new Ur(this,t)}createFramebuffer(t){return new ve(this,t)}createRenderPipeline(t){return new Vr(this,t)}createVertexArray(t){return new ut(this,t)}beginRenderPass(t){return new Wr(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}createTransformFeedback(t){return new jr(this,t)}getDefaultRenderPass(){return this.renderPass=this.renderPass||this.beginRenderPass({framebuffer:this.canvasContext.getCurrentFramebuffer()}),this.renderPass}createCommandEncoder(t){return new zr(this,t)}submit(){var t;(t=this.renderPass)===null||t===void 0||t.end(),this.renderPass=null}get webglLimits(){return this._webglLimits=this._webglLimits||oa(this.gl),this._webglLimits}loseDevice(){var t;let r=!1,n=this.gl.getExtension("WEBGL_lose_context");return n&&(r=!0,n.loseContext()),(t=this._resolveContextLost)===null||t===void 0||t.call(this,{reason:"destroyed",message:"Application triggered context loss"}),r}pushState(){Ie(this.gl)}popState(){Ee(this.gl)}setSpectorMetadata(t,r){t.__SPECTOR_Metadata=r}getGLKey(t,r){r=r||this.gl2||this.gl;let n=Number(t);for(let i in r)if(r[i]===n)return`GL.${i}`;return String(t)}setConstantAttribute(t,r){this._constants=this._constants||new Array(this.limits.maxVertexAttributes).fill(null);let n=this._constants[t];switch(n&&wc(n,r)&&H.log.info(1,`setConstantAttribute(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:Ic(this,t,r);break;case Int32Array:Dc(this,t,r);break;case Uint32Array:Fc(this,t,r);break;default:(0,H.assert)(!1)}}};k.type="webgl";function Nc(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function Mc(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Ic(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:(0,H.assert)(!1)}}function Dc(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function Fc(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function wc(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Wa=P(I(),1);var Bc=256,Uc=1024,Wc=16384;var Hc="clear: bad arguments";function $r(e,t){let r=k.attach(e),{framebuffer:n=null,color:i=null,depth:o=null,stencil:a=null}=t||{},s={};n&&(s.framebuffer=n);let l=0;i&&(l|=Wc,i!==!0&&(s.clearColor=i)),o&&(l|=Bc,o!==!0&&(s.clearDepth=o)),a&&(l|=Uc,o!==!0&&(s.clearStencil=o)),(0,Wa.assert)(l!==0,Hc),Q(r.gl,s,()=>{r.gl.clear(l)})}var sr=P(I(),1);var ai=P(I(),1);function Ha(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return(0,ai.assert)(!1),0}}function Va(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return(0,ai.assert)(!1),0}}function dt(e,t){let{sourceX:r=0,sourceY:n=0,sourceFormat:i=6408,targetByteOffset:o=0}=t||{},{target:a,sourceWidth:s,sourceHeight:l,sourceType:f}=t||{},{framebuffer:u,deleteFramebuffer:c}=Vc(e);(0,sr.assert)(u),s=s||u.width,l=l||u.height;let d=u;if(f=f||5121,!a){let h=Ha(i),A=Va(f),_=o+s*l*h*A;a=d.device.createBuffer({byteLength:_})}let g=e.device.createCommandEncoder();return g.copyTextureToBuffer({source:e,width:s,height:l,origin:[r,n],destination:a,byteOffset:o}),g.destroy(),c&&u.destroy(),a}function Vc(e){return e instanceof sr.Framebuffer?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:Xc(e),deleteFramebuffer:!0}}function Xc(e,t){let{device:r,width:n,height:i,id:o}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${o}`,width:n,height:i,colorAttachments:[e]})}var Ue=P($());var w={SUM:1,MEAN:2,MIN:3,MAX:4};function Xa(e,t){return e+t}function Lc(e,t){return t>e?t:e}function zc(e,t){return t<e?t:e}function jc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Xa,0)/r.length:null}function kc(e,t){if(Number.isFinite(t))return e.length?e.length*t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Xa,0):null}function $c(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Lc,-1/0):null}function Kc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(zc,1/0):null}function gt(e,t,r){var n=w[e]||w.SUM;switch(t=Yc(t,r),n){case w.MIN:return function(i){return Kc(i,t)};case w.SUM:return function(i){return kc(i,t)};case w.MEAN:return function(i){return jc(i,t)};case w.MAX:return function(i){return $c(i,t)};default:return null}}function Yc(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Number.isFinite(e)?e:function(r){return t.index=r.index,e(r.source,t)}}function La(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function(r){return t.indices=r.map(function(n){return n.index}),e(r.map(function(n){return n.source}),t)}}var ht;function Kr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var za={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},Be=3402823466e29,si=[32775,32774],li=[32776,32774],ja=[32776,32775],fi=(ht={},Kr(ht,w.SUM,32774),Kr(ht,w.MEAN,32774),Kr(ht,w.MIN,si),Kr(ht,w.MAX,li),ht);var ka={size:1,operation:w.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},$a=4;var Ka=`#version 300 es
|
|
315
|
+
`;var lf={ONE:1};function uf(){return lf}var Ot={name:"fp64-arithmetic",vs:js,getUniforms:uf,fp64ify:ao,fp64LowPart:zs,fp64ifyMatrix4:Ls};var lo=M(B(),1);var fn=class{constructor(t){this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;let r=hr(Object.values(t));lo.log.log(1,"Creating ShaderInputs with modules",r.map(n=>n.name))(),this.modules=t,this.moduleUniforms={},this.moduleBindings={};for(let[n,i]of Object.entries(t)){let o=n;this.moduleUniforms[o]=i.defaultUniforms||{},this.moduleBindings[o]={}}}destroy(){}setProps(t){for(let n of Object.keys(t)){var r;let i=n,o=t[i],s=this.modules[i];if(!s){lo.log.warn(`Module ${n} not found`)();continue}let a=this.moduleUniforms[i],l=((r=s.getUniforms)===null||r===void 0?void 0:r.call(s,o,this.moduleUniforms[i]))||o;this.moduleUniforms[i]={...a,...l}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let t={};for(let r of Object.values(this.moduleBindings))Object.assign(t,r);return t}getDebugTable(){let t={};for(let[n,i]of Object.entries(this.moduleUniforms))for(let[o,s]of Object.entries(i)){var r;t[`${n}.${o}`]={type:(r=this.modules[n].uniformTypes)===null||r===void 0?void 0:r[o],value:String(s)}}return t}};var Fe=M(B(),1),dn=class{constructor(t){this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=t.id||(0,Fe.uid)("geometry"),this.topology=t.topology,this.indices=t.indices||null,this.attributes=t.attributes,this.vertexCount=t.vertexCount,this.bufferLayout=t.bufferLayout||[],this.indices&&(0,Fe.assert)(this.indices.usage===Fe.Buffer.INDEX)}destroy(){var t;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(t=this.attributes.colors)===null||t===void 0||t.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(t){return t.byteLength/12}};function $s(e,t){if(t instanceof dn)return t;let r=cf(e,t),{attributes:n,bufferLayout:i}=ff(e,t);return new dn({topology:t.topology||"triangle-list",bufferLayout:i,vertexCount:t.vertexCount,indices:r,attributes:n})}function cf(e,t){if(!t.indices)return;let r=t.indices.value;return e.createBuffer({usage:Fe.Buffer.INDEX,data:r})}function ff(e,t){let r=[],n={};for(let[o,s]of Object.entries(t.attributes)){let a=o;switch(o){case"POSITION":a="positions";break;case"NORMAL":a="normals";break;case"TEXCOORD_0":a="texCoords";break;case"COLOR_0":a="colors";break}n[a]=e.createBuffer({data:s.value,id:`${o}-buffer`});let{value:l,size:u,normalized:c}=s;r.push({name:a,format:(0,Fe.getVertexFormatFromAttribute)(l,u,c)})}let i=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:i}}var Ks=M(B(),1),Le=class{static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new Le(t),t._lumaData.defaultPipelineFactory}constructor(t){this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=t}createRenderPipeline(t){let r={...Le.defaultProps,...t},n=this._hashRenderPipeline({...r});if(!this._pipelineCache[n]){let i=this.device.createRenderPipeline({...r,vs:this.device.createShader({stage:"vertex",source:r.vs}),fs:r.fs?this.device.createShader({stage:"fragment",source:r.fs}):null});i.hash=n,this._pipelineCache[n]=i,this._useCounts[n]=0}return this._useCounts[n]++,this._pipelineCache[n]}release(t){let r=t.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._pipelineCache[r].destroy(),delete this._pipelineCache[r],delete this._useCounts[r])}_createRenderPipeline(t){if(!t.fs)throw new Error("fs");return this.device.createRenderPipeline({...t,vs:this.device.createShader({stage:"vertex",source:t.vs}),fs:t.fs?this.device.createShader({stage:"fragment",source:t.fs}):null})}_hashRenderPipeline(t){let r=this._getHash(t.vs),n=t.fs?this._getHash(t.fs):0,i="-";switch(this.device.info.type){case"webgpu":let o=this._getHash(JSON.stringify(t.parameters)),s=this._getHash(JSON.stringify(t.bufferLayout));return`${r}/${n}V${i}T${t.topology}P${o}BL${s}}`;default:return`${r}/${n}V${i}`}}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}};Le.defaultProps={...Ks.RenderPipeline.defaultProps,vs:void 0,fs:void 0};function Ys(e,t){var r;let n={},i="Values";if(e.attributes.length===0&&!((r=e.varyings)!==null&&r!==void 0&&r.length))return{"No attributes or varyings":{[i]:"N/A"}};for(let o of e.attributes)if(o){let s=`${o.location} ${o.name}: ${o.type}`;n[`in ${s}`]={[i]:o.stepMode||"vertex"}}for(let o of e.varyings||[]){let s=`${o.location} ${o.name}`;n[`out ${s}`]={[i]:JSON.stringify(o.accessor)}}return n}var J=null,uo=null;function qs(e,t){let{id:r,minimap:n,opaque:i,top:o="0",left:s="0",rgbaScale:a=1}=t;J||(J=document.createElement("canvas"),J.id=r,J.title=r,J.style.zIndex="100",J.style.position="absolute",J.style.top=o,J.style.left=s,J.style.border="blue 1px solid",J.style.transform="scaleY(-1)",document.body.appendChild(J),uo=J.getContext("2d")),(J.width!==e.width||J.height!==e.height)&&(J.width=e.width/2,J.height=e.height/2,J.style.width="400px",J.style.height="400px");let l=e.device.readPixelsToArrayWebGL(e),u=uo.createImageData(e.width,e.height),c=0;for(let f=0;f<l.length;f+=4)u.data[c+f+0]=l[f+0]*a,u.data[c+f+1]=l[f+1]*a,u.data[c+f+2]=l[f+2]*a,u.data[c+f+3]=i?255:l[f+3]*a;uo.putImageData(u,0,0)}var wt=2,df=1e4,ee=class{constructor(t,r){var n,i,o;this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.vertexArray=void 0,this.transformFeedback=null,this.pipeline=void 0,this.shaderInputs=void 0,this._uniformStore=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this._lastLogTime=0,this._logOpen=!1,this._drawCount=0,this.props={...ee.defaultProps,...r},r=this.props,this.id=r.id||(0,V.uid)("model"),this.device=t,Object.assign(this.userData,r.userData);let s=Object.fromEntries(((n=this.props.modules)===null||n===void 0?void 0:n.map(y=>[y.name,y]))||[]);this.setShaderInputs(r.shaderInputs||new fn(s));let a=this.device.info.type==="webgpu";if(this.props.source){if(a){var l;(l=this.props).shaderLayout||(l.shaderLayout=cn(this.props.source))}this.props.fs=this.props.source,this.props.vs=this.props.source}if(a&&typeof this.props.vs!="string"){var u;(u=this.props).shaderLayout||(u.shaderLayout=cn(this.props.vs.wgsl))}let c=hf(t),f=(((i=this.props.modules)===null||i===void 0?void 0:i.length)>0?this.props.modules:(o=this.shaderInputs)===null||o===void 0?void 0:o.getModules())||[],{vs:h,fs:_,getUniforms:m}=this.props.shaderAssembler.assembleShaders({platformInfo:c,...this.props,modules:f});if(this.vs=h,this.fs=_,this._getModuleUniforms=m,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&(this._gpuGeometry=this.setGeometry(r.geometry)),this.pipelineFactory=r.pipelineFactory||Le.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=t.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),r.vertexCount&&this.setVertexCount(r.vertexCount),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&(V.log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")(),this.updateModuleSettings(r.moduleSettings)),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this.pipelineFactory.release(this.pipeline),this._uniformStore.destroy()}predraw(){this.updateShaderInputs()}draw(t){this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:t,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,transformFeedback:this.transformFeedback})}finally{this._logDrawCallEnd()}this._logFramebuffer(t)}setGeometry(t){let r=t&&$s(this.device,t);return this.setTopology(r.topology||"triangle-list"),this.bufferLayout=Zs(this.bufferLayout,r.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r),r}_setGeometryAttributes(t){let r={...t.attributes};for(let[n]of Object.entries(r))!this.pipeline.shaderLayout.attributes.find(i=>i.name===n)&&n!=="positions"&&delete r[n];this.vertexCount=t.vertexCount,this.setIndexBuffer(t.indices),this.setAttributes(t.attributes,"ignore-unknown"),this.setAttributes(r)}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){this.bufferLayout=this._gpuGeometry?Zs(t,this._gpuGeometry.bufferLayout):t,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(t){(0,V.deepEqual)(t,this.parameters,2)||(this.parameters=t,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(t){this.vertexCount=t}setInstanceCount(t){this.instanceCount=t}setShaderInputs(t){this.shaderInputs=t,this._uniformStore=new je.UniformStore(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let n=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=n}}setShaderModuleProps(t){let r=this._getModuleUniforms(t),n=Object.keys(r).filter(o=>{let s=r[o];return!(0,V.isNumberArray)(s)&&typeof s!="number"&&typeof s!="boolean"}),i={};for(let o of n)i[o]=r[o],delete r[o]}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues())}updateModuleSettings(t){V.log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();let{bindings:r,uniforms:n}=(0,V.splitUniformsAndBindings)(this._getModuleUniforms(t));Object.assign(this.bindings,r),Object.assign(this.uniforms,n)}setBindings(t){Object.assign(this.bindings,t)}setUniforms(t){this.pipeline.setUniforms(t),Object.assign(this.uniforms,t)}setIndexBuffer(t){this.vertexArray.setIndexBuffer(t)}setTransformFeedback(t){this.transformFeedback=t}setAttributes(t,r){t.indices&&V.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[n,i]of Object.entries(t)){let o=this.bufferLayout.find(l=>Qs(l).includes(n));if(!o){V.log.warn(`Model(${this.id}): Missing layout for buffer "${n}".`)();continue}let s=Qs(o),a=!1;for(let l of s){let u=this._attributeInfos[l];u&&(this.vertexArray.setBuffer(u.location,i),a=!0)}!a&&r!=="ignore-unknown"&&V.log.warn(`Model(${this.id}): Ignoring buffer "${i.id}" for unknown attribute "${n}"`)()}}setConstantAttributes(t){for(let[r,n]of Object.entries(t)){let i=this._attributeInfos[r];i?this.vertexArray.setConstant(i.location,n):V.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${r}"`)()}}_setPipelineNeedsUpdate(t){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||t}_updatePipeline(){if(this._pipelineNeedsUpdate){this.pipeline&&V.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),this._pipelineNeedsUpdate=!1;let t=this.device.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.vs}),r=this.fs?this.device.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.fs}):null;this.pipeline=this.device.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:t,fs:r}),this._attributeInfos=(0,Js.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)}return this.pipeline}_logDrawCallStart(){let t=V.log.level>3?0:df;V.log.level<2||Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,V.log.group(wt,`>>> DRAWING MODEL ${this.id}`,{collapsed:V.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let t=Ys(this.pipeline.shaderLayout,this.id);V.log.table(wt,t)();let r=this.shaderInputs.getDebugTable();for(let[i,o]of Object.entries(this.uniforms))r[i]={value:o};V.log.table(wt,r)();let n=this._getAttributeDebugTable();V.log.table(wt,this._attributeInfos)(),V.log.table(wt,n)(),V.log.groupEnd(wt)(),this._logOpen=!1}}_logFramebuffer(t){let r=V.log.get("framebuffer");if(this._drawCount++,!r||this._drawCount++>3&&this._drawCount%60)return;let n=t.props.framebuffer;n&&qs(n,{id:n.id,minimap:!0})}_getAttributeDebugTable(){let t={};for(let[r,n]of Object.entries(this._attributeInfos))t[n.location]={name:r,type:n.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[n.location],n.bufferDataType)};if(this.vertexArray.indexBuffer){let{indexBuffer:r}=this.vertexArray,n=r.indexType==="uint32"?new Uint32Array(r.debugData):new Uint16Array(r.debugData);t.indices={name:"indices",type:r.indexType,values:n.toString()}}return t}_getBufferOrConstantValues(t,r){let n=(0,je.getTypedArrayFromDataType)(r);return(t instanceof je.Buffer?new n(t.debugData):t).toString()}};ee.defaultProps={...je.RenderPipeline.defaultProps,source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,transformFeedback:void 0,shaderAssembler:me.getDefaultShaderAssembler()};function Zs(e,t){let r=[...e];for(let n of t){let i=r.findIndex(o=>o.name===n.name);i<0?r.push(n):r[i]=n}return r}function hf(e){return{type:e.info.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,features:e.features}}function Qs(e){var t;return e.attributes?(t=e.attributes)===null||t===void 0?void 0:t.map(r=>r.attribute):[e.name]}var _f="transform_output",$e=class{constructor(t,r){this.device=void 0,this.model=void 0,this.sampler=void 0,this.currentIndex=0,this.samplerTextureMap=null,this.bindings=[],this.resources={},this.device=t,this.sampler=t.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new ee(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Ei({version:300,input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:_f}),vertexCount:r.vertexCount,...r}),this._initialize(r),Object.seal(this)}destroy(){}delete(){this.destroy()}run(t){let{framebuffer:r}=this.bindings[this.currentIndex],n=this.device.beginRenderPass({framebuffer:r,...t});this.model.draw(n),n.end()}update(){console.warn("TextureTransform#update() not implemented")}getData(){let{packed:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("getData() not implemented")}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(t){this._updateBindings(t)}_updateBindings(t){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t)}_updateBinding(t,r){let{sourceBuffers:n,sourceTextures:i,targetTexture:o}=r;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,i),Object.assign(t.sourceBuffers,n),o){t.targetTexture=o;let{width:s,height:a}=o;t.framebuffer&&t.framebuffer.destroy(),t.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:s,height:a,colorAttachments:[o]}),t.framebuffer.resize({width:s,height:a})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:r}=this.bindings[t];for(let n in r)r[n].sampler=this.sampler}};var Ct=M(B(),1),ut=class{constructor(t){this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};let{attributes:r={},indices:n=null,vertexCount:i=null}=t;this.id=t.id||(0,Ct.uid)("geometry"),this.topology=t.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(let[o,s]of Object.entries(r)){let a=ArrayBuffer.isView(s)?{value:s}:s;(0,Ct.assert)(ArrayBuffer.isView(a.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!a.size&&(a.size=3),o==="indices"?((0,Ct.assert)(!this.indices),this.indices=a):this.attributes[o]=a}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=i||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,r){return this}_calculateVertexCount(t,r){if(r)return r.value.length;let n=1/0;for(let i of Object.values(t)){let{value:o,size:s,constant:a}=i;!a&&o&&s>=1&&(n=Math.min(n,o.length/s))}return(0,Ct.assert)(Number.isFinite(n)),n}};var Gs=M(B(),1);var mr=class extends ut{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=(0,Gs.uid)("cube-geometry"),indices:n=!0}=t;super(n?{...t,id:r,topology:"triangle-list",indices:{size:1,value:gf},attributes:{...Tf,...t.attributes}}:{...t,id:r,topology:"triangle-list",indices:void 0,attributes:{...Sf,...t.attributes}})}},gf=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]),pf=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,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,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),mf=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),vf=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),bf=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,-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,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,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1]),yf=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),Af=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),Tf={POSITION:{size:3,value:pf},NORMAL:{size:3,value:mf},TEXCOORD_0:{size:2,value:vf}},Sf={POSITION:{size:3,value:bf},TEXCOORD_0:{size:2,value:yf},COLOR_0:{size:3,value:Af}};var xf="Failed to create WebGL context in Node.js, headless gl returned null",Rf=" luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL contexts can not be created. This may not be an error. For example, this is a typical configuration for isorender applications running on the server.",Ef={width:1,height:1,debug:!0,throwOnError:!1},co=null;function ea(){return co!==null}function ta(e){e={...Ef,...e};let{width:t,height:r,webgl1:n,webgl2:i}=e;if(i&&!n)throw new Error("headless-gl does not support WebGL2");if(!co)throw new Error(Rf);let o=co(t,r,e);if(!o)throw new Error(xf);return o}var j=M(B(),1);function vr(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function ve(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||vr()}var Tv=globalThis.self||globalThis.window||globalThis.global,Sv=globalThis.window||globalThis.self||globalThis.global,xv=globalThis.document||{},Rv=globalThis.process||{},Ev=globalThis.console,ra=globalThis.navigator||{};var fo=globalThis;function hn(e){if(!e&&!ve())return"Node";if(vr(e))return"Electron";let t=e||ra.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":fo.chrome?"Chrome":fo.safari?"Safari":fo.mozInnerScreenX?"Firefox":"Unknown"}var fa=M(B(),1);var br={};function Of(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function wf(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function Cf(e,t){br[e]=!0,t!==void 0&&Of(t)}function Nf(e){let t=e.getError;e.getError=function(){let n;do n=t.apply(e),n!==0&&(br[n]=!0);while(n!==0);for(n in br)if(br[n])return delete br[n],parseInt(n,10);return 0}}var yr=function e(t){let r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let n=0;n<this.attribs.length;n++){let i=new e.VertexAttrib(r);this.attribs[n]=i}this.maxAttrib=0};yr.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()};yr.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var ct=function(t){let r=this;this.gl=t,Nf(t);let n=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(o){return o===r.VERTEX_ARRAY_BINDING_OES?r.currentVertexArrayObject===r.defaultVertexArrayObject?null:r.currentVertexArrayObject:n.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(o){let s=r.currentVertexArrayObject;s.maxAttrib=Math.max(s.maxAttrib,o);let a=s.attribs[o];return a.enabled=!0,n.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(o){let s=r.currentVertexArrayObject;s.maxAttrib=Math.max(s.maxAttrib,o);let a=s.attribs[o];return a.enabled=!1,n.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(o,s){switch(o){case 34962:r.currentArrayBuffer=s;break;case 34963:r.currentVertexArrayObject.elementArrayBuffer=s;break;default:}return n.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(o,s){let l=r.currentVertexArrayObject.attribs[o];switch(s){case 34975:return l.buffer;case 34338:return l.enabled;case 34339:return l.size;case 34340:return l.stride;case 34341:return l.type;case 34922:return l.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(o,s,a,l,u,c){let f=r.currentVertexArrayObject;f.maxAttrib=Math.max(f.maxAttrib,o);let h=f.attribs[o];return h.buffer=r.currentArrayBuffer,h.size=s,h.type=a,h.normalized=l,h.stride=u,h.offset=c,h.recache(),n.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",()=>{wf("OESVertexArrayObject emulation library context restored"),r.reset_()},!0),this.reset_()};ct.prototype.VERTEX_ARRAY_BINDING_OES=34229;ct.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let n=0;n<this.vertexArrayObjects.length;++n)this.vertexArrayObjects.isAlive=!1;let r=this.gl;this.maxVertexAttribs=r.getParameter(34921),this.defaultVertexArrayObject=new yr(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};ct.prototype.createVertexArrayOES=function(){let t=new yr(this);return this.vertexArrayObjects.push(t),t};ct.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};ct.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof yr&&t.hasBeenBound&&t.ext===this)};ct.prototype.bindVertexArrayOES=function(t){let r=this.gl;if(t&&!t.isAlive){Cf(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject");return}let n=this.original,i=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;let o=this.currentVertexArrayObject;if(i===o)return;(!i||o.elementArrayBuffer!==i.elementArrayBuffer)&&n.bindBuffer.call(r,34963,o.elementArrayBuffer);let s=this.currentArrayBuffer,a=Math.max(i?i.maxAttrib:0,o.maxAttrib);for(let l=0;l<=a;l++){let u=o.attribs[l],c=i?i.attribs[l]:null;if((!i||u.enabled!==c.enabled)&&(u.enabled?n.enableVertexAttribArray.call(r,l):n.disableVertexAttribArray.call(r,l)),u.enabled){let f=!1;(!i||u.buffer!==c.buffer)&&(s!==u.buffer&&(n.bindBuffer.call(r,34962,u.buffer),s=u.buffer),f=!0),(f||u.cached!==c.cached)&&n.vertexAttribPointer.call(r,l,u.size,u.type,u.normalized,u.stride,u.offset)}}this.currentArrayBuffer!==s&&n.bindBuffer.call(r,34962,this.currentArrayBuffer)};function na(e){if(typeof e.createVertexArray=="function")return;let t=e.getSupportedExtensions;e.getSupportedExtensions=function(){let i=t.call(this)||[];return i.indexOf("OES_vertex_array_object")<0&&i.push("OES_vertex_array_object"),i};let r=e.getExtension;e.getExtension=function(i){let o=r.call(this,i);return o||(i!=="OES_vertex_array_object"?null:(e.__OESVertexArrayObject||(this.__OESVertexArrayObject=new ct(this)),this.__OESVertexArrayObject))}}var ft=M(B(),1);var ia=M(B(),1),Pf="Invalid WebGLRenderingContext";function If(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function U(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function ho(e){return U(e)?e:null}function oa(e){return(0,ia.assert)(If(e),Pf),e}var sa="OES_element_index",aa="WEBGL_draw_buffers",Mf="EXT_disjoint_timer_query",Df="EXT_disjoint_timer_query_webgl2",Ff="EXT_texture_filter_anisotropic",la="WEBGL_debug_renderer_info",Bf=35723,Uf=4352,kf=36795,Wf=34047,Vf=37445,Hf=37446,H=e=>U(e)?void 0:0,Xf={[3074]:e=>U(e)?void 0:36064,[Bf]:e=>U(e)?void 0:Uf,[35977]:H,[32937]:H,[kf]:(e,t)=>{let r=U(e)?e.getExtension(Df):e.getExtension(Mf);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[Vf]:(e,t)=>{let r=e.getExtension(la);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[Hf]:(e,t)=>{let r=e.getExtension(la);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[Wf]:(e,t)=>{var r;let n=((r=e.luma)===null||r===void 0||(r=r.extensions)===null||r===void 0?void 0:r[Ff])||e.getExtension("EXT_texture_filter_anisotropic");return n?t(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},[32883]:H,[35071]:H,[37447]:H,[36063]:(e,t)=>{if(!U(e)){let r=e.getExtension(aa);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},[35379]:H,[35374]:H,[35377]:H,[34852]:e=>{if(!U(e)){let t=e.getExtension(aa);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},[36203]:e=>e.getExtension(sa)?2147483647:65535,[33001]:e=>e.getExtension(sa)?16777216:65535,[33e3]:e=>16777216,[37157]:H,[35373]:H,[35657]:H,[36183]:H,[37137]:H,[34045]:H,[35978]:H,[35979]:H,[35968]:H,[35376]:H,[35375]:H,[35659]:H,[37154]:H,[35371]:H,[35658]:H,[35076]:H,[35077]:H,[35380]:H};function ua(e,t,r){let n=Xf[r],i=typeof n=="function"?n(e,t,r):n;return i!==void 0?i:t(r)}function Nt(e){if(!e.luma){let r={_polyfilled:!1,_extensions:{}};e.luma=r}return e.luma}var zf="OES_vertex_array_object",ca="ANGLE_instanced_arrays",Lf="WEBGL_draw_buffers",jf="EXT_disjoint_timer_query",$f="EXT_texture_filter_anisotropic",Kf="VertexArray requires WebGL2 or OES_vertex_array_object extension";function Yf(e,t){return{webgl2:U(e),ext:e.getExtension(t)}}var _o={[zf]:{meta:{suffix:"OES"},createVertexArray:()=>{(0,ft.assert)(!1,Kf)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[ca]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(e,t){(0,ft.assert)(t===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[Lf]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{(0,ft.assert)(!1)}},[jf]:{meta:{suffix:"EXT"},createQuery:()=>{(0,ft.assert)(!1)},deleteQuery:()=>{(0,ft.assert)(!1)},beginQuery:()=>{(0,ft.assert)(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:(e,t)=>{}}},_n={readBuffer:(e,t,r)=>{U(e)&&t(r)},getVertexAttrib:(e,t,r,n)=>{let{webgl2:i,ext:o}=Yf(e,ca),s;switch(n){case 35069:s=i?void 0:!1;break;case 35070:s=!i&&!o?0:void 0;break;default:}return s!==void 0?s:t(r,n)},getProgramParameter:(e,t,r,n)=>{if(!U(e))switch(n){case 35967:return 35981;case 35971:return 0;case 35382:return 0;default:}return t(r,n)},getInternalformatParameter:(e,t,r,n,i)=>{if(!U(e))switch(i){case 32937:return new Int32Array([0]);default:}return e.getInternalformatParameter(r,n,i)},getTexParameter(e,t,r,n){switch(n){case 34046:let i=Nt(e),{_extensions:o}=i,s=o[$f];n=s&&s.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,n)},getParameter:ua,hint(e,t,r,n){return t(r,n)}};function da(e){let t=Nt(e);return t._polyfilled||(na(e),qf(e),Zf(e,_o),Jf(e,{target:t,target2:e}),t._polyfilled=!0),e}function qf(e){let t=Nt(e),r=e.getSupportedExtensions()||[],n=["WEBGL_polygon_mode"];for(let i of r)if(!n.includes(i)){let o=e.getExtension(i);t._extensions[i]=o}}function Zf(e,t){let r=Nt(e);for(let n of Object.getOwnPropertyNames(t))n!=="overrides"&&Qf(e,{extension:n,target:r,target2:e})}function Qf(e,t){let{extension:r,target:n,target2:i}=t,o=_o[r];(0,fa.assert)(o);let{meta:s={}}=o,{suffix:a=""}=s,l=e.getExtension(r);for(let u of Object.keys(o)){let c=`${u}${a}`,f=null;u==="meta"||typeof e[u]=="function"||(l&&typeof l[c]=="function"?f=function(){return l[c](...arguments)}:typeof o[u]=="function"&&(f=o[u].bind(n))),f&&(n[u]=f,i[u]=f)}}function Jf(e,t){let{target:r,target2:n}=t;Object.keys(_n).forEach(i=>{if(typeof _n[i]=="function"){let o=e[i]?e[i].bind(e):()=>{},s=_n[i].bind(null,e,o);r[i]=s,n[i]=s}})}var Tr=M(B(),1);var gn={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},xe=(e,t,r)=>t?e.enable(r):e.disable(r),ha=(e,t,r)=>e.hint(r,t),ue=(e,t,r)=>e.pixelStorei(r,t),_a=(e,t,r)=>{let n;return r===36006?n=U(e)?36009:36160:n=36008,e.bindFramebuffer(n,t)},Ar=(e,t,r)=>{let i={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];e.bindBuffer(i,t)};function go(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}var ga={[3042]:xe,[32773]:(e,t)=>e.blendColor(...t),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(e,t)=>e.clearColor(...t),[3107]:(e,t)=>e.colorMask(...t),[2884]:xe,[2885]:(e,t)=>e.cullFace(t),[2929]:xe,[2931]:(e,t)=>e.clearDepth(t),[2932]:(e,t)=>e.depthFunc(t),[2928]:(e,t)=>e.depthRange(...t),[2930]:(e,t)=>e.depthMask(t),[3024]:xe,[35723]:ha,[35725]:(e,t)=>e.useProgram(t),[36007]:(e,t)=>e.bindRenderbuffer(36161,t),[36389]:(e,t)=>{var r,n;return(r=(n=e).bindTransformFeedback)===null||r===void 0?void 0:r.call(n,36386,t)},[34229]:(e,t)=>e.bindVertexArray(t),[36006]:_a,[36010]:_a,[34964]:Ar,[36662]:Ar,[36663]:Ar,[35053]:Ar,[35055]:Ar,[2886]:(e,t)=>e.frontFace(t),[33170]:ha,[2849]:(e,t)=>e.lineWidth(t),[32823]:xe,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:xe,[32926]:xe,[32928]:xe,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:xe,[3088]:(e,t)=>e.scissor(...t),[2960]:xe,[2961]:(e,t)=>e.clearStencil(t),[2968]:(e,t)=>e.stencilMaskSeparate(1028,t),[36005]:(e,t)=>e.stencilMaskSeparate(1029,t),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(e,t)=>e.viewport(...t),[3333]:ue,[3317]:ue,[37440]:ue,[37441]:ue,[37443]:ue,[3330]:ue,[3332]:ue,[3331]:ue,[3314]:ue,[32878]:ue,[3316]:ue,[3315]:ue,[32877]:ue,framebuffer:(e,t)=>{let r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{let r=typeof t=="number"?[t,t]:t;e.blendEquationSeparate(...r)},blendFunc:(e,t)=>{let r=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...r)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(...t),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=go(t)?t:[t,t];let[r,n]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,n)},stencilFunc:(e,t)=>{t=go(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,s,a]=t;e.stencilFuncSeparate(1028,r,n,i),e.stencilFuncSeparate(1029,o,s,a)},stencilOp:(e,t)=>{t=go(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,s,a]=t;e.stencilOpSeparate(1028,r,n,i),e.stencilOpSeparate(1029,o,s,a)},viewport:(e,t)=>e.viewport(...t)};function $(e,t,r){return t[e]!==void 0?t[e]:r[e]}var pa={blendEquation:(e,t,r)=>e.blendEquationSeparate($(32777,t,r),$(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate($(32969,t,r),$(32968,t,r),$(32971,t,r),$(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset($(32824,t,r),$(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage($(32938,t,r),$(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,$(2962,t,r),$(2967,t,r),$(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,$(34816,t,r),$(36003,t,r),$(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,$(2964,t,r),$(2965,t,r),$(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,$(34817,t,r),$(34818,t,r),$(34819,t,r))},po={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),useProgram:(e,t)=>e({[35725]:t}),bindRenderbuffer:(e,t,r)=>e({[36007]:r}),bindTransformFeedback:(e,t,r)=>e({[36389]:r}),bindVertexArray:(e,t)=>e({[34229]:t}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({[36006]:r,[36010]:r});case 36009:return e({[36006]:r});case 36008:return e({[36010]:r});default:return null}},bindBuffer:(e,t,r)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[t];return n?e({[n]:r}):{valueChanged:!0}},blendColor:(e,t,r,n,i)=>e({[32773]:new Float32Array([t,r,n,i])}),blendEquation:(e,t)=>e({[32777]:t,[34877]:t}),blendEquationSeparate:(e,t,r)=>e({[32777]:t,[34877]:r}),blendFunc:(e,t,r)=>e({[32969]:t,[32968]:r,[32971]:t,[32970]:r}),blendFuncSeparate:(e,t,r,n,i)=>e({[32969]:t,[32968]:r,[32971]:n,[32970]:i}),clearColor:(e,t,r,n,i)=>e({[3106]:new Float32Array([t,r,n,i])}),clearDepth:(e,t)=>e({[2931]:t}),clearStencil:(e,t)=>e({[2961]:t}),colorMask:(e,t,r,n,i)=>e({[3107]:[t,r,n,i]}),cullFace:(e,t)=>e({[2885]:t}),depthFunc:(e,t)=>e({[2932]:t}),depthRange:(e,t,r)=>e({[2928]:new Float32Array([t,r])}),depthMask:(e,t)=>e({[2930]:t}),frontFace:(e,t)=>e({[2886]:t}),lineWidth:(e,t)=>e({[2849]:t}),polygonOffset:(e,t,r)=>e({[32824]:t,[10752]:r}),sampleCoverage:(e,t,r)=>e({[32938]:t,[32939]:r}),scissor:(e,t,r,n,i)=>e({[3088]:new Int32Array([t,r,n,i])}),stencilMask:(e,t)=>e({[2968]:t,[36005]:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,n)=>e({[2962]:t,[2967]:r,[2963]:n,[34816]:t,[36003]:r,[36004]:n}),stencilFuncSeparate:(e,t,r,n,i)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:n,[t===1028?2963:36004]:i}),stencilOp:(e,t,r,n)=>e({[2964]:t,[2965]:r,[2966]:n,[34817]:t,[34818]:r,[34819]:n}),stencilOpSeparate:(e,t,r,n,i)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:n,[t===1028?2966:34819]:i}),viewport:(e,t,r,n,i)=>e({[2978]:[t,r,n,i]})},Re=(e,t)=>e.isEnabled(t),mo={[3042]:Re,[2884]:Re,[2929]:Re,[3024]:Re,[32823]:Re,[32926]:Re,[32928]:Re,[3089]:Re,[2960]:Re,[35977]:Re},ma=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Be(e,t){let n=Z.attach(e).gl;if(Gf(t))return;let i={};for(let s in t){let a=Number(s),l=ga[s];l&&(typeof l=="string"?i[l]=!0:l(n,t[s],a))}let o=n.state&&n.state.cache;if(o)for(let s in i){let a=pa[s];a(n,t,o)}}function va(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gn,n=Z.attach(e).gl;if(typeof t=="number"){let s=t,a=mo[s];return a?a(n,s):n.getParameter(s)}let i=Array.isArray(t)?t:Object.keys(t),o={};for(let s of i){let a=mo[s];o[s]=a?a(n,Number(s)):n.getParameter(Number(s))}return o}function Gf(e){for(let t in e)return!1;return!0}function ba(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),n=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&n&&e.length===t.length){for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}var vo=class{constructor(t){let{copyState:r=!1,log:n=()=>{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=void 0,this.program=null,this.stateStack=[],this.enable=!0,this.cache=void 0,this.log=void 0,this.gl=t,this.cache=r?va(t):Object.assign({},gn),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})}pop(){(0,Tr.assert)(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];Be(this.gl,t),this.stateStack.pop()}_updateCache(t){let r=!1,n,i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in t){(0,Tr.assert)(o!==void 0);let s=t[o],a=this.cache[o];ba(s,a)||(r=!0,n=a,i&&!(o in i)&&(i[o]=a),this.cache[o]=s)}return{valueChanged:r,oldValue:n}}};function dt(e){return e.state}function bo(e,t){let{enable:r=!0,copyState:n}=t;if((0,Tr.assert)(n!==void 0),!e.state){e.state=new vo(e,{copyState:n}),td(e);for(let o in po){let s=po[o];ed(e,o,s)}ya(e,"getParameter"),ya(e,"isEnabled")}let i=dt(e);return i.enable=r,e}function Ke(e){let t=dt(e);t||(bo(e,{copyState:!1}),t=dt(e)),t.push()}function Ue(e){let t=dt(e);(0,Tr.assert)(t),t.pop()}function ya(e,t){let r=e[t].bind(e);e[t]=function(i){if(i===void 0||ma.has(i))return r(i);let o=dt(e);return i in o.cache||(o.cache[i]=r(i)),o.enable?o.cache[i]:r(i)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function ed(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(){let o=dt(e);for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];let{valueChanged:u,oldValue:c}=r(o._updateCache,...a);return u&&n(...a),c},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function td(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let i=dt(e);i.program!==n&&(t(n),i.program=n)}}var rd={webgl2:!0,webgl1:!0,powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function Aa(e,t){t={...rd,...t};let r=null,n=o=>r=o.statusMessage||r;e.addEventListener("webglcontextcreationerror",n,!1);let i=null;if(t.type==="webgl2"&&(t={...t,webgl1:!1}),t.type==="webgl1"&&(t={...t,webgl2:!1}),!i&&t.webgl2&&(i=e.getContext("webgl2",t)),!i&&t.webgl1&&(i=e.getContext("webgl",t)),e.removeEventListener("webglcontextcreationerror",n,!1),!i)throw new Error(`Failed to create ${t.webgl2&&!t.webgl1?"WebGL2":"WebGL"} context: ${r||"Unknown error"}`);if(t.onContextLost){let{onContextLost:o}=t;e.addEventListener("webglcontextlost",s=>o(s),!1)}if(t.onContextRestored){let{onContextRestored:o}=t;e.addEventListener("webglcontextrestored",s=>o(s),!1)}return i}function Ta(e){let t=e.getParameter(7936),r=e.getParameter(7937),n=e.getExtension("WEBGL_debug_renderer_info"),i=e.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),o=e.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),s=i||t,a=o||r,l=e.getParameter(7938),u=Sa(s,a),c=nd(s,a),f=id(s,a),h="glsl",_=U(e)?300:100;return{type:U(e)?"webgl2":"webgl",gpu:u,gpuType:f,gpuBackend:c,vendor:s,renderer:a,version:l,shadingLanguage:h,shadingLanguageVersion:_}}function Sa(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function nd(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function id(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(Sa(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function xa(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<"u"?window.navigator||{}:{},r=e.userAgent||t.userAgent||"",n=r.indexOf("MSIE ")!==-1,i=r.indexOf("Trident/")!==-1;return n||i}var To=M(B(),1);function pn(e){switch(e){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(e))}var ne="texture-compression-bc",k="texture-compression-astc",Ee="texture-compression-etc2",od="texture-compression-etc1-webgl",mn="texture-compression-pvrtc-webgl",yo="texture-compression-atc-webgl",Sr="WEBGL_compressed_texture_s3tc",xr="WEBGL_compressed_texture_s3tc_srgb",Pt="EXT_texture_compression_rgtc",Rr="EXT_texture_compression_bptc",sd="WEBGL_compressed_texture_etc",ad="WEBGL_compressed_texture_astc",ld="WEBGL_compressed_texture_etc1",ud="WEBGL_compressed_texture_pvrtc",cd="WEBGL_compressed_texture_atc",Ra="EXT_sRGB",ke="EXT_texture_norm16",fd="WEBGL_color_buffer_float",dd="EXT_color_buffer_float",be=(e,t)=>e.getExtension(t),ht=(e,t)=>t.every(r=>e.getExtension(r)),Ao={"texture-blend-float-webgl1":e=>U(e)?!0:be(e,"EXT_float_blend"),"texture-formats-srgb-webgl1":e=>U(e)?!0:be(e,Ra),"texture-formats-depth-webgl1":e=>U(e)?!0:be(e,"WEBGL_depth_texture"),"texture-formats-float32-webgl1":e=>U(e)?!0:be(e,"OES_texture_float"),"texture-formats-float16-webgl1":e=>U(e)?!0:be(e,"OES_texture_half_float"),"texture-formats-norm16-webgl":e=>U(e)?be(e,ke):!1,"texture-filter-linear-float32-webgl":e=>be(e,"OES_texture_float_linear"),"texture-filter-linear-float16-webgl":e=>be(e,"OES_texture_half_float_linear"),"texture-filter-anisotropic-webgl":e=>be(e,"EXT_texture_filter_anisotropic"),"texture-renderable-float32-webgl":e=>be(e,"EXT_color_buffer_float"),"texture-renderable-float16-webgl":e=>be(e,"EXT_color_buffer_half_float"),"texture-compression-bc":e=>ht(e,[Sr,xr,Pt,Rr]),"texture-compression-bc5-webgl":e=>ht(e,[Pt]),"texture-compression-etc2":e=>ht(e,[sd]),"texture-compression-astc":e=>ht(e,[ad]),"texture-compression-etc1-webgl":e=>ht(e,[ld]),"texture-compression-pvrtc-webgl":e=>ht(e,[ud]),"texture-compression-atc-webgl":e=>ht(e,[cd])};function hd(e,t){var r;return((r=Ao[t])===null||r===void 0?void 0:r.call(Ao,e))||!1}function Ea(e){return Object.keys(Ao).filter(r=>hd(e,r))}var Er={"rgb8unorm-unsized":{gl:6407,gl1:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,gl1:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,renderbuffer:!0},r8snorm:{gl:36756,b:1,c:1},r8uint:{gl:33330,b:1,c:1,renderbuffer:!0},r8sint:{gl:33329,b:1,c:1,renderbuffer:!0},rg8unorm:{gl:33323,b:2,c:2,renderbuffer:!0},rg8snorm:{gl:36757,b:2,c:2},rg8uint:{gl:33336,b:2,c:2,renderbuffer:!0},rg8sint:{gl:33335,b:2,c:2,renderbuffer:!0},r16uint:{gl:33332,b:2,c:1,renderbuffer:!0},r16sint:{gl:33331,b:2,c:1,renderbuffer:!0},r16float:{gl:33325,b:2,c:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:ke},"r16snorm-webgl":{gl:36760,b:2,c:1,f:"texture-formats-norm16-webgl",x:ke},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,gl1:6408,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,gl1:35906,b:4,c:4,gl1ext:Ra,bpp:4},rgba8snorm:{gl:36759,b:4,c:4},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,f:"texture-formats-norm16-webgl",x:ke},"rg16snorm-webgl":{gl:36761,b:2,c:2,f:"texture-formats-norm16-webgl",x:ke},r32uint:{gl:33334,b:4,c:1,bpp:4,renderbuffer:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,renderbuffer:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl"},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:"texture-renderable-float32-webgl",renderbuffer:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,renderbuffer:!0},"rgb10a2unorm-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,renderbuffer:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:"texture-formats-norm16-webgl",x:ke},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:"texture-formats-norm16-webgl",x:ke},rg32uint:{gl:33340,b:8,c:2,renderbuffer:!0},rg32sint:{gl:33339,b:8,c:2,renderbuffer:!0},rg32float:{gl:33328,b:8,c:2,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},rgba16uint:{gl:36214,b:8,c:4,renderbuffer:!0},rgba16sint:{gl:36232,b:8,c:4,renderbuffer:!0},rgba16float:{gl:34842,gl1:6408,b:8,c:4,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},"rgba16unorm-webgl":{gl:32859,b:2,c:4,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:ke},"rgba16snorm-webgl":{gl:36763,b:2,c:4,f:"texture-formats-norm16-webgl",x:ke},"rgb32float-webgl":{gl:34837,gl1:6407,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",gl2ext:dd,gl1ext:fd,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,renderbuffer:!0},rgba32sint:{gl:36226,b:16,c:4,renderbuffer:!0},rgba32float:{gl:34836,b:16,c:4,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},stencil8:{gl:36168,gl1:36168,b:1,c:1,attachment:36128,renderbuffer:!0},depth16unorm:{gl:33189,gl1:33189,b:2,c:1,attachment:36096,renderbuffer:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096},depth32float:{gl:36012,b:4,c:1,attachment:36096,renderbuffer:!0},"depth24plus-stencil8":{gl:34041,gl1:34041,b:4,c:2,p:1,attachment:33306,renderbuffer:!0,depthTexture:!0},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,renderbuffer:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,renderbuffer:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Sr,f:ne},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:xr,f:ne},"bc1-rgba-unorm":{gl:33777,x:Sr,f:ne},"bc1-rgba-unorm-srgb":{gl:35916,x:xr,f:ne},"bc2-rgba-unorm":{gl:33778,x:Sr,f:ne},"bc2-rgba-unorm-srgb":{gl:35918,x:xr,f:ne},"bc3-rgba-unorm":{gl:33779,x:Sr,f:ne},"bc3-rgba-unorm-srgb":{gl:35919,x:xr,f:ne},"bc4-r-unorm":{gl:36283,x:Pt,f:ne},"bc4-r-snorm":{gl:36284,x:Pt,f:ne},"bc5-rg-unorm":{gl:36285,x:Pt,f:ne},"bc5-rg-snorm":{gl:36286,x:Pt,f:ne},"bc6h-rgb-ufloat":{gl:36495,x:Rr,f:ne},"bc6h-rgb-float":{gl:36494,x:Rr,f:ne},"bc7-rgba-unorm":{gl:36492,x:Rr,f:ne},"bc7-rgba-unorm-srgb":{gl:36493,x:Rr,f:ne},"etc2-rgb8unorm":{gl:37492,f:Ee},"etc2-rgb8unorm-srgb":{gl:37494,f:Ee},"etc2-rgb8a1unorm":{gl:37496,f:Ee},"etc2-rgb8a1unorm-srgb":{gl:37497,f:Ee},"etc2-rgba8unorm":{gl:37493,f:Ee},"etc2-rgba8unorm-srgb":{gl:37495,f:Ee},"eac-r11unorm":{gl:37488,f:Ee},"eac-r11snorm":{gl:37489,f:Ee},"eac-rg11unorm":{gl:37490,f:Ee},"eac-rg11snorm":{gl:37491,f:Ee},"astc-4x4-unorm":{gl:37808,f:k},"astc-4x4-unorm-srgb":{gl:37840,f:k},"astc-5x4-unorm":{gl:37809,f:k},"astc-5x4-unorm-srgb":{gl:37841,f:k},"astc-5x5-unorm":{gl:37810,f:k},"astc-5x5-unorm-srgb":{gl:37842,f:k},"astc-6x5-unorm":{gl:37811,f:k},"astc-6x5-unorm-srgb":{gl:37843,f:k},"astc-6x6-unorm":{gl:37812,f:k},"astc-6x6-unorm-srgb":{gl:37844,f:k},"astc-8x5-unorm":{gl:37813,f:k},"astc-8x5-unorm-srgb":{gl:37845,f:k},"astc-8x6-unorm":{gl:37814,f:k},"astc-8x6-unorm-srgb":{gl:37846,f:k},"astc-8x8-unorm":{gl:37815,f:k},"astc-8x8-unorm-srgb":{gl:37847,f:k},"astc-10x5-unorm":{gl:37819,f:k},"astc-10x5-unorm-srgb":{gl:37851,f:k},"astc-10x6-unorm":{gl:37817,f:k},"astc-10x6-unorm-srgb":{gl:37849,f:k},"astc-10x8-unorm":{gl:37818,f:k},"astc-10x8-unorm-srgb":{gl:37850,f:k},"astc-10x10-unorm":{gl:37819,f:k},"astc-10x10-unorm-srgb":{gl:37851,f:k},"astc-12x10-unorm":{gl:37820,f:k},"astc-12x10-unorm-srgb":{gl:37852,f:k},"astc-12x12-unorm":{gl:37821,f:k},"astc-12x12-unorm-srgb":{gl:37853,f:k},"pvrtc-rgb4unorm-webgl":{gl:35840,f:mn},"pvrtc-rgba4unorm-webgl":{gl:35842,f:mn},"pvrtc-rbg2unorm-webgl":{gl:35841,f:mn},"pvrtc-rgba2unorm-webgl":{gl:35843,f:mn},"etc1-rbg-unorm-webgl":{gl:36196,f:od},"atc-rgb-unorm-webgl":{gl:35986,f:yo},"atc-rgba-unorm-webgl":{gl:35986,f:yo},"atc-rgbai-unorm-webgl":{gl:34798,f:yo}},_d={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},gd={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function Or(e,t){let r=wr(t),n=Er[r];if(!n||(U(e)?n.gl===void 0:n.gl1===void 0))return!1;let i=n.x||U(e)&&n.gl2ext||n.gl1ext;return i?Boolean(e.getExtension(i)):!0}function Oa(e,t){var r;return Or(e,t)&&((r=Er[t])===null||r===void 0?void 0:r.renderbuffer)}function wr(e){if(typeof e=="string")return e;let t=Object.entries(Er).find(r=>{let[,n]=r;return n.gl===e||n.gl1===e});if(!t)throw new Error(`Unknown texture format ${e}`);return t[0]}function Cr(e,t){let r=Er[e],n=t?r?.gl:r?.gl1;if(n===void 0)throw new Error(`Unsupported texture format ${e}`);return n}function wa(e,t){let r=wr(t);if(!Or(e,r))return!1;try{if((0,To.decodeTextureFormat)(r).signed)return!1}catch{return!1}return r.endsWith("32float")?Boolean(e.getExtension("OES_texture_float_linear")):r.endsWith("16float")?Boolean(e.getExtension("OES_texture_half_float_linear")):!0}function Ca(e,t){let r=wr(t);return!(!Or(e,r)||typeof r=="number")}function It(e,t){let r=wr(e),n=Cr(r,t),i=(0,To.decodeTextureFormat)(r);return{format:n,dataFormat:pd(i.format,i.integer,i.normalized,n),type:i.dataType?pn(i.dataType):5121,compressed:i.compressed}}function Na(e){let t=Er[e];if(!(t!=null&&t.attachment))throw new Error(`${e} is not a depth stencil format`);return t.attachment}function Pa(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6408,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6408,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5121,i=null,o=null;try{i=e.createTexture(),e.bindTexture(3553,i);let s=0,a=1,l=1,u=0,c=new Uint8Array([0,0,255,255]);e.texImage2D(3553,s,t,a,l,u,r,n,c),o=e.createFramebuffer(),e.bindFramebuffer(36160,o),e.framebufferTexture2D(36160,36064,3553,i,0);let f=e.checkFramebufferStatus(36160)===36053;return e.bindTexture(3553,null),f}finally{e.deleteTexture(i),e.deleteFramebuffer(o)}}function Nr(e,t){let r=wr(e),n=It(r,t),i=_d[n.dataFormat]||4,o=gd[n.type]||1;return i*o}function pd(e,t,r,n){if(n===6408||n===6407)return n;switch(e){case"r":return t&&!r?36244:6403;case"rg":return t&&!r?33320:33319;case"rgb":return t&&!r?36248:6407;case"rgba":return t&&!r?36249:6408;default:return 6408}}function Ia(e){let t=md(e);for(let r of Ea(e))t.add(r);return t}function md(e){e.getExtension("EXT_color_buffer_float"),e.getExtension("WEBGL_color_buffer_float"),e.getExtension("EXT_float_blend");let t=new Set;for(let r of Object.keys(Ma))vd(e,r)&&t.add(r);return t}function vd(e,t){let r=Ma[t];if(!r)return!1;let[n,i]=r||[],o=U(e)?i:n;if(typeof o=="boolean")return o;switch(t){case"texture-renderable-rgba32float-webgl":return U(e)?Boolean(e.getExtension(o)):Pa(e);case"glsl-derivatives":return xo(e,o);case"glsl-frag-data":return xo(e,o,{behavior:"require"});case"glsl-frag-depth":return xo(e,o);default:return Boolean(e.getExtension(o))}}var So={};function xo(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!xa(r))return!0;if(t in So)return So[t];let n=r.behavior||"enable",i=`#extension GL_${t} : ${n}
|
|
316
|
+
void main(void) {}`,o=e.createShader(35633);if(!o)throw new Error("shader");e.shaderSource(o,i),e.compileShader(o);let s=e.getShaderParameter(o,35713);return e.deleteShader(o),So[t]=s,s}var Ma={webgl:[!0,!0],webgl2:[!1,!0],"timer-query-webgl":["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],"transform-feedback-webgl2":[!1,!0],"vertex-array-object-webgl1":["OES_vertex_array_object",!0],"instanced-rendering-webgl1":["ANGLE_instanced_arrays",!0],"multiple-render-targets-webgl1":["WEBGL_draw_buffers",!0],"index-uint32-webgl1":["OES_element_index_uint",!0],"blend-minmax-webgl1":["EXT_blend_minmax",!0],"texture-blend-float-webgl1":["EXT_float_blend","EXT_float_blend"],"texture-formats-srgb-webgl1":["EXT_sRGB",!0],"texture-formats-depth-webgl1":["WEBGL_depth_texture",!0],"texture-formats-float32-webgl1":["OES_texture_float",!0],"texture-formats-float16-webgl1":["OES_texture_half_float",!0],"texture-filter-linear-float32-webgl":["OES_texture_float_linear","OES_texture_float_linear"],"texture-filter-linear-float16-webgl":["OES_texture_half_float_linear","OES_texture_half_float_linear"],"texture-filter-anisotropic-webgl":["EXT_texture_filter_anisotropic","EXT_texture_filter_anisotropic"],"texture-renderable-rgba32float-webgl":["WEBGL_color_buffer_float","EXT_color_buffer_float"],"texture-renderable-float32-webgl":[!1,"EXT_color_buffer_float"],"texture-renderable-float16-webgl":["EXT_color_buffer_half_float","EXT_color_buffer_half_float"],"glsl-frag-data":["WEBGL_draw_buffers",!0],"glsl-frag-depth":["EXT_frag_depth",!0],"glsl-derivatives":["OES_standard_derivatives",!0],"glsl-texture-lod":["EXT_shader_texture_lod",!0]};function Da(e){let t=ho(e);return{maxTextureDimension1D:0,maxTextureDimension2D:e.getParameter(3379),maxTextureDimension3D:t?t.getParameter(32883):0,maxTextureArrayLayers:t?t.getParameter(35071):0,maxBindGroups:1,maxDynamicUniformBuffersPerPipelineLayout:0,maxDynamicStorageBuffersPerPipelineLayout:0,maxSampledTexturesPerShaderStage:e.getParameter(35660),maxSamplersPerShaderStage:e.getParameter(35661),maxStorageBuffersPerShaderStage:0,maxStorageTexturesPerShaderStage:0,maxUniformBuffersPerShaderStage:t?t.getParameter(35375):0,maxUniformBufferBindingSize:t?t.getParameter(35376):0,maxStorageBufferBindingSize:0,minUniformBufferOffsetAlignment:t?t.getParameter(35380):0,minStorageBufferOffsetAlignment:0,maxVertexBuffers:0,maxVertexAttributes:e.getParameter(34921),maxVertexBufferArrayStride:2048,maxInterStageShaderComponents:t?t.getParameter(35659):0,maxComputeWorkgroupStorageSize:0,maxComputeInvocationsPerWorkgroup:0,maxComputeWorkgroupSizeX:0,maxComputeWorkgroupSizeY:0,maxComputeWorkgroupSizeZ:0,maxComputeWorkgroupsPerDimension:0}}function Fa(e){let t=ho(e);function r(i){return e.getParameter(i)}function n(i,o){return t?t.getParameter(i):o||0}return{[33902]:r(33902),[33901]:r(33901),[3379]:r(3379),[34076]:r(34076),[34930]:r(34930),[35661]:r(35661),[35660]:r(35660),[34024]:r(34024),[36348]:r(36348),[34921]:r(34921),[36347]:r(36347),[36349]:r(36349),[3386]:r(3386),[34047]:r(34047),[32883]:n(32883),[35071]:n(35071),[37447]:n(37447),[36063]:n(36063),[35379]:n(35379),[35374]:n(35374),[35377]:n(35377),[34852]:n(34852),[36203]:n(36203),[33001]:n(33001),[33e3]:n(33e3),[37157]:n(37157),[35373]:n(35373),[35657]:n(35657),[36183]:n(36183),[37137]:n(37137),[34045]:n(34045),[35978]:n(35978),[35979]:n(35979),[35968]:n(35968),[35376]:n(35376),[35375]:n(35375),[35659]:n(35659),[37154]:n(37154),[35371]:n(35371),[35658]:n(35658),[35076]:n(35076),[35077]:n(35077),[35380]:n(35380)}}var La=M(B(),1);var Rn=M(B(),1);var Y=M(B(),1);function ae(e,t,r){let i=Z.attach(e).gl;if(bd(t))return r(e);let{nocatch:o=!0}=t;Ke(i),Be(i,t);let s;if(o)s=r(i),Ue(i);else try{s=r(i)}finally{Ue(i)}return s}function bd(e){for(let t in e)return!1;return!0}var yn=M(B(),1);function Ua(e,t,r,n){if((0,yn.isObjectEmpty)(t))return n(e);Ke(e.gl);try{return yd(e,t),Be(e,r),n(e)}finally{Ue(e.gl)}}function yd(e,t){let r=Z.attach(e),{gl:n}=r;if(t.cullMode)switch(t.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(t.frontFace&&n.frontFace(Pr("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.depthBias!==void 0&&n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0),t.depthWriteEnabled!==void 0&&n.depthMask(Td("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(bn("depthCompare",t.depthCompare))),t.stencilWriteMask){let i=t.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(t.stencilReadMask&&yn.log.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let i=t.stencilReadMask||4294967295,o=bn("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,o,0,i),n.stencilFuncSeparate(1029,o,0,i)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let i=Ro("stencilPassOperation",t.stencilPassOperation),o=Ro("stencilFailOperation",t.stencilFailOperation),s=Ro("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,s,i),n.stencilOpSeparate(1029,o,s,i)}if(t.blendColorOperation||t.blendAlphaOperation){n.enable(3042);let i=Ba("blendColorOperation",t.blendColorOperation||"add"),o=Ba("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let s=vn("blendColorSrcFactor",t.blendColorSrcFactor||"one"),a=vn("blendColorDstFactor",t.blendColorDstFactor||"zero"),l=vn("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),u=vn("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(s,a,l,u)}}function bn(e,t){return Pr(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Ro(e,t){return Pr(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Ba(e,t){return Pr(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function vn(e,t){return Pr(e,t,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773})}function Ad(e,t){return`Illegal parameter ${t} for ${e}`}function Pr(e,t,r){if(!(t in r))throw new Error(Ad(e,t));return r[t]}function Td(e,t){return t}function An(e){let t={};return e.addressModeU&&(t[10242]=Eo(e.addressModeU)),e.addressModeV&&(t[10243]=Eo(e.addressModeV)),e.addressModeW&&(t[32882]=Eo(e.addressModeW)),e.magFilter&&(t[10240]=Wa(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=Sd(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=bn("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function ka(e){let t={...e};return e[10241]!==9728&&(t[10241]=9729),t[10242]=33071,t[10243]=33071,t}function Eo(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Wa(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function Sd(e,t){if(!t)return Wa(e);switch(e){case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}var Oe=M(B(),1),se=class extends Oe.Buffer{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.glTarget=void 0,this.glUsage=void 0,this.glIndexType=5123,this.byteLength=void 0,this.bytesUsed=void 0,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),t.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=xd(this.props.usage),this.glUsage=Rd(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r,i=this.glTarget;this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,r,t),this.gl.bindBuffer(i,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(t,r,n),this.trackAllocatedMemory(n)}_initWithByteLength(t){(0,Oe.assert)(t>=0);let r=t;t===0&&(r=new Float32Array(0));let n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.bytesUsed=t,this.byteLength=t,this._setDebugData(null,0,t),this.trackAllocatedMemory(t),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=0,i=void 0,o=this.device.isWebGL2?36663:this.glTarget;this.gl.bindBuffer(o,this.handle),n!==0||i!==void 0?(this.device.assertWebGL2(),this.gl2.bufferSubData(o,r,t,n,i)):this.gl.bufferSubData(o,r,t),this.gl.bindBuffer(o,null),this._setDebugData(t,r,t.byteLength)}async readAsync(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1?arguments[1]:void 0;return this.readSyncWebGL2(t,r)}readSyncWebGL2(){var t;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0;this.device.assertWebGL2(),n=(t=n)!==null&&t!==void 0?t:this.byteLength-r;let i=new Uint8Array(n),o=0;return this.gl.bindBuffer(36662,this.handle),this.gl2.getBufferSubData(36662,r,i,o,n),this.gl.bindBuffer(36662,null),this._setDebugData(i,r,n),i}};function xd(e){return e&Oe.Buffer.INDEX?34963:e&Oe.Buffer.VERTEX?34962:e&Oe.Buffer.UNIFORM?35345:34962}function Rd(e){return e&Oe.Buffer.INDEX||e&Oe.Buffer.VERTEX?35044:e&Oe.Buffer.UNIFORM?35048:35044}var Va=M(B(),1);var _t=class extends Va.Sampler{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.parameters=void 0,this.device=t,this.parameters=An(r),this.device.isWebGL2&&(this.handle=this.handle||this.device.gl2.createSampler(),this._setSamplerParameters(this.parameters))}destroy(){this.handle&&(this.device.gl2.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(t){for(let[r,n]of Object.entries(t)){let i=Number(r);switch(i){case 33082:case 33083:this.device.gl2.samplerParameterf(this.handle,i,n);break;default:this.device.gl2.samplerParameteri(this.handle,i,n);break}}}};var Ed={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},G=class extends Y.Texture{constructor(t,r){var n;super(t,{...Ed,format:"rgba8unorm",...r}),this.MAX_ATTRIBUTES=void 0,this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.sampler=void 0,this.glFormat=void 0,this.type=void 0,this.dataFormat=void 0,this.mipmaps=void 0,this.target=void 0,this.textureUnit=void 0,this.loaded=!1,this._video=void 0,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Od(this.props),this.loaded=!1,typeof((n=this.props)===null||n===void 0?void 0:n.data)=="string"&&Object.assign(this.props,{data:(0,Y.loadImage)(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.props.dimension==="cube")return this.initializeCube(t);let r=t.data;if(r instanceof Promise)return r.then(v=>this.initialize(Object.assign({},t,{pixels:v,data:v}))),this;let n=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(n&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(t)),this;let{parameters:i={}}=t,{pixels:o=null,pixelStore:s={},textureUnit:a=void 0}=t;r||(r=o);let{width:l,height:u,dataFormat:c,type:f,compressed:h=!1,mipmaps:_=!0}=t,{depth:m=0}=t,y=Cr(t.format,this.device.isWebGL2);return{width:l,height:u,compressed:h,dataFormat:c,type:f}=this._deduceParameters({format:t.format,type:f,dataFormat:c,compressed:h,data:r,width:l,height:u}),this.width=l,this.height=u,this.glFormat=y,this.type=f,this.dataFormat=c,this.textureUnit=a,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),_&&this.device.isWebGL1&&Tn(this.width,this.height)&&(Y.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaps`)(),_=!1),this.mipmaps=_,this.setImageData({data:r,width:l,height:u,depth:m,format:y,type:f,dataFormat:c,parameters:s,compressed:h}),this.setSampler(t.sampler),this._setSamplerParameters(i),_&&this.generateMipmap(),n&&(this._video={video:r,parameters:i,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(t){let{mipmaps:r=!0,parameters:n={}}=t;return this.setCubeMapImageData(t).then(()=>{this.loaded=!0,r&&this.generateMipmap(t),this.setSampler(t.sampler),this._setSamplerParameters(n)}),this}setSampler(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r;t instanceof _t?(this.sampler=t,r=t.props):(this.sampler=new _t(this.device,t),r=t);let n=An(r);return this._setSamplerParameters(n),this}resize(t){let{height:r,width:n,mipmaps:i=!1}=t;return n!==this.width||r!==this.height?this.initialize({width:n,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:i}):this}update(){if(this._video){let{video:t,parameters:r,lastTime:n}=this._video;if(n===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}generateMipmap(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.device.isWebGL1&&Tn(this.width,this.height)?(Y.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),ae(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(t);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:n=null,level:i=0,glFormat:o=this.glFormat,offset:s=0,parameters:a={}}=t,{data:l=null,type:u=this.type,width:c=this.width,height:f=this.height,dataFormat:h=this.dataFormat,compressed:_=!1}=t;l||(l=n),{type:u,dataFormat:h,compressed:_,width:c,height:f}=this._deduceParameters({format:this.props.format,type:u,dataFormat:h,compressed:_,data:l,width:c,height:f});let{gl:m}=this;m.bindTexture(this.target,this.handle);let y=null;({data:l,dataType:y}=this._getDataType({data:l,compressed:_}));let v;if(ae(this.gl,a,()=>{switch(y){case"null":m.texImage2D(r,i,o,c,f,0,h,u,l);break;case"typed-array":m.texImage2D(r,i,o,c,f,0,h,u,l,s);break;case"buffer":v=this.device.assertWebGL2(),v.bindBuffer(35052,l.handle||l),v.texImage2D(r,i,o,c,f,0,h,u,s),v.bindBuffer(35052,null);break;case"browser-object":this.device.isWebGL2?m.texImage2D(r,i,o,c,f,0,h,u,l):m.texImage2D(r,i,o,h,u,l);break;case"compressed":for(let[S,T]of l.entries())m.compressedTexImage2D(r,S,T.format,T.width,T.height,0,T.data);break;default:(0,Y.assert)(!1,"Unknown image data type")}}),l&&l.byteLength)this.trackAllocatedMemory(l.byteLength,"Texture");else{let S=Nr(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*S,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:n=null,data:i=null,x:o=0,y:s=0,width:a=this.width,height:l=this.height,level:u=0,glFormat:c=this.glFormat,type:f=this.type,dataFormat:h=this.dataFormat,compressed:_=!1,offset:m=0,parameters:y={}}=t;if({type:f,dataFormat:h,compressed:_,width:a,height:l}=this._deduceParameters({format:this.props.format,type:f,dataFormat:h,compressed:_,data:i,width:a,height:l}),(0,Y.assert)(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=n),i&&i.data){let v=i;i=v.data,a=v.shape[0],l=v.shape[1]}i instanceof se&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),ae(this.gl,y,()=>{if(_)this.gl.compressedTexSubImage2D(r,u,o,s,a,l,c,i);else if(i===null)this.gl.texSubImage2D(r,u,o,s,a,l,h,f,null);else if(ArrayBuffer.isView(i))this.gl.texSubImage2D(r,u,o,s,a,l,h,f,i,m);else if(typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer){let v=this.device.assertWebGL2();v.bindBuffer(35052,i),v.texSubImage2D(r,u,o,s,a,l,h,f,m),v.bindBuffer(35052,null)}else this.device.isWebGL2?this.device.assertWebGL2().texSubImage2D(r,u,o,s,a,l,h,f,i):this.gl.texSubImage2D(r,u,o,s,h,f,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Y.log.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,null),t}_getDataType(t){let{data:r,compressed:n=!1}=t;return n?{data:r,dataType:"compressed"}:r===null?{data:r,dataType:"null"}:ArrayBuffer.isView(r)?{data:r,dataType:"typed-array"}:r instanceof se?{data:r.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&r instanceof WebGLBuffer?{data:r,dataType:"buffer"}:{data:r,dataType:"browser-object"}}_deduceParameters(t){let{format:r,data:n}=t,{width:i,height:o,dataFormat:s,type:a,compressed:l}=t,u=It(r,this.device.isWebGL2);return s=s||u.dataFormat,a=a||u.type,l=l||u.compressed,{width:i,height:o}=this._deduceImageSize(n,i,o),{dataFormat:s,type:a,compressed:l,width:i,height:o,format:r,data:n}}_deduceImageSize(t,r,n){let i;return typeof ImageData<"u"&&t instanceof ImageData?i={width:t.width,height:t.height}:typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement?i={width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?i={width:t.width,height:t.height}:typeof ImageBitmap<"u"&&t instanceof ImageBitmap?i={width:t.width,height:t.height}:typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?i={width:t.videoWidth,height:t.videoHeight}:t?i={width:r,height:n}:i={width:r>=0?r:1,height:n>=0?n:1},(0,Y.assert)(i,"Could not deduced texture size"),(0,Y.assert)(r===void 0||i.width===r,"Deduced texture width does not match supplied width"),(0,Y.assert)(n===void 0||i.height===n,"Deduced texture height does not match supplied height"),i}async setCubeMapImageData(t){let{gl:r}=this,{width:n,height:i,pixels:o,data:s,format:a=6408,type:l=5121}=t,u=o||s,c=await Promise.all(G.FACES.map(f=>{let h=u[f];return Promise.all(Array.isArray(h)?h:[h])}));this.bind(),G.FACES.forEach((f,h)=>{c[h].length>1&&this.props.mipmaps!==!1&&Y.log.warn(`${this.id} has mipmap and multiple LODs.`)(),c[h].forEach((_,m)=>{n&&i?r.texImage2D(f,m,a,n,i,0,a,l,_):r.texImage2D(f,m,a,a,l,_)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:n,height:i,pixels:o,data:s,format:a=6408,type:l=5121}=t,{gl:u}=this,c=o||s;return this.bind(),c instanceof Promise?c.then(f=>this.setImageDataForFace(Object.assign({},t,{face:r,data:f,pixels:f}))):this.width||this.height?u.texImage2D(r,0,a,n,i,0,a,l,c):u.texImage2D(r,0,a,a,l,c),this}setImageData3D(t){let{level:r=0,dataFormat:n,format:i,type:o,width:s,height:a,depth:l=1,offset:u=0,data:c,parameters:f={}}=t;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let h=It(i,this.device.isWebGL2);if(ae(this.gl,f,()=>{ArrayBuffer.isView(c)&&this.gl.texImage3D(this.target,r,h.format,s,a,l,0,h.dataFormat,h.type,c),c instanceof se&&(this.gl.bindBuffer(35052,c.handle),this.gl.texImage3D(this.target,r,n,s,a,l,0,i,o,u))}),c&&c.byteLength)this.trackAllocatedMemory(c.byteLength,"Texture");else{let _=Nr(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*this.depth*_,"Texture")}return this.loaded=!0,this}_setSamplerParameters(t){if(this.device.isWebGL1&&Tn(this.width,this.height)&&(t=ka(t)),!(0,Y.isObjectEmpty)(t)){wd(t),this.gl.bindTexture(this.target,this.handle);for(let[r,n]of Object.entries(t)){let i=Number(r),o=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.target,i,o);break;default:this.gl.texParameteri(this.target,i,o);break}}this.gl.bindTexture(this.target,null)}}_getWebGL1NPOTParameterOverride(t,r){if(this.device.isWebGL1&&Tn(this.width,this.height))switch(t){case 10241:if(r!==9729&&r!==9728)return 9729;break;case 10242:case 10243:return 33071;default:break}return r}};G.FACES=[34069,34070,34071,34072,34073,34074];function Od(e){switch(e.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(e.dimension)}}function Tn(e,t){return!e||!t?!1:!(0,Y.isPowerOfTwo)(e)||!(0,Y.isPowerOfTwo)(t)}function wd(e){Y.log.log(1,"texture sampler parameters",e)()}var za=M(B(),1);var We=M(B(),1);var Ha=M(B(),1);function Sn(e,t){if(typeof t!="string")return t;let r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\./,"");let n=e[t];return(0,Ha.assert)(n!==void 0,`Accessing undefined constant GL.${t}`),n}var Mt="Resource subclass must define virtual methods",xn=class extends We.Resource{constructor(t,r,n){super(t,r,n),this.device=void 0,this.gl=void 0,this.gl2=void 0,this._handle=void 0,this._bound=!1,this.byteLength=0,this.device=Z.attach(t);let i=this.device.gl;oa(i);let{id:o}=r||{};this.gl=i,this.gl2=i,this.id=o||(0,We.uid)(this.constructor.name),this._handle=r?.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0}toString(){return`${this.constructor.name}(${this.id})`}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this.removeStats(),this._handle=null,r&&t&&r.filter(Boolean).forEach(n=>n.destroy()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this._bindHandle(t),this;let r;return this._bound?r=t():(this._bindHandle(this.handle),this._bound=!0,r=t(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}getParameter(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=Sn(this.gl,t),(0,We.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=U(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension)))){let a=i.webgl1,l="webgl2"in i?i.webgl2:i.webgl1;return o?l:a}}return this._getParameter(t,r)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{parameters:r,keys:n}=t,i=this.constructor.PARAMETERS||{},o=U(this.gl),s={},a=r||Object.keys(i);for(let l of a){let u=i[l];if(u&&(!("webgl2"in u)||o)&&(!("extension"in u)||this.gl.getExtension(u.extension))){let f=n?this.device.getGLKey(l):l;s[f]=this.getParameter(l,t),n&&u.type==="GLenum"&&(s[f]=this.device.getGLKey(s[f]))}}return s}setParameter(t,r){t=Sn(this.gl,t),(0,We.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=U(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension))))throw new Error("Parameter not available on this platform");i.type==="GLenum"&&(r=Sn(r))}return this._setParameter(t,r),this}setParameters(t){for(let r in t)this.setParameter(r,t[r]);return this}stubRemovedMethods(t,r,n){return(0,We.stubRemovedMethods)(this,t,r,n)}initialize(t){}_createHandle(){throw new Error(Mt)}_deleteHandle(){throw new Error(Mt)}_bindHandle(t){throw new Error(Mt)}_getOptsFromHandle(){throw new Error(Mt)}_getParameter(t,r){throw new Error(Mt)}_setParameter(t,r){throw new Error(Mt)}};var Xa;Xa=Symbol.toStringTag;var Ye=class extends xn{get[Xa](){return"Renderbuffer"}get width(){return this.props.width}get height(){return this.props.height}get format(){return this.props.format}get samples(){return this.props.samples}get attachment(){}static isTextureFormatSupported(t,r){return Oa(t.gl,r)}constructor(t,r){if(typeof r.format=="number")throw new Error("Renderbuffer");super(t,r,Ye.defaultProps),this.glFormat=void 0,this.glFormat=Cr(this.props.format,t.isWebGL2),this._initialize(this.props)}resize(t){(t.width!==this.width||t.height!==this.height)&&(Object.assign(this.props,{...t,format:this.format,samples:this.samples}),this._initialize(this.props))}_initialize(t){let{format:r,width:n,height:i,samples:o}=t;(0,za.assert)(r,"Needs format"),this.trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),o!==0&&this.device.isWebGL2?this.gl2.renderbufferStorageMultisample(36161,o,this.glFormat,n,i):this.gl.renderbufferStorage(36161,this.glFormat,n,i),this.gl.bindRenderbuffer(36161,null),this.trackAllocatedMemory(n*i*(o||1)*Nr(this.glFormat,this.device.isWebGL2))}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this.trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}};Ye.defaultProps={id:void 0,handle:void 0,userData:void 0,format:void 0,width:1,height:1,samples:0};var we=class extends Rn.Framebuffer{get texture(){return this.colorAttachments[0]}constructor(t,r){super(t,r),this.device=void 0,this.gl=void 0,this.handle=void 0;let n=r.handle===null;if(this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),!n){t.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.gl.bindFramebuffer(36160,this.handle);for(let i=0;i<this.colorAttachments.length;++i){let o=this.colorAttachments[i],s=36064+i;o&&this._attachOne(s,o)}this.depthStencilAttachment&&this._attachOne(Na(this.depthStencilAttachment.format),this.depthStencilAttachment),this.gl.bindFramebuffer(36160,null)}r.check!==!1&&this._checkStatus()}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}_checkStatus(){let{gl:t}=this,r=t.bindFramebuffer(36160,this.handle),n=t.checkFramebufferStatus(36160);if(t.bindFramebuffer(36160,r||null),n!==36053)throw new Error(`Framebuffer ${Nd(n)}`)}createDepthStencilTexture(t){return new Ye(this.device,{id:`${this.id}-depth-stencil`,format:t,width:this.width,height:this.height})}resizeAttachments(t,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;t===void 0&&(t=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let n of this.colorAttachments)n.resize({width:t,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.resize({width:t,height:r}),this}_attachOne(t,r){if(r instanceof Ye)return this._attachWEBGLRenderbuffer(t,r),r;if(Array.isArray(r)){let[n,i=0,o=0]=r;return this._attachTexture(t,n,i,o),n}else if(r instanceof G)return this._attachTexture(t,r,0,0),r;throw new Error("attach")}_attachWEBGLRenderbuffer(t,r){this.gl.framebufferRenderbuffer(36160,t,36161,r.handle)}_attachTexture(t,r,n,i){let{gl:o,gl2:s}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:this.device.assertWebGL2(),s?.framebufferTextureLayer(36160,t,r.target,i,n);break;case 34067:let a=Cd(n);o.framebufferTexture2D(36160,t,a,r.handle,i);break;case 3553:o.framebufferTexture2D(36160,t,3553,r.handle,i);break;default:(0,Rn.assert)(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function Cd(e){return e<34069?e+34069:e}function Nd(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${e}`}}var En=class extends La.CanvasContext{constructor(t,r){super(r),this.device=void 0,this.presentationSize=void 0,this._framebuffer=null,this.device=t,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new we(this.device,{handle:null}),this._framebuffer}update(){let t=this.getPixelSize();(t[0]!==this.presentationSize[0]||t[1]!==this.presentationSize[1])&&(this.presentationSize=t,this.resize())}resize(t){if(!this.device.gl)return;if(this.canvas){let n=this.getDevicePixelRatio(t?.useDevicePixels);this.setDevicePixelRatio(n,t);return}let r=this.device.gl.getExtension("STACKGL_resize_drawingbuffer");r&&t&&"width"in t&&"height"in t&&r.resize(t.width,t.height)}commit(){}};var Ce=M(B(),1),Pd={spector:Ce.log.get("spector")||Ce.log.get("inspect")},Id="https://spectorcdn.babylonjs.com/spector.bundle.js",Md=1,le=null,ja=!1;async function $a(e){if(!globalThis.SPECTOR)try{await(0,Ce.loadScript)(Id)}catch(t){Ce.log.warn(String(t))}}function Ka(e){var t,r;if(e={...Pd,...e},!((t=e)!==null&&t!==void 0&&t.spector)||(!le&&globalThis.SPECTOR&&(Ce.log.probe(Md,"SPECTOR found and initialized")(),le=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=le)),!le))return null;if(!ja){var n,i;ja=!0,le.spyCanvases(),(n=le)===null||n===void 0||n.onCaptureStarted.add(a=>Ce.log.info("Spector capture started:",a)()),(i=le)===null||i===void 0||i.onCapture.add(a=>{var l,u,c;Ce.log.info("Spector capture complete:",a)(),(l=le)===null||l===void 0||l.getResultUI(),(u=le)===null||u===void 0||u.resultView.display(),(c=le)===null||c===void 0||c.resultView.addCapture(a)})}if((r=e)!==null&&r!==void 0&&r.canvas){var o,s;if(typeof e.spector=="string"&&e.spector!==e.canvas.id)return le;(o=le)===null||o===void 0||o.startCapture((s=e)===null||s===void 0?void 0:s.canvas,500),new Promise(a=>setTimeout(a,2e3)).then(a=>{var l;Ce.log.info("Spector capture stopped after 2 seconds")(),(l=le)===null||l===void 0||l.stopCapture()})}return le}var qe=M(B(),1);var Dd="https://unpkg.com/webgl-debug@2.0.1/index.js";function Ya(e){return e.luma=e.luma||{},e.luma}async function qa(){ve()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await(0,qe.loadScript)(Dd))}function Za(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?Bd(e,t):Fd(e):null}function Fd(e){let t=Ya(e);return t.realContext?t.realContext:e}function Bd(e,t){if(!globalThis.WebGLDebugUtils)return qe.log.warn("webgl-debug not loaded")(),e;let r=Ya(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...st,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,Ud.bind(null,t),kd.bind(null,t));for(let s in st)!(s in n)&&typeof st[s]=="number"&&(n[s]=st[s]);class i{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(i,n);let o=Object.create(i);return r.realContext=e,r.debugContext=o,o.debug=!0,o}function Oo(e,t){t=Array.from(t).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${e}(${r})`}function Ud(e,t,r,n){n=Array.from(n).map(l=>l===void 0?"undefined":l);let i=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),s=e.webgl2?"gl2":"gl1",a=`${i} in ${s}.${r}(${o})`;qe.log.error(a)();debugger;if(e.throwOnError)throw new Error(a)}function kd(e,t,r){let n="";if(qe.log.level>=1&&(n=Oo(t,r),qe.log.log(1,n)()),e.break&&e.break.length>0&&(n=n||Oo(t,r),e.break.every(o=>n.indexOf(o)!==-1)))debugger;for(let i of r)if(i===void 0){if(n=n||Oo(t,r),e.throwOnError)throw new Error(`Undefined argument: ${n}`);qe.log.error(`Undefined argument: ${n}`)();debugger}}var Ga=M(B(),1);function Ja(e){let t=e.split(/\r?\n/),r=[];for(let n of t){if(n.length<=1)continue;let i=n.split(":");if(i.length===2){let[f,h]=i;r.push({message:h.trim(),type:Qa(f),lineNum:0,linePos:0});continue}let[o,s,a,...l]=i,u=parseInt(a,10);isNaN(u)&&(u=0);let c=parseInt(s,10);isNaN(c)&&(c=0),r.push({message:l.join(":").trim(),type:Qa(o),lineNum:u,linePos:c})}return r}function Qa(e){let t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}var On=class extends Ga.Shader{constructor(t,r){switch(super(t,r),this.device=void 0,this.handle=void 0,this.device=t,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return this.getCompilationInfoSync()}getCompilationInfoSync(){let t=this.device.gl.getShaderInfoLog(this.handle);return Ja(t)}_compile(t){t=(i=>i.startsWith("#version ")?i:`#version 100
|
|
317
|
+
${i}`)(t);let{gl:n}=this.device;if(n.shaderSource(this.handle,t),n.compileShader(this.handle),this.compilationStatus=n.getShaderParameter(this.handle,35713)?"success":"error",this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`)}};var el=M(B(),1);var Wd=256,Vd=1024,Hd=16384,wo=6144,wn=class extends el.RenderPass{constructor(t,r){super(t,r),this.device=void 0,this.glParameters=void 0,this.device=t,Ke(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){Ue(this.device.gl),this.props.framebuffer&&Be(this.device,{framebuffer:null})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={};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,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),r.scissorTest=Boolean(t.scissorRect),t.scissorRect&&(r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=t.stencilReference),this.glParameters=r,Be(this.device,r)}clear(){let t={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=Hd,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=Wd,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=Vd,t.clearStencil=this.props.clearStencil),r!==0&&ae(this.device,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];ae(this.device.gl2,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl2.clearBufferiv(wo,t,r);break;case Uint32Array:this.device.gl2.clearBufferuiv(wo,t,r);break;case Float32Array:default:this.device.gl2.clearBufferfv(wo,t,r);break}})}};var te=M(B(),1),cl=M(B(),1);var Cn=M(B(),1);var Xd="Failed to deduce GL constant from typed array";function tl(e){switch(ArrayBuffer.isView(e)?e.constructor:e){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(Xd)}}function Ir(e,t){let{clamped:r=!0}=t||{};switch(e){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 zd={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Ld={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Ze=class{static getBytesPerElement(t){return Ir(t.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(t){return(0,Cn.assert)(t.size),Ir(t.type||5126).BYTES_PER_ELEMENT*t.size}static resolve(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return new Ze(zd,...r)}constructor(){this.offset=void 0,this.stride=void 0,this.type=void 0,this.size=void 0,this.divisor=void 0,this.normalized=void 0,this.integer=void 0,this.buffer=void 0,this.index=void 0;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(i=>this._assign(i)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return Ze.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Ze.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=(0,Cn.checkProps)("Accessor",t,Ld),t.type!==void 0&&(this.type=t.type,(t.type===5124||t.type===5125)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalize!==void 0&&(this.normalized=t.normalize),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index=="boolean"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function rl(e){return jd.includes(e)}var jd=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],nl={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function Co(e){let t=nl[e];if(!t)throw new Error("uniform");let[r,n,,i]=t;return{format:i,components:n,glType:r}}function il(e){let t=nl[e];if(!t)throw new Error("attribute");let[,r,,n,i]=t;return{attributeType:n,vertexFormat:i,components:r}}function ol(e,t){let r={attributes:[],bindings:[]};r.attributes=$d(e,t);let n=qd(e,t);for(let a of n){let l=a.uniforms.map(u=>({name:u.name,format:u.format,byteOffset:u.byteOffset,byteStride:u.byteStride,arrayLength:u.arrayLength}));r.bindings.push({type:"uniform",name:a.name,location:a.location,visibility:(a.vertex?1:0)&(a.fragment?2:0),minBindingSize:a.byteLength,uniforms:l})}let i=Yd(e,t),o=0;for(let a of i)if(rl(a.type)){let{viewDimension:l,sampleType:u}=Qd(a.type);r.bindings.push({type:"texture",name:a.name,location:o,viewDimension:l,sampleType:u}),a.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let s=Kd(e,t);return s!=null&&s.length&&(r.varyings=s),r}function $d(e,t){let r=[],n=e.getProgramParameter(t,35721);for(let i=0;i<n;i++){let o=e.getActiveAttrib(t,i);if(!o)throw new Error("activeInfo");let{name:s,type:a}=o,l=e.getAttribLocation(t,s);if(l>=0){let{attributeType:u}=il(a),c=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:l,stepMode:c,type:u})}}return r.sort((i,o)=>i.location-o.location),r}function Kd(e,t){if(!U(e))return[];let r=e,n=[],i=e.getProgramParameter(t,35971);for(let o=0;o<i;o++){let s=r.getTransformFeedbackVarying(t,o);if(!s)throw new Error("activeInfo");let{name:a,type:l,size:u}=s,{glType:c,components:f}=Co(l),h=new Ze({type:c,size:u*f}),_={location:o,name:a,accessor:h};n.push(_)}return n.sort((o,s)=>o.location-s.location),n}function Yd(e,t){let r=[],n=e.getProgramParameter(t,35718);for(let i=0;i<n;i++){let o=e.getActiveUniform(t,i);if(!o)throw new Error("activeInfo");let{name:s,size:a,type:l}=o,{name:u,isArray:c}=Jd(s),f=e.getUniformLocation(t,u),h={location:f,name:u,size:a,type:l,isArray:c};if(r.push(h),h.size>1)for(let _=0;_<h.size;_++){let m=`${u}[${_}]`;f=e.getUniformLocation(t,m);let y={...h,name:m,location:f};r.push(y)}}return r}function qd(e,t){if(!U(e))return[];let r=e,n=(s,a)=>r.getActiveUniformBlockParameter(t,s,a),i=[],o=r.getProgramParameter(t,35382);for(let s=0;s<o;s++){let a={name:r.getActiveUniformBlockName(t,s)||"",location:n(s,35391),byteLength:n(s,35392),vertex:n(s,35396),fragment:n(s,35398),uniformCount:n(s,35394),uniforms:[]},l=n(s,35395)||[],u=r.getActiveUniforms(t,l,35383),c=r.getActiveUniforms(t,l,35384),f=r.getActiveUniforms(t,l,35387),h=r.getActiveUniforms(t,l,35388);for(let _=0;_<a.uniformCount;++_){let m=r.getActiveUniform(t,l[_]);if(!m)throw new Error("activeInfo");a.uniforms.push({name:m.name,format:Co(u[_]).format,type:u[_],arrayLength:c[_],byteOffset:f[_],byteStride:h[_]})}i.push(a)}return i.sort((s,a)=>s.location-a.location),i}var Zd={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function Qd(e){let t=Zd[e];if(!t)throw new Error("sampler");let[r,n]=t;return{viewDimension:r,sampleType:n}}function Jd(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function sl(e,t,r,n){let i=e,o=n;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case 5126:return e.uniform1fv(t,s);case 35664:return e.uniform2fv(t,s);case 35665:return e.uniform3fv(t,s);case 35666:return e.uniform4fv(t,s);case 5124:return e.uniform1iv(t,s);case 35667:return e.uniform2iv(t,s);case 35668:return e.uniform3iv(t,s);case 35669:return e.uniform4iv(t,s);case 35670:return e.uniform1iv(t,s);case 35671:return e.uniform2iv(t,s);case 35672:return e.uniform3iv(t,s);case 35673:return e.uniform4iv(t,s);case 5125:return i.uniform1uiv(t,s,1);case 36294:return i.uniform2uiv(t,s,2);case 36295:return i.uniform3uiv(t,s,3);case 36296:return i.uniform4uiv(t,s,4);case 35674:return e.uniformMatrix2fv(t,!1,s);case 35675:return e.uniformMatrix3fv(t,!1,s);case 35676:return e.uniformMatrix4fv(t,!1,s);case 35685:return i.uniformMatrix2x3fv(t,!1,s);case 35686:return i.uniformMatrix2x4fv(t,!1,s);case 35687:return i.uniformMatrix3x2fv(t,!1,s);case 35688:return i.uniformMatrix3x4fv(t,!1,s);case 35689:return i.uniformMatrix4x2fv(t,!1,s);case 35690:return i.uniformMatrix4x3fv(t,!1,s)}throw new Error("Illegal uniform")}function al(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(e)}}function ll(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(e)}}var ul=4,Nn=class extends te.RenderPipeline{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.vs=void 0,this.fs=void 0,this.introspectedLayout=void 0,this.uniforms={},this.bindings={},this.varyings=null,this._uniformCount=0,this._uniformSetters={},this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=(0,te.cast)(r.vs),this.fs=(0,te.cast)(r.fs);let{varyings:n,bufferMode:i=35981}=r;if(n&&n.length>0){var o;this.device.assertWebGL2(),this.varyings=n,(o=this.device.gl2)===null||o===void 0||o.transformFeedbackVaryings(this.handle,n,i)}switch(this._compileAndLink(),this.introspectedLayout=ol(this.device.gl,this.handle),this.shaderLayout=(0,cl.mergeShaderLayout)(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":te.log.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(t){for(let[r,n]of Object.entries(t)){let i=this.shaderLayout.bindings.find(o=>o.name===r)||this.shaderLayout.bindings.find(o=>o.name===`${r}Uniforms`);if(!i){let o=this.shaderLayout.bindings.map(s=>`"${s.name}"`).join(", ");te.log.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${o}`)();continue}switch(n||te.log.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(n instanceof se)&&!(n.buffer instanceof se))throw new Error("buffer value");break;case"texture":if(!(n instanceof G||n instanceof we))throw new Error("texture value");break;case"sampler":te.log.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(i.type)}this.bindings[r]=n}}setUniforms(t){let{bindings:r}=(0,te.splitUniformsAndBindings)(t);Object.keys(r).forEach(n=>{te.log.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,t)}draw(t){var r;let{renderPass:n,vertexArray:i,vertexCount:o,instanceCount:s,firstVertex:a=0,transformFeedback:l}=t,u=al(this.props.topology),c=Boolean(i.indexBuffer),f=(r=i.indexBuffer)===null||r===void 0?void 0:r.glIndexType,h=Number(s)>0;if(!this._areTexturesRenderable()||o===0)return!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(n),l&&l.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let _=n;return Ua(this.device,this.props.parameters,_.glParameters,()=>{if(c&&h){var m;(m=this.device.gl2)===null||m===void 0||m.drawElementsInstanced(u,o||0,f,a,s||0)}else if(c)this.device.gl.drawElements(u,o||0,f,a);else if(h){var y;(y=this.device.gl2)===null||y===void 0||y.drawArraysInstanced(u,a,o||0,s||0)}else this.device.gl.drawArrays(u,a,o||0);l&&l.end()}),i.unbindAfterRender(n),!0}_compileAndLink(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),te.log.time(ul,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),te.log.timeEnd(ul,`linkProgram for ${this.id}`)(),!t.debug&&te.log.level,!t.getProgramParameter(this.handle,35714))throw new Error(`Error linking: ${t.getProgramInfoLog(this.handle)}`);if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error(`Error validating: ${t.getProgramInfoLog(this.handle)}`)}_areTexturesRenderable(){let t=!0;for(let[,r]of Object.entries(this.bindings))r instanceof G&&(r.update(),t=t&&r.loaded);return t}_applyBindings(){this.device.gl.useProgram(this.handle);let{gl2:t}=this.device;if(!t)throw new Error("bindings");let r=0,n=0;for(let i of this.shaderLayout.bindings){let o=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:s}=i,a=t.getUniformBlockIndex(this.handle,s);if(a===4294967295)throw new Error(`Invalid uniform block name ${s}`);t.uniformBlockBinding(this.handle,n,a),o instanceof se?t.bindBufferBase(35345,n,o.handle):t.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),n+=1;break;case"texture":if(!(o instanceof G||o instanceof we))throw new Error("texture");let l;if(o instanceof G)l=o;else if(o instanceof we&&o.colorAttachments[0]instanceof G)te.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=o.colorAttachments[0];else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(l.target,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let r of this.shaderLayout.uniforms||[]){var t;let{name:n,location:i,type:o,textureUnit:s}=r,a=(t=this.uniforms[n])!==null&&t!==void 0?t:s;a!==void 0&&sl(this.device.gl,i,o,a)}}};var dl=M(B(),1);var In=M(B(),1);var Pn=class extends In.CommandBuffer{constructor(t){super(t,{}),this.device=void 0,this.commands=[],this.device=t}submitCommands(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.commands;for(let r of t)switch(r.name){case"copy-buffer-to-buffer":Gd(this.device,r.options);break;case"copy-buffer-to-texture":eh(this.device,r.options);break;case"copy-texture-to-buffer":th(this.device,r.options);break;case"copy-texture-to-texture":rh(this.device,r.options);break}}};function Gd(e,t){let r=t.source,n=t.destination,i=e.assertWebGL2();if(i){var o,s;i.bindBuffer(36662,r.handle),i.bindBuffer(36663,n.handle),i.copyBufferSubData(36662,36663,(o=t.sourceOffset)!==null&&o!==void 0?o:0,(s=t.destinationOffset)!==null&&s!==void 0?s:0,t.size),i.bindBuffer(36662,null),i.bindBuffer(36663,null)}else throw new Error("copyBufferToBuffer not implemented in WebGL1")}function eh(e,t){throw new Error("Not implemented")}function th(e,t){let{source:r,mipLevel:n=0,aspect:i="all",width:o=t.source.width,height:s=t.source.height,depthOrArrayLayers:a=0,origin:l=[0,0],destination:u,byteOffset:c=0,bytesPerRow:f,rowsPerImage:h}=t;if(i!=="all")throw new Error("not supported");if(n!==0||a!==0||f||h)throw new Error("not implemented");let _=e.assertWebGL2(),{framebuffer:m,destroyFramebuffer:y}=fl(r);try{let v=u,S=o||m.width,T=s||m.height,x=It(m.texture.format,!0),O=x.dataFormat,P=x.type;_.bindBuffer(35051,v.handle),_.bindFramebuffer(36160,m.handle),_.readPixels(l[0],l[1],S,T,O,P,c)}finally{_.bindBuffer(35051,null),_.bindFramebuffer(36160,null),y&&m.destroy()}}function rh(e,t){let{source:r,origin:n=[0,0],destination:i}=t,{width:o=t.destination.width,height:s=t.destination.width}=t,a=0,l=6408,{framebuffer:u,destroyFramebuffer:c}=fl(r),[f,h]=n,_=!1;e.gl.bindFramebuffer(36160,u.handle);let m=null,y;if(i instanceof G)m=i,o=Number.isFinite(o)?o:m.width,s=Number.isFinite(s)?s:m.height,m.bind(0),y=m.destination;else throw new Error("whoops");return _||e.gl.copyTexImage2D(y,a,l,f,h,o,s,0),m&&m.unbind(),c&&u.destroy(),m}function fl(e){if(e instanceof In.Texture){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var Mn=class extends dl.CommandEncoder{constructor(t,r){super(t,r),this.device=void 0,this.commandBuffer=void 0,this.device=t,this.commandBuffer=new Pn(t)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}};var Ft=M(B(),1);var hl;hl=Symbol.toStringTag;var Dt=class extends Ft.VertexArray{get[hl](){return"VertexArray"}static isConstantAttributeZeroSupported(t){return t.info.type==="webgl2"||hn()==="Chrome"}constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.buffer=null,this.bufferValue=null,this.init=!1,this.device=t,this.handle=this.device.gl2.createVertexArray()}destroy(){if(super.destroy(),this.buffer){var t;(t=this.buffer)===null||t===void 0||t.destroy()}this.handle&&(this.device.gl2.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(t){let r=t;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl2.bindVertexArray(this.handle),this.device.gl2.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r}setBuffer(t,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:i,type:o,stride:s,offset:a,normalized:l,integer:u,divisor:c}=this._getAccessor(t);this.device.gl2.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),u?(this.device.assertWebGL2(),this.device.gl2.vertexAttribIPointer(t,i,o,s,a)):this.device.gl.vertexAttribPointer(t,i,o,l,s,a),this.device.gl.enableVertexAttribArray(t),this.device.gl2.vertexAttribDivisor(t,c||0),this.attributes[t]=n}setConstant(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){if(this.device.gl2.bindVertexArray(this.handle),!this.init){let t=this.indexBuffer;this.device.gl2.bindBuffer(34963,t?.handle||null),this.init=!0}this._applyConstantAttributes()}unbindAfterRender(){this.device.gl2.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttribute(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=pn(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=Dt.isConstantAttributeZeroSupported(this.device)||t!==0;(r||i)&&(t=Number(t),this.device.gl2.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl2.bindVertexArray(null))}getConstantBuffer(t,r){let n=nh(r),i=n.byteLength*t,o=n.length*t;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),s=s||!ih(n,this.bufferValue),s){let a=(0,Ft.getScratchArray)(r.constructor,o);(0,Ft.fillArray)({target:a,source:n,start:0,count:o}),this.buffer.write(a),this.bufferValue=r}return this.buffer}};function nh(e){return Array.isArray(e)?new Float32Array(e):e}function ih(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Fn=M(B(),1);var Dn=class extends Fn.TransformFeedback{constructor(t,r){super(t,r),this.device=void 0,this.gl2=void 0,this.handle=void 0,this.layout=void 0,this.buffers={},this.unusedBuffers={},this.bindOnUse=!0,this._bound=!1,t.assertWebGL2(),this.device=t,this.gl2=t.gl2,this.handle=this.props.handle||this.gl2.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl2.deleteTransformFeedback(this.handle),super.destroy()}begin(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"point-list";this.gl2.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl2.beginTransformFeedback(ll(t))}end(){this.gl2.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl2.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])})}setBuffer(t,r){let n=this._getVaryingIndex(t),{buffer:i,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=i,Fn.log.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(n,i,s,o)}getBuffer(t){if(_l(t))return this.buffers[t]||null;let r=this._getVaryingIndex(t);return r>=0?this.buffers[r]:null}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this.gl2.bindTransformFeedback(36386,t),this;let r;return this._bound?r=t():(this.gl2.bindTransformFeedback(36386,this.handle),this._bound=!0,r=t(),this._bound=!1,this.gl2.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof se)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=t.buffer.byteLength}=t;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(t){if(_l(t))return Number(t);for(let r of this.layout.varyings)if(t===r.name)return r.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),r,i,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl2.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,o=r&&r.handle;!o||i===void 0?this.gl2.bindBufferBase(35982,t,o):this.gl2.bindBufferRange(35982,t,o,n,i)}};function _l(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var Bt=M(B(),1);var No=M(B(),1);function Po(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return(0,No.assert)(!1),0}}function gl(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return(0,No.assert)(!1),0}}function Io(e,t){var r;let{sourceX:n=0,sourceY:i=0,sourceFormat:o=6408,sourceAttachment:s=36064}=t||{},{target:a=null,sourceWidth:l,sourceHeight:u,sourceType:c}=t||{},{framebuffer:f,deleteFramebuffer:h}=pl(e);(0,Bt.assert)(f);let{gl:_,handle:m}=f;l=l||f.width,u=u||f.height;let y=s-36064;c=c||((r=f.colorAttachments[y])===null||r===void 0?void 0:r.type)||5121,a=sh(a,c,o,l,u),c=c||tl(a);let v=_.bindFramebuffer(36160,m);return _.readPixels(n,i,l,u,o,c,a),_.bindFramebuffer(36160,v||null),h&&f.destroy(),a}function Qe(e,t){let{target:r,sourceX:n=0,sourceY:i=0,sourceFormat:o=6408,targetByteOffset:s=0}=t||{},{sourceWidth:a,sourceHeight:l,sourceType:u}=t||{},{framebuffer:c,deleteFramebuffer:f}=pl(e);(0,Bt.assert)(c),a=a||c.width,l=l||c.height;let h=c;u=u||5121;let _=r;if(!_){let y=Po(o),v=gl(u),S=s+a*l*y*v;_=h.device.createBuffer({byteLength:S})}let m=e.device.createCommandEncoder();return m.copyTextureToBuffer({source:e,width:a,height:l,origin:[n,i],destination:_,byteOffset:s}),m.destroy(),f&&c.destroy(),_}function pl(e){return e instanceof Bt.Framebuffer?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:oh(e),deleteFramebuffer:!0}}function oh(e,t){let{device:r,width:n,height:i,id:o}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${o}`,width:n,height:i,colorAttachments:[e]})}function sh(e,t,r,n,i){if(e)return e;t=t||5121;let o=Ir(t,{clamped:!1}),s=Po(r);return new o(n*i*s)}var Mr=1,Z=class extends j.Device{static isSupported(){return typeof WebGLRenderingContext<"u"||ea()}get features(){return this._features=this._features||Ia(this.gl),this._features}get limits(){return this._limits=this._limits||Da(this.gl),this._limits}static attach(t){if(t instanceof Z)return t;if(t?.device instanceof j.Device)return t.device;if(!ah(t))throw new Error("Invalid WebGLRenderingContext");return new Z({gl:t})}static async create(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};j.log.groupCollapsed(Mr,"WebGLDevice created")(),typeof t.canvas=="string"&&await j.CanvasContext.pageLoaded,(j.log.get("debug")||t.debug)&&await qa();let{spector:r}=t;if((j.log.get("spector")||r)&&await $a(),j.log.probe(Mr+1,"DOM is loaded")(),t.gl&&t.gl.device)return Z.attach(t.gl);let n=new Z(t),i=`Created ${n.info.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return j.log.probe(Mr,i)(),j.log.table(Mr,n.info)(),j.log.groupEnd(Mr)(),n}constructor(t){var r,n;super({...t,id:t.id||(0,j.uid)("webgl-device")}),this.info=void 0,this.canvasContext=void 0,this.handle=void 0,this.lost=void 0,this._resolveContextLost=void 0,this._features=void 0,this._limits=void 0,this.renderPass=null,this.gl=void 0,this.gl2=null,this.debug=!1,this.isWebGL1=void 0,this.isWebGL2=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this._extensions={},this._polyfilled=!1,this.spector=void 0,this._webglLimits=void 0,this._constants=void 0;let i=(r=t.gl)===null||r===void 0?void 0:r.device;if(i)throw new Error(`WebGL context already attached to device ${i.id}`);let o=t.canvas||((n=t.gl)===null||n===void 0?void 0:n.canvas);this.canvasContext=new En(this,{...t,canvas:o}),this.lost=new Promise(c=>{this._resolveContextLost=c});let s=c=>{var f;return(f=this._resolveContextLost)===null||f===void 0?void 0:f.call(this,{reason:"destroyed",message:"Computer entered sleep mode, or too many apps or browser tabs are using the GPU."})},a=t.gl||null;if(a=a||(ve()?Aa(this.canvasContext.canvas,{...t,onContextLost:s}):null),a=a||(ve()?null:ta({...t,onContextLost:s})),!a)throw new Error("WebGL context creation failed");this.handle=a,this.gl=this.handle,this.gl2=this.gl,this.isWebGL2=lh(this.gl),this.isWebGL1=!this.isWebGL2,this.canvasContext.resize(),this.info=Ta(this.gl),this.gl.device=this,this.gl._version=this.isWebGL2?2:1,da(this.gl);let{enable:l=!0,copyState:u=!1}=t;if(bo(this.gl,{enable:l,copyState:u,log:function(){for(var c=arguments.length,f=new Array(c),h=0;h<c;h++)f[h]=arguments[h];return j.log.log(1,...f)()}}),ve()&&t.debug&&(this.gl=Za(this.gl,{...t,webgl2:this.isWebGL2,throwOnError:!0}),this.gl2=this.gl,this.debug=!0,j.log.level=Math.max(j.log.level,1),j.log.warn("WebGL debug mode activated. Performance reduced.")()),ve()&&t.spector){let c=this.handle.canvas||t.canvas;this.spector=Ka({...this.props,canvas:c})}}destroy(){let t=this.gl.getExtension("STACKGL_destroy_context");t&&t.destroy()}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(t){return Or(this.gl,t)}isTextureFormatFilterable(t){return wa(this.gl,t)}isTextureFormatRenderable(t){return Ca(this.gl,t)}assertWebGL2(){if(!this.gl2)throw new Error("Requires WebGL2");return this.gl2}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._getBufferProps(t);return new se(this,r)}_createTexture(t){return new G(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new _t(this,t)}createShader(t){return new On(this,t)}createFramebuffer(t){return new we(this,t)}createRenderPipeline(t){return new Nn(this,t)}createVertexArray(t){return new Dt(this,t)}beginRenderPass(t){return new wn(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}createTransformFeedback(t){return new Dn(this,t)}getDefaultRenderPass(){return this.renderPass=this.renderPass||this.beginRenderPass({framebuffer:this.canvasContext.getCurrentFramebuffer()}),this.renderPass}createCommandEncoder(t){return new Mn(this,t)}submit(){var t;(t=this.renderPass)===null||t===void 0||t.end(),this.renderPass=null}readPixelsToArrayWebGL(t,r){return Io(t,r)}readPixelsToBufferWebGL2(t,r){return Qe(t,r)}get webglLimits(){return this._webglLimits=this._webglLimits||Fa(this.gl),this._webglLimits}loseDevice(){var t;let r=!1,n=this.gl.getExtension("WEBGL_lose_context");return n&&(r=!0,n.loseContext()),(t=this._resolveContextLost)===null||t===void 0||t.call(this,{reason:"destroyed",message:"Application triggered context loss"}),r}pushState(){Ke(this.gl)}popState(){Ue(this.gl)}setSpectorMetadata(t,r){t.__SPECTOR_Metadata=r}getGLKey(t,r){r=r||this.gl2||this.gl;let n=Number(t);for(let i in r)if(r[i]===n)return`GL.${i}`;return String(t)}setConstantAttribute(t,r){this._constants=this._constants||new Array(this.limits.maxVertexAttributes).fill(null);let n=this._constants[t];switch(n&&dh(n,r)&&j.log.info(1,`setConstantAttribute(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:uh(this,t,r);break;case Int32Array:ch(this,t,r);break;case Uint32Array:fh(this,t,r);break;default:(0,j.assert)(!1)}}};Z.type="webgl";function ah(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function lh(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function uh(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:(0,j.assert)(!1)}}function ch(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function fh(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function dh(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var ml=M(B(),1);var hh=256,_h=1024,gh=16384;var ph="clear: bad arguments";function Bn(e,t){let r=Z.attach(e),{framebuffer:n=null,color:i=null,depth:o=null,stencil:s=null}=t||{},a={};n&&(a.framebuffer=n);let l=0;i&&(l|=gh,i!==!0&&(a.clearColor=i)),o&&(l|=hh,o!==!0&&(a.clearDepth=o)),s&&(l|=_h,o!==!0&&(a.clearStencil=o)),(0,ml.assert)(l!==0,ph),ae(r.gl,a,()=>{r.gl.clear(l)})}var Ge=M(Q());var W={SUM:1,MEAN:2,MIN:3,MAX:4};function vl(e,t){return e+t}function mh(e,t){return t>e?t:e}function vh(e,t){return t<e?t:e}function bh(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(vl,0)/r.length:null}function yh(e,t){if(Number.isFinite(t))return e.length?e.length*t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(vl,0):null}function Ah(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(mh,-1/0):null}function Th(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(vh,1/0):null}function Ut(e,t,r){var n=W[e]||W.SUM;switch(t=Sh(t,r),n){case W.MIN:return function(i){return Th(i,t)};case W.SUM:return function(i){return yh(i,t)};case W.MEAN:return function(i){return bh(i,t)};case W.MAX:return function(i){return Ah(i,t)};default:return null}}function Sh(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Number.isFinite(e)?e:function(r){return t.index=r.index,e(r.source,t)}}function bl(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function(r){return t.indices=r.map(function(n){return n.index}),e(r.map(function(n){return n.source}),t)}}var kt;function Un(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yl={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},Je=3402823466e29,Mo=[32775,32774],Do=[32776,32774],Al=[32776,32775],Fo=(kt={},Un(kt,W.SUM,32774),Un(kt,W.MEAN,32774),Un(kt,W.MIN,Mo),Un(kt,W.MAX,Do),kt);var Tl={size:1,operation:W.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},Sl=4;var xl=`#version 300 es
|
|
315
318
|
#define SHADER_NAME gpu-aggregation-to-grid-vs
|
|
316
319
|
|
|
317
320
|
in vec3 positions;
|
|
@@ -360,7 +363,7 @@ void main(void) {
|
|
|
360
363
|
gl_Position = vec4(pos, 0.0, 1.0);
|
|
361
364
|
gl_PointSize = 1.0;
|
|
362
365
|
}
|
|
363
|
-
`;var
|
|
366
|
+
`;var Rl=`#version 300 es
|
|
364
367
|
#define SHADER_NAME gpu-aggregation-to-grid-fs
|
|
365
368
|
|
|
366
369
|
precision highp float;
|
|
@@ -373,7 +376,7 @@ void main(void) {
|
|
|
373
376
|
fragColor = vec4(vWeights, 1.0);
|
|
374
377
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
375
378
|
}
|
|
376
|
-
`;var
|
|
379
|
+
`;var El=`#version 300 es
|
|
377
380
|
#define SHADER_NAME gpu-aggregation-all-vs-64
|
|
378
381
|
|
|
379
382
|
in vec2 position;
|
|
@@ -401,7 +404,7 @@ void main(void) {
|
|
|
401
404
|
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
402
405
|
gl_PointSize = 1.0;
|
|
403
406
|
}
|
|
404
|
-
`;var
|
|
407
|
+
`;var Ol=`#version 300 es
|
|
405
408
|
#define SHADER_NAME gpu-aggregation-all-fs
|
|
406
409
|
|
|
407
410
|
precision highp float;
|
|
@@ -418,7 +421,7 @@ void main(void) {
|
|
|
418
421
|
fragColor.rgb = textureColor.rgb;
|
|
419
422
|
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
|
|
420
423
|
}
|
|
421
|
-
`;var
|
|
424
|
+
`;var wl=`#version 300 es
|
|
422
425
|
#define SHADER_NAME gpu-aggregation-transform-mean-vs
|
|
423
426
|
in vec4 aggregationValues;
|
|
424
427
|
out vec4 meanValues;
|
|
@@ -430,8 +433,8 @@ void main()
|
|
|
430
433
|
meanValues.w = aggregationValues.w;
|
|
431
434
|
gl_PointSize = 1.0;
|
|
432
435
|
}
|
|
433
|
-
`;var
|
|
434
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Qc(e,t){if(e){if(typeof e=="string")return Ja(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ja(e,t)}}function Ja(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ga(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ga(Object(r),!0).forEach(function(n){ui(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ga(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ui(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Gc=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],es={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},ed=["webgl2","blend-minmax-webgl1","texture-renderable-float32-webgl","texture-blend-float-webgl1","texture-formats-float32-webgl1"],ee=function(){e.getAggregationData=function(n){var i=n.aggregationData,o=n.maxData,a=n.minData,s=n.maxMinData,l=n.pixelIndex,f=l*$a,u={};return i&&(u.cellCount=i[f+3],u.cellWeight=i[f]),s?(u.maxCellWieght=s[0],u.minCellWeight=s[3]):(o&&(u.maxCellWieght=o[0],u.totalCount=o[3]),a&&(u.minCellWeight=a[0],u.totalCount=a[3])),u},e.getCellData=function(n){for(var i=n.countsData,o=n.size,a=o===void 0?1:o,s=i.length/4,l=new Float32Array(s*a),f=new Uint32Array(s),u=0;u<s;u++){for(var c=0;c<a;c++)l[u*a+c]=i[u*4+c];f[u]=i[u*4+3]}return{cellCounts:f,cellWeights:l}},e.isSupported=function(n){return ed.every(function(i){return n.features.has(i)})};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Jc(this,e),this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=void 0,this.device=void 0,this._hasGPUSupport=void 0,this.gridAggregationModel=void 0,this.allAggregationModel=void 0,this.meanTransform=void 0,this.id=n.id||"gpu-grid-aggregator",this.device=r;var i=["blend-minmax-webgl1","texture-renderable-float32-webgl","texture-formats-float32-webgl1"];this._hasGPUSupport=this.device.info.type==="webgl2"&&i.every(function(o){return r.features.has(o)}),this._hasGPUSupport&&this._setupModels()}var t=e.prototype;return t.delete=function(){var n=this.gridAggregationModel,i=this.allAggregationModel,o=this.meanTransform,a=this.state,s=a.textures,l=a.framebuffers,f=a.maxMinFramebuffers,u=a.minFramebuffers,c=a.maxFramebuffers,d=a.meanTextures,g=a.resources;n?.destroy(),i?.destroy(),o?.destroy(),rd([l,s,f,u,c,d,g])},t.run=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({results:{}});var i=this._normalizeAggregationParams(n);return this._hasGPUSupport||Ue.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(i)},t.getData=function(n){var i={},o=this.state.results;o[n].aggregationData||(o[n].aggregationData=o[n].aggregationBuffer.getData()),i.aggregationData=o[n].aggregationData;for(var a in es){var s=es[a];(o[n][a]||o[n][s])&&(o[n][a]=o[n][a]||o[n][s].getData(),i[a]=o[n][a])}return i},t.updateShaders=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({shaderOptions:n,modelDirty:!0})},t._normalizeAggregationParams=function(n){var i=G(G({},za),n),o=i.weights;return o&&(i.weights=td(o)),i},t.setState=function(n){Object.assign(this.state,n)},t._getAggregateData=function(n){var i={},o=this.state,a=o.textures,s=o.framebuffers,l=o.maxMinFramebuffers,f=o.minFramebuffers,u=o.maxFramebuffers,c=o.resources,d=n.weights;for(var g in d){i[g]={};var h=d[g],A=h.needMin,_=h.needMax,v=h.combineMaxMin;i[g].aggregationTexture=a[g],i[g].aggregationBuffer=dt(s[g],{target:d[g].aggregationBuffer,sourceType:5126}),A&&_&&v?(i[g].maxMinBuffer=dt(l[g],{target:d[g].maxMinBuffer,sourceType:5126}),i[g].maxMinTexture=c["".concat(g,"-maxMinTexture")]):(A&&(i[g].minBuffer=dt(f[g],{target:d[g].minBuffer,sourceType:5126}),i[g].minTexture=c["".concat(g,"-minTexture")]),_&&(i[g].maxBuffer=dt(u[g],{target:d[g].maxBuffer,sourceType:5126}),i[g].maxTexture=c["".concat(g,"-maxTexture")]))}return this._trackGPUResultBuffers(i,d),i},t._renderAggregateData=function(n){var i=n.cellSize,o=n.projectPoints,a=n.attributes,s=n.moduleSettings,l=n.numCol,f=n.numRow,u=n.weights,c=n.translation,d=n.scaling,g=this.state,h=g.maxMinFramebuffers,A=g.minFramebuffers,_=g.maxFramebuffers,v=[l,f],T={blend:!0,depthTest:!1,blendFunc:[1,1]},m={cellSize:i,gridSize:v,projectPoints:o,translation:c,scaling:d};for(var E in u){var O=u[E],C=O.needMin,N=O.needMax,M=C&&N&&u[E].combineMaxMin;this._renderToWeightsTexture({id:E,parameters:T,moduleSettings:s,uniforms:m,gridSize:v,attributes:a,weights:u}),M?this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:ja}),gridSize:v,minOrMaxFb:h[E],clearParams:{clearColor:[0,0,0,Be]},combineMaxMin:M}):(C&&this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:si}),gridSize:v,minOrMaxFb:A[E],clearParams:{clearColor:[Be,Be,Be,0]},combineMaxMin:M}),N&&this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:li}),gridSize:v,minOrMaxFb:_[E],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:M}))}},t._renderToMaxMinTexture=function(n){var i=this,o=n.id,a=n.parameters,s=n.gridSize,l=n.minOrMaxFb,f=n.combineMaxMin,u=n.clearParams,c=u===void 0?{}:u,d=this.state.framebuffers,g=this.allAggregationModel;Q(this.device,G(G({},c),{},{framebuffer:l,viewport:[0,0,s[0],s[1]]}),function(){$r(i.device,{color:!0}),g.setUniforms({gridSize:s,combineMaxMin:f}),g.setBindings({uSampler:d[o].texture}),g.draw()})},t._renderToWeightsTexture=function(n){var i=this,o=n.id,a=n.parameters,s=n.moduleSettings,l=n.uniforms,f=n.gridSize,u=n.weights,c=this.state,d=c.framebuffers,g=c.equations,h=c.weightAttributes,A=this.gridAggregationModel,_=u[o].operation,v=_===w.MIN?[Be,Be,Be,0]:[0,0,0,0];if(Q(this.device,{framebuffer:d[o],viewport:[0,0,f[0],f[1]],clearColor:v},function(){$r(i.device,{color:!0});var C={weights:h[o]};A.draw({parameters:G(G({},a),{},{blendEquation:g[o]}),moduleSettings:s,uniforms:l,attributes:C})}),_===w.MEAN){var T=this.state,m=T.meanTextures,E=T.textures,O={_sourceTextures:{aggregationValues:m[o]},_targetTexture:E[o],elementCount:E[o].width*E[o].height};this.meanTransform?this.meanTransform.update(O):this.meanTransform=od(this.device,O),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),d[o].attach(ui({},36064,E[o]))}},t._runAggregation=function(n){this._updateModels(n),this._setupFramebuffers(n),this._renderAggregateData(n);var i=this._getAggregateData(n);return this.setState({results:i}),i},t._setupFramebuffers=function(n){var i=this.state,o=i.textures,a=i.framebuffers,s=i.maxMinFramebuffers,l=i.minFramebuffers,f=i.maxFramebuffers,u=i.meanTextures,c=i.equations,d=n.weights,g=n.numCol,h=n.numRow,A={width:g,height:h};for(var _ in d){var v=d[_],T=v.needMin,m=v.needMax,E=v.combineMaxMin,O=v.operation;o[_]=d[_].aggregationTexture||o[_]||_t(this.device,{id:"".concat(_,"-texture"),width:g,height:h}),o[_].resize(A);var C=o[_];O===w.MEAN&&(u[_]=u[_]||_t(this.device,{id:"".concat(_,"-mean-texture"),width:g,height:h}),u[_].resize(A),C=u[_]),a[_]?a[_].attach(ui({},36064,C)):a[_]=lr(this.device,{id:"".concat(_,"-fb"),width:g,height:h,texture:C}),a[_].resize(A),c[_]=fi[O]||fi[w.SUM],(T||m)&&(T&&m&&E?s[_]||(C=d[_].maxMinTexture||this._getMinMaxTexture("".concat(_,"-maxMinTexture")),s[_]=lr(this.device,{id:"".concat(_,"-maxMinFb"),texture:C})):(T&&(l[_]||(C=d[_].minTexture||this._getMinMaxTexture("".concat(_,"-minTexture")),l[_]=lr(this.device,{id:"".concat(_,"-minFb"),texture:C}))),m&&(f[_]||(C=d[_].maxTexture||this._getMinMaxTexture("".concat(_,"-maxTexture")),f[_]=lr(this.device,{id:"".concat(_,"-maxFb"),texture:C})))))}},t._getMinMaxTexture=function(n){var i=this.state.resources;return i[n]||(i[n]=_t(this.device,{id:"resourceName"})),i[n]},t._setupModels=function(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=i.numCol,a=o===void 0?0:o,s=i.numRow,l=s===void 0?0:s,f=this.state.shaderOptions;if((n=this.gridAggregationModel)===null||n===void 0||n.destroy(),this.gridAggregationModel=nd(this.device,f),!this.allAggregationModel){var u=a*l;this.allAggregationModel=id(this.device,u)}},t._setupWeightAttributes=function(n){var i=this.state.weightAttributes,o=n.weights;for(var a in o)i[a]=n.attributes[a]},t._trackGPUResultBuffers=function(n,i){var o=this.state.resources;for(var a in n)if(n[a]){var s=qc(Gc),l;try{for(s.s();!(l=s.n()).done;){var f=l.value;if(n[a][f]&&i[a][f]!==n[a][f]){var u="gpu-result-".concat(a,"-").concat(f);o[u]&&o[u].delete(),o[u]=n[a][f]}}}catch(c){s.e(c)}finally{s.f()}}},t._updateModels=function(n){var i=n.vertexCount,o=n.attributes,a=n.numCol,s=n.numRow,l=this.state.modelDirty;l&&(this._setupModels(n),this.setState({modelDirty:!1})),this._setupWeightAttributes(n),this.gridAggregationModel.setVertexCount(i),this.gridAggregationModel.setAttributes(o),this.allAggregationModel.setInstanceCount(a*s)},e}();function td(e){var t={};for(var r in e)t[r]=G(G({},ka),e[r]);return t}function rd(e){e=Array.isArray(e)?e:[e],e.forEach(function(t){for(var r in t)t[r].delete()})}function nd(e,t){var r=(0,Ue._mergeShaders)({vs:Ka,fs:Ya,modules:[it,Ue.project32]},t);return new Y(e,G({id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,Ue.getShaderAssembler)()},r))}function id(e,t){return new Y(e,{id:"All-Aggregation-Model",vs:Za,fs:qa,modules:[it],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function od(e,t){return new Me(e,G({vs:Qa,_targetTextureVarying:"meanValues"},t))}var At=P($());var ae=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function We(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array,n;if(Number.isFinite(e[0]))n=new r(e);else{n=new r(e.length*4);for(var i=0,o=0;o<e.length;o++){var a=e[o];n[i++]=a[0],n[i++]=a[1],n[i++]=a[2],n[i++]=Number.isFinite(a[3])?a[3]:255}}if(t)for(var s=0;s<n.length;s++)n[s]/=255;return n}var ts=`#version 300 es
|
|
436
|
+
`;var xh={minFilter:"nearest",magFilter:"nearest"};function Wt(e,t){var r=t.width,n=r===void 0?1:r,i=t.height,o=i===void 0?1:i,s=t.data,a=s===void 0?null:s,l=t.parameters,u=l===void 0?xh:l,c=e.createTexture({data:a,format:"rgba32float",mipmaps:!1,sampler:u,width:n,height:o});return c}function Dr(e,t){var r=t.id,n=t.width,i=n===void 0?1:n,o=t.height,s=o===void 0?1:o,a=t.texture,l=e.createFramebuffer({id:r,width:i,height:s,colorAttachments:[a]});return l}function Rh(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Eh(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
437
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Eh(e,t){if(e){if(typeof e=="string")return Cl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cl(e,t)}}function Cl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Nl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(r),!0).forEach(function(n){Bo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Bo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var wh=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],Pl={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},Ch=["webgl2","blend-minmax-webgl1","texture-renderable-float32-webgl","texture-blend-float-webgl1","texture-formats-float32-webgl1"],oe=function(){e.getAggregationData=function(n){var i=n.aggregationData,o=n.maxData,s=n.minData,a=n.maxMinData,l=n.pixelIndex,u=l*Sl,c={};return i&&(c.cellCount=i[u+3],c.cellWeight=i[u]),a?(c.maxCellWieght=a[0],c.minCellWeight=a[3]):(o&&(c.maxCellWieght=o[0],c.totalCount=o[3]),s&&(c.minCellWeight=s[0],c.totalCount=s[3])),c},e.getCellData=function(n){for(var i=n.countsData,o=n.size,s=o===void 0?1:o,a=i.length/4,l=new Float32Array(a*s),u=new Uint32Array(a),c=0;c<a;c++){for(var f=0;f<s;f++)l[c*s+f]=i[c*4+f];u[c]=i[c*4+3]}return{cellCounts:u,cellWeights:l}},e.isSupported=function(n){return Ch.every(function(i){return n.features.has(i)})};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Oh(this,e),this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=void 0,this.device=void 0,this._hasGPUSupport=void 0,this.gridAggregationModel=void 0,this.allAggregationModel=void 0,this.meanTransform=void 0,this.id=n.id||"gpu-grid-aggregator",this.device=r;var i=["blend-minmax-webgl1","texture-renderable-float32-webgl","texture-formats-float32-webgl1"];this._hasGPUSupport=this.device.info.type==="webgl2"&&i.every(function(o){return r.features.has(o)}),this._hasGPUSupport&&this._setupModels()}var t=e.prototype;return t.delete=function(){var n=this.gridAggregationModel,i=this.allAggregationModel,o=this.meanTransform,s=this.state,a=s.textures,l=s.framebuffers,u=s.maxMinFramebuffers,c=s.minFramebuffers,f=s.maxFramebuffers,h=s.meanTextures,_=s.resources;n?.destroy(),i?.destroy(),o?.destroy(),Ph([l,a,u,c,f,h,_])},t.run=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({results:{}});var i=this._normalizeAggregationParams(n);return this._hasGPUSupport||Ge.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(i)},t.getData=function(n){var i={},o=this.state.results;o[n].aggregationData||(o[n].aggregationData=o[n].aggregationBuffer.getData()),i.aggregationData=o[n].aggregationData;for(var s in Pl){var a=Pl[s];(o[n][s]||o[n][a])&&(o[n][s]=o[n][s]||o[n][a].getData(),i[s]=o[n][s])}return i},t.updateShaders=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({shaderOptions:n,modelDirty:!0})},t._normalizeAggregationParams=function(n){var i=ie(ie({},yl),n),o=i.weights;return o&&(i.weights=Nh(o)),i},t.setState=function(n){Object.assign(this.state,n)},t._getAggregateData=function(n){var i={},o=this.state,s=o.textures,a=o.framebuffers,l=o.maxMinFramebuffers,u=o.minFramebuffers,c=o.maxFramebuffers,f=o.resources,h=n.weights;for(var _ in h){i[_]={};var m=h[_],y=m.needMin,v=m.needMax,S=m.combineMaxMin;i[_].aggregationTexture=s[_],i[_].aggregationBuffer=Qe(a[_],{target:h[_].aggregationBuffer,sourceType:5126}),y&&v&&S?(i[_].maxMinBuffer=Qe(l[_],{target:h[_].maxMinBuffer,sourceType:5126}),i[_].maxMinTexture=f["".concat(_,"-maxMinTexture")]):(y&&(i[_].minBuffer=Qe(u[_],{target:h[_].minBuffer,sourceType:5126}),i[_].minTexture=f["".concat(_,"-minTexture")]),v&&(i[_].maxBuffer=Qe(c[_],{target:h[_].maxBuffer,sourceType:5126}),i[_].maxTexture=f["".concat(_,"-maxTexture")]))}return this._trackGPUResultBuffers(i,h),i},t._renderAggregateData=function(n){var i=n.cellSize,o=n.projectPoints,s=n.attributes,a=n.moduleSettings,l=n.numCol,u=n.numRow,c=n.weights,f=n.translation,h=n.scaling,_=this.state,m=_.maxMinFramebuffers,y=_.minFramebuffers,v=_.maxFramebuffers,S=[l,u],T={blend:!0,depthTest:!1,blendFunc:[1,1]},x={cellSize:i,gridSize:S,projectPoints:o,translation:f,scaling:h};for(var O in c){var P=c[O],I=P.needMin,D=P.needMax,F=I&&D&&c[O].combineMaxMin;this._renderToWeightsTexture({id:O,parameters:T,moduleSettings:a,uniforms:x,gridSize:S,attributes:s,weights:c}),F?this._renderToMaxMinTexture({id:O,parameters:ie(ie({},T),{},{blendEquation:Al}),gridSize:S,minOrMaxFb:m[O],clearParams:{clearColor:[0,0,0,Je]},combineMaxMin:F}):(I&&this._renderToMaxMinTexture({id:O,parameters:ie(ie({},T),{},{blendEquation:Mo}),gridSize:S,minOrMaxFb:y[O],clearParams:{clearColor:[Je,Je,Je,0]},combineMaxMin:F}),D&&this._renderToMaxMinTexture({id:O,parameters:ie(ie({},T),{},{blendEquation:Do}),gridSize:S,minOrMaxFb:v[O],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:F}))}},t._renderToMaxMinTexture=function(n){var i=this,o=n.id,s=n.parameters,a=n.gridSize,l=n.minOrMaxFb,u=n.combineMaxMin,c=n.clearParams,f=c===void 0?{}:c,h=this.state.framebuffers,_=this.allAggregationModel;ae(this.device,ie(ie({},f),{},{framebuffer:l,viewport:[0,0,a[0],a[1]]}),function(){Bn(i.device,{color:!0}),_.setUniforms({gridSize:a,combineMaxMin:u}),_.setBindings({uSampler:h[o].texture}),_.draw()})},t._renderToWeightsTexture=function(n){var i=this,o=n.id,s=n.parameters,a=n.moduleSettings,l=n.uniforms,u=n.gridSize,c=n.weights,f=this.state,h=f.framebuffers,_=f.equations,m=f.weightAttributes,y=this.gridAggregationModel,v=c[o].operation,S=v===W.MIN?[Je,Je,Je,0]:[0,0,0,0];if(ae(this.device,{framebuffer:h[o],viewport:[0,0,u[0],u[1]],clearColor:S},function(){Bn(i.device,{color:!0});var I={weights:m[o]};y.draw({parameters:ie(ie({},s),{},{blendEquation:_[o]}),moduleSettings:a,uniforms:l,attributes:I})}),v===W.MEAN){var T=this.state,x=T.meanTextures,O=T.textures,P={_sourceTextures:{aggregationValues:x[o]},_targetTexture:O[o],elementCount:O[o].width*O[o].height};this.meanTransform?this.meanTransform.update(P):this.meanTransform=Dh(this.device,P),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),h[o].attach(Bo({},36064,O[o]))}},t._runAggregation=function(n){this._updateModels(n),this._setupFramebuffers(n),this._renderAggregateData(n);var i=this._getAggregateData(n);return this.setState({results:i}),i},t._setupFramebuffers=function(n){var i=this.state,o=i.textures,s=i.framebuffers,a=i.maxMinFramebuffers,l=i.minFramebuffers,u=i.maxFramebuffers,c=i.meanTextures,f=i.equations,h=n.weights,_=n.numCol,m=n.numRow,y={width:_,height:m};for(var v in h){var S=h[v],T=S.needMin,x=S.needMax,O=S.combineMaxMin,P=S.operation;o[v]=h[v].aggregationTexture||o[v]||Wt(this.device,{id:"".concat(v,"-texture"),width:_,height:m}),o[v].resize(y);var I=o[v];P===W.MEAN&&(c[v]=c[v]||Wt(this.device,{id:"".concat(v,"-mean-texture"),width:_,height:m}),c[v].resize(y),I=c[v]),s[v]?s[v].attach(Bo({},36064,I)):s[v]=Dr(this.device,{id:"".concat(v,"-fb"),width:_,height:m,texture:I}),s[v].resize(y),f[v]=Fo[P]||Fo[W.SUM],(T||x)&&(T&&x&&O?a[v]||(I=h[v].maxMinTexture||this._getMinMaxTexture("".concat(v,"-maxMinTexture")),a[v]=Dr(this.device,{id:"".concat(v,"-maxMinFb"),texture:I})):(T&&(l[v]||(I=h[v].minTexture||this._getMinMaxTexture("".concat(v,"-minTexture")),l[v]=Dr(this.device,{id:"".concat(v,"-minFb"),texture:I}))),x&&(u[v]||(I=h[v].maxTexture||this._getMinMaxTexture("".concat(v,"-maxTexture")),u[v]=Dr(this.device,{id:"".concat(v,"-maxFb"),texture:I})))))}},t._getMinMaxTexture=function(n){var i=this.state.resources;return i[n]||(i[n]=Wt(this.device,{id:"resourceName"})),i[n]},t._setupModels=function(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=i.numCol,s=o===void 0?0:o,a=i.numRow,l=a===void 0?0:a,u=this.state.shaderOptions;if((n=this.gridAggregationModel)===null||n===void 0||n.destroy(),this.gridAggregationModel=Ih(this.device,u),!this.allAggregationModel){var c=s*l;this.allAggregationModel=Mh(this.device,c)}},t._setupWeightAttributes=function(n){var i=this.state.weightAttributes,o=n.weights;for(var s in o)i[s]=n.attributes[s]},t._trackGPUResultBuffers=function(n,i){var o=this.state.resources;for(var s in n)if(n[s]){var a=Rh(wh),l;try{for(a.s();!(l=a.n()).done;){var u=l.value;if(n[s][u]&&i[s][u]!==n[s][u]){var c="gpu-result-".concat(s,"-").concat(u);o[c]&&o[c].delete(),o[c]=n[s][u]}}}catch(f){a.e(f)}finally{a.f()}}},t._updateModels=function(n){var i=n.vertexCount,o=n.attributes,s=n.numCol,a=n.numRow,l=this.state.modelDirty;l&&(this._setupModels(n),this.setState({modelDirty:!1})),this._setupWeightAttributes(n),this.gridAggregationModel.setVertexCount(i),this.gridAggregationModel.setAttributes(o),this.allAggregationModel.setInstanceCount(s*a)},e}();function Nh(e){var t={};for(var r in e)t[r]=ie(ie({},Tl),e[r]);return t}function Ph(e){e=Array.isArray(e)?e:[e],e.forEach(function(t){for(var r in t)t[r].delete()})}function Ih(e,t){var r=(0,Ge._mergeShaders)({vs:xl,fs:Rl,modules:[Ot,Ge.project32]},t);return new ee(e,ie({id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,Ge.getShaderAssembler)()},r))}function Mh(e,t){return new ee(e,{id:"All-Aggregation-Model",vs:El,fs:Ol,modules:[Ot],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function Dh(e,t){return new $e(e,ie({vs:wl,_targetTextureVarying:"meanValues"},t))}var Ht=M(Q());var ge=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function et(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array,n;if(Number.isFinite(e[0]))n=new r(e);else{n=new r(e.length*4);for(var i=0,o=0;o<e.length;o++){var s=e[o];n[i++]=s[0],n[i++]=s[1],n[i++]=s[2],n[i++]=Number.isFinite(s[3])?s[3]:255}}if(t)for(var a=0;a<n.length;a++)n[a]/=255;return n}var Il=`#version 300 es
|
|
435
438
|
#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
436
439
|
#define RANGE_COUNT 6
|
|
437
440
|
|
|
@@ -492,7 +495,7 @@ void main(void) {
|
|
|
492
495
|
|
|
493
496
|
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
494
497
|
}
|
|
495
|
-
`;var
|
|
498
|
+
`;var Ml=`#version 300 es
|
|
496
499
|
#define SHADER_NAME screen-grid-layer-fragment-shader
|
|
497
500
|
|
|
498
501
|
precision highp float;
|
|
@@ -510,16 +513,16 @@ void main(void) {
|
|
|
510
513
|
|
|
511
514
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
512
515
|
}
|
|
513
|
-
`;function
|
|
514
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,
|
|
515
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,
|
|
516
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,
|
|
517
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
518
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
519
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,
|
|
520
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function ag(e,t){if(e){if(typeof e=="string")return Ns(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ns(e,t)}}function Ns(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function sg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function St(e,t,r){return typeof Reflect<"u"&&Reflect.get?St=Reflect.get:St=function(i,o,a){var s=lg(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},St(e,t,r||e)}function lg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ve(e),e!==null););return e}function fg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pi(e,t)}function pi(e,t){return pi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},pi(e,t)}function ug(e){var t=gg();return function(){var n=Ve(e),i;if(t){var o=Ve(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cg(this,i)}}function cg(e,t){if(t&&(tn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dg(e)}function dg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ve(e){return Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ve(e)}var qe=function(e){fg(r,e);var t=ug(r);function r(){var i;sg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){var a=o.dimensions;St(Ve(r.prototype),"initializeAggregationLayer",this).call(this,a),this.setState({layerData:{},gpuGridAggregator:new ee(this.context.device,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:bt})},n.updateState=function(o){St(Ve(r.prototype),"updateState",this).call(this,o),this.updateAggregationState(o);var a=this.state,s=a.aggregationDataDirty,l=a.aggregationWeightsDirty,f=a.gpuAggregation;if(!(this.getNumInstances()<=0)){var u=!1;(s||f&&l)&&(this._updateAggregation(o),u=!0),!f&&(s||l)&&(this._updateWeightBins(),this._uploadAggregationResults(),u=!0),this.setState({aggregationDirty:u})}},n.finalizeState=function(o){var a,s=this.state.weights.count;s&&s.aggregationBuffer&&s.aggregationBuffer.delete(),(a=this.state.gpuGridAggregator)===null||a===void 0||a.delete(),St(Ve(r.prototype),"finalizeState",this).call(this,o)},n.updateShaders=function(o){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(o)},n.updateAggregationState=function(o){Ms.log.assert(!1)},n.allocateResources=function(o,a){if(this.state.numRow!==o||this.state.numCol!==a){var s=a*o*4*4,l=this.state.weights;for(var f in l){var u=l[f];u.aggregationBuffer&&u.aggregationBuffer.delete(),u.aggregationBuffer=this.context.device.createBuffer({byteLength:s,accessor:{size:4,type:5126,divisor:1}})}}},n.updateResults=function(o){var a=o.aggregationData,s=o.maxMinData,l=o.maxData,f=o.minData,u=this.state.weights.count;u&&(u.aggregationData=a,u.maxMinData=s,u.maxData=l,u.minData=f)},n._updateAggregation=function(o){var a=this.state,s=a.cpuGridAggregator,l=a.gpuGridAggregator,f=a.gridOffset,u=a.posOffset,c=a.translation,d=c===void 0?[0,0]:c,g=a.scaling,h=g===void 0?[0,0,0]:g,A=a.boundingBox,_=a.projectPoints,v=a.gpuAggregation,T=a.numCol,m=a.numRow,E=o.props,O=this.context.viewport,C=this.getAttributes(),N=this.getNumInstances();if(v){var U=this.state.weights;l.run({weights:U,cellSize:[f.xOffset,f.yOffset],numCol:T,numRow:m,translation:d,scaling:h,vertexCount:N,projectPoints:_,attributes:C,moduleSettings:this.getModuleSettings()})}else{var M=s(E,{gridOffset:f,projectPoints:_,attributes:C,viewport:O,posOffset:u,boundingBox:A});this.setState({layerData:M})}},n._updateWeightBins=function(){var o=this.state.getValue,a=new mt(this.state.layerData.data||[],{getValue:o});this.setState({sortedBins:a})},n._uploadAggregationResults=function(){var o=this.state,a=o.numCol,s=o.numRow,l=this.state.layerData.data,f=this.state.sortedBins,u=f.aggregatedBins,c=f.minValue,d=f.maxValue,g=f.totalCount,h=4,A=a*s*h,_=new Float32Array(A).fill(0),v=og(u),T;try{for(v.s();!(T=v.n()).done;){var m=T.value,E=l[m.i],O=E.lonIdx,C=E.latIdx,N=m.value,M=m.counts,U=(O+C*a)*h;_[U]=N,_[U+h-1]=M}}catch(oe){v.e(oe)}finally{v.f()}var W=new Float32Array([d,0,0,c]),j=new Float32Array([d,0,0,g]),Z=new Float32Array([c,0,0,g]);this.updateResults({aggregationData:_,maxMinData:W,maxData:j,minData:Z})},r}(de);qe.layerName="GridAggregationLayer";function rn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rn=function(r){return typeof r}:rn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},rn(e)}function hg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rt(e,t,r){return typeof Reflect<"u"&&Reflect.get?Rt=Reflect.get:Rt=function(i,o,a){var s=_g(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},Rt(e,t,r||e)}function _g(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Xe(e),e!==null););return e}function pg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ai(e,t)}function Ai(e,t){return Ai=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ai(e,t)}function Ag(e){var t=mg();return function(){var n=Xe(e),i;if(t){var o=Xe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Tg(this,i)}}function Tg(e,t){if(t&&(rn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vg(e)}function vg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Xe(e){return Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Xe(e)}function Is(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ti(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Is(Object(r),!0).forEach(function(n){vi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Is(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bg=Ti(Ti({},Tt.defaultProps),{},{getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"}),Ds="positions",Sg={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},nn=function(e){pg(r,e);var t=Ag(r);function r(){var i;hg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;if(!Tt.isSupported(this.context.device)){this.setState({supported:!1}),mi.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}Rt(Xe(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Sg,getCellSize:function(f){return f.cellSizePixels}});var a={count:{size:1,operation:w.SUM,needMax:!0,maxTexture:_t(this.context.device,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:a,subLayerData:{attributes:{}},maxTexture:a.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]});var s=this.getAttributeManager();s.add((o={},vi(o,Ds,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),vi(o,"count",{size:3,accessor:"getWeight"}),o))},n.shouldUpdateState=function(o){var a=o.changeFlags;return this.state.supported&&a.somethingChanged},n.updateState=function(o){Rt(Xe(r.prototype),"updateState",this).call(this,o)},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,a=o.maxTexture,s=o.numRow,l=o.numCol,f=o.weights,u=this.props.updateTriggers,c=f.count.aggregationBuffer,d=this.getSubLayerClass("cells",Tt);return new d(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:u}),{data:{attributes:{instanceCounts:c}},maxTexture:a,numInstances:s*l})},n.finalizeState=function(o){Rt(Xe(r.prototype),"finalizeState",this).call(this,o);var a=this.state,s=a.aggregationBuffer,l=a.maxBuffer,f=a.maxTexture;s?.delete(),l?.delete(),f?.delete()},n.getPickingInfo=function(o){var a=o.info,s=a.index;if(s>=0){var l=this.state,f=l.gpuGridAggregator,u=l.gpuAggregation,c=l.weights,d=u?f.getData("count"):c.count;a.object=ee.getAggregationData(Ti({pixelIndex:s},d))}return a},n.updateResults=function(o){var a=o.aggregationData,s=o.maxData,l=this.state.weights.count;l.aggregationData=a,l.aggregationBuffer.write(a),l.maxData=s,l.maxTexture.setImageData({data:s})},n.updateAggregationState=function(o){var a=o.props.cellSizePixels,s=o.oldProps.cellSizePixels!==a,l=o.changeFlags.viewportChanged,f=o.props.gpuAggregation;this.state.gpuAggregation!==o.props.gpuAggregation&&f&&!ee.isSupported(this.context.device)&&(mi.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),f=!1);var u=f!==this.state.gpuAggregation;this.setState({gpuAggregation:f});var c=this.isAttributeChanged(Ds),d=this.state.dimensions,g=d.data,h=d.weights,A=c||u||l||this.isAggregationDirty(o,{compareAll:f,dimension:g}),_=this.isAggregationDirty(o,{dimension:h});this.setState({aggregationDataDirty:A,aggregationWeightsDirty:_});var v=this.context.viewport;if(l||s){var T=v.width,m=v.height,E=Math.ceil(T/a),O=Math.ceil(m/a);this.allocateResources(O,E),this.setState({scaling:[T/2,-m/2,1],gridOffset:{xOffset:a,yOffset:a},width:T,height:m,numCol:E,numRow:O})}_&&this._updateAccessors(o),(A||_)&&this._resetResults()},n._updateAccessors=function(o){var a=o.props,s=a.getWeight,l=a.aggregation,f=a.data,u=this.state.weights.count;u&&(u.getWeight=s,u.operation=w[l]),this.setState({getValue:gt(l,s,{data:f})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},r}(qe);nn.layerName="ScreenGridLayer";nn.defaultProps=bg;var Vs=P(rt());function ur(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ur=function(r){return typeof r}:ur=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ur(e)}function Fs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ge(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fs(Object(r),!0).forEach(function(n){Ws(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ws(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ws(){}var Bs=["getBins","getDomain","getScaleFunc"],Us=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],yg=function(t){return t.cellSize},yt=function(){function e(r){Rg(this,e),this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=void 0,this._getAggregator=void 0,this._getCellSize=r.getCellSize||yg,this._getAggregator=r.getAggregator,this._addDimension(r.dimensions||Us)}e.defaultDimensions=function(){return Us};var t=e.prototype;return t.updateState=function(n,i){var o=n.oldProps,a=n.props,s=n.changeFlags;this.updateGetValueFuncs(o,a,s);var l=this.needsReProjectPoints(o,a,s),f=!1;if(s.dataChanged||l)this.getAggregatedData(a,i),f=!0;else{var u=this.getDimensionChanges(o,a,s)||[];u.forEach(function(c){return typeof c=="function"&&c()}),f=!0}return this.setState({aggregationDirty:f}),this.state},t.setState=function(n){this.state=ge(ge({},this.state),n)},t.setDimensionState=function(n,i){this.setState({dimensions:ge(ge({},this.state.dimensions),{},Ws({},n,ge(ge({},this.state.dimensions[n]),i)))})},t.normalizeResult=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n.hexagons?ge({data:n.hexagons},n):n.layerData?ge({data:n.layerData},n):n},t.getAggregatedData=function(n,i){var o=this._getAggregator(n),a=o(n,i);this.setState({layerData:this.normalizeResult(a)}),this.changeFlags={layerData:!0},this.getSortedBins(n)},t.updateGetValueFuncs=function(n,i,o){for(var a in this.dimensionUpdaters){var s=this.dimensionUpdaters[a].getBins.triggers,l=s.value,f=s.weight,u=s.aggregation,c=i[l.prop],d=this.needUpdateDimensionStep(this.dimensionUpdaters[a].getBins,n,i,o);d&&(c?c=La(c,{data:i.data}):c=gt(i[u.prop],i[f.prop],{data:i.data})),c&&this.setDimensionState(a,{getValue:c})}},t.needsReProjectPoints=function(n,i,o){return this._getCellSize(n)!==this._getCellSize(i)||this._getAggregator(n)!==this._getAggregator(i)||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getPosition)},t.addDimension=function(n){this._addDimension(n)},t._addDimension=function(){var n=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(o){var a=o.key;n.dimensionUpdaters[a]=n.getDimensionUpdaters(o),n.state.dimensions[a]={getValue:null,domain:null,sortedBins:null,scaleFunc:ws}})},t.getDimensionUpdaters=function(n){var i=n.key,o=n.accessor,a=n.pickingInfo,s=n.getBins,l=n.getDomain,f=n.getScaleFunc,u=n.nullValue;return{key:i,accessor:o,pickingInfo:a,getBins:ge({updater:this.getDimensionSortedBins.bind(this)},s),getDomain:ge({updater:this.getDimensionValueDomain.bind(this)},l),getScaleFunc:ge({updater:this.getDimensionScale.bind(this)},f),attributeAccessor:this.getSubLayerDimensionAttribute(i,u)}},t.needUpdateDimensionStep=function(n,i,o,a){return Object.values(n.triggers).some(function(s){return s.updateTrigger?a.dataChanged||a.updateTriggersChanged&&(a.updateTriggersChanged.all||a.updateTriggersChanged[s.updateTrigger]):i[s.prop]!==o[s.prop]})},t.getDimensionChanges=function(n,i,o){var a=this,s=[],l=function(c){var d=Bs.find(function(g){return a.needUpdateDimensionStep(a.dimensionUpdaters[c][g],n,i,o)});d&&s.push(a.dimensionUpdaters[c][d].updater.bind(a,i,a.dimensionUpdaters[c]))};for(var f in this.dimensionUpdaters)l(f);return s.length?s:null},t.getUpdateTriggers=function(n){var i=this,o=n.updateTriggers||{},a={},s=function(u){var c=i.dimensionUpdaters[u].accessor;a[c]={},Bs.forEach(function(d){Object.values(i.dimensionUpdaters[u][d].triggers).forEach(function(g){var h=g.prop,A=g.updateTrigger;if(A){var _=o[A];ur(_)==="object"&&!Array.isArray(_)?Object.assign(a[c],_):_!==void 0&&(a[c][h]=_)}else a[c][h]=n[h]})})};for(var l in this.dimensionUpdaters)s(l);return a},t.getSortedBins=function(n){for(var i in this.dimensionUpdaters)this.getDimensionSortedBins(n,this.dimensionUpdaters[i])},t.getDimensionSortedBins=function(n,i){var o=i.key,a=this.state.dimensions[o].getValue,s=new mt(this.state.layerData.data||[],{getValue:a,filterData:n._filterData});this.setDimensionState(o,{sortedBins:s}),this.getDimensionValueDomain(n,i)},t.getDimensionValueDomain=function(n,i){var o=i.getDomain,a=i.key,s=o.triggers,l=s.lowerPercentile,f=s.upperPercentile,u=s.scaleType,c=this.state.dimensions[a].sortedBins.getValueDomainByScale(n[u.prop],[n[l.prop],n[f.prop]]);this.setDimensionState(a,{valueDomain:c}),this.getDimensionScale(n,i)},t.getDimensionScale=function(n,i){var o=i.key,a=i.getScaleFunc,s=i.getDomain,l=a.triggers,f=l.domain,u=l.range,c=s.triggers.scaleType,d=a.onSet,g=n[u.prop],h=n[f.prop]||this.state.dimensions[o].valueDomain,A=ps(c&&n[c.prop]),_=A(h,g);ur(d)==="object"&&typeof n[d.props]=="function"&&n[d.props](_.domain()),this.setDimensionState(o,{scaleFunc:_})},t.getSubLayerDimensionAttribute=function(n,i){var o=this;return function(a){var s=o.state.dimensions[n],l=s.sortedBins,f=s.scaleFunc,u=l.binMap[a.index];if(u&&u.counts===0)return i;var c=u&&u.value,d=f.domain(),g=c>=d[0]&&c<=d[d.length-1];return g?f(c):i}},t.getSubLayerAccessors=function(n){var i={};for(var o in this.dimensionUpdaters){var a=this.dimensionUpdaters[o].accessor;i[a]=this.getSubLayerDimensionAttribute(n,o)}return i},t.getPickingInfo=function(n){var i=n.info,o=i.picked&&i.index>-1,a=null;if(o){var s=this.state.layerData.data[i.index],l={};for(var f in this.dimensionUpdaters){var u=this.dimensionUpdaters[f].pickingInfo,c=this.state.dimensions[f].sortedBins,d=c.binMap[s.index]&&c.binMap[s.index].value;l[u]=d}a=Object.assign(l,s,{points:s.filteredPoints||s.points})}return i.picked=Boolean(a),i.object=a,i},t.getAccessor=function(n){return this.dimensionUpdaters.hasOwnProperty(n)?this.dimensionUpdaters[n].attributeAccessor:ws},e}();function on(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?on=function(r){return typeof r}:on=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},on(e)}function Eg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function an(e,t,r){return typeof Reflect<"u"&&Reflect.get?an=Reflect.get:an=function(i,o,a){var s=xg(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},an(e,t,r||e)}function xg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Et(e),e!==null););return e}function Og(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bi(e,t)}function bi(e,t){return bi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},bi(e,t)}function Cg(e){var t=Mg();return function(){var n=Et(e),i;if(t){var o=Et(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Pg(this,i)}}function Pg(e,t){if(t&&(on(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ng(e)}function Ng(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Et(e){return Et=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Et(e)}function Hs(){}var Ig={colorDomain:null,colorRange:ae,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:Hs,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Hs,gridAggregator:bt,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Qe=function(e){Og(r,e);var t=Cg(r);function r(){var i;Eg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new yt({getAggregator:function(l){return l.gridAggregator},getCellSize:function(l){return l.cellSize}});this.state={cpuAggregator:o,aggregatorState:o.state};var a=this.getAttributeManager();a.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){an(Et(r.prototype),"updateState",this).call(this,o),this.setState({aggregatorState:this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})},n.getPickingInfo=function(o){var a=o.info;return this.state.cpuAggregator.getPickingInfo({info:a})},n._onGetSublayerColor=function(o){return this.state.cpuAggregator.getAccessor("fillColor")(o)},n._onGetSublayerElevation=function(o){return this.state.cpuAggregator.getAccessor("elevation")(o)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var o=this.props,a=o.elevationScale,s=o.extruded,l=o.cellSize,f=o.coverage,u=o.material,c=o.transitions,d=this.state.cpuAggregator,g=this.getSubLayerClass("grid-cell",Vs.GridCellLayer),h=this._getSublayerUpdateTriggers();return new g({cellSize:l,coverage:f,material:u,elevationScale:a,extruded:s,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:c&&{getFillColor:c.getColorValue||c.getColorWeight,getElevation:c.getElevationValue||c.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:h}),{data:d.state.layerData.data})},r}(de);Qe.layerName="CPUGridLayer";Qe.defaultProps=Ig;var $s=P($()),Ks=P(rt());var xt=Math.PI/3,Dg=[0,xt,2*xt,3*xt,4*xt,5*xt];function Fg(e){return e[0]}function wg(e){return e[1]}function Si(){var e=0,t=0,r=1,n=1,i=Fg,o=wg,a,s,l;function f(c){var d={},g=[],h,A=c.length;for(h=0;h<A;++h)if(!(isNaN(v=+i.call(null,_=c[h],h,c))||isNaN(T=+o.call(null,_,h,c)))){var _,v,T,m=Math.round(T=T/l),E=Math.round(v=v/s-(m&1)/2),O=T-m;if(Math.abs(O)*3>1){var C=v-E,N=E+(v<E?-1:1)/2,M=m+(T<m?-1:1),U=v-N,W=T-M;C*C+O*O>U*U+W*W&&(E=N+(m&1?1:-1)/2,m=M)}var j=E+"-"+m,Z=d[j];Z?Z.push(_):(g.push(Z=d[j]=[_]),Z.x=(E+(m&1)/2)*s,Z.y=m*l)}return g}function u(c){var d=0,g=0;return Dg.map(function(h){var A=Math.sin(h)*c,_=-Math.cos(h)*c,v=A-d,T=_-g;return d=A,g=_,[v,T]})}return f.hexagon=function(c){return"m"+u(c==null?a:+c).join("l")+"z"},f.centers=function(){for(var c=[],d=Math.round(t/l),g=Math.round(e/s),h=d*l;h<n+a;h+=l,++d)for(var A=g*s+(d&1)*s/2;A<r+s/2;A+=s)c.push([A,h]);return c},f.mesh=function(){var c=u(a).slice(0,4).join("l");return f.centers().map(function(d){return"M"+d+"m"+c}).join("")},f.x=function(c){return arguments.length?(i=c,f):i},f.y=function(c){return arguments.length?(o=c,f):o},f.radius=function(c){return arguments.length?(a=+c,s=a*2*Math.sin(xt),l=a*1.5,f):a},f.size=function(c){return arguments.length?(e=t=0,r=+c[0],n=+c[1],f):[r-e,n-t]},f.extent=function(c){return arguments.length?(e=+c[0][0],t=+c[0][1],r=+c[1][0],n=+c[1][1],f):[[e,t],[r,n]]},f.radius(1)}var sn=P($());function Bg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ug(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
521
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Ug(e,t){if(e){if(typeof e=="string")return Xs(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xs(e,t)}}function Xs(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ls(e,t){var r=e.data,n=e.radius,i=t.viewport,o=t.attributes,a=r.length?Wg(r,t):null,s=Hg(n,i,a),l=[],f=(0,sn.createIterable)(r),u=f.iterable,c=f.objectInfo,d=o.positions.value,g=o.positions.getAccessor(),h=g.size,A=Bg(u),_;try{for(A.s();!(_=A.n()).done;){var v=_.value;c.index++;var T=c.index*h,m=[d[T],d[T+1]],E=Number.isFinite(m[0])&&Number.isFinite(m[1]);E?l.push({screenCoord:i.projectFlat(m),source:v,index:c.index}):sn.log.warn("HexagonLayer: invalid position")()}}catch(N){A.e(N)}finally{A.f()}var O=Si().radius(s).x(function(N){return N.screenCoord[0]}).y(function(N){return N.screenCoord[1]}),C=O(l);return{hexagons:C.map(function(N,M){return{position:i.unprojectFlat([N.x,N.y]),points:N,index:M}}),radiusCommon:s}}function Wg(e,t){var r=t.attributes,n=r.positions.value,i=r.positions.getAccessor(),o=i.size,a=1/0,s=1/0,l=-1/0,f=-1/0,u;for(u=0;u<o*e.length;u+=o){var c=n[u],d=n[u+1],g=Number.isFinite(c)&&Number.isFinite(d);g&&(a=Math.min(c,a),l=Math.max(c,l),s=Math.min(d,s),f=Math.max(d,f))}return[a,s,l,f].every(Number.isFinite)?[(a+l)/2,(s+f)/2]:null}function Hg(e,t,r){var n=t.getDistanceScales(r),i=n.unitsPerMeter;return e*i[0]}function ln(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ln=function(r){return typeof r}:ln=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ln(e)}function zs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function js(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zs(Object(r),!0).forEach(function(n){Vg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fn(e,t,r){return typeof Reflect<"u"&&Reflect.get?fn=Reflect.get:fn=function(i,o,a){var s=Lg(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},fn(e,t,r||e)}function Lg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ot(e),e!==null););return e}function zg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ri(e,t)}function Ri(e,t){return Ri=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ri(e,t)}function jg(e){var t=Kg();return function(){var n=Ot(e),i;if(t){var o=Ot(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return kg(this,i)}}function kg(e,t){if(t&&(ln(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $g(e)}function $g(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ot(e){return Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ot(e)}function ks(){}var Yg={colorDomain:null,colorRange:ae,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:ks,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:ks,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Ls,getPosition:{type:"accessor",value:function(t){return t.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},un=function(e){zg(r,e);var t=jg(r);function r(){var i;Xg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new yt({getAggregator:function(l){return l.hexagonAggregator},getCellSize:function(l){return l.radius}});this.state={cpuAggregator:o,aggregatorState:o.state,vertices:null};var a=this.getAttributeManager();a.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){if(fn(Ot(r.prototype),"updateState",this).call(this,o),o.changeFlags.propsOrDataChanged){var a=this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==a.layerData){var s=a.layerData||{},l=s.hexagonVertices;this.setState({vertices:l&&this.convertLatLngToMeterOffset(l)})}this.setState({aggregatorState:a})}},n.convertLatLngToMeterOffset=function(o){var a=this.context.viewport;if(Array.isArray(o)&&o.length===6){var s=o[0],l=o[3],f=[(s[0]+l[0])/2,(s[1]+l[1])/2],u=a.projectFlat(f),c=a.getDistanceScales(f),d=c.metersPerUnit,g=o.map(function(h){var A=a.projectFlat(h);return[(A[0]-u[0])*d[0],(A[1]-u[1])*d[1]]});return g}return $s.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null},n.getPickingInfo=function(o){var a=o.info;return this.state.cpuAggregator.getPickingInfo({info:a})},n._onGetSublayerColor=function(o){return this.state.cpuAggregator.getAccessor("fillColor")(o)},n._onGetSublayerElevation=function(o){return this.state.cpuAggregator.getAccessor("elevation")(o)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var o=this.props,a=o.elevationScale,s=o.extruded,l=o.coverage,f=o.material,u=o.transitions,c=this.state,d=c.aggregatorState,g=c.vertices,h=this.getSubLayerClass("hexagon-cell",Ks.ColumnLayer),A=this._getSublayerUpdateTriggers(),_=g?{vertices:g,radius:1}:{radius:d.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new h(js(js({},_),{},{diskResolution:6,elevationScale:a,extruded:s,coverage:l,material:f,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:u&&{getFillColor:u.getColorValue||u.getColorWeight,getElevation:u.getElevationValue||u.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:A}),{data:d.layerData.data})},r}(de);un.layerName="HexagonLayer";un.defaultProps=Yg;var pn=P(rt());var bl=P($());var S;function R(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=.5,x=1/6,p={N:[0,b],E:[b,0],S:[0,-b],W:[-b,0],NE:[b,b],NW:[-b,b],SE:[b,-b],SW:[-b,-b]},Ct=[p.W,p.SW,p.S],Pt=[p.S,p.SE,p.E],Nt=[p.E,p.NE,p.N],Mt=[p.NW,p.W,p.N],It=[[-b,x],[-b,-x],[-x,-b],[x,-b]],Dt=[[-x,-b],[x,-b],[b,-x],[b,x]],Ft=[[b,-x],[b,x],[x,b],[-x,b]],wt=[[-b,x],[-b,-x],[x,b],[-x,b]],Ys=[p.W,p.SW,p.SE,p.E],Zs=[p.S,p.SE,p.NE,p.N],qs=[p.NW,p.W,p.E,p.NE],Qs=[p.NW,p.SW,p.S,p.N],Js=[[-b,x],[-b,-x],[b,-x],[b,x]],Gs=[[-x,-b],[x,-b],[x,b],[-x,b]],Zg=[p.NW,p.SW,p.SE,p.NE],el=[p.NW,p.SW,p.SE,p.E,p.N],tl=[p.W,p.SW,p.SE,p.NE,p.N],rl=[p.NW,p.W,p.S,p.SE,p.NE],nl=[p.NW,p.SW,p.S,p.E,p.NE],il=[p.NW,p.W,[b,-x],[b,x],p.N],ol=[[-x,-b],[x,-b],p.E,p.NE,p.N],al=[[-b,x],[-b,-x],p.S,p.SE,p.E],sl=[p.W,p.SW,p.S,[x,b],[-x,b]],ll=[p.NW,p.W,[-x,-b],[x,-b],p.N],fl=[[-b,x],[-b,-x],p.E,p.NE,p.N],ul=[p.S,p.SE,p.E,[x,b],[-x,b]],cl=[p.W,p.SW,p.S,[b,-x],[b,x]],dl=[p.W,p.SW,p.SE,p.E,[x,b],[-x,b]],gl=[[-b,x],[-b,-x],p.S,p.SE,p.NE,p.N],hl=[p.NW,p.W,[-x,-b],[x,-b],p.E,p.NE],_l=[p.NW,p.SW,p.S,[b,-x],[b,x],p.N],Bt=[p.W,p.SW,p.S,p.E,p.NE,p.N],Ut=[p.NW,p.W,p.S,p.SE,p.E,p.N],cn=[[-b,x],[-b,-x],[-x,-b],[x,-b],p.E,p.NE,p.N],dn=[p.W,p.SW,p.S,[b,-x],[b,x],[x,b],[-x,b]],gn=[p.NW,p.W,[-x,-b],[x,-b],[b,-x],[b,x],p.N],hn=[[-b,x],[-b,-x],p.S,p.SE,p.E,[x,b],[-x,b]],pl=[[-b,x],[-b,-x],[-x,-b],[x,-b],[b,-x],[b,x],[x,b],[-x,b]],Al={0:[],1:[[p.W,p.S]],2:[[p.S,p.E]],3:[[p.W,p.E]],4:[[p.N,p.E]],5:{0:[[p.W,p.S],[p.N,p.E]],1:[[p.W,p.N],[p.S,p.E]]},6:[[p.N,p.S]],7:[[p.W,p.N]],8:[[p.W,p.N]],9:[[p.N,p.S]],10:{0:[[p.W,p.N],[p.S,p.E]],1:[[p.W,p.S],[p.N,p.E]]},11:[[p.N,p.E]],12:[[p.W,p.E]],13:[[p.S,p.E]],14:[[p.W,p.S]],15:[]};function y(e){return parseInt(e,4)}var Tl=(S={},R(S,y("0000"),[]),R(S,y("2222"),[]),R(S,y("2221"),[Ct]),R(S,y("2212"),[Pt]),R(S,y("2122"),[Nt]),R(S,y("1222"),[Mt]),R(S,y("0001"),[Ct]),R(S,y("0010"),[Pt]),R(S,y("0100"),[Nt]),R(S,y("1000"),[Mt]),R(S,y("2220"),[It]),R(S,y("2202"),[Dt]),R(S,y("2022"),[Ft]),R(S,y("0222"),[wt]),R(S,y("0002"),[It]),R(S,y("0020"),[Dt]),R(S,y("0200"),[Ft]),R(S,y("2000"),[wt]),R(S,y("0011"),[Ys]),R(S,y("0110"),[Zs]),R(S,y("1100"),[qs]),R(S,y("1001"),[Qs]),R(S,y("2211"),[Ys]),R(S,y("2112"),[Zs]),R(S,y("1122"),[qs]),R(S,y("1221"),[Qs]),R(S,y("2200"),[Js]),R(S,y("2002"),[Gs]),R(S,y("0022"),[Js]),R(S,y("0220"),[Gs]),R(S,y("1111"),[Zg]),R(S,y("1211"),[el]),R(S,y("2111"),[tl]),R(S,y("1112"),[rl]),R(S,y("1121"),[nl]),R(S,y("1011"),[el]),R(S,y("0111"),[tl]),R(S,y("1110"),[rl]),R(S,y("1101"),[nl]),R(S,y("1200"),[il]),R(S,y("0120"),[ol]),R(S,y("0012"),[al]),R(S,y("2001"),[sl]),R(S,y("1022"),[il]),R(S,y("2102"),[ol]),R(S,y("2210"),[al]),R(S,y("0221"),[sl]),R(S,y("1002"),[ll]),R(S,y("2100"),[fl]),R(S,y("0210"),[ul]),R(S,y("0021"),[cl]),R(S,y("1220"),[ll]),R(S,y("0122"),[fl]),R(S,y("2012"),[ul]),R(S,y("2201"),[cl]),R(S,y("0211"),[dl]),R(S,y("2110"),[gl]),R(S,y("1102"),[hl]),R(S,y("1021"),[_l]),R(S,y("2011"),[dl]),R(S,y("0112"),[gl]),R(S,y("1120"),[hl]),R(S,y("1201"),[_l]),R(S,y("2101"),[Bt]),R(S,y("0121"),[Bt]),R(S,y("1012"),[Ut]),R(S,y("1210"),[Ut]),R(S,y("0101"),{0:[Ct,Nt],1:[Bt],2:[Bt]}),R(S,y("1010"),{0:[Mt,Pt],1:[Ut],2:[Ut]}),R(S,y("2121"),{0:[Bt],1:[Bt],2:[Ct,Nt]}),R(S,y("1212"),{0:[Ut],1:[Ut],2:[Mt,Pt]}),R(S,y("2120"),{0:[cn],1:[cn],2:[It,Nt]}),R(S,y("2021"),{0:[dn],1:[dn],2:[Ct,Ft]}),R(S,y("1202"),{0:[gn],1:[gn],2:[Mt,Dt]}),R(S,y("0212"),{0:[hn],1:[hn],2:[Pt,wt]}),R(S,y("0102"),{0:[It,Nt],1:[cn],2:[cn]}),R(S,y("0201"),{0:[Ct,Ft],1:[dn],2:[dn]}),R(S,y("1020"),{0:[Mt,Dt],1:[gn],2:[gn]}),R(S,y("2010"),{0:[Pt,wt],1:[hn],2:[hn]}),R(S,y("2020"),{0:[wt,Dt],1:[pl],2:[It,Ft]}),R(S,y("0202"),{0:[Ft,It],1:[pl],2:[wt,Dt]}),S);function vl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ml(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vl(Object(r),!0).forEach(function(n){qg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Je={ISO_LINES:1,ISO_BANDS:2},Qg={zIndex:0,zOffset:.005};function cr(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function Sl(e){var t=e.cellWeights,r=e.x,n=e.y,i=e.width,o=e.height,a=e.threshold;e.thresholdValue&&(bl.log.deprecated("thresholdValue","threshold")(),a=e.thresholdValue);var s=r<0,l=r>=i-1,f=n<0,u=n>=o-1,c=s||l||f||u,d={},g={};s||u?g.top=0:(d.top=t[(n+1)*i+r],g.top=cr(d.top,a)),l||u?g.topRight=0:(d.topRight=t[(n+1)*i+r+1],g.topRight=cr(d.topRight,a)),l||f?g.right=0:(d.right=t[n*i+r+1],g.right=cr(d.right,a)),s||f?g.current=0:(d.current=t[n*i+r],g.current=cr(d.current,a));var h=g.top,A=g.topRight,_=g.right,v=g.current,T=-1;Number.isFinite(a)&&(T=h<<3|A<<2|_<<1|v),Array.isArray(a)&&(T=h<<6|A<<4|_<<2|v);var m=0;return c||(m=cr((d.top+d.topRight+d.right+d.current)/4,a)),{code:T,meanCode:m}}function yi(e){var t=e.gridOrigin,r=e.cellSize,n=e.x,i=e.y,o=e.code,a=e.meanCode,s=e.type,l=s===void 0?Je.ISO_LINES:s,f=ml(ml({},Qg),e.thresholdData),u=l===Je.ISO_BANDS?Tl[o]:Al[o];Array.isArray(u)||(u=u[a]);var c=f.zIndex*f.zOffset,d=(n+1)*r[0],g=(i+1)*r[1],h=t[0]+d,A=t[1]+g;if(l===Je.ISO_BANDS){var _=[];return u.forEach(function(T){var m=[];T.forEach(function(E){var O=h+E[0]*r[0],C=A+E[1]*r[1];m.push([O,C,c])}),_.push(m)}),_}var v=[];return u.forEach(function(T){T.forEach(function(m){var E=h+m[0]*r[0],O=A+m[1]*r[1];v.push([E,O,c])})}),v}function Rl(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Jg(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
522
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,
|
|
516
|
+
`;function kn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?kn=function(r){return typeof r}:kn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},kn(e)}function Dl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Uo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dl(Object(r),!0).forEach(function(n){Fh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wn(e,t,r){return typeof Reflect<"u"&&Reflect.get?Wn=Reflect.get:Wn=function(i,o,s){var a=Uh(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},Wn(e,t,r||e)}function Uh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Vt(e),e!==null););return e}function kh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ko(e,t)}function ko(e,t){return ko=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ko(e,t)}function Wh(e){var t=Xh();return function(){var n=Vt(e),i;if(t){var o=Vt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Vh(this,i)}}function Vh(e,t){if(t&&(kn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hh(e)}function Hh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xh(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Vt(e){return Vt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Vt(e)}var zh=[0,0,0,0],Lh=[0,255,0,255],jh=["minColor","maxColor","colorRange","colorDomain"],$h={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ge},Xt=function(e){kh(r,e);var t=Wh(r);function r(){var i;Bh(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}r.isSupported=function(o){return o.features.has("texture-formats-float32-webgl1")};var n=r.prototype;return n.getShaders=function(){return{vs:Il,fs:Ml,modules:[Ht.picking]}},n.initializeState=function(){var o=this.getAttributeManager();o.addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})},n.shouldUpdateState=function(o){var s=o.changeFlags;return s.somethingChanged},n.updateState=function(o){Wn(Vt(r.prototype),"updateState",this).call(this,o);var s=o.oldProps,a=o.props,l=o.changeFlags,u=this.getAttributeManager();a.numInstances!==s.numInstances?u.invalidateAll():s.cellSizePixels!==a.cellSizePixels&&u.invalidate("instancePositions"),this._updateUniforms(s,a,l)},n.draw=function(o){var s=o.uniforms,a=this.props,l=a.parameters,u=a.maxTexture,c=this.props.minColor||zh,f=this.props.maxColor||Lh,h=this.props.colorDomain||[1,0],_=this.state.model;_.setUniforms(s),_.setBindings({maxTexture:u}),_.setUniforms({minColor:c,maxColor:f,colorDomain:h}),_.setParameters(Uo({depthWriteEnabled:!1},l)),_.draw(this.context.renderPass)},n.calculateInstancePositions=function(o,s){for(var a=s.numInstances,l=this.context.viewport,u=l.width,c=l.height,f=this.props.cellSizePixels,h=Math.ceil(u/f),_=o.value,m=o.size,y=0;y<a;y++){var v=y%h,S=Math.floor(y/h);_[y*m+0]=v*f/u*2-1,_[y*m+1]=1-S*f/c*2,_[y*m+2]=0}},n._getModel=function(){return new ee(this.context.device,Uo(Uo({},this.getShaders()),{},{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new ut({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])}})}))},n._shouldUseMinMax=function(){var o=this.props,s=o.minColor,a=o.maxColor,l=o.colorDomain,u=o.colorRange;return s||a?(Ht.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(l||u)},n._updateUniforms=function(o,s,a){var l=this.state.model;if(jh.some(function(S){return o[S]!==s[S]})&&l.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),o.colorRange!==s.colorRange&&l.setUniforms({colorRange:et(s.colorRange)}),o.cellMarginPixels!==s.cellMarginPixels||o.cellSizePixels!==s.cellSizePixels||a.viewportChanged){var u=this.context.viewport,c=u.width,f=u.height,h=this.props,_=h.cellSizePixels,m=h.cellMarginPixels,y=_>m?m:0,v=new Float32Array([(_-y)/c*2,-(_-y)/f*2,1]);l.setUniforms({cellScale:v})}},r}(Ht.Layer);Xt.layerName="ScreenGridCellLayer";Xt.defaultProps=$h;var lu=M(Q());var zt=M(Q());function Fl(e,t){var r={};for(var n in e)t.includes(n)||(r[n]=e[n]);return r}function Vn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Vn=function(r){return typeof r}:Vn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Vn(e)}function Bl(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Kh(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
517
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Kh(e,t){if(e){if(typeof e=="string")return Ul(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ul(e,t)}}function Ul(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Yh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fr(e,t,r){return typeof Reflect<"u"&&Reflect.get?Fr=Reflect.get:Fr=function(i,o,s){var a=qh(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},Fr(e,t,r||e)}function qh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=gt(e),e!==null););return e}function Zh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wo(e,t)}function Wo(e,t){return Wo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Wo(e,t)}function Qh(e){var t=e_();return function(){var n=gt(e),i;if(t){var o=gt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Jh(this,i)}}function Jh(e,t){if(t&&(Vn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gh(e)}function Gh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function e_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gt(e){return gt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},gt(e)}var ye=function(e){Zh(r,e);var t=Qh(r);function r(){var i;Yh(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){Fr(gt(r.prototype),"initializeState",this).call(this,this.context),this.setState({ignoreProps:Fl(this.constructor._propTypes,o.data.props),dimensions:o})},n.updateState=function(o){Fr(gt(r.prototype),"updateState",this).call(this,o);var s=o.changeFlags;if(s.extensionsChanged){var a=this.getShaders({});a&&a.defines&&(a.defines.NON_INSTANCED_MODEL=1),this.updateShaders(a)}this._updateAttributes()},n.updateAttributes=function(o){this.setState({changedAttributes:o})},n.getAttributes=function(){return this.getAttributeManager().getAttributes()},n.getModuleSettings=function(){var o=this.context,s=o.viewport,a=o.mousePosition,l=o.device,u=Object.assign(Object.create(this.props),{viewport:s,mousePosition:a,picking:{isActive:0},devicePixelRatio:l.canvasContext.cssToDeviceRatio()});return u},n.updateShaders=function(o){},n.isAggregationDirty=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=o.props,l=o.oldProps,u=o.changeFlags,c=s.compareAll,f=c===void 0?!1:c,h=s.dimension,_=this.state.ignoreProps,m=h.props,y=h.accessors,v=y===void 0?[]:y,S=u.updateTriggersChanged;if(u.dataChanged)return!0;if(S){if(S.all)return!0;var T=Bl(v),x;try{for(T.s();!(x=T.n()).done;){var O=x.value;if(S[O])return!0}}catch(F){T.e(F)}finally{T.f()}}if(f)return u.extensionsChanged?!0:(0,zt._compareProps)({oldProps:l,newProps:a,ignoreProps:_,propTypes:this.constructor._propTypes});var P=Bl(m),I;try{for(P.s();!(I=P.n()).done;){var D=I.value;if(a[D]!==l[D])return!0}}catch(F){P.e(F)}finally{P.f()}return!1},n.isAttributeChanged=function(o){var s=this.state.changedAttributes;return o?s&&s[o]!==void 0:!t_(s)},n._getAttributeManager=function(){return new zt.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},r}(zt.CompositeLayer);ye.layerName="AggregationLayer";function t_(e){var t=!0;for(var r in e){t=!1;break}return t}var Vl=M(Q());function r_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=n_(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
518
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function n_(e,t){if(e){if(typeof e=="string")return kl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kl(e,t)}}function kl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Hn(e,t,r){var n=r;return n.domain=function(){return e},n.range=function(){return t},n}function Wl(e,t){var r=function(i){return f_(e,t,i)};return Hn(e,t,r)}function i_(e,t){var r=function(i){return d_(e,t,i)};return Hn(e,t,r)}function o_(e,t){for(var r=e.sort(Hl),n=0,i=Math.max(1,t.length),o=new Array(i-1);++n<i;)o[n-1]=s_(r,n/i);var s=function(l){return l_(o,t,l)};return s.thresholds=function(){return o},Hn(e,t,s)}function Hl(e,t){return e-t}function s_(e,t){var r=e.length;if(t<=0||r<2)return e[0];if(t>=1)return e[r-1];var n=(r-1)*t,i=Math.floor(n),o=e[i],s=e[i+1];return o+(s-o)*(n-i)}function a_(e,t){for(var r=0,n=e.length;r<n;){var i=r+n>>>1;Hl(e[i],t)>0?n=i:r=i+1}return r}function l_(e,t,r){return t[a_(e,r)]}function u_(e,t,r,n){var i="".concat(n),o=t.get(i);return o===void 0&&(o=e.push(n),t.set(i,o)),r[(o-1)%r.length]}function c_(e,t){var r=new Map,n=[],i=r_(e),o;try{for(i.s();!(o=i.n()).done;){var s=o.value,a="".concat(s);r.has(a)||r.set(a,n.push(s))}}catch(u){i.e(u)}finally{i.f()}var l=function(c){return u_(n,r,t,c)};return Hn(e,t,l)}function f_(e,t,r){var n=e[1]-e[0];if(n<=0)return Vl.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];var i=n/t.length,o=Math.floor((r-e[0])/i),s=Math.max(Math.min(o,t.length-1),0);return t[s]}function d_(e,t,r){return(r-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function Xl(e){return e!=null}function h_(e){var t=[];return e.forEach(function(r){!t.includes(r)&&Xl(r)&&t.push(r)}),t}function zl(e,t){var r=typeof t=="function"?e.map(t):e;return r.filter(Xl)}function Ll(e,t){return zl(e,t)}function jl(e,t){return h_(zl(e,t))}function $l(e,t,r){return Math.max(t,Math.min(r,e))}function Kl(e){switch(e){case"quantize":return Wl;case"linear":return i_;case"quantile":return o_;case"ordinal":return c_;default:return Wl}}function Yl(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ql(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
519
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Vo(e,t){return p_(e)||g_(e,t)||Ql(e,t)||__()}function __(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
520
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ql(e,t){if(e){if(typeof e=="string")return ql(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ql(e,t)}}function ql(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function g_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function p_(e){if(Array.isArray(e))return e}function m_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Jl=function(t){return t.length},v_=3402823466e29,Gl=function(t){return t.points},eu=function(t){return t.index},Zl=function(t,r){return t<r?-1:t>r?1:t>=r?0:NaN},b_={getValue:Jl,getPoints:Gl,getIndex:eu,filterData:null},Lt=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b_;m_(this,e),this.maxCount=void 0,this.maxValue=void 0,this.minValue=void 0,this.totalCount=void 0,this.aggregatedBins=void 0,this.sortedBins=void 0,this.binMap=void 0,this.aggregatedBins=this.getAggregatedBins(r,n),this._updateMinMaxValues(),this.binMap=this.getBinMap()}var t=e.prototype;return t.getAggregatedBins=function(n,i){for(var o=i.getValue,s=o===void 0?Jl:o,a=i.getPoints,l=a===void 0?Gl:a,u=i.getIndex,c=u===void 0?eu:u,f=i.filterData,h=typeof f=="function",_=n.length,m=[],y=0,v=0;v<_;v++){var S=n[v],T=l(S),x=c(S),O=h?T.filter(f):T;S.filteredPoints=h?O:null;var P=O.length?s(O):null;P!=null&&(m[y]={i:Number.isFinite(x)?x:v,value:P,counts:O.length},y++)}return m},t._percentileToIndex=function(n){var i=this.sortedBins.length;if(i<2)return[0,0];var o=n.map(function(f){return $l(f,0,100)}),s=Vo(o,2),a=s[0],l=s[1],u=Math.ceil(a/100*(i-1)),c=Math.floor(l/100*(i-1));return[u,c]},t.getBinMap=function(){var n={},i=Yl(this.aggregatedBins),o;try{for(i.s();!(o=i.n()).done;){var s=o.value;n[s.i]=s}}catch(a){i.e(a)}finally{i.f()}return n},t._updateMinMaxValues=function(){var n=0,i=0,o=v_,s=0,a=Yl(this.aggregatedBins),l;try{for(a.s();!(l=a.n()).done;){var u=l.value;n=n>u.counts?n:u.counts,i=i>u.value?i:u.value,o=o<u.value?o:u.value,s+=u.counts}}catch(c){a.e(c)}finally{a.f()}this.maxCount=n,this.maxValue=i,this.minValue=o,this.totalCount=s},t.getValueRange=function(n){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(a,l){return Zl(a.value,l.value)})),!this.sortedBins.length)return[];var i=0,o=this.sortedBins.length-1;if(Array.isArray(n)){var s=this._percentileToIndex(n);i=s[0],o=s[1]}return[this.sortedBins[i].value,this.sortedBins[o].value]},t.getValueDomainByScale=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=Vo(i,2),s=o[0],a=s===void 0?0:s,l=o[1],u=l===void 0?100:l;if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(f,h){return Zl(f.value,h.value)})),!this.sortedBins.length)return[];var c=this._percentileToIndex([a,u]);return this._getScaleDomain(n,c)},t._getScaleDomain=function(n,i){var o=Vo(i,2),s=o[0],a=o[1],l=this.sortedBins;switch(n){case"quantize":case"linear":return[l[s].value,l[a].value];case"quantile":return Ll(l.slice(s,a+1),function(u){return u.value});case"ordinal":return jl(l,function(u){return u.value});default:return[l[s].value,l[a].value]}},e}();var su=M(Q());var tt=M(Q()),ru=6378e3;function Xn(e){return Number.isFinite(e)?e:0}function zn(e,t){for(var r=e.positions.value,n=1/0,i=-1/0,o=1/0,s=-1/0,a,l,u=0;u<t;u++)l=r[u*3],a=r[u*3+1],n=a<n?a:n,i=a>i?a:i,o=l<o?l:o,s=l>s?l:s;var c={xMin:Xn(o),xMax:Xn(s),yMin:Xn(n),yMax:Xn(i)};return c}function y_(e,t,r,n){var i=n.width,o=n.height,s=r===tt.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-o/2]:[-180,-90];tt.log.assert(r===tt.COORDINATE_SYSTEM.CARTESIAN||r===tt.COORDINATE_SYSTEM.LNGLAT||r===tt.COORDINATE_SYSTEM.DEFAULT);var a=e.xMin,l=e.yMin;return[-1*(tu(a-s[0],t.xOffset)+s[0]),-1*(tu(l-s[1],t.yOffset)+s[1])]}function tu(e,t){var r=e<0?-1:1,n=r<0?Math.abs(e)+t:Math.abs(e);return n=Math.floor(n/t)*t,n*r}function Ho(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!r)return{xOffset:t,yOffset:t};var n=e.yMin,i=e.yMax,o=(n+i)/2;return A_(t,o)}function Ln(e,t,r,n){var i=Ho(e,t,n!==tt.COORDINATE_SYSTEM.CARTESIAN),o=y_(e,i,n,r),s=e.xMin,a=e.yMin,l=e.xMax,u=e.yMax,c=l-s+i.xOffset,f=u-a+i.yOffset,h=Math.ceil(c/i.xOffset),_=Math.ceil(f/i.yOffset);return{gridOffset:i,translation:o,width:c,height:f,numCol:h,numRow:_}}function A_(e,t){var r=T_(e),n=S_(t,e);return{yOffset:r,xOffset:n}}function T_(e){return e/ru*(180/Math.PI)}function S_(e,t){return t/ru*(180/Math.PI)/Math.cos(e*Math.PI/180)}function nu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function x_(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nu(Object(r),!0).forEach(function(n){R_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function R_(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E_(e,t){return C_(e)||w_(e,t)||ou(e,t)||O_()}function O_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
521
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function C_(e){if(Array.isArray(e))return e}function N_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ou(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
522
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function ou(e,t){if(e){if(typeof e=="string")return iu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return iu(e,t)}}function iu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function jt(e,t){var r=P_(e,t),n=I_(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:n}}function P_(e,t){var r=e.data,n=r===void 0?[]:r,i=e.cellSize,o=t.attributes,s=t.viewport,a=t.projectPoints,l=t.numInstances,u=o.positions.value,c=o.positions.getAccessor(),f=c.size,h=t.boundingBox||M_(o.positions,l),_=t.posOffset||[180,90],m=t.gridOffset||Ho(h,i);if(m.xOffset<=0||m.yOffset<=0)return{gridHash:{},gridOffset:m,offsets:[0,0]};var y=s.width,v=s.height,S=Math.ceil(y/m.xOffset),T=Math.ceil(v/m.yOffset),x={},O=(0,su.createIterable)(n),P=O.iterable,I=O.objectInfo,D=new Array(3),F=N_(P),X;try{for(F.s();!(X=F.n()).done;){var L=X.value;I.index++,D[0]=u[I.index*f],D[1]=u[I.index*f+1],D[2]=f>=3?u[I.index*f+2]:0;var q=a?s.project(D):D,re=E_(q,2),fe=re[0],fs=re[1];if(Number.isFinite(fe)&&Number.isFinite(fs)){var Vr=Math.floor((fs+_[1])/m.yOffset),Hr=Math.floor((fe+_[0])/m.xOffset);if(!a||Hr>=0&&Hr<S&&Vr>=0&&Vr<T){var Xr="".concat(Vr,"-").concat(Hr);x[Xr]=x[Xr]||{count:0,points:[],lonIdx:Hr,latIdx:Vr},x[Xr].count+=1,x[Xr].points.push({source:L,index:I.index})}}}}catch(Dc){F.e(Dc)}finally{F.f()}return{gridHash:x,gridOffset:m,offsets:[_[0]*-1,_[1]*-1]}}function I_(e){var t=e.gridHash,r=e.gridOffset,n=e.offsets,i=new Array(Object.keys(t).length),o=0;for(var s in t){var a=s.split("-"),l=parseInt(a[0],10),u=parseInt(a[1],10),c=o++;i[c]=x_({index:c,position:[n[0]+r.xOffset*u,n[1]+r.yOffset*l]},t[s])}return i}function M_(e,t){for(var r=e.value,n=e.getAccessor(),i=n.size,o=1/0,s=-1/0,a=1/0,l=-1/0,u,c,f=0;f<t;f++)c=r[f*i],u=r[f*i+1],Number.isFinite(c)&&Number.isFinite(u)&&(o=u<o?u:o,s=u>s?u:s,a=c<a?c:a,l=c>l?c:l);return{xMin:a,xMax:l,yMin:o,yMax:s}}function jn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?jn=function(r){return typeof r}:jn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},jn(e)}function D_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=F_(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
523
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function F_(e,t){if(e){if(typeof e=="string")return au(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return au(e,t)}}function au(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function B_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $t(e,t,r){return typeof Reflect<"u"&&Reflect.get?$t=Reflect.get:$t=function(i,o,s){var a=U_(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},$t(e,t,r||e)}function U_(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=rt(e),e!==null););return e}function k_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xo(e,t)}function Xo(e,t){return Xo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Xo(e,t)}function W_(e){var t=X_();return function(){var n=rt(e),i;if(t){var o=rt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return V_(this,i)}}function V_(e,t){if(t&&(jn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return H_(e)}function H_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function X_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function rt(e){return rt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},rt(e)}var pt=function(e){k_(r,e);var t=W_(r);function r(){var i;B_(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){var s=o.dimensions;$t(rt(r.prototype),"initializeAggregationLayer",this).call(this,s),this.setState({layerData:{},gpuGridAggregator:new oe(this.context.device,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:jt})},n.updateState=function(o){$t(rt(r.prototype),"updateState",this).call(this,o),this.updateAggregationState(o);var s=this.state,a=s.aggregationDataDirty,l=s.aggregationWeightsDirty,u=s.gpuAggregation;if(!(this.getNumInstances()<=0)){var c=!1;(a||u&&l)&&(this._updateAggregation(o),c=!0),!u&&(a||l)&&(this._updateWeightBins(),this._uploadAggregationResults(),c=!0),this.setState({aggregationDirty:c})}},n.finalizeState=function(o){var s,a=this.state.weights.count;a&&a.aggregationBuffer&&a.aggregationBuffer.delete(),(s=this.state.gpuGridAggregator)===null||s===void 0||s.delete(),$t(rt(r.prototype),"finalizeState",this).call(this,o)},n.updateShaders=function(o){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(o)},n.updateAggregationState=function(o){lu.log.assert(!1)},n.allocateResources=function(o,s){if(this.state.numRow!==o||this.state.numCol!==s){var a=s*o*4*4,l=this.state.weights;for(var u in l){var c=l[u];c.aggregationBuffer&&c.aggregationBuffer.delete(),c.aggregationBuffer=this.context.device.createBuffer({byteLength:a,accessor:{size:4,type:5126,divisor:1}})}}},n.updateResults=function(o){var s=o.aggregationData,a=o.maxMinData,l=o.maxData,u=o.minData,c=this.state.weights.count;c&&(c.aggregationData=s,c.maxMinData=a,c.maxData=l,c.minData=u)},n._updateAggregation=function(o){var s=this.state,a=s.cpuGridAggregator,l=s.gpuGridAggregator,u=s.gridOffset,c=s.posOffset,f=s.translation,h=f===void 0?[0,0]:f,_=s.scaling,m=_===void 0?[0,0,0]:_,y=s.boundingBox,v=s.projectPoints,S=s.gpuAggregation,T=s.numCol,x=s.numRow,O=o.props,P=this.context.viewport,I=this.getAttributes(),D=this.getNumInstances();if(S){var X=this.state.weights;l.run({weights:X,cellSize:[u.xOffset,u.yOffset],numCol:T,numRow:x,translation:h,scaling:m,vertexCount:D,projectPoints:v,attributes:I,moduleSettings:this.getModuleSettings()})}else{var F=a(O,{gridOffset:u,projectPoints:v,attributes:I,viewport:P,posOffset:c,boundingBox:y});this.setState({layerData:F})}},n._updateWeightBins=function(){var o=this.state.getValue,s=new Lt(this.state.layerData.data||[],{getValue:o});this.setState({sortedBins:s})},n._uploadAggregationResults=function(){var o=this.state,s=o.numCol,a=o.numRow,l=this.state.layerData.data,u=this.state.sortedBins,c=u.aggregatedBins,f=u.minValue,h=u.maxValue,_=u.totalCount,m=4,y=s*a*m,v=new Float32Array(y).fill(0),S=D_(c),T;try{for(S.s();!(T=S.n()).done;){var x=T.value,O=l[x.i],P=O.lonIdx,I=O.latIdx,D=x.value,F=x.counts,X=(P+I*s)*m;v[X]=D,v[X+m-1]=F}}catch(fe){S.e(fe)}finally{S.f()}var L=new Float32Array([h,0,0,f]),q=new Float32Array([h,0,0,_]),re=new Float32Array([f,0,0,_]);this.updateResults({aggregationData:v,maxMinData:L,maxData:q,minData:re})},r}(ye);pt.layerName="GridAggregationLayer";function $n(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$n=function(r){return typeof r}:$n=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},$n(e)}function z_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kt(e,t,r){return typeof Reflect<"u"&&Reflect.get?Kt=Reflect.get:Kt=function(i,o,s){var a=L_(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},Kt(e,t,r||e)}function L_(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=nt(e),e!==null););return e}function j_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zo(e,t)}function zo(e,t){return zo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},zo(e,t)}function $_(e){var t=q_();return function(){var n=nt(e),i;if(t){var o=nt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K_(this,i)}}function K_(e,t){if(t&&($n(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Y_(e)}function Y_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function nt(e){return nt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},nt(e)}function uu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Lo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uu(Object(r),!0).forEach(function(n){jo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Z_=Lo(Lo({},Xt.defaultProps),{},{getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"}),cu="positions",Q_={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Kn=function(e){j_(r,e);var t=$_(r);function r(){var i;z_(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;if(!Xt.isSupported(this.context.device)){this.setState({supported:!1}),$o.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}Kt(nt(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Q_,getCellSize:function(u){return u.cellSizePixels}});var s={count:{size:1,operation:W.SUM,needMax:!0,maxTexture:Wt(this.context.device,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:s,subLayerData:{attributes:{}},maxTexture:s.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]});var a=this.getAttributeManager();a.add((o={},jo(o,cu,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),jo(o,"count",{size:3,accessor:"getWeight"}),o))},n.shouldUpdateState=function(o){var s=o.changeFlags;return this.state.supported&&s.somethingChanged},n.updateState=function(o){Kt(nt(r.prototype),"updateState",this).call(this,o)},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,s=o.maxTexture,a=o.numRow,l=o.numCol,u=o.weights,c=this.props.updateTriggers,f=u.count.aggregationBuffer,h=this.getSubLayerClass("cells",Xt);return new h(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:c}),{data:{attributes:{instanceCounts:f}},maxTexture:s,numInstances:a*l})},n.finalizeState=function(o){Kt(nt(r.prototype),"finalizeState",this).call(this,o);var s=this.state,a=s.aggregationBuffer,l=s.maxBuffer,u=s.maxTexture;a?.delete(),l?.delete(),u?.delete()},n.getPickingInfo=function(o){var s=o.info,a=s.index;if(a>=0){var l=this.state,u=l.gpuGridAggregator,c=l.gpuAggregation,f=l.weights,h=c?u.getData("count"):f.count;s.object=oe.getAggregationData(Lo({pixelIndex:a},h))}return s},n.updateResults=function(o){var s=o.aggregationData,a=o.maxData,l=this.state.weights.count;l.aggregationData=s,l.aggregationBuffer.write(s),l.maxData=a,l.maxTexture.setImageData({data:a})},n.updateAggregationState=function(o){var s=o.props.cellSizePixels,a=o.oldProps.cellSizePixels!==s,l=o.changeFlags.viewportChanged,u=o.props.gpuAggregation;this.state.gpuAggregation!==o.props.gpuAggregation&&u&&!oe.isSupported(this.context.device)&&($o.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),u=!1);var c=u!==this.state.gpuAggregation;this.setState({gpuAggregation:u});var f=this.isAttributeChanged(cu),h=this.state.dimensions,_=h.data,m=h.weights,y=f||c||l||this.isAggregationDirty(o,{compareAll:u,dimension:_}),v=this.isAggregationDirty(o,{dimension:m});this.setState({aggregationDataDirty:y,aggregationWeightsDirty:v});var S=this.context.viewport;if(l||a){var T=S.width,x=S.height,O=Math.ceil(T/s),P=Math.ceil(x/s);this.allocateResources(P,O),this.setState({scaling:[T/2,-x/2,1],gridOffset:{xOffset:s,yOffset:s},width:T,height:x,numCol:O,numRow:P})}v&&this._updateAccessors(o),(y||v)&&this._resetResults()},n._updateAccessors=function(o){var s=o.props,a=s.getWeight,l=s.aggregation,u=s.data,c=this.state.weights.count;c&&(c.getWeight=a,c.operation=W[l]),this.setState({getValue:Ut(l,a,{data:u})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},r}(pt);Kn.layerName="ScreenGridLayer";Kn.defaultProps=Z_;var mu=M(At());function Br(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Br=function(r){return typeof r}:Br=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Br(e)}function fu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ae(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(r),!0).forEach(function(n){gu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function du(){}var hu=["getBins","getDomain","getScaleFunc"],_u=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],G_=function(t){return t.cellSize},Yt=function(){function e(r){J_(this,e),this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=void 0,this._getAggregator=void 0,this._getCellSize=r.getCellSize||G_,this._getAggregator=r.getAggregator,this._addDimension(r.dimensions||_u)}e.defaultDimensions=function(){return _u};var t=e.prototype;return t.updateState=function(n,i){var o=n.oldProps,s=n.props,a=n.changeFlags;this.updateGetValueFuncs(o,s,a);var l=this.needsReProjectPoints(o,s,a),u=!1;if(a.dataChanged||l)this.getAggregatedData(s,i),u=!0;else{var c=this.getDimensionChanges(o,s,a)||[];c.forEach(function(f){return typeof f=="function"&&f()}),u=!0}return this.setState({aggregationDirty:u}),this.state},t.setState=function(n){this.state=Ae(Ae({},this.state),n)},t.setDimensionState=function(n,i){this.setState({dimensions:Ae(Ae({},this.state.dimensions),{},gu({},n,Ae(Ae({},this.state.dimensions[n]),i)))})},t.normalizeResult=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n.hexagons?Ae({data:n.hexagons},n):n.layerData?Ae({data:n.layerData},n):n},t.getAggregatedData=function(n,i){var o=this._getAggregator(n),s=o(n,i);this.setState({layerData:this.normalizeResult(s)}),this.changeFlags={layerData:!0},this.getSortedBins(n)},t.updateGetValueFuncs=function(n,i,o){for(var s in this.dimensionUpdaters){var a=this.dimensionUpdaters[s].getBins.triggers,l=a.value,u=a.weight,c=a.aggregation,f=i[l.prop],h=this.needUpdateDimensionStep(this.dimensionUpdaters[s].getBins,n,i,o);h&&(f?f=bl(f,{data:i.data}):f=Ut(i[c.prop],i[u.prop],{data:i.data})),f&&this.setDimensionState(s,{getValue:f})}},t.needsReProjectPoints=function(n,i,o){return this._getCellSize(n)!==this._getCellSize(i)||this._getAggregator(n)!==this._getAggregator(i)||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getPosition)},t.addDimension=function(n){this._addDimension(n)},t._addDimension=function(){var n=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(o){var s=o.key;n.dimensionUpdaters[s]=n.getDimensionUpdaters(o),n.state.dimensions[s]={getValue:null,domain:null,sortedBins:null,scaleFunc:du}})},t.getDimensionUpdaters=function(n){var i=n.key,o=n.accessor,s=n.pickingInfo,a=n.getBins,l=n.getDomain,u=n.getScaleFunc,c=n.nullValue;return{key:i,accessor:o,pickingInfo:s,getBins:Ae({updater:this.getDimensionSortedBins.bind(this)},a),getDomain:Ae({updater:this.getDimensionValueDomain.bind(this)},l),getScaleFunc:Ae({updater:this.getDimensionScale.bind(this)},u),attributeAccessor:this.getSubLayerDimensionAttribute(i,c)}},t.needUpdateDimensionStep=function(n,i,o,s){return Object.values(n.triggers).some(function(a){return a.updateTrigger?s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged[a.updateTrigger]):i[a.prop]!==o[a.prop]})},t.getDimensionChanges=function(n,i,o){var s=this,a=[],l=function(f){var h=hu.find(function(_){return s.needUpdateDimensionStep(s.dimensionUpdaters[f][_],n,i,o)});h&&a.push(s.dimensionUpdaters[f][h].updater.bind(s,i,s.dimensionUpdaters[f]))};for(var u in this.dimensionUpdaters)l(u);return a.length?a:null},t.getUpdateTriggers=function(n){var i=this,o=n.updateTriggers||{},s={},a=function(c){var f=i.dimensionUpdaters[c].accessor;s[f]={},hu.forEach(function(h){Object.values(i.dimensionUpdaters[c][h].triggers).forEach(function(_){var m=_.prop,y=_.updateTrigger;if(y){var v=o[y];Br(v)==="object"&&!Array.isArray(v)?Object.assign(s[f],v):v!==void 0&&(s[f][m]=v)}else s[f][m]=n[m]})})};for(var l in this.dimensionUpdaters)a(l);return s},t.getSortedBins=function(n){for(var i in this.dimensionUpdaters)this.getDimensionSortedBins(n,this.dimensionUpdaters[i])},t.getDimensionSortedBins=function(n,i){var o=i.key,s=this.state.dimensions[o].getValue,a=new Lt(this.state.layerData.data||[],{getValue:s,filterData:n._filterData});this.setDimensionState(o,{sortedBins:a}),this.getDimensionValueDomain(n,i)},t.getDimensionValueDomain=function(n,i){var o=i.getDomain,s=i.key,a=o.triggers,l=a.lowerPercentile,u=a.upperPercentile,c=a.scaleType,f=this.state.dimensions[s].sortedBins.getValueDomainByScale(n[c.prop],[n[l.prop],n[u.prop]]);this.setDimensionState(s,{valueDomain:f}),this.getDimensionScale(n,i)},t.getDimensionScale=function(n,i){var o=i.key,s=i.getScaleFunc,a=i.getDomain,l=s.triggers,u=l.domain,c=l.range,f=a.triggers.scaleType,h=s.onSet,_=n[c.prop],m=n[u.prop]||this.state.dimensions[o].valueDomain,y=Kl(f&&n[f.prop]),v=y(m,_);Br(h)==="object"&&typeof n[h.props]=="function"&&n[h.props](v.domain()),this.setDimensionState(o,{scaleFunc:v})},t.getSubLayerDimensionAttribute=function(n,i){var o=this;return function(s){var a=o.state.dimensions[n],l=a.sortedBins,u=a.scaleFunc,c=l.binMap[s.index];if(c&&c.counts===0)return i;var f=c&&c.value,h=u.domain(),_=f>=h[0]&&f<=h[h.length-1];return _?u(f):i}},t.getSubLayerAccessors=function(n){var i={};for(var o in this.dimensionUpdaters){var s=this.dimensionUpdaters[o].accessor;i[s]=this.getSubLayerDimensionAttribute(n,o)}return i},t.getPickingInfo=function(n){var i=n.info,o=i.picked&&i.index>-1,s=null;if(o){var a=this.state.layerData.data[i.index],l={};for(var u in this.dimensionUpdaters){var c=this.dimensionUpdaters[u].pickingInfo,f=this.state.dimensions[u].sortedBins,h=f.binMap[a.index]&&f.binMap[a.index].value;l[c]=h}s=Object.assign(l,a,{points:a.filteredPoints||a.points})}return i.picked=Boolean(s),i.object=s,i},t.getAccessor=function(n){return this.dimensionUpdaters.hasOwnProperty(n)?this.dimensionUpdaters[n].attributeAccessor:du},e}();function Yn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yn=function(r){return typeof r}:Yn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Yn(e)}function eg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qn(e,t,r){return typeof Reflect<"u"&&Reflect.get?qn=Reflect.get:qn=function(i,o,s){var a=tg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},qn(e,t,r||e)}function tg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=qt(e),e!==null););return e}function rg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ko(e,t)}function Ko(e,t){return Ko=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ko(e,t)}function ng(e){var t=sg();return function(){var n=qt(e),i;if(t){var o=qt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ig(this,i)}}function ig(e,t){if(t&&(Yn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return og(e)}function og(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function qt(e){return qt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},qt(e)}function pu(){}var ag={colorDomain:null,colorRange:ge,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:pu,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:pu,gridAggregator:jt,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},mt=function(e){rg(r,e);var t=ng(r);function r(){var i;eg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new Yt({getAggregator:function(l){return l.gridAggregator},getCellSize:function(l){return l.cellSize}});this.state={cpuAggregator:o,aggregatorState:o.state};var s=this.getAttributeManager();s.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){qn(qt(r.prototype),"updateState",this).call(this,o),this.setState({aggregatorState:this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})},n.getPickingInfo=function(o){var s=o.info;return this.state.cpuAggregator.getPickingInfo({info:s})},n._onGetSublayerColor=function(o){return this.state.cpuAggregator.getAccessor("fillColor")(o)},n._onGetSublayerElevation=function(o){return this.state.cpuAggregator.getAccessor("elevation")(o)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var o=this.props,s=o.elevationScale,a=o.extruded,l=o.cellSize,u=o.coverage,c=o.material,f=o.transitions,h=this.state.cpuAggregator,_=this.getSubLayerClass("grid-cell",mu.GridCellLayer),m=this._getSublayerUpdateTriggers();return new _({cellSize:l,coverage:u,material:c,elevationScale:s,extruded:a,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:f&&{getFillColor:f.getColorValue||f.getColorWeight,getElevation:f.getElevationValue||f.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:m}),{data:h.state.layerData.data})},r}(ye);mt.layerName="CPUGridLayer";mt.defaultProps=ag;var Su=M(Q()),xu=M(At());var Zt=Math.PI/3,lg=[0,Zt,2*Zt,3*Zt,4*Zt,5*Zt];function ug(e){return e[0]}function cg(e){return e[1]}function Yo(){var e=0,t=0,r=1,n=1,i=ug,o=cg,s,a,l;function u(f){var h={},_=[],m,y=f.length;for(m=0;m<y;++m)if(!(isNaN(S=+i.call(null,v=f[m],m,f))||isNaN(T=+o.call(null,v,m,f)))){var v,S,T,x=Math.round(T=T/l),O=Math.round(S=S/a-(x&1)/2),P=T-x;if(Math.abs(P)*3>1){var I=S-O,D=O+(S<O?-1:1)/2,F=x+(T<x?-1:1),X=S-D,L=T-F;I*I+P*P>X*X+L*L&&(O=D+(x&1?1:-1)/2,x=F)}var q=O+"-"+x,re=h[q];re?re.push(v):(_.push(re=h[q]=[v]),re.x=(O+(x&1)/2)*a,re.y=x*l)}return _}function c(f){var h=0,_=0;return lg.map(function(m){var y=Math.sin(m)*f,v=-Math.cos(m)*f,S=y-h,T=v-_;return h=y,_=v,[S,T]})}return u.hexagon=function(f){return"m"+c(f==null?s:+f).join("l")+"z"},u.centers=function(){for(var f=[],h=Math.round(t/l),_=Math.round(e/a),m=h*l;m<n+s;m+=l,++h)for(var y=_*a+(h&1)*a/2;y<r+a/2;y+=a)f.push([y,m]);return f},u.mesh=function(){var f=c(s).slice(0,4).join("l");return u.centers().map(function(h){return"M"+h+"m"+f}).join("")},u.x=function(f){return arguments.length?(i=f,u):i},u.y=function(f){return arguments.length?(o=f,u):o},u.radius=function(f){return arguments.length?(s=+f,a=s*2*Math.sin(Zt),l=s*1.5,u):s},u.size=function(f){return arguments.length?(e=t=0,r=+f[0],n=+f[1],u):[r-e,n-t]},u.extent=function(f){return arguments.length?(e=+f[0][0],t=+f[0][1],r=+f[1][0],n=+f[1][1],u):[[e,t],[r,n]]},u.radius(1)}var Zn=M(Q());function fg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=dg(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
524
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function dg(e,t){if(e){if(typeof e=="string")return vu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vu(e,t)}}function vu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function bu(e,t){var r=e.data,n=e.radius,i=t.viewport,o=t.attributes,s=r.length?hg(r,t):null,a=_g(n,i,s),l=[],u=(0,Zn.createIterable)(r),c=u.iterable,f=u.objectInfo,h=o.positions.value,_=o.positions.getAccessor(),m=_.size,y=fg(c),v;try{for(y.s();!(v=y.n()).done;){var S=v.value;f.index++;var T=f.index*m,x=[h[T],h[T+1]],O=Number.isFinite(x[0])&&Number.isFinite(x[1]);O?l.push({screenCoord:i.projectFlat(x),source:S,index:f.index}):Zn.log.warn("HexagonLayer: invalid position")()}}catch(D){y.e(D)}finally{y.f()}var P=Yo().radius(a).x(function(D){return D.screenCoord[0]}).y(function(D){return D.screenCoord[1]}),I=P(l);return{hexagons:I.map(function(D,F){return{position:i.unprojectFlat([D.x,D.y]),points:D,index:F}}),radiusCommon:a}}function hg(e,t){var r=t.attributes,n=r.positions.value,i=r.positions.getAccessor(),o=i.size,s=1/0,a=1/0,l=-1/0,u=-1/0,c;for(c=0;c<o*e.length;c+=o){var f=n[c],h=n[c+1],_=Number.isFinite(f)&&Number.isFinite(h);_&&(s=Math.min(f,s),l=Math.max(f,l),a=Math.min(h,a),u=Math.max(h,u))}return[s,a,l,u].every(Number.isFinite)?[(s+l)/2,(a+u)/2]:null}function _g(e,t,r){var n=t.getDistanceScales(r),i=n.unitsPerMeter;return e*i[0]}function Qn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Qn=function(r){return typeof r}:Qn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Qn(e)}function yu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Au(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(r),!0).forEach(function(n){gg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jn(e,t,r){return typeof Reflect<"u"&&Reflect.get?Jn=Reflect.get:Jn=function(i,o,s){var a=mg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},Jn(e,t,r||e)}function mg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Qt(e),e!==null););return e}function vg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qo(e,t)}function qo(e,t){return qo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},qo(e,t)}function bg(e){var t=Tg();return function(){var n=Qt(e),i;if(t){var o=Qt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return yg(this,i)}}function yg(e,t){if(t&&(Qn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ag(e)}function Ag(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Qt(e){return Qt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Qt(e)}function Tu(){}var Sg={colorDomain:null,colorRange:ge,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Tu,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Tu,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:bu,getPosition:{type:"accessor",value:function(t){return t.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},Gn=function(e){vg(r,e);var t=bg(r);function r(){var i;pg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new Yt({getAggregator:function(l){return l.hexagonAggregator},getCellSize:function(l){return l.radius}});this.state={cpuAggregator:o,aggregatorState:o.state,vertices:null};var s=this.getAttributeManager();s.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){if(Jn(Qt(r.prototype),"updateState",this).call(this,o),o.changeFlags.propsOrDataChanged){var s=this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==s.layerData){var a=s.layerData||{},l=a.hexagonVertices;this.setState({vertices:l&&this.convertLatLngToMeterOffset(l)})}this.setState({aggregatorState:s})}},n.convertLatLngToMeterOffset=function(o){var s=this.context.viewport;if(Array.isArray(o)&&o.length===6){var a=o[0],l=o[3],u=[(a[0]+l[0])/2,(a[1]+l[1])/2],c=s.projectFlat(u),f=s.getDistanceScales(u),h=f.metersPerUnit,_=o.map(function(m){var y=s.projectFlat(m);return[(y[0]-c[0])*h[0],(y[1]-c[1])*h[1]]});return _}return Su.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null},n.getPickingInfo=function(o){var s=o.info;return this.state.cpuAggregator.getPickingInfo({info:s})},n._onGetSublayerColor=function(o){return this.state.cpuAggregator.getAccessor("fillColor")(o)},n._onGetSublayerElevation=function(o){return this.state.cpuAggregator.getAccessor("elevation")(o)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var o=this.props,s=o.elevationScale,a=o.extruded,l=o.coverage,u=o.material,c=o.transitions,f=this.state,h=f.aggregatorState,_=f.vertices,m=this.getSubLayerClass("hexagon-cell",xu.ColumnLayer),y=this._getSublayerUpdateTriggers(),v=_?{vertices:_,radius:1}:{radius:h.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new m(Au(Au({},v),{},{diskResolution:6,elevationScale:s,extruded:a,coverage:l,material:u,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:c&&{getFillColor:c.getColorValue||c.getColorWeight,getElevation:c.getElevationValue||c.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:y}),{data:h.layerData.data})},r}(ye);Gn.layerName="HexagonLayer";Gn.defaultProps=Sg;var oi=M(At());var Ju=M(Q());var E;function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var R=.5,N=1/6,b={N:[0,R],E:[R,0],S:[0,-R],W:[-R,0],NE:[R,R],NW:[-R,R],SE:[R,-R],SW:[-R,-R]},Jt=[b.W,b.SW,b.S],Gt=[b.S,b.SE,b.E],er=[b.E,b.NE,b.N],tr=[b.NW,b.W,b.N],rr=[[-R,N],[-R,-N],[-N,-R],[N,-R]],nr=[[-N,-R],[N,-R],[R,-N],[R,N]],ir=[[R,-N],[R,N],[N,R],[-N,R]],or=[[-R,N],[-R,-N],[N,R],[-N,R]],Ru=[b.W,b.SW,b.SE,b.E],Eu=[b.S,b.SE,b.NE,b.N],Ou=[b.NW,b.W,b.E,b.NE],wu=[b.NW,b.SW,b.S,b.N],Cu=[[-R,N],[-R,-N],[R,-N],[R,N]],Nu=[[-N,-R],[N,-R],[N,R],[-N,R]],xg=[b.NW,b.SW,b.SE,b.NE],Pu=[b.NW,b.SW,b.SE,b.E,b.N],Iu=[b.W,b.SW,b.SE,b.NE,b.N],Mu=[b.NW,b.W,b.S,b.SE,b.NE],Du=[b.NW,b.SW,b.S,b.E,b.NE],Fu=[b.NW,b.W,[R,-N],[R,N],b.N],Bu=[[-N,-R],[N,-R],b.E,b.NE,b.N],Uu=[[-R,N],[-R,-N],b.S,b.SE,b.E],ku=[b.W,b.SW,b.S,[N,R],[-N,R]],Wu=[b.NW,b.W,[-N,-R],[N,-R],b.N],Vu=[[-R,N],[-R,-N],b.E,b.NE,b.N],Hu=[b.S,b.SE,b.E,[N,R],[-N,R]],Xu=[b.W,b.SW,b.S,[R,-N],[R,N]],zu=[b.W,b.SW,b.SE,b.E,[N,R],[-N,R]],Lu=[[-R,N],[-R,-N],b.S,b.SE,b.NE,b.N],ju=[b.NW,b.W,[-N,-R],[N,-R],b.E,b.NE],$u=[b.NW,b.SW,b.S,[R,-N],[R,N],b.N],sr=[b.W,b.SW,b.S,b.E,b.NE,b.N],ar=[b.NW,b.W,b.S,b.SE,b.E,b.N],ei=[[-R,N],[-R,-N],[-N,-R],[N,-R],b.E,b.NE,b.N],ti=[b.W,b.SW,b.S,[R,-N],[R,N],[N,R],[-N,R]],ri=[b.NW,b.W,[-N,-R],[N,-R],[R,-N],[R,N],b.N],ni=[[-R,N],[-R,-N],b.S,b.SE,b.E,[N,R],[-N,R]],Ku=[[-R,N],[-R,-N],[-N,-R],[N,-R],[R,-N],[R,N],[N,R],[-N,R]],Yu={0:[],1:[[b.W,b.S]],2:[[b.S,b.E]],3:[[b.W,b.E]],4:[[b.N,b.E]],5:{0:[[b.W,b.S],[b.N,b.E]],1:[[b.W,b.N],[b.S,b.E]]},6:[[b.N,b.S]],7:[[b.W,b.N]],8:[[b.W,b.N]],9:[[b.N,b.S]],10:{0:[[b.W,b.N],[b.S,b.E]],1:[[b.W,b.S],[b.N,b.E]]},11:[[b.N,b.E]],12:[[b.W,b.E]],13:[[b.S,b.E]],14:[[b.W,b.S]],15:[]};function C(e){return parseInt(e,4)}var qu=(E={},w(E,C("0000"),[]),w(E,C("2222"),[]),w(E,C("2221"),[Jt]),w(E,C("2212"),[Gt]),w(E,C("2122"),[er]),w(E,C("1222"),[tr]),w(E,C("0001"),[Jt]),w(E,C("0010"),[Gt]),w(E,C("0100"),[er]),w(E,C("1000"),[tr]),w(E,C("2220"),[rr]),w(E,C("2202"),[nr]),w(E,C("2022"),[ir]),w(E,C("0222"),[or]),w(E,C("0002"),[rr]),w(E,C("0020"),[nr]),w(E,C("0200"),[ir]),w(E,C("2000"),[or]),w(E,C("0011"),[Ru]),w(E,C("0110"),[Eu]),w(E,C("1100"),[Ou]),w(E,C("1001"),[wu]),w(E,C("2211"),[Ru]),w(E,C("2112"),[Eu]),w(E,C("1122"),[Ou]),w(E,C("1221"),[wu]),w(E,C("2200"),[Cu]),w(E,C("2002"),[Nu]),w(E,C("0022"),[Cu]),w(E,C("0220"),[Nu]),w(E,C("1111"),[xg]),w(E,C("1211"),[Pu]),w(E,C("2111"),[Iu]),w(E,C("1112"),[Mu]),w(E,C("1121"),[Du]),w(E,C("1011"),[Pu]),w(E,C("0111"),[Iu]),w(E,C("1110"),[Mu]),w(E,C("1101"),[Du]),w(E,C("1200"),[Fu]),w(E,C("0120"),[Bu]),w(E,C("0012"),[Uu]),w(E,C("2001"),[ku]),w(E,C("1022"),[Fu]),w(E,C("2102"),[Bu]),w(E,C("2210"),[Uu]),w(E,C("0221"),[ku]),w(E,C("1002"),[Wu]),w(E,C("2100"),[Vu]),w(E,C("0210"),[Hu]),w(E,C("0021"),[Xu]),w(E,C("1220"),[Wu]),w(E,C("0122"),[Vu]),w(E,C("2012"),[Hu]),w(E,C("2201"),[Xu]),w(E,C("0211"),[zu]),w(E,C("2110"),[Lu]),w(E,C("1102"),[ju]),w(E,C("1021"),[$u]),w(E,C("2011"),[zu]),w(E,C("0112"),[Lu]),w(E,C("1120"),[ju]),w(E,C("1201"),[$u]),w(E,C("2101"),[sr]),w(E,C("0121"),[sr]),w(E,C("1012"),[ar]),w(E,C("1210"),[ar]),w(E,C("0101"),{0:[Jt,er],1:[sr],2:[sr]}),w(E,C("1010"),{0:[tr,Gt],1:[ar],2:[ar]}),w(E,C("2121"),{0:[sr],1:[sr],2:[Jt,er]}),w(E,C("1212"),{0:[ar],1:[ar],2:[tr,Gt]}),w(E,C("2120"),{0:[ei],1:[ei],2:[rr,er]}),w(E,C("2021"),{0:[ti],1:[ti],2:[Jt,ir]}),w(E,C("1202"),{0:[ri],1:[ri],2:[tr,nr]}),w(E,C("0212"),{0:[ni],1:[ni],2:[Gt,or]}),w(E,C("0102"),{0:[rr,er],1:[ei],2:[ei]}),w(E,C("0201"),{0:[Jt,ir],1:[ti],2:[ti]}),w(E,C("1020"),{0:[tr,nr],1:[ri],2:[ri]}),w(E,C("2010"),{0:[Gt,or],1:[ni],2:[ni]}),w(E,C("2020"),{0:[or,nr],1:[Ku],2:[rr,ir]}),w(E,C("0202"),{0:[ir,rr],1:[Ku],2:[or,nr]}),E);function Zu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Qu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(r),!0).forEach(function(n){Rg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var vt={ISO_LINES:1,ISO_BANDS:2},Eg={zIndex:0,zOffset:.005};function Ur(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function Gu(e){var t=e.cellWeights,r=e.x,n=e.y,i=e.width,o=e.height,s=e.threshold;e.thresholdValue&&(Ju.log.deprecated("thresholdValue","threshold")(),s=e.thresholdValue);var a=r<0,l=r>=i-1,u=n<0,c=n>=o-1,f=a||l||u||c,h={},_={};a||c?_.top=0:(h.top=t[(n+1)*i+r],_.top=Ur(h.top,s)),l||c?_.topRight=0:(h.topRight=t[(n+1)*i+r+1],_.topRight=Ur(h.topRight,s)),l||u?_.right=0:(h.right=t[n*i+r+1],_.right=Ur(h.right,s)),a||u?_.current=0:(h.current=t[n*i+r],_.current=Ur(h.current,s));var m=_.top,y=_.topRight,v=_.right,S=_.current,T=-1;Number.isFinite(s)&&(T=m<<3|y<<2|v<<1|S),Array.isArray(s)&&(T=m<<6|y<<4|v<<2|S);var x=0;return f||(x=Ur((h.top+h.topRight+h.right+h.current)/4,s)),{code:T,meanCode:x}}function Zo(e){var t=e.gridOrigin,r=e.cellSize,n=e.x,i=e.y,o=e.code,s=e.meanCode,a=e.type,l=a===void 0?vt.ISO_LINES:a,u=Qu(Qu({},Eg),e.thresholdData),c=l===vt.ISO_BANDS?qu[o]:Yu[o];Array.isArray(c)||(c=c[s]);var f=u.zIndex*u.zOffset,h=(n+1)*r[0],_=(i+1)*r[1],m=t[0]+h,y=t[1]+_;if(l===vt.ISO_BANDS){var v=[];return c.forEach(function(T){var x=[];T.forEach(function(O){var P=m+O[0]*r[0],I=y+O[1]*r[1];x.push([P,I,f])}),v.push(x)}),v}var S=[];return c.forEach(function(T){T.forEach(function(x){var O=m+x[0]*r[0],P=y+x[1]*r[1];S.push([O,P,f])})}),S}function ec(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Og(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
525
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Og(e,t){if(e){if(typeof e=="string")return tc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tc(e,t)}}function tc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function rc(e){var t=e.thresholdData,r=e.cellWeights,n=e.gridSize,i=e.gridOrigin,o=e.cellSize,s=[],a=[],l=n[0],u=n[1],c=0,f=0,h=ec(t),_;try{for(h.s();!(_=h.n()).done;)for(var m=_.value,y=m.contour,v=y.threshold,S=-1;S<l;S++)for(var T=-1;T<u;T++){var x=Gu({cellWeights:r,threshold:v,x:S,y:T,width:l,height:u}),O=x.code,P=x.meanCode,I={type:vt.ISO_BANDS,gridOrigin:i,cellSize:o,x:S,y:T,width:l,height:u,code:O,meanCode:P,thresholdData:m};if(Array.isArray(v)){I.type=vt.ISO_BANDS;var D=Zo(I),F=ec(D),X;try{for(F.s();!(X=F.n()).done;){var L=X.value;a[f++]={vertices:L,contour:y}}}catch(fe){F.e(fe)}finally{F.f()}}else{I.type=vt.ISO_LINES;for(var q=Zo(I),re=0;re<q.length;re+=2)s[c++]={start:q[re],end:q[re+1],contour:y}}}}catch(fe){h.e(fe)}finally{h.f()}return{contourSegments:s,contourPolygons:a}}var sc=M(Q());function ii(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ii=function(r){return typeof r}:ii=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ii(e)}function nc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kr(e,t,r){return typeof Reflect<"u"&&Reflect.get?kr=Reflect.get:kr=function(i,o,s){var a=Cg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},kr(e,t,r||e)}function Cg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=bt(e),e!==null););return e}function Ng(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qo(e,t)}function Qo(e,t){return Qo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Qo(e,t)}function Pg(e){var t=Dg();return function(){var n=bt(e),i;if(t){var o=bt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ig(this,i)}}function Ig(e,t){if(t&&(ii(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mg(e)}function Mg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function bt(e){return bt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},bt(e)}var ic=[255,255,255,255],Fg=1,Bg=1,Ug={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:Bg}],optional:!0,compare:3},zOffset:.005},oc="positions",kg={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},si=function(e){Ng(r,e);var t=Pg(r);function r(){var i;wg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;kr(bt(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:kg}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:W.SUM}}});var s=this.getAttributeManager();s.add((o={},nc(o,oc,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),nc(o,"count",{size:3,accessor:"getWeight"}),o))},n.updateState=function(o){kr(bt(r.prototype),"updateState",this).call(this,o);var s=!1,a=o.oldProps,l=o.props,u=this.state.aggregationDirty;(a.contours!==l.contours||a.zOffset!==l.zOffset)&&(s=!0,this._updateThresholdData(o.props)),this.getNumInstances()>0&&(u||s)&&this._generateContours()},n.renderLayers=function(){var o=this.state.contourData,s=o.contourSegments,a=o.contourPolygons,l=this.getSubLayerClass("lines",oi.LineLayer),u=this.getSubLayerClass("bands",oi.SolidPolygonLayer),c=s&&s.length>0&&new l(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:function(_){return _.start},getTargetPosition:function(_){return _.end},getColor:function(_){return _.contour.color||ic},getWidth:function(_){return _.contour.strokeWidth||Fg}}),f=a&&a.length>0&&new u(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:function(_){return _.vertices},getFillColor:function(_){return _.contour.color||ic}});return[c,f]},n.updateAggregationState=function(o){var s=o.props,a=o.oldProps,l=s.cellSize,u=s.coordinateSystem,c=this.context.viewport,f=a.cellSize!==l,h=s.gpuAggregation;this.state.gpuAggregation!==s.gpuAggregation&&h&&!oe.isSupported(this.context.device)&&(sc.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),h=!1);var _=h!==this.state.gpuAggregation;this.setState({gpuAggregation:h});var m=this.state.dimensions,y=this.isAttributeChanged(oc),v=m.data,S=m.weights,T=this.state.boundingBox;if(y&&(T=zn(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:T})),y||f){var x=Ln(T,l,c,u),O=x.gridOffset,P=x.translation,I=x.width,D=x.height,F=x.numCol,X=x.numRow;this.allocateResources(X,F),this.setState({gridOffset:O,boundingBox:T,translation:P,posOffset:P.slice(),gridOrigin:[-1*P[0],-1*P[1]],width:I,height:D,numCol:F,numRow:X})}var L=y||_||this.isAggregationDirty(o,{dimension:v,compareAll:h}),q=this.isAggregationDirty(o,{dimension:S});q&&this._updateAccessors(o),(L||q)&&this._resetResults(),this.setState({aggregationDataDirty:L,aggregationWeightsDirty:q})},n._updateAccessors=function(o){var s=o.props,a=s.getWeight,l=s.aggregation,u=s.data,c=this.state.weights.count;c&&(c.getWeight=a,c.operation=W[l]),this.setState({getValue:Ut(l,a,{data:u})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},n._generateContours=function(){var o=this.state,s=o.numCol,a=o.numRow,l=o.gridOrigin,u=o.gridOffset,c=o.thresholdData,f=this.state.weights.count,h=f.aggregationData;h||(h=f.aggregationBuffer.readSyncWebGL2(),f.aggregationData=h);var _=oe.getCellData({countsData:h}),m=_.cellWeights,y=rc({thresholdData:c,cellWeights:m,gridSize:[s,a],gridOrigin:l,cellSize:[u.xOffset,u.yOffset]});this.setState({contourData:y})},n._updateThresholdData=function(o){for(var s=o.contours,a=o.zOffset,l=s.length,u=new Array(l),c=0;c<l;c++){var f=s[c];u[c]={contour:f,zIndex:f.zIndex||c,zOffset:a}}this.setState({thresholdData:u})},r}(pt);si.layerName="ContourLayer";si.defaultProps=Ug;var pc=M(Q());var _c=M(Q());var ce=M(Q());var ac=`#version 300 es
|
|
523
526
|
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
|
|
524
527
|
#define RANGE_COUNT 6
|
|
525
528
|
|
|
@@ -625,7 +628,7 @@ void main(void) {
|
|
|
625
628
|
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
626
629
|
}
|
|
627
630
|
}
|
|
628
|
-
`;var
|
|
631
|
+
`;var lc=`#version 300 es
|
|
629
632
|
#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
|
|
630
633
|
|
|
631
634
|
precision highp float;
|
|
@@ -638,9 +641,9 @@ void main(void) {
|
|
|
638
641
|
fragColor = vColor;
|
|
639
642
|
fragColor = picking_filterColor(fragColor);
|
|
640
643
|
}
|
|
641
|
-
`;function Tn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Tn=function(r){return typeof r}:Tn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Tn(e)}function Il(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Dl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(r),!0).forEach(function(n){uh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Il(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ch(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e,t,r){return typeof Reflect<"u"&&Reflect.get?vn=Reflect.get:vn=function(i,o,a){var s=dh(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},vn(e,t,r||e)}function dh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Wt(e),e!==null););return e}function gh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ci(e,t)}function Ci(e,t){return Ci=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ci(e,t)}function hh(e){var t=Ah();return function(){var n=Wt(e),i;if(t){var o=Wt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return _h(this,i)}}function _h(e,t){if(t&&(Tn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ph(e)}function ph(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ah(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Wt(e){return Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Wt(e)}var xi=0,Oi=1,Th={colorDomain:null,colorRange:ae,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},mn=function(e){gh(r,e);var t=hh(r);function r(){var i;ch(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return vn(Wt(r.prototype),"getShaders",this).call(this,{vs:Nl,fs:Ml,modules:[ie.project32,ie.gouraudLighting,ie.picking,it]})},n.initializeState=function(){var o=this.getAttributeManager();o.addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var a=this._getModel();this._setupUniformBuffer(a),this.setState({model:a})},n._getModel=function(){return new Y(this.context.device,Dl(Dl({},this.getShaders()),{},{id:this.props.id,geometry:new kt,isInstanced:!0}))},n.draw=function(o){var a=o.uniforms,s=this.props,l=s.cellSize,f=s.offset,u=s.extruded,c=s.elevationScale,d=s.coverage,g=s.gridSize,h=s.gridOrigin,A=s.gridOffset,_=s.elevationRange,v=s.colorMaxMinBuffer,T=s.elevationMaxMinBuffer,m=this.state.model,E=[(0,ie.fp64LowPart)(h[0]),(0,ie.fp64LowPart)(h[1])],O=[(0,ie.fp64LowPart)(A[0]),(0,ie.fp64LowPart)(A[1])],C=this.getDomainUniforms(),N=We(this.props.colorRange);this.bindUniformBuffers(v,T),m.setUniforms(a),m.setUniforms(C),m.setUniforms({cellSize:l,offset:f,extruded:u,elevationScale:c,coverage:d,gridSize:g,gridOrigin:h,gridOriginLow:E,gridOffset:A,gridOffsetLow:O,colorRange:N,elevationRange:_}),m.draw(this.context.renderPass),this.unbindUniformBuffers(v,T)},n.bindUniformBuffers=function(o,a){o.bind({target:35345,index:xi}),a.bind({target:35345,index:Oi})},n.unbindUniformBuffers=function(o,a){o.unbind({target:35345,index:xi}),a.unbind({target:35345,index:Oi})},n.getDomainUniforms=function(){var o=this.props,a=o.colorDomain,s=o.elevationDomain,l={};return a!==null?(l.colorDomainValid=!0,l.colorDomain=a):l.colorDomainValid=!1,s!==null?(l.elevationDomainValid=!0,l.elevationDomain=s):l.elevationDomainValid=!1,l},n._setupUniformBuffer=function(o){var a=o.pipeline.handle,s=this.context.gl,l=s.getUniformBlockIndex(a,"ColorData"),f=s.getUniformBlockIndex(a,"ElevationData");s.uniformBlockBinding(a,l,xi),s.uniformBlockBinding(a,f,Oi)},r}(ie.Layer);mn.layerName="GPUGridCellLayer";mn.defaultProps=Th;function bn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bn=function(r){return typeof r}:bn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bn(e)}function Fl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function wl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fl(Object(r),!0).forEach(function(n){Sn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ht(e,t,r){return typeof Reflect<"u"&&Reflect.get?Ht=Reflect.get:Ht=function(i,o,a){var s=mh(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},Ht(e,t,r||e)}function mh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Le(e),e!==null););return e}function bh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pi(e,t)}function Pi(e,t){return Pi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Pi(e,t)}function Sh(e){var t=Eh();return function(){var n=Le(e),i;if(t){var o=Le(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Rh(this,i)}}function Rh(e,t){if(t&&(bn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yh(e)}function yh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Eh(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Le(e){return Le=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Le(e)}var xh={colorDomain:null,colorRange:ae,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:function(t){return t.position}},extruded:!1,material:!0},Oh={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},Bl="positions",et=function(e){bh(r,e);var t=Sh(r);function r(){var i;vh(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(o){var a,s=o.device,l=ee.isSupported(s);l||Ul.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),Ht(Le(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Oh}),this.setState({gpuAggregation:!0,projectPoints:!1,isSupported:l,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:s.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:s.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"});var f=this.getAttributeManager();f.add((a={},Sn(a,Bl,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),Sn(a,"color",{size:3,accessor:"getColorWeight"}),Sn(a,"elevation",{size:3,accessor:"getElevationWeight"}),a))},n.updateState=function(o){if(this.state.isSupported!==!1){Ht(Le(r.prototype),"updateState",this).call(this,o);var a=this.state.aggregationDirty;a&&this.setState({gridHash:null})}},n.getHashKeyForIndex=function(o){var a=this.state,s=a.numRow,l=a.numCol,f=a.boundingBox,u=a.gridOffset,c=[l,s],d=[f.xMin,f.yMin],g=[u.xOffset,u.yOffset],h=Math.floor(o/c[0]),A=o-h*c[0],_=Math.floor((h*g[1]+d[1]+90+g[1]/2)/g[1]),v=Math.floor((A*g[0]+d[0]+180+g[0]/2)/g[0]);return"".concat(_,"-").concat(v)},n.getPositionForIndex=function(o){var a=this.state,s=a.numRow,l=a.numCol,f=a.boundingBox,u=a.gridOffset,c=[l,s],d=[f.xMin,f.yMin],g=[u.xOffset,u.yOffset],h=Math.floor(o/c[0]),A=o-h*c[0],_=h*g[1]+d[1],v=A*g[0]+d[0];return[v,_]},n.getPickingInfo=function(o){var a=o.info,s=o.mode,l=a.index,f=null;if(l>=0){var u=this.state.gpuGridAggregator,c=this.getPositionForIndex(l),d=ee.getAggregationData(wl({pixelIndex:l},u.getData("color"))),g=ee.getAggregationData(wl({pixelIndex:l},u.getData("elevation")));if(f={colorValue:d.cellWeight,elevationValue:g.cellWeight,count:d.cellCount||g.cellCount,position:c,totalCount:d.totalCount||g.totalCount},s!=="hover"){var h=this.props,A=this.state.gridHash;if(!A){var _=this.state,v=_.gridOffset,T=_.translation,m=_.boundingBox,E=this.context.viewport,O=this.getAttributes(),C=bt(h,{gridOffset:v,attributes:O,viewport:E,translation:T,boundingBox:m});A=C.gridHash,this.setState({gridHash:A})}var N=this.getHashKeyForIndex(l),M=A[N];Object.assign(f,M)}}return a.picked=Boolean(f),a.object=f,a},n.renderLayers=function(){if(!this.state.isSupported)return null;var o=this.props,a=o.elevationScale,s=o.extruded,l=o.cellSize,f=o.coverage,u=o.material,c=o.elevationRange,d=o.colorDomain,g=o.elevationDomain,h=this.state,A=h.weights,_=h.numRow,v=h.numCol,T=h.gridOrigin,m=h.gridOffset,E=A.color,O=A.elevation,C=We(this.props.colorRange),N=this.getSubLayerClass("gpu-grid-cell",mn);return new N({gridSize:[v,_],gridOrigin:T,gridOffset:[m.xOffset,m.yOffset],colorRange:C,elevationRange:c,colorDomain:d,elevationDomain:g,cellSize:l,coverage:f,material:u,elevationScale:a,extruded:s},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:E.aggregationBuffer,elevations:O.aggregationBuffer}},colorMaxMinBuffer:E.maxMinBuffer,elevationMaxMinBuffer:O.maxMinBuffer,numInstances:v*_})},n.finalizeState=function(o){var a=this.state.weights,s=a.color,l=a.elevation;[s,l].forEach(function(f){var u=f.aggregationBuffer,c=f.maxMinBuffer;c?.destroy(),u?.destroy()}),Ht(Le(r.prototype),"finalizeState",this).call(this,o)},n.updateAggregationState=function(o){var a=o.props,s=o.oldProps,l=a.cellSize,f=a.coordinateSystem,u=this.context.viewport,c=s.cellSize!==l,d=this.state.dimensions,g=this.isAttributeChanged(Bl),h=g||this.isAttributeChanged(),A=this.state.boundingBox;if(g&&(A=Gr(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:A})),g||c){var _=en(A,l,u,f),v=_.gridOffset,T=_.translation,m=_.width,E=_.height,O=_.numCol,C=_.numRow;this.allocateResources(C,O),this.setState({gridOffset:v,translation:T,gridOrigin:[-1*T[0],-1*T[1]],width:m,height:E,numCol:O,numRow:C})}var N=h||this.isAggregationDirty(o,{dimension:d.data,compareAll:!0});N&&this._updateAccessors(o),this.setState({aggregationDataDirty:N})},n._updateAccessors=function(o){var a=o.props,s=a.colorAggregation,l=a.elevationAggregation,f=this.state.weights,u=f.color,c=f.elevation;u.operation=w[s],c.operation=w[l]},r}(qe);et.layerName="GPUGridLayer";et.defaultProps=xh;function Rn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Rn=function(r){return typeof r}:Rn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Rn(e)}function Ch(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ph(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mi(e,t)}function Mi(e,t){return Mi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Mi(e,t)}function Nh(e){var t=Dh();return function(){var n=yn(e),i;if(t){var o=yn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Mh(this,i)}}function Mh(e,t){if(t&&(Rn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ih(e)}function Ih(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dh(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function yn(e){return yn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},yn(e)}function Wl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ni(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wl(Object(r),!0).forEach(function(n){Fh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wh=Ni(Ni(Ni({},et.defaultProps),Qe.defaultProps),{},{gpuAggregation:!1}),En=function(e){Ph(r,e);var t=Nh(r);function r(){var i;Ch(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){this.state={useGPUAggregation:!0}},n.updateState=function(o){var a=o.props;this.setState({useGPUAggregation:this.canUseGPUAggregation(a)})},n.renderLayers=function(){var o=this.props,a=o.data,s=o.updateTriggers,l=this.state.useGPUAggregation?"GPU":"CPU",f=this.state.useGPUAggregation?this.getSubLayerClass("GPU",et):this.getSubLayerClass("CPU",Qe);return new f(this.props,this.getSubLayerProps({id:l,updateTriggers:s}),{data:a})},n.canUseGPUAggregation=function(o){var a=o.gpuAggregation,s=o.lowerPercentile,l=o.upperPercentile,f=o.getColorValue,u=o.getElevationValue,c=o.colorScaleType;return!(!a||!ee.isSupported(this.context.device)||s!==0||l!==100||f!==null||u!==null||c==="quantile"||c==="ordinal")},r}(Hl.CompositeLayer);En.layerName="GridLayer";En.defaultProps=wh;function Ll(e,t){return Wh(e)||Uh(e,t)||zl(e,t)||Bh()}function Bh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
642
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
643
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,
|
|
644
|
+
`;function ai(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ai=function(r){return typeof r}:ai=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ai(e)}function uc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function cc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uc(Object(r),!0).forEach(function(n){Wg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function li(e,t,r){return typeof Reflect<"u"&&Reflect.get?li=Reflect.get:li=function(i,o,s){var a=Hg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},li(e,t,r||e)}function Hg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=lr(e),e!==null););return e}function Xg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&es(e,t)}function es(e,t){return es=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},es(e,t)}function zg(e){var t=$g();return function(){var n=lr(e),i;if(t){var o=lr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Lg(this,i)}}function Lg(e,t){if(t&&(ai(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jg(e)}function jg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $g(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function lr(e){return lr=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},lr(e)}var Jo=0,Go=1,Kg={colorDomain:null,colorRange:ge,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},ui=function(e){Xg(r,e);var t=zg(r);function r(){var i;Vg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return li(lr(r.prototype),"getShaders",this).call(this,{vs:ac,fs:lc,modules:[ce.project32,ce.gouraudLighting,ce.picking,Ot]})},n.initializeState=function(){var o=this.getAttributeManager();o.addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var s=this._getModel();this._setupUniformBuffer(s),this.setState({model:s})},n._getModel=function(){return new ee(this.context.device,cc(cc({},this.getShaders()),{},{id:this.props.id,geometry:new mr,isInstanced:!0}))},n.draw=function(o){var s=o.uniforms,a=this.props,l=a.cellSize,u=a.offset,c=a.extruded,f=a.elevationScale,h=a.coverage,_=a.gridSize,m=a.gridOrigin,y=a.gridOffset,v=a.elevationRange,S=a.colorMaxMinBuffer,T=a.elevationMaxMinBuffer,x=this.state.model,O=[(0,ce.fp64LowPart)(m[0]),(0,ce.fp64LowPart)(m[1])],P=[(0,ce.fp64LowPart)(y[0]),(0,ce.fp64LowPart)(y[1])],I=this.getDomainUniforms(),D=et(this.props.colorRange);this.bindUniformBuffers(S,T),x.setUniforms(s),x.setUniforms(I),x.setUniforms({cellSize:l,offset:u,extruded:c,elevationScale:f,coverage:h,gridSize:_,gridOrigin:m,gridOriginLow:O,gridOffset:y,gridOffsetLow:P,colorRange:D,elevationRange:v}),x.draw(this.context.renderPass),this.unbindUniformBuffers(S,T)},n.bindUniformBuffers=function(o,s){o.bind({target:35345,index:Jo}),s.bind({target:35345,index:Go})},n.unbindUniformBuffers=function(o,s){o.unbind({target:35345,index:Jo}),s.unbind({target:35345,index:Go})},n.getDomainUniforms=function(){var o=this.props,s=o.colorDomain,a=o.elevationDomain,l={};return s!==null?(l.colorDomainValid=!0,l.colorDomain=s):l.colorDomainValid=!1,a!==null?(l.elevationDomainValid=!0,l.elevationDomain=a):l.elevationDomainValid=!1,l},n._setupUniformBuffer=function(o){var s=o.pipeline.handle,a=this.context.gl,l=a.getUniformBlockIndex(s,"ColorData"),u=a.getUniformBlockIndex(s,"ElevationData");a.uniformBlockBinding(s,l,Jo),a.uniformBlockBinding(s,u,Go)},r}(ce.Layer);ui.layerName="GPUGridCellLayer";ui.defaultProps=Kg;function ci(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ci=function(r){return typeof r}:ci=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ci(e)}function fc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fc(Object(r),!0).forEach(function(n){fi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ur(e,t,r){return typeof Reflect<"u"&&Reflect.get?ur=Reflect.get:ur=function(i,o,s){var a=qg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},ur(e,t,r||e)}function qg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=it(e),e!==null););return e}function Zg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ts(e,t)}function ts(e,t){return ts=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ts(e,t)}function Qg(e){var t=ep();return function(){var n=it(e),i;if(t){var o=it(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Jg(this,i)}}function Jg(e,t){if(t&&(ci(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gg(e)}function Gg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ep(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function it(e){return it=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},it(e)}var tp={colorDomain:null,colorRange:ge,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:function(t){return t.position}},extruded:!1,material:!0},rp={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},hc="positions",yt=function(e){Zg(r,e);var t=Qg(r);function r(){var i;Yg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(o){var s,a=o.device,l=oe.isSupported(a);l||_c.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),ur(it(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:rp}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:l,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:a.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:a.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"});var u=this.getAttributeManager();u.add((s={},fi(s,hc,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),fi(s,"color",{size:3,accessor:"getColorWeight"}),fi(s,"elevation",{size:3,accessor:"getElevationWeight"}),s))},n.updateState=function(o){if(this.state.isSupported!==!1){ur(it(r.prototype),"updateState",this).call(this,o);var s=this.state.aggregationDirty;s&&this.setState({gridHash:null})}},n.getHashKeyForIndex=function(o){var s=this.state,a=s.numRow,l=s.numCol,u=s.boundingBox,c=s.gridOffset,f=[l,a],h=[u.xMin,u.yMin],_=[c.xOffset,c.yOffset],m=Math.floor(o/f[0]),y=o-m*f[0],v=Math.floor((m*_[1]+h[1]+90+_[1]/2)/_[1]),S=Math.floor((y*_[0]+h[0]+180+_[0]/2)/_[0]);return"".concat(v,"-").concat(S)},n.getPositionForIndex=function(o){var s=this.state,a=s.numRow,l=s.numCol,u=s.boundingBox,c=s.gridOffset,f=[l,a],h=[u.xMin,u.yMin],_=[c.xOffset,c.yOffset],m=Math.floor(o/f[0]),y=o-m*f[0],v=m*_[1]+h[1],S=y*_[0]+h[0];return[S,v]},n.getPickingInfo=function(o){var s=o.info,a=o.mode,l=s.index,u=null;if(l>=0){var c=this.state.gpuGridAggregator,f=this.getPositionForIndex(l),h=oe.getAggregationData(dc({pixelIndex:l},c.getData("color"))),_=oe.getAggregationData(dc({pixelIndex:l},c.getData("elevation")));if(u={colorValue:h.cellWeight,elevationValue:_.cellWeight,count:h.cellCount||_.cellCount,position:f,totalCount:h.totalCount||_.totalCount},a!=="hover"){var m=this.props,y=this.state.gridHash;if(!y){var v=this.state,S=v.gridOffset,T=v.translation,x=v.boundingBox,O=this.context.viewport,P=this.getAttributes(),I=jt(m,{gridOffset:S,attributes:P,viewport:O,translation:T,boundingBox:x});y=I.gridHash,this.setState({gridHash:y})}var D=this.getHashKeyForIndex(l),F=y[D];Object.assign(u,F)}}return s.picked=Boolean(u),s.object=u,s},n.renderLayers=function(){if(!this.state.isSupported)return null;var o=this.props,s=o.elevationScale,a=o.extruded,l=o.cellSize,u=o.coverage,c=o.material,f=o.elevationRange,h=o.colorDomain,_=o.elevationDomain,m=this.state,y=m.weights,v=m.numRow,S=m.numCol,T=m.gridOrigin,x=m.gridOffset,O=y.color,P=y.elevation,I=et(this.props.colorRange),D=this.getSubLayerClass("gpu-grid-cell",ui);return new D({gridSize:[S,v],gridOrigin:T,gridOffset:[x.xOffset,x.yOffset],colorRange:I,elevationRange:f,colorDomain:h,elevationDomain:_,cellSize:l,coverage:u,material:c,elevationScale:s,extruded:a},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:O.aggregationBuffer,elevations:P.aggregationBuffer}},colorMaxMinBuffer:O.maxMinBuffer,elevationMaxMinBuffer:P.maxMinBuffer,numInstances:S*v})},n.finalizeState=function(o){var s=this.state.weights,a=s.color,l=s.elevation;[a,l].forEach(function(u){var c=u.aggregationBuffer,f=u.maxMinBuffer;f?.destroy(),c?.destroy()}),ur(it(r.prototype),"finalizeState",this).call(this,o)},n.updateAggregationState=function(o){var s=o.props,a=o.oldProps,l=s.cellSize,u=s.coordinateSystem,c=this.context.viewport,f=a.cellSize!==l,h=this.state.dimensions,_=this.isAttributeChanged(hc),m=_||this.isAttributeChanged(),y=this.state.boundingBox;if(_&&(y=zn(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:y})),_||f){var v=Ln(y,l,c,u),S=v.gridOffset,T=v.translation,x=v.width,O=v.height,P=v.numCol,I=v.numRow;this.allocateResources(I,P),this.setState({gridOffset:S,translation:T,gridOrigin:[-1*T[0],-1*T[1]],width:x,height:O,numCol:P,numRow:I})}var D=m||this.isAggregationDirty(o,{dimension:h.data,compareAll:!0});D&&this._updateAccessors(o),this.setState({aggregationDataDirty:D})},n._updateAccessors=function(o){var s=o.props,a=s.colorAggregation,l=s.elevationAggregation,u=this.state.weights,c=u.color,f=u.elevation;c.operation=W[a],f.operation=W[l]},r}(pt);yt.layerName="GPUGridLayer";yt.defaultProps=tp;function di(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?di=function(r){return typeof r}:di=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},di(e)}function np(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ip(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ns(e,t)}function ns(e,t){return ns=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ns(e,t)}function op(e){var t=lp();return function(){var n=hi(e),i;if(t){var o=hi(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return sp(this,i)}}function sp(e,t){if(t&&(di(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ap(e)}function ap(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lp(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function hi(e){return hi=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},hi(e)}function gc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gc(Object(r),!0).forEach(function(n){up(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function up(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cp=rs(rs(rs({},yt.defaultProps),mt.defaultProps),{},{gpuAggregation:!1}),_i=function(e){ip(r,e);var t=op(r);function r(){var i;np(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){this.state={useGPUAggregation:!1}},n.updateState=function(o){var s=o.props;this.setState({useGPUAggregation:!1})},n.renderLayers=function(){var o=this.props,s=o.data,a=o.updateTriggers,l=this.state.useGPUAggregation?"GPU":"CPU",u=this.state.useGPUAggregation?this.getSubLayerClass("GPU",yt):this.getSubLayerClass("CPU",mt);return new u(this.props,this.getSubLayerProps({id:l,updateTriggers:a}),{data:s})},n.canUseGPUAggregation=function(o){var s=o.gpuAggregation,a=o.lowerPercentile,l=o.upperPercentile,u=o.getColorValue,c=o.getElevationValue,f=o.colorScaleType;return!(!s||!oe.isSupported(this.context.device)||a!==0||l!==100||u!==null||c!==null||f==="quantile"||f==="ordinal")},r}(pc.CompositeLayer);_i.layerName="GridLayer";_i.defaultProps=cp;function bc(e,t){return hp(e)||dp(e,t)||yc(e,t)||fp()}function fp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
645
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dp(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function hp(e){if(Array.isArray(e))return e}function _p(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=yc(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
646
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function yc(e,t){if(e){if(typeof e=="string")return mc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return mc(e,t)}}function mc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ac(e){var t=e.map(function(a){return a[0]}),r=e.map(function(a){return a[1]}),n=Math.min.apply(null,t),i=Math.max.apply(null,t),o=Math.min.apply(null,r),s=Math.max.apply(null,r);return[n,o,i,s]}function Tc(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var vc=new Float32Array(12);function is(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=0,n=_p(e),i;try{for(n.s();!(i=n.n()).done;)for(var o=i.value,s=0;s<t;s++)vc[r++]=o[s]||0}catch(a){n.e(a)}finally{n.f()}return vc}function Sc(e,t,r){var n=bc(e,4),i=n[0],o=n[1],s=n[2],a=n[3],l=s-i,u=a-o,c=l,f=u;l/u<t/r?c=t/r*u:f=r/t*l,c<t&&(c=t,f=r);var h=(s+i)/2,_=(a+o)/2;return[h-c/2,_-f/2,h+c/2,_+f/2]}function xc(e,t){var r=bc(t,4),n=r[0],i=r[1],o=r[2],s=r[3];return[(e[0]-n)/(o-n),(e[1]-i)/(s-i)]}var Pe=M(Q());var vi=M(Q());var Rc=`#version 300 es
|
|
644
647
|
#define SHADER_NAME heatp-map-layer-vertex-shader
|
|
645
648
|
|
|
646
649
|
uniform sampler2D maxTexture;
|
|
@@ -669,13 +672,13 @@ void main(void) {
|
|
|
669
672
|
vIntensityMax = intensity / maxValue;
|
|
670
673
|
vIntensityMin = intensity / minValue;
|
|
671
674
|
}
|
|
672
|
-
`;var
|
|
675
|
+
`;var Ec=`#version 300 es
|
|
673
676
|
#define SHADER_NAME triangle-layer-fragment-shader
|
|
674
677
|
|
|
675
678
|
precision highp float;
|
|
676
679
|
|
|
677
680
|
uniform float opacity;
|
|
678
|
-
uniform sampler2D
|
|
681
|
+
uniform sampler2D weightsTexture;
|
|
679
682
|
uniform sampler2D colorTexture;
|
|
680
683
|
uniform float aggregationMode;
|
|
681
684
|
|
|
@@ -693,7 +696,7 @@ vec4 getLinearColor(float value) {
|
|
|
693
696
|
}
|
|
694
697
|
|
|
695
698
|
void main(void) {
|
|
696
|
-
vec4 weights = texture(
|
|
699
|
+
vec4 weights = texture(weightsTexture, vTexCoords);
|
|
697
700
|
float weight = weights.r;
|
|
698
701
|
|
|
699
702
|
if (aggregationMode > 0.5) {
|
|
@@ -707,7 +710,7 @@ void main(void) {
|
|
|
707
710
|
linearColor.a *= opacity;
|
|
708
711
|
fragColor = linearColor;
|
|
709
712
|
}
|
|
710
|
-
`;function
|
|
713
|
+
`;function pi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pi=function(r){return typeof r}:pi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},pi(e)}function Oc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Oc(Object(r),!0).forEach(function(n){gp(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&os(e,t)}function os(e,t){return os=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},os(e,t)}function vp(e){var t=Ap();return function(){var n=mi(e),i;if(t){var o=mi(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return bp(this,i)}}function bp(e,t){if(t&&(pi(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yp(e)}function yp(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ap(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function mi(e){return mi=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},mi(e)}var ss=function(e){mp(r,e);var t=vp(r);function r(){var i;pp(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return{vs:Rc,fs:Ec,modules:[vi.project32]}},n.initializeState=function(o){var s=o.device;this.setState({model:this._getModel(s)})},n._getModel=function(o){var s=this.props,a=s.vertexCount,l=s.data,u=s.weightsTexture,c=s.maxTexture,f=s.colorTexture;return new ee(o,gi(gi({},this.getShaders()),{},{id:this.props.id,bindings:{weightsTexture:u,maxTexture:c,colorTexture:f},attributes:l.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-fan-webgl",vertexCount:a}))},n.draw=function(o){var s=o.uniforms,a=this.state.model,l=this.props,u=l.intensity,c=l.threshold,f=l.aggregationMode,h=l.colorDomain;a.setUniforms(gi(gi({},s),{},{intensity:u,threshold:c,aggregationMode:f,colorDomain:h})),a.draw(this.context.renderPass)},r}(vi.Layer);ss.layerName="TriangleLayer";var as=`#version 300 es
|
|
711
714
|
in vec3 positions;
|
|
712
715
|
in vec3 positions64Low;
|
|
713
716
|
in float weights;
|
|
@@ -716,18 +719,20 @@ uniform float radiusPixels;
|
|
|
716
719
|
uniform float textureWidth;
|
|
717
720
|
uniform vec4 commonBounds;
|
|
718
721
|
uniform float weightsScale;
|
|
722
|
+
|
|
719
723
|
void main()
|
|
720
724
|
{
|
|
721
725
|
weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
|
|
722
726
|
|
|
723
|
-
float radiusTexels
|
|
727
|
+
float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
|
|
724
728
|
gl_PointSize = radiusTexels * 2.;
|
|
725
729
|
|
|
726
730
|
vec3 commonPosition = project_position(positions, positions64Low);
|
|
727
731
|
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
|
|
728
732
|
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
733
|
+
gl_Position.w = 1.0;
|
|
729
734
|
}
|
|
730
|
-
`;var
|
|
735
|
+
`;var ls=`#version 300 es
|
|
731
736
|
in vec4 weightsTexture;
|
|
732
737
|
out vec4 fragColor;
|
|
733
738
|
float gaussianKDE(float u){
|
|
@@ -742,24 +747,29 @@ void main()
|
|
|
742
747
|
fragColor = weightsTexture * gaussianKDE(2. * dist);
|
|
743
748
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
744
749
|
}
|
|
745
|
-
`;var
|
|
746
|
-
|
|
750
|
+
`;var wc=`#version 300 es
|
|
751
|
+
uniform sampler2D inTexture;
|
|
752
|
+
uniform float textureSize;
|
|
747
753
|
out vec4 outTexture;
|
|
748
754
|
|
|
749
755
|
void main()
|
|
750
756
|
{
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
757
|
+
int yIndex = gl_VertexID / int(textureSize);
|
|
758
|
+
int xIndex = gl_VertexID - (yIndex * int(textureSize));
|
|
759
|
+
vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
|
|
760
|
+
outTexture = texture(inTexture, uv);
|
|
761
|
+
|
|
762
|
+
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
763
|
+
gl_PointSize = 1.0;
|
|
754
764
|
}
|
|
755
|
-
`;var
|
|
765
|
+
`;var Cc=`#version 300 es
|
|
756
766
|
in vec4 outTexture;
|
|
757
767
|
out vec4 fragColor;
|
|
758
768
|
void main() {
|
|
759
769
|
fragColor = outTexture;
|
|
760
770
|
fragColor.g = outTexture.r / max(1.0, outTexture.a);
|
|
761
771
|
}
|
|
762
|
-
`;function
|
|
763
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yh(e,t){if(e){if(typeof e=="string")return nf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nf(e,t)}}function nf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Zh(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function qh(e){if(Array.isArray(e))return e}function of(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Vt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?of(Object(r),!0).forEach(function(n){Qh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):of(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tt(e,t,r){return typeof Reflect<"u"&&Reflect.get?tt=Reflect.get:tt=function(i,o,a){var s=Gh(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},tt(e,t,r||e)}function Gh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ce(e),e!==null););return e}function e_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Bi(e,t)}function Bi(e,t){return Bi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Bi(e,t)}function t_(e){var t=i_();return function(){var n=Ce(e),i;if(t){var o=Ce(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return r_(this,i)}}function r_(e,t){if(t&&(Nn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return n_(e)}function n_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ce(e){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ce(e)}var o_=2,wi={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},af=[0,0],a_={SUM:0,MEAN:1},s_={getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ae,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}},l_=["blend-minmax-webgl1","texture-formats-float32-webgl1"],f_=["texture-renderable-float32-webgl","texture-blend-float-webgl1"],u_={data:{props:["radiusPixels"]}},Mn=function(e){e_(r,e);var t=t_(r);function r(){var i;Jh(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=this;if(!l_.every(function(a){return o.context.device.features.has(a)})){this.setState({supported:!1}),be.log.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();return}tt(Ce(r.prototype),"initializeAggregationLayer",this).call(this,u_),this.setState({supported:!0,colorDomain:af}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()},n.shouldUpdateState=function(o){var a=o.changeFlags;return a.somethingChanged},n.updateState=function(o){this.state.supported&&(tt(Ce(r.prototype),"updateState",this).call(this,o),this._updateHeatmapState(o))},n._updateHeatmapState=function(o){var a=o.props,s=o.oldProps,l=this._getChangeFlags(o);(l.dataChanged||l.viewportChanged)&&(l.boundsChanged=this._updateBounds(l.dataChanged),this._updateTextureRenderingBounds()),l.dataChanged||l.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):l.viewportZoomChanged&&this._debouncedUpdateWeightmap(),a.colorRange!==s.colorRange&&this._updateColorTexture(o),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:o.context.viewport.zoom})},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,a=o.weightsTexture,s=o.triPositionBuffer,l=o.triTexCoordBuffer,f=o.maxWeightsTexture,u=o.colorTexture,c=o.colorDomain,d=this.props,g=d.updateTriggers,h=d.intensity,A=d.threshold,_=d.aggregation,v=this.getSubLayerClass("triangle",Fi);return new v(this.getSubLayerProps({id:"triangle-layer",updateTriggers:g}),{coordinateSystem:be.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:s,texCoords:l}},vertexCount:4,maxTexture:f,colorTexture:u,aggregationMode:a_[_]||0,texture:a,intensity:h,threshold:A,colorDomain:c})},n.finalizeState=function(o){tt(Ce(r.prototype),"finalizeState",this).call(this,o);var a=this.state,s=a.weightsTransform,l=a.weightsTexture,f=a.maxWeightTransform,u=a.maxWeightsTexture,c=a.triPositionBuffer,d=a.triTexCoordBuffer,g=a.colorTexture,h=a.updateTimer;s?.destroy(),l?.destroy(),f?.destroy(),u?.destroy(),c?.destroy(),d?.destroy(),g?.destroy(),h&&clearTimeout(h)},n._getAttributeManager=function(){return new be.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},n._getChangeFlags=function(o){var a={},s=this.state.dimensions;a.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(o,{compareAll:!0,dimension:s.data})&&"aggregation is dirty",a.viewportChanged=o.changeFlags.viewportChanged;var l=this.state.zoom;return(!o.context.viewport||o.context.viewport.zoom!==l)&&(a.viewportZoomChanged=!0),a},n._createTextures=function(){var o=this.state,a=o.textureSize,s=o.format,l=o.type;this.setState({weightsTexture:this.context.device.createTexture(Vt({width:a,height:a,format:s,type:l},wi)),maxWeightsTexture:this.context.device.createTexture(Vt({format:s,type:l},wi))})},n._setupAttributes=function(){var o=this.getAttributeManager();o.add({positions:{size:3,type:5130,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})},n._setupTextureParams=function(){var o=this.context.device,a=this.props.weightsTextureSize,s=Math.min(a,o.limits.maxTextureDimension2D),l=f_.every(function(g){return o.features.has(g)}),f=Yl({device:o,floatTargetSupport:l}),u=f.format,c=f.type,d=l?1:1/255;this.setState({textureSize:s,format:u,type:c,weightsScale:d}),l||be.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, fallingback to low precession format"))()},n.getShaders=function(o){return tt(Ce(r.prototype),"getShaders",this).call(this,o==="max-weights-transform"?{vs:ef,_fs:tf}:{vs:Jl,_fs:Gl})},n._createWeightsTransform=function(){var o,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=this.state.weightsTransform;(o=s)===null||o===void 0||o.delete(),s=new Me(this.context.device,Vt({id:"".concat(this.id,"-weights-transform"),vertexCount:1,targetTexture:this.state.weightsTexture,targetTextureVarying:"weightsTexture"},a)),this.setState({weightsTransform:s})},n._setupResources=function(){this._createTextures();var o=this.state,a=o.textureSize,s=o.weightsTexture,l=o.maxWeightsTexture,f=this.getShaders("weights-transform");this._createWeightsTransform(f);var u=this.getShaders("max-weights-transform"),c=new Me(this.context.device,Vt(Vt({id:"".concat(this.id,"-max-weights-transform"),_sourceTextures:{inTexture:s},_targetTexture:l,_targetTextureVarying:"outTexture"},u),{},{elementCount:a*a}));this.setState({weightsTexture:s,maxWeightsTexture:l,maxWeightTransform:c,zoom:null,triPositionBuffer:this.context.device.createBuffer({byteLength:48,accessor:{size:3}}),triTexCoordBuffer:this.context.device.createBuffer({byteLength:48,accessor:{size:2}})})},n.updateShaders=function(o){this._createWeightsTransform(o)},n._updateMaxWeightValue=function(){var o=this.state.maxWeightTransform;o.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})},n._updateBounds=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.context.viewport,s=[a.unproject([0,0]),a.unproject([a.width,0]),a.unproject([a.width,a.height]),a.unproject([0,a.height])].map(function(h){return h.map(Math.fround)}),l=jl(s),f={visibleWorldBounds:l,viewportCorners:s},u=!1;if(o||!this.state.worldBounds||!kl(this.state.worldBounds,l)){var c=this._worldToCommonBounds(l),d=this._commonToWorldBounds(c);this.props.coordinateSystem===be.COORDINATE_SYSTEM.LNGLAT&&(d[1]=Math.max(d[1],-85.051129),d[3]=Math.min(d[3],85.051129),d[0]=Math.max(d[0],-360),d[2]=Math.min(d[2],360));var g=this._worldToCommonBounds(d);f.worldBounds=d,f.normalizedCommonBounds=g,u=!0}return this.setState(f),u},n._updateTextureRenderingBounds=function(){var o=this.state,a=o.triPositionBuffer,s=o.triTexCoordBuffer,l=o.normalizedCommonBounds,f=o.viewportCorners,u=this.context.viewport;a.write(Ii(f,3));var c=f.map(function(d){return Kl(u.projectPosition(d),l)});s.write(Ii(c,2))},n._updateColorTexture=function(o){var a=o.props.colorRange,s=this.state.colorTexture,l=We(a,!1,Uint8Array);s?s.setImageData({data:l,width:a.length}):s=this.context.device.createTexture(Vt({data:l,width:a.length,height:1},wi)),this.setState({colorTexture:s})},n._updateWeightmap=function(){var o=this,a=this.props,s=a.radiusPixels,l=a.colorDomain,f=a.aggregation,u=this.state,c=u.worldBounds,d=u.textureSize,g=u.weightsScale,h=this.state.weightsTransform;this.state.isWeightMapDirty=!1;var A=this._worldToCommonBounds(c,{useLayerCoordinateSystem:!0});if(l&&f==="SUM"){var _=this.context.viewport,v=_.distanceScales.metersPerUnit[2]*(A[2]-A[0])/d;this.state.colorDomain=l.map(function(m){return m*v*g})}else this.state.colorDomain=l||af;var T={radiusPixels:s,commonBounds:A,textureWidth:d,weightsScale:g};h.update({elementCount:this.getNumInstances()}),Q(this.context.gl,{clearColor:[0,0,0,0]},function(){h.run({uniforms:T,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:o.getAttributes(),moduleSettings:o.getModuleSettings()})}),this._updateMaxWeightValue()},n._debouncedUpdateWeightmap=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.state.updateTimer,s=this.props.debounceTimeout;o?(a=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(a),a=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),s)),this.setState({updateTimer:a})},n._worldToCommonBounds=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=a.useLayerCoordinateSystem,l=s===void 0?!1:s,f=rf(o,4),u=f[0],c=f[1],d=f[2],g=f[3],h=this.context.viewport,A=this.state.textureSize,_=this.props.coordinateSystem,v=l&&(_===be.COORDINATE_SYSTEM.LNGLAT_OFFSETS||_===be.COORDINATE_SYSTEM.METER_OFFSETS),T=v?h.projectPosition(this.props.coordinateOrigin):[0,0],m=A*o_/h.scale,E,O;return l&&!v?(E=this.projectPosition([u,c,0]),O=this.projectPosition([d,g,0])):(E=h.projectPosition([u,c,0]),O=h.projectPosition([d,g,0])),$l([E[0]-T[0],E[1]-T[1],O[0]-T[0],O[1]-T[1]],m,m)},n._commonToWorldBounds=function(o){var a=rf(o,4),s=a[0],l=a[1],f=a[2],u=a[3],c=this.context.viewport,d=c.unprojectPosition([s,l]),g=c.unprojectPosition([f,u]);return d.slice(0,2).concat(g.slice(0,2))},r}(de);Mn.layerName="HeatmapLayer";Mn.defaultProps=s_;return hf(gr);})();
|
|
772
|
+
`;function bi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bi=function(r){return typeof r}:bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bi(e)}function Nc(e,t){return Rp(e)||xp(e,t)||Sp(e,t)||Tp()}function Tp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
773
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sp(e,t){if(e){if(typeof e=="string")return Pc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pc(e,t)}}function Pc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xp(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function Rp(e){if(Array.isArray(e))return e}function Ic(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ic(Object(r),!0).forEach(function(n){Ep(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ic(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ep(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Op(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cr(e,t,r){return typeof Reflect<"u"&&Reflect.get?cr=Reflect.get:cr=function(i,o,s){var a=wp(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},cr(e,t,r||e)}function wp(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=ot(e),e!==null););return e}function Cp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&cs(e,t)}function cs(e,t){return cs=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},cs(e,t)}function Np(e){var t=Mp();return function(){var n=ot(e),i;if(t){var o=ot(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Pp(this,i)}}function Pp(e,t){if(t&&(bi(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ip(e)}function Ip(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mp(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ot(e){return ot=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ot(e)}var Dp=2,us={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Mc=[0,0],Fp={SUM:0,MEAN:1},Bp={getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ge,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}},Up=["blend-minmax-webgl1","texture-formats-float32-webgl1"],kp=["texture-renderable-float32-webgl","texture-blend-float-webgl1"],Wp={data:{props:["radiusPixels"]}},yi=function(e){Cp(r,e);var t=Np(r);function r(){var i;Op(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=this;if(!Up.every(function(s){return o.context.device.features.has(s)})){this.setState({supported:!1}),Pe.log.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();return}cr(ot(r.prototype),"initializeAggregationLayer",this).call(this,Wp),this.setState({supported:!0,colorDomain:Mc}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()},n.shouldUpdateState=function(o){var s=o.changeFlags;return s.somethingChanged},n.updateState=function(o){this.state.supported&&(cr(ot(r.prototype),"updateState",this).call(this,o),this._updateHeatmapState(o))},n._updateHeatmapState=function(o){var s=o.props,a=o.oldProps,l=this._getChangeFlags(o);(l.dataChanged||l.viewportChanged)&&(l.boundsChanged=this._updateBounds(l.dataChanged),this._updateTextureRenderingBounds()),l.dataChanged||l.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):l.viewportZoomChanged&&this._debouncedUpdateWeightmap(),s.colorRange!==a.colorRange&&this._updateColorTexture(o),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:o.context.viewport.zoom})},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,s=o.weightsTexture,a=o.triPositionBuffer,l=o.triTexCoordBuffer,u=o.maxWeightsTexture,c=o.colorTexture,f=o.colorDomain,h=this.props,_=h.updateTriggers,m=h.intensity,y=h.threshold,v=h.aggregation,S=this.getSubLayerClass("triangle",ss);return new S(this.getSubLayerProps({id:"triangle-layer",updateTriggers:_}),{coordinateSystem:Pe.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:a,texCoords:l}},vertexCount:4,maxTexture:u,colorTexture:c,aggregationMode:Fp[v]||0,weightsTexture:s,intensity:m,threshold:y,colorDomain:f})},n.finalizeState=function(o){cr(ot(r.prototype),"finalizeState",this).call(this,o);var s=this.state,a=s.weightsTransform,l=s.weightsTexture,u=s.maxWeightTransform,c=s.maxWeightsTexture,f=s.triPositionBuffer,h=s.triTexCoordBuffer,_=s.colorTexture,m=s.updateTimer;a?.destroy(),l?.destroy(),u?.destroy(),c?.destroy(),f?.destroy(),h?.destroy(),_?.destroy(),m&&clearTimeout(m)},n._getAttributeManager=function(){return new Pe.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},n._getChangeFlags=function(o){var s={},a=this.state.dimensions;s.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(o,{compareAll:!0,dimension:a.data})&&"aggregation is dirty",s.viewportChanged=o.changeFlags.viewportChanged;var l=this.state.zoom;return(!o.context.viewport||o.context.viewport.zoom!==l)&&(s.viewportZoomChanged=!0),s},n._createTextures=function(){var o=this.state,s=o.textureSize,a=o.format;this.setState({weightsTexture:this.context.device.createTexture(Ne(Ne({},us),{},{width:s,height:s,format:a})),maxWeightsTexture:this.context.device.createTexture(Ne(Ne({},us),{},{width:1,height:1,format:a}))})},n._setupAttributes=function(){var o=this.getAttributeManager();o.add({positions:{size:3,type:5130,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})},n._setupTextureParams=function(){var o=this.context.device,s=this.props.weightsTextureSize,a=Math.min(s,o.limits.maxTextureDimension2D),l=kp.every(function(f){return o.features.has(f)}),u=l?"rgba32float":"rgba8unorm",c=l?1:1/255;this.setState({textureSize:a,format:u,weightsScale:c}),l||Pe.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, falling back to low precision format"))()},n._createWeightsTransform=function(o){var s,a=this.state.weightsTransform,l=this.state.weightsTexture,u=this.getAttributeManager();(s=a)===null||s===void 0||s.destroy(),a=new $e(this.context.device,Ne({id:"".concat(this.id,"-weights-transform"),bufferLayout:u.getBufferLayouts(),vertexCount:1,targetTexture:l,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list"},o)),this.setState({weightsTransform:a})},n._setupResources=function(){this._createTextures();var o=this.context.device,s=this.state,a=s.textureSize,l=s.weightsTexture,u=s.maxWeightsTexture,c=this.getShaders({vs:as,fs:ls});this._createWeightsTransform(c);var f=this.getShaders({vs:wc,fs:Cc}),h=new $e(o,Ne(Ne({id:"".concat(this.id,"-max-weights-transform"),bindings:{inTexture:l},uniforms:{textureSize:a},targetTexture:u},f),{},{vertexCount:a*a,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}}));this.setState({weightsTexture:l,maxWeightsTexture:u,maxWeightTransform:h,zoom:null,triPositionBuffer:o.createBuffer({byteLength:48}),triTexCoordBuffer:o.createBuffer({byteLength:48})})},n.updateShaders=function(o){this._createWeightsTransform(Ne({vs:as,fs:ls},o))},n._updateMaxWeightValue=function(){var o=this.state,s=o.maxWeightTransform,a=o.textureSize;s.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})},n._updateBounds=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.context.viewport,a=[s.unproject([0,0]),s.unproject([s.width,0]),s.unproject([s.width,s.height]),s.unproject([0,s.height])].map(function(m){return m.map(Math.fround)}),l=Ac(a),u={visibleWorldBounds:l,viewportCorners:a},c=!1;if(o||!this.state.worldBounds||!Tc(this.state.worldBounds,l)){var f=this._worldToCommonBounds(l),h=this._commonToWorldBounds(f);this.props.coordinateSystem===Pe.COORDINATE_SYSTEM.LNGLAT&&(h[1]=Math.max(h[1],-85.051129),h[3]=Math.min(h[3],85.051129),h[0]=Math.max(h[0],-360),h[2]=Math.min(h[2],360));var _=this._worldToCommonBounds(h);u.worldBounds=h,u.normalizedCommonBounds=_,c=!0}return this.setState(u),c},n._updateTextureRenderingBounds=function(){var o=this.state,s=o.triPositionBuffer,a=o.triTexCoordBuffer,l=o.normalizedCommonBounds,u=o.viewportCorners,c=this.context.viewport;s.write(is(u,3));var f=u.map(function(h){return xc(c.projectPosition(h),l)});a.write(is(f,2))},n._updateColorTexture=function(o){var s,a=o.props.colorRange,l=this.state.colorTexture,u=et(a,!1,Uint8Array);if(l&&((s=l)===null||s===void 0?void 0:s.width)===a.length)l.setSubImageData({data:u});else{var c;(c=l)===null||c===void 0||c.destroy(),l=this.context.device.createTexture(Ne(Ne({},us),{},{data:u,width:a.length,height:1}))}this.setState({colorTexture:l})},n._updateWeightmap=function(){var o=this.props,s=o.radiusPixels,a=o.colorDomain,l=o.aggregation,u=this.state,c=u.worldBounds,f=u.textureSize,h=u.weightsScale,_=this.state.weightsTransform;this.state.isWeightMapDirty=!1;var m=this._worldToCommonBounds(c,{useLayerCoordinateSystem:!0});if(a&&l==="SUM"){var y=this.context.viewport,v=y.distanceScales.metersPerUnit[2]*(m[2]-m[0])/f;this.state.colorDomain=a.map(function(D){return D*v*h})}else this.state.colorDomain=a||Mc;var S=this.getAttributeManager(),T=S.getAttributes(),x=this.getModuleSettings(),O=T.positions.buffer,P={radiusPixels:s,commonBounds:m,textureWidth:f,weightsScale:h},I=T.weights.buffer;_.model.setAttributes({positions:O,weights:I}),_.model.setVertexCount(this.getNumInstances()),_.model.setUniforms(P),_.model.updateModuleSettings(x),_.run({parameters:{viewport:[0,0,f,f]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()},n._debouncedUpdateWeightmap=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.state.updateTimer,a=this.props.debounceTimeout;o?(s=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(s),s=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),a)),this.setState({updateTimer:s})},n._worldToCommonBounds=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.useLayerCoordinateSystem,l=a===void 0?!1:a,u=Nc(o,4),c=u[0],f=u[1],h=u[2],_=u[3],m=this.context.viewport,y=this.state.textureSize,v=this.props.coordinateSystem,S=l&&(v===Pe.COORDINATE_SYSTEM.LNGLAT_OFFSETS||v===Pe.COORDINATE_SYSTEM.METER_OFFSETS),T=S?m.projectPosition(this.props.coordinateOrigin):[0,0],x=y*Dp/m.scale,O,P;return l&&!S?(O=this.projectPosition([c,f,0]),P=this.projectPosition([h,_,0])):(O=m.projectPosition([c,f,0]),P=m.projectPosition([h,_,0])),Sc([O[0]-T[0],O[1]-T[1],P[0]-T[0],P[1]-T[1]],x,x)},n._commonToWorldBounds=function(o){var s=Nc(o,4),a=s[0],l=s[1],u=s[2],c=s[3],f=this.context.viewport,h=f.unprojectPosition([a,l]),_=f.unprojectPosition([u,c]);return h.slice(0,2).concat(_.slice(0,2))},r}(ye);yi.layerName="HeatmapLayer";yi.defaultProps=Bp;return Hc(Wr);})();
|
|
764
774
|
return __exports__;
|
|
765
775
|
});
|