@deck.gl/aggregation-layers 9.0.0-alpha.7 → 9.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/dist.dev.js +58 -30
  2. package/dist/es5/aggregation-layer.js +3 -1
  3. package/dist/es5/aggregation-layer.js.map +1 -1
  4. package/dist/es5/contour-layer/contour-layer.js +2 -2
  5. package/dist/es5/contour-layer/contour-layer.js.map +1 -1
  6. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +1 -1
  7. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  8. package/dist/es5/grid-layer/grid-layer.js +2 -2
  9. package/dist/es5/grid-layer/grid-layer.js.map +1 -1
  10. package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
  11. package/dist/es5/screen-grid-layer/screen-grid-layer.js +1 -1
  12. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
  13. package/dist/es5/utils/cpu-aggregator.js.map +1 -1
  14. package/dist/es5/utils/resource-utils.js +0 -2
  15. package/dist/es5/utils/resource-utils.js.map +1 -1
  16. package/dist/esm/aggregation-layer.js +3 -1
  17. package/dist/esm/aggregation-layer.js.map +1 -1
  18. package/dist/esm/contour-layer/contour-layer.js +2 -2
  19. package/dist/esm/contour-layer/contour-layer.js.map +1 -1
  20. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +1 -1
  21. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  22. package/dist/esm/grid-layer/grid-layer.js +2 -2
  23. package/dist/esm/grid-layer/grid-layer.js.map +1 -1
  24. package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
  25. package/dist/esm/screen-grid-layer/screen-grid-layer.js +1 -1
  26. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
  27. package/dist/esm/utils/cpu-aggregator.js.map +1 -1
  28. package/dist/esm/utils/resource-utils.js +0 -1
  29. package/dist/esm/utils/resource-utils.js.map +1 -1
  30. package/dist.min.js +61 -61
  31. package/package.json +7 -7
  32. package/src/aggregation-layer.ts +3 -1
  33. package/src/contour-layer/contour-layer.ts +3 -3
  34. package/src/gpu-grid-layer/gpu-grid-layer.ts +1 -1
  35. package/src/grid-layer/grid-layer.ts +4 -2
  36. package/src/heatmap-layer/triangle-layer.ts +0 -1
  37. package/src/screen-grid-layer/screen-grid-layer.ts +1 -1
  38. package/src/utils/cpu-aggregator.ts +1 -1
  39. package/src/utils/resource-utils.ts +2 -8
  40. package/typed/aggregation-layer.d.ts.map +1 -1
  41. package/typed/contour-layer/contour-layer.d.ts.map +1 -1
  42. package/typed/grid-layer/grid-layer.d.ts.map +1 -1
  43. package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -1
  44. 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 ll=Object.create;var mr=Object.defineProperty;var ul=Object.getOwnPropertyDescriptor;var cl=Object.getOwnPropertyNames;var dl=Object.getPrototypeOf,gl=Object.prototype.hasOwnProperty;var Mn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hl=(e,t)=>{for(var r in t)mr(e,r,{get:t[r],enumerable:!0})},vr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cl(t))!gl.call(e,i)&&i!==r&&mr(e,i,{get:()=>t[i],enumerable:!(n=ul(t,i))||n.enumerable});return e},Pe=(e,t,r)=>(vr(e,t,"default"),r&&vr(r,t,"default")),P=(e,t,r)=>(r=e!=null?ll(dl(e)):{},vr(t||!e||!e.__esModule?mr(r,"default",{value:e,enumerable:!0}):r,e)),_l=e=>vr(mr({},"__esModule",{value:!0}),e);var nt=Mn((d_,Wi)=>{Wi.exports=globalThis.deck});var $=Mn((h_,Vi)=>{Vi.exports=globalThis.deck});var M=Mn((T_,Xi)=>{Xi.exports=globalThis.luma});var _r={};hl(_r,{AGGREGATION_OPERATION:()=>w,CPUGridLayer:()=>Je,ContourLayer:()=>An,GPUGridLayer:()=>tt,GridLayer:()=>En,HeatmapLayer:()=>In,HexagonLayer:()=>un,ScreenGridLayer:()=>nn,_AggregationLayer:()=>ce,_BinSorter:()=>St,_CPUAggregator:()=>xt,_GPUGridAggregator:()=>ee});var ge={},Hi=P(nt());Pe(ge,P(nt()));if(!Hi.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Pe(_r,ge);var mi=P($());var je=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}(je||{});var Ie=P(M(),1),V=P(M(),1),Ro=P(M(),1);var L=e=>`${e}`;function he(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]=pl(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&&he(o.validate(e[i],o),`${r}: invalid ${i}`),n[i]=e[i]):n[i]=o.value;return n}function pl(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=L`\
8
8
  #ifdef MODULE_LOGDEPTH
9
9
  logdepth_adjustPosition(gl_Position);
10
10
  #endif
11
- `,$i=X`\
11
+ `,$i=L`\
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 pf={vertex:ki,fragment:$i},Ki=/void\s+main\s*\([^)]*\)\s*\{\n?/,Yi=/}\n?[^{}]*$/,Fn=[],Xt="__LUMA_INJECT_DECLARATIONS__";function Zi(e){let t={vertex:{},fragment:{}};for(let r in e){let n=e[r],i=Af(r);typeof n=="string"&&(n={order:0,injection:n}),t[i][r]=n}return t}function Af(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function Lt(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=t==="vertex";for(let o in r){let a=r[o];a.sort((l,f)=>l.order-f.order),Fn.length=a.length;for(let l=0,f=a.length;l<f;++l)Fn[l]=a[l].injection;let s=`${Fn.join(`
32
+ `;var Al={vertex:ki,fragment:$i},Ki=/void\s+main\s*\([^)]*\)\s*\{\n?/,Yi=/}\n?[^{}]*$/,Fn=[],zt="__LUMA_INJECT_DECLARATIONS__";function Zi(e){let t={vertex:{},fragment:{}};for(let r in e){let n=e[r],i=Tl(r);typeof n=="string"&&(n={order:0,injection:n}),t[i][r]=n}return t}function Tl(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function jt(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=t==="vertex";for(let o in r){let a=r[o];a.sort((f,l)=>f.order-l.order),Fn.length=a.length;for(let f=0,l=a.length;f<l;++f)Fn[f]=a[f].injection;let s=`${Fn.join(`
33
33
  `)}
34
- `;switch(o){case"vs:#decl":i&&(e=e.replace(Xt,s));break;case"vs:#main-start":i&&(e=e.replace(Ki,l=>l+s));break;case"vs:#main-end":i&&(e=e.replace(Yi,l=>s+l));break;case"fs:#decl":i||(e=e.replace(Xt,s));break;case"fs:#main-start":i||(e=e.replace(Ki,l=>l+s));break;case"fs:#main-end":i||(e=e.replace(Yi,l=>s+l));break;default:e=e.replace(o,l=>l+s)}}return e=e.replace(Xt,""),n&&(e=e.replace(/\}\s*$/,o=>o+pf[t])),e}var Tf=1,se=class{static instantiateModules(t){return t.map(r=>{if(r instanceof se)return r;_e(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-${Tf++}`);let n=new se(r);return n.dependencies=se.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:a={},getUniforms:s,deprecations:l=[],defines:f={},inject:u={}}=t;_e(typeof r=="string"),this.name=r,this.vs=n,this.fs=i,this.getModuleUniforms=s,this.dependencies=se.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(l),this.defines=f,this.injections=Zi(u),a&&(this.uniforms=zi(a))}getModuleSource(t){let r;switch(t){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:_e(!1)}let n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
34
+ `;switch(o){case"vs:#decl":i&&(e=e.replace(zt,s));break;case"vs:#main-start":i&&(e=e.replace(Ki,f=>f+s));break;case"vs:#main-end":i&&(e=e.replace(Yi,f=>s+f));break;case"fs:#decl":i||(e=e.replace(zt,s));break;case"fs:#main-start":i||(e=e.replace(Ki,f=>f+s));break;case"fs:#main-end":i||(e=e.replace(Yi,f=>s+f));break;default:e=e.replace(o,f=>f+s)}}return e=e.replace(zt,""),n&&(e=e.replace(/\}\s*$/,o=>o+Al[t])),e}var vl=1,se=class{static instantiateModules(t){return t.map(r=>{if(r instanceof se)return r;he(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-${vl++}`);let n=new se(r);return n.dependencies=se.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:a={},getUniforms:s,deprecations:f=[],defines:l={},inject:u={}}=t;he(typeof r=="string"),this.name=r,this.vs=n,this.fs=i,this.getModuleUniforms=s,this.dependencies=se.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(f),this.defines=l,this.injections=Zi(u),a&&(this.uniforms=zi(a))}getModuleSource(t){let r;switch(t){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:he(!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):ji(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&&_e(o.validate(t[i],o),`${this.name}: invalid ${i}`),r[i]=t[i]):r[i]=o.value}return r}};function zt(e){let t=se.instantiateModules(e);return vf(t)}function vf(e){let t={},r={};return qi({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((n,i)=>r[i]-r[n]).map(n=>t[n])}function qi(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&&qi({modules:o.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}function Qi(e){switch(e?.gpu.toLowerCase()){case"apple":return X`\
39
+ `}getUniforms(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):ji(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&&he(o.validate(t[i],o),`${this.name}: invalid ${i}`),r[i]=t[i]):r[i]=o.value}return r}};function kt(e){let t=se.instantiateModules(e);return ml(t)}function ml(e){let t={},r={};return qi({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((n,i)=>r[i]-r[n]).map(n=>t[n])}function qi(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&&qi({modules:o.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}function Qi(e){switch(e?.gpu.toLowerCase()){case"apple":return L`\
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 X`\
46
+ `;case"nvidia":return L`\
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 X`\
50
+ `;case"intel":return L`\
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 X`\
58
+ `;case"amd":return L`\
59
59
  #define AMD_GPU
60
- `;default:return X`\
60
+ `;default:return L`\
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 Ji(e){let t="";return e.features.has("webgl2")&&(t+=X`\
68
+ `}}function Ji(e){let t="";return e.features.has("webgl2")&&(t+=L`\
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+=X`\
73
+ `),e.features.has("webgl2")||(e.features.has("glsl-frag-depth")&&(t+=L`\
74
74
 
75
75
  // FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available
76
76
  #ifdef GL_EXT_frag_depth
@@ -79,63 +79,63 @@ ${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+=X`\
82
+ `),e!=null&&e.features.has("glsl-derivatives")&&(t+=L`\
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+=X`\
89
+ `),e!=null&&e.features.has("glsl-frag-data")&&(t+=L`\
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+=X`\
96
+ `),e!=null&&e.features.has("glsl-texture-lod")&&(t+=L`\
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 eo(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=jt(e,mf),e;case"fragment":return e=jt(e,bf),e;default:throw new Error(r)}case 100:switch(r){case"vertex":return e=jt(e,Sf),e;case"fragment":return e=jt(e,no),e=yf(e),e;default:throw new Error(r)}default:throw new Error(String(t))}}var to=[[/^(#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("]],mf=[...to,[nt("attribute"),"in $1"],[nt("varying"),"out $1"]],bf=[...to,[nt("varying"),"in $1"]],ro=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],Sf=[...ro,[nt("in"),"attribute $1"],[nt("out"),"varying $1"]],no=[...ro,[nt("in"),"varying $1"]],Rf="gl_FragColor",Gi=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function jt(e,t){for(let[r,n]of t)e=e.replace(r,n);return e}function yf(e){e=jt(e,no);let t=Gi.exec(e);if(t){let r=t[1];e=e.replace(Gi,"").replace(new RegExp(`\\b${r}\\b`,"g"),Rf)}return e}function nt(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function wn(e,t){let r="";for(let n in e){let i=e[n];if(r+=`void ${i.signature} {
103
+ `)),t}function eo(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=$t(e,bl),e;case"fragment":return e=$t(e,Sl),e;default:throw new Error(r)}case 100:switch(r){case"vertex":return e=$t(e,Rl),e;case"fragment":return e=$t(e,no),e=El(e),e;default:throw new Error(r)}default:throw new Error(String(t))}}var to=[[/^(#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("]],bl=[...to,[it("attribute"),"in $1"],[it("varying"),"out $1"]],Sl=[...to,[it("varying"),"in $1"]],ro=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],Rl=[...ro,[it("in"),"attribute $1"],[it("out"),"varying $1"]],no=[...ro,[it("in"),"varying $1"]],yl="gl_FragColor",Gi=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function $t(e,t){for(let[r,n]of t)e=e.replace(r,n);return e}function El(e){e=$t(e,no);let t=Gi.exec(e);if(t){let r=t[1];e=e.replace(Gi,"").replace(new RegExp(`\\b${r}\\b`,"g"),yl)}return e}function it(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function wn(e,t){let r="";for(let n in e){let i=e[n];if(r+=`void ${i.signature} {
105
105
  `,i.header&&(r+=` ${i.header}`),t[n]){let o=t[n];o.sort((a,s)=>a.order-s.order);for(let a of o)r+=` ${a.injection}
106
106
  `}i.footer&&(r+=` ${i.footer}`),r+=`}
107
- `}return r}function Bn(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,a]=i.split(":"),s=i.replace(/\(.+/,""),l=Object.assign(n,{signature:a});switch(o){case"vs":t.vertex[s]=l;break;case"fs":t.fragment[s]=l;break;default:throw new Error(o)}}return t}function io(e,t){return{name:Ef(e,t),language:"glsl",version:xf(e)}}function Ef(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return n?n[1]:t}function xf(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 lo=`
107
+ `}return r}function Bn(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,a]=i.split(":"),s=i.replace(/\(.+/,""),f=Object.assign(n,{signature:a});switch(o){case"vs":t.vertex[s]=f;break;case"fs":t.fragment[s]=f;break;default:throw new Error(o)}}return t}function io(e,t){return{name:xl(e,t),language:"glsl",version:Ol(e)}}function xl(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return n?n[1]:t}function Ol(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 fo=`
108
108
 
109
- ${Xt}
110
- `,Of=X`\
109
+ ${zt}
110
+ `,Cl=L`\
111
111
  precision highp float;
112
- `;function fo(e){let{vs:t,fs:r}=e,n=zt(e.modules||[]);switch(e.platformInfo.shaderLanguage){case"glsl":return{vs:ao(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:ao(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:so(n)};case"wgsl":return{vs:oo(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:oo(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:so(n)}}}function oo(e,t){let{source:r,stage:n,modules:i,defines:o={},hookFunctions:a=[],inject:s={},log:l}=t;_e(typeof r=="string","shader source must be a string");let f=r,u={};i.forEach(_=>{Object.assign(u,_.getDefines())}),Object.assign(u,o);let c="",d=Bn(a),g={},h={},A={};for(let _ in s){let v=typeof s[_]=="string"?{injection:s[_],order:0}:s[_],T=/^(v|f)s:(#)?([\w-]+)$/.exec(_);if(T){let m=T[2],E=T[3];m?E==="decl"?h[_]=[v]:A[_]=[v]:g[_]=[v]}else A[_]=[v]}for(let _ of i){l&&_.checkDeprecations(f,l);let v=_.getModuleSource(n,"wgsl");c+=v;let T=_.injections[n];for(let m in T){let E=/^(v|f)s:#([\w-]+)$/.exec(m);if(E){let C=E[2]==="decl"?h:A;C[m]=C[m]||[],C[m].push(T[m])}else g[m]=g[m]||[],g[m].push(T[m])}}return c+=lo,c=Lt(c,n,h),c+=wn(d[n],g),c+=f,c=Lt(c,n,A),c}function ao(e,t){let{id:r,source:n,stage:i,language:o="glsl",modules:a,defines:s={},hookFunctions:l=[],inject:f={},prologue:u=!0,log:c}=t;_e(typeof n=="string","shader source must be a string");let d=o==="glsl"?io(n).version:-1,g=e.shaderLanguageVersion,h=d===100?"#version 100":"#version 300 es",_=n.split(`
112
+ `;function lo(e){let{vs:t,fs:r}=e,n=kt(e.modules||[]);switch(e.platformInfo.shaderLanguage){case"glsl":return{vs:ao(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:ao(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:so(n)};case"wgsl":return{vs:oo(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:oo(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:so(n)}}}function oo(e,t){let{source:r,stage:n,modules:i,defines:o={},hookFunctions:a=[],inject:s={},log:f}=t;he(typeof r=="string","shader source must be a string");let l=r,u={};i.forEach(_=>{Object.assign(u,_.getDefines())}),Object.assign(u,o);let c="",d=Bn(a),g={},h={},A={};for(let _ in s){let v=typeof s[_]=="string"?{injection:s[_],order:0}:s[_],T=/^(v|f)s:(#)?([\w-]+)$/.exec(_);if(T){let m=T[2],E=T[3];m?E==="decl"?h[_]=[v]:A[_]=[v]:g[_]=[v]}else A[_]=[v]}for(let _ of i){f&&_.checkDeprecations(l,f);let v=_.getModuleSource(n,"wgsl");c+=v;let T=_.injections[n];for(let m in T){let E=/^(v|f)s:#([\w-]+)$/.exec(m);if(E){let C=E[2]==="decl"?h:A;C[m]=C[m]||[],C[m].push(T[m])}else g[m]=g[m]||[],g[m].push(T[m])}}return c+=fo,c=jt(c,n,h),c+=wn(d[n],g),c+=l,c=jt(c,n,A),c}function ao(e,t){let{id:r,source:n,stage:i,language:o="glsl",modules:a,defines:s={},hookFunctions:f=[],inject:l={},prologue:u=!0,log:c}=t;he(typeof n=="string","shader source must be a string");let d=o==="glsl"?io(n).version:-1,g=e.shaderLanguageVersion,h=d===100?"#version 100":"#version 300 es",_=n.split(`
113
113
  `).slice(1).join(`
114
114
  `),v={};a.forEach(N=>{Object.assign(v,N.getDefines())}),Object.assign(v,s);let T="";switch(o){case"wgsl":break;case"glsl":T=u?`${h}
115
115
 
116
116
  // ----- PROLOGUE -------------------------
117
- ${Cf({id:r,source:n,stage:i})}
117
+ ${Pl({id:r,source:n,stage:i})}
118
118
  ${`#define SHADER_TYPE_${i.toUpperCase()}`}
119
119
  ${Qi(e)}
120
120
  ${Ji(e)}
121
- ${i==="fragment"?Of:""}
121
+ ${i==="fragment"?Cl:""}
122
122
 
123
123
  // ----- APPLICATION DEFINES -------------------------
124
124
 
125
- ${Pf(v)}
125
+ ${Nl(v)}
126
126
 
127
127
  `:`${h}
128
- `;break}let m=Bn(l),E={},O={},C={};for(let N in f){let M=typeof f[N]=="string"?{injection:f[N],order:0}:f[N],U=/^(v|f)s:(#)?([\w-]+)$/.exec(N);if(U){let W=U[2],j=U[3];W?j==="decl"?O[N]=[M]:C[N]=[M]:E[N]=[M]}else C[N]=[M]}for(let N of a){c&&N.checkDeprecations(_,c);let M=N.getModuleSource(i);T+=M;let U=N.injections[i];for(let W in U){let j=/^(v|f)s:#([\w-]+)$/.exec(W);if(j){let oe=j[2]==="decl"?O:C;oe[W]=oe[W]||[],oe[W].push(U[W])}else E[W]=E[W]||[],E[W].push(U[W])}}return T+="// ----- MAIN SHADER SOURCE -------------------------",T+=lo,T=Lt(T,i,O),T+=wn(m[i],E),T+=_,T=Lt(T,i,C),o==="glsl"&&d!==g&&(T=eo(T,g,i)),T.trim()}function so(e){return function(r){let n={};for(let i of e){let o=i.getUniforms(r,n);Object.assign(n,o)}return n}}function Cf(e){let{id:t,source:r,stage:n}=e;return t&&r.indexOf("SHADER_NAME")===-1?`
128
+ `;break}let m=Bn(f),E={},O={},C={};for(let N in l){let I=typeof l[N]=="string"?{injection:l[N],order:0}:l[N],U=/^(v|f)s:(#)?([\w-]+)$/.exec(N);if(U){let W=U[2],j=U[3];W?j==="decl"?O[N]=[I]:C[N]=[I]:E[N]=[I]}else C[N]=[I]}for(let N of a){c&&N.checkDeprecations(_,c);let I=N.getModuleSource(i);T+=I;let U=N.injections[i];for(let W in U){let j=/^(v|f)s:#([\w-]+)$/.exec(W);if(j){let oe=j[2]==="decl"?O:C;oe[W]=oe[W]||[],oe[W].push(U[W])}else E[W]=E[W]||[],E[W].push(U[W])}}return T+="// ----- MAIN SHADER SOURCE -------------------------",T+=fo,T=jt(T,i,O),T+=wn(m[i],E),T+=_,T=jt(T,i,C),o==="glsl"&&d!==g&&(T=eo(T,g,i)),T.trim()}function so(e){return function(r){let n={};for(let i of e){let o=i.getUniforms(r,n);Object.assign(n,o)}return n}}function Pl(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 Pf(){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 co(e){if(!e.vs)throw new Error("no vertex shader");let t=uo(e.platformInfo,e.vs),r;return e.fs&&(r=uo(e.platformInfo,e.fs)),{...e,vs:t,fs:r}}function uo(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 le=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return le.defaultShaderAssembler=le.defaultShaderAssembler||new le,le.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=co(t);return{...fo({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,a=this._defaultModules.length;o<a;++o){let s=this._defaultModules[o],l=s.name;r[i++]=s,n[l]=!0}for(let o=0,a=t.length;o<a;++o){let s=t[o],l=s.name;n[l]||(r[i++]=s,n[l]=!0)}return r.length=i,se.instantiateModules(r)}};le.defaultShaderAssembler=void 0;var Nf=X`void main() {gl_FragColor = vec4(0);}`,go=X`\
131
+ `:""}function Nl(){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 co(e){if(!e.vs)throw new Error("no vertex shader");let t=uo(e.platformInfo,e.vs),r;return e.fs&&(r=uo(e.platformInfo,e.fs)),{...e,vs:t,fs:r}}function uo(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 fe=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return fe.defaultShaderAssembler=fe.defaultShaderAssembler||new fe,fe.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=co(t);return{...lo({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,a=this._defaultModules.length;o<a;++o){let s=this._defaultModules[o],f=s.name;r[i++]=s,n[f]=!0}for(let o=0,a=t.length;o<a;++o){let s=t[o],f=s.name;n[f]||(r[i++]=s,n[f]=!0)}return r.length=i,se.instantiateModules(r)}};fe.defaultShaderAssembler=void 0;var Il=L`void main() {gl_FragColor = vec4(0);}`,go=L`\
133
133
  out vec4 transform_output;
134
134
  void main() {
135
135
  transform_output = vec4(0);
136
- }`,Mf=`#version 300 es
137
- ${go}`;function Un(e){let{version:t=100,input:r,inputChannels:n,output:i}=e||{};if(!r)return t===300?Mf:t>300?`#version ${t}
138
- ${go}`:Nf;if(!n)throw new Error("inputChannels");let o=If(n),a=ho(r,n);return t>=300?`#version ${t} ${t===300?"es":""}
136
+ }`,Ml=`#version 300 es
137
+ ${go}`;function Un(e){let{version:t=100,input:r,inputChannels:n,output:i}=e||{};if(!r)return t===300?Ml:t>300?`#version ${t}
138
+ ${go}`:Il;if(!n)throw new Error("inputChannels");let o=Dl(n),a=ho(r,n);return t>=300?`#version ${t} ${t===300?"es":""}
139
139
  in ${o} ${r};
140
140
  out vec4 ${i};
141
141
  void main() {
@@ -143,7 +143,7 @@ void main() {
143
143
  }`:`varying ${o} ${r};
144
144
  void main() {
145
145
  gl_FragColor = ${a};
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`\
146
+ }`}function Dl(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=L`\
147
147
  uniform float ONE;
148
148
 
149
149
  /*
@@ -309,9 +309,9 @@ vec2 sqrt_fp64(vec2 a) {
309
309
  return sum_fp64(vec2(yn, 0.0), prod);
310
310
  #endif
311
311
  }
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
312
+ `;var Fl={ONE:1};function wl(){return Fl}var ot={name:"fp64-arithmetic",vs:Ao,getUniforms:wl,fp64ify:Wn,fp64LowPart:_o,fp64ifyMatrix4:po};var Hn=P(M(),1);var br=class{constructor(t){this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;let r=kt(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],f=((r=a.getUniforms)===null||r===void 0?void 0:r.call(a,o,this.moduleUniforms[i]))||o;this.moduleUniforms[i]={...s,...f}}}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(M(),1),Sr=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 Sr)return t;let r=Bl(e,t),{attributes:n,bufferLayout:i}=Ul(e,t);return new Sr({topology:t.topology||"triangle-list",bufferLayout:i,vertexCount:t.vertexCount,indices:r,attributes:n})}function Bl(e,t){if(!t.indices)return;let r=t.indices.value;return e.createBuffer({usage:Se.Buffer.INDEX,data:r})}function Ul(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:f,size:l,normalized:u}=a;r.push({name:s,format:(0,Se.getVertexFormatFromAttribute)(f,l,u)})}let i=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:i}}var vo=P(M(),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 at=2,Wl=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,V.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 br(a));let s=Hl(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:l,fs:u,getUniforms:c}=this.props.shaderAssembler.assembleShaders({platformInfo:s,...this.props,modules:f});if(this.vs=l,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&&(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()}}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,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 Ie.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){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(f=>So(f).includes(n));if(!o){V.log.warn(`Model(${this.id}): Missing layout for buffer "${n}".`)();continue}let a=So(o),s=!1;for(let f of a){let l=this._attributeInfos[f];l&&(this.vertexArray.setBuffer(l.location,i),s=!0)}!s&&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(){return this._pipelineNeedsUpdate&&(this.pipeline&&V.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,Ro.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline}_logDrawCallStart(){let t=V.log.level>3?0:Wl;Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,V.log.group(at,`>>> DRAWING MODEL ${this.id}`,{collapsed:V.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let t=mo(this.pipeline.shaderLayout);V.log.table(at,t)();let r=this.shaderInputs.getDebugTable();for(let[i,o]of Object.entries(this.uniforms))r[i]={value:o};V.log.table(at,r)();let n=this._getAttributeDebugTable();V.log.table(at,this._attributeInfos)(),V.log.table(at,n)(),V.log.groupEnd(at)(),this._logOpen=!1}}_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,Ie.getTypedArrayFromDataType)(r);return(t instanceof Ie.Buffer?new n(t.debugData):t).toString()}};Y.defaultProps={...Ie.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:fe.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 Hl(e){return{type:e.info.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,features:e.features}}function So(e){var t;return e.attributes?(t=e.attributes)===null||t===void 0?void 0:t.map(r=>r.attribute):[e.name]}var Vl="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:Vl}),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 st=P(M(),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,st.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,st.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,st.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,st.assert)(Number.isFinite(n)),n}};var yo=P(M(),1);var Kt=class extends Re{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=(0,yo.uid)("cube-geometry"),indices:n=!0}=t;super(n?{...t,id:r,topology:"triangle-list",indices:{size:1,value:Xl},attributes:{...Yl,...t.attributes}}:{...t,id:r,topology:"triangle-list",indices:void 0,attributes:{...Zl,...t.attributes}})}},Xl=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]),Ll=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]),zl=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]),jl=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]),kl=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]),$l=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]),Kl=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]),Yl={POSITION:{size:3,value:Ll},NORMAL:{size:3,value:zl},TEXCOORD_0:{size:2,value:jl}},Zl={POSITION:{size:4,value:kl},TEXCOORD_0:{size:2,value:$l},COLOR_0:{size:3,value:Kl}};var ql="Failed to create WebGL context in Node.js, headless gl returned null",Ql=" 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.",Jl={width:1,height:1,debug:!0,throwOnError:!1},Vn=null;function Eo(){return Vn!==null}function xo(e){e={...Jl,...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(Ql);let o=Vn(t,r,e);if(!o)throw new Error(ql);return o}var H=P(M(),1);function Yt(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 le(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Yt()}var Xp=globalThis.self||globalThis.window||globalThis.global,Lp=globalThis.window||globalThis.self||globalThis.global,zp=globalThis.document||{},jp=globalThis.process||{},kp=globalThis.console,Oo=globalThis.navigator||{};var Xn=globalThis;function Rr(e){if(!e&&!le())return"Node";if(Yt(e))return"Electron";let t=e||Oo.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 Bo=P(M(),1);var Zt={};function Gl(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function eu(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function tu(e,t){Zt[e]=!0,t!==void 0&&Gl(t)}function ru(e){let t=e.getError;e.getError=function(){let n;do n=t.apply(e),n!==0&&(Zt[n]=!0);while(n!==0);for(n in Zt)if(Zt[n])return delete Zt[n],parseInt(n,10);return 0}}var qt=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};qt.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()};qt.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var ke=function(t){let r=this;this.gl=t,ru(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 f=r.currentVertexArrayObject.attribs[o];switch(a){case 34975:return f.buffer;case 34338:return f.enabled;case 34339:return f.size;case 34340:return f.stride;case 34341:return f.type;case 34922:return f.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(o,a,s,f,l,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=f,d.stride=l,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",()=>{eu("OESVertexArrayObject emulation library context restored"),r.reset_()},!0),this.reset_()};ke.prototype.VERTEX_ARRAY_BINDING_OES=34229;ke.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 qt(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};ke.prototype.createVertexArrayOES=function(){let t=new qt(this);return this.vertexArrayObjects.push(t),t};ke.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};ke.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof qt&&t.hasBeenBound&&t.ext===this)};ke.prototype.bindVertexArrayOES=function(t){let r=this.gl;if(t&&!t.isAlive){tu(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 f=0;f<=s;f++){let l=o.attribs[f],u=i?i.attribs[f]:null;if((!i||l.enabled!==u.enabled)&&(l.enabled?n.enableVertexAttribArray.call(r,f):n.disableVertexAttribArray.call(r,f)),l.enabled){let c=!1;(!i||l.buffer!==u.buffer)&&(a!==l.buffer&&(n.bindBuffer.call(r,34962,l.buffer),a=l.buffer),c=!0),(c||l.cached!==u.cached)&&n.vertexAttribPointer.call(r,f,l.size,l.type,l.normalized,l.stride,l.offset)}}this.currentArrayBuffer!==a&&n.bindBuffer.call(r,34962,this.currentArrayBuffer)};function Co(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 ke(this)),this.__OESVertexArrayObject))}}var $e=P(M(),1);var Po=P(M(),1),nu="Invalid WebGLRenderingContext";function iu(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 No(e){return(0,Po.assert)(iu(e),nu),e}var Io="OES_element_index",Mo="WEBGL_draw_buffers",ou="EXT_disjoint_timer_query",au="EXT_disjoint_timer_query_webgl2",su="EXT_texture_filter_anisotropic",Do="WEBGL_debug_renderer_info",fu=35723,lu=4352,uu=36795,cu=34047,du=37445,gu=37446,B=e=>D(e)?void 0:0,hu={[3074]:e=>D(e)?void 0:36064,[fu]:e=>D(e)?void 0:lu,[35977]:B,[32937]:B,[uu]:(e,t)=>{let r=D(e)?e.getExtension(au):e.getExtension(ou);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[du]:(e,t)=>{let r=e.getExtension(Do);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[gu]:(e,t)=>{let r=e.getExtension(Do);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[cu]:(e,t)=>{var r;let n=((r=e.luma)===null||r===void 0||(r=r.extensions)===null||r===void 0?void 0:r[su])||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(Io)?2147483647:65535,[33001]:e=>e.getExtension(Io)?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 Fo(e,t,r){let n=hu[r],i=typeof n=="function"?n(e,t,r):n;return i!==void 0?i:t(r)}function ft(e){if(!e.luma){let r={_polyfilled:!1,_extensions:{}};e.luma=r}return e.luma}var _u="OES_vertex_array_object",wo="ANGLE_instanced_arrays",pu="WEBGL_draw_buffers",Au="EXT_disjoint_timer_query",Tu="EXT_texture_filter_anisotropic",vu="VertexArray requires WebGL2 or OES_vertex_array_object extension";function mu(e,t){return{webgl2:D(e),ext:e.getExtension(t)}}var zn={[_u]:{meta:{suffix:"OES"},createVertexArray:()=>{(0,$e.assert)(!1,vu)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[wo]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(e,t){(0,$e.assert)(t===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[pu]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{(0,$e.assert)(!1)}},[Au]:{meta:{suffix:"EXT"},createQuery:()=>{(0,$e.assert)(!1)},deleteQuery:()=>{(0,$e.assert)(!1)},beginQuery:()=>{(0,$e.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}=mu(e,wo),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=ft(e),{_extensions:o}=i,a=o[Tu];n=a&&a.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,n)},getParameter:Fo,hint(e,t,r,n){return t(r,n)}};function Uo(e){let t=ft(e);return t._polyfilled||(Co(e),bu(e),Su(e,zn),yu(e,{target:t,target2:e}),t._polyfilled=!0),e}function bu(e){let t=ft(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 Su(e,t){let r=ft(e);for(let n of Object.getOwnPropertyNames(t))n!=="overrides"&&Ru(e,{extension:n,target:r,target2:e})}function Ru(e,t){let{extension:r,target:n,target2:i}=t,o=zn[r];(0,Bo.assert)(o);let{meta:a={}}=o,{suffix:s=""}=a,f=e.getExtension(r);for(let l of Object.keys(o)){let u=`${l}${s}`,c=null;l==="meta"||typeof e[l]=="function"||(f&&typeof f[u]=="function"?c=function(){return f[u](...arguments)}:typeof o[l]=="function"&&(c=o[l].bind(n))),c&&(n[l]=c,i[l]=c)}}function yu(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 Jt=P(M(),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},_e=(e,t,r)=>t?e.enable(r):e.disable(r),Wo=(e,t,r)=>e.hint(r,t),ne=(e,t,r)=>e.pixelStorei(r,t),Ho=(e,t,r)=>{let n;return r===36006?n=D(e)?36009:36160:n=36008,e.bindFramebuffer(n,t)},Qt=(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 Vo={[3042]:_e,[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]:_e,[2885]:(e,t)=>e.cullFace(t),[2929]:_e,[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]:_e,[35723]:Wo,[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]:Ho,[36010]:Ho,[34964]:Qt,[36662]:Qt,[36663]:Qt,[35053]:Qt,[35055]:Qt,[2886]:(e,t)=>e.frontFace(t),[33170]:Wo,[2849]:(e,t)=>e.lineWidth(t),[32823]:_e,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:_e,[32926]:_e,[32928]:_e,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:_e,[3088]:(e,t)=>e.scissor(...t),[2960]:_e,[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 X(e,t,r){return t[e]!==void 0?t[e]:r[e]}var Xo={blendEquation:(e,t,r)=>e.blendEquationSeparate(X(32777,t,r),X(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(X(32969,t,r),X(32968,t,r),X(32971,t,r),X(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(X(32824,t,r),X(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(X(32938,t,r),X(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,X(2962,t,r),X(2967,t,r),X(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,X(34816,t,r),X(36003,t,r),X(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,X(2964,t,r),X(2965,t,r),X(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,X(34817,t,r),X(34818,t,r),X(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]})},pe=(e,t)=>e.isEnabled(t),$n={[3042]:pe,[2884]:pe,[2929]:pe,[3024]:pe,[32823]:pe,[32926]:pe,[32928]:pe,[3089]:pe,[2960]:pe,[35977]:pe},Lo=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(Eu(t))return;let i={};for(let a in t){let s=Number(a),f=Vo[a];f&&(typeof f=="string"?i[f]=!0:f(n,t[a],s))}let o=n.state&&n.state.cache;if(o)for(let a in i){let s=Xo[a];s(n,t,o)}}function zo(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 Eu(e){for(let t in e)return!1;return!0}function jo(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?zo(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,Jt.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,Jt.assert)(o!==void 0);let a=t[o],s=this.cache[o];jo(a,s)||(r=!0,n=s,i&&!(o in i)&&(i[o]=s),this.cache[o]=a)}return{valueChanged:r,oldValue:n}}};function Ke(e){return e.state}function Yn(e,t){let{enable:r=!0,copyState:n}=t;if((0,Jt.assert)(n!==void 0),!e.state){e.state=new Kn(e,{copyState:n}),Ou(e);for(let o in kn){let a=kn[o];xu(e,o,a)}ko(e,"getParameter"),ko(e,"isEnabled")}let i=Ke(e);return i.enable=r,e}function De(e){let t=Ke(e);t||(Yn(e,{copyState:!1}),t=Ke(e)),t.push()}function Ee(e){let t=Ke(e);(0,Jt.assert)(t),t.pop()}function ko(e,t){let r=e[t].bind(e);e[t]=function(i){if(i===void 0||Lo.has(i))return r(i);let o=Ke(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 xu(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(){let o=Ke(e);for(var a=arguments.length,s=new Array(a),f=0;f<a;f++)s[f]=arguments[f];let{valueChanged:l,oldValue:u}=r(o._updateCache,...s);return l&&n(...s),u},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function Ou(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let i=Ke(e);i.program!==n&&(t(n),i.program=n)}}var Cu={webgl2:!0,webgl1:!0,powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function $o(e,t){t={...Cu,...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 Ko(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,f=e.getParameter(7938),l=Yo(a,s),u=Pu(a,s),c=Nu(a,s),d="glsl",g=D(e)?300:100;return{type:D(e)?"webgl2":"webgl",gpu:l,gpuType:c,gpuBackend:u,vendor:a,renderer:s,version:f,shadingLanguage:d,shadingLanguageVersion:g}}function Yo(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 Pu(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function Nu(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(Yo(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Zo(){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(M(),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",Ae="texture-compression-etc2",Iu="texture-compression-etc1-webgl",Or="texture-compression-pvrtc-webgl",Zn="texture-compression-atc-webgl",Gt="WEBGL_compressed_texture_s3tc",er="WEBGL_compressed_texture_s3tc_srgb",lt="EXT_texture_compression_rgtc",tr="EXT_texture_compression_bptc",Mu="WEBGL_compressed_texture_etc",Du="WEBGL_compressed_texture_astc",Fu="WEBGL_compressed_texture_etc1",wu="WEBGL_compressed_texture_pvrtc",Bu="WEBGL_compressed_texture_atc",qo="EXT_sRGB",xe="EXT_texture_norm16",Uu="WEBGL_color_buffer_float",Wu="EXT_color_buffer_float",ue=(e,t)=>e.getExtension(t),Ye=(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,qo),"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=>Ye(e,[Gt,er,lt,tr]),"texture-compression-bc5-webgl":e=>Ye(e,[lt]),"texture-compression-etc2":e=>Ye(e,[Mu]),"texture-compression-astc":e=>Ye(e,[Du]),"texture-compression-etc1-webgl":e=>Ye(e,[Fu]),"texture-compression-pvrtc-webgl":e=>Ye(e,[wu]),"texture-compression-atc-webgl":e=>Ye(e,[Bu])};function Hu(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=>Hu(e,r))}var rr={"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:qo,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:Wu,gl1ext:Uu,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:Gt,f:q},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:er,f:q},"bc1-rgba-unorm":{gl:33777,x:Gt,f:q},"bc1-rgba-unorm-srgb":{gl:35916,x:er,f:q},"bc2-rgba-unorm":{gl:33778,x:Gt,f:q},"bc2-rgba-unorm-srgb":{gl:35918,x:er,f:q},"bc3-rgba-unorm":{gl:33779,x:Gt,f:q},"bc3-rgba-unorm-srgb":{gl:35919,x:er,f:q},"bc4-r-unorm":{gl:36283,x:lt,f:q},"bc4-r-snorm":{gl:36284,x:lt,f:q},"bc5-rg-unorm":{gl:36285,x:lt,f:q},"bc5-rg-snorm":{gl:36286,x:lt,f:q},"bc6h-rgb-ufloat":{gl:36495,x:tr,f:q},"bc6h-rgb-float":{gl:36494,x:tr,f:q},"bc7-rgba-unorm":{gl:36492,x:tr,f:q},"bc7-rgba-unorm-srgb":{gl:36493,x:tr,f:q},"etc2-rgb8unorm":{gl:37492,f:Ae},"etc2-rgb8unorm-srgb":{gl:37494,f:Ae},"etc2-rgb8a1unorm":{gl:37496,f:Ae},"etc2-rgb8a1unorm-srgb":{gl:37497,f:Ae},"etc2-rgba8unorm":{gl:37493,f:Ae},"etc2-rgba8unorm-srgb":{gl:37495,f:Ae},"eac-r11unorm":{gl:37488,f:Ae},"eac-r11snorm":{gl:37489,f:Ae},"eac-rg11unorm":{gl:37490,f:Ae},"eac-rg11snorm":{gl:37491,f:Ae},"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:Iu},"atc-rgb-unorm-webgl":{gl:35986,f:Zn},"atc-rgba-unorm-webgl":{gl:35986,f:Zn},"atc-rgbai-unorm-webgl":{gl:34798,f:Zn}},Vu={[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},Xu={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function nr(e,t){let r=ir(t),n=rr[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 Jo(e,t){var r;return nr(e,t)&&((r=rr[t])===null||r===void 0?void 0:r.renderbuffer)}function ir(e){if(typeof e=="string")return e;let t=Object.entries(rr).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 or(e,t){let r=rr[e],n=t?r?.gl:r?.gl1;if(n===void 0)throw new Error(`Unsupported texture format ${e}`);return n}function Go(e,t){let r=ir(t);if(!nr(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 ea(e,t){let r=ir(t);return!(!nr(e,r)||typeof r=="number")}function ut(e,t){let r=ir(e),n=or(r,t),i=(0,Qn.decodeTextureFormat)(r);return{format:n,dataFormat:Lu(i.format,i.integer,i.normalized,n),type:i.dataType?xr(i.dataType):5121,compressed:i.compressed}}function ta(e){let t=rr[e];if(!(t!=null&&t.attachment))throw new Error(`${e} is not a depth stencil format`);return t.attachment}function ra(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,f=1,l=0,u=new Uint8Array([0,0,255,255]);e.texImage2D(3553,a,t,s,f,l,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 ar(e,t){let r=ir(e),n=ut(r,t),i=Vu[n.dataFormat]||4,o=Xu[n.type]||1;return i*o}function Lu(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 na(e){let t=zu(e);for(let r of Qo(e))t.add(r);return t}function zu(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(ia))ju(e,r)&&t.add(r);return t}function ju(e,t){let r=ia[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)):ra(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(!Zo(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 ia={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 oa(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 aa(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 _a=P(M(),1);var wr=P(M(),1);var z=P(M(),1);function Q(e,t,r){let i=k.attach(e).gl;if(ku(t))return r(e);let{nocatch:o=!0}=t;De(i),ye(i,t);let a;if(o)a=r(i),Ee(i);else try{a=r(i)}finally{Ee(i)}return a}function ku(e){for(let t in e)return!1;return!0}var Nr=P(M(),1);function fa(e,t,r,n){if((0,Nr.isObjectEmpty)(t))return n(e);De(e.gl);try{return $u(e,t),ye(e,r),n(e)}finally{Ee(e.gl)}}function $u(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(sr("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.depthBias!==void 0&&n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0),t.depthWriteEnabled!==void 0&&n.depthMask(Yu("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=sa("blendColorOperation",t.blendColorOperation||"add"),o=sa("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let a=Cr("blendColorSrcFactor",t.blendColorSrcFactor||"one"),s=Cr("blendColorDstFactor",t.blendColorDstFactor||"zero"),f=Cr("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),l=Cr("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(a,s,f,l)}}function Pr(e,t){return sr(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 sr(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function sa(e,t){return sr(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function Cr(e,t){return sr(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 Ku(e,t){return`Illegal parameter ${t} for ${e}`}function sr(e,t,r){if(!(t in r))throw new Error(Ku(e,t));return r[t]}function Yu(e,t){return t}function Ir(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]=ua(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=Zu(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 ua(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function Zu(e,t){if(!t)return ua(e);switch(e){case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}var Te=P(M(),1),te=class extends Te.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=qu(this.props.usage),this.glUsage=Qu(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,Te.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 qu(e){return e&Te.Buffer.INDEX?34963:e&Te.Buffer.VERTEX?34962:e&Te.Buffer.UNIFORM?35345:34962}function Qu(e){return e&Te.Buffer.INDEX||e&Te.Buffer.VERTEX?35044:e&Te.Buffer.UNIFORM?35048:35044}var ca=P(M(),1);var Ze=class extends ca.Sampler{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.parameters=void 0,this.device=t,this.parameters=Ir(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 z.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,z.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:f,height:l,dataFormat:u,type:c,compressed:d=!1,mipmaps:g=!0}=t,{depth:h=0}=t,A=or(t.format,this.device.isWebGL2);return{width:f,height:l,compressed:d,dataFormat:u,type:c}=this._deduceParameters({format:t.format,type:c,dataFormat:u,compressed:d,data:r,width:f,height:l}),this.width=f,this.height=l,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&&Mr(this.width,this.height)&&(z.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaps`)(),g=!1),this.mipmaps=g,this.setImageData({data:r,width:f,height:l,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 Ze?(this.sampler=t,r=t.props):(this.sampler=new Ze(this.device,t),r=t);let n=Ir(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&&Mr(this.width,this.height)?(z.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:f=null,type:l=this.type,width:u=this.width,height:c=this.height,dataFormat:d=this.dataFormat,compressed:g=!1}=t;f||(f=n),{type:l,dataFormat:d,compressed:g,width:u,height:c}=this._deduceParameters({format:this.props.format,type:l,dataFormat:d,compressed:g,data:f,width:u,height:c});let{gl:h}=this;h.bindTexture(this.target,this.handle);let A=null;({data:f,dataType:A}=this._getDataType({data:f,compressed:g}));let _;if(Q(this.gl,s,()=>{switch(A){case"null":h.texImage2D(r,i,o,u,c,0,d,l,f);break;case"typed-array":h.texImage2D(r,i,o,u,c,0,d,l,f,a);break;case"buffer":_=this.device.assertWebGL2(),_.bindBuffer(35052,f.handle||f),_.texImage2D(r,i,o,u,c,0,d,l,a),_.bindBuffer(35052,null);break;case"browser-object":this.device.isWebGL2?h.texImage2D(r,i,o,u,c,0,d,l,f):h.texImage2D(r,i,o,d,l,f);break;case"compressed":for(let[v,T]of f.entries())h.compressedTexImage2D(r,v,T.format,T.width,T.height,0,T.data);break;default:(0,z.assert)(!1,"Unknown image data type")}}),f&&f.byteLength)this.trackAllocatedMemory(f.byteLength,"Texture");else{let v=ar(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:f=this.height,level:l=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:f}=this._deduceParameters({format:this.props.format,type:c,dataFormat:d,compressed:g,data:i,width:s,height:f}),(0,z.assert)(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=n),i&&i.data){let _=i;i=_.data,s=_.shape[0],f=_.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,l,o,a,s,f,u,i);else if(i===null)this.gl.texSubImage2D(r,l,o,a,s,f,d,c,null);else if(ArrayBuffer.isView(i))this.gl.texSubImage2D(r,l,o,a,s,f,d,c,i,h);else if(typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer){let _=this.device.assertWebGL2();_.bindBuffer(35052,i),_.texSubImage2D(r,l,o,a,s,f,d,c,h),_.bindBuffer(35052,null)}else this.device.isWebGL2?this.device.assertWebGL2().texSubImage2D(r,l,o,a,s,f,d,c,i):this.gl.texSubImage2D(r,l,o,a,d,c,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return z.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:f}=t,l=ut(r,this.device.isWebGL2);return a=a||l.dataFormat,s=s||l.type,f=f||l.compressed,{width:i,height:o}=this._deduceImageSize(n,i,o),{dataFormat:a,type:s,compressed:f,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,z.assert)(i,"Could not deduced texture size"),(0,z.assert)(r===void 0||i.width===r,"Deduced texture width does not match supplied width"),(0,z.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:f=5121}=t,l=o||a,u=await Promise.all(K.FACES.map(c=>{let d=l[c];return Promise.all(Array.isArray(d)?d:[d])}));this.bind(),K.FACES.forEach((c,d)=>{u[d].length>1&&this.props.mipmaps!==!1&&z.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,f,g):r.texImage2D(c,h,s,s,f,g)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:n,height:i,pixels:o,data:a,format:s=6408,type:f=5121}=t,{gl:l}=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?l.texImage2D(r,0,s,n,i,0,s,f,u):l.texImage2D(r,0,s,s,f,u),this}setImageData3D(t){let{level:r=0,dataFormat:n,format:i,type:o,width:a,height:s,depth:f=1,offset:l=0,data:u,parameters:c={}}=t;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let d=ut(i,this.device.isWebGL2);if(Q(this.gl,c,()=>{ArrayBuffer.isView(u)&&this.gl.texImage3D(this.target,r,d.format,a,s,f,0,d.dataFormat,d.type,u),u instanceof te&&(this.gl.bindBuffer(35052,u.handle),this.gl.texImage3D(this.target,r,n,a,s,f,0,i,o,l))}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let g=ar(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&&Mr(this.width,this.height)&&(t=la(t)),!(0,z.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&&Mr(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 Mr(e,t){return!e||!t?!1:!(0,z.isPowerOfTwo)(e)||!(0,z.isPowerOfTwo)(t)}function ec(e){z.log.log(1,"texture sampler parameters",e)()}var ha=P(M(),1);var Oe=P(M(),1);var da=P(M(),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,da.assert)(n!==void 0,`Accessing undefined constant GL.${t}`),n}var ct="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;No(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,f="webgl2"in i?i.webgl2:i.webgl1;return o?f: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 f of s){let l=i[f];if(l&&(!("webgl2"in l)||o)&&(!("extension"in l)||this.gl.getExtension(l.extension))){let c=n?this.device.getGLKey(f):f;a[c]=this.getParameter(f,t),n&&l.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(ct)}_deleteHandle(){throw new Error(ct)}_bindHandle(t){throw new Error(ct)}_getOptsFromHandle(){throw new Error(ct)}_getParameter(t,r){throw new Error(ct)}_setParameter(t,r){throw new Error(ct)}};var ga;ga=Symbol.toStringTag;var Fe=class extends Fr{get[ga](){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 Jo(t.gl,r)}constructor(t,r){if(typeof r.format=="number")throw new Error("Renderbuffer");super(t,r,Fe.defaultProps),this.glFormat=void 0,this.glFormat=or(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,ha.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)*ar(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)}};Fe.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(ta(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 Fe(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 Fe)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 _a.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(M(),1),nc={spector:me.log.get("spector")||me.log.get("inspect")},ic="https://spectorcdn.babylonjs.com/spector.bundle.js",oc=1,re=null,pa=!1;async function Aa(e){if(!globalThis.SPECTOR)try{await(0,me.loadScript)(ic)}catch(t){me.log.warn(String(t))}}function Ta(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(!pa){var n,i;pa=!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 f,l,u;me.log.info("Spector capture complete:",s)(),(f=re)===null||f===void 0||f.getResultUI(),(l=re)===null||l===void 0||l.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 f;me.log.info("Spector capture stopped after 2 seconds")(),(f=re)===null||f===void 0||f.stopCapture()})}return re}var we=P(M(),1);var ac="https://unpkg.com/webgl-debug@2.0.1/index.js";function va(e){return e.luma=e.luma||{},e.luma}async function ma(){le()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await(0,we.loadScript)(ac))}function ba(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?fc(e,t):sc(e):null}function sc(e){let t=va(e);return t.realContext?t.realContext:e}function fc(e,t){if(!globalThis.WebGLDebugUtils)return we.log.warn("webgl-debug not loaded")(),e;let r=va(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...je,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,lc.bind(null,t),uc.bind(null,t));for(let a in je)!(a in n)&&typeof je[a]=="number"&&(n[a]=je[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 lc(e,t,r,n){n=Array.from(n).map(f=>f===void 0?"undefined":f);let i=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),a=e.webgl2?"gl2":"gl1",s=`${i} in ${a}.${r}(${o})`;we.log.error(s)();debugger;if(e.throwOnError)throw new Error(s)}function uc(e,t,r){let n="";if(we.log.level>=1&&(n=ri(t,r),we.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}`);we.log.error(`Undefined argument: ${n}`)();debugger}}var ya=P(M(),1);function Ra(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:Sa(c),lineNum:0,linePos:0});continue}let[o,a,s,...f]=i,l=parseInt(s,10);isNaN(l)&&(l=0);let u=parseInt(a,10);isNaN(u)&&(u=0),r.push({message:f.join(":").trim(),type:Sa(o),lineNum:l,linePos:u})}return r}function Sa(e){let t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}var Ur=class extends ya.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 Ra(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 Ea=P(M(),1);var cc=256,dc=1024,gc=16384,ni=6144,Wr=class extends Ea.RenderPass{constructor(t,r){super(t,r),this.device=void 0,this.glParameters=void 0,this.device=t,De(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(M(),1),Fa=P(M(),1);var Hr=P(M(),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"}},Be=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 Be(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 Be.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Be.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 xa(e){return pc.includes(e)}var pc=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],Oa={[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=Oa[e];if(!t)throw new Error("uniform");let[r,n,,i]=t;return{format:i,components:n,glType:r}}function Ca(e){let t=Oa[e];if(!t)throw new Error("attribute");let[,r,,n,i]=t;return{attributeType:n,vertexFormat:i,components:r}}function Pa(e,t){let r={attributes:[],bindings:[]};r.attributes=Ac(e,t);let n=mc(e,t);for(let s of n){let f=s.uniforms.map(l=>({name:l.name,format:l.format,byteOffset:l.byteOffset,byteStride:l.byteStride,arrayLength:l.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:f})}let i=vc(e,t),o=0;for(let s of i)if(xa(s.type)){let{viewDimension:f,sampleType:l}=Sc(s.type);r.bindings.push({type:"texture",name:s.name,location:o,viewDimension:f,sampleType:l}),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,f=e.getAttribLocation(t,a);if(f>=0){let{attributeType:l}=Ca(s),u=/instance/i.test(a)?"instance":"vertex";r.push({name:a,location:f,stepMode:u,type:l})}}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:f,size:l}=a,{glType:u,components:c}=oi(f),d=new Be({type:u,size:l*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:f}=o,{name:l,isArray:u}=Rc(a),c=e.getUniformLocation(t,l),d={location:c,name:l,size:s,type:f,isArray:u};if(r.push(d),d.size>1)for(let g=0;g<d.size;g++){let h=`${l}[${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:[]},f=n(a,35395)||[],l=r.getActiveUniforms(t,f,35383),u=r.getActiveUniforms(t,f,35384),c=r.getActiveUniforms(t,f,35387),d=r.getActiveUniforms(t,f,35388);for(let g=0;g<s.uniformCount;++g){let h=r.getActiveUniform(t,f[g]);if(!h)throw new Error("activeInfo");s.uniforms.push({name:h.name,format:oi(l[g]).format,type:l[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 Na(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 Ia(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 Da=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=Pa(this.device.gl,this.handle),this.shaderLayout=(0,Fa.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:f}=t,l=Ia(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),f&&f.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let g=n;return fa(this.device,this.props.parameters,g.glParameters,()=>{if(u&&d){var h;(h=this.device.gl2)===null||h===void 0||h.drawElementsInstanced(l,o||0,c,s,a||0)}else if(u)this.device.gl.drawElements(l,o||0,c,s);else if(d){var A;(A=this.device.gl2)===null||A===void 0||A.drawArraysInstanced(l,s,o||0,a||0)}else this.device.gl.drawArrays(l,s,o||0);f&&f.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(Da,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),J.log.timeEnd(Da,`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 f;if(o instanceof K)f=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")(),f=o.colorAttachments[0];else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(f.target,f.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&&Na(this.device.gl,i,o,s)}}};var Ba=P(M(),1);var Lr=P(M(),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:f=[0,0],destination:l,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}=wa(r);try{let _=l,v=o||h.width,T=a||h.height,m=ut(h.texture.format,!0),E=m.dataFormat,O=m.type;g.bindBuffer(35051,_.handle),g.bindFramebuffer(36160,h.handle),g.readPixels(f[0],f[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,f=6408,{framebuffer:l,destroyFramebuffer:u}=wa(r),[c,d]=n,g=!1;e.gl.bindFramebuffer(36160,l.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,f,c,d,o,a,0),h&&h.unbind(),u&&l.destroy(),h}function wa(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 Ba.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 gt=P(M(),1);var Ua;Ua=Symbol.toStringTag;var dt=class extends gt.VertexArray{get[Ua](){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:f,integer:l,divisor:u}=this._getAccessor(t);this.device.gl2.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),l?(this.device.assertWebGL2(),this.device.gl2.vertexAttribIPointer(t,i,o,a,s)):this.device.gl.vertexAttribPointer(t,i,o,f,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=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=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,gt.getScratchArray)(r.constructor,o);(0,gt.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(M(),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(Wa(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(Wa(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 Wa(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var fr=1,k=class extends H.Device{static isSupported(){return typeof WebGLRenderingContext<"u"||Eo()}get features(){return this._features=this._features||na(this.gl),this._features}get limits(){return this._limits=this._limits||oa(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(fr,"WebGLDevice created")(),typeof t.canvas=="string"&&await H.CanvasContext.pageLoaded,(H.log.get("debug")||t.debug)&&await ma();let{spector:r}=t;if((H.log.get("spector")||r)&&await Aa(),H.log.probe(fr+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(fr,i)(),H.log.table(fr,n.info)(),H.log.groupEnd(fr)(),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(f=>{this._resolveContextLost=f});let i=f=>{var l;return(l=this._resolveContextLost)===null||l===void 0?void 0:l.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||(le()?$o(this.canvasContext.canvas,{...t,onContextLost:i}):null),o=o||(le()?null:xo({...t,onContextLost:i})),!o)throw new Error("WebGL context creation failed");this.handle=o,this.gl=this.handle,this.gl2=this.gl,this.isWebGL2=Ic(this.gl),this.isWebGL1=!this.isWebGL2,this.info=Ko(this.gl),this.gl.device=this,this.gl._version=this.isWebGL2?2:1,Uo(this.gl);let{enable:a=!0,copyState:s=!1}=t;if(Yn(this.gl,{enable:a,copyState:s,log:function(){for(var f=arguments.length,l=new Array(f),u=0;u<f;u++)l[u]=arguments[u];return H.log.log(1,...l)()}}),le()&&t.debug&&(this.gl=ba(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.")()),le()&&t.spector){let f=this.handle.canvas||t.canvas;this.spector=Ta({...this.props,canvas:f})}}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 nr(this.gl,t)}isTextureFormatFilterable(t){return Go(this.gl,t)}isTextureFormatRenderable(t){return ea(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 Ze(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 dt(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||aa(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(){De(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:Mc(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 Ic(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Mc(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 Ha=P(M(),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 f=0;i&&(f|=Wc,i!==!0&&(s.clearColor=i)),o&&(f|=Bc,o!==!0&&(s.clearDepth=o)),a&&(f|=Uc,o!==!0&&(s.clearStencil=o)),(0,Ha.assert)(f!==0,Hc),Q(r.gl,s,()=>{r.gl.clear(f)})}var lr=P(M(),1);var ai=P(M(),1);function Va(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 Xa(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 ht(e,t){let{sourceX:r=0,sourceY:n=0,sourceFormat:i=6408,targetByteOffset:o=0}=t||{},{target:a,sourceWidth:s,sourceHeight:f,sourceType:l}=t||{},{framebuffer:u,deleteFramebuffer:c}=Vc(e);(0,lr.assert)(u),s=s||u.width,f=f||u.height;let d=u;if(l=l||5121,!a){let h=Va(i),A=Xa(l),_=o+s*f*h*A;a=d.device.createBuffer({byteLength:_})}let g=e.device.createCommandEncoder();return g.copyTextureToBuffer({source:e,width:s,height:f,origin:[r,n],destination:a,byteOffset:o}),g.destroy(),c&&u.destroy(),a}function Vc(e){return e instanceof lr.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 We=P($());var w={SUM:1,MEAN:2,MIN:3,MAX:4};function La(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(La,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(La,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 _t(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 za(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 pt;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 ja={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},Ue=3402823466e29,si=[32775,32774],fi=[32776,32774],ka=[32776,32775],li=(pt={},Kr(pt,w.SUM,32774),Kr(pt,w.MEAN,32774),Kr(pt,w.MIN,si),Kr(pt,w.MAX,fi),pt);var $a={size:1,operation:w.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},Ka=4;var Ya=`#version 300 es
315
315
  #define SHADER_NAME gpu-aggregation-to-grid-vs
316
316
 
317
317
  in vec3 positions;
@@ -360,7 +360,7 @@ void main(void) {
360
360
  gl_Position = vec4(pos, 0.0, 1.0);
361
361
  gl_PointSize = 1.0;
362
362
  }
363
- `;var Ya=`#version 300 es
363
+ `;var Za=`#version 300 es
364
364
  #define SHADER_NAME gpu-aggregation-to-grid-fs
365
365
 
366
366
  precision highp float;
@@ -373,7 +373,7 @@ void main(void) {
373
373
  fragColor = vec4(vWeights, 1.0);
374
374
  DECKGL_FILTER_COLOR(fragColor, geometry);
375
375
  }
376
- `;var Za=`#version 300 es
376
+ `;var qa=`#version 300 es
377
377
  #define SHADER_NAME gpu-aggregation-all-vs-64
378
378
 
379
379
  in vec2 position;
@@ -401,7 +401,7 @@ void main(void) {
401
401
  vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
402
402
  gl_PointSize = 1.0;
403
403
  }
404
- `;var qa=`#version 300 es
404
+ `;var Qa=`#version 300 es
405
405
  #define SHADER_NAME gpu-aggregation-all-fs
406
406
 
407
407
  precision highp float;
@@ -418,7 +418,7 @@ void main(void) {
418
418
  fragColor.rgb = textureColor.rgb;
419
419
  fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
420
420
  }
421
- `;var Qa=`#version 300 es
421
+ `;var Ja=`#version 300 es
422
422
  #define SHADER_NAME gpu-aggregation-transform-mean-vs
423
423
  in vec4 aggregationValues;
424
424
  out vec4 meanValues;
@@ -430,8 +430,8 @@ void main()
430
430
  meanValues.w = aggregationValues.w;
431
431
  gl_PointSize = 1.0;
432
432
  }
433
- `;var Zc={minFilter:"nearest",magFilter:"nearest"};function _t(e,t){var r=t.width,n=r===void 0?1:r,i=t.height,o=i===void 0?1:i,a=t.data,s=a===void 0?null:a,l=t.unpackFlipY,f=l===void 0?!0:l,u=t.parameters,c=u===void 0?Zc:u,d=e.createTexture({data:s,format:"rgba32float",mipmaps:!1,sampler:c,width:n,height:o});return d}function lr(e,t){var r=t.id,n=t.width,i=n===void 0?1:n,o=t.height,a=o===void 0?1:o,s=t.texture,l=e.createFramebuffer({id:r,width:i,height:a,colorAttachments:[s]});return l}function qc(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Qc(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.
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
433
+ `;var Zc={minFilter:"nearest",magFilter:"nearest"};function At(e,t){var r=t.width,n=r===void 0?1:r,i=t.height,o=i===void 0?1:i,a=t.data,s=a===void 0?null:a,f=t.parameters,l=f===void 0?Zc:f,u=e.createTexture({data:s,format:"rgba32float",mipmaps:!1,sampler:l,width:n,height:o});return u}function ur(e,t){var r=t.id,n=t.width,i=n===void 0?1:n,o=t.height,a=o===void 0?1:o,s=t.texture,f=e.createFramebuffer({id:r,width:i,height:a,colorAttachments:[s]});return f}function qc(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Qc(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
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 l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},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 Ga(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 Ga(e,t)}}function Ga(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 es(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?es(Object(r),!0).forEach(function(n){ui(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):es(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"],ts={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,f=n.pixelIndex,l=f*Ka,u={};return i&&(u.cellCount=i[l+3],u.cellWeight=i[l]),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,f=new Float32Array(s*a),l=new Uint32Array(s),u=0;u<s;u++){for(var c=0;c<a;c++)f[u*a+c]=i[u*4+c];l[u]=i[u*4+3]}return{cellCounts:l,cellWeights:f}},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,f=a.framebuffers,l=a.maxMinFramebuffers,u=a.minFramebuffers,c=a.maxFramebuffers,d=a.meanTextures,g=a.resources;n?.destroy(),i?.destroy(),o?.destroy(),rd([f,s,l,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||We.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 ts){var s=ts[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({},ja),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,f=o.maxMinFramebuffers,l=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=ht(s[g],{target:d[g].aggregationBuffer,sourceType:5126}),A&&_&&v?(i[g].maxMinBuffer=ht(f[g],{target:d[g].maxMinBuffer,sourceType:5126}),i[g].maxMinTexture=c["".concat(g,"-maxMinTexture")]):(A&&(i[g].minBuffer=ht(l[g],{target:d[g].minBuffer,sourceType:5126}),i[g].minTexture=c["".concat(g,"-minTexture")]),_&&(i[g].maxBuffer=ht(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,f=n.numCol,l=n.numRow,u=n.weights,c=n.translation,d=n.scaling,g=this.state,h=g.maxMinFramebuffers,A=g.minFramebuffers,_=g.maxFramebuffers,v=[f,l],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,I=C&&N&&u[E].combineMaxMin;this._renderToWeightsTexture({id:E,parameters:T,moduleSettings:s,uniforms:m,gridSize:v,attributes:a,weights:u}),I?this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:ka}),gridSize:v,minOrMaxFb:h[E],clearParams:{clearColor:[0,0,0,Ue]},combineMaxMin:I}):(C&&this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:si}),gridSize:v,minOrMaxFb:A[E],clearParams:{clearColor:[Ue,Ue,Ue,0]},combineMaxMin:I}),N&&this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:fi}),gridSize:v,minOrMaxFb:_[E],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:I}))}},t._renderToMaxMinTexture=function(n){var i=this,o=n.id,a=n.parameters,s=n.gridSize,f=n.minOrMaxFb,l=n.combineMaxMin,u=n.clearParams,c=u===void 0?{}:u,d=this.state.framebuffers,g=this.allAggregationModel;Q(this.device,G(G({},c),{},{framebuffer:f,viewport:[0,0,s[0],s[1]]}),function(){$r(i.device,{color:!0}),g.setUniforms({gridSize:s,combineMaxMin:l}),g.setBindings({uSampler:d[o].texture}),g.draw()})},t._renderToWeightsTexture=function(n){var i=this,o=n.id,a=n.parameters,s=n.moduleSettings,f=n.uniforms,l=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?[Ue,Ue,Ue,0]:[0,0,0,0];if(Q(this.device,{framebuffer:d[o],viewport:[0,0,l[0],l[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:f,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,f=i.minFramebuffers,l=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[_]||At(this.device,{id:"".concat(_,"-texture"),width:g,height:h}),o[_].resize(A);var C=o[_];O===w.MEAN&&(u[_]=u[_]||At(this.device,{id:"".concat(_,"-mean-texture"),width:g,height:h}),u[_].resize(A),C=u[_]),a[_]?a[_].attach(ui({},36064,C)):a[_]=ur(this.device,{id:"".concat(_,"-fb"),width:g,height:h,texture:C}),a[_].resize(A),c[_]=li[O]||li[w.SUM],(T||m)&&(T&&m&&E?s[_]||(C=d[_].maxMinTexture||this._getMinMaxTexture("".concat(_,"-maxMinTexture")),s[_]=ur(this.device,{id:"".concat(_,"-maxMinFb"),texture:C})):(T&&(f[_]||(C=d[_].minTexture||this._getMinMaxTexture("".concat(_,"-minTexture")),f[_]=ur(this.device,{id:"".concat(_,"-minFb"),texture:C}))),m&&(l[_]||(C=d[_].maxTexture||this._getMinMaxTexture("".concat(_,"-maxTexture")),l[_]=ur(this.device,{id:"".concat(_,"-maxFb"),texture:C})))))}},t._getMinMaxTexture=function(n){var i=this.state.resources;return i[n]||(i[n]=At(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,f=s===void 0?0:s,l=this.state.shaderOptions;if((n=this.gridAggregationModel)===null||n===void 0||n.destroy(),this.gridAggregationModel=nd(this.device,l),!this.allAggregationModel){var u=a*f;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),f;try{for(s.s();!(f=s.n()).done;){var l=f.value;if(n[a][l]&&i[a][l]!==n[a][l]){var u="gpu-result-".concat(a,"-").concat(l);o[u]&&o[u].delete(),o[u]=n[a][l]}}}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,f=this.state.modelDirty;f&&(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({},$a),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,We._mergeShaders)({vs:Ya,fs:Za,modules:[ot,We.project32]},t);return new Y(e,G({id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,We.getShaderAssembler)()},r))}function id(e,t){return new Y(e,{id:"All-Aggregation-Model",vs:qa,fs:Qa,modules:[ot],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function od(e,t){return new Me(e,G({vs:Ja,_targetTextureVarying:"meanValues"},t))}var vt=P($());var ae=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function He(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 rs=`#version 300 es
435
435
  #define SHADER_NAME screen-grid-layer-vertex-shader
436
436
  #define RANGE_COUNT 6
437
437
 
@@ -492,7 +492,7 @@ void main(void) {
492
492
 
493
493
  gl_Position = vec4(instancePositions + positions * cellScale, 1.);
494
494
  }
495
- `;var rs=`#version 300 es
495
+ `;var ns=`#version 300 es
496
496
  #define SHADER_NAME screen-grid-layer-fragment-shader
497
497
 
498
498
  precision highp float;
@@ -510,16 +510,16 @@ void main(void) {
510
510
 
511
511
  DECKGL_FILTER_COLOR(fragColor, geometry);
512
512
  }
513
- `;function Yr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yr=function(r){return typeof r}:Yr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Yr(e)}function ns(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 ci(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ns(Object(r),!0).forEach(function(n){ad(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ns(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ad(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zr(e,t,r){return typeof Reflect<"u"&&Reflect.get?Zr=Reflect.get:Zr=function(i,o,a){var s=ld(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},Zr(e,t,r||e)}function ld(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=pt(e),e!==null););return e}function fd(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&&di(e,t)}function di(e,t){return di=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},di(e,t)}function ud(e){var t=gd();return function(){var n=pt(e),i;if(t){var o=pt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cd(this,i)}}function cd(e,t){if(t&&(Yr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dd(e)}function dd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gd(){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 pt(e){return pt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},pt(e)}var hd=[0,0,0,0],_d=[0,255,0,255],pd=["minColor","maxColor","colorRange","colorDomain"],Ad={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ae},Tt=function(e){fd(r,e);var t=ud(r);function r(){var i;sd(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}r.isSupported=function(o){return o.features.has("texture-formats-float32-webgl1")};var n=r.prototype;return n.getShaders=function(){return{vs:ts,fs:rs,modules:[At.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 a=o.changeFlags;return a.somethingChanged},n.updateState=function(o){Zr(pt(r.prototype),"updateState",this).call(this,o);var a=o.oldProps,s=o.props,l=o.changeFlags,f=this.getAttributeManager();s.numInstances!==a.numInstances?f.invalidateAll():a.cellSizePixels!==s.cellSizePixels&&f.invalidate("instancePositions"),this._updateUniforms(a,s,l)},n.draw=function(o){var a=o.uniforms,s=this.props,l=s.parameters,f=s.maxTexture,u=this.props.minColor||hd,c=this.props.maxColor||_d,d=this.props.colorDomain||[1,0],g=this.state.model;g.setUniforms(a),g.setBindings({maxTexture:f}),g.setUniforms({minColor:u,maxColor:c,colorDomain:d}),g.setParameters(ci({depthWriteEnabled:!1},l)),g.draw(this.context.renderPass)},n.calculateInstancePositions=function(o,a){for(var s=a.numInstances,l=this.context.viewport,f=l.width,u=l.height,c=this.props.cellSizePixels,d=Math.ceil(f/c),g=o.value,h=o.size,A=0;A<s;A++){var _=A%d,v=Math.floor(A/d);g[A*h+0]=_*c/f*2-1,g[A*h+1]=1-v*c/u*2,g[A*h+2]=0}},n._getModel=function(){return new Y(this.context.device,ci(ci({},this.getShaders()),{},{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Re({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,a=o.minColor,s=o.maxColor,l=o.colorDomain,f=o.colorRange;return a||s?(At.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(l||f)},n._updateUniforms=function(o,a,s){var l=this.state.model;if(pd.some(function(v){return o[v]!==a[v]})&&l.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),o.colorRange!==a.colorRange&&l.setUniforms({colorRange:We(a.colorRange)}),o.cellMarginPixels!==a.cellMarginPixels||o.cellSizePixels!==a.cellSizePixels||s.viewportChanged){var f=this.context.viewport,u=f.width,c=f.height,d=this.props,g=d.cellSizePixels,h=d.cellMarginPixels,A=g>h?h:0,_=new Float32Array([(g-A)/u*2,-(g-A)/c*2,1]);l.setUniforms({cellScale:_})}},r}(At.Layer);Tt.layerName="ScreenGridCellLayer";Tt.defaultProps=Ad;var Ms=P($());var vt=P($());function is(e,t){var r={};for(var n in e)t.includes(n)||(r[n]=e[n]);return r}function qr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qr=function(r){return typeof r}:qr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qr(e)}function os(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Td(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.
514
- 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 Td(e,t){if(e){if(typeof e=="string")return as(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 as(e,t)}}function as(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 vd(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,a){var s=md(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},fr(e,t,r||e)}function md(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ze(e),e!==null););return e}function bd(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&&gi(e,t)}function gi(e,t){return gi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},gi(e,t)}function Sd(e){var t=Ed();return function(){var n=Ze(e),i;if(t){var o=Ze(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Rd(this,i)}}function Rd(e,t){if(t&&(qr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yd(e)}function yd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ed(){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 Ze(e){return Ze=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ze(e)}var de=function(e){bd(r,e);var t=Sd(r);function r(){var i;vd(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){fr(Ze(r.prototype),"initializeState",this).call(this,this.context),this.setState({ignoreProps:is(this.constructor._propTypes,o.data.props),dimensions:o})},n.updateState=function(o){fr(Ze(r.prototype),"updateState",this).call(this,o);var a=o.changeFlags;if(a.extensionsChanged){var s=this.getShaders({});s&&s.defines&&(s.defines.NON_INSTANCED_MODEL=1),this.updateShaders(s)}this._updateAttributes()},n.updateAttributes=function(o){this.setState({changedAttributes:o})},n.getAttributes=function(){return this.getAttributeManager().getAttributes()},n.getModuleSettings=function(){var o=this.context,a=o.viewport,s=o.mousePosition,l=o.device,f=Object.assign(Object.create(this.props),{viewport:a,mousePosition:s,pickingActive:0,devicePixelRatio:l.canvasContext.cssToDeviceRatio()});return f},n.updateShaders=function(o){},n.isAggregationDirty=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.props,l=o.oldProps,f=o.changeFlags,u=a.compareAll,c=u===void 0?!1:u,d=a.dimension,g=this.state.ignoreProps,h=d.props,A=d.accessors,_=A===void 0?[]:A,v=f.updateTriggersChanged;if(f.dataChanged)return!0;if(v){if(v.all)return!0;var T=os(_),m;try{for(T.s();!(m=T.n()).done;){var E=m.value;if(v[E])return!0}}catch(M){T.e(M)}finally{T.f()}}if(c)return f.extensionsChanged?!0:(0,vt._compareProps)({oldProps:l,newProps:s,ignoreProps:g,propTypes:this.constructor._propTypes});var O=os(h),C;try{for(O.s();!(C=O.n()).done;){var N=C.value;if(s[N]!==l[N])return!0}}catch(M){O.e(M)}finally{O.f()}return!1},n.isAttributeChanged=function(o){var a=this.state.changedAttributes;return o?a&&a[o]!==void 0:!xd(a)},n._getAttributeManager=function(){return new vt.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},r}(vt.CompositeLayer);de.layerName="AggregationLayer";function xd(e){var t=!0;for(var r in e){t=!1;break}return t}var fs=P($());function Od(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Cd(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.
515
- 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 Cd(e,t){if(e){if(typeof e=="string")return ss(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 ss(e,t)}}function ss(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 Qr(e,t,r){var n=r;return n.domain=function(){return e},n.range=function(){return t},n}function ls(e,t){var r=function(i){return Bd(e,t,i)};return Qr(e,t,r)}function Pd(e,t){var r=function(i){return Ud(e,t,i)};return Qr(e,t,r)}function Nd(e,t){for(var r=e.sort(us),n=0,i=Math.max(1,t.length),o=new Array(i-1);++n<i;)o[n-1]=Md(r,n/i);var a=function(l){return Dd(o,t,l)};return a.thresholds=function(){return o},Qr(e,t,a)}function us(e,t){return e-t}function Md(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],a=e[i+1];return o+(a-o)*(n-i)}function Id(e,t){for(var r=0,n=e.length;r<n;){var i=r+n>>>1;us(e[i],t)>0?n=i:r=i+1}return r}function Dd(e,t,r){return t[Id(e,r)]}function Fd(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 wd(e,t){var r=new Map,n=[],i=Od(e),o;try{for(i.s();!(o=i.n()).done;){var a=o.value,s="".concat(a);r.has(s)||r.set(s,n.push(a))}}catch(f){i.e(f)}finally{i.f()}var l=function(u){return Fd(n,r,t,u)};return Qr(e,t,l)}function Bd(e,t,r){var n=e[1]-e[0];if(n<=0)return fs.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];var i=n/t.length,o=Math.floor((r-e[0])/i),a=Math.max(Math.min(o,t.length-1),0);return t[a]}function Ud(e,t,r){return(r-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function cs(e){return e!=null}function Wd(e){var t=[];return e.forEach(function(r){!t.includes(r)&&cs(r)&&t.push(r)}),t}function ds(e,t){var r=typeof t=="function"?e.map(t):e;return r.filter(cs)}function gs(e,t){return ds(e,t)}function hs(e,t){return Wd(ds(e,t))}function _s(e,t,r){return Math.max(t,Math.min(r,e))}function ps(e){switch(e){case"quantize":return ls;case"linear":return Pd;case"quantile":return Nd;case"ordinal":return wd;default:return ls}}function As(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ms(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.
516
- 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 hi(e,t){return Xd(e)||Vd(e,t)||ms(e,t)||Hd()}function Hd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
517
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ms(e,t){if(e){if(typeof e=="string")return Ts(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 Ts(e,t)}}function Ts(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 Vd(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 Xd(e){if(Array.isArray(e))return e}function Ld(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var bs=function(t){return t.length},zd=3402823466e29,Ss=function(t){return t.points},Rs=function(t){return t.index},vs=function(t,r){return t<r?-1:t>r?1:t>=r?0:NaN},jd={getValue:bs,getPoints:Ss,getIndex:Rs,filterData:null},mt=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jd;Ld(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,a=o===void 0?bs:o,s=i.getPoints,l=s===void 0?Ss:s,f=i.getIndex,u=f===void 0?Rs:f,c=i.filterData,d=typeof c=="function",g=n.length,h=[],A=0,_=0;_<g;_++){var v=n[_],T=l(v),m=u(v),E=d?T.filter(c):T;v.filteredPoints=d?E:null;var O=E.length?a(E):null;O!=null&&(h[A]={i:Number.isFinite(m)?m:_,value:O,counts:E.length},A++)}return h},t._percentileToIndex=function(n){var i=this.sortedBins.length;if(i<2)return[0,0];var o=n.map(function(c){return _s(c,0,100)}),a=hi(o,2),s=a[0],l=a[1],f=Math.ceil(s/100*(i-1)),u=Math.floor(l/100*(i-1));return[f,u]},t.getBinMap=function(){var n={},i=As(this.aggregatedBins),o;try{for(i.s();!(o=i.n()).done;){var a=o.value;n[a.i]=a}}catch(s){i.e(s)}finally{i.f()}return n},t._updateMinMaxValues=function(){var n=0,i=0,o=zd,a=0,s=As(this.aggregatedBins),l;try{for(s.s();!(l=s.n()).done;){var f=l.value;n=n>f.counts?n:f.counts,i=i>f.value?i:f.value,o=o<f.value?o:f.value,a+=f.counts}}catch(u){s.e(u)}finally{s.f()}this.maxCount=n,this.maxValue=i,this.minValue=o,this.totalCount=a},t.getValueRange=function(n){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(s,l){return vs(s.value,l.value)})),!this.sortedBins.length)return[];var i=0,o=this.sortedBins.length-1;if(Array.isArray(n)){var a=this._percentileToIndex(n);i=a[0],o=a[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=hi(i,2),a=o[0],s=a===void 0?0:a,l=o[1],f=l===void 0?100:l;if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(c,d){return vs(c.value,d.value)})),!this.sortedBins.length)return[];var u=this._percentileToIndex([s,f]);return this._getScaleDomain(n,u)},t._getScaleDomain=function(n,i){var o=hi(i,2),a=o[0],s=o[1],l=this.sortedBins;switch(n){case"quantize":case"linear":return[l[a].value,l[s].value];case"quantile":return gs(l.slice(a,s+1),function(f){return f.value});case"ordinal":return hs(l,function(f){return f.value});default:return[l[a].value,l[s].value]}},e}();var Ps=P($());var He=P($()),Es=6378e3;function Jr(e){return Number.isFinite(e)?e:0}function Gr(e,t){for(var r=e.positions.value,n=1/0,i=-1/0,o=1/0,a=-1/0,s,l,f=0;f<t;f++)l=r[f*3],s=r[f*3+1],n=s<n?s:n,i=s>i?s:i,o=l<o?l:o,a=l>a?l:a;var u={xMin:Jr(o),xMax:Jr(a),yMin:Jr(n),yMax:Jr(i)};return u}function kd(e,t,r,n){var i=n.width,o=n.height,a=r===He.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-o/2]:[-180,-90];He.log.assert(r===He.COORDINATE_SYSTEM.CARTESIAN||r===He.COORDINATE_SYSTEM.LNGLAT||r===He.COORDINATE_SYSTEM.DEFAULT);var s=e.xMin,l=e.yMin;return[-1*(ys(s-a[0],t.xOffset)+a[0]),-1*(ys(l-a[1],t.yOffset)+a[1])]}function ys(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 _i(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 $d(t,o)}function en(e,t,r,n){var i=_i(e,t,n!==He.COORDINATE_SYSTEM.CARTESIAN),o=kd(e,i,n,r),a=e.xMin,s=e.yMin,l=e.xMax,f=e.yMax,u=l-a+i.xOffset,c=f-s+i.yOffset,d=Math.ceil(u/i.xOffset),g=Math.ceil(c/i.yOffset);return{gridOffset:i,translation:o,width:u,height:c,numCol:d,numRow:g}}function $d(e,t){var r=Kd(e),n=Yd(t,e);return{yOffset:r,xOffset:n}}function Kd(e){return e/Es*(180/Math.PI)}function Yd(e,t){return t/Es*(180/Math.PI)/Math.cos(e*Math.PI/180)}function xs(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 Zd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xs(Object(r),!0).forEach(function(n){qd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qd(e,t){return eg(e)||Gd(e,t)||Cs(e,t)||Jd()}function Jd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
518
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gd(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 eg(e){if(Array.isArray(e))return e}function tg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Cs(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.
519
- 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 Cs(e,t){if(e){if(typeof e=="string")return Os(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 Os(e,t)}}function Os(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 bt(e,t){var r=rg(e,t),n=ng(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:n}}function rg(e,t){var r=e.data,n=r===void 0?[]:r,i=e.cellSize,o=t.attributes,a=t.viewport,s=t.projectPoints,l=t.numInstances,f=o.positions.value,u=o.positions.getAccessor(),c=u.size,d=t.boundingBox||ig(o.positions,l),g=t.posOffset||[180,90],h=t.gridOffset||_i(d,i);if(h.xOffset<=0||h.yOffset<=0)return{gridHash:{},gridOffset:h,offsets:[0,0]};var A=a.width,_=a.height,v=Math.ceil(A/h.xOffset),T=Math.ceil(_/h.yOffset),m={},E=(0,Ps.createIterable)(n),O=E.iterable,C=E.objectInfo,N=new Array(3),M=tg(O),U;try{for(M.s();!(U=M.n()).done;){var W=U.value;C.index++,N[0]=f[C.index*c],N[1]=f[C.index*c+1],N[2]=c>=3?f[C.index*c+2]:0;var j=s?a.project(N):N,Z=Qd(j,2),oe=Z[0],Ui=Z[1];if(Number.isFinite(oe)&&Number.isFinite(Ui)){var hr=Math.floor((Ui+g[1])/h.yOffset),_r=Math.floor((oe+g[0])/h.xOffset);if(!s||_r>=0&&_r<v&&hr>=0&&hr<T){var pr="".concat(hr,"-").concat(_r);m[pr]=m[pr]||{count:0,points:[],lonIdx:_r,latIdx:hr},m[pr].count+=1,m[pr].points.push({source:W,index:C.index})}}}}catch(sf){M.e(sf)}finally{M.f()}return{gridHash:m,gridOffset:h,offsets:[g[0]*-1,g[1]*-1]}}function ng(e){var t=e.gridHash,r=e.gridOffset,n=e.offsets,i=new Array(Object.keys(t).length),o=0;for(var a in t){var s=a.split("-"),l=parseInt(s[0],10),f=parseInt(s[1],10),u=o++;i[u]=Zd({index:u,position:[n[0]+r.xOffset*f,n[1]+r.yOffset*l]},t[a])}return i}function ig(e,t){for(var r=e.value,n=e.getAccessor(),i=n.size,o=1/0,a=-1/0,s=1/0,l=-1/0,f,u,c=0;c<t;c++)u=r[c*i],f=r[c*i+1],Number.isFinite(u)&&Number.isFinite(f)&&(o=f<o?f:o,a=f>a?f:a,s=u<s?u:s,l=u>l?u:l);return{xMin:s,xMax:l,yMin:o,yMax:a}}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 og(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ag(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.
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,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 Jg(e,t){if(e){if(typeof e=="string")return yl(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 yl(e,t)}}function yl(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 El(e){var t=e.thresholdData,r=e.cellWeights,n=e.gridSize,i=e.gridOrigin,o=e.cellSize,a=[],s=[],l=n[0],f=n[1],u=0,c=0,d=Rl(t),g;try{for(d.s();!(g=d.n()).done;)for(var h=g.value,A=h.contour,_=A.threshold,v=-1;v<l;v++)for(var T=-1;T<f;T++){var m=Sl({cellWeights:r,threshold:_,x:v,y:T,width:l,height:f}),E=m.code,O=m.meanCode,C={type:Je.ISO_BANDS,gridOrigin:i,cellSize:o,x:v,y:T,width:l,height:f,code:E,meanCode:O,thresholdData:h};if(Array.isArray(_)){C.type=Je.ISO_BANDS;var N=yi(C),M=Rl(N),U;try{for(M.s();!(U=M.n()).done;){var W=U.value;s[c++]={vertices:W,contour:A}}}catch(oe){M.e(oe)}finally{M.f()}}else{C.type=Je.ISO_LINES;for(var j=yi(C),Z=0;Z<j.length;Z+=2)a[u++]={start:j[Z],end:j[Z+1],contour:A}}}}catch(oe){d.e(oe)}finally{d.f()}return{contourSegments:a,contourPolygons:s}}var Pl=P($());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 xl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dr(e,t,r){return typeof Reflect<"u"&&Reflect.get?dr=Reflect.get:dr=function(i,o,a){var s=eh(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},dr(e,t,r||e)}function eh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ge(e),e!==null););return e}function th(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&&Ei(e,t)}function Ei(e,t){return Ei=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ei(e,t)}function rh(e){var t=oh();return function(){var n=Ge(e),i;if(t){var o=Ge(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return nh(this,i)}}function nh(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 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 oh(){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 Ge(e){return Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ge(e)}var Ol=[255,255,255,255],ah=1,sh=1,lh={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM",contours:{type:"object",value:[{threshold:sh}],optional:!0,compare:3},zOffset:.005},Cl="positions",fh={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},An=function(e){th(r,e);var t=rh(r);function r(){var i;Gg(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;dr(Ge(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:fh}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:w.SUM}}});var a=this.getAttributeManager();a.add((o={},xl(o,Cl,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),xl(o,"count",{size:3,accessor:"getWeight"}),o))},n.updateState=function(o){dr(Ge(r.prototype),"updateState",this).call(this,o);var a=!1,s=o.oldProps,l=o.props,f=this.state.aggregationDirty;(s.contours!==l.contours||s.zOffset!==l.zOffset)&&(a=!0,this._updateThresholdData(o.props)),this.getNumInstances()>0&&(f||a)&&this._generateContours()},n.renderLayers=function(){var o=this.state.contourData,a=o.contourSegments,s=o.contourPolygons,l=this.getSubLayerClass("lines",pn.LineLayer),f=this.getSubLayerClass("bands",pn.SolidPolygonLayer),u=a&&a.length>0&&new l(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:function(g){return g.start},getTargetPosition:function(g){return g.end},getColor:function(g){return g.contour.color||Ol},getWidth:function(g){return g.contour.strokeWidth||ah}}),c=s&&s.length>0&&new f(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:function(g){return g.vertices},getFillColor:function(g){return g.contour.color||Ol}});return[u,c]},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=a.gpuAggregation;this.state.gpuAggregation!==a.gpuAggregation&&d&&!ee.isSupported(this.context.device)&&(Pl.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),d=!1);var g=d!==this.state.gpuAggregation;this.setState({gpuAggregation:d});var h=this.state.dimensions,A=this.isAttributeChanged(Cl),_=h.data,v=h.weights,T=this.state.boundingBox;if(A&&(T=Gr(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:T})),A||c){var m=en(T,l,u,f),E=m.gridOffset,O=m.translation,C=m.width,N=m.height,M=m.numCol,U=m.numRow;this.allocateResources(U,M),this.setState({gridOffset:E,boundingBox:T,translation:O,posOffset:O.slice(),gridOrigin:[-1*O[0],-1*O[1]],width:C,height:N,numCol:M,numRow:U})}var W=A||g||this.isAggregationDirty(o,{dimension:_,compareAll:d}),j=this.isAggregationDirty(o,{dimension:v});j&&this._updateAccessors(o),(W||j)&&this._resetResults(),this.setState({aggregationDataDirty:W,aggregationWeightsDirty:j})},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)},n._generateContours=function(){var o=this.state,a=o.numCol,s=o.numRow,l=o.gridOrigin,f=o.gridOffset,u=o.thresholdData,c=this.state.weights.count,d=c.aggregationData;d||(d=c.aggregationBuffer.getData(),c.aggregationData=d);var g=ee.getCellData({countsData:d}),h=g.cellWeights,A=El({thresholdData:u,cellWeights:h,gridSize:[a,s],gridOrigin:l,cellSize:[f.xOffset,f.yOffset]});this.setState({contourData:A})},n._updateThresholdData=function(o){for(var a=o.contours,s=o.zOffset,l=a.length,f=new Array(l),u=0;u<l;u++){var c=a[u];f[u]={contour:c,zIndex:c.zIndex||u,zOffset:s}}this.setState({thresholdData:f})},r}(qe);An.layerName="ContourLayer";An.defaultProps=lh;var Hl=P($());var Ul=P($());var ie=P($());var Nl=`#version 300 es
513
+ `;function Yr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yr=function(r){return typeof r}:Yr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Yr(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 ci(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){ad(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 ad(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zr(e,t,r){return typeof Reflect<"u"&&Reflect.get?Zr=Reflect.get:Zr=function(i,o,a){var s=fd(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},Zr(e,t,r||e)}function fd(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Tt(e),e!==null););return e}function ld(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&&di(e,t)}function di(e,t){return di=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},di(e,t)}function ud(e){var t=gd();return function(){var n=Tt(e),i;if(t){var o=Tt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cd(this,i)}}function cd(e,t){if(t&&(Yr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dd(e)}function dd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gd(){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 Tt(e){return Tt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Tt(e)}var hd=[0,0,0,0],_d=[0,255,0,255],pd=["minColor","maxColor","colorRange","colorDomain"],Ad={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ae},mt=function(e){ld(r,e);var t=ud(r);function r(){var i;sd(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}r.isSupported=function(o){return o.features.has("texture-formats-float32-webgl1")};var n=r.prototype;return n.getShaders=function(){return{vs:rs,fs:ns,modules:[vt.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 a=o.changeFlags;return a.somethingChanged},n.updateState=function(o){Zr(Tt(r.prototype),"updateState",this).call(this,o);var a=o.oldProps,s=o.props,f=o.changeFlags,l=this.getAttributeManager();s.numInstances!==a.numInstances?l.invalidateAll():a.cellSizePixels!==s.cellSizePixels&&l.invalidate("instancePositions"),this._updateUniforms(a,s,f)},n.draw=function(o){var a=o.uniforms,s=this.props,f=s.parameters,l=s.maxTexture,u=this.props.minColor||hd,c=this.props.maxColor||_d,d=this.props.colorDomain||[1,0],g=this.state.model;g.setUniforms(a),g.setBindings({maxTexture:l}),g.setUniforms({minColor:u,maxColor:c,colorDomain:d}),g.setParameters(ci({depthWriteEnabled:!1},f)),g.draw(this.context.renderPass)},n.calculateInstancePositions=function(o,a){for(var s=a.numInstances,f=this.context.viewport,l=f.width,u=f.height,c=this.props.cellSizePixels,d=Math.ceil(l/c),g=o.value,h=o.size,A=0;A<s;A++){var _=A%d,v=Math.floor(A/d);g[A*h+0]=_*c/l*2-1,g[A*h+1]=1-v*c/u*2,g[A*h+2]=0}},n._getModel=function(){return new Y(this.context.device,ci(ci({},this.getShaders()),{},{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Re({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,a=o.minColor,s=o.maxColor,f=o.colorDomain,l=o.colorRange;return a||s?(vt.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(f||l)},n._updateUniforms=function(o,a,s){var f=this.state.model;if(pd.some(function(v){return o[v]!==a[v]})&&f.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),o.colorRange!==a.colorRange&&f.setUniforms({colorRange:He(a.colorRange)}),o.cellMarginPixels!==a.cellMarginPixels||o.cellSizePixels!==a.cellSizePixels||s.viewportChanged){var l=this.context.viewport,u=l.width,c=l.height,d=this.props,g=d.cellSizePixels,h=d.cellMarginPixels,A=g>h?h:0,_=new Float32Array([(g-A)/u*2,-(g-A)/c*2,1]);f.setUniforms({cellScale:_})}},r}(vt.Layer);mt.layerName="ScreenGridCellLayer";mt.defaultProps=Ad;var Ms=P($());var bt=P($());function os(e,t){var r={};for(var n in e)t.includes(n)||(r[n]=e[n]);return r}function qr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qr=function(r){return typeof r}:qr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qr(e)}function as(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Td(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
514
+ 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 l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Td(e,t){if(e){if(typeof e=="string")return ss(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 ss(e,t)}}function ss(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 vd(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,a){var s=md(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},cr(e,t,r||e)}function md(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=qe(e),e!==null););return e}function bd(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&&gi(e,t)}function gi(e,t){return gi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},gi(e,t)}function Sd(e){var t=Ed();return function(){var n=qe(e),i;if(t){var o=qe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Rd(this,i)}}function Rd(e,t){if(t&&(qr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yd(e)}function yd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ed(){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 qe(e){return qe=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},qe(e)}var ce=function(e){bd(r,e);var t=Sd(r);function r(){var i;vd(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){cr(qe(r.prototype),"initializeState",this).call(this,this.context),this.setState({ignoreProps:os(this.constructor._propTypes,o.data.props),dimensions:o})},n.updateState=function(o){cr(qe(r.prototype),"updateState",this).call(this,o);var a=o.changeFlags;if(a.extensionsChanged){var s=this.getShaders({});s&&s.defines&&(s.defines.NON_INSTANCED_MODEL=1),this.updateShaders(s)}this._updateAttributes()},n.updateAttributes=function(o){this.setState({changedAttributes:o})},n.getAttributes=function(){return this.getAttributeManager().getAttributes()},n.getModuleSettings=function(){var o=this.context,a=o.viewport,s=o.mousePosition,f=o.device,l=Object.assign(Object.create(this.props),{viewport:a,mousePosition:s,picking:{isActive:0},devicePixelRatio:f.canvasContext.cssToDeviceRatio()});return l},n.updateShaders=function(o){},n.isAggregationDirty=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.props,f=o.oldProps,l=o.changeFlags,u=a.compareAll,c=u===void 0?!1:u,d=a.dimension,g=this.state.ignoreProps,h=d.props,A=d.accessors,_=A===void 0?[]:A,v=l.updateTriggersChanged;if(l.dataChanged)return!0;if(v){if(v.all)return!0;var T=as(_),m;try{for(T.s();!(m=T.n()).done;){var E=m.value;if(v[E])return!0}}catch(I){T.e(I)}finally{T.f()}}if(c)return l.extensionsChanged?!0:(0,bt._compareProps)({oldProps:f,newProps:s,ignoreProps:g,propTypes:this.constructor._propTypes});var O=as(h),C;try{for(O.s();!(C=O.n()).done;){var N=C.value;if(s[N]!==f[N])return!0}}catch(I){O.e(I)}finally{O.f()}return!1},n.isAttributeChanged=function(o){var a=this.state.changedAttributes;return o?a&&a[o]!==void 0:!xd(a)},n._getAttributeManager=function(){return new bt.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},r}(bt.CompositeLayer);ce.layerName="AggregationLayer";function xd(e){var t=!0;for(var r in e){t=!1;break}return t}var us=P($());function Od(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Cd(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
515
+ 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 l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Cd(e,t){if(e){if(typeof e=="string")return fs(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 fs(e,t)}}function fs(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 Qr(e,t,r){var n=r;return n.domain=function(){return e},n.range=function(){return t},n}function ls(e,t){var r=function(i){return Bd(e,t,i)};return Qr(e,t,r)}function Pd(e,t){var r=function(i){return Ud(e,t,i)};return Qr(e,t,r)}function Nd(e,t){for(var r=e.sort(cs),n=0,i=Math.max(1,t.length),o=new Array(i-1);++n<i;)o[n-1]=Id(r,n/i);var a=function(f){return Dd(o,t,f)};return a.thresholds=function(){return o},Qr(e,t,a)}function cs(e,t){return e-t}function Id(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],a=e[i+1];return o+(a-o)*(n-i)}function Md(e,t){for(var r=0,n=e.length;r<n;){var i=r+n>>>1;cs(e[i],t)>0?n=i:r=i+1}return r}function Dd(e,t,r){return t[Md(e,r)]}function Fd(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 wd(e,t){var r=new Map,n=[],i=Od(e),o;try{for(i.s();!(o=i.n()).done;){var a=o.value,s="".concat(a);r.has(s)||r.set(s,n.push(a))}}catch(l){i.e(l)}finally{i.f()}var f=function(u){return Fd(n,r,t,u)};return Qr(e,t,f)}function Bd(e,t,r){var n=e[1]-e[0];if(n<=0)return us.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];var i=n/t.length,o=Math.floor((r-e[0])/i),a=Math.max(Math.min(o,t.length-1),0);return t[a]}function Ud(e,t,r){return(r-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function ds(e){return e!=null}function Wd(e){var t=[];return e.forEach(function(r){!t.includes(r)&&ds(r)&&t.push(r)}),t}function gs(e,t){var r=typeof t=="function"?e.map(t):e;return r.filter(ds)}function hs(e,t){return gs(e,t)}function _s(e,t){return Wd(gs(e,t))}function ps(e,t,r){return Math.max(t,Math.min(r,e))}function As(e){switch(e){case"quantize":return ls;case"linear":return Pd;case"quantile":return Nd;case"ordinal":return wd;default:return ls}}function Ts(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=bs(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
516
+ 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 l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function hi(e,t){return Xd(e)||Vd(e,t)||bs(e,t)||Hd()}function Hd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
517
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bs(e,t){if(e){if(typeof e=="string")return vs(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 vs(e,t)}}function vs(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 Vd(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(f){o=!0,s=f}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function Xd(e){if(Array.isArray(e))return e}function Ld(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ss=function(t){return t.length},zd=3402823466e29,Rs=function(t){return t.points},ys=function(t){return t.index},ms=function(t,r){return t<r?-1:t>r?1:t>=r?0:NaN},jd={getValue:Ss,getPoints:Rs,getIndex:ys,filterData:null},St=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jd;Ld(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,a=o===void 0?Ss:o,s=i.getPoints,f=s===void 0?Rs:s,l=i.getIndex,u=l===void 0?ys:l,c=i.filterData,d=typeof c=="function",g=n.length,h=[],A=0,_=0;_<g;_++){var v=n[_],T=f(v),m=u(v),E=d?T.filter(c):T;v.filteredPoints=d?E:null;var O=E.length?a(E):null;O!=null&&(h[A]={i:Number.isFinite(m)?m:_,value:O,counts:E.length},A++)}return h},t._percentileToIndex=function(n){var i=this.sortedBins.length;if(i<2)return[0,0];var o=n.map(function(c){return ps(c,0,100)}),a=hi(o,2),s=a[0],f=a[1],l=Math.ceil(s/100*(i-1)),u=Math.floor(f/100*(i-1));return[l,u]},t.getBinMap=function(){var n={},i=Ts(this.aggregatedBins),o;try{for(i.s();!(o=i.n()).done;){var a=o.value;n[a.i]=a}}catch(s){i.e(s)}finally{i.f()}return n},t._updateMinMaxValues=function(){var n=0,i=0,o=zd,a=0,s=Ts(this.aggregatedBins),f;try{for(s.s();!(f=s.n()).done;){var l=f.value;n=n>l.counts?n:l.counts,i=i>l.value?i:l.value,o=o<l.value?o:l.value,a+=l.counts}}catch(u){s.e(u)}finally{s.f()}this.maxCount=n,this.maxValue=i,this.minValue=o,this.totalCount=a},t.getValueRange=function(n){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(s,f){return ms(s.value,f.value)})),!this.sortedBins.length)return[];var i=0,o=this.sortedBins.length-1;if(Array.isArray(n)){var a=this._percentileToIndex(n);i=a[0],o=a[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=hi(i,2),a=o[0],s=a===void 0?0:a,f=o[1],l=f===void 0?100:f;if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(c,d){return ms(c.value,d.value)})),!this.sortedBins.length)return[];var u=this._percentileToIndex([s,l]);return this._getScaleDomain(n,u)},t._getScaleDomain=function(n,i){var o=hi(i,2),a=o[0],s=o[1],f=this.sortedBins;switch(n){case"quantize":case"linear":return[f[a].value,f[s].value];case"quantile":return hs(f.slice(a,s+1),function(l){return l.value});case"ordinal":return _s(f,function(l){return l.value});default:return[f[a].value,f[s].value]}},e}();var Ns=P($());var Ve=P($()),xs=6378e3;function Jr(e){return Number.isFinite(e)?e:0}function Gr(e,t){for(var r=e.positions.value,n=1/0,i=-1/0,o=1/0,a=-1/0,s,f,l=0;l<t;l++)f=r[l*3],s=r[l*3+1],n=s<n?s:n,i=s>i?s:i,o=f<o?f:o,a=f>a?f:a;var u={xMin:Jr(o),xMax:Jr(a),yMin:Jr(n),yMax:Jr(i)};return u}function kd(e,t,r,n){var i=n.width,o=n.height,a=r===Ve.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-o/2]:[-180,-90];Ve.log.assert(r===Ve.COORDINATE_SYSTEM.CARTESIAN||r===Ve.COORDINATE_SYSTEM.LNGLAT||r===Ve.COORDINATE_SYSTEM.DEFAULT);var s=e.xMin,f=e.yMin;return[-1*(Es(s-a[0],t.xOffset)+a[0]),-1*(Es(f-a[1],t.yOffset)+a[1])]}function Es(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 _i(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 $d(t,o)}function en(e,t,r,n){var i=_i(e,t,n!==Ve.COORDINATE_SYSTEM.CARTESIAN),o=kd(e,i,n,r),a=e.xMin,s=e.yMin,f=e.xMax,l=e.yMax,u=f-a+i.xOffset,c=l-s+i.yOffset,d=Math.ceil(u/i.xOffset),g=Math.ceil(c/i.yOffset);return{gridOffset:i,translation:o,width:u,height:c,numCol:d,numRow:g}}function $d(e,t){var r=Kd(e),n=Yd(t,e);return{yOffset:r,xOffset:n}}function Kd(e){return e/xs*(180/Math.PI)}function Yd(e,t){return t/xs*(180/Math.PI)/Math.cos(e*Math.PI/180)}function Os(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 Zd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Os(Object(r),!0).forEach(function(n){qd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Os(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qd(e,t){return eg(e)||Gd(e,t)||Ps(e,t)||Jd()}function Jd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
518
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gd(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(f){o=!0,s=f}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function eg(e){if(Array.isArray(e))return e}function tg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ps(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(l){throw l},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,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Ps(e,t){if(e){if(typeof e=="string")return Cs(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 Cs(e,t)}}function Cs(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 Rt(e,t){var r=rg(e,t),n=ng(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:n}}function rg(e,t){var r=e.data,n=r===void 0?[]:r,i=e.cellSize,o=t.attributes,a=t.viewport,s=t.projectPoints,f=t.numInstances,l=o.positions.value,u=o.positions.getAccessor(),c=u.size,d=t.boundingBox||ig(o.positions,f),g=t.posOffset||[180,90],h=t.gridOffset||_i(d,i);if(h.xOffset<=0||h.yOffset<=0)return{gridHash:{},gridOffset:h,offsets:[0,0]};var A=a.width,_=a.height,v=Math.ceil(A/h.xOffset),T=Math.ceil(_/h.yOffset),m={},E=(0,Ns.createIterable)(n),O=E.iterable,C=E.objectInfo,N=new Array(3),I=tg(O),U;try{for(I.s();!(U=I.n()).done;){var W=U.value;C.index++,N[0]=l[C.index*c],N[1]=l[C.index*c+1],N[2]=c>=3?l[C.index*c+2]:0;var j=s?a.project(N):N,Z=Qd(j,2),oe=Z[0],Ui=Z[1];if(Number.isFinite(oe)&&Number.isFinite(Ui)){var pr=Math.floor((Ui+g[1])/h.yOffset),Ar=Math.floor((oe+g[0])/h.xOffset);if(!s||Ar>=0&&Ar<v&&pr>=0&&pr<T){var Tr="".concat(pr,"-").concat(Ar);m[Tr]=m[Tr]||{count:0,points:[],lonIdx:Ar,latIdx:pr},m[Tr].count+=1,m[Tr].points.push({source:W,index:C.index})}}}}catch(fl){I.e(fl)}finally{I.f()}return{gridHash:m,gridOffset:h,offsets:[g[0]*-1,g[1]*-1]}}function ng(e){var t=e.gridHash,r=e.gridOffset,n=e.offsets,i=new Array(Object.keys(t).length),o=0;for(var a in t){var s=a.split("-"),f=parseInt(s[0],10),l=parseInt(s[1],10),u=o++;i[u]=Zd({index:u,position:[n[0]+r.xOffset*l,n[1]+r.yOffset*f]},t[a])}return i}function ig(e,t){for(var r=e.value,n=e.getAccessor(),i=n.size,o=1/0,a=-1/0,s=1/0,f=-1/0,l,u,c=0;c<t;c++)u=r[c*i],l=r[c*i+1],Number.isFinite(u)&&Number.isFinite(l)&&(o=l<o?l:o,a=l>a?l:a,s=u<s?u:s,f=u>f?u:f);return{xMin:s,xMax:f,yMin:o,yMax:a}}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 og(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ag(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
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 l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},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 Is(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 Is(e,t)}}function Is(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 yt(e,t,r){return typeof Reflect<"u"&&Reflect.get?yt=Reflect.get:yt=function(i,o,a){var s=fg(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},yt(e,t,r||e)}function fg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Xe(e),e!==null););return e}function lg(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=Xe(e),i;if(t){var o=Xe(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 Xe(e){return Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Xe(e)}var Qe=function(e){lg(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;yt(Xe(r.prototype),"initializeAggregationLayer",this).call(this,a),this.setState({layerData:{},gpuGridAggregator:new ee(this.context.device,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:Rt})},n.updateState=function(o){yt(Xe(r.prototype),"updateState",this).call(this,o),this.updateAggregationState(o);var a=this.state,s=a.aggregationDataDirty,f=a.aggregationWeightsDirty,l=a.gpuAggregation;if(!(this.getNumInstances()<=0)){var u=!1;(s||l&&f)&&(this._updateAggregation(o),u=!0),!l&&(s||f)&&(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(),yt(Xe(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,f=this.state.weights;for(var l in f){var u=f[l];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,f=o.maxData,l=o.minData,u=this.state.weights.count;u&&(u.aggregationData=a,u.maxMinData=s,u.maxData=f,u.minData=l)},n._updateAggregation=function(o){var a=this.state,s=a.cpuGridAggregator,f=a.gpuGridAggregator,l=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;f.run({weights:U,cellSize:[l.xOffset,l.yOffset],numCol:T,numRow:m,translation:d,scaling:h,vertexCount:N,projectPoints:_,attributes:C,moduleSettings:this.getModuleSettings()})}else{var I=s(E,{gridOffset:l,projectPoints:_,attributes:C,viewport:O,posOffset:u,boundingBox:A});this.setState({layerData:I})}},n._updateWeightBins=function(){var o=this.state.getValue,a=new St(this.state.layerData.data||[],{getValue:o});this.setState({sortedBins:a})},n._uploadAggregationResults=function(){var o=this.state,a=o.numCol,s=o.numRow,f=this.state.layerData.data,l=this.state.sortedBins,u=l.aggregatedBins,c=l.minValue,d=l.maxValue,g=l.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=f[m.i],O=E.lonIdx,C=E.latIdx,N=m.value,I=m.counts,U=(O+C*a)*h;_[U]=N,_[U+h-1]=I}}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}(ce);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 Et(e,t,r){return typeof Reflect<"u"&&Reflect.get?Et=Reflect.get:Et=function(i,o,a){var s=_g(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},Et(e,t,r||e)}function _g(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Le(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=Le(e),i;if(t){var o=Le(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 Le(e){return Le=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Le(e)}function Ds(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?Ds(Object(r),!0).forEach(function(n){vi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ds(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({},mt.defaultProps),{},{getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"}),Fs="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(!mt.isSupported(this.context.device)){this.setState({supported:!1}),mi.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}Et(Le(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Sg,getCellSize:function(l){return l.cellSizePixels}});var a={count:{size:1,operation:w.SUM,needMax:!0,maxTexture:At(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,Fs,{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){Et(Le(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,f=o.numCol,l=o.weights,u=this.props.updateTriggers,c=l.count.aggregationBuffer,d=this.getSubLayerClass("cells",mt);return new d(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:u}),{data:{attributes:{instanceCounts:c}},maxTexture:a,numInstances:s*f})},n.finalizeState=function(o){Et(Le(r.prototype),"finalizeState",this).call(this,o);var a=this.state,s=a.aggregationBuffer,f=a.maxBuffer,l=a.maxTexture;s?.delete(),f?.delete(),l?.delete()},n.getPickingInfo=function(o){var a=o.info,s=a.index;if(s>=0){var f=this.state,l=f.gpuGridAggregator,u=f.gpuAggregation,c=f.weights,d=u?l.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,f=this.state.weights.count;f.aggregationData=a,f.aggregationBuffer.write(a),f.maxData=s,f.maxTexture.setImageData({data:s})},n.updateAggregationState=function(o){var a=o.props.cellSizePixels,s=o.oldProps.cellSizePixels!==a,f=o.changeFlags.viewportChanged,l=o.props.gpuAggregation;this.state.gpuAggregation!==o.props.gpuAggregation&&l&&!ee.isSupported(this.context.device)&&(mi.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),l=!1);var u=l!==this.state.gpuAggregation;this.setState({gpuAggregation:l});var c=this.isAttributeChanged(Fs),d=this.state.dimensions,g=d.data,h=d.weights,A=c||u||f||this.isAggregationDirty(o,{compareAll:l,dimension:g}),_=this.isAggregationDirty(o,{dimension:h});this.setState({aggregationDataDirty:A,aggregationWeightsDirty:_});var v=this.context.viewport;if(f||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,f=a.aggregation,l=a.data,u=this.state.weights.count;u&&(u.getWeight=s,u.operation=w[f]),this.setState({getValue:_t(f,s,{data:l})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},r}(Qe);nn.layerName="ScreenGridLayer";nn.defaultProps=bg;var Xs=P(nt());function dr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?dr=function(r){return typeof r}:dr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},dr(e)}function ws(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 de(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ws(Object(r),!0).forEach(function(n){Hs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ws(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Hs(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 Bs(){}var Us=["getBins","getDomain","getScaleFunc"],Ws=[{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},xt=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||Ws)}e.defaultDimensions=function(){return Ws};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 f=this.needsReProjectPoints(o,a,s),l=!1;if(s.dataChanged||f)this.getAggregatedData(a,i),l=!0;else{var u=this.getDimensionChanges(o,a,s)||[];u.forEach(function(c){return typeof c=="function"&&c()}),l=!0}return this.setState({aggregationDirty:l}),this.state},t.setState=function(n){this.state=de(de({},this.state),n)},t.setDimensionState=function(n,i){this.setState({dimensions:de(de({},this.state.dimensions),{},Hs({},n,de(de({},this.state.dimensions[n]),i)))})},t.normalizeResult=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n.hexagons?de({data:n.hexagons},n):n.layerData?de({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,f=s.value,l=s.weight,u=s.aggregation,c=i[f.prop],d=this.needUpdateDimensionStep(this.dimensionUpdaters[a].getBins,n,i,o);d&&(c?c=za(c,{data:i.data}):c=_t(i[u.prop],i[l.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:Bs}})},t.getDimensionUpdaters=function(n){var i=n.key,o=n.accessor,a=n.pickingInfo,s=n.getBins,f=n.getDomain,l=n.getScaleFunc,u=n.nullValue;return{key:i,accessor:o,pickingInfo:a,getBins:de({updater:this.getDimensionSortedBins.bind(this)},s),getDomain:de({updater:this.getDimensionValueDomain.bind(this)},f),getScaleFunc:de({updater:this.getDimensionScale.bind(this)},l),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=[],f=function(c){var d=Us.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 l in this.dimensionUpdaters)f(l);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]={},Us.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];dr(_)==="object"&&!Array.isArray(_)?Object.assign(a[c],_):_!==void 0&&(a[c][h]=_)}else a[c][h]=n[h]})})};for(var f in this.dimensionUpdaters)s(f);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 St(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,f=s.lowerPercentile,l=s.upperPercentile,u=s.scaleType,c=this.state.dimensions[a].sortedBins.getValueDomainByScale(n[u.prop],[n[f.prop],n[l.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,f=a.triggers,l=f.domain,u=f.range,c=s.triggers.scaleType,d=a.onSet,g=n[u.prop],h=n[l.prop]||this.state.dimensions[o].valueDomain,A=As(c&&n[c.prop]),_=A(h,g);dr(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],f=s.sortedBins,l=s.scaleFunc,u=f.binMap[a.index];if(u&&u.counts===0)return i;var c=u&&u.value,d=l.domain(),g=c>=d[0]&&c<=d[d.length-1];return g?l(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],f={};for(var l in this.dimensionUpdaters){var u=this.dimensionUpdaters[l].pickingInfo,c=this.state.dimensions[l].sortedBins,d=c.binMap[s.index]&&c.binMap[s.index].value;f[u]=d}a=Object.assign(f,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:Bs},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 f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},an(e,t,r||e)}function xg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ot(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=Ig();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 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 Ig(){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 Vs(){}var Mg={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:Vs,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:Vs,gridAggregator:Rt,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}},Je=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 xt({getAggregator:function(f){return f.gridAggregator},getCellSize:function(f){return f.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(Ot(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,f=o.cellSize,l=o.coverage,u=o.material,c=o.transitions,d=this.state.cpuAggregator,g=this.getSubLayerClass("grid-cell",Xs.GridCellLayer),h=this._getSublayerUpdateTriggers();return new g({cellSize:f,coverage:l,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}(ce);Je.layerName="CPUGridLayer";Je.defaultProps=Mg;var Ks=P($()),Ys=P(nt());var Ct=Math.PI/3,Dg=[0,Ct,2*Ct,3*Ct,4*Ct,5*Ct];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,f;function l(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/f),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,I=m+(T<m?-1:1),U=v-N,W=T-I;C*C+O*O>U*U+W*W&&(E=N+(m&1?1:-1)/2,m=I)}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*f)}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 l.hexagon=function(c){return"m"+u(c==null?a:+c).join("l")+"z"},l.centers=function(){for(var c=[],d=Math.round(t/f),g=Math.round(e/s),h=d*f;h<n+a;h+=f,++d)for(var A=g*s+(d&1)*s/2;A<r+s/2;A+=s)c.push([A,h]);return c},l.mesh=function(){var c=u(a).slice(0,4).join("l");return l.centers().map(function(d){return"M"+d+"m"+c}).join("")},l.x=function(c){return arguments.length?(i=c,l):i},l.y=function(c){return arguments.length?(o=c,l):o},l.radius=function(c){return arguments.length?(a=+c,s=a*2*Math.sin(Ct),f=a*1.5,l):a},l.size=function(c){return arguments.length?(e=t=0,r=+c[0],n=+c[1],l):[r-e,n-t]},l.extent=function(c){return arguments.length?(e=+c[0][0],t=+c[0][1],r=+c[1][0],n=+c[1][1],l):[[e,t],[r,n]]},l.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(l){throw l},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 l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},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 Ls(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 Ls(e,t)}}function Ls(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 zs(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),f=[],l=(0,sn.createIterable)(r),u=l.iterable,c=l.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?f.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(f);return{hexagons:C.map(function(N,I){return{position:i.unprojectFlat([N.x,N.y]),points:N,index:I}}),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,f=-1/0,l=-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),f=Math.max(c,f),s=Math.min(d,s),l=Math.max(d,l))}return[a,s,f,l].every(Number.isFinite)?[(a+f)/2,(s+l)/2]:null}function Hg(e,t,r){var n=t.getDistanceScales(r),i=n.unitsPerMeter;return e*i[0]}function fn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fn=function(r){return typeof r}:fn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fn(e)}function js(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 ks(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?js(Object(r),!0).forEach(function(n){Vg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):js(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 ln(e,t,r){return typeof Reflect<"u"&&Reflect.get?ln=Reflect.get:ln=function(i,o,a){var s=Lg(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},ln(e,t,r||e)}function Lg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Pt(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=Pt(e),i;if(t){var o=Pt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return kg(this,i)}}function kg(e,t){if(t&&(fn(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 Pt(e){return Pt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Pt(e)}function $s(){}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:$s,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:$s,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:zs,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 xt({getAggregator:function(f){return f.hexagonAggregator},getCellSize:function(f){return f.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(ln(Pt(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||{},f=s.hexagonVertices;this.setState({vertices:f&&this.convertLatLngToMeterOffset(f)})}this.setState({aggregatorState:a})}},n.convertLatLngToMeterOffset=function(o){var a=this.context.viewport;if(Array.isArray(o)&&o.length===6){var s=o[0],f=o[3],l=[(s[0]+f[0])/2,(s[1]+f[1])/2],u=a.projectFlat(l),c=a.getDistanceScales(l),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 Ks.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,f=o.coverage,l=o.material,u=o.transitions,c=this.state,d=c.aggregatorState,g=c.vertices,h=this.getSubLayerClass("hexagon-cell",Ys.ColumnLayer),A=this._getSublayerUpdateTriggers(),_=g?{vertices:g,radius:1}:{radius:d.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new h(ks(ks({},_),{},{diskResolution:6,elevationScale:a,extruded:s,coverage:f,material:l,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}(ce);un.layerName="HexagonLayer";un.defaultProps=Yg;var pn=P(nt());var Rf=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]},Nt=[p.W,p.SW,p.S],It=[p.S,p.SE,p.E],Mt=[p.E,p.NE,p.N],Dt=[p.NW,p.W,p.N],Ft=[[-b,x],[-b,-x],[-x,-b],[x,-b]],wt=[[-x,-b],[x,-b],[b,-x],[b,x]],Bt=[[b,-x],[b,x],[x,b],[-x,b]],Ut=[[-b,x],[-b,-x],[x,b],[-x,b]],Zs=[p.W,p.SW,p.SE,p.E],qs=[p.S,p.SE,p.NE,p.N],Qs=[p.NW,p.W,p.E,p.NE],Js=[p.NW,p.SW,p.S,p.N],Gs=[[-b,x],[-b,-x],[b,-x],[b,x]],ef=[[-x,-b],[x,-b],[x,b],[-x,b]],Zg=[p.NW,p.SW,p.SE,p.NE],tf=[p.NW,p.SW,p.SE,p.E,p.N],rf=[p.W,p.SW,p.SE,p.NE,p.N],nf=[p.NW,p.W,p.S,p.SE,p.NE],of=[p.NW,p.SW,p.S,p.E,p.NE],af=[p.NW,p.W,[b,-x],[b,x],p.N],sf=[[-x,-b],[x,-b],p.E,p.NE,p.N],ff=[[-b,x],[-b,-x],p.S,p.SE,p.E],lf=[p.W,p.SW,p.S,[x,b],[-x,b]],uf=[p.NW,p.W,[-x,-b],[x,-b],p.N],cf=[[-b,x],[-b,-x],p.E,p.NE,p.N],df=[p.S,p.SE,p.E,[x,b],[-x,b]],gf=[p.W,p.SW,p.S,[b,-x],[b,x]],hf=[p.W,p.SW,p.SE,p.E,[x,b],[-x,b]],_f=[[-b,x],[-b,-x],p.S,p.SE,p.NE,p.N],pf=[p.NW,p.W,[-x,-b],[x,-b],p.E,p.NE],Af=[p.NW,p.SW,p.S,[b,-x],[b,x],p.N],Wt=[p.W,p.SW,p.S,p.E,p.NE,p.N],Ht=[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]],Tf=[[-b,x],[-b,-x],[-x,-b],[x,-b],[b,-x],[b,x],[x,b],[-x,b]],vf={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 mf=(S={},R(S,y("0000"),[]),R(S,y("2222"),[]),R(S,y("2221"),[Nt]),R(S,y("2212"),[It]),R(S,y("2122"),[Mt]),R(S,y("1222"),[Dt]),R(S,y("0001"),[Nt]),R(S,y("0010"),[It]),R(S,y("0100"),[Mt]),R(S,y("1000"),[Dt]),R(S,y("2220"),[Ft]),R(S,y("2202"),[wt]),R(S,y("2022"),[Bt]),R(S,y("0222"),[Ut]),R(S,y("0002"),[Ft]),R(S,y("0020"),[wt]),R(S,y("0200"),[Bt]),R(S,y("2000"),[Ut]),R(S,y("0011"),[Zs]),R(S,y("0110"),[qs]),R(S,y("1100"),[Qs]),R(S,y("1001"),[Js]),R(S,y("2211"),[Zs]),R(S,y("2112"),[qs]),R(S,y("1122"),[Qs]),R(S,y("1221"),[Js]),R(S,y("2200"),[Gs]),R(S,y("2002"),[ef]),R(S,y("0022"),[Gs]),R(S,y("0220"),[ef]),R(S,y("1111"),[Zg]),R(S,y("1211"),[tf]),R(S,y("2111"),[rf]),R(S,y("1112"),[nf]),R(S,y("1121"),[of]),R(S,y("1011"),[tf]),R(S,y("0111"),[rf]),R(S,y("1110"),[nf]),R(S,y("1101"),[of]),R(S,y("1200"),[af]),R(S,y("0120"),[sf]),R(S,y("0012"),[ff]),R(S,y("2001"),[lf]),R(S,y("1022"),[af]),R(S,y("2102"),[sf]),R(S,y("2210"),[ff]),R(S,y("0221"),[lf]),R(S,y("1002"),[uf]),R(S,y("2100"),[cf]),R(S,y("0210"),[df]),R(S,y("0021"),[gf]),R(S,y("1220"),[uf]),R(S,y("0122"),[cf]),R(S,y("2012"),[df]),R(S,y("2201"),[gf]),R(S,y("0211"),[hf]),R(S,y("2110"),[_f]),R(S,y("1102"),[pf]),R(S,y("1021"),[Af]),R(S,y("2011"),[hf]),R(S,y("0112"),[_f]),R(S,y("1120"),[pf]),R(S,y("1201"),[Af]),R(S,y("2101"),[Wt]),R(S,y("0121"),[Wt]),R(S,y("1012"),[Ht]),R(S,y("1210"),[Ht]),R(S,y("0101"),{0:[Nt,Mt],1:[Wt],2:[Wt]}),R(S,y("1010"),{0:[Dt,It],1:[Ht],2:[Ht]}),R(S,y("2121"),{0:[Wt],1:[Wt],2:[Nt,Mt]}),R(S,y("1212"),{0:[Ht],1:[Ht],2:[Dt,It]}),R(S,y("2120"),{0:[cn],1:[cn],2:[Ft,Mt]}),R(S,y("2021"),{0:[dn],1:[dn],2:[Nt,Bt]}),R(S,y("1202"),{0:[gn],1:[gn],2:[Dt,wt]}),R(S,y("0212"),{0:[hn],1:[hn],2:[It,Ut]}),R(S,y("0102"),{0:[Ft,Mt],1:[cn],2:[cn]}),R(S,y("0201"),{0:[Nt,Bt],1:[dn],2:[dn]}),R(S,y("1020"),{0:[Dt,wt],1:[gn],2:[gn]}),R(S,y("2010"),{0:[It,Ut],1:[hn],2:[hn]}),R(S,y("2020"),{0:[Ut,wt],1:[Tf],2:[Ft,Bt]}),R(S,y("0202"),{0:[Bt,Ft],1:[Tf],2:[Ut,wt]}),S);function bf(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 Sf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bf(Object(r),!0).forEach(function(n){qg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bf(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 Ge={ISO_LINES:1,ISO_BANDS:2},Qg={zIndex:0,zOffset:.005};function gr(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function yf(e){var t=e.cellWeights,r=e.x,n=e.y,i=e.width,o=e.height,a=e.threshold;e.thresholdValue&&(Rf.log.deprecated("thresholdValue","threshold")(),a=e.thresholdValue);var s=r<0,f=r>=i-1,l=n<0,u=n>=o-1,c=s||f||l||u,d={},g={};s||u?g.top=0:(d.top=t[(n+1)*i+r],g.top=gr(d.top,a)),f||u?g.topRight=0:(d.topRight=t[(n+1)*i+r+1],g.topRight=gr(d.topRight,a)),f||l?g.right=0:(d.right=t[n*i+r+1],g.right=gr(d.right,a)),s||l?g.current=0:(d.current=t[n*i+r],g.current=gr(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=gr((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,f=s===void 0?Ge.ISO_LINES:s,l=Sf(Sf({},Qg),e.thresholdData),u=f===Ge.ISO_BANDS?mf[o]:vf[o];Array.isArray(u)||(u=u[a]);var c=l.zIndex*l.zOffset,d=(n+1)*r[0],g=(i+1)*r[1],h=t[0]+d,A=t[1]+g;if(f===Ge.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 Ef(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(l){throw l},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,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Jg(e,t){if(e){if(typeof e=="string")return xf(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 xf(e,t)}}function xf(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 Of(e){var t=e.thresholdData,r=e.cellWeights,n=e.gridSize,i=e.gridOrigin,o=e.cellSize,a=[],s=[],f=n[0],l=n[1],u=0,c=0,d=Ef(t),g;try{for(d.s();!(g=d.n()).done;)for(var h=g.value,A=h.contour,_=A.threshold,v=-1;v<f;v++)for(var T=-1;T<l;T++){var m=yf({cellWeights:r,threshold:_,x:v,y:T,width:f,height:l}),E=m.code,O=m.meanCode,C={type:Ge.ISO_BANDS,gridOrigin:i,cellSize:o,x:v,y:T,width:f,height:l,code:E,meanCode:O,thresholdData:h};if(Array.isArray(_)){C.type=Ge.ISO_BANDS;var N=yi(C),I=Ef(N),U;try{for(I.s();!(U=I.n()).done;){var W=U.value;s[c++]={vertices:W,contour:A}}}catch(oe){I.e(oe)}finally{I.f()}}else{C.type=Ge.ISO_LINES;for(var j=yi(C),Z=0;Z<j.length;Z+=2)a[u++]={start:j[Z],end:j[Z+1],contour:A}}}}catch(oe){d.e(oe)}finally{d.f()}return{contourSegments:a,contourPolygons:s}}var If=P($());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 Cf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hr(e,t,r){return typeof Reflect<"u"&&Reflect.get?hr=Reflect.get:hr=function(i,o,a){var s=eh(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},hr(e,t,r||e)}function eh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=et(e),e!==null););return e}function th(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&&Ei(e,t)}function Ei(e,t){return Ei=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ei(e,t)}function rh(e){var t=oh();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 nh(this,i)}}function nh(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 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 oh(){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)}var Pf=[255,255,255,255],ah=1,sh=1,fh={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:sh}],optional:!0,compare:3},zOffset:.005},Nf="positions",lh={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},An=function(e){th(r,e);var t=rh(r);function r(){var i;Gg(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;hr(et(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:lh}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:w.SUM}}});var a=this.getAttributeManager();a.add((o={},Cf(o,Nf,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),Cf(o,"count",{size:3,accessor:"getWeight"}),o))},n.updateState=function(o){hr(et(r.prototype),"updateState",this).call(this,o);var a=!1,s=o.oldProps,f=o.props,l=this.state.aggregationDirty;(s.contours!==f.contours||s.zOffset!==f.zOffset)&&(a=!0,this._updateThresholdData(o.props)),this.getNumInstances()>0&&(l||a)&&this._generateContours()},n.renderLayers=function(){var o=this.state.contourData,a=o.contourSegments,s=o.contourPolygons,f=this.getSubLayerClass("lines",pn.LineLayer),l=this.getSubLayerClass("bands",pn.SolidPolygonLayer),u=a&&a.length>0&&new f(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:function(g){return g.start},getTargetPosition:function(g){return g.end},getColor:function(g){return g.contour.color||Pf},getWidth:function(g){return g.contour.strokeWidth||ah}}),c=s&&s.length>0&&new l(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:function(g){return g.vertices},getFillColor:function(g){return g.contour.color||Pf}});return[u,c]},n.updateAggregationState=function(o){var a=o.props,s=o.oldProps,f=a.cellSize,l=a.coordinateSystem,u=this.context.viewport,c=s.cellSize!==f,d=a.gpuAggregation;this.state.gpuAggregation!==a.gpuAggregation&&d&&!ee.isSupported(this.context.device)&&(If.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),d=!1);var g=d!==this.state.gpuAggregation;this.setState({gpuAggregation:d});var h=this.state.dimensions,A=this.isAttributeChanged(Nf),_=h.data,v=h.weights,T=this.state.boundingBox;if(A&&(T=Gr(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:T})),A||c){var m=en(T,f,u,l),E=m.gridOffset,O=m.translation,C=m.width,N=m.height,I=m.numCol,U=m.numRow;this.allocateResources(U,I),this.setState({gridOffset:E,boundingBox:T,translation:O,posOffset:O.slice(),gridOrigin:[-1*O[0],-1*O[1]],width:C,height:N,numCol:I,numRow:U})}var W=A||g||this.isAggregationDirty(o,{dimension:_,compareAll:d}),j=this.isAggregationDirty(o,{dimension:v});j&&this._updateAccessors(o),(W||j)&&this._resetResults(),this.setState({aggregationDataDirty:W,aggregationWeightsDirty:j})},n._updateAccessors=function(o){var a=o.props,s=a.getWeight,f=a.aggregation,l=a.data,u=this.state.weights.count;u&&(u.getWeight=s,u.operation=w[f]),this.setState({getValue:_t(f,s,{data:l})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},n._generateContours=function(){var o=this.state,a=o.numCol,s=o.numRow,f=o.gridOrigin,l=o.gridOffset,u=o.thresholdData,c=this.state.weights.count,d=c.aggregationData;d||(d=c.aggregationBuffer.readSyncWebGL2(),c.aggregationData=d);var g=ee.getCellData({countsData:d}),h=g.cellWeights,A=Of({thresholdData:u,cellWeights:h,gridSize:[a,s],gridOrigin:f,cellSize:[l.xOffset,l.yOffset]});this.setState({contourData:A})},n._updateThresholdData=function(o){for(var a=o.contours,s=o.zOffset,f=a.length,l=new Array(f),u=0;u<f;u++){var c=a[u];l[u]={contour:c,zIndex:c.zIndex||u,zOffset:s}}this.setState({thresholdData:l})},r}(Qe);An.layerName="ContourLayer";An.defaultProps=fh;var Xf=P($());var Hf=P($());var ie=P($());var Mf=`#version 300 es
523
523
  #define SHADER_NAME gpu-grid-cell-layer-vertex-shader
524
524
  #define RANGE_COUNT 6
525
525
 
@@ -625,7 +625,7 @@ void main(void) {
625
625
  vColor = vec4(color.rgb, color.a * opacity) / 255.;
626
626
  }
627
627
  }
628
- `;var Ml=`#version 300 es
628
+ `;var Df=`#version 300 es
629
629
  #define SHADER_NAME gpu-grid-cell-layer-fragment-shader
630
630
 
631
631
  precision highp float;
@@ -638,9 +638,9 @@ void main(void) {
638
638
  fragColor = vColor;
639
639
  fragColor = picking_filterColor(fragColor);
640
640
  }
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 Uh(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 Wh(e){if(Array.isArray(e))return e}function Hh(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=zl(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.
643
- 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 zl(e,t){if(e){if(typeof e=="string")return Vl(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 Vl(e,t)}}function Vl(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 jl(e){var t=e.map(function(s){return s[0]}),r=e.map(function(s){return s[1]}),n=Math.min.apply(null,t),i=Math.max.apply(null,t),o=Math.min.apply(null,r),a=Math.max.apply(null,r);return[n,o,i,a]}function kl(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var Xl=new Float32Array(12);function Ii(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=0,n=Hh(e),i;try{for(n.s();!(i=n.n()).done;)for(var o=i.value,a=0;a<t;a++)Xl[r++]=o[a]||0}catch(s){n.e(s)}finally{n.f()}return Xl}function $l(e,t,r){var n=Ll(e,4),i=n[0],o=n[1],a=n[2],s=n[3],l=a-i,f=s-o,u=l,c=f;l/f<t/r?u=t/r*f:c=r/t*l,u<t&&(u=t,c=r);var d=(a+i)/2,g=(s+o)/2;return[d-u/2,g-c/2,d+u/2,g+c/2]}function Kl(e,t){var r=Ll(t,4),n=r[0],i=r[1],o=r[2],a=r[3];return[(e[0]-n)/(o-n),(e[1]-i)/(a-i)]}function Yl(e){var t=e.device,r=e.floatTargetSupport;return r?{format:t.info.type==="webgl2"?34836:6408,type:5126}:{format:6408,type:5121}}var be=P($());var Pn=P($());var Zl=`#version 300 es
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 Ff(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 wf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ff(Object(r),!0).forEach(function(n){uh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ff(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 f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},vn(e,t,r||e)}function dh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Vt(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=Vt(e),i;if(t){var o=Vt(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 Vt(e){return Vt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Vt(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(Vt(r.prototype),"getShaders",this).call(this,{vs:Mf,fs:Df,modules:[ie.project32,ie.gouraudLighting,ie.picking,ot]})},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,wf(wf({},this.getShaders()),{},{id:this.props.id,geometry:new Kt,isInstanced:!0}))},n.draw=function(o){var a=o.uniforms,s=this.props,f=s.cellSize,l=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=He(this.props.colorRange);this.bindUniformBuffers(v,T),m.setUniforms(a),m.setUniforms(C),m.setUniforms({cellSize:f,offset:l,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,f={};return a!==null?(f.colorDomainValid=!0,f.colorDomain=a):f.colorDomainValid=!1,s!==null?(f.elevationDomainValid=!0,f.elevationDomain=s):f.elevationDomainValid=!1,f},n._setupUniformBuffer=function(o){var a=o.pipeline.handle,s=this.context.gl,f=s.getUniformBlockIndex(a,"ColorData"),l=s.getUniformBlockIndex(a,"ElevationData");s.uniformBlockBinding(a,f,xi),s.uniformBlockBinding(a,l,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 Bf(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 Uf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bf(Object(r),!0).forEach(function(n){Sn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bf(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 Xt(e,t,r){return typeof Reflect<"u"&&Reflect.get?Xt=Reflect.get:Xt=function(i,o,a){var s=mh(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},Xt(e,t,r||e)}function mh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=ze(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=ze(e),i;if(t){var o=ze(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 ze(e){return ze=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ze(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"]}},Wf="positions",tt=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,f=ee.isSupported(s);f||Hf.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),Xt(ze(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Oh}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:f,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 l=this.getAttributeManager();l.add((a={},Sn(a,Wf,{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){Xt(ze(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,f=a.numCol,l=a.boundingBox,u=a.gridOffset,c=[f,s],d=[l.xMin,l.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,f=a.numCol,l=a.boundingBox,u=a.gridOffset,c=[f,s],d=[l.xMin,l.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,f=a.index,l=null;if(f>=0){var u=this.state.gpuGridAggregator,c=this.getPositionForIndex(f),d=ee.getAggregationData(Uf({pixelIndex:f},u.getData("color"))),g=ee.getAggregationData(Uf({pixelIndex:f},u.getData("elevation")));if(l={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=Rt(h,{gridOffset:v,attributes:O,viewport:E,translation:T,boundingBox:m});A=C.gridHash,this.setState({gridHash:A})}var N=this.getHashKeyForIndex(f),I=A[N];Object.assign(l,I)}}return a.picked=Boolean(l),a.object=l,a},n.renderLayers=function(){if(!this.state.isSupported)return null;var o=this.props,a=o.elevationScale,s=o.extruded,f=o.cellSize,l=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=He(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:f,coverage:l,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,f=a.elevation;[s,f].forEach(function(l){var u=l.aggregationBuffer,c=l.maxMinBuffer;c?.destroy(),u?.destroy()}),Xt(ze(r.prototype),"finalizeState",this).call(this,o)},n.updateAggregationState=function(o){var a=o.props,s=o.oldProps,f=a.cellSize,l=a.coordinateSystem,u=this.context.viewport,c=s.cellSize!==f,d=this.state.dimensions,g=this.isAttributeChanged(Wf),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,f,u,l),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,f=a.elevationAggregation,l=this.state.weights,u=l.color,c=l.elevation;u.operation=w[s],c.operation=w[f]},r}(Qe);tt.layerName="GPUGridLayer";tt.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&&Ii(e,t)}function Ii(e,t){return Ii=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ii(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 Ih(this,i)}}function Ih(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 Mh(e)}function Mh(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 Vf(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?Vf(Object(r),!0).forEach(function(n){Fh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vf(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({},tt.defaultProps),Je.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:!1}},n.updateState=function(o){var a=o.props;this.setState({useGPUAggregation:!1})},n.renderLayers=function(){var o=this.props,a=o.data,s=o.updateTriggers,f=this.state.useGPUAggregation?"GPU":"CPU",l=this.state.useGPUAggregation?this.getSubLayerClass("GPU",tt):this.getSubLayerClass("CPU",Je);return new l(this.props,this.getSubLayerProps({id:f,updateTriggers:s}),{data:a})},n.canUseGPUAggregation=function(o){var a=o.gpuAggregation,s=o.lowerPercentile,f=o.upperPercentile,l=o.getColorValue,u=o.getElevationValue,c=o.colorScaleType;return!(!a||!ee.isSupported(this.context.device)||s!==0||f!==100||l!==null||u!==null||c==="quantile"||c==="ordinal")},r}(Xf.CompositeLayer);En.layerName="GridLayer";En.defaultProps=wh;function jf(e,t){return Wh(e)||Uh(e,t)||kf(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 Uh(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(f){o=!0,s=f}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function Wh(e){if(Array.isArray(e))return e}function Hh(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=kf(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
643
+ 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 l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function kf(e,t){if(e){if(typeof e=="string")return Lf(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 Lf(e,t)}}function Lf(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 $f(e){var t=e.map(function(s){return s[0]}),r=e.map(function(s){return s[1]}),n=Math.min.apply(null,t),i=Math.max.apply(null,t),o=Math.min.apply(null,r),a=Math.max.apply(null,r);return[n,o,i,a]}function Kf(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var zf=new Float32Array(12);function Mi(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=0,n=Hh(e),i;try{for(n.s();!(i=n.n()).done;)for(var o=i.value,a=0;a<t;a++)zf[r++]=o[a]||0}catch(s){n.e(s)}finally{n.f()}return zf}function Yf(e,t,r){var n=jf(e,4),i=n[0],o=n[1],a=n[2],s=n[3],f=a-i,l=s-o,u=f,c=l;f/l<t/r?u=t/r*l:c=r/t*f,u<t&&(u=t,c=r);var d=(a+i)/2,g=(s+o)/2;return[d-u/2,g-c/2,d+u/2,g+c/2]}function Zf(e,t){var r=jf(t,4),n=r[0],i=r[1],o=r[2],a=r[3];return[(e[0]-n)/(o-n),(e[1]-i)/(a-i)]}function qf(e){var t=e.device,r=e.floatTargetSupport;return r?{format:t.info.type==="webgl2"?34836:6408,type:5126}:{format:6408,type:5121}}var be=P($());var Pn=P($());var Qf=`#version 300 es
644
644
  #define SHADER_NAME heatp-map-layer-vertex-shader
645
645
 
646
646
  uniform sampler2D maxTexture;
@@ -669,7 +669,7 @@ void main(void) {
669
669
  vIntensityMax = intensity / maxValue;
670
670
  vIntensityMin = intensity / minValue;
671
671
  }
672
- `;var ql=`#version 300 es
672
+ `;var Jf=`#version 300 es
673
673
  #define SHADER_NAME triangle-layer-fragment-shader
674
674
 
675
675
  precision highp float;
@@ -707,7 +707,7 @@ void main(void) {
707
707
  linearColor.a *= opacity;
708
708
  fragColor = linearColor;
709
709
  }
710
- `;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 Ql(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 xn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ql(Object(r),!0).forEach(function(n){Vh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ql(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lh(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&&Di(e,t)}function Di(e,t){return Di=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Di(e,t)}function zh(e){var t=$h();return function(){var n=Cn(e),i;if(t){var o=Cn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return jh(this,i)}}function jh(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 kh(e)}function kh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $h(){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 Cn(e){return Cn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Cn(e)}var Fi=function(e){Lh(r,e);var t=zh(r);function r(){var i;Xh(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{vs:Zl,fs:ql,modules:[Pn.project32]}},n.initializeState=function(o){var a=o.device,s=this.getAttributeManager();s.add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(a)})},n._getModel=function(o){var a=this.props.vertexCount;return new Y(o,xn(xn({},this.getShaders()),{},{id:this.props.id,geometry:new Re({topology:"triangle-fan-webgl",vertexCount:a})}))},n.draw=function(o){var a=o.uniforms,s=this.state.model,l=this.props,f=l.texture,u=l.maxTexture,c=l.colorTexture,d=l.intensity,g=l.threshold,h=l.aggregationMode,A=l.colorDomain;s.setUniforms(xn(xn({},a),{},{texture:f,maxTexture:u,colorTexture:c,intensity:d,threshold:g,aggregationMode:h,colorDomain:A})),s.draw(this.context.renderPass)},r}(Pn.Layer);Fi.layerName="TriangleLayer";var Jl=`#version 300 es
710
+ `;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 Gf(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 xn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gf(Object(r),!0).forEach(function(n){Vh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lh(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&&Di(e,t)}function Di(e,t){return Di=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Di(e,t)}function zh(e){var t=$h();return function(){var n=Cn(e),i;if(t){var o=Cn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return jh(this,i)}}function jh(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 kh(e)}function kh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $h(){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 Cn(e){return Cn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Cn(e)}var Fi=function(e){Lh(r,e);var t=zh(r);function r(){var i;Xh(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{vs:Qf,fs:Jf,modules:[Pn.project32]}},n.initializeState=function(o){var a=o.device,s=this.getAttributeManager();s.add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(a)})},n._getModel=function(o){var a=this.props.vertexCount;return new Y(o,xn(xn({},this.getShaders()),{},{id:this.props.id,geometry:new Re({topology:"triangle-fan-webgl",vertexCount:a})}))},n.draw=function(o){var a=o.uniforms,s=this.state.model,f=this.props,l=f.texture,u=f.maxTexture,c=f.colorTexture,d=f.intensity,g=f.threshold,h=f.aggregationMode,A=f.colorDomain;s.setUniforms(xn(xn({},a),{},{texture:l,maxTexture:u,colorTexture:c,intensity:d,threshold:g,aggregationMode:h,colorDomain:A})),s.draw(this.context.renderPass)},r}(Pn.Layer);Fi.layerName="TriangleLayer";var el=`#version 300 es
711
711
  in vec3 positions;
712
712
  in vec3 positions64Low;
713
713
  in float weights;
@@ -727,7 +727,7 @@ void main()
727
727
  gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
728
728
  gl_Position.xy = (gl_Position.xy * 2.) - (1.);
729
729
  }
730
- `;var Gl=`#version 300 es
730
+ `;var tl=`#version 300 es
731
731
  in vec4 weightsTexture;
732
732
  out vec4 fragColor;
733
733
  float gaussianKDE(float u){
@@ -742,7 +742,7 @@ void main()
742
742
  fragColor = weightsTexture * gaussianKDE(2. * dist);
743
743
  DECKGL_FILTER_COLOR(fragColor, geometry);
744
744
  }
745
- `;var ef=`#version 300 es
745
+ `;var rl=`#version 300 es
746
746
  in vec4 inTexture;
747
747
  out vec4 outTexture;
748
748
 
@@ -752,14 +752,14 @@ outTexture = inTexture;
752
752
  gl_Position = vec4(0, 0, 0, 1.);
753
753
  gl_PointSize = 1.0;
754
754
  }
755
- `;var tf=`#version 300 es
755
+ `;var nl=`#version 300 es
756
756
  in vec4 outTexture;
757
757
  out vec4 fragColor;
758
758
  void main() {
759
759
  fragColor = outTexture;
760
760
  fragColor.g = outTexture.r / max(1.0, outTexture.a);
761
761
  }
762
- `;function Nn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nn=function(r){return typeof r}:Nn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Nn(e)}function rf(e,t){return qh(e)||Zh(e,t)||Yh(e,t)||Kh()}function Kh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
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);})();
762
+ `;function Nn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nn=function(r){return typeof r}:Nn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Nn(e)}function il(e,t){return qh(e)||Zh(e,t)||Yh(e,t)||Kh()}function Kh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
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 ol(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 ol(e,t)}}function ol(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(f){o=!0,s=f}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 al(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 Lt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?al(Object(r),!0).forEach(function(n){Qh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):al(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 rt(e,t,r){return typeof Reflect<"u"&&Reflect.get?rt=Reflect.get:rt=function(i,o,a){var s=Gh(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},rt(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"}},sl=[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}},f_=["blend-minmax-webgl1","texture-formats-float32-webgl1"],l_=["texture-renderable-float32-webgl","texture-blend-float-webgl1"],u_={data:{props:["radiusPixels"]}},In=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(!f_.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}rt(Ce(r.prototype),"initializeAggregationLayer",this).call(this,u_),this.setState({supported:!0,colorDomain:sl}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()},n.shouldUpdateState=function(o){var a=o.changeFlags;return a.somethingChanged},n.updateState=function(o){this.state.supported&&(rt(Ce(r.prototype),"updateState",this).call(this,o),this._updateHeatmapState(o))},n._updateHeatmapState=function(o){var a=o.props,s=o.oldProps,f=this._getChangeFlags(o);(f.dataChanged||f.viewportChanged)&&(f.boundsChanged=this._updateBounds(f.dataChanged),this._updateTextureRenderingBounds()),f.dataChanged||f.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):f.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,f=o.triTexCoordBuffer,l=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:f}},vertexCount:4,maxTexture:l,colorTexture:u,aggregationMode:a_[_]||0,texture:a,intensity:h,threshold:A,colorDomain:c})},n.finalizeState=function(o){rt(Ce(r.prototype),"finalizeState",this).call(this,o);var a=this.state,s=a.weightsTransform,f=a.weightsTexture,l=a.maxWeightTransform,u=a.maxWeightsTexture,c=a.triPositionBuffer,d=a.triTexCoordBuffer,g=a.colorTexture,h=a.updateTimer;s?.destroy(),f?.destroy(),l?.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 f=this.state.zoom;return(!o.context.viewport||o.context.viewport.zoom!==f)&&(a.viewportZoomChanged=!0),a},n._createTextures=function(){var o=this.state,a=o.textureSize,s=o.format,f=o.type;this.setState({weightsTexture:this.context.device.createTexture(Lt({width:a,height:a,format:s,type:f},wi)),maxWeightsTexture:this.context.device.createTexture(Lt({format:s,type:f},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),f=l_.every(function(g){return o.features.has(g)}),l=qf({device:o,floatTargetSupport:f}),u=l.format,c=l.type,d=f?1:1/255;this.setState({textureSize:s,format:u,type:c,weightsScale:d}),f||be.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, fallingback to low precession format"))()},n.getShaders=function(o){return rt(Ce(r.prototype),"getShaders",this).call(this,o==="max-weights-transform"?{vs:rl,_fs:nl}:{vs:el,_fs:tl})},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,Lt({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,f=o.maxWeightsTexture,l=this.getShaders("weights-transform");this._createWeightsTransform(l);var u=this.getShaders("max-weights-transform"),c=new Me(this.context.device,Lt(Lt({id:"".concat(this.id,"-max-weights-transform"),_sourceTextures:{inTexture:s},_targetTexture:f,_targetTextureVarying:"outTexture"},u),{},{elementCount:a*a}));this.setState({weightsTexture:s,maxWeightsTexture:f,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)}),f=$f(s),l={visibleWorldBounds:f,viewportCorners:s},u=!1;if(o||!this.state.worldBounds||!Kf(this.state.worldBounds,f)){var c=this._worldToCommonBounds(f),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);l.worldBounds=d,l.normalizedCommonBounds=g,u=!0}return this.setState(l),u},n._updateTextureRenderingBounds=function(){var o=this.state,a=o.triPositionBuffer,s=o.triTexCoordBuffer,f=o.normalizedCommonBounds,l=o.viewportCorners,u=this.context.viewport;a.write(Mi(l,3));var c=l.map(function(d){return Zf(u.projectPosition(d),f)});s.write(Mi(c,2))},n._updateColorTexture=function(o){var a=o.props.colorRange,s=this.state.colorTexture,f=He(a,!1,Uint8Array);s?s.setImageData({data:f,width:a.length}):s=this.context.device.createTexture(Lt({data:f,width:a.length,height:1},wi)),this.setState({colorTexture:s})},n._updateWeightmap=function(){var o=this,a=this.props,s=a.radiusPixels,f=a.colorDomain,l=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(f&&l==="SUM"){var _=this.context.viewport,v=_.distanceScales.metersPerUnit[2]*(A[2]-A[0])/d;this.state.colorDomain=f.map(function(m){return m*v*g})}else this.state.colorDomain=f||sl;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,f=s===void 0?!1:s,l=il(o,4),u=l[0],c=l[1],d=l[2],g=l[3],h=this.context.viewport,A=this.state.textureSize,_=this.props.coordinateSystem,v=f&&(_===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 f&&!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])),Yf([E[0]-T[0],E[1]-T[1],O[0]-T[0],O[1]-T[1]],m,m)},n._commonToWorldBounds=function(o){var a=il(o,4),s=a[0],f=a[1],l=a[2],u=a[3],c=this.context.viewport,d=c.unprojectPosition([s,f]),g=c.unprojectPosition([l,u]);return d.slice(0,2).concat(g.slice(0,2))},r}(ce);In.layerName="HeatmapLayer";In.defaultProps=s_;return _l(_r);})();
764
764
  return __exports__;
765
765
  });