r,cN:()=>i,fb:()=>a})},23140:(e,t,n)=>{"use strict";n.d(t,{E:()=>i});var r=n(8766);function i(e,t,n){const r=o(e),i=Object.keys(r).filter((e=>r[e]!==Array));return function(e,t,n){const{pointPositionsCount:r,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:c,lineFeaturesCount:d,polygonPositionsCount:f,polygonObjectsCount:p,polygonRingsCount:g,polygonFeaturesCount:m,propArrayTypes:A,coordLength:v}=t,{numericPropKeys:y=[],PositionDataType:b=Float32Array}=n,_=e[0]&&"id"in e[0],w=e.length>65535?Uint32Array:Uint16Array,x={type:"Point",positions:new b(r*v),globalFeatureIds:new w(r),featureIds:i>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},E={type:"LineString",pathIndices:o>65535?new Uint32Array(c+1):new Uint16Array(c+1),positions:new b(o*v),globalFeatureIds:new w(o),featureIds:d>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},S={type:"Polygon",polygonIndices:f>65535?new Uint32Array(p+1):new Uint16Array(p+1),primitivePolygonIndices:f>65535?new Uint32Array(g+1):new Uint16Array(g+1),positions:new b(f*v),triangles:[],globalFeatureIds:new w(f),featureIds:m>65535?new Uint32Array(f):new Uint16Array(f),numericProps:{},properties:[],fields:[]};for(const a of[x,E,S])for(const e of y){const t=A[e];a.numericProps[e]=new t(a.positions.length/v)}E.pathIndices[c]=o,S.polygonIndices[p]=f,S.primitivePolygonIndices[g]=f;const C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const u of e){const e=u.geometry,t=u.properties||{};switch(e.type){case"Point":a(e,x,C,v,t),x.properties.push(h(t,y)),_&&x.fields.push({id:u.id}),C.pointFeature++;break;case"LineString":s(e,E,C,v,t),E.properties.push(h(t,y)),_&&E.fields.push({id:u.id}),C.lineFeature++;break;case"Polygon":l(e,S,C,v,t),S.properties.push(h(t,y)),_&&S.fields.push({id:u.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return function(e,t,n,r){return{points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:u(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:u(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},triangles:{value:new Uint32Array(n.triangles),size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:u(n.numericProps,1)}}}(x,E,S,v)}(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||i,PositionDataType:n?n.PositionDataType:Float32Array})}function o(e){const t={};for(const n of e)if(n.properties)for(const e in n.properties){const r=n.properties[e];t[e]=f(r,t[e])}return t}function a(e,t,n,r,i){t.positions.set(e.data,n.pointPosition*r);const o=e.data.length/r;d(t,i,n.pointPosition,o),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+o),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+o),n.pointPosition+=o}function s(e,t,n,r,i){t.positions.set(e.data,n.linePosition*r);const o=e.data.length/r;d(t,i,n.linePosition,o),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+o),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+o);for(let a=0,s=e.indices.length;a(e-d)/s)),f=(0,r.earcut)(u,h,s,t);for(let r=0,p=f.length;r{"use strict";function r(e,t){if(!e)throw new Error(t||"loader assertion failed.")}n.d(t,{h:()=>r})},69113:(e,t,n)=>{"use strict";n.d(t,{jU:()=>r});"undefined"!==typeof self&&self,"undefined"!==typeof window&&window,"undefined"!==typeof n.g&&n.g,"undefined"!==typeof document&&document;const r=Boolean("object"!==typeof process||"[object process]"!==String(process)||process.browser),i="undefined"!==typeof process&&process.version&&/v([0-9]*)/.exec(process.version);i&&parseFloat(i[1])},45802:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.readTag=t.readFeature=t.project=t.classifyRings=void 0;const r=n(8766);function i(e,t){const n=e.readVarint()+e.pos;for(;e.pos{"use strict";function n(e){let t=0;for(let n,r,i=0,o=e.length-1;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TEST_EXPORTS=void 0;const r=n(45802);let i,o,a,s,l,c,u;t.TEST_EXPORTS={classifyRings:r.classifyRings};t.default=class{constructor(e,t,n,i,o,a){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=a,e.readFields(r.readFeature,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry,i=e.readVarint()+e.pos,o=1,s=0,l=0,c=0,u=0;const t=[],n=[];for(;e.pos>3),s--,1===o||2===o)l+=e.readSVarint(),c+=e.readSVarint(),1===o&&t.push(u),n.push(l,c),u+=2;else{if(7!==o)throw new Error("unknown command ".concat(o));if(u>0){const e=t[t.length-1];n.push(n[e],n[e+1]),u+=2}}return{data:n,indices:t}}_toBinaryCoordinates(e){const t=this.loadGeometry();let n;e(t.data,this);switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/2,n={type:"LineString",...t};break;case 3:n=(0,r.classifyRings)(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(const e of n.indices)this._geometryInfo.polygonRingsCount+=e.length;this._geometryInfo.polygonPositionsCount+=n.data.length/2;break;default:throw new Error("Invalid geometry type: ".concat(this.type))}const i={type:"Feature",geometry:n,properties:this.properties};return null!==this.id&&(i.id=this.id),i}toBinaryCoordinates(e){if("function"===typeof e)return this._toBinaryCoordinates(e);const{x:t,y:n,z:i}=e,o=this.extent*Math.pow(2,i),a=this.extent*t,s=this.extent*n;return this._toBinaryCoordinates((e=>(0,r.project)(e,a,s,o)))}}},29243:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(30500));function o(e,t,n){t&&n&&(15===e?t.version=n.readVarint():1===e?t.name=n.readString():5===e?t.extent=n.readVarint():2===e?t._features.push(n.pos):3===e?t._keys.push(n.readString()):4===e&&t._values.push(function(e){let t=null;const n=e.readVarint()+e.pos;for(;e.pos>3;t=1===n?e.readString():2===n?e.readFloat():3===n?e.readDouble():4===n?e.readVarint64():5===n?e.readVarint():6===n?e.readSVarint():7===n?e.readBoolean():null}return t}(n)))}t.default=class{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(o,this,t),this.length=this._features.length}feature(e,t){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const n=this._pbf.readVarint()+this._pbf.pos;return new i.default(this._pbf,n,this.extent,this._keys,this._values,t)}}},27615:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(29243));function o(e,t,n){if(3===e&&n){const e=new i.default(n,n.readVarint()+n.pos);e.length&&t&&(t[e.name]=e)}}t.default=class{constructor(e,t){this.layers=e.readFields(o,{},t)}}},85847:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(69209);class i{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(e,t,n,i,o){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,e.readFields(r.readFeature,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let n=1,r=0,i=0,o=0;const a=[];let s;for(;e.pos>3}if(r--,1===n||2===n)i+=e.readSVarint(),o+=e.readSVarint(),1===n&&(s&&a.push(s),s=[]),s&&s.push([i,o]);else{if(7!==n)throw new Error("unknown command ".concat(n));s&&s.push(s[0].slice())}}return s&&a.push(s),a}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let n=1,r=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;for(;e.pos>3}if(r--,1===n||2===n)i+=e.readSVarint(),o+=e.readSVarint(),is&&(s=i),oc&&(c=o);else if(7!==n)throw new Error("unknown command ".concat(n))}return[a,l,s,c]}_toGeoJSON(e){let t,n,o=this.loadGeometry(),a=i.types[this.type];switch(this.type){case 1:const i=[];for(t=0;t>3;t=1===n?e.readString():2===n?e.readFloat():3===n?e.readDouble():4===n?e.readVarint64():5===n?e.readVarint():6===n?e.readSVarint():7===n?e.readBoolean():null}return t}(n)))}t.default=class{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(o,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new i.default(this._pbf,t,this.extent,this._keys,this._values)}}},36452:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(34925));function o(e,t,n){if(3===e&&n){const e=new i.default(n,n.readVarint()+n.pos);e.length&&t&&(t[e.name]=e)}}t.default=class{constructor(e,t){this.layers=e.readFields(o,{},t)}}},64274:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(68072),o=r(n(30576)),a=r(n(36452)),s=r(n(27615));function l(e,t){const[n,r]=function(e,t){const n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];const i=new s.default(new o.default(e)),a=t&&Array.isArray(t.layers)?t.layers:Object.keys(i.layers);return a.forEach((e=>{const o=i.layers[e];if(o)for(let i=0;i{const i=r.layers[e];if(i)for(let r=0;r{"use strict";n.d(t,{Z:()=>r});const r={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,FUNC_ADD:32774,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,BLEND_COLOR:32773,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,VENDOR:7936,RENDERER:7937,VERSION:7938,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,BROWSER_DEFAULT_WEBGL:37444,STATIC_DRAW:35044,STREAM_DRAW:35040,DYNAMIC_DRAW:35048,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,CULL_FACE:2884,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,BLEND:3042,DEPTH_TEST:2929,DITHER:3024,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,SCISSOR_TEST:3089,STENCIL_TEST:2960,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CONTEXT_LOST_WEBGL:37442,CW:2304,CCW:2305,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,COMPILE_STATUS:35713,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_ATTRIBUTES:35721,ACTIVE_UNIFORMS:35718,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,ALWAYS:519,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,GEQUAL:518,NOTEQUAL:517,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,TEXTURE_WIDTH:4096,TEXTURE_HEIGHT:4097,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,MAX_3D_TEXTURE_SIZE:32883,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,MAX_TEXTURE_LOD_BIAS:34045,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,RASTERIZER_DISCARD:35977,VERTEX_ARRAY_BINDING:34229,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,MAX_ELEMENT_INDEX:36203,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,RGB9_E5:35901,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2UI:36975,TEXTURE_IMMUTABLE_FORMAT:37167,TEXTURE_IMMUTABLE_LEVELS:33503,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,UNSIGNED_INT_24_8:34042,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,INT_2_10_10_10_REV:36255,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,MAX_SAMPLES:36183,SAMPLER_BINDING:35097,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,UNSIGNED_NORMALIZED:35863,SIGNED_NORMALIZED:36764,VERTEX_ATTRIB_ARRAY_INTEGER:35069,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,DEPTH24_STENCIL8:35056,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,COLOR:6144,DEPTH:6145,STENCIL:6146,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,INVALID_INDEX:4294967295,TIMEOUT_IGNORED:-1,MAX_CLIENT_WAIT_TIMEOUT_WEBGL:37447,VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,UNMASKED_VENDOR_WEBGL:37445,UNMASKED_RENDERER_WEBGL:37446,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047,TEXTURE_MAX_ANISOTROPY_EXT:34046,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35986,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,UNSIGNED_INT_24_8_WEBGL:34042,HALF_FLOAT_OES:36193,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863,MIN_EXT:32775,MAX_EXT:32776,SRGB_EXT:35904,SRGB_ALPHA_EXT:35906,SRGB8_ALPHA8_EXT:35907,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:33296,FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723,COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067,COLOR_ATTACHMENT4_WEBGL:36068,COLOR_ATTACHMENT5_WEBGL:36069,COLOR_ATTACHMENT6_WEBGL:36070,COLOR_ATTACHMENT7_WEBGL:36071,COLOR_ATTACHMENT8_WEBGL:36072,COLOR_ATTACHMENT9_WEBGL:36073,COLOR_ATTACHMENT10_WEBGL:36074,COLOR_ATTACHMENT11_WEBGL:36075,COLOR_ATTACHMENT12_WEBGL:36076,COLOR_ATTACHMENT13_WEBGL:36077,COLOR_ATTACHMENT14_WEBGL:36078,COLOR_ATTACHMENT15_WEBGL:36079,DRAW_BUFFER0_WEBGL:34853,DRAW_BUFFER1_WEBGL:34854,DRAW_BUFFER2_WEBGL:34855,DRAW_BUFFER3_WEBGL:34856,DRAW_BUFFER4_WEBGL:34857,DRAW_BUFFER5_WEBGL:34858,DRAW_BUFFER6_WEBGL:34859,DRAW_BUFFER7_WEBGL:34860,DRAW_BUFFER8_WEBGL:34861,DRAW_BUFFER9_WEBGL:34862,DRAW_BUFFER10_WEBGL:34863,DRAW_BUFFER11_WEBGL:34864,DRAW_BUFFER12_WEBGL:34865,DRAW_BUFFER13_WEBGL:34866,DRAW_BUFFER14_WEBGL:34867,DRAW_BUFFER15_WEBGL:34868,MAX_COLOR_ATTACHMENTS_WEBGL:36063,MAX_DRAW_BUFFERS_WEBGL:34852,VERTEX_ARRAY_BINDING_OES:34229,QUERY_COUNTER_BITS_EXT:34916,CURRENT_QUERY_EXT:34917,QUERY_RESULT_EXT:34918,QUERY_RESULT_AVAILABLE_EXT:34919,TIME_ELAPSED_EXT:35007,TIMESTAMP_EXT:36392,GPU_DISJOINT_EXT:36795}},16621:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(39042),i=n(59661);const o={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class a{static get DRAW_MODE(){return o}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t=(0,r.hQ)("geometry"),drawMode:n=o.TRIANGLES,attributes:i={},indices:a=null,vertexCount:s=null}=e;this.id=t,this.drawMode=0|n,this.attributes={},this.userData={},this._setAttributes(i,a),this.vertexCount=s||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return"Geometry ".concat(this.id," attribute ").concat(e)}_setAttributes(e,t){t&&(this.indices=ArrayBuffer.isView(t)?{value:t,size:1}:t);for(const n in e){let t=e[n];t=ArrayBuffer.isView(t)?{value:t}:t,(0,i.h)(ArrayBuffer.isView(t.value),"".concat(this._print(n),": must be typed array or object with value as typed array")),"POSITION"!==n&&"positions"!==n||t.size||(t.size=3),"indices"===n?((0,i.h)(!this.indices),this.indices=t):this.attributes[n]=t}return this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(e,t){if(t)return t.value.length;let n=1/0;for(const r in e){const t=e[r],{value:i,size:o,constant:a}=t;!a&&i&&o>=1&&(n=Math.min(n,i.length/o))}return(0,i.h)(Number.isFinite(n)),n}}},44548:(e,t,n)=>{"use strict";n.d(t,{Z:()=>L});var r=n(76195),i=n(68833),o=n(39042),a=n(59661),s=n(36708),l=n(32073),c=n(71254),u=n(64180),d=n(1112);let h=null;function f(e,t){var n;return new e((n=e.BYTES_PER_ELEMENT*t,(!h||h.byteLength1&&void 0!==arguments[1]?arguments[1]:{}).constantAttributeZero||((0,r.D0)(e)||"Chrome"===(0,p.Z)())}static getDefaultArray(e){return e.luma=e.luma||{},e.luma.defaultVertexArray||(e.luma.defaultVertexArray=new g(e,{handle:null,isDefaultArray:!0})),e.luma.defaultVertexArray}static getMaxAttributes(e){return g.MAX_ATTRIBUTES=g.MAX_ATTRIBUTES||e.getParameter(34921),g.MAX_ATTRIBUTES}static setConstant(e,t,n){switch(n.constructor){case Float32Array:g._setConstantFloatArray(e,t,n);break;case Int32Array:g._setConstantIntArray(e,t,n);break;case Uint32Array:g._setConstantUintArray(e,t,n);break;default:(0,a.h)(!1)}}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t.id||t.program&&t.program.id;super(e,Object.assign({},t,{id:n})),this.buffer=null,this.bufferValue=null,this.isDefaultArray=t.isDefaultArray||!1,this.gl2=e,this.initialize(t),Object.seal(this)}delete(){return super.delete(),this.buffer&&this.buffer.delete(),this}get MAX_ATTRIBUTES(){return g.getMaxAttributes(this.gl)}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setProps(e)}setProps(e){return this}setElementBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,a.h)(!e||34963===e.target,"elements must be GL.ELEMENT_ARRAY_BUFFER"),this.bind((()=>{this.gl.bindBuffer(34963,e?e.handle:null)})),this}setBuffer(e,t,n){if(34963===t.target)return this.setElementBuffer(t,n);const{size:i,type:o,stride:s,offset:l,normalized:c,integer:u,divisor:d}=n,{gl:h,gl2:f}=this;return e=Number(e),this.bind((()=>{h.bindBuffer(34962,t.handle),u?((0,a.h)((0,r.D0)(h)),f.vertexAttribIPointer(e,i,o,s,l)):h.vertexAttribPointer(e,i,o,c,s,l),h.enableVertexAttribArray(e),f.vertexAttribDivisor(e,d||0)})),this}enable(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!t&&0===e&&!g.isSupported(this.gl,{constantAttributeZero:!0})||(e=Number(e),this.bind((()=>t?this.gl.enableVertexAttribArray(e):this.gl.disableVertexAttribArray(e)))),this}getConstantBuffer(e,t){const n=this._normalizeConstantArrayValue(t),r=n.byteLength*e,i=n.length*e;let o=!this.buffer;if(this.buffer=this.buffer||new u.Z(this.gl,r),o=o||this.buffer.reallocate(r),o=o||!this._compareConstantArrayValues(n,this.bufferValue),o){const e=f(t.constructor,i);!function(e){let{target:t,source:n,start:r=0,count:i=1}=e;const o=n.length,a=i*o;let s=0;for(let l=r;s34373===e?this.gl.getVertexAttribOffset(n,e):this.gl.getVertexAttrib(n,e)))}}var m=n(43331);const A=/^(.+)__LOCATION_([0-9]+)$/,v=["setBuffers","setGeneric","clearBindings","setLocations","setGenericValues","setDivisor","enable","disable"];class y{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t.id||t.program&&t.program.id;this.id=n,this.gl=e,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={},this.vertexArrayObject=new g(e),(0,m.F)(this,"VertexArray","v6.0",v),this.initialize(t),Object.seal(this)}delete(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(e)}reset(){this.elements=null,this.elementsAccessor=null;const{MAX_ATTRIBUTES:e}=this.vertexArrayObject;return this.values=new Array(e).fill(null),this.accessors=new Array(e).fill(null),this.unused={},this.drawParams=null,this}setProps(e){return"program"in e&&(this.configuration=e.program&&e.program.configuration),"configuration"in e&&(this.configuration=e.configuration),"attributes"in e&&this.setAttributes(e.attributes),"elements"in e&&this.setElementBuffer(e.elements),"bindOnUse"in e&&(e=e.bindOnUse),this}clearDrawParams(){this.drawParams=null}getDrawParams(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}setAttributes(e){return Object.assign(this.attributes,e),this.vertexArrayObject.bind((()=>{for(const t in e){const n=e[t];this._setAttribute(t,n)}this.gl.bindBuffer(34962,null)})),this}setElementBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.elements=e,this.elementsAccessor=t,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(e,t),this}setBuffer(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(34963===t.target)return this.setElementBuffer(t,n);const{location:r,accessor:i}=this._resolveLocationAndAccessor(e,t,t.accessor,n);return r>=0&&(this.values[r]=t,this.accessors[r]=i,this.clearDrawParams(),this.vertexArrayObject.setBuffer(r,t,i)),this}setConstant(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{location:r,accessor:i}=this._resolveLocationAndAccessor(e,t,Object.assign({size:t.length},n));return r>=0&&(t=this.vertexArrayObject._normalizeConstantArrayValue(t),this.values[r]=t,this.accessors[r]=i,this.clearDrawParams(),this.vertexArrayObject.enable(r,!1)),this}unbindBuffers(){return this.vertexArrayObject.bind((()=>{this.elements&&this.vertexArrayObject.setElementBuffer(null),this.buffer=this.buffer||new u.Z(this.gl,{accessor:{size:4}});for(let e=0;e{this.elements&&this.setElementBuffer(this.elements);for(let e=0;e{this._setConstantAttributes(e,t),r=n()})),r}_resolveLocationAndAccessor(e,t,n,i){const o={location:-1,accessor:null},{location:s,name:l}=this._getAttributeIndex(e);if(!Number.isFinite(s)||s<0)return this.unused[e]=t,r.cM.once(3,(()=>"unused value ".concat(e," in ").concat(this.id)))(),o;const u=this._getAttributeInfo(l||s);if(!u)return o;const d=this.accessors[s]||{},h=c.Z.resolve(u.accessor,d,n,i),{size:f,type:p}=h;return(0,a.h)(Number.isFinite(f)&&Number.isFinite(p)),{location:s,accessor:h}}_getAttributeInfo(e){return this.configuration&&this.configuration.getAttributeInfo(e)}_getAttributeIndex(e){const t=Number(e);if(Number.isFinite(t))return{location:t};const n=A.exec(e),r=n?n[1]:e,i=n?Number(n[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(r)+i,name:r}:{location:-1}}_setAttribute(e,t){if(t instanceof u.Z)this.setBuffer(e,t);else if(Array.isArray(t)&&t.length&&t[0]instanceof u.Z){const n=t[0],r=t[1];this.setBuffer(e,n,r)}else if(ArrayBuffer.isView(t)||Array.isArray(t)){const n=t;this.setConstant(e,n)}else{if(!(t.buffer instanceof u.Z))throw new Error("VertexArray: attributes must be Buffers or constants (i.e. typed array)");{const n=t;this.setBuffer(e,n.buffer,n)}}}_setConstantAttributes(e,t){const n=Math.max(0|e,0|t);let r=this.values[0];ArrayBuffer.isView(r)&&this._setConstantAttributeZero(r,n);for(let i=1;i0;if(e.isInstanced=e.isInstanced||o,n instanceof u.Z){const t=n;if(o){const n=t.getVertexCount(r);e.instanceCount=Math.min(e.instanceCount,n)}else{const n=t.getVertexCount(r);e.vertexCount=Math.min(e.vertexCount,n)}}}setElements(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.cM.deprecated("setElements","setElementBuffer")(),this.setElementBuffer(e,t)}}var b=n(73011),_=n(55562),w=n(2187);function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isInteger:n=!1}=t;if(Array.isArray(e)||ArrayBuffer.isView(e))return function(e,t){const{maxElts:n=16,size:r=1}=t;let i="[";for(let a=0;a0&&(i+=",".concat(a%r===0?" ":"")),i+=x(e[a],t);const o=e.length>n?"...":"]";return"".concat(i).concat(o)}(e,t);if(!Number.isFinite(e))return String(e);if(Math.abs(e)<1e-16)return n?"0":"0.";if(n)return e.toFixed(0);if(Math.abs(e)>100&&Math.abs(e)<1e4)return e.toFixed(0);const r=e.toPrecision(2);return r.indexOf(".0")===r.length-2?r.slice(0,-1):r}function E(e,t,n,r){const{gl:i}=e;if(!t)return{[r]:"null","Format ":"N/A"};let o,a,s,l="NOT PROVIDED",c=1,d=0,h=0;if(n&&(l=n.type,c=n.size,l=String(l).replace("Array",""),o=-1!==l.indexOf("nt")),t instanceof u.Z){const e=t,{data:u,changed:f}=e.getDebugData();let p;if(a=f?"*":"",s=u,h=e.byteLength,d=h/u.BYTES_PER_ELEMENT/c,n){const e=n.divisor>0;p="".concat(e?"I ":"P "," ").concat(d," (x").concat(c,"=").concat(h," bytes ").concat((0,_.km)(i,l),")")}else o=!0,p="".concat(h," bytes");return{[r]:"".concat(a).concat(x(s,{size:c,isInteger:o})),"Format ":p}}return s=t,c=t.length,l=String(t.constructor.name).replace("Array",""),o=-1!==l.indexOf("nt"),{[r]:"".concat(x(s,{size:c,isInteger:o})," (constant)"),"Format ":"".concat(c,"x").concat(l," (constant)")}}function S(e,t){const{type:n,size:r}=t,i=(0,w.jG)(n,r);return i?"".concat(e," (").concat(i.name,")"):e}function C(e){let{header:t="Uniforms",program:n,uniforms:r,undefinedOnly:i=!1}=e;(0,a.h)(n);const o=".*Matrix",s=n._uniformSetters,l={},c=Object.keys(s).sort();let u=0;for(const a of c)a.match(".*_.*")||a.match(o)||P({table:l,header:t,uniforms:r,uniformName:a,undefinedOnly:i})&&u++;for(const a of c)a.match(o)&&P({table:l,header:t,uniforms:r,uniformName:a,undefinedOnly:i})&&u++;for(const a of c)l[a]||P({table:l,header:t,uniforms:r,uniformName:a,undefinedOnly:i})&&u++;let d=0;const h={};if(!i)for(const a in r){const e=r[a];l[a]||(d++,h[a]={Type:"NOT USED: ".concat(e),[t]:x(e)})}return{table:l,count:u,unusedTable:h,unusedCount:d}}function P(e){let{table:t,header:n,uniforms:r,uniformName:i,undefinedOnly:o}=e;const a=r[i],s=function(e){return void 0!==e&&null!==e}(a);return(!o||!s)&&(t[i]={[n]:s?x(a):"N/A","Uniform Type":s?a:"NOT PROVIDED"},!0)}function T(e){const{type:t,size:n}=e.accessor,r=(0,w.jG)(t,n);return r?"".concat(r.name," ").concat(e.name):e.name}const M={POSITION:"positions",NORMAL:"normals",COLOR_0:"colors",TEXCOORD_0:"texCoords",TEXCOORD_1:"texCoords1",TEXCOORD_2:"texCoords2"};function k(e,t){const{attributeMap:n=M}=t||{};return n&&n[e]||e}function R(e,t){let n;switch(e){case"texCoords":case"texCoord1":case"texCoord2":case"texCoord3":n="uvs";break;case"vertices":case"positions":case"normals":case"pickingColors":n="vectors"}switch(n){case"vectors":t.size=t.size||3;break;case"uvs":t.size=t.size||2}(0,a.h)(Number.isFinite(t.size),"attribute ".concat(e," needs size"))}const O=()=>{},I={};class L{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{id:n=(0,o.hQ)("model")}=t;(0,a.h)((0,r.UF)(e)),this.id=n,this.gl=e,this.id=t.id||(0,o.hQ)("Model"),this.lastLogTime=0,this.animated=!1,this.initialize(t)}initialize(e){this.props={},this.programManager=e.programManager||i.Z.getDefaultProgramManager(this.gl),this._programManagerState=-1,this._managedProgram=!1;const{program:t=null,vs:n,fs:r,modules:o,defines:s,inject:l,varyings:c,bufferMode:u,transpileToGLSL100:d}=e;this.programProps={program:t,vs:n,fs:r,modules:o,defines:s,inject:l,varyings:c,bufferMode:u,transpileToGLSL100:d},this.program=null,this.vertexArray=null,this._programDirty=!0,this.userData={},this.needsRedraw=!0,this._attributes={},this.attributes={},this.uniforms={},this.pickable=!0,this._checkProgram(),this.setUniforms(Object.assign({},this.getModuleUniforms(e.moduleSettings))),this.drawMode=void 0!==e.drawMode?e.drawMode:4,this.vertexCount=e.vertexCount||0,this.geometryBuffers={},this.isInstanced=e.isInstanced||e.instanced||e.instanceCount>0,this._setModelProps(e),this.geometry={},(0,a.h)(void 0!==this.drawMode&&Number.isFinite(this.vertexCount),"Model needs drawMode and vertexCount")}setProps(e){this._setModelProps(e)}delete(){for(const e in this._attributes)this._attributes[e]!==this.attributes[e]&&this._attributes[e].delete();this._managedProgram&&(this.programManager.release(this.program),this._managedProgram=!1),this.vertexArray.delete(),this._deleteGeometryBuffers()}getDrawMode(){return this.drawMode}getVertexCount(){return this.vertexCount}getInstanceCount(){return this.instanceCount}getAttributes(){return this.attributes}getProgram(){return this.program}setProgram(e){const{program:t,vs:n,fs:r,modules:i,defines:o,inject:a,varyings:s,bufferMode:l,transpileToGLSL100:c}=e;this.programProps={program:t,vs:n,fs:r,modules:i,defines:o,inject:a,varyings:s,bufferMode:l,transpileToGLSL100:c},this._programDirty=!0}getUniforms(){return this.uniforms}setDrawMode(e){return this.drawMode=e,this}setVertexCount(e){return(0,a.h)(Number.isFinite(e)),this.vertexCount=e,this}setInstanceCount(e){return(0,a.h)(Number.isFinite(e)),this.instanceCount=e,this}setGeometry(e){return this.drawMode=e.drawMode,this.vertexCount=e.getVertexCount(),this._deleteGeometryBuffers(),this.geometryBuffers=function(e,t,n){const r={};let i=t.indices;for(const o in t.attributes){const a=t.attributes[o],s=k(o,n);if("indices"===o)i=a;else if(a.constant)r[s]=a.value;else{const t=a.value,n={...a};delete n.value,r[s]=[new u.Z(e,t),n],R(o,n)}}if(i){const t=i.value||i;(0,a.h)(t instanceof Uint16Array||t instanceof Uint32Array,'attribute array for "indices" must be of integer type');const n={size:1,isIndexed:void 0===i.isIndexed||i.isIndexed};r.indices=[new u.Z(e,{data:t,target:34963}),n]}return r}(this.gl,e),this.vertexArray.setAttributes(this.geometryBuffers),this}setAttributes(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((0,o.nK)(e))return this;const t={};for(const n in e){const r=e[n];t[n]=r.getValue?r.getValue():r}return this.vertexArray.setAttributes(t),this}setUniforms(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(this.uniforms,e),this}getModuleUniforms(e){this._checkProgram();const t=this.programManager.getUniforms(this.program);return t?t(e):{}}updateModuleSettings(e){const t=this.getModuleUniforms(e||{});return this.setUniforms(t)}clear(e){return(0,s.Z)(this.program.gl,e),this}draw(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._checkProgram();const{moduleSettings:t=null,framebuffer:n,uniforms:i={},attributes:o={},transformFeedback:a=this.transformFeedback,parameters:s={},vertexArray:l=this.vertexArray}=e;let c;this.setAttributes(o),this.updateModuleSettings(t),this.setUniforms(i),r.cM.priority>=2&&(c=this._logDrawCallStart(2));const u=this.vertexArray.getDrawParams(),{isIndexed:d=u.isIndexed,indexType:h=u.indexType,indexOffset:f=u.indexOffset,vertexArrayInstanced:p=u.isInstanced}=this.props;p&&!this.isInstanced&&r.cM.warn("Found instanced attributes on non-instanced model",this.id)();const{isInstanced:g,instanceCount:m}=this,{onBeforeRender:A=O,onAfterRender:v=O}=this.props;A(),this.program.setUniforms(this.uniforms);const y=this.program.draw(Object.assign(I,e,{logPriority:c,uniforms:null,framebuffer:n,parameters:s,drawMode:this.getDrawMode(),vertexCount:this.getVertexCount(),vertexArray:l,transformFeedback:a,isIndexed:d,indexType:h,isInstanced:g,instanceCount:m,offset:d?f:0}));return v(),r.cM.priority>=2&&this._logDrawCallEnd(c,l,n),y}transform(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{discard:t=!0,feedbackBuffers:n,unbindModels:r=[]}=e;let{parameters:i}=e;n&&this._setFeedbackBuffers(n),t&&(i=Object.assign({},i,{35977:t})),r.forEach((e=>e.vertexArray.unbindBuffers()));try{this.draw(Object.assign({},e,{parameters:i}))}finally{r.forEach((e=>e.vertexArray.bindBuffers()))}return this}render(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r.cM.warn("Model.render() is deprecated. Use Model.setUniforms() and Model.draw()")(),this.setUniforms(e).draw()}_setModelProps(e){Object.assign(this.props,e),"uniforms"in e&&this.setUniforms(e.uniforms),"pickable"in e&&(this.pickable=e.pickable),"instanceCount"in e&&(this.instanceCount=e.instanceCount),"geometry"in e&&this.setGeometry(e.geometry),"attributes"in e&&this.setAttributes(e.attributes),"_feedbackBuffers"in e&&this._setFeedbackBuffers(e._feedbackBuffers)}_checkProgram(){if(!(this._programDirty||this.programManager.stateHash!==this._programManagerState))return;let{program:e}=this.programProps;if(e)this._managedProgram=!1;else{const{vs:t,fs:n,modules:r,inject:i,defines:o,varyings:a,bufferMode:s,transpileToGLSL100:l}=this.programProps;e=this.programManager.get({vs:t,fs:n,modules:r,inject:i,defines:o,varyings:a,bufferMode:s,transpileToGLSL100:l}),this.program&&this._managedProgram&&this.programManager.release(this.program),this._programManagerState=this.programManager.stateHash,this._managedProgram=!0}(0,a.h)(e instanceof l.Z,"Model needs a program"),this._programDirty=!1,e!==this.program&&(this.program=e,this.vertexArray?this.vertexArray.setProps({program:this.program,attributes:this.vertexArray.attributes}):this.vertexArray=new y(this.gl,{program:this.program}),this.setUniforms(Object.assign({},this.getModuleUniforms())))}_deleteGeometryBuffers(){for(const e in this.geometryBuffers){const t=this.geometryBuffers[e][0]||this.geometryBuffers[e];t instanceof u.Z&&t.delete()}}_setAnimationProps(e){this.animated&&(0,a.h)(e,"Model.draw(): animated uniforms but no animationProps")}_setFeedbackBuffers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((0,o.nK)(e))return this;const{gl:t}=this.program;return this.transformFeedback=this.transformFeedback||new b.Z(t,{program:this.program}),this.transformFeedback.setBuffers(e),this}_logDrawCallStart(e){const t=e>3?0:1e4;if(!(Date.now()-this.lastLogTime>> DRAWING MODEL ".concat(this.id),{collapsed:r.cM.level<=2})(),e}_logDrawCallEnd(e,t,n,i){if(void 0===e)return;const o=function(e){let{vertexArray:t,header:n="Attributes"}=e;if(!t.configuration)return{};const r={};t.elements&&(r.ELEMENT_ARRAY_BUFFER=E(t,t.elements,null,n));const i=t.values;for(const o in i){const e=t._getAttributeInfo(o);if(e){let a="".concat(o,": ").concat(e.name);const s=t.accessors[e.location];s&&(a="".concat(o,": ").concat(S(e.name,s))),r[a]=E(t,i[o],s,n)}}return r}({vertexArray:t,header:"".concat(this.id," attributes"),attributes:this._attributes}),{table:a,unusedTable:s,unusedCount:l}=C({header:"".concat(this.id," uniforms"),program:this.program,uniforms:Object.assign({},this.program.uniforms,n)}),{table:c,count:u}=C({header:"".concat(this.id," uniforms"),program:this.program,uniforms:Object.assign({},this.program.uniforms,n),undefinedOnly:!0});u>0&&r.cM.log("MISSING UNIFORMS",Object.keys(c))(),l>0&&r.cM.log("UNUSED UNIFORMS",Object.keys(s))();const d=function(e){const t={},n="Accessors for ".concat(e.id);for(const r of e.attributeInfos)if(r){const e=T(r);t["in ".concat(e)]={[n]:JSON.stringify(r.accessor)}}for(const r of e.varyingInfos)if(r){const e=T(r);t["out ".concat(e)]={[n]:JSON.stringify(r.accessor)}}return t}(this.vertexArray.configuration);r.cM.table(e,o)(),r.cM.table(e,a)(),r.cM.table(e+1,d)(),i&&i.log({logLevel:2,message:"Rendered to ".concat(i.id)}),r.cM.groupEnd(2)()}}},68833:(e,t,n)=>{"use strict";n.d(t,{Z:()=>H});var r=n(91203),i=n(7064);const o={number:{validate:(e,t)=>Number.isFinite(e)&&(!("max"in t)||e<=t.max)&&(!("min"in t)||e>=t.min)},array:{validate:(e,t)=>Array.isArray(e)||ArrayBuffer.isView(e)}};function a(e){let t=s(e);return"object"===t?e?"type"in e?Object.assign({},e,o[e.type]):"value"in e?(t=s(e.value),Object.assign({type:t},e,o[t])):{type:"object",value:e}:{type:"object",value:null}:Object.assign({type:t,value:e},o[t])}function s(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}class l{constructor(e){let{name:t,vs:n,fs:r,dependencies:o=[],uniforms:s,getUniforms:l,deprecations:c=[],defines:u={},inject:d={},vertexShader:h,fragmentShader:f}=e;(0,i.Z)("string"===typeof t),this.name=t,this.vs=n||h,this.fs=r||f,this.getModuleUniforms=l,this.dependencies=o,this.deprecations=this._parseDeprecationDefinitions(c),this.defines=u,this.injections=function(e){const t={vs:{},fs:{}};for(const n in e){let r=e[n];"string"===typeof r&&(r={order:0,injection:r}),t[n.slice(0,2)][n]=r}return t}(d),s&&(this.uniforms=function(e){const t={};for(const n in e){const r=a(e[n]);t[n]=r}return t}(s))}getModuleSource(e){let t;switch(e){case"vs":t=this.vs||"";break;case"fs":t=this.fs||"";break;default:(0,i.Z)(!1)}return"#define MODULE_".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),"\n").concat(t,"// END MODULE_").concat(this.name,"\n\n")}getUniforms(e,t){return this.getModuleUniforms?this.getModuleUniforms(e,t):this.uniforms?this._defaultGetUniforms(e):{}}getDefines(){return this.defines}checkDeprecations(e,t){this.deprecations.forEach((n=>{n.regex.test(e)&&(n.deprecated?t.deprecated(n.old,n.new)():t.removed(n.old,n.new)())}))}_parseDeprecationDefinitions(e){return e.forEach((e=>{if("function"===e.type)e.regex=new RegExp("\\b".concat(e.old,"\\("));else e.regex=new RegExp("".concat(e.type," ").concat(e.old,";"))})),e}_defaultGetUniforms(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t={},n=this.uniforms;for(const r in n){const o=n[r];r in e&&!o.private?(o.validate&&(0,i.Z)(o.validate(e[r],o),"".concat(this.name,": invalid ").concat(r)),t[r]=e[r]):t[r]=o.value}return t}}function c(e){return u(h(e))}function u(e){const t={},n={};return d({modules:e,level:0,moduleMap:t,moduleDepth:n}),Object.keys(n).sort(((e,t)=>n[t]-n[e])).map((e=>t[e]))}function d(e){let{modules:t,level:n,moduleMap:r,moduleDepth:i}=e;if(n>=5)throw new Error("Possible loop in shader dependency graph");for(const o of t)r[o.name]=o,(void 0===i[o.name]||i[o.name](e instanceof l||((0,i.Z)("string"!==typeof e,"Shader module use by name is deprecated. Import shader module '".concat(e,"' and use it directly.")),(0,i.Z)(e.name,"shader module has no name"),(e=new l(e)).dependencies=h(e.dependencies)),e)))}const f=7936,p=7937,g=7938,m=35724,A={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]},v={};Object.keys(A).forEach((e=>{v[e]=e}));const y={};function b(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=A[t];if((0,i.Z)(r,t),!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t="undefined"!==typeof window&&window.navigator||{},n=e.userAgent||t.userAgent||"",r=-1!==n.indexOf("MSIE "),i=-1!==n.indexOf("Trident/");return r||i}(n))return!0;if(t in y)return y[t];const o=r[0],a=n.behavior||"enable",s="#extension GL_".concat(o," : ").concat(a,"\nvoid main(void) {}"),l=e.createShader(35633);e.shaderSource(l,s),e.compileShader(l);const c=e.getShaderParameter(l,35713);return e.deleteShader(l),y[t]=c,c}function _(e,t){const n=A[t];(0,i.Z)(n,t);const r=function(e){return"undefined"!==typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||Boolean(e&&2===e._version)}(e)&&n[1]||n[0],o="string"===typeof r?Boolean(e.getExtension(r)):r;return(0,i.Z)(!1===o||!0===o),o}function w(e,t){return(t=Array.isArray(t)?t:[t]).every((t=>_(e,t)))}function x(e){const t=function(e){const t=e.getExtension("WEBGL_debug_renderer_info"),n=e.getParameter(t&&t.UNMASKED_VENDOR_WEBGL||f),r=e.getParameter(t&&t.UNMASKED_RENDERER_WEBGL||p);return{gpuVendor:function(e,t){return e.match(/NVIDIA/i)||t.match(/NVIDIA/i)?"NVIDIA":e.match(/INTEL/i)||t.match(/INTEL/i)?"INTEL":e.match(/AMD/i)||t.match(/AMD/i)||e.match(/ATI/i)||t.match(/ATI/i)?"AMD":"UNKNOWN GPU"}(n,r),vendor:n,renderer:r,version:e.getParameter(g),shadingLanguageVersion:e.getParameter(m)}}(e);switch(t.gpuVendor.toLowerCase()){case"nvidia":return"#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";case"intel":return"#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"amd":return"#define AMD_GPU\n";default:return"#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n"}}var E=n(11558);function S(e){return new RegExp("\\b".concat(e,"[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)"),"g")}const C=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,"#version 300 es\n"],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],P=[...C,[S("attribute"),"in $1"],[S("varying"),"out $1"]],T=[...C,[S("varying"),"in $1"]],M=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],k=[...M,[S("in"),"attribute $1"],[S("out"),"varying $1"]],R=[...M,[S("in"),"varying $1"]],O="gl_FragColor",I=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/,L=/void\s+main\s*\([^)]*\)\s*\{\n?/;function D(e,t,n){switch(t){case 300:return n?N(e,P):function(e){e=N(e,T);const t=e.match(I);if(t){const n=t[1];e=e.replace(new RegExp("\\b".concat(O,"\\b"),"g"),n)}else{const t="fragmentColor";e=e.replace(L,(e=>"out vec4 ".concat(t,";\n").concat(e))).replace(new RegExp("\\b".concat(O,"\\b"),"g"),t)}return e}(e);case 100:return n?N(e,k):function(e){e=N(e,R);const t=e.match(I);if(t){const n=t[1];e=e.replace(I,"").replace(new RegExp("\\b".concat(n,"\\b"),"g"),O)}return e}(e);default:throw new Error("unknown GLSL version ".concat(t))}}function N(e,t){for(const[n,r]of t)e=e.replace(n,r);return e}const F="\n\n".concat(E.O_,"\n\n"),j={[r.H]:"vertex",[r.Y]:"fragment"},B="precision highp float;\n\n";function z(e,t){let{id:n,source:o,type:a,modules:s,defines:l={},hookFunctions:c=[],inject:u={},transpileToGLSL100:d=!1,prologue:h=!0,log:f}=t;(0,i.Z)("string"===typeof o,"shader source must be a string");const p=a===r.H,g=o.split("\n");let m=100,A="",y=o;0===g[0].indexOf("#version ")?(m=300,A=g[0],y=g.slice(1).join("\n")):A="#version ".concat(m);const _={};s.forEach((e=>{Object.assign(_,e.getDefines())})),Object.assign(_,l);let S=h?"".concat(A,"\n").concat(function(e){let{id:t,source:n,type:r}=e;const i=t&&"string"===typeof t&&-1===n.indexOf("SHADER_NAME");return i?"\n#define SHADER_NAME ".concat(t,"_").concat(j[r],"\n\n"):""}({id:n,source:o,type:a}),"\n").concat(function(e){let{type:t}=e;return"\n#define SHADER_TYPE_".concat(j[t].toUpperCase(),"\n")}({type:a}),"\n").concat(x(e),"\n").concat(function(e,t,n){let r="#if (__VERSION__ > 120)\n\n# define FEATURE_GLSL_DERIVATIVES\n# define FEATURE_GLSL_DRAW_BUFFERS\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FEATURE_GLSL_TEXTURE_LOD\n\n// DEPRECATED FLAGS, remove in v9\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n\n#endif // __VERSION\n";return w(e,v.GLSL_FRAG_DEPTH)&&(r+="\n// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n"),w(e,v.GLSL_DERIVATIVES)&&b(e,v.GLSL_DERIVATIVES)&&(r+="\n// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define FEATURE_GLSL_DERIVATIVES\n# define DERIVATIVES\n#endif\n"),w(e,v.GLSL_FRAG_DATA)&&b(e,v.GLSL_FRAG_DATA,{behavior:"require"})&&(r+="\n// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define FEATURE_GLSL_DRAW_BUFFERS\n#define DRAW_BUFFERS\n#endif\n"),w(e,v.GLSL_TEXTURE_LOD)&&(r+="// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n\n# define FEATURE_GLSL_TEXTURE_LOD\n# define TEXTURE_LOD\n\n#endif\n"),r}(e),"\n").concat(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=0,n="";for(const r in e){0===t&&(n+="\n// APPLICATION DEFINES\n"),t++;const i=e[r];(i||Number.isFinite(i))&&(n+="#define ".concat(r.toUpperCase()," ").concat(e[r],"\n"))}0===t&&(n+="\n");return n}(_),"\n").concat(p?"":B,"\n"):"".concat(A,"\n");const C=function(e){const t={vs:{},fs:{}};return e.forEach((e=>{let n;"string"!==typeof e?(n=e,e=n.hook):n={},e=e.trim();const[r,i]=e.split(":"),o=e.replace(/\(.+/,"");t[r][o]=Object.assign(n,{signature:i})})),t}(c),P={},T={},M={};for(const r in u){const e="string"===typeof u[r]?{injection:u[r],order:0}:u[r],t=r.match(/^(v|f)s:(#)?([\w-]+)$/);if(t){const n=t[2],i=t[3];n?"decl"===i?T[r]=[e]:M[r]=[e]:P[r]=[e]}else M[r]=[e]}for(const r of s){f&&r.checkDeprecations(y,f);S+=r.getModuleSource(a,m);const e=r.injections[a];for(const t in e){const n=t.match(/^(v|f)s:#([\w-]+)$/);if(n){const r="decl"===n[2]?T:M;r[t]=r[t]||[],r[t].push(e[t])}else P[t]=P[t]||[],P[t].push(e[t])}}return S+=F,S=(0,E.ZP)(S,a,T),S+=function(e,t){let n="";for(const r in e){const i=e[r];if(n+="void ".concat(i.signature," {\n"),i.header&&(n+=" ".concat(i.header)),t[r]){const e=t[r];e.sort(((e,t)=>e.order-t.order));for(const t of e)n+=" ".concat(t.injection,"\n")}i.footer&&(n+=" ".concat(i.footer)),n+="}\n"}return n}(C[a],P),S+=y,S=(0,E.ZP)(S,a,M),S=D(S,d?100:m,p),S}function Z(e){return function(t){const n={};for(const r of e){const e=r.getUniforms(t,n);Object.assign(n,e)}return n}}var U=n(32073);class H{static getDefaultProgramManager(e){return e.luma=e.luma||{},e.luma.defaultProgramManager=e.luma.defaultProgramManager||new H(e),e.luma.defaultProgramManager}constructor(e){this.gl=e,this._programCache={},this._getUniforms={},this._registeredModules={},this._hookFunctions=[],this._defaultModules=[],this._hashes={},this._hashCounter=0,this.stateHash=0,this._useCounts={}}addDefaultModule(e){this._defaultModules.find((t=>t.name===e.name))||this._defaultModules.push(e),this.stateHash++}removeDefaultModule(e){const t="string"===typeof e?e:e.name;this._defaultModules=this._defaultModules.filter((e=>e.name!==t)),this.stateHash++}addShaderHook(e,t){t&&(e=Object.assign(t,{hook:e})),this._hookFunctions.push(e),this.stateHash++}get(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{vs:t="",fs:n="",defines:i={},inject:o={},varyings:a=[],bufferMode:s=35981,transpileToGLSL100:l=!1}=e,u=this._getModuleList(e.modules),d=this._getHash(t),h=this._getHash(n),f=u.map((e=>this._getHash(e.name))).sort(),p=a.map((e=>this._getHash(e))),g=Object.keys(i).sort(),m=Object.keys(o).sort(),A=[],v=[];for(const r of g)A.push(this._getHash(r)),A.push(this._getHash(i[r]));for(const r of m)v.push(this._getHash(r)),v.push(this._getHash(o[r]));const y="".concat(d,"/").concat(h,"D").concat(A.join("/"),"M").concat(f.join("/"),"I").concat(v.join("/"),"V").concat(p.join("/"),"H").concat(this.stateHash,"B").concat(s).concat(l?"T":"");if(!this._programCache[y]){const e=function(e,t){const{vs:n,fs:i}=t,o=c(t.modules||[]);return{gl:e,vs:z(e,Object.assign({},t,{source:n,type:r.H,modules:o})),fs:z(e,Object.assign({},t,{source:i,type:r.Y,modules:o})),getUniforms:Z(o)}}(this.gl,{vs:t,fs:n,modules:u,inject:o,defines:i,hookFunctions:this._hookFunctions,transpileToGLSL100:l});this._programCache[y]=new U.Z(this.gl,{hash:y,vs:e.vs,fs:e.fs,varyings:a,bufferMode:s}),this._getUniforms[y]=e.getUniforms||(e=>{}),this._useCounts[y]=0}return this._useCounts[y]++,this._programCache[y]}getUniforms(e){return this._getUniforms[e.hash]||null}release(e){const t=e.hash;this._useCounts[t]--,0===this._useCounts[t]&&(this._programCache[t].delete(),delete this._programCache[t],delete this._getUniforms[t],delete this._useCounts[t])}_getHash(e){return void 0===this._hashes[e]&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}_getModuleList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=new Array(this._defaultModules.length+e.length),n={};let r=0;for(let i=0,o=this._defaultModules.length;i{"use strict";n.d(t,{Z:()=>T});var r=n(7064);const i="out vec4 transform_output;\nvoid main() {\n transform_output = vec4(0);\n}",o="#version 300 es\n".concat(i);function a(e,t){t=Array.isArray(t)?t:[t];const n=e.replace(/^\s+/,"").split(/\s+/),[r,i,o]=n;if(!t.includes(r)||!i||!o)return null;return{qualifier:r,type:i,name:o.split(";")[0]}}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{version:t=100,input:n,inputType:a,output:s}=e;if(!n)return 300===t?o:t>300?"#version ".concat(t,"\n").concat(i):"void main() {gl_FragColor = vec4(0);}";const l=function(e,t){switch(t){case"float":return"vec4(".concat(e,", 0.0, 0.0, 1.0)");case"vec2":return"vec4(".concat(e,", 0.0, 1.0)");case"vec3":return"vec4(".concat(e,", 1.0)");case"vec4":return e;default:return(0,r.Z)(!1),null}}(n,a);return t>=300?"#version ".concat(t," ").concat(300===t?"es":"","\nin ").concat(a," ").concat(n,";\nout vec4 ").concat(s,";\nvoid main() {\n ").concat(s," = ").concat(l,";\n}"):"varying ".concat(a," ").concat(n,";\nvoid main() {\n gl_FragColor = ").concat(l,";\n}")}var l=n(76195),c=n(64180),u=n(73011),d=n(59661);class h{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=e,this.currentIndex=0,this.feedbackMap={},this.varyings=null,this.bindings=[],this.resources={},this._initialize(t),Object.seal(this)}setupResources(e){for(const t of this.bindings)this._setupTransformFeedback(t,e)}updateModelProps(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{varyings:t}=this;return t.length>0&&(e=Object.assign({},e,{varyings:t})),e}getDrawOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.bindings[this.currentIndex],{sourceBuffers:n,transformFeedback:r}=t;return{attributes:Object.assign({},n,e.attributes),transformFeedback:r}}swap(){return!!this.feedbackMap&&(this.currentIndex=this._getNextIndex(),!0)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._setupBuffers(e)}getBuffer(e){const{feedbackBuffers:t}=this.bindings[this.currentIndex],n=e?t[e]:null;return n?n instanceof c.Z?n:n.buffer:null}getData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{varyingName:t}=e,n=this.getBuffer(t);return n?n.getData():null}delete(){for(const e in this.resources)this.resources[e].delete()}_initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._setupBuffers(e),this.varyings=e.varyings||Object.keys(this.bindings[this.currentIndex].feedbackBuffers),this.varyings.length>0&&(0,d.h)((0,l.D0)(this.gl))}_getFeedbackBuffers(e){const{sourceBuffers:t={}}=e,n={};if(this.bindings[this.currentIndex]&&Object.assign(n,this.bindings[this.currentIndex].feedbackBuffers),this.feedbackMap)for(const r in this.feedbackMap){const e=this.feedbackMap[r];r in t&&(n[e]=r)}Object.assign(n,e.feedbackBuffers);for(const r in n){const e=n[r];if("string"===typeof e){const i=t[e],{byteLength:o,usage:a,accessor:s}=i;n[r]=this._createNewBuffer(r,{byteLength:o,usage:a,accessor:s})}}return n}_setupBuffers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{sourceBuffers:t=null}=e;Object.assign(this.feedbackMap,e.feedbackMap);const n=this._getFeedbackBuffers(e);this._updateBindings({sourceBuffers:t,feedbackBuffers:n})}_setupTransformFeedback(e,t){let{model:n}=t;const{program:r}=n;e.transformFeedback=new u.Z(this.gl,{program:r,buffers:e.feedbackBuffers})}_updateBindings(e){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],e),this.feedbackMap){const{sourceBuffers:e,feedbackBuffers:t}=this._swapBuffers(this.bindings[this.currentIndex]),n=this._getNextIndex();this.bindings[n]=this._updateBinding(this.bindings[n],{sourceBuffers:e,feedbackBuffers:t})}}_updateBinding(e,t){return e?(Object.assign(e.sourceBuffers,t.sourceBuffers),Object.assign(e.feedbackBuffers,t.feedbackBuffers),e.transformFeedback&&e.transformFeedback.setBuffers(e.feedbackBuffers),e):{sourceBuffers:Object.assign({},t.sourceBuffers),feedbackBuffers:Object.assign({},t.feedbackBuffers)}}_swapBuffers(e){if(!this.feedbackMap)return null;const t=Object.assign({},e.sourceBuffers),n=Object.assign({},e.feedbackBuffers);for(const r in this.feedbackMap){const i=this.feedbackMap[r];t[r]=e.feedbackBuffers[i],n[i]=e.sourceBuffers[r],(0,d.h)(n[i]instanceof c.Z)}return{sourceBuffers:t,feedbackBuffers:n}}_createNewBuffer(e,t){const n=new c.Z(this.gl,t);return this.resources[e]&&this.resources[e].delete(),this.resources[e]=n,n}_getNextIndex(){return(this.currentIndex+1)%2}}var f=n(77378),p=n(81786),g=n(64282),m=n(15671);function A(e){let t=100;const n=e.match(/[^\s]+/g);if(n.length>=2&&"#version"===n[0]){const e=parseInt(n[1],10);Number.isFinite(e)&&(t=e)}return t}var v=n(11558);const y={name:"transform",vs:"attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n float xIndex = transform_elementID - (yIndex * texSize[0]);\n return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n vec2 coord = indices / size + pixelSizeHalf;\n return coord;\n}\nvec2 transform_getPos(vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec4 textureColor = texture2D(texSampler, texCoord);\n return textureColor;\n}\n",fs:null},b="transform_uSampler_",_="transform_uSize_",w="transform_position";function x(e){let{vs:t,sourceTextureMap:n,targetTextureVarying:i,targetTexture:o}=e;let s=Object.keys(n).length,l=null;const c={};let u=t,h={};if(s>0||i){const e=u.split("\n"),t=e.slice();if(e.forEach(((e,o,u)=>{if(s>0){const i=function(e,t){const n={},i=function(e){return a(e,["attribute","in"])}(e);if(!i)return null;const{type:o,name:s}=i;if(s&&t[s]){const t="// ".concat(e," => Replaced by Transform with a sampler"),{samplerName:i,sizeName:a,uniformDeclerations:l}=function(e){const t="".concat(b).concat(e),n="".concat(_).concat(e),r=" uniform sampler2D ".concat(t,";\n uniform vec2 ").concat(n,";");return{samplerName:t,sizeName:n,uniformDeclerations:r}}(s),c=function(e){switch(e){case"float":return"x";case"vec2":return"xy";case"vec3":return"xyz";case"vec4":return"xyzw";default:return(0,r.Z)(!1),null}}(o),u=" ".concat(o," ").concat(s," = transform_getInput(").concat(i,", ").concat(a,").").concat(c,";\n");n[i]=s;return{updatedLine:t,inject:{"vs:#decl":l,"vs:#main-start":u},samplerTextureMap:n}}return null}(e,n);if(i){const{updatedLine:e,inject:n}=i;t[o]=e,h=(0,v.Lm)([h,n]),Object.assign(c,i.samplerTextureMap),s--}}i&&!l&&(l=function(e,t){const n=a(e,["varying","out"]);if(!n)return null;return n.name===t?n.type:null}(e,i))})),i){(0,d.h)(o);const e="".concat(_).concat(i),t={"vs:#decl":"uniform vec2 ".concat(e,";\n"),"vs:#main-start":" vec2 ".concat(w," = transform_getPos(").concat(e,");\n gl_Position = vec4(").concat(w,", 0, 1.);\n")};h=(0,v.Lm)([h,t])}u=t.join("\n")}return{vs:u,targetTextureType:l,inject:h,samplerTextureMap:c}}const E={10241:9728,10240:9728,10242:33071,10243:33071};class S{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=e,this.id=this.currentIndex=0,this._swapTexture=null,this.targetTextureVarying=null,this.targetTextureType=null,this.samplerTextureMap=null,this.bindings=[],this.resources={},this._initialize(t),Object.seal(this)}updateModelProps(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this._processVertexShader(e);return Object.assign({},e,t)}getDrawOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{sourceBuffers:t,sourceTextures:n,framebuffer:r,targetTexture:i}=this.bindings[this.currentIndex],o=Object.assign({},t,e.attributes),a=Object.assign({},e.uniforms),s=Object.assign({},e.parameters);let l=e.discard;if(this.hasSourceTextures||this.hasTargetTexture){o.transform_elementID=this.elementIDBuffer;for(const t in this.samplerTextureMap){const e=this.samplerTextureMap[t];a[t]=n[e]}this._setSourceTextureParameters();const e=function(e){let{sourceTextureMap:t,targetTextureVarying:n,targetTexture:r}=e;const i={};let o,a;n&&(({width:o,height:a}=r),i["".concat(_).concat(n)]=[o,a]);for(const s in t)({width:o,height:a}=t[s]),i["".concat(_).concat(s)]=[o,a];return i}({sourceTextureMap:n,targetTextureVarying:this.targetTextureVarying,targetTexture:i});Object.assign(a,e)}return this.hasTargetTexture&&(l=!1,s.viewport=[0,0,r.width,r.height]),{attributes:o,framebuffer:r,uniforms:a,discard:l,parameters:s}}swap(){return!!this._swapTexture&&(this.currentIndex=this._getNextIndex(),!0)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._setupTextures(e)}getTargetTexture(){const{targetTexture:e}=this.bindings[this.currentIndex];return e}getData(){let{packed:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{framebuffer:t}=this.bindings[this.currentIndex],n=(0,f.z6)(t);if(!e)return n;const i=n.constructor,o=function(e){switch(e){case"float":return 1;case"vec2":return 2;case"vec3":return 3;case"vec4":return 4;default:return(0,r.Z)(!1),null}}(this.targetTextureType),a=new i(n.length*o/4);let s=0;for(let r=0;r0&&void 0!==arguments[0]?arguments[0]:{};const{_targetTextureVarying:t,_swapTexture:n}=e;this._swapTexture=n,this.targetTextureVarying=t,this.hasTargetTexture=t,this._setupTextures(e)}_createTargetTexture(e){const{sourceTextures:t,textureOrReference:n}=e;if(n instanceof p.Z)return n;const r=t[n];return r?(this._targetRefTexName=n,this._createNewTexture(r)):null}_setupTextures(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{sourceBuffers:t,_sourceTextures:n={},_targetTexture:r}=e,i=this._createTargetTexture({sourceTextures:n,textureOrReference:r});this.hasSourceTextures=this.hasSourceTextures||n&&Object.keys(n).length>0,this._updateBindings({sourceBuffers:t,sourceTextures:n,targetTexture:i}),"elementCount"in e&&this._updateElementIDBuffer(e.elementCount)}_updateElementIDBuffer(e){if("number"!==typeof e||this.elementCount>=e)return;const t=new Float32Array(e);t.forEach(((e,t,n)=>{n[t]=t})),this.elementIDBuffer?this.elementIDBuffer.setData({data:t}):this.elementIDBuffer=new c.Z(this.gl,{data:t,accessor:{size:1}}),this.elementCount=e}_updateBindings(e){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],e),this._swapTexture){const{sourceTextures:e,targetTexture:t}=this._swapTextures(this.bindings[this.currentIndex]),n=this._getNextIndex();this.bindings[n]=this._updateBinding(this.bindings[n],{sourceTextures:e,targetTexture:t})}}_updateBinding(e,t){const{sourceBuffers:n,sourceTextures:r,targetTexture:i}=t;if(e||(e={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(e.sourceTextures,r),Object.assign(e.sourceBuffers,n),i){e.targetTexture=i;const{width:t,height:n}=i,{framebuffer:r}=e;r?(r.update({attachments:{36064:i},resizeAttachments:!1}),r.resize({width:t,height:n})):e.framebuffer=new g.Z(this.gl,{id:"transform-framebuffer",width:t,height:n,attachments:{36064:i}})}return e}_setSourceTextureParameters(){const e=this.currentIndex,{sourceTextures:t}=this.bindings[e];for(const n in t)t[n].setParameters(E)}_swapTextures(e){if(!this._swapTexture)return null;const t=Object.assign({},e.sourceTextures);t[this._swapTexture]=e.targetTexture;return{sourceTextures:t,targetTexture:e.sourceTextures[this._swapTexture]}}_createNewTexture(e){const t=(0,m.h)(e,{parameters:{10241:9728,10240:9728,10242:33071,10243:33071},pixelStore:{37440:!1}});return this.ownTexture&&this.ownTexture.delete(),this.ownTexture=t,t}_getNextIndex(){return(this.currentIndex+1)%2}_processVertexShader(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{sourceTextures:t,targetTexture:n}=this.bindings[this.currentIndex],{vs:r,uniforms:i,targetTextureType:o,inject:a,samplerTextureMap:l}=x({vs:e.vs,sourceTextureMap:t,targetTextureVarying:this.targetTextureVarying,targetTexture:n}),c=(0,v.Lm)([e.inject||{},a]);this.targetTextureType=o,this.samplerTextureMap=l;return{vs:r,fs:e._fs||s({version:A(r),input:this.targetTextureVarying,inputType:o,output:"transform_output"}),modules:this.hasSourceTextures||this.targetTextureVarying?[y].concat(e.modules||[]):e.modules,uniforms:i,inject:c}}}var C=n(39042),P=n(44548);class T{static isSupported(e){return(0,l.D0)(e)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=e,this.model=null,this.elementCount=0,this.bufferTransform=null,this.textureTransform=null,this.elementIDBuffer=null,this._initialize(t),Object.seal(this)}delete(){const{model:e,bufferTransform:t,textureTransform:n}=this;e&&e.delete(),t&&t.delete(),n&&n.delete()}run(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{clearRenderTarget:t=!0}=e,n=this._updateDrawOptions(e);t&&n.framebuffer&&n.framebuffer.clear({color:!0}),this.model.transform(n)}swap(){let e=!1;const t=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const n of t)e=e||n.swap();(0,d.h)(e,"Nothing to swap")}getBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.bufferTransform&&this.bufferTransform.getBuffer(e)}getData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const n of t){const t=n.getData(e);if(t)return t}return null}getFramebuffer(){return this.textureTransform&&this.textureTransform.getFramebuffer()}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"elementCount"in e&&this.model.setVertexCount(e.elementCount);const t=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const n of t)n.update(e)}_initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{gl:t}=this;this._buildResourceTransforms(t,e),e=this._updateModelProps(e),this.model=new P.Z(t,Object.assign({},e,{fs:e.fs||s({version:A(e.vs)}),id:e.id||"transform-model",drawMode:e.drawMode||0,vertexCount:e.elementCount})),this.bufferTransform&&this.bufferTransform.setupResources({model:this.model})}_updateModelProps(e){let t=Object.assign({},e);const n=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of n)t=r.updateModelProps(t);return t}_buildResourceTransforms(e,t){(function(e){if(!(0,C.nK)(e.feedbackBuffers)||!(0,C.nK)(e.feedbackMap)||e.varyings&&e.varyings.length>0)return!0;return!1})(t)&&(this.bufferTransform=new h(e,t)),function(e){if(!(0,C.nK)(e._sourceTextures)||e._targetTexture||e._targetTextureVarying)return!0;return!1}(t)&&(this.textureTransform=new S(e,t)),(0,d.h)(this.bufferTransform||this.textureTransform,"must provide source/feedback buffers or source/target textures")}_updateDrawOptions(e){let t=Object.assign({},e);const n=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of n)t=Object.assign(t,r.getDrawOptions(t));return t}}},76195:(e,t,n)=>{"use strict";n.d(t,{KQ:()=>d,JD:()=>u,s9:()=>ee,JY:()=>Y,w:()=>q,ZS:()=>V,vd:()=>c,yW:()=>te,UF:()=>s,D0:()=>l,cM:()=>r,kL:()=>G,aQ:()=>ne,dR:()=>H,s8:()=>W});const r=new(n(20251).Z)({id:"luma.gl"});function i(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}const o="Invalid WebGLRenderingContext",a="Requires WebGL2";function s(e){return"undefined"!==typeof WebGLRenderingContext&&e instanceof WebGLRenderingContext||("undefined"!==typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||Boolean(e&&Number.isFinite(e._version)))}function l(e){return"undefined"!==typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||Boolean(e&&2===e._version)}function c(e){return l(e)?e:null}function u(e){return i(s(e),o),e}function d(e){return i(l(e),a),e}const h={};function f(e,t){var n;h[e]=!0,void 0!==t&&(n=t,globalThis.console&&globalThis.console.error&&globalThis.console.error(n))}const p=function e(t){const n=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let r=0;r{var e;e="OESVertexArrayObject emulation library context restored",globalThis.console&&globalThis.console.log&&globalThis.console.log(e),t.reset_()}),!0),this.reset_()};g.prototype.VERTEX_ARRAY_BINDING_OES=34229,g.prototype.reset_=function(){if(void 0!==this.vertexArrayObjects)for(let t=0;tl(e)?void 0:0,b={3074:e=>l(e)?void 0:36064,35723:e=>l(e)?void 0:4352,35977:y,32937:y,36795:(e,t)=>{const n=l(e)?e.getExtension("EXT_disjoint_timer_query_webgl2"):e.getExtension("EXT_disjoint_timer_query");return n&&n.GPU_DISJOINT_EXT?t(n.GPU_DISJOINT_EXT):0},37445:(e,t)=>{const n=e.getExtension(v);return t(n&&n.UNMASKED_VENDOR_WEBGL||7936)},37446:(e,t)=>{const n=e.getExtension(v);return t(n&&n.UNMASKED_RENDERER_WEBGL||7937)},34047:(e,t)=>{const n=e.luma.extensions.EXT_texture_filter_anisotropic;return n?t(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},32883:y,35071:y,37447:y,36063:(e,t)=>{if(!l(e)){const n=e.getExtension(A);return n?t(n.MAX_COLOR_ATTACHMENTS_WEBGL):0}},35379:y,35374:y,35377:y,34852:e=>{if(!l(e)){const t=e.getExtension(A);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},36203:e=>e.getExtension(m)?2147483647:65535,33001:e=>e.getExtension(m)?16777216:65535,33e3:e=>16777216,37157:y,35373:y,35657:y,36183:y,37137:y,34045:y,35978:y,35979:y,35968:y,35376:y,35375:y,35659:y,37154:y,35371:y,35658:y,35076:y,35077:y,35380:y};const _="ANGLE_instanced_arrays";const w={OES_vertex_array_object:{meta:{suffix:"OES"},createVertexArray:()=>{i(!1,"VertexArray requires WebGL2 or OES_vertex_array_object extension")},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[_]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(e,t){i(0===t,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},WEBGL_draw_buffers:{meta:{suffix:"WEBGL"},drawBuffers:()=>{i(!1)}},EXT_disjoint_timer_query:{meta:{suffix:"EXT"},createQuery:()=>{i(!1)},deleteQuery:()=>{i(!1)},beginQuery:()=>{i(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:()=>{}}},x={readBuffer:(e,t,n)=>{l(e)&&t(n)},getVertexAttrib:(e,t,n,r)=>{const{webgl2:i,ext:o}=function(e,t){return{webgl2:l(e),ext:e.getExtension(t)}}(e,_);let a;switch(r){case 35069:a=!!i&&void 0;break;case 35070:a=i||o?void 0:0}return void 0!==a?a:t(n,r)},getProgramParameter:(e,t,n,r)=>{if(!l(e))switch(r){case 35967:return 35981;case 35971:case 35382:return 0}return t(n,r)},getInternalformatParameter:(e,t,n,r,i)=>l(e)||32937!==i?e.getInternalformatParameter(n,r,i):new Int32Array([0]),getTexParameter(e,t,n,r){if(34046===r){const{extensions:t}=e.luma,n=t.EXT_texture_filter_anisotropic;r=n&&n.TEXTURE_MAX_ANISOTROPY_EXT||34046}return t(n,r)},getParameter:function(e,t,n){const r=b[n],i="function"===typeof r?r(e,t,n):r;return void 0!==i?i:t(n)},hint:(e,t,n,r)=>t(n,r)};function E(e,t){let{extension:n,target:r,target2:o}=t;const a=w[n];i(a);const{meta:s={}}=a,{suffix:l=""}=s,c=e.getExtension(n);for(const i of Object.keys(a)){const t="".concat(i).concat(l);let n=null;"meta"===i||"function"===typeof e[i]||(c&&"function"===typeof c[t]?n=function(){return c[t](...arguments)}:"function"===typeof a[i]&&(n=a[i].bind(r))),n&&(r[i]=n,o[i]=n)}}globalThis.polyfillContext=function(e){e.luma=e.luma||{};const{luma:t}=e;return t.polyfilled||(!function(e){if("function"===typeof e.createVertexArray)return;const t=e.getSupportedExtensions;e.getSupportedExtensions=function(){const e=t.call(this)||[];return e.indexOf("OES_vertex_array_object")<0&&e.push("OES_vertex_array_object"),e};const n=e.getExtension;e.getExtension=function(t){return n.call(this,t)||("OES_vertex_array_object"!==t?null:(e.__OESVertexArrayObject||(this.__OESVertexArrayObject=new g(this)),this.__OESVertexArrayObject))}}(e),function(e){e.luma.extensions={};const t=e.getSupportedExtensions()||[];for(const n of t)e.luma[n]=e.getExtension(n)}(e),function(e,t){for(const n of Object.getOwnPropertyNames(t))"overrides"!==n&&E(e,{extension:n,target:e.luma,target2:e})}(e,w),function(e,t){let{target:n,target2:r}=t;Object.keys(x).forEach((t=>{if("function"===typeof x[t]){const i=e[t]?e[t].bind(e):()=>{},o=x[t].bind(null,e,i);n[t]=o,r[t]=o}}))}(e,{target:t,target2:e}),t.polyfilled=!0),e};const S={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,36006:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,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,35723:4352,36010:null,35977:!1,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},C=(e,t,n)=>t?e.enable(n):e.disable(n),P=(e,t,n)=>e.hint(n,t),T=(e,t,n)=>e.pixelStorei(n,t);function M(e){return Array.isArray(e)||ArrayBuffer.isView(e)}const k={3042:C,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:C,2885:(e,t)=>e.cullFace(t),2929:C,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:C,35723:P,36006:(e,t)=>{const n=l(e)?36009:36160;return e.bindFramebuffer(n,t)},2886:(e,t)=>e.frontFace(t),33170:P,2849:(e,t)=>e.lineWidth(t),32823:C,32824:"polygonOffset",10752:"polygonOffset",35977:C,32938:"sampleCoverage",32939:"sampleCoverage",3089:C,3088:(e,t)=>e.scissor(...t),2960:C,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:T,3317:T,37440:T,37441:T,37443:T,3330:T,3332:T,3331:T,36010:(e,t)=>e.bindFramebuffer(36008,t),3314:T,32878:T,3316:T,3315:T,32877:T,framebuffer:(e,t)=>{const n=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,n)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{t=M(t)?t:[t,t],e.blendEquationSeparate(...t)},blendFunc:(e,t)=>{t=M(t)&&2===t.length?[...t,...t]:t,e.blendFuncSeparate(...t)},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=M(t)?t:[t,t];const[n,r]=t;e.stencilMaskSeparate(1028,n),e.stencilMaskSeparate(1029,r)},stencilFunc:(e,t)=>{t=M(t)&&3===t.length?[...t,...t]:t;const[n,r,i,o,a,s]=t;e.stencilFuncSeparate(1028,n,r,i),e.stencilFuncSeparate(1029,o,a,s)},stencilOp:(e,t)=>{t=M(t)&&3===t.length?[...t,...t]:t;const[n,r,i,o,a,s]=t;e.stencilOpSeparate(1028,n,r,i),e.stencilOpSeparate(1029,o,a,s)},viewport:(e,t)=>e.viewport(...t)};function R(e,t,n){return void 0!==t[e]?t[e]:n[e]}const O={blendEquation:(e,t,n)=>e.blendEquationSeparate(R(32777,t,n),R(34877,t,n)),blendFunc:(e,t,n)=>e.blendFuncSeparate(R(32969,t,n),R(32968,t,n),R(32971,t,n),R(32970,t,n)),polygonOffset:(e,t,n)=>e.polygonOffset(R(32824,t,n),R(10752,t,n)),sampleCoverage:(e,t,n)=>e.sampleCoverage(R(32938,t,n),R(32939,t,n)),stencilFuncFront:(e,t,n)=>e.stencilFuncSeparate(1028,R(2962,t,n),R(2967,t,n),R(2963,t,n)),stencilFuncBack:(e,t,n)=>e.stencilFuncSeparate(1029,R(34816,t,n),R(36003,t,n),R(36004,t,n)),stencilOpFront:(e,t,n)=>e.stencilOpSeparate(1028,R(2964,t,n),R(2965,t,n),R(2966,t,n)),stencilOpBack:(e,t,n)=>e.stencilOpSeparate(1029,R(34817,t,n),R(34818,t,n),R(34819,t,n))},I={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,n)=>e({[t]:n}),hint:(e,t,n)=>e({[t]:n}),bindFramebuffer:(e,t,n)=>{switch(t){case 36160:return e({36006:n,36010:n});case 36009:return e({36006:n});case 36008:return e({36010:n});default:return null}},blendColor:(e,t,n,r,i)=>e({32773:new Float32Array([t,n,r,i])}),blendEquation:(e,t)=>e({32777:t,34877:t}),blendEquationSeparate:(e,t,n)=>e({32777:t,34877:n}),blendFunc:(e,t,n)=>e({32969:t,32968:n,32971:t,32970:n}),blendFuncSeparate:(e,t,n,r,i)=>e({32969:t,32968:n,32971:r,32970:i}),clearColor:(e,t,n,r,i)=>e({3106:new Float32Array([t,n,r,i])}),clearDepth:(e,t)=>e({2931:t}),clearStencil:(e,t)=>e({2961:t}),colorMask:(e,t,n,r,i)=>e({3107:[t,n,r,i]}),cullFace:(e,t)=>e({2885:t}),depthFunc:(e,t)=>e({2932:t}),depthRange:(e,t,n)=>e({2928:new Float32Array([t,n])}),depthMask:(e,t)=>e({2930:t}),frontFace:(e,t)=>e({2886:t}),lineWidth:(e,t)=>e({2849:t}),polygonOffset:(e,t,n)=>e({32824:t,10752:n}),sampleCoverage:(e,t,n)=>e({32938:t,32939:n}),scissor:(e,t,n,r,i)=>e({3088:new Int32Array([t,n,r,i])}),stencilMask:(e,t)=>e({2968:t,36005:t}),stencilMaskSeparate:(e,t,n)=>e({[1028===t?2968:36005]:n}),stencilFunc:(e,t,n,r)=>e({2962:t,2967:n,2963:r,34816:t,36003:n,36004:r}),stencilFuncSeparate:(e,t,n,r,i)=>e({[1028===t?2962:34816]:n,[1028===t?2967:36003]:r,[1028===t?2963:36004]:i}),stencilOp:(e,t,n,r)=>e({2964:t,2965:n,2966:r,34817:t,34818:n,34819:r}),stencilOpSeparate:(e,t,n,r,i)=>e({[1028===t?2964:34817]:n,[1028===t?2965:34818]:r,[1028===t?2966:34819]:i}),viewport:(e,t,n,r,i)=>e({2978:[t,n,r,i]})},L=(e,t)=>e.isEnabled(t),D={3042:L,2884:L,2929:L,3024:L,32823:L,32926:L,32928:L,3089:L,2960:L,35977:L};function N(e){for(const t in e)return!1;return!0}function F(e,t){if(e===t)return!0;const n=Array.isArray(e)||ArrayBuffer.isView(e),r=Array.isArray(t)||ArrayBuffer.isView(t);if(n&&r&&e.length===t.length){for(let n=0;n{})}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=e,this.program=null,this.stateStack=[],this.enable=!0,this.cache=t?V(e):Object.assign({},S),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){this.stateStack.push({})}pop(){i(this.stateStack.length>0);const e=this.stateStack[this.stateStack.length-1];H(this.gl,e),this.stateStack.pop()}_updateCache(e){let t,n=!1;const r=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(const o in e){i(void 0!==o);const a=e[o],s=this.cache[o];F(a,s)||(n=!0,t=s,r&&!(o in r)&&(r[o]=s),this.cache[o]=a)}return{valueChanged:n,oldValue:t}}}function Z(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{enable:n=!0,copyState:r}=t;if(i(void 0!==r),!e.state){const{polyfillContext:t}=globalThis;t&&t(e),e.state=new z(e,{copyState:r}),function(e){const t=e.useProgram.bind(e);e.useProgram=function(n){e.state.program!==n&&(t(n),e.state.program=n)}}(e);for(const n in I){B(e,n,I[n])}j(e,"getParameter"),j(e,"isEnabled")}return e.state.enable=n,e}function U(e){i(e.state),e.state.pop()}function H(e,t){if(i(s(e),"setParameters requires a WebGL context"),N(t))return;const n={};for(const i in t){const r=Number(i),o=k[i];o&&("string"===typeof o?n[o]=!0:o(e,t[i],r))}const r=e.state&&e.state.cache;if(r)for(const i in n){(0,O[i])(e,t,r)}}function V(e,t){if("number"===typeof(t=t||S)){const n=t,r=D[n];return r?r(e,n):e.getParameter(n)}const n=Array.isArray(t)?t:Object.keys(t),r={};for(const i of n){const t=D[i];r[i]=t?t(e,Number(i)):e.getParameter(Number(i))}return r}function G(e){H(e,S)}function W(e,t,n){if(N(t))return n(e);const{nocatch:r=!0}=t;let i;if(function(e){e.state||Z(e,{copyState:!1}),e.state.push()}(e),H(e,t),r)i=n(e),U(e);else try{i=n(e)}finally{U(e)}return i}function q(e){const{luma:t}=e;if(e.canvas&&t){const{clientWidth:n}=t.canvasSizeInfo;return n?e.drawingBufferWidth/n:1}return 1}function Y(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(e,t,n,r,i){const o=X(e[0],t,n);let a=K(e[1],t,r,i),s=X(e[0]+1,t,n);const l=s===n-1?s:s-1;let c;s=K(e[1]+1,t,r,i),i?(s=0===s?s:s+1,c=a,a=s):c=s===r-1?s:s-1;return{x:o,y:a,width:Math.max(l-o+1,1),height:Math.max(c-a+1,1)}}(t,q(e),e.drawingBufferWidth,e.drawingBufferHeight,n)}function X(e,t,n){return Math.min(Math.round(e*t),n-1)}function K(e,t,n,r){return r?Math.max(0,n-1-Math.round(e*t)):Math.min(Math.round(e*t),n-1)}const Q=(0,n(89258).Z)(),$=Q&&"undefined"!==typeof document,J={webgl2:!0,webgl1:!0,throwOnError:!0,manageState:!0,canvas:null,debug:!1,width:800,height:600};function ee(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(Q,"createGLContext only available in the browser.\nCreate your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils"),e=Object.assign({},J,e);const{width:t,height:n}=e;function o(t){if(e.throwOnError)throw new Error(t);return console.error(t),null}let a;e.onError=o;const{canvas:s}=e,c=function(e){let t,{canvas:n,width:r=800,height:i=600,onError:o}=e;if("string"===typeof n){$&&"complete"===document.readyState||o("createGLContext called on canvas '".concat(n,"' before page was loaded")),t=document.getElementById(n)}else n?t=n:(t=document.createElement("canvas"),t.id="lumagl-canvas",t.style.width=Number.isFinite(r)?"".concat(r,"px"):"100%",t.style.height=Number.isFinite(i)?"".concat(i,"px"):"100%",document.body.insertBefore(t,document.body.firstChild));return t}({canvas:s,width:t,height:n,onError:o});return a=function(e,t){const{onError:n}=t;let r=null;const i=e=>r=e.statusMessage||r;e.addEventListener("webglcontextcreationerror",i,!1);const{webgl1:o=!0,webgl2:a=!0}=t;let s=null;a&&(s=s||e.getContext("webgl2",t),s=s||e.getContext("experimental-webgl2",t));o&&(s=s||e.getContext("webgl",t),s=s||e.getContext("experimental-webgl",t));if(e.removeEventListener("webglcontextcreationerror",i,!1),!s)return n("Failed to create ".concat(a&&!o?"WebGL2":"WebGL"," context: ").concat(r||"Unknown error"));t.onContextLost&&e.addEventListener("webglcontextlost",t.onContextLost,!1);t.onContextRestored&&e.addEventListener("webglcontextrestored",t.onContextRestored,!1);return s}(c,e),a?(a=te(a,e),function(e){const t=l(e)?"WebGL2":"WebGL1",n=function(e){const t=e.getParameter(7936),n=e.getParameter(7937),r=e.getExtension("WEBGL_debug_renderer_info"),i=r&&e.getParameter(r.UNMASKED_VENDOR_WEBGL||7936),o=r&&e.getParameter(r.UNMASKED_RENDERER_WEBGL||7937);return{vendor:i||t,renderer:o||n,vendorMasked:t,rendererMasked:n,version:e.getParameter(7938),shadingLanguageVersion:e.getParameter(35724)}}(e),i=n?"(".concat(n.vendor,",").concat(n.renderer,")"):"",o=e.debug?" debug":"";r.info(1,"".concat(t).concat(o," context ").concat(i))()}(a),a):null}function te(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||e._instrumented)return e;e._version=e._version||function(e){if("undefined"!==typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext)return 2;return 1}(e),e.luma=e.luma||{},e.luma.canvasSizeInfo=e.luma.canvasSizeInfo||{},t=Object.assign({},J,t);const{manageState:n,debug:i}=t;return n&&Z(e,{copyState:!1,log:function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(e.canvas){return void function(e,t,n){let i="width"in n?n.width:e.canvas.clientWidth,o="height"in n?n.height:e.canvas.clientHeight;i&&o||(r.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,i=e.canvas.width||1,o=e.canvas.height||1);e.luma=e.luma||{},e.luma.canvasSizeInfo=e.luma.canvasSizeInfo||{};const a=e.luma.canvasSizeInfo;if(a.clientWidth!==i||a.clientHeight!==o||a.devicePixelRatio!==t){let n=t;const a=Math.floor(i*n),s=Math.floor(o*n);e.canvas.width=a,e.canvas.height=s,e.drawingBufferWidth===a&&e.drawingBufferHeight===s||(r.warn("Device pixel ratio clamped")(),n=Math.min(e.drawingBufferWidth/i,e.drawingBufferHeight/o),e.canvas.width=Math.floor(i*n),e.canvas.height=Math.floor(o*n)),Object.assign(e.luma.canvasSizeInfo,{clientWidth:i,clientHeight:o,devicePixelRatio:t})}}(e,function(e){const t="undefined"===typeof window?1:window.devicePixelRatio||1;return Number.isFinite(e)?e<=0?1:e:e?t:1}(t.useDevicePixels),t)}const n=e.getExtension("STACKGL_resize_drawingbuffer");n&&"width"in t&&"height"in t&&n.resize(t.width,t.height)}},91203:(e,t,n)=>{"use strict";n.d(t,{H:()=>r,Y:()=>i});const r="vs",i="fs"},11558:(e,t,n)=>{"use strict";n.d(t,{O_:()=>a,Lm:()=>d,ZP:()=>u});var r=n(91203),i=n(7064);const o={[r.H]:"#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n",[r.Y]:"#ifdef MODULE_MATERIAL\n gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n logdepth_setFragDepth();\n#endif\n"},a="__LUMA_INJECT_DECLARATIONS__",s=/void\s+main\s*\([^)]*\)\s*\{\n?/,l=/}\n?[^{}]*$/,c=[];function u(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const u=t===r.H;for(const r in n){const t=n[r];t.sort(((e,t)=>e.order-t.order)),c.length=t.length;for(let e=0,n=t.length;ee+i)));break;case"vs:#main-end":u&&(e=e.replace(l,(e=>i+e)));break;case"fs:#decl":u||(e=e.replace(a,i));break;case"fs:#main-start":u||(e=e.replace(s,(e=>e+i)));break;case"fs:#main-end":u||(e=e.replace(l,(e=>i+e)));break;default:e=e.replace(r,(e=>e+i))}}return e=e.replace(a,""),i&&(e=e.replace(/\}\s*$/,(e=>e+o[t]))),e}function d(e){const t={};return(0,i.Z)(Array.isArray(e)&&e.length>1),e.forEach((e=>{for(const n in e)t[n]=t[n]?"".concat(t[n],"\n").concat(e[n]):e[n]})),t}},48424:(e,t,n)=>{"use strict";n.d(t,{N:()=>u,s:()=>d});const r="#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\n\nstruct AmbientLight {\n vec3 color;\n};\n\nstruct PointLight {\n vec3 color;\n vec3 position;\n vec3 attenuation;\n};\n\nstruct DirectionalLight {\n vec3 color;\n vec3 direction;\n};\n\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\n\nuniform bool lighting_uEnabled;\n\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\n return pointLight.attenuation.x\n + pointLight.attenuation.y * distance\n + pointLight.attenuation.z * distance * distance;\n}\n\n#endif\n",i={lightSources:{}};function o(){let{color:e=[0,0,0],intensity:t=1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.map((e=>e*t/255))}const a={name:"lights",vs:r,fs:r,getUniforms:function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;if("lightSources"in t){const{ambientLight:e,pointLights:n,directionalLights:r}=t.lightSources||{};return e||n&&n.length>0||r&&r.length>0?Object.assign({},function(e){let{ambientLight:t,pointLights:n=[],directionalLights:r=[]}=e;const i={};return i["lighting_uAmbientLight.color"]=t?o(t):[0,0,0],n.forEach(((e,t)=>{i["lighting_uPointLight[".concat(t,"].color")]=o(e),i["lighting_uPointLight[".concat(t,"].position")]=e.position,i["lighting_uPointLight[".concat(t,"].attenuation")]=e.attenuation||[1,0,0]})),i.lighting_uPointLightCount=n.length,r.forEach(((e,t)=>{i["lighting_uDirectionalLight[".concat(t,"].color")]=o(e),i["lighting_uDirectionalLight[".concat(t,"].direction")]=e.direction})),i.lighting_uDirectionalLightCount=r.length,i}({ambientLight:e,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in t){const n={pointLights:[],directionalLights:[]};for(const e of t.lights||[])switch(e.type){case"ambient":n.ambientLight=e;break;case"directional":n.directionalLights.push(e);break;case"point":n.pointLights.push(e)}return e({lightSources:n})}return{}},defines:{MAX_LIGHTS:3}},s="\nuniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3 lighting_uSpecularColor;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normal_worldspace);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n specular = pow(specular_angle, lighting_uShininess);\n }\n lambertian = max(lambertian, 0.0);\n return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = surfaceColor;\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = vec3(0, 0, 0);\n vec3 surfaceColor = vec3(0, 0, 0);\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n",l={};function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l;if(!("material"in e))return{};const{material:t}=e;return t?function(e){const{ambient:t=.35,diffuse:n=.6,shininess:r=32,specularColor:i=[30,30,30]}=e;return{lighting_uAmbient:t,lighting_uDiffuse:n,lighting_uShininess:r,lighting_uSpecularColor:i.map((e=>e/255))}}(t):{lighting_uEnabled:!1}}const u={name:"gouraud-lighting",dependencies:[a],vs:s,defines:{LIGHTING_VERTEX:1},getUniforms:c},d={name:"phong-lighting",dependencies:[a],fs:s,defines:{LIGHTING_FRAGMENT:1},getUniforms:c}},7064:(e,t,n)=>{"use strict";function r(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}n.d(t,{Z:()=>r})},71254:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(78501),i=n(59661),o=n(13413);const a={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},s={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}};class l{static getBytesPerElement(e){return(0,r.vN)(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){(0,i.h)(e.size);return(0,r.vN)(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(){for(var e=arguments.length,t=new Array(e),n=0;nthis._assign(e))),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return l.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return l.getBytesPerVertex(this)}_assign(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=(0,o.k)("Accessor",e,s),void 0!==e.type&&(this.type=e.type,5124!==e.type&&5125!==e.type||(this.integer=!0)),void 0!==e.size&&(this.size=e.size),void 0!==e.offset&&(this.offset=e.offset),void 0!==e.stride&&(this.stride=e.stride),void 0!==e.normalized&&(this.normalized=e.normalized),void 0!==e.integer&&(this.integer=e.integer),void 0!==e.divisor&&(this.divisor=e.divisor),void 0!==e.buffer&&(this.buffer=e.buffer),void 0!==e.index&&("boolean"===typeof e.index?this.index=e.index?1:0:this.index=e.index),void 0!==e.instanced&&(this.divisor=e.instanced?1:0),void 0!==e.isInstanced&&(this.divisor=e.isInstanced?1:0),this}}},64180:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var r=n(1112),i=n(71254),o=n(78501),a=n(76195),s=n(59661),l=n(13413);const c={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},u={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:c},d={removedProps:c};class h extends r.Z{get[Symbol.toStringTag](){return"Buffer"}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,t),this.stubRemovedMethods("Buffer","v6.0",["layout","setLayout","getIndexedParameter"]),this.target=t.target||(this.gl.webgl2?36662:34962),this.initialize(t),Object.seal(this)}getElementCount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.accessor;return Math.round(this.byteLength/i.Z.getBytesPerElement(e))}getVertexCount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.accessor;return Math.round(this.byteLength/i.Z.getBytesPerVertex(e))}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ArrayBuffer.isView(e)&&(e={data:e}),Number.isFinite(e)&&(e={byteLength:e}),e=(0,l.k)("Buffer",e,u),this.usage=e.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},e,e.accessor)),e.data?this._setData(e.data,e.offset,e.byteLength):this._setByteLength(e.byteLength||0),this}setProps(e){return"accessor"in(e=(0,l.k)("Buffer",e,d))&&this.setAccessor(e.accessor),this}setAccessor(e){return delete(e=Object.assign({},e)).buffer,this.accessor=new i.Z(e),this}reallocate(e){return e>this.byteLength?(this._setByteLength(e),!0):(this.bytesUsed=e,!1)}setData(e){return this.initialize(e)}subData(e){ArrayBuffer.isView(e)&&(e={data:e});const{data:t,offset:n=0,srcOffset:r=0}=e,i=e.byteLength||e.length;(0,s.h)(t);const o=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(o,this.handle),0!==r||void 0!==i?((0,a.KQ)(this.gl),this.gl.bufferSubData(this.target,n,t,r,i)):this.gl.bufferSubData(o,n,t),this.gl.bindBuffer(o,null),this.debugData=null,this._inferType(t),this}copyData(e){let{sourceBuffer:t,readOffset:n=0,writeOffset:r=0,size:i}=e;const{gl:o}=this;return(0,a.KQ)(o),o.bindBuffer(36662,t.handle),o.bindBuffer(36663,this.handle),o.copyBufferSubData(36662,36663,n,r,i),o.bindBuffer(36662,null),o.bindBuffer(36663,null),this.debugData=null,this}getData(){let{dstData:e=null,srcByteOffset:t=0,dstOffset:n=0,length:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,a.KQ)(this.gl);const i=(0,o.vN)(this.accessor.type||5126,{clamped:!1}),l=this._getAvailableElementCount(t),c=n;let u,d;e?(d=e.length,u=d-c):(u=Math.min(l,r||l),d=c+u);const h=Math.min(l,u);return r=r||h,(0,s.h)(r<=h),e=e||new i(d),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,t,e,n,r),this.gl.bindBuffer(36662,null),e}bind(){let{target:e=this.target,index:t=this.accessor&&this.accessor.index,offset:n=0,size:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 35345===e||35982===e?void 0!==r?this.gl.bindBufferRange(e,t,this.handle,n,r):((0,s.h)(0===n),this.gl.bindBufferBase(e,t,this.handle)):this.gl.bindBuffer(e,this.handle),this}unbind(){let{target:e=this.target,index:t=this.accessor&&this.accessor.index}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 35345===e||35982===e?this.gl.bindBufferBase(e,t,null):this.gl.bindBuffer(e,null),this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(10,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.byteLength+t;(0,s.h)(ArrayBuffer.isView(e)),this._trackDeallocatedMemory();const r=this._getTarget();this.gl.bindBuffer(r,this.handle),this.gl.bufferData(r,n,this.usage),this.gl.bufferSubData(r,t,e),this.gl.bindBuffer(r,null),this.debugData=e.slice(0,10),this.bytesUsed=n,this._trackAllocatedMemory(n);const a=(0,o.O)(e);return(0,s.h)(a),this.setAccessor(new i.Z(this.accessor,{type:a})),this}_setByteLength(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.usage;(0,s.h)(e>=0),this._trackDeallocatedMemory();let n=e;0===e&&(n=new Float32Array(0));const r=this._getTarget();return this.gl.bindBuffer(r,this.handle),this.gl.bufferData(r,n,t),this.gl.bindBuffer(r,null),this.usage=t,this.debugData=null,this.bytesUsed=e,this._trackAllocatedMemory(e),this}_getTarget(){return this.gl.webgl2?36663:this.target}_getAvailableElementCount(e){const t=e/(0,o.vN)(this.accessor.type||5126,{clamped:!1}).BYTES_PER_ELEMENT;return this.getElementCount()-t}_inferType(e){this.accessor.type||this.setAccessor(new i.Z(this.accessor,{type:(0,o.O)(e)}))}_createHandle(){return this.gl.createBuffer()}_deleteHandle(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}_getParameter(e){this.gl.bindBuffer(this.target,this.handle);const t=this.gl.getBufferParameter(this.target,e);return this.gl.bindBuffer(this.target,null),t}get type(){return a.cM.deprecated("Buffer.type","Buffer.accessor.type")(),this.accessor.type}get bytes(){return a.cM.deprecated("Buffer.bytes","Buffer.byteLength")(),this.byteLength}setByteLength(e){return a.cM.deprecated("setByteLength","reallocate")(),this.reallocate(e)}updateAccessor(e){return a.cM.deprecated("updateAccessor(...)","setAccessor(new Accessor(buffer.accessor, ...)")(),this.accessor=new i.Z(this.accessor,e),this}}},36708:(e,t,n)=>{"use strict";n.d(t,{$:()=>p,Z:()=>f});var r=n(76195),i=n(59661);const o=256,a=1024,s=16384,l=6144,c=6145,u=6146,d=34041,h="clear: bad arguments";function f(e){let{framebuffer:t=null,color:n=null,depth:l=null,stencil:c=null}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const u={};t&&(u.framebuffer=t);let d=0;n&&(d|=s,!0!==n&&(u.clearColor=n)),l&&(d|=o,!0!==l&&(u.clearDepth=l)),c&&(d|=a,!0!==l&&(u.clearStencil=l)),(0,i.h)(0!==d,h),(0,r.s8)(e,u,(()=>{e.clear(d)}))}function p(e){let{framebuffer:t=null,buffer:n=l,drawBuffer:o=0,value:a=[0,0,0,0]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,r.KQ)(e),(0,r.s8)(e,{framebuffer:t},(()=>{switch(n){case l:switch(a.constructor){case Int32Array:e.clearBufferiv(n,o,a);break;case Uint32Array:e.clearBufferuiv(n,o,a);break;case Float32Array:default:e.clearBufferfv(n,o,a)}break;case c:e.clearBufferfv(c,0,[a]);break;case u:e.clearBufferiv(u,0,[a]);break;case d:const[t,r]=a;e.clearBufferfi(d,0,t,r);break;default:(0,i.h)(!1,h)}}))}},77378:(e,t,n)=>{"use strict";n.d(t,{Km:()=>u,Lv:()=>d,z6:()=>c});var r=n(64282),i=n(46773),o=n(76195),a=n(78501),s=n(59661);var l=n(15671);function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{sourceX:n=0,sourceY:r=0,sourceFormat:i=6408}=t;let{sourceAttachment:o=36064,target:l=null,sourceWidth:c,sourceHeight:u,sourceType:d}=t;const{framebuffer:f,deleteFramebuffer:p}=h(e);(0,s.h)(f);const{gl:g,handle:m,attachments:A}=f;c=c||f.width,u=u||f.height,36064===o&&null===m&&(o=1028),(0,s.h)(A[o]),d=d||A[o].type,l=function(e,t,n,r,i){if(e)return e;t=t||5121;const o=(0,a.vN)(t,{clamped:!1}),l=function(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,s.h)(!1),0}}(n);return new o(r*i*l)}(l,d,i,c,u),d=d||(0,a.O)(l);const v=g.bindFramebuffer(36160,m);return g.readPixels(n,r,c,u,i,d,l),g.bindFramebuffer(36160,v||null),p&&f.delete(),l}function u(e){let{sourceAttachment:t=36064,targetMaxHeight:n=Number.MAX_SAFE_INTEGER}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=c(e,{sourceAttachment:t}),{width:i,height:o}=e;for(;o>n;)({data:r,width:i,height:o}=(0,a.KS)({data:r,width:i,height:o}));(0,a.c$)({data:r,width:i,height:o});const s=document.createElement("canvas");s.width=i,s.height=o;const l=s.getContext("2d"),u=l.createImageData(i,o);return u.data.set(r),l.putImageData(u,0,0),s.toDataURL()}function d(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{sourceX:r=0,sourceY:a=0,targetMipmaplevel:l=0,targetInternalFormat:c=6408}=n;let{targetX:u,targetY:d,targetZ:f,width:p,height:g}=n;const{framebuffer:m,deleteFramebuffer:A}=h(e);(0,s.h)(m);const{gl:v,handle:y}=m,b="undefined"!==typeof u||"undefined"!==typeof d||"undefined"!==typeof f;u=u||0,d=d||0,f=f||0;const _=v.bindFramebuffer(36160,y);(0,s.h)(t);let w=null;if(t instanceof i.Z&&(w=t,p=Number.isFinite(p)?p:w.width,g=Number.isFinite(g)?g:w.height,w.bind(0),t=w.target),b)switch(t){case 3553:case 34067:v.copyTexSubImage2D(t,l,u,d,r,a,p,g);break;case 35866:case 32879:(0,o.KQ)(v).copyTexSubImage3D(t,l,u,d,f,r,a,p,g)}else v.copyTexImage2D(t,l,c,r,a,p,g,0);return w&&w.unbind(),v.bindFramebuffer(36160,_||null),A&&m.delete(),w}function h(e){return e instanceof r.Z?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:(0,l.Y)(e),deleteFramebuffer:!0}}},64282:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(76195),i=n(1112),o=n(81786),a=n(26277),s=n(36708),l=n(77378),c=n(6509),u=n(55562),d=n(59661);const h="Multiple render targets not supported";class f extends i.Z{get[Symbol.toStringTag](){return"Framebuffer"}static isSupported(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{colorBufferFloat:n,colorBufferHalfFloat:r}=t;let i=!0;return n&&(i=Boolean(e.getExtension("EXT_color_buffer_float")||e.getExtension("WEBGL_color_buffer_float")||e.getExtension("OES_texture_float"))),r&&(i=i&&Boolean(e.getExtension("EXT_color_buffer_float")||e.getExtension("EXT_color_buffer_half_float"))),i}static getDefaultFramebuffer(e){return e.luma=e.luma||{},e.luma.defaultFramebuffer=e.luma.defaultFramebuffer||new f(e,{id:"default-framebuffer",handle:null,attachments:{}}),e.luma.defaultFramebuffer}get MAX_COLOR_ATTACHMENTS(){const e=(0,r.KQ)(this.gl);return e.getParameter(e.MAX_COLOR_ATTACHMENTS)}get MAX_DRAW_BUFFERS(){const e=(0,r.KQ)(this.gl);return e.getParameter(e.MAX_DRAW_BUFFERS)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,t),this.width=null,this.height=null,this.attachments={},this.readBuffer=36064,this.drawBuffers=[36064],this.ownResources=[],this.initialize(t),Object.seal(this)}get color(){return this.attachments[36064]||null}get texture(){return this.attachments[36064]||null}get depth(){return this.attachments[36096]||this.attachments[33306]||null}get stencil(){return this.attachments[36128]||this.attachments[33306]||null}initialize(e){let{width:t=1,height:n=1,attachments:r=null,color:i=!0,depth:o=!0,stencil:a=!1,check:s=!0,readBuffer:l,drawBuffers:c}=e;if((0,d.h)(t>=0&&n>=0,"Width and height need to be integers"),this.width=t,this.height=n,r)for(const u in r){const e=r[u];(Array.isArray(e)?e[0]:e).resize({width:t,height:n})}else r=this._createDefaultAttachments(i,o,a,t,n);this.update({clearAttachments:!0,attachments:r,readBuffer:l,drawBuffers:c}),r&&s&&this.checkStatus()}delete(){for(const e of this.ownResources)e.delete();return super.delete(),this}update(e){let{attachments:t={},readBuffer:n,drawBuffers:r,clearAttachments:i=!1,resizeAttachments:o=!0}=e;this.attach(t,{clearAttachments:i,resizeAttachments:o});const{gl:a}=this,s=a.bindFramebuffer(36160,this.handle);return n&&this._setReadBuffer(n),r&&this._setDrawBuffers(r),a.bindFramebuffer(36160,s||null),this}resize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{width:t,height:n}=e;if(null===this.handle)return(0,d.h)(void 0===t&&void 0===n),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;void 0===t&&(t=this.gl.drawingBufferWidth),void 0===n&&(n=this.gl.drawingBufferHeight),t!==this.width&&n!==this.height&&r.cM.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(t,"x").concat(n))();for(const r in this.attachments)this.attachments[r].resize({width:t,height:n});return this.width=t,this.height=n,this}attach(e){let{clearAttachments:t=!1,resizeAttachments:n=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={};t&&Object.keys(this.attachments).forEach((e=>{r[e]=null})),Object.assign(r,e);const i=this.gl.bindFramebuffer(36160,this.handle);for(const o in r){(0,d.h)(void 0!==o,"Misspelled framebuffer binding point?");const e=Number(o),t=r[e];let i=t;if(i)if(i instanceof a.Z)this._attachRenderbuffer({attachment:e,renderbuffer:i});else if(Array.isArray(t)){const[n,r=0,o=0]=t;i=n,this._attachTexture({attachment:e,texture:n,layer:r,level:o})}else this._attachTexture({attachment:e,texture:i,layer:0,level:0});else this._unattach(e);n&&i&&i.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,i||null),Object.assign(this.attachments,e),Object.keys(this.attachments).filter((e=>!this.attachments[e])).forEach((e=>{delete this.attachments[e]}))}checkStatus(){const{gl:e}=this,t=this.getStatus();if(36053!==t)throw new Error(function(e){return(f.STATUS||{})[e]||"Framebuffer error ".concat(e)}(t));return this}getStatus(){const{gl:e}=this,t=e.bindFramebuffer(36160,this.handle),n=e.checkFramebufferStatus(36160);return e.bindFramebuffer(36160,t||null),n}clear(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t,depth:n,stencil:r,drawBuffers:i=[]}=e,o=this.gl.bindFramebuffer(36160,this.handle);return(t||n||r)&&(0,s.Z)(this.gl,{color:t,depth:n,stencil:r}),i.forEach(((e,t)=>{(0,s.$)(this.gl,{drawBuffer:t,value:e})})),this.gl.bindFramebuffer(36160,o||null),this}readPixels(){return r.cM.error("Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)")(),null}readPixelsToBuffer(){return r.cM.error("Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)")(),null}copyToDataUrl(){return r.cM.error("Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)")(),null}copyToImage(){return r.cM.error("Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)")(),null}copyToTexture(){return r.cM.error("Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}blit(){return r.cM.error("Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)")(),null}invalidate(e){let{attachments:t=[],x:n=0,y:i=0,width:o,height:a}=e;const s=(0,r.KQ)(this.gl),l=s.bindFramebuffer(36008,this.handle);return 0===n&&0===i&&void 0===o&&void 0===a?s.invalidateFramebuffer(36008,t):s.invalidateFramebuffer(36008,t,n,i,o,a),s.bindFramebuffer(36008,l),this}getAttachmentParameter(e,t,n){let r=this._getAttachmentParameterFallback(t);return null===r&&(this.gl.bindFramebuffer(36160,this.handle),r=this.gl.getFramebufferAttachmentParameter(36160,e,t),this.gl.bindFramebuffer(36160,null)),n&&r>1e3&&(r=(0,u.km)(this.gl,r)),r}getAttachmentParameters(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:36064,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[];const r={};for(const i of n){r[t?(0,u.km)(this.gl,i):i]=this.getAttachmentParameter(e,i,t)}return r}getParameters(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=Object.keys(this.attachments),n={};for(const r of t){const t=Number(r);n[e?(0,u.km)(this.gl,t):t]=this.getAttachmentParameters(t,e)}return n}show(){return"undefined"!==typeof window&&window.open((0,l.Km)(this),"luma-debug-texture"),this}log(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(e>r.cM.level||"undefined"===typeof window)return this;t=t||"Framebuffer ".concat(this.id);const n=(0,l.Km)(this,{targetMaxHeight:100});return r.cM.image({logLevel:e,message:t,image:n},t)(),this}bind(){let{target:e=36160}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.gl.bindFramebuffer(e,this.handle),this}unbind(){let{target:e=36160}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.gl.bindFramebuffer(e,null),this}_createDefaultAttachments(e,t,n,r,i){let s=null;return e&&(s=s||{},s[36064]=new o.Z(this.gl,{id:"".concat(this.id,"-color0"),pixels:null,format:6408,type:5121,width:r,height:i,mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.ownResources.push(s[36064])),t&&n?(s=s||{},s[33306]=new a.Z(this.gl,{id:"".concat(this.id,"-depth-stencil"),format:35056,width:r,height:111}),this.ownResources.push(s[33306])):t?(s=s||{},s[36096]=new a.Z(this.gl,{id:"".concat(this.id,"-depth"),format:33189,width:r,height:i}),this.ownResources.push(s[36096])):n&&(0,d.h)(!1),s}_unattach(e){const t=this.attachments[e];t&&(t instanceof a.Z?this.gl.framebufferRenderbuffer(36160,e,36161,null):this.gl.framebufferTexture2D(36160,e,3553,null,0),delete this.attachments[e])}_attachRenderbuffer(e){let{attachment:t=36064,renderbuffer:n}=e;const{gl:r}=this;r.framebufferRenderbuffer(36160,t,36161,n.handle),this.attachments[t]=n}_attachTexture(e){let{attachment:t=36064,texture:n,layer:i,level:o}=e;const{gl:a}=this;switch(a.bindTexture(n.target,n.handle),n.target){case 35866:case 32879:(0,r.KQ)(a).framebufferTextureLayer(36160,t,n.target,o,i);break;case 34067:const e=function(e){return e<34069?e+34069:e}(i);a.framebufferTexture2D(36160,t,e,n.handle,o);break;case 3553:a.framebufferTexture2D(36160,t,3553,n.handle,o);break;default:(0,d.h)(!1,"Illegal texture type")}a.bindTexture(n.target,null),this.attachments[t]=n}_setReadBuffer(e){const t=(0,r.vd)(this.gl);t?t.readBuffer(e):(0,d.h)(36064===e||1029===e,h),this.readBuffer=e}_setDrawBuffers(e){const{gl:t}=this,n=(0,r.KQ)(t);if(n)n.drawBuffers(e);else{const n=t.getExtension("WEBGL_draw_buffers");n?n.drawBuffersWEBGL(e):(0,d.h)(1===e.length&&(36064===e[0]||1029===e[0]),h)}this.drawBuffers=e}_getAttachmentParameterFallback(e){const t=(0,c.N$)(this.gl);switch(e){case 36052:return t.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return t.WEBGL2?null:8;case 33297:return t.WEBGL2?null:5125;case 33296:return t.WEBGL2||t.EXT_sRGB?null:9729;default:return null}}_createHandle(){return this.gl.createFramebuffer()}_deleteHandle(){this.gl.deleteFramebuffer(this.handle)}_bindHandle(e){return this.gl.bindFramebuffer(36160,e)}}f.ATTACHMENT_PARAMETERS=[36049,36048,33296,33298,33299,33300,33301,33302,33303]},32073:(e,t,n)=>{"use strict";n.d(t,{Z:()=>U});var r=n(1112),i=n(46773),o=n(64282),a=n(76195),s=n(26277),l=n(59661);const c={5126:x.bind(null,"uniform1fv",g,1,E),35664:x.bind(null,"uniform2fv",g,2,E),35665:x.bind(null,"uniform3fv",g,3,E),35666:x.bind(null,"uniform4fv",g,4,E),5124:x.bind(null,"uniform1iv",m,1,E),35667:x.bind(null,"uniform2iv",m,2,E),35668:x.bind(null,"uniform3iv",m,3,E),35669:x.bind(null,"uniform4iv",m,4,E),35670:x.bind(null,"uniform1iv",m,1,E),35671:x.bind(null,"uniform2iv",m,2,E),35672:x.bind(null,"uniform3iv",m,3,E),35673:x.bind(null,"uniform4iv",m,4,E),35674:x.bind(null,"uniformMatrix2fv",g,4,S),35675:x.bind(null,"uniformMatrix3fv",g,9,S),35676:x.bind(null,"uniformMatrix4fv",g,16,S),35678:w,35680:w,5125:x.bind(null,"uniform1uiv",A,1,E),36294:x.bind(null,"uniform2uiv",A,2,E),36295:x.bind(null,"uniform3uiv",A,3,E),36296:x.bind(null,"uniform4uiv",A,4,E),35685:x.bind(null,"uniformMatrix2x3fv",g,6,S),35686:x.bind(null,"uniformMatrix2x4fv",g,8,S),35687:x.bind(null,"uniformMatrix3x2fv",g,6,S),35688:x.bind(null,"uniformMatrix3x4fv",g,12,S),35689:x.bind(null,"uniformMatrix4x2fv",g,8,S),35690:x.bind(null,"uniformMatrix4x3fv",g,12,S),35678:w,35680:w,35679:w,35682:w,36289:w,36292:w,36293:w,36298:w,36299:w,36300:w,36303:w,36306:w,36307:w,36308:w,36311:w},u={},d={},h={},f=[0];function p(e,t,n,r){1===t&&"boolean"===typeof e&&(e=e?1:0),Number.isFinite(e)&&(f[0]=e,e=f);const i=e.length;if(i%t&&a.cM.warn("Uniform size should be multiples of ".concat(t),e)(),e instanceof n)return e;let o=r[i];o||(o=new n(i),r[i]=o);for(let a=0;a{const i=e!==r;return i&&(t.uniform1i(n,r),e=r),i}}function x(e,t,n,r){let i=null,o=null;return(a,s,c)=>{const u=t(c,n),d=u.length;let h=!1;if(null===i)i=new Float32Array(d),o=d,h=!0;else{(0,l.h)(o===d,"Uniform length cannot change.");for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"unnamed";const n=e.match(/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/);return n?n[1]:t}const P=35632,T=35633;function M(e,t,n,r){const i=e.split(/\r?\n/),o={},a={},s=r||C(t)||"(unnamed)",l="".concat(function(e){switch(e){case P:return"fragment";case T:return"vertex";default:return"unknown type"}}(n)," shader ").concat(s);for(let u=0;u1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:": ";const r=e.split(/\r?\n/),i=String(r.length+t-1).length;return r.map(((e,r)=>{const o=String(r+t),a=o.length;return R(o,i-a)+n+e}))}(t);return{shaderName:l,errors:k(o,c),warnings:k(a,c)}}function k(e,t){let n="";for(let r=0;r0&&void 0!==arguments[0]?arguments[0]:this.source;e.startsWith("#version ")||(e="#version 100\n".concat(e)),this.source=e,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle);if(!this.getParameter(35713)){const e=this.gl.getShaderInfoLog(this.handle),{shaderName:t,errors:n,warnings:r}=M(e,this.source,this.shaderType,this.id);throw a.cM.error("GLSL compilation errors in ".concat(t,"\n").concat(n))(),a.cM.warn("GLSL compilation warnings in ".concat(t,"\n").concat(r))(),new Error("GLSL compilation errors in ".concat(t))}}_deleteHandle(){this.gl.deleteShader(this.handle)}_getOptsFromHandle(){return{type:this.getParameter(35663),source:this.getSource()}}}class L extends I{get[Symbol.toStringTag](){return"VertexShader"}constructor(e,t){"string"===typeof t&&(t={source:t}),super(e,Object.assign({},t,{shaderType:35633}))}_createHandle(){return this.gl.createShader(35633)}}class D extends I{get[Symbol.toStringTag](){return"FragmentShader"}constructor(e,t){"string"===typeof t&&(t={source:t}),super(e,Object.assign({},t,{shaderType:35632}))}_createHandle(){return this.gl.createShader(35632)}}var N=n(71254),F=n(2187);class j{constructor(e){this.id=e.id,this.attributeInfos=[],this.attributeInfosByName={},this.attributeInfosByLocation=[],this.varyingInfos=[],this.varyingInfosByName={},Object.seal(this),this._readAttributesFromProgram(e),this._readVaryingsFromProgram(e)}getAttributeInfo(e){const t=Number(e);return Number.isFinite(t)?this.attributeInfosByLocation[t]:this.attributeInfosByName[e]||null}getAttributeLocation(e){const t=this.getAttributeInfo(e);return t?t.location:-1}getAttributeAccessor(e){const t=this.getAttributeInfo(e);return t?t.accessor:null}getVaryingInfo(e){const t=Number(e);return Number.isFinite(t)?this.varyingInfos[t]:this.varyingInfosByName[e]||null}getVaryingIndex(e){const t=this.getVaryingInfo();return t?t.location:-1}getVaryingAccessor(e){const t=this.getVaryingInfo();return t?t.accessor:null}_readAttributesFromProgram(e){const{gl:t}=e,n=t.getProgramParameter(e.handle,35721);for(let r=0;r=0&&this._addAttribute(a,n,i,o)}this.attributeInfos.sort(((e,t)=>e.location-t.location))}_readVaryingsFromProgram(e){const{gl:t}=e;if(!(0,a.D0)(t))return;const n=t.getProgramParameter(e.handle,35971);for(let r=0;re.location-t.location))}_addAttribute(e,t,n,r){const{type:i,components:o}=(0,F.hJ)(n),a={type:i,size:r*o};this._inferProperties(e,t,a);const s={location:e,name:t,accessor:new N.Z(a)};this.attributeInfos.push(s),this.attributeInfosByLocation[e]=s,this.attributeInfosByName[s.name]=s}_inferProperties(e,t,n){/instance/i.test(t)&&(n.divisor=1)}_addVarying(e,t,n,r){const{type:i,components:o}=(0,F.hJ)(n),a={location:e,name:t,accessor:new N.Z({type:i,size:r*o})};this.varyingInfos.push(a),this.varyingInfosByName[a.name]=a}}var B=n(55562);const z=35981,Z=["setVertexArray","setAttributes","setBuffers","unsetBuffers","use","getUniformCount","getUniformInfo","getUniformLocation","getUniformValue","getVarying","getFragDataLocation","getAttachedShaders","getAttributeCount","getAttributeLocation","getAttributeInfo"];class U extends r.Z{get[Symbol.toStringTag](){return"Program"}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,t),this.stubRemovedMethods("Program","v6.0",Z),this._isCached=!1,this.initialize(t),Object.seal(this),this._setId(t.id)}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{hash:t,vs:n,fs:r,varyings:i,bufferMode:o=z}=e;return this.hash=t||"",this.vs="string"===typeof n?new L(this.gl,{id:"".concat(e.id,"-vs"),source:n}):n,this.fs="string"===typeof r?new D(this.gl,{id:"".concat(e.id,"-fs"),source:r}):r,(0,l.h)(this.vs instanceof L),(0,l.h)(this.fs instanceof D),this.uniforms={},this._textureUniforms={},i&&i.length>0&&((0,a.KQ)(this.gl),this.varyings=i,this.gl2.transformFeedbackVaryings(this.handle,i,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new j(this),this.setProps(e)}delete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._isCached?this:super.delete(e)}setProps(e){return"uniforms"in e&&this.setUniforms(e.uniforms),this}draw(e){let{logPriority:t,drawMode:n=4,vertexCount:r,offset:i=0,start:o,end:s,isIndexed:c=!1,indexType:u=5123,instanceCount:d=0,isInstanced:h=d>0,vertexArray:f=null,transformFeedback:p,framebuffer:g,parameters:m={},uniforms:A,samplers:v}=e;if((A||v)&&(a.cM.deprecated("Program.draw({uniforms})","Program.setUniforms(uniforms)")(),this.setUniforms(A||{})),a.cM.priority>=t){const e=g?g.id:"default",i="mode=".concat((0,B.km)(this.gl,n)," verts=").concat(r," ")+"instances=".concat(d," indexType=").concat((0,B.km)(this.gl,u)," ")+"isInstanced=".concat(h," isIndexed=").concat(c," ")+"Framebuffer=".concat(e);a.cM.log(t,i)()}return(0,l.h)(f),this.gl.useProgram(this.handle),!(!this._areTexturesRenderable()||0===r||h&&0===d)&&(f.bindForDraw(r,d,(()=>{if(void 0!==g&&(m=Object.assign({},m,{framebuffer:g})),p){const e=(0,F.$Z)(n);p.begin(e)}this._bindTextures(),(0,a.s8)(this.gl,m,(()=>{c&&h?this.gl2.drawElementsInstanced(n,r,u,i,d):c&&(0,a.D0)(this.gl)&&!isNaN(o)&&!isNaN(s)?this.gl2.drawRangeElements(n,o,s,r,u,i):c?this.gl.drawElements(n,r,u,i):h?this.gl2.drawArraysInstanced(n,i,r,d):this.gl.drawArrays(n,i,r)})),p&&p.end()})),!0)}setUniforms(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a.cM.priority>=2&&function(e,t,n){for(const r in e){const i=e[r];if((!n||Boolean(n[r]))&&!b(i))throw t=t?"".concat(t," "):"",console.error("".concat(t," Bad uniform ").concat(r),i),new Error("".concat(t," Bad uniform ").concat(r))}}(e,this.id,this._uniformSetters),this.gl.useProgram(this.handle);for(const t in e){const n=e[t],r=this._uniformSetters[t];if(r){let e=n,a=!1;if(e instanceof o.Z&&(e=e.texture),e instanceof i.Z)if(a=this.uniforms[t]!==n,a){void 0===r.textureIndex&&(r.textureIndex=this._textureIndexCounter++);const n=e,{textureIndex:i}=r;n.bind(i),e=i,this._textureUniforms[t]=n}else e=r.textureIndex;else this._textureUniforms[t]&&delete this._textureUniforms[t];(r(e)||a)&&_(this.uniforms,t,n)}}return this}_areTexturesRenderable(){let e=!0;for(const t in this._textureUniforms){const n=this._textureUniforms[t];n.update(),e=e&&n.loaded}return e}_bindTextures(){for(const e in this._textureUniforms){const t=this._uniformSetters[e].textureIndex;this._textureUniforms[e].bind(t)}}_createHandle(){return this.gl.createProgram()}_deleteHandle(){this.gl.deleteProgram(this.handle)}_getOptionsFromHandle(e){const t=this.gl.getAttachedShaders(e),n={};for(const r of t){switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:n.vs=new L({handle:r});break;case 35632:n.fs=new D({handle:r})}}return n}_getParameter(e){return this.gl.getProgramParameter(this.handle,e)}_setId(e){if(!e){const e=this._getName();this.id=(0,O.hQ)(e)}}_getName(){let e=this.vs.getName()||this.fs.getName();return e=e.replace(/shader/i,""),e=e?"".concat(e,"-program"):"program",e}_compileAndLink(){const{gl:e}=this;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),a.cM.time(4,"linkProgram for ".concat(this._getName()))(),e.linkProgram(this.handle),a.cM.timeEnd(4,"linkProgram for ".concat(this._getName()))(),e.debug||a.cM.level>0){if(!e.getProgramParameter(this.handle,35714))throw new Error("Error linking: ".concat(e.getProgramInfoLog(this.handle)));e.validateProgram(this.handle);if(!e.getProgramParameter(this.handle,35715))throw new Error("Error validating: ".concat(e.getProgramInfoLog(this.handle)))}}_readUniformLocationsFromLinkedProgram(){const{gl:e}=this;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(let t=0;t1)for(let t=0;t{"use strict";n.d(t,{Z:()=>l});var r=n(1112);const i="EXT_color_buffer_float",o={33189:{bpp:2},33190:{gl2:!0,bpp:3},36012:{gl2:!0,bpp:4},36168:{bpp:1},34041:{bpp:4},35056:{gl2:!0,bpp:4},36013:{gl2:!0,bpp:5},32854:{bpp:2},36194:{bpp:2},32855:{bpp:2},33321:{gl2:!0,bpp:1},33330:{gl2:!0,bpp:1},33329:{gl2:!0,bpp:1},33332:{gl2:!0,bpp:2},33331:{gl2:!0,bpp:2},33334:{gl2:!0,bpp:4},33333:{gl2:!0,bpp:4},33323:{gl2:!0,bpp:2},33336:{gl2:!0,bpp:2},33335:{gl2:!0,bpp:2},33338:{gl2:!0,bpp:4},33337:{gl2:!0,bpp:4},33340:{gl2:!0,bpp:8},33339:{gl2:!0,bpp:8},32849:{gl2:!0,bpp:3},32856:{gl2:!0,bpp:4},32857:{gl2:!0,bpp:4},36220:{gl2:!0,bpp:4},36238:{gl2:!0,bpp:4},36975:{gl2:!0,bpp:4},36214:{gl2:!0,bpp:8},36232:{gl2:!0,bpp:8},36226:{gl2:!0,bpp:16},36208:{gl2:!0,bpp:16},33325:{gl2:i,bpp:2},33327:{gl2:i,bpp:4},34842:{gl2:i,bpp:8},33326:{gl2:i,bpp:4},33328:{gl2:i,bpp:8},34836:{gl2:i,bpp:16},35898:{gl2:i,bpp:4}};var a=n(76195),s=n(59661);class l extends r.Z{get[Symbol.toStringTag](){return"Renderbuffer"}static isSupported(e){let{format:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{format:null};return!t||function(e,t,n){const r=n[t];if(!r)return!1;const i=(0,a.D0)(e)&&r.gl2||r.gl1;return"string"===typeof i?e.getExtension(i):i}(e,t,o)}static getSamplesForFormat(e,t){let{format:n}=t;return e.getInternalformatParameter(36161,n,32937)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,t),this.initialize(t),Object.seal(this)}initialize(e){let{format:t,width:n=1,height:r=1,samples:i=0}=e;return(0,s.h)(t,"Needs format"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),0!==i&&(0,a.D0)(this.gl)?this.gl.renderbufferStorageMultisample(36161,i,t,n,r):this.gl.renderbufferStorage(36161,t,n,r),this.format=t,this.width=n,this.height=r,this.samples=i,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*o[this.format].bpp),this}resize(e){let{width:t,height:n}=e;return t!==this.width||n!==this.height?this.initialize({width:t,height:n,format:this.format,samples:this.samples}):this}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}_bindHandle(e){this.gl.bindRenderbuffer(36161,e)}_syncHandle(e){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}_getParameter(e){this.gl.bindRenderbuffer(36161,this.handle);return this.gl.getRenderbufferParameter(36161,e)}}},1112:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(76195),i=n(53886),o=n(55562),a=n(59661),s=n(39042),l=n(43331);const c="Resource subclass must define virtual methods";class u{get[Symbol.toStringTag](){return"Resource"}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,r.JD)(e);const{id:n,userData:i={}}=t;this.gl=e,this.gl2=e,this.id=n||(0,s.hQ)(this[Symbol.toStringTag]),this.userData=i,this._bound=!1,this._handle=t.handle,void 0===this._handle&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}toString(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")}get handle(){return this._handle}delete(){let{deleteChildren:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,t&&e&&t.filter(Boolean).forEach((e=>e.delete())),this}bind(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.handle;return"function"!==typeof t?(this._bindHandle(t),this):(this._bound?e=t():(this._bindHandle(this.handle),this._bound=!0,e=t(),this._bound=!1,this._bindHandle(null)),e)}unbind(){this.bind(null)}getParameter(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=(0,o.sF)(this.gl,e),(0,a.h)(e);const n=(this.constructor.PARAMETERS||{})[e];if(n){const e=(0,r.D0)(this.gl);if(!((!("webgl2"in n)||e)&&(!("extension"in n)||this.gl.getExtension(n.extension)))){const t=n.webgl1,r="webgl2"in n?n.webgl2:n.webgl1;return e?r:t}}return this._getParameter(e,t)}getParameters(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{parameters:t,keys:n}=e,i=this.constructor.PARAMETERS||{},a=(0,r.D0)(this.gl),s={},l=t||Object.keys(i);for(const r of l){const t=i[r];if(t&&(!("webgl2"in t)||a)&&(!("extension"in t)||this.gl.getExtension(t.extension))){const i=n?(0,o.km)(this.gl,r):r;s[i]=this.getParameter(r,e),n&&"GLenum"===t.type&&(s[i]=(0,o.km)(this.gl,s[i]))}}return s}setParameter(e,t){e=(0,o.sF)(this.gl,e),(0,a.h)(e);const n=(this.constructor.PARAMETERS||{})[e];if(n){const e=(0,r.D0)(this.gl);if(!((!("webgl2"in n)||e)&&(!("extension"in n)||this.gl.getExtension(n.extension))))throw new Error("Parameter not available on this platform");"GLenum"===n.type&&(t=(0,o.sF)(t))}return this._setParameter(e,t),this}setParameters(e){for(const t in e)this.setParameter(t,e[t]);return this}stubRemovedMethods(e,t,n){return(0,l.F)(this,e,t,n)}initialize(e){}_createHandle(){throw new Error(c)}_deleteHandle(){throw new Error(c)}_bindHandle(e){throw new Error(c)}_getOptsFromHandle(){throw new Error(c)}_getParameter(e,t){throw new Error(c)}_setParameter(e,t){throw new Error(c)}_context(){return this.gl.luma=this.gl.luma||{},this.gl.luma}_addStats(){const e=this[Symbol.toStringTag],t=i.lR.get("Resource Counts");t.get("Resources Created").incrementCount(),t.get("".concat(e,"s Created")).incrementCount(),t.get("".concat(e,"s Active")).incrementCount()}_removeStats(){const e=this[Symbol.toStringTag];i.lR.get("Resource Counts").get("".concat(e,"s Active")).decrementCount()}_trackAllocatedMemory(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this[Symbol.toStringTag];this._trackAllocatedMemoryForContext(e,t),this._trackAllocatedMemoryForContext(e,t,this.gl.canvas&&this.gl.canvas.id),this.byteLength=e}_trackAllocatedMemoryForContext(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this[Symbol.toStringTag],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const r=i.lR.get("Memory Usage".concat(n));r.get("GPU Memory").addCount(e),r.get("".concat(t," Memory")).addCount(e)}_trackDeallocatedMemory(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this[Symbol.toStringTag];this._trackDeallocatedMemoryForContext(e),this._trackDeallocatedMemoryForContext(e,this.gl.canvas&&this.gl.canvas.id),this.byteLength=0}_trackDeallocatedMemoryForContext(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this[Symbol.toStringTag],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=i.lR.get("Memory Usage".concat(t));n.get("GPU Memory").subtractCount(this.byteLength),n.get("".concat(e," Memory")).subtractCount(this.byteLength)}}},81786:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(76195),i=n(46773),o=n(59661);let a="";class s extends i.Z{get[Symbol.toStringTag](){return"Texture2D"}static isSupported(e,t){return i.Z.isSupported(e,t)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,i;(0,r.JD)(e),(t instanceof Promise||"string"===typeof t)&&(t={data:t}),"string"===typeof t.data&&(t=Object.assign({},t,{data:(n=t.data,(0,o.h)("string"===typeof n),n=a+n,new Promise(((e,t)=>{try{const r=new Image;r.onload=()=>e(r),r.onerror=()=>t(new Error("Could not load image ".concat(n,"."))),r.crossOrigin=i&&i.crossOrigin||"anonymous",r.src=n}catch(r){t(r)}})))})),super(e,Object.assign({},t,{target:3553})),this.initialize(t),Object.seal(this)}}},50844:(e,t,n)=>{"use strict";n.d(t,{C:()=>o,KR:()=>l,ae:()=>i,br:()=>s,pH:()=>a});var r=n(76195);const i={6407:{dataFormat:6407,types:[5121,33635]},6408:{dataFormat:6408,types:[5121,32819,32820]},6406:{dataFormat:6406,types:[5121]},6409:{dataFormat:6409,types:[5121]},6410:{dataFormat:6410,types:[5121]},33326:{dataFormat:6403,types:[5126],gl2:!0},33328:{dataFormat:33319,types:[5126],gl2:!0},34837:{dataFormat:6407,types:[5126],gl2:!0},34836:{dataFormat:6408,types:[5126],gl2:!0}},o={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},a={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function s(e,t){const n=i[t];if(!n)return!1;if(void 0===n.gl1&&void 0===n.gl2)return!0;const o=(0,r.D0)(e)&&n.gl2||n.gl1;return"string"===typeof o?e.getExtension(o):o}function l(e,t){const n=i[t];switch(n&&n.types[0]){case 5126:return e.getExtension("OES_texture_float_linear");case 5131:return e.getExtension("OES_texture_half_float_linear");default:return!0}}},46773:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(76195),i=n(1112),o=n(64180),a=n(50844),s=n(59661),l=n(39042);const c=[9729,9728],u=globalThis.WebGLBuffer||function(){};class d extends i.Z{get[Symbol.toStringTag](){return"Texture"}static isSupported(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{format:n,linearFiltering:r}=t;let i=!0;return n&&(i=i&&(0,a.br)(e,n),i=i&&(!r||(0,a.KR)(e,n))),i}constructor(e,t){const{id:n=(0,l.hQ)("texture"),handle:r,target:i}=t;super(e,{id:n,handle:r}),this.target=i,this.textureUnit=void 0,this.loaded=!1,this.width=void 0,this.height=void 0,this.depth=void 0,this.format=void 0,this.type=void 0,this.dataFormat=void 0,this.border=void 0,this.textureUnit=void 0,this.mipmaps=void 0}toString(){return"Texture(".concat(this.id,",").concat(this.width,"x").concat(this.height,")")}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.data;if(t instanceof Promise)return t.then((t=>this.initialize(Object.assign({},e,{pixels:t,data:t})))),this;const n="undefined"!==typeof HTMLVideoElement&&t instanceof HTMLVideoElement;if(n&&t.readyStatethis.initialize(e))),this;const{pixels:i=null,format:o=6408,border:a=0,recreate:s=!1,parameters:l={},pixelStore:c={},textureUnit:u}=e;t||(t=i);let{width:d,height:h,dataFormat:f,type:p,compressed:g=!1,mipmaps:m=!0}=e;const{depth:A=0}=e;return({width:d,height:h,compressed:g,dataFormat:f,type:p}=this._deduceParameters({format:o,type:p,dataFormat:f,compressed:g,data:t,width:d,height:h})),this.width=d,this.height=h,this.depth=A,this.format=o,this.type=p,this.dataFormat=f,this.border=a,this.textureUnit=u,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),m&&this._isNPOT()&&(r.cM.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),m=!1,this._updateForNPOT(l)),this.mipmaps=m,this.setImageData({data:t,width:d,height:h,depth:A,format:o,type:p,dataFormat:f,border:a,mipmaps:m,parameters:c,compressed:g}),m&&this.generateMipmap(),this.setParameters(l),s&&(this.data=t),n&&(this._video={video:t,parameters:l,lastTime:t.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?t.currentTime:-1}),this}update(){if(this._video){const{video:e,parameters:t,lastTime:n}=this._video;if(n===e.currentTime||e.readyState0&&void 0!==arguments[0]?arguments[0]:{};return this._isNPOT()?(r.cM.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),(0,r.s8)(this.gl,e,(()=>{this.gl.generateMipmap(this.target)})),this.gl.bindTexture(this.target,null),this)}setImageData(e){this._trackDeallocatedMemory("Texture");const{target:t=this.target,pixels:n=null,level:i=0,format:o=this.format,border:l=this.border,offset:c=0,parameters:u={}}=e;let{data:d=null,type:h=this.type,width:f=this.width,height:p=this.height,dataFormat:g=this.dataFormat,compressed:m=!1}=e;d||(d=n),({type:h,dataFormat:g,compressed:m,width:f,height:p}=this._deduceParameters({format:o,type:h,dataFormat:g,compressed:m,data:d,width:f,height:p}));const{gl:A}=this;A.bindTexture(this.target,this.handle);let v,y=null;({data:d,dataType:y}=this._getDataType({data:d,compressed:m}));let b=0;if((0,r.s8)(this.gl,u,(()=>{switch(y){case"null":A.texImage2D(t,i,o,f,p,l,g,h,d);break;case"typed-array":A.texImage2D(t,i,o,f,p,l,g,h,d,c);break;case"buffer":v=(0,r.KQ)(A),v.bindBuffer(35052,d.handle||d),v.texImage2D(t,i,o,f,p,l,g,h,c),v.bindBuffer(35052,null);break;case"browser-object":(0,r.D0)(A)?A.texImage2D(t,i,o,f,p,l,g,h,d):A.texImage2D(t,i,o,g,h,d);break;case"compressed":for(const[e,n]of d.entries())A.compressedTexImage2D(t,e,n.format,n.width,n.height,l,n.data),b+=n.levelSize;break;default:(0,s.h)(!1,"Unknown image data type")}})),"compressed"===y)this._trackAllocatedMemory(b,"Texture");else if(d&&d.byteLength)this._trackAllocatedMemory(d.byteLength,"Texture");else{const e=a.C[this.dataFormat]||4,t=a.pH[this.type]||1;this._trackAllocatedMemory(this.width*this.height*e*t,"Texture")}return this.loaded=!0,this}setSubImageData(e){let{target:t=this.target,pixels:n=null,data:i=null,x:a=0,y:l=0,width:c=this.width,height:d=this.height,level:h=0,format:f=this.format,type:p=this.type,dataFormat:g=this.dataFormat,compressed:m=!1,offset:A=0,border:v=this.border,parameters:y={}}=e;if(({type:p,dataFormat:g,compressed:m,width:c,height:d}=this._deduceParameters({format:f,type:p,dataFormat:g,compressed:m,data:i,width:c,height:d})),(0,s.h)(0===this.depth,"texSubImage not supported for 3D textures"),i||(i=n),i&&i.data){const e=i;i=e.data,c=e.shape[0],d=e.shape[1]}i instanceof o.Z&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),(0,r.s8)(this.gl,y,(()=>{if(m)this.gl.compressedTexSubImage2D(t,h,a,l,c,d,f,i);else if(null===i)this.gl.texSubImage2D(t,h,a,l,c,d,g,p,null);else if(ArrayBuffer.isView(i))this.gl.texSubImage2D(t,h,a,l,c,d,g,p,i,A);else if(i instanceof u){const e=(0,r.KQ)(this.gl);e.bindBuffer(35052,i),e.texSubImage2D(t,h,a,l,c,d,g,p,A),e.bindBuffer(35052,null)}else if((0,r.D0)(this.gl)){(0,r.KQ)(this.gl).texSubImage2D(t,h,a,l,c,d,g,p,i)}else this.gl.texSubImage2D(t,h,a,l,g,p,i)})),this.gl.bindTexture(this.target,null)}copyFramebuffer(){return r.cM.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit;const{gl:t}=this;return void 0!==e&&(this.textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.target,this.handle),e}unbind(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit;const{gl:t}=this;return void 0!==e&&(this.textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.target,null),e}_getDataType(e){let{data:t,compressed:n=!1}=e;return n?{data:t,dataType:"compressed"}:null===t?{data:t,dataType:"null"}:ArrayBuffer.isView(t)?{data:t,dataType:"typed-array"}:t instanceof o.Z?{data:t.handle,dataType:"buffer"}:t instanceof u?{data:t,dataType:"buffer"}:{data:t,dataType:"browser-object"}}_deduceParameters(e){const{format:t,data:n}=e;let{width:r,height:i,dataFormat:o,type:s,compressed:l}=e;const c=a.ae[t];return o=o||c&&c.dataFormat,s=s||c&&c.types[0],l=l||c&&c.compressed,({width:r,height:i}=this._deduceImageSize(n,r,i)),{dataFormat:o,type:s,compressed:l,width:r,height:i,format:t,data:n}}_deduceImageSize(e,t,n){let r;return r="undefined"!==typeof ImageData&&e instanceof ImageData?{width:e.width,height:e.height}:"undefined"!==typeof HTMLImageElement&&e instanceof HTMLImageElement?{width:e.naturalWidth,height:e.naturalHeight}:"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&e instanceof ImageBitmap?{width:e.width,height:e.height}:"undefined"!==typeof HTMLVideoElement&&e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e?{width:t,height:n}:{width:t>=0?t:1,height:n>=0?n:1},(0,s.h)(r,"Could not deduced texture size"),(0,s.h)(void 0===t||r.width===t,"Deduced texture width does not match supplied width"),(0,s.h)(void 0===n||r.height===n,"Deduced texture height does not match supplied height"),r}_createHandle(){return this.gl.createTexture()}_deleteHandle(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory("Texture")}_getParameter(e){switch(e){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);const t=this.gl.getTexParameter(this.target,e);return this.gl.bindTexture(this.target,null),t}}_setParameter(e,t){switch(this.gl.bindTexture(this.target,this.handle),t=this._getNPOTParam(e,t),e){case 33082:case 33083:this.gl.texParameterf(this.handle,e,t);break;case 4096:case 4097:(0,s.h)(!1);break;default:this.gl.texParameteri(this.target,e,t)}return this.gl.bindTexture(this.target,null),this}_isNPOT(){return!(0,r.D0)(this.gl)&&(!(!this.width||!this.height)&&(!(0,l.wt)(this.width)||!(0,l.wt)(this.height)))}_updateForNPOT(e){void 0===e[this.gl.TEXTURE_MIN_FILTER]&&(e[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),void 0===e[this.gl.TEXTURE_WRAP_S]&&(e[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),void 0===e[this.gl.TEXTURE_WRAP_T]&&(e[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}_getNPOTParam(e,t){if(this._isNPOT())switch(e){case 10241:-1===c.indexOf(t)&&(t=9729);break;case 10242:case 10243:33071!==t&&(t=33071)}return t}}},73011:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(76195),i=n(1112),o=n(64180),a=n(39042);class s extends i.Z{get[Symbol.toStringTag](){return"TransformFeedback"}static isSupported(e){return(0,r.D0)(e)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,r.KQ)(e),super(e,t),this.initialize(t),this.stubRemovedMethods("TransformFeedback","v6.0",["pause","resume"]),Object.seal(this)}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,(0,a.nK)(this.buffers)||this.bind((()=>this._unbindBuffers())),this.setProps(e),this}setProps(e){"program"in e&&(this.configuration=e.program&&e.program.configuration),"configuration"in e&&(this.configuration=e.configuration),"bindOnUse"in e&&(e=e.bindOnUse),"buffers"in e&&this.setBuffers(e.buffers)}setBuffers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.bind((()=>{for(const t in e)this.setBuffer(t,e[t])})),this}setBuffer(e,t){const n=this._getVaryingIndex(e),{buffer:i,byteSize:o,byteOffset:a}=this._getBufferParams(t);return n<0?(this.unused[e]=i,r.cM.warn("".concat(this.id," unused varying buffer ").concat(e))(),this):(this.buffers[n]=t,this.bindOnUse||this._bindBuffer(n,i,a,o),this)}begin(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(e),this}end(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}_getBufferParams(e){let t,n,r;return e instanceof o.Z===!1?(r=e.buffer,n=e.byteSize,t=e.byteOffset):r=e,void 0===t&&void 0===n||(t=t||0,n=n||r.byteLength-t),{buffer:r,byteOffset:t,byteSize:n}}_getVaryingInfo(e){return this.configuration&&this.configuration.getVaryingInfo(e)}_getVaryingIndex(e){if(this.configuration)return this.configuration.getVaryingInfo(e).location;const t=Number(e);return Number.isFinite(t)?t:-1}_bindBuffers(){if(this.bindOnUse)for(const e in this.buffers){const{buffer:t,byteSize:n,byteOffset:r}=this._getBufferParams(this.buffers[e]);this._bindBuffer(e,t,r,n)}}_unbindBuffers(){if(this.bindOnUse)for(const e in this.buffers)this._bindBuffer(e,null)}_bindBuffer(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;const i=t&&t.handle;return i&&void 0!==r?this.gl.bindBufferRange(35982,e,i,n,r):this.gl.bindBufferBase(35982,e,i),this}_createHandle(){return this.gl.createTransformFeedback()}_deleteHandle(){this.gl.deleteTransformFeedback(this.handle)}_bindHandle(e){this.gl.bindTransformFeedback(36386,this.handle)}}},6509:(e,t,n)=>{"use strict";n.d(t,{N$:()=>c,U6:()=>s,ag:()=>l});var r=n(87966),i=n(76195),o=n(59661);const a=2;function s(e,t){return l(e,t)}function l(e,t){return(t=Array.isArray(t)?t:[t]).every((t=>u(e,t)))}function c(e){e.luma=e.luma||{},e.luma.caps=e.luma.caps||{};for(const t in r.Z)void 0===e.luma.caps[t]&&(e.luma.caps[t]=u(e,t));return e.luma.caps}function u(e,t){return e.luma=e.luma||{},e.luma.caps=e.luma.caps||{},void 0===e.luma.caps[t]&&(e.luma.caps[t]=function(e,t){const n=r.Z[t];let a;(0,o.h)(n,t);const s=(0,i.D0)(e)&&n[1]||n[0];if("function"===typeof s)a=s(e);else if(Array.isArray(s)){a=!0;for(const t of s)a=a&&Boolean(e.getExtension(t))}else"string"===typeof s?a=Boolean(e.getExtension(s)):"boolean"===typeof s?a=s:(0,o.h)(!1);return a}(e,t)),e.luma.caps[t]||i.cM.log(a,"Feature: ".concat(t," not supported"))(),e.luma.caps[t]}},87966:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a,h:()=>o});var r=n(64282),i=n(81786);const o={WEBGL2:"WEBGL2",VERTEX_ARRAY_OBJECT:"VERTEX_ARRAY_OBJECT",TIMER_QUERY:"TIMER_QUERY",INSTANCED_RENDERING:"INSTANCED_RENDERING",MULTIPLE_RENDER_TARGETS:"MULTIPLE_RENDER_TARGETS",ELEMENT_INDEX_UINT32:"ELEMENT_INDEX_UINT32",BLEND_EQUATION_MINMAX:"BLEND_EQUATION_MINMAX",FLOAT_BLEND:"FLOAT_BLEND",COLOR_ENCODING_SRGB:"COLOR_ENCODING_SRGB",TEXTURE_DEPTH:"TEXTURE_DEPTH",TEXTURE_FLOAT:"TEXTURE_FLOAT",TEXTURE_HALF_FLOAT:"TEXTURE_HALF_FLOAT",TEXTURE_FILTER_LINEAR_FLOAT:"TEXTURE_FILTER_LINEAR_FLOAT",TEXTURE_FILTER_LINEAR_HALF_FLOAT:"TEXTURE_FILTER_LINEAR_HALF_FLOAT",TEXTURE_FILTER_ANISOTROPIC:"TEXTURE_FILTER_ANISOTROPIC",COLOR_ATTACHMENT_RGBA32F:"COLOR_ATTACHMENT_RGBA32F",COLOR_ATTACHMENT_FLOAT:"COLOR_ATTACHMENT_FLOAT",COLOR_ATTACHMENT_HALF_FLOAT:"COLOR_ATTACHMENT_HALF_FLOAT",GLSL_FRAG_DATA:"GLSL_FRAG_DATA",GLSL_FRAG_DEPTH:"GLSL_FRAG_DEPTH",GLSL_DERIVATIVES:"GLSL_DERIVATIVES",GLSL_TEXTURE_LOD:"GLSL_TEXTURE_LOD"};const a={[o.WEBGL2]:[!1,!0],[o.VERTEX_ARRAY_OBJECT]:["OES_vertex_array_object",!0],[o.TIMER_QUERY]:["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],[o.INSTANCED_RENDERING]:["ANGLE_instanced_arrays",!0],[o.MULTIPLE_RENDER_TARGETS]:["WEBGL_draw_buffers",!0],[o.ELEMENT_INDEX_UINT32]:["OES_element_index_uint",!0],[o.BLEND_EQUATION_MINMAX]:["EXT_blend_minmax",!0],[o.FLOAT_BLEND]:["EXT_float_blend"],[o.COLOR_ENCODING_SRGB]:["EXT_sRGB",!0],[o.TEXTURE_DEPTH]:["WEBGL_depth_texture",!0],[o.TEXTURE_FLOAT]:["OES_texture_float",!0],[o.TEXTURE_HALF_FLOAT]:["OES_texture_half_float",!0],[o.TEXTURE_FILTER_LINEAR_FLOAT]:["OES_texture_float_linear"],[o.TEXTURE_FILTER_LINEAR_HALF_FLOAT]:["OES_texture_half_float_linear"],[o.TEXTURE_FILTER_ANISOTROPIC]:["EXT_texture_filter_anisotropic"],[o.COLOR_ATTACHMENT_RGBA32F]:[function(e){const t=new i.Z(e,{format:6408,type:5126,dataFormat:6408}),n=new r.Z(e,{id:"test-framebuffer",check:!1,attachments:{36064:t}}),o=n.getStatus();return t.delete(),n.delete(),36053===o},"EXT_color_buffer_float"],[o.COLOR_ATTACHMENT_FLOAT]:[!1,"EXT_color_buffer_float"],[o.COLOR_ATTACHMENT_HALF_FLOAT]:["EXT_color_buffer_half_float"],[o.GLSL_FRAG_DATA]:["WEBGL_draw_buffers",!0],[o.GLSL_FRAG_DEPTH]:["EXT_frag_depth",!0],[o.GLSL_DERIVATIVES]:["OES_standard_derivatives",!0],[o.GLSL_TEXTURE_LOD]:["EXT_shader_texture_lod",!0]}},53886:(e,t,n)=>{"use strict";n.d(t,{lR:()=>s});var r=n(76195),i=n(89069),o=n(89258);const a="8.5.19";const s=new class{constructor(){this.stats=new Map}get(e){return this.stats.has(e)||this.stats.set(e,new i.Z({id:e})),this.stats.get(e)}};if(globalThis.luma&&globalThis.luma.VERSION!==a)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(a));globalThis.luma||((0,o.Z)()&&r.cM.log(1,"luma.gl ".concat(a," - ").concat("set luma.log.level=1 (or higher) to trace rendering"))(),globalThis.luma=globalThis.luma||{VERSION:a,version:a,log:r.cM,stats:s,globals:{modules:{},nodeIO:{}}});globalThis.luma},59661:(e,t,n)=>{"use strict";function r(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}n.d(t,{h:()=>r})},13413:(e,t,n)=>{"use strict";n.d(t,{k:()=>i});var r=n(76195);function i(e,t,n){const{removedProps:i={},deprecatedProps:o={},replacedProps:a={}}=n;for(const l in i)if(l in t){const t=i[l]?"".concat(e,".").concat(i[l]):"N/A";r.cM.removed("".concat(e,".").concat(l),t)()}for(const l in o)if(l in t){const t=o[l];r.cM.deprecated("".concat(e,".").concat(l),"".concat(e,".").concat(t))()}let s=null;for(const l in a)if(l in t){const n=a[l];r.cM.deprecated("".concat(e,".").concat(l),"".concat(e,".").concat(n))(),s=s||Object.assign({},t),s[n]=t[l],delete s[l]}return s||t}},43331:(e,t,n)=>{"use strict";n.d(t,{F:()=>i});var r=n(76195);function i(e,t,n,i){const o="See luma.gl ".concat(n," Upgrade Guide at https://luma.gl/docs/upgrade-guide"),a=Object.getPrototypeOf(e);i.forEach((e=>{a.methodName||(a[e]=()=>{throw r.cM.removed("Calling removed method ".concat(t,".").concat(e,": "),o)(),new Error(e)})}))}},39042:(e,t,n)=>{"use strict";n.d(t,{hQ:()=>o,nK:()=>s,wt:()=>a});var r=n(59661);const i={};function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";i[e]=i[e]||1;const t=i[e]++;return"".concat(e,"-").concat(t)}function a(e){return(0,r.h)("number"===typeof e,"Input must be a number"),e&&0===(e&e-1)}function s(e){let t=!0;for(const n in e){t=!1;break}return t}},2187:(e,t,n)=>{"use strict";n.d(t,{$Z:()=>y,hJ:()=>b,jG:()=>_});var r=n(59661);const i=5120,o=5121,a=5122,s=5123,l=0,c=1,u=2,d=3,h=4,f=5,p=6,g=5126,m=5124,A=5125,v={[g]:[g,1,"float"],35664:[g,2,"vec2"],35665:[g,3,"vec3"],35666:[g,4,"vec4"],[m]:[m,1,"int"],35667:[m,2,"ivec2"],35668:[m,3,"ivec3"],35669:[m,4,"ivec4"],[A]:[A,1,"uint"],36294:[A,2,"uvec2"],36295:[A,3,"uvec3"],36296:[A,4,"uvec4"],35670:[g,1,"bool"],35671:[g,2,"bvec2"],35672:[g,3,"bvec3"],35673:[g,4,"bvec4"],35674:[g,8,"mat2"],35685:[g,8,"mat2x3"],35686:[g,8,"mat2x4"],35675:[g,12,"mat3"],35687:[g,12,"mat3x2"],35688:[g,12,"mat3x4"],35676:[g,16,"mat4"],35689:[g,16,"mat4x2"],35690:[g,16,"mat4x3"]};function y(e){switch(e){case l:return l;case c:case d:case u:return c;case h:case f:case p:return h;default:return(0,r.h)(!1),0}}function b(e){const t=v[e];if(!t)return null;const[n,r]=t;return{type:n,components:r}}function _(e,t){switch(e){case i:case o:case a:case s:e=g}for(const n in v){const[r,i,o]=v[n];if(r===e&&i===t)return{glType:n,name:o}}return null}},55562:(e,t,n)=>{"use strict";n.d(t,{km:()=>o,sF:()=>i});var r=n(59661);function i(e,t){if("string"!==typeof t)return t;const n=Number(t);if(!isNaN(n))return n;const i=e[t=t.replace(/^.*\./,"")];return(0,r.h)(void 0!==i,"Accessing undefined constant GL.".concat(t)),i}function o(e,t){t=Number(t);for(const n in e)if(e[n]===t)return"GL.".concat(n);return String(t)}},15671:(e,t,n)=>{"use strict";n.d(t,{h:()=>f,Y:()=>p});var r=n(81786),i=n(76195),o=n(46773);const a=[34069,34070,34071,34072,34073,34074];class s extends o.Z{get[Symbol.toStringTag](){return"TextureCube"}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,i.JD)(e),super(e,Object.assign({},t,{target:34067})),this.initialize(t),Object.seal(this)}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{mipmaps:t=!0,parameters:n={}}=e;return this.opts=e,this.setCubeMapImageData(e).then((()=>{this.loaded=!0,t&&this.generateMipmap(e),this.setParameters(n)})),this}subImage(e){let{face:t,data:n,x:r=0,y:i=0,mipmapLevel:o=0}=e;return this._subImage({target:t,data:n,x:r,y:i,mipmapLevel:o})}async setCubeMapImageData(e){let{width:t,height:n,pixels:r,data:o,border:s=0,format:l=6408,type:c=5121}=e;const{gl:u}=this,d=r||o,h=await Promise.all(a.map((e=>{const t=d[e];return Promise.all(Array.isArray(t)?t:[t])})));this.bind(),a.forEach(((e,r)=>{h[r].length>1&&!1!==this.opts.mipmaps&&i.cM.warn("".concat(this.id," has mipmap and multiple LODs."))(),h[r].forEach(((r,i)=>{t&&n?u.texImage2D(e,i,l,t,n,s,l,c,r):u.texImage2D(e,i,l,l,c,r)}))})),this.unbind()}setImageDataForFace(e){const{face:t,width:n,height:r,pixels:i,data:o,border:a=0,format:s=6408,type:l=5121}=e,{gl:c}=this,u=i||o;return this.bind(),u instanceof Promise?u.then((n=>this.setImageDataForFace(Object.assign({},e,{face:t,data:n,pixels:n})))):this.width||this.height?c.texImage2D(t,0,s,n,r,a,s,l,u):c.texImage2D(t,0,s,s,l,u),this}}s.FACES=a;var l=n(50844),c=n(64180);class u extends o.Z{get[Symbol.toStringTag](){return"Texture3D"}static isSupported(e){return(0,i.D0)(e)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,i.KQ)(e),t=Object.assign({depth:1},t,{target:32879,unpackFlipY:!1}),super(e,t),this.initialize(t),Object.seal(this)}setImageData(e){let{level:t=0,dataFormat:n=6408,width:r,height:o,depth:a=1,border:s=0,format:u,type:d=5121,offset:h=0,data:f,parameters:p={}}=e;if(this._trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle),(0,i.s8)(this.gl,p,(()=>{ArrayBuffer.isView(f)&&this.gl.texImage3D(this.target,t,n,r,o,a,s,u,d,f),f instanceof c.Z&&(this.gl.bindBuffer(35052,f.handle),this.gl.texImage3D(this.target,t,n,r,o,a,s,u,d,h))})),f&&f.byteLength)this._trackAllocatedMemory(f.byteLength,"Texture");else{const e=l.C[this.dataFormat]||4,t=l.pH[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*e*t,"Texture")}return this.loaded=!0,this}}var d=n(64282),h=n(59661);function f(e,t){(0,h.h)(e instanceof r.Z||e instanceof s||e instanceof u);const n=e.constructor,{gl:i,width:o,height:a,format:l,type:c,dataFormat:d,border:f,mipmaps:p}=e;return new n(i,Object.assign({width:o,height:a,format:l,type:c,dataFormat:d,border:f,mipmaps:p},t))}function p(e,t){const{gl:n,width:r,height:i,id:o}=e;return new d.Z(n,Object.assign({},t,{id:"framebuffer-for-".concat(o),width:r,height:i,attachments:{36064:e}}))}},78501:(e,t,n)=>{"use strict";n.d(t,{KS:()=>s,O:()=>i,c$:()=>a,vN:()=>o});const r="Failed to deduce GL constant from typed array";function i(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(r)}}function o(e){let{clamped:t=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return t?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")}}function a(e){let{data:t,width:n,height:r,bytesPerPixel:i=4,temp:o}=e;const a=n*i;o=o||new Uint8Array(a);for(let s=0;s{function t(e){if(e=Object.assign({},e),!(this instanceof t))throw new Error("MapboxLanguage needs to be called with the new keyword");this.setLanguage=this.setLanguage.bind(this),this._initialStyleUpdate=this._initialStyleUpdate.bind(this),this._defaultLanguage=e.defaultLanguage,this._isLanguageField=e.languageField||/^name_/,this._getLanguageField=e.getLanguageField||function(e){return"mul"===e?"name":"name_".concat(e)},this._languageSource=e.languageSource||null,this._languageTransform=e.languageTransform,this._excludedLayerIds=e.excludedLayerIds||[],this.supportedLanguages=e.supportedLanguages||["ar","de","en","es","fr","it","ja","ko","mul","pt","ru","vi","zh-Hans","zh-Hant"]}const n=/^\{name/;function r(e,t){const r=Array.isArray(t)&&"get"===t[0];return r&&n.test(t[1])&&console.warn("This plugin no longer supports the use of token syntax (e.g. {name}). Please use a get expression. See https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/ for more details."),r&&e.test(t[1])}function i(e,t,n){if(Array.isArray(t))for(let o=1;o{const n=e.sources[t].url;return n&&n.indexOf("mapbox.mapbox-streets-v8")>-1||/mapbox-streets-v[1-9][1-9]/.test(n)}));if(!t.length)throw new Error('If using MapboxLanguage with a Mapbox style, the style must be based on vector tile version 8, e.g. "streets-v11"');return t[0]}(e);if(!n)return e;const r=this._getLanguageField(t),i=this._isLanguageField,a=this._excludedLayerIds,s=e.layers.map((e=>e.source===n?function(e,t,n,r){return t.layout&&t.layout["text-field"]&&-1===r.indexOf(t.id)?Object.assign({},t,{layout:Object.assign({},t.layout,{"text-field":o(e,t.layout["text-field"],n)})}):t}(i,e,r,a):e)),l=Object.assign({},e,{layers:s});return this._languageTransform?this._languageTransform(l,t):l},t.prototype._initialStyleUpdate=function(){const e=this._map.getStyle(),t=this._defaultLanguage||function(e){const t=navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage,n=t&&t.split("-");let r=t;n.length>1&&(r=n[0]);if(e.indexOf(r)>-1)return r;return null}(this.supportedLanguages);this._map.setStyle(this.setLanguage(e,t))},t.prototype.onAdd=function(e){return this._map=e,this._map.on("style.load",this._initialStyleUpdate),this._container=document.createElement("div"),this._container},t.prototype.onRemove=function(){this._map.off("style.load",this._initialStyleUpdate),this._map=void 0},"undefined"!==typeof e.exports?e.exports=t:window.MapboxLanguage=t},76624:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(30373);class i extends(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array)){clone(){return(new this.constructor).copy(this)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n0?", ":"")+(0,r.Bw)(this[n],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t{"use strict";n.d(t,{Z:()=>a});var r=n(76624),i=n(6859),o=n(30373);class a extends r.Z{toString(){let e="[";if(o.vc.printRowMajor){e+="row-major:";for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:new Array(this.RANK).fill(-0);const n=e*this.RANK;for(let r=0;r{"use strict";n.d(t,{Z:()=>a});var r=n(76624),i=n(6859),o=n(83006);class a extends r.Z{get x(){return this[0]}set x(e){this[0]=(0,i.u5)(e)}get y(){return this[1]}set y(e){this[1]=(0,i.u5)(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t=0&&e=0&&e{"use strict";n.d(t,{Z:()=>m});var r,i=n(74310),o=n(6859),a=n(96420),s=n(44649),l=n(69291),c=n(58034),u=n(81723);!function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"}(r||(r={}));const d=45*Math.PI/180,h=1,f=.1,p=500,g=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class m extends i.Z{static get IDENTITY(){return function(){v||(v=new m,Object.freeze(v));return v}()}static get ZERO(){return function(){A||(A=new m([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(A));return A}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return r}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,n,r,i,o,a,s,l,c,u,d,h,f,p,g){return this[0]=e,this[1]=t,this[2]=n,this[3]=r,this[4]=i,this[5]=o,this[6]=a,this[7]=s,this[8]=l,this[9]=c,this[10]=u,this[11]=d,this[12]=h,this[13]=f,this[14]=p,this[15]=g,this.check()}setRowMajor(e,t,n,r,i,o,a,s,l,c,u,d,h,f,p,g){return this[0]=e,this[1]=i,this[2]=l,this[3]=h,this[4]=t,this[5]=o,this[6]=c,this[7]=f,this[8]=n,this[9]=a,this[10]=u,this[11]=p,this[12]=r,this[13]=s,this[14]=d,this[15]=g,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(g)}fromObject(e){return this.check()}fromQuaternion(e){return s.en(this,e),this.check()}frustum(e){const{left:t,right:n,bottom:r,top:i,near:o=f,far:a=p}=e;return a===1/0?function(e,t,n,r,i,o){const a=2*o/(n-t),s=2*o/(i-r),l=(n+t)/(n-t),c=(i+r)/(i-r),u=-1,d=-1,h=-2*o;e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=l,e[9]=c,e[10]=u,e[11]=d,e[12]=0,e[13]=0,e[14]=h,e[15]=0}(this,t,n,r,i,o):s.oy(this,t,n,r,i,o,a),this.check()}lookAt(e){const{eye:t,center:n=[0,0,0],up:r=[0,1,0]}=e;return s.zB(this,t,n,r),this.check()}ortho(e){const{left:t,right:n,bottom:r,top:i,near:o=f,far:a=p}=e;return s.M5(this,t,n,r,i,o,a),this.check()}orthographic(e){const{fovy:t=d,aspect:n=h,focalDistance:r=1,near:i=f,far:o=p}=e;y(t);const a=t/2,s=r*Math.tan(a),l=s*n;return this.ortho({left:-l,right:l,bottom:-s,top:s,near:i,far:o})}perspective(e){const{fovy:t=45*Math.PI/180,aspect:n=1,near:r=.1,far:i=500}=e;return y(t),s.G3(this,t,n,r,i),this.check()}determinant(){return s.GH(this)}getScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const n=this.getScale(t),r=1/n[0],i=1/n[1],o=1/n[2];return e[0]=this[0]*r,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*r,e[5]=this[5]*i,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*r,e[9]=this[9]*i,e[10]=this[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const n=this.getScale(t),r=1/n[0],i=1/n[1],o=1/n[2];return e[0]=this[0]*r,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=this[4]*r,e[4]=this[5]*i,e[5]=this[6]*o,e[6]=this[8]*r,e[7]=this[9]*i,e[8]=this[10]*o,e}transpose(){return s.p4(this,this),this.check()}invert(){return s.U_(this,this),this.check()}multiplyLeft(e){return s.Jp(this,e,this),this.check()}multiplyRight(e){return s.Jp(this,this,e),this.check()}rotateX(e){return s.lM(this,this,e),this.check()}rotateY(e){return s.uD(this,this,e),this.check()}rotateZ(e){return s.jI(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return s.U1(this,this,e,t),this.check()}scale(e){return s.bA(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return s.Iu(this,this,e),this.check()}transform(e,t){return 4===e.length?(t=u.fF(t||[-0,-0,-0,-0],e,this),(0,o.IL)(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:n}=e;let r;switch(n){case 2:r=l.fF(t||[-0,-0],e,this);break;case 3:r=c.fF(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return(0,o.IL)(r,e.length),r}transformAsVector(e,t){let n;switch(e.length){case 2:n=(0,a.pb)(t||[-0,-0],e,this);break;case 3:n=(0,a.pL)(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return(0,o.IL)(n,e.length),n}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,n){return this.identity().translate([e,t,n])}}let A,v;function y(e){if(e>2*Math.PI)throw Error("expected radians")}},31549:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(22070),i=n(30373),o=n(6859),a=n(58034),s=n(96420);const l=[0,0,0];let c;class u extends r.Z{static get ZERO(){return c||(c=new u(0,0,0),Object.freeze(c)),c}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;super(-0,-0,-0),1===arguments.length&&(0,i.kJ)(e)?this.copy(e):(i.vc.debug&&((0,o.u5)(e),(0,o.u5)(t),(0,o.u5)(n)),this[0]=e,this[1]=t,this[2]=n)}set(e,t,n){return this[0]=e,this[1]=t,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return i.vc.debug&&((0,o.u5)(e.x),(0,o.u5)(e.y),(0,o.u5)(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=(0,o.u5)(e)}angle(e){return a.EU(this,e)}cross(e){return a.kC(this,this,e),this.check()}rotateX(e){let{radians:t,origin:n=l}=e;return a.lM(this,this,n,t),this.check()}rotateY(e){let{radians:t,origin:n=l}=e;return a.uD(this,this,n,t),this.check()}rotateZ(e){let{radians:t,origin:n=l}=e;return a.jI(this,this,n,t),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return a.fF(this,this,e),this.check()}transformAsVector(e){return(0,s.pL)(this,this,e),this.check()}transformByMatrix3(e){return a.kK(this,this,e),this.check()}transformByMatrix2(e){return(0,s.eQ)(this,this,e),this.check()}transformByQuaternion(e){return a.VC(this,this,e),this.check()}}},83006:(e,t,n)=>{"use strict";function r(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}n.d(t,{Z:()=>r})},30373:(e,t,n)=>{"use strict";n.d(t,{Bw:()=>i,fS:()=>l,kJ:()=>o,t7:()=>s,uZ:()=>a,vc:()=>r});Math.PI,Math.PI;const r={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function i(e){let{precision:t=r.precision}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=function(e){return Math.round(e/r.EPSILON)*r.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function o(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function a(e,t,n){return c(e,(e=>Math.max(t,Math.min(n,e))))}function s(e,t,n){return o(e)?e.map(((e,r)=>s(e,t[r],n))):n*t+(1-n)*e}function l(e,t,n){const i=r.EPSILON;n&&(r.EPSILON=n);try{if(e===t)return!0;if(o(e)&&o(t)){if(e.length!==t.length)return!1;for(let n=0;n{"use strict";function r(e,t,n){const r=t[0],i=t[1],o=n[3]*r+n[7]*i||1;return e[0]=(n[0]*r+n[4]*i)/o,e[1]=(n[1]*r+n[5]*i)/o,e}function i(e,t,n){const r=t[0],i=t[1],o=t[2],a=n[3]*r+n[7]*i+n[11]*o||1;return e[0]=(n[0]*r+n[4]*i+n[8]*o)/a,e[1]=(n[1]*r+n[5]*i+n[9]*o)/a,e[2]=(n[2]*r+n[6]*i+n[10]*o)/a,e}function o(e,t,n){const r=t[0],i=t[1];return e[0]=n[0]*r+n[2]*i,e[1]=n[1]*r+n[3]*i,e[2]=t[2],e}function a(e,t,n){const r=t[0],i=t[1];return e[0]=n[0]*r+n[2]*i,e[1]=n[1]*r+n[3]*i,e[2]=t[2],e[3]=t[3],e}function s(e,t,n){const r=t[0],i=t[1],o=t[2];return e[0]=n[0]*r+n[3]*i+n[6]*o,e[1]=n[1]*r+n[4]*i+n[7]*o,e[2]=n[2]*r+n[5]*i+n[8]*o,e[3]=t[3],e}n.d(t,{G7:()=>a,_x:()=>s,eQ:()=>o,pL:()=>i,pb:()=>r})},6859:(e,t,n)=>{"use strict";n.d(t,{IL:()=>o,u5:()=>i});var r=n(30373);function i(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(r.vc.debug&&!function(e,t){if(e.length!==t)return!1;for(let n=0;n{"use strict";n.r(t),n.d(t,{Polygon:()=>h,WINDING:()=>o,_Polygon:()=>h,clipPolygon:()=>U,clipPolyline:()=>Z,cutPolygonByGrid:()=>X,cutPolygonByMercatorBounds:()=>ne,cutPolylineByGrid:()=>G,cutPolylineByMercatorBounds:()=>te,earcut:()=>f,forEachSegmentInPolygon:()=>c,getPolygonSignedArea:()=>l,getPolygonWindingDirection:()=>s,modifyPolygonWindingDirection:()=>a});var r=n(68185),i=n(30373);const o={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(e,n)!==t&&(function(e,t){const{start:n=0,end:r=e.length,size:i=2}=t,o=(r-n)/i,a=Math.floor(o/2);for(let s=0;s1&&void 0!==arguments[1]?arguments[1]:{};return Math.sign(l(e,t))}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{start:n=0,end:r=e.length}=t,i=t.size||2;let o=0;for(let a=n,s=r-i;a2&&void 0!==arguments[2]?arguments[2]:{};const{start:r=0,end:o=e.length,size:a=2,isClosed:s}=n,l=(o-r)/a;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:{};return Math.sign(d(e,t))}(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{});return n!==t&&(e.reverse(),!0)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{start:n=0,end:r=e.length}=t;let i=0;for(let o=n,a=r-1;o1&&void 0!==arguments[1]?arguments[1]:{};(0,r.Z)(this,"points",void 0),(0,r.Z)(this,"isFlatArray",void 0),(0,r.Z)(this,"options",void 0),this.points=e,this.isFlatArray=!(0,i.kJ)(e[0]),this.options={start:t.start||0,end:t.end||e.length,size:t.size||2,isClosed:t.isClosed},Object.freeze(this)}getSignedArea(){return this.isFlatArray?l(this.points,this.options):d(this.points,this.options)}getArea(){return Math.abs(this.getSignedArea())}getWindingDirection(){return Math.sign(this.getSignedArea())}forEachSegment(e){this.isFlatArray?c(this.points,((t,n,r,i,o,a)=>{e([t,n],[r,i],o,a)}),this.options):function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{start:r=0,end:o=e.length,isClosed:a}=n;for(let i=r;i2&&void 0!==arguments[2]?arguments[2]:2,r=arguments.length>3?arguments[3]:void 0;const i=t&&t.length,o=i?t[0]*n:e.length;let a=p(e,0,o,n,!0,r&&r[0]);const s=[];if(!a||a.next===a.prev)return s;let l,c,u,d,h,f,A;if(i&&(a=function(e,t,n,r,i){const o=[];let a,s,l,c,u;for(a=0,s=t.length;a80*n){d=c=e[0],h=u=e[1];for(let t=n;tc&&(c=f),A>u&&(u=A);l=Math.max(c-d,u-h),l=0!==l?1/l:0}return m(a,s,n,d,h,l),s}function p(e,t,n,r,i,o){let a,s;if(void 0===o&&(o=l(e,{start:t,end:n,size:r})),i===o<0)for(a=t;a=t;a-=r)s=D(a,e[a],e[a+1],s);return s&&M(s,s.next)&&(N(s),s=s.next),s}function g(e,t){if(!e)return e;t||(t=e);let n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==T(r.prev,r,r.next))r=r.next;else{if(N(r),r=t=r.prev,r===r.next)break;n=!0}}while(n||r!==t);return t}function m(e,t,n,r,i,o,a){if(!e)return;!a&&o&&function(e,t,n,r){let i=e;do{null===i.z&&(i.z=E(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n,r,i,o,a,s,l,c=1;do{for(i=e,e=null,l=null,r=0;i;){for(r++,a=i,o=0,n=0;n0||s>0&&a;)0!==o&&(0===s||!a||i.z<=a.z)?(t=i,i=i.nextZ,o--):(t=a,a=a.nextZ,s--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;i=a}l.nextZ=null,c*=2}while(r>1)}(i)}(e,r,i,o);let s,l,c=e;for(;e.prev!==e.next;)if(s=e.prev,l=e.next,o?v(e,r,i,o):A(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),N(e),e=l.next,c=l.next;else if((e=l)===c){a?1===a?m(e=y(g(e),t,n),t,n,r,i,o,2):2===a&&b(e,t,n,r,i,o):m(g(e),t,n,r,i,o,1);break}}function A(e){const t=e.prev,n=e,r=e.next;if(T(t,n,r)>=0)return!1;let i=e.next.next;for(;i!==e.prev;){if(C(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&T(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function v(e,t,n,r){const i=e.prev,o=e,a=e.next;if(T(i,o,a)>=0)return!1;const s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,d=E(s,l,t,n,r),h=E(c,u,t,n,r);let f=e.prevZ,p=e.nextZ;for(;f&&f.z>=d&&p&&p.z<=h;){if(f!==e.prev&&f!==e.next&&C(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&T(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,p!==e.prev&&p!==e.next&&C(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&T(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;f&&f.z>=d;){if(f!==e.prev&&f!==e.next&&C(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&T(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&C(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&T(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function y(e,t,n){let r=e;do{const i=r.prev,o=r.next.next;!M(i,o)&&k(i,r,r.next,o)&&I(i,o)&&I(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),N(r),N(r.next),r=e=o),r=r.next}while(r!==e);return g(r)}function b(e,t,n,r,i,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&P(a,e)){let s=L(a,e);return a=g(a,a.next),s=g(s,s.next),m(a,t,n,r,i,o),void m(s,t,n,r,i,o)}e=e.next}a=a.next}while(a!==e)}function _(e,t){return e.x-t.x}function w(e,t){if(t=function(e,t){let n=t;const r=e.x,i=e.y;let o,a=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a){if(a=e,e===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x=n.x&&n.x>=l&&r!==n.x&&C(io.x||n.x===o.x&&x(o,n)))&&(o=n,d=u)),n=n.next}while(n!==s);return o}(e,t),t){const n=L(t,e);g(t,t.next),g(n,n.next)}}function x(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function E(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function S(e){let t=e,n=e;do{(t.x=0&&(e-a)*(r-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function P(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&k(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(I(e,t)&&I(t,e)&&function(e,t){let n=e,r=!1;const i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!==n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||M(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function M(e,t){return e.x===t.x&&e.y===t.y}function k(e,t,n,r){const i=O(T(e,t,n)),o=O(T(e,t,r)),a=O(T(n,r,e)),s=O(T(n,r,t));return i!==o&&a!==s||(!(0!==i||!R(e,n,t))||(!(0!==o||!R(e,r,t))||(!(0!==a||!R(n,e,r))||!(0!==s||!R(n,t,r)))))}function R(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function O(e){return e>0?1:e<0?-1:0}function I(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function L(e,t){const n=new F(e.i,e.x,e.y),r=new F(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function D(e,t,n,r){const i=new F(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function N(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function F(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function j(e,t){const n=t.length,r=e.length;if(r>0){let i=!0;for(let o=0;o4&&void 0!==arguments[4]?arguments[4]:[];const o=r+t*n;for(let a=0;a4&&void 0!==arguments[4]?arguments[4]:[];if(8&n)i=(r[3]-e[1])/(t[1]-e[1]),o=3;else if(4&n)i=(r[1]-e[1])/(t[1]-e[1]),o=1;else if(2&n)i=(r[2]-e[0])/(t[0]-e[0]),o=2;else{if(!(1&n))return null;i=(r[0]-e[0])/(t[0]-e[0]),o=0}for(let s=0;st[2]&&(n|=2),e[1]t[3]&&(n|=8),n}function G(e,t){const{size:n=2,broken:r=!1,gridResolution:i=10,gridOffset:o=[0,0],startIndex:a=0,endIndex:s=e.length}=t||{},l=(s-a)/n;let c=[];const u=[c],d=z(e,0,n,a);let h,f;const p=Q(d,i,o,[]),g=[];j(c,d);for(let m=1;mn&&(c=[],u.push(c),j(c,d)),f=V(h,p)}j(c,h),B(d,h)}return r?u:u[0]}const W=0,q=1;function Y(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;if(!e.length)return[];const{size:r=2,gridResolution:i=10,gridOffset:o=[0,0],edgeTypes:a=!1}=n||{},s=[],l=[{pos:e,types:a?new Array(e.length/r).fill(q):null,holes:t||[]}],c=[[],[]];let u=[];for(;l.length;){const{pos:e,types:t,holes:n}=l.shift();J(e,r,n[0]||e.length,c),u=Q(c[0],i,o,u);const d=V(c[1],u);if(d){let i=K(e,t,r,0,n[0]||e.length,u,d);const o={pos:i[0].pos,types:i[0].types,holes:[]},s={pos:i[1].pos,types:i[1].types,holes:[]};l.push(o,s);for(let l=0;l