@mapvx/web-kit 0.0.0-stage → 1.2.0-develop.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +187 -2
  3. package/dist/cjs/chunks/DRACOLoader-CjN7nfMz.cjs +2 -0
  4. package/dist/cjs/chunks/GLTFLoader-C33v_eKh.cjs +2 -0
  5. package/dist/cjs/chunks/KTX2Loader-GfgRciKI.cjs +2 -0
  6. package/dist/cjs/chunks/accessibility-CamvBQ8h.cjs +2 -0
  7. package/dist/cjs/chunks/back_arrow-BrByZltA.cjs +2 -0
  8. package/dist/cjs/chunks/debug-hooks-C_m1SbH2.cjs +2 -0
  9. package/dist/cjs/chunks/dist-B3zxScE2.cjs +2 -0
  10. package/dist/cjs/chunks/dist-CpCOzc73.cjs +2 -0
  11. package/dist/cjs/chunks/dist-DRfr3UXp.cjs +2 -0
  12. package/dist/cjs/chunks/expression-EUvjFYH4.cjs +2 -0
  13. package/dist/cjs/chunks/globe-viewport-SZrSWKdf.cjs +2 -0
  14. package/dist/cjs/chunks/icon-origin-point-DW7v7TzN.cjs +2 -0
  15. package/dist/cjs/chunks/meshopt_decoder.module-Dk924uu3.cjs +2 -0
  16. package/dist/cjs/chunks/repeat_icon-Bpef1DPh.cjs +2 -0
  17. package/dist/cjs/chunks/rolldown-runtime-1If4f64F.cjs +2 -0
  18. package/dist/cjs/chunks/shader-type-decoder-BqFbHaKB.cjs +2 -0
  19. package/dist/cjs/chunks/styles-DP9KZtXl.cjs +2 -0
  20. package/dist/cjs/chunks/three.module-Drz560ge.cjs +2 -0
  21. package/dist/cjs/chunks/walking-BfKvsH3Y.cjs +2 -0
  22. package/dist/cjs/chunks/webgl-CxZNw2p_.cjs +2 -0
  23. package/dist/cjs/chunks/webgl-device-Dpif38ir.cjs +2 -0
  24. package/dist/cjs/web-kit.cjs +413 -0
  25. package/dist/es/chunks/DRACOLoader-CudX8012.js +2 -0
  26. package/dist/es/chunks/GLTFLoader-BLc_n6C7.js +2 -0
  27. package/dist/es/chunks/KTX2Loader-CnBac9vX.js +2 -0
  28. package/dist/es/chunks/accessibility-BTRW5qzF.js +2 -0
  29. package/dist/es/chunks/back_arrow-DaE2mYq8.js +2 -0
  30. package/dist/es/chunks/debug-hooks-A7fGcVSJ.js +2 -0
  31. package/dist/es/chunks/dist-B8bewEN3.js +2 -0
  32. package/dist/es/chunks/dist-CeI9yzhC.js +4 -0
  33. package/dist/es/chunks/dist-Cq65fMeu.js +2 -0
  34. package/dist/es/chunks/expression-BFfy7ZSj.js +2 -0
  35. package/dist/es/chunks/globe-viewport-C_lLyBu9.js +2 -0
  36. package/dist/es/chunks/icon-origin-point-bHQmYXyG.js +2 -0
  37. package/dist/es/chunks/meshopt_decoder.module-ClKO_vyv.js +2 -0
  38. package/dist/es/chunks/repeat_icon-BDjNCPIN.js +2 -0
  39. package/dist/es/chunks/rolldown-runtime-CGJB3Nua.js +2 -0
  40. package/dist/es/chunks/shader-type-decoder-DV9QwQh3.js +2 -0
  41. package/dist/es/chunks/styles-BPMrJs_x.js +2 -0
  42. package/dist/es/chunks/three.module-DUnMDXpm.js +22 -0
  43. package/dist/es/chunks/walking-CUOW_o2S.js +2 -0
  44. package/dist/es/chunks/webgl-B16MrmDy.js +2 -0
  45. package/dist/es/chunks/webgl-device-Bht0bA0i.js +2 -0
  46. package/dist/es/web-kit.mjs +416 -0
  47. package/dist/iife/web-kit.iife.js +413 -0
  48. package/dist/sw/mvx-tiles-sw.js +582 -0
  49. package/dist/types/index.d.ts +1765 -0
  50. package/package.json +87 -4
@@ -0,0 +1,2 @@
1
+ /*! Web-kit v1.2.0-develop.11 | (c) 2026 MapVX */
2
+ !function(){try{var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="6f4625a7-0262-475f-b48d-046df6a31af0",t._sentryDebugIdIdentifier="sentry-dbid-6f4625a7-0262-475f-b48d-046df6a31af0")}catch(t){}}();import{$t as t,A as e,At as i,C as s,D as n,F as r,Ft as o,Gt as a,H as h,L as c,M as d,Nt as l,O as p,P as u,Qt as g,R as v,S as m,Ut as w,V as f,W as _,_ as y,a as P,an as b,at as C,b as M,dn as k,h as x,ht as S,in as E,it as R,j as L,k as D,l as I,n as T,nn as A,nt as V,o as z,r as F,rn as O,s as j,tn as B,ut as N,v as U,z as G,zt as W}from"./debug-hooks-A7fGcVSJ.js";import{g as Z,p as H,u as q}from"./shader-type-decoder-DV9QwQh3.js";import{f as $,n as X,r as Y,t as K}from"./globe-viewport-C_lLyBu9.js";var J={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:function(t){const e=t[0],i=t[t.length-1];return"{"===e&&"}"===i||"["===e&&"]"===i},parseTextSync:JSON.parse};var Q=function(){const t="9.4.1",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(O.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:O,_registerLoggers:A},b([J,[$,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}(),tt="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",et=class e{static defaultProps={...t,type:"best-available",adapters:void 0,waitForPageLoad:!0};stats=g;log=H;VERSION="9.4.2";spector;preregisteredAdapters=/* @__PURE__ */new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw H.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),H.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");H.error("This version of luma.gl has already been initialized")()}H.log(1,`${this.VERSION} - set luma.log.level=1 (or higher) to trace rendering`)(),globalThis.luma=this}async createDevice(t={}){const i={...e.defaultProps,...t},s=this.selectAdapter(i.type,i.adapters);if(!s)throw new Error(tt);return i.waitForPageLoad&&await s.pageLoaded,await s.create(i)}async attachDevice(t,e){const i=this._getTypeFromHandle(t,e.adapters),s=i&&this.selectAdapter(i,e.adapters);if(!s)throw new Error(tt);return await(s?.attach?.(t,e))}registerAdapters(t){for(const e of t)this.preregisteredAdapters.set(e.type,e)}getSupportedAdapters(t=[]){const e=this._getAdapterMap(t);return Array.from(e).map(([,t])=>t).filter(t=>t.isSupported?.()).map(t=>t.type)}getBestAvailableAdapterType(t=[]){const e=["webgpu","webgl","null"],i=this._getAdapterMap(t);for(const s of e)if(i.get(s)?.isSupported?.())return s;return null}selectAdapter(t,e=[]){let i=t;"best-available"===t&&(i=this.getBestAvailableAdapterType(e));const s=this._getAdapterMap(e);return i&&s.get(i)||null}enforceWebGL2(t=!0,e=[]){const i=this._getAdapterMap(e).get("webgl");i||H.warn("enforceWebGL2: webgl adapter not found")(),i?.enforceWebGL2?.(t)}setDefaultDeviceProps(t){Object.assign(e.defaultProps,t)}_getAdapterMap(t=[]){const e=new Map(this.preregisteredAdapters);for(const i of t)e.set(i.type,i);return e}_getTypeFromHandle(t,e=[]){return t instanceof WebGL2RenderingContext?"webgl":"undefined"!=typeof GPUDevice&&t instanceof GPUDevice||t?.queue?"webgpu":null===t?"null":(t instanceof WebGLRenderingContext?H.warn("WebGL1 is not supported",t)():H.warn("Unknown handle type",t)(),null)}},it=new et,st=class{get pageLoaded(){return function(){ot||(ot=rt()||"undefined"==typeof window?Promise.resolve():new Promise(t=>window.addEventListener("load",()=>t())));return ot}()}},nt=Z()&&"undefined"!=typeof document,rt=()=>nt&&"complete"===document.readyState,ot=null;var at="layout(std140) uniform layerUniforms {\n uniform float opacity;\n} layer;\n",ht={name:"layer",source:"struct LayerUniforms {\n opacity: f32,\n};\n\n@group(0) @binding(auto)\nvar<uniform> layer: LayerUniforms;\n",vs:at,fs:at,getUniforms:t=>({opacity:Math.pow(t.opacity,1/2.2)}),uniformTypes:{opacity:"f32"}},ct="\nlayout(std140) uniform shadowUniforms {\n bool drawShadowMap;\n bool useShadowMap;\n vec4 color;\n highp int lightId;\n float lightCount;\n mat4 viewProjectionMatrix0;\n mat4 viewProjectionMatrix1;\n vec4 projectCenter0;\n vec4 projectCenter1;\n} shadow;\n",dt=`\n${ct}\n\nconst int max_lights = 2;\n\nout vec3 shadow_vPosition[max_lights];\n\nvec4 shadow_setVertexPosition(vec4 position_commonspace) {\n mat4 viewProjectionMatrices[max_lights];\n viewProjectionMatrices[0] = shadow.viewProjectionMatrix0;\n viewProjectionMatrices[1] = shadow.viewProjectionMatrix1;\n vec4 projectCenters[max_lights];\n projectCenters[0] = shadow.projectCenter0;\n projectCenters[1] = shadow.projectCenter1;\n\n if (shadow.drawShadowMap) {\n return project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[shadow.lightId], projectCenters[shadow.lightId]);\n }\n if (shadow.useShadowMap) {\n for (int i = 0; i < max_lights; i++) {\n if(i < int(shadow.lightCount)) {\n vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[i], projectCenters[i]);\n shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;\n }\n }\n }\n return gl_Position;\n}\n\n`,lt=`\n${ct}\n\nconst int max_lights = 2;\nuniform sampler2D shadow_uShadowMap0;\nuniform sampler2D shadow_uShadowMap1;\n\nin vec3 shadow_vPosition[max_lights];\n\nconst vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);\nconst vec4 bitUnpackShift = 1.0 / bitPackShift;\nconst vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\nfloat shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {\n vec4 rgbaDepth = texture(shadowMap, position.xy);\n\n float z = dot(rgbaDepth, bitUnpackShift);\n return smoothstep(0.001, 0.01, position.z - z);\n}\n\nvec4 shadow_filterShadowColor(vec4 color) {\n if (shadow.drawShadowMap) {\n vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);\n rgbaDepth -= rgbaDepth.gbaa * bitMask;\n return rgbaDepth;\n }\n if (shadow.useShadowMap) {\n float shadowAlpha = 0.0;\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);\n if(shadow.lightCount > 1.0) {\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);\n }\n shadowAlpha *= shadow.color.a / shadow.lightCount;\n float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);\n\n return vec4(\n mix(color.rgb, shadow.color.rgb, shadowAlpha / blendedAlpha),\n blendedAlpha\n );\n }\n return color;\n}\n\n`,pt=r(function({viewport:t,center:e}){return new _(t.viewProjectionMatrix).invert().transform(e)}),ut=r(function({viewport:t,shadowMatrices:e}){const i=[],s=function(t){const{width:e,height:i,pixelUnprojectionMatrix:s}=t,n=[[0,0],[e,0],[e,i],[0,i]],r=n.map(([t,e])=>p([t,e,-1],s)),o=n.map(([t,e])=>p([t,e,1],s));if(!t.isGeospatial)return r.concat(o);const a=r.concat(o).filter(t=>t[2]>=0);for(let h=0;h<4;h++){const t=(h+1)%4;for(const[e,i]of[[r[h],o[h]],[r[h],r[t]],[o[h],o[t]]])if(e[2]<0!=i[2]<0){const t=e[2]/(e[2]-i[2]);a.push([e[0]+(i[0]-e[0])*t,e[1]+(i[1]-e[1])*t,0])}}return a.length>0?a:r.concat(o)}(t);for(const n of e){const e=n.clone().translate(new V(t.center).negate()),r=s.map(t=>e.transform(t)),o=(new _).ortho({left:Math.min(...r.map(t=>t[0])),right:Math.max(...r.map(t=>t[0])),bottom:Math.min(...r.map(t=>t[1])),top:Math.max(...r.map(t=>t[1])),near:Math.min(...r.map(t=>-t[2])),far:Math.max(...r.map(t=>-t[2]))});i.push(o.multiplyRight(n))}return i}),gt=[0,0,0,1],vt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];var mt={name:"shadow",dependencies:[d],vs:dt,fs:lt,inject:{"vs:DECKGL_FILTER_GL_POSITION":"\n position = shadow_setVertexPosition(geometry.position);\n ","fs:DECKGL_FILTER_COLOR":"\n color = shadow_filterShadowColor(color);\n "},getUniforms:function(t){const{shadowEnabled:e=!0,project:i}=t;if(!(e&&i&&t.shadowMatrices&&t.shadowMatrices.length))return{drawShadowMap:!1,useShadowMap:!1,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};const s=d.getUniforms(i),n=pt({viewport:i.viewport,center:s.center}),r=[],o=ut({shadowMatrices:t.shadowMatrices,viewport:i.viewport}).slice();for(let h=0;h<t.shadowMatrices.length;h++){const t=o[h],e=t.clone().translate(new V(i.viewport.center).negate());s.coordinateSystem===u("lnglat")&&s.projectionMode===v.WEB_MERCATOR?(o[h]=e,r[h]=n):(o[h]=t.clone().multiplyRight(vt),r[h]=e.transform(n))}const a={drawShadowMap:Boolean(t.drawToShadowMap),useShadowMap:!!t.shadowMaps&&t.shadowMaps.length>0,color:t.shadowColor||gt,lightId:t.shadowLightId||0,lightCount:t.shadowMatrices.length,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};for(let h=0;h<o.length;h++)a[`viewProjectionMatrix${h}`]=o[h],a[`projectCenter${h}`]=r[h];for(let h=0;h<2;h++)a[`shadow_uShadowMap${h}`]=t.shadowMaps&&t.shadowMaps[h]||t.dummyShadowMap;return a},uniformTypes:{drawShadowMap:"f32",useShadowMap:"f32",color:"vec4<f32>",lightId:"i32",lightCount:"f32",viewProjectionMatrix0:"mat4x4<f32>",viewProjectionMatrix1:"mat4x4<f32>",projectCenter0:"vec4<f32>",projectCenter1:"vec4<f32>"}},wt=[h],ft=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"],_t=[];function yt(t){const e=W.getDefaultShaderAssembler(t);for(const s of wt)e.addDefaultModule(s);e._hookFunctions.length=0;const i="glsl"===t?ft:_t;for(const s of i)e.addShaderHook(s);return e}var Pt=[255,255,255],bt=1,Ct=0,Mt=class{constructor(t={}){this.type="ambient";const{color:e=Pt}=t,{intensity:i=bt}=t;this.id=t.id||"ambient-"+Ct++,this.color=e,this.intensity=i}},kt=[255,255,255],xt=1,St=[0,0,-1],Et=0,Rt=class{constructor(t={}){this.type="directional";const{color:e=kt}=t,{intensity:i=xt}=t,{direction:s=St}=t,{_shadow:n=!1}=t;this.id=t.id||"directional-"+Et++,this.color=e,this.intensity=i,this.type="directional",this.direction=new V(s).normalize().toArray(),this.shadow=n}getProjectedLight(t){return this}},Lt=class{constructor(t,e={id:"pass"}){const{id:i}=e;this.id=i,this.device=t,this.props={...e}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}},Dt={depthWriteEnabled:!0,depthCompare:"less-equal",blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one-minus-src-alpha",blendAlphaOperation:"add",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha"},It=class extends Lt{constructor(){super(...arguments),this._lastRenderIndex=-1}render(t){this._render(t)}_render(t){const{canvasContext:e=this.device.canvasContext}=t,i=t.target??e.getCurrentFramebuffer(),[s,n]=e.getDrawingBufferSize(),r=t.clearCanvas??!0;let o=t.clearColor??(!!r&&[0,0,0,0]),a=!!r&&1,h=!!r&&0;const c=t.colorMask??15,d={viewport:[0,0,s,n]};t.colorMask&&(d.colorMask=c),t.scissorRect&&(d.scissorRect=t.scissorRect);const{shaderModuleProps:l,viewports:p,views:u,onViewportActive:g,clearStack:v=!0}=t,m=t.pass||"unknown",w="webgpu"===this.device.type;v&&(this._lastRenderIndex=-1);const f=[];if(!p.length)return this.device.beginRenderPass({framebuffer:i,parameters:d,clearColor:o,clearDepth:a,clearStencil:h}).end(),this.device.submit(),f;try{for(const s of p){g?.(s);const n=this._getDrawLayerParams(s,t),r=u&&u[s.id],c=s.subViewports||[s],p=w?c.map(t=>[t]):[c];for(const s of p){const c=this.device.beginRenderPass({framebuffer:i,parameters:d,clearColor:o,clearDepth:a,clearStencil:h});try{for(const o of s){const s=this._drawLayersInViewport(c,{target:i,canvasContext:e,shaderModuleProps:l,viewport:o,view:r,pass:m,layers:t.layers,isPicking:t.isPicking},n);f.push(s)}}finally{c.end(),w&&this.device.submit()}o=!1,a=!1,h=!1}}return f}finally{w||this.device.submit()}}_getDrawLayerParams(t,{layers:e,pass:i,isPicking:s=!1,layerFilter:n,cullRect:r,views:o,effects:a,canvasContext:h=this.device.canvasContext,shaderModuleProps:c},d=!1){const l=[],p=Tt(this._lastRenderIndex+1),u={layer:e[0],viewport:t,isPicking:s,renderPass:i,cullRect:r},g={};for(let v=0;v<e.length;v++){const s=e[v],r=this._shouldDrawLayer(s,u,n,g),m={shouldDrawLayer:r};r&&!d&&(m.shouldDrawLayer=!0,m.layerRenderIndex=p(s,r),m.shaderModuleProps=this._getShaderModuleProps(s,a,i,h,c),m.layerParameters={..."webgpu"===s.context.device.type?Dt:null,...s.context.deck?.props.parameters,...o?.[t.id]?.props.parameters,...this.getLayerParameters(s,v,t)}),l[v]=m}return l}_drawLayersInViewport(t,{layers:e,shaderModuleProps:i,pass:s,target:n,canvasContext:r,viewport:o,view:a,isPicking:h},c){const d=function(t,{canvasContext:e=t.canvasContext,shaderModuleProps:i,target:s,viewport:n}){const r=i?.project?.devicePixelRatio??e.cssToDeviceRatio(),[,o]=e.getDrawingBufferSize(),a=s?s.height:o,h=n;return[h.x*r,a-(h.y+h.height)*r,h.width*r,h.height*r]}(this.device,{canvasContext:r,shaderModuleProps:i,target:n,viewport:o});if(a){const{clear:t,clearColor:e,clearDepth:i,clearStencil:s}=a.props;if(t){let t=[0,0,0,0],r=1,o=0;Array.isArray(e)&&!h?t=[...e.slice(0,3),e[3]||255].map(t=>t/255):!1===e&&(t=!1),void 0!==i&&(r=i),void 0!==s&&(o=s),this.device.beginRenderPass({framebuffer:n,parameters:{viewport:d,scissorRect:d},clearColor:t,clearDepth:r,clearStencil:o}).end()}}const l={totalCount:e.length,visibleCount:0,compositeCount:0,pickableCount:0};t.setParameters({viewport:d});for(let u=0;u<e.length;u++){const i=e[u],n=c[u],{shouldDrawLayer:r}=n;if(r&&i.props.pickable&&l.pickableCount++,i.isComposite&&l.compositeCount++,i.isDrawable&&n.shouldDrawLayer){const{layerRenderIndex:e,shaderModuleProps:r,layerParameters:a}=n;l.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,e),r.project&&(r.project.viewport=o),i.context.renderPass=t;try{i._drawLayer({renderPass:t,shaderModuleProps:r,uniforms:{layerIndex:e},parameters:a})}catch(p){i.raiseError(p,`drawing ${i} to ${s}`)}}}return l}shouldDrawLayer(t){return!0}getShaderModuleProps(t,e,i){return null}getLayerParameters(t,e,i){return t.props.parameters}_shouldDrawLayer(t,e,i,s){if(!t.props.visible||!this.shouldDrawLayer(t))return!1;e.layer=t;let n=t.parent;for(;n;){if(!n.props.visible||!n.filterSubLayer(e))return!1;e.layer=n,n=n.parent}if(i){const t=e.layer.id;if(t in s||(s[t]=i(e)),!s[t])return!1}return t.activateViewport(e.viewport),!0}_getShaderModuleProps(t,e,i,s,n){const r=s.cssToDeviceRatio(),o=t.internalState?.propsInTransition||t.props,a={layer:o,picking:{isActive:!1},project:{viewport:t.context.viewport,devicePixelRatio:r,modelMatrix:o.modelMatrix,coordinateSystem:o.coordinateSystem,coordinateOrigin:o.coordinateOrigin,autoWrapLongitude:t.wrapLongitude}};if(e)for(const h of e)At(a,h.getShaderModuleProps?.(t,a));for(const h of t.context.defaultShaderModules)h.name in a||(a[h.name]={});return At(a,this.getShaderModuleProps(t,e,a),n)}};function Tt(t=0,e={}){const i={},s=(n,r)=>{const o=n.props._offset,a=n.id,h=n.parent&&n.parent.id;let c;if(h&&!(h in e)&&s(n.parent,!1),h in i){const t=i[h]=i[h]||Tt(e[h],e);c=t(n,r),i[a]=t}else Number.isFinite(o)?(c=o+(e[h]||0),i[a]=null):c=t;return r&&c>=t&&(t=c+1),e[a]=c,c};return s}function At(t,...e){for(const i of e)if(i)for(const e in i)t[e]?Object.assign(t[e],i[e]):t[e]=i[e];return t}var Vt=class extends It{constructor(t,e){super(t,e);const i=t.createTexture({format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),s=t.createTexture({format:"depth16unorm",width:1,height:1});this.fbo=t.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[i],depthStencilAttachment:s})}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null)}getShadowMap(){return this.fbo.colorAttachments[0].texture}render(t){const e=this.fbo,i=this.device.canvasContext.cssToDeviceRatio(),s=t.viewports[0],n=s.width*i,r=s.height*i;n===e.width&&r===e.height||e.resize({width:n,height:r}),super.render({...t,clearColor:[1,1,1,1],target:e,pass:"shadow"})}getLayerParameters(t,e,i){return{...t.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal",depthBias:0}}shouldDrawLayer(t){return!1!==t.props.shadowEnabled}getShaderModuleProps(t,e,i){return{shadow:{project:i.project,drawToShadowMap:!0},lighting:{enabled:!1}}}},zt={color:[255,255,255],intensity:1},Ft=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],Ot=[0,0,0,200/255],jt=class{constructor(t={}){this.id="lighting-effect",this.shadowColor=Ot,this.shadow=!1,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.dummyShadowMap=null,this.setProps(t)}setup(t){this.context=t;const{device:e,deck:i}=t;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(e),i._addDefaultShaderModule(mt),this.dummyShadowMap=e.createTexture({width:1,height:1}))}setProps(t){this.ambientLight=void 0,this.directionalLights=[],this.pointLights=[];for(const e in t){const i=t[e];switch(i.type){case"ambient":this.ambientLight=i;break;case"directional":this.directionalLights.push(i);break;case"point":this.pointLights.push(i)}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(t=>t.shadow),this.context&&(this.shadow||this.cleanup(this.context),this.setup(this.context)),this.props=t}preRender({layers:t,layerFilter:e,viewports:i,onViewportActive:s,views:n}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let r=0;r<this.shadowPasses.length;r++)this.shadowPasses[r].render({layers:t,layerFilter:e,viewports:i,onViewportActive:s,views:n,shaderModuleProps:{shadow:{shadowLightId:r,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}}})}}getShaderModuleProps(t,e){const i=this.shadow?{project:e.project,shadowMaps:this.shadowPasses.map(t=>t.getShadowMap()),dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{},s={enabled:!0,lights:this._getLights(t)},n=t.props.material;return{shadow:i,lighting:s,phongMaterial:n,gouraudMaterial:n}}cleanup(t){for(const e of this.shadowPasses)e.delete();this.shadowPasses.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,t.deck._removeDefaultShaderModule(mt))}_calculateMatrices(){const t=[];for(const e of this.directionalLights){const i=(new _).lookAt({eye:new V(e.direction).negate()});t.push(i)}return t}_createShadowPasses(t){for(let e=0;e<this.directionalLights.length;e++){const i=new Vt(t);this.shadowPasses[e]=i}}_applyDefaultLights(){const{ambientLight:t,pointLights:e,directionalLights:i}=this;t||0!==e.length||0!==i.length||(this.ambientLight=new Mt(zt),this.directionalLights.push(new Rt(Ft[0]),new Rt(Ft[1])))}_getLights(t){const e=[];this.ambientLight&&e.push(this.ambientLight);for(const i of this.pointLights)e.push(i.getProjectedLight({layer:t}));for(const i of this.directionalLights)e.push(i.getProjectedLight({layer:t}));return e}},Bt=1,Nt=1,Ut=class{time=0;channels=/* @__PURE__ */new Map;animations=/* @__PURE__ */new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(t){const{delay:e=0,duration:i=Number.POSITIVE_INFINITY,rate:s=1,repeat:n=1}=t,r=Bt++,o={time:0,delay:e,duration:i,rate:s,repeat:n};return this._setChannelTime(o,this.time),this.channels.set(r,o),r}removeChannel(t){this.channels.delete(t);for(const[e,i]of this.animations)i.channel===t&&this.detachAnimation(e)}isFinished(t){const e=this.channels.get(t);return void 0!==e&&this.time>=e.delay+e.duration*e.repeat}getTime(t){if(void 0===t)return this.time;const e=this.channels.get(t);return void 0===e?-1:e.time}setTime(t){this.time=Math.max(0,t);const e=this.channels.values();for(const s of e)this._setChannelTime(s,this.time);const i=this.animations.values();for(const s of i){const{animation:t,channel:e}=s;t.setTime(this.getTime(e))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,e){const i=Nt++;return this.animations.set(i,{animation:t,channel:e}),t.setTime(this.getTime(e)),i}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(-1===this.lastEngineTime&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,e){const i=e-t.delay;i>=t.duration*t.repeat?t.time=t.duration*t.rate:(t.time=Math.max(0,i)%t.duration,t.time*=t.rate)}};var Gt=0,Wt={requestAnimationFrame:t=>function(t){const e="undefined"!=typeof window?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame:null;return e?e.call(window,t):setTimeout(()=>t("undefined"!=typeof performance?performance.now():Date.now()),1e3/60)}(t),cancelAnimationFrame:t=>function(t){const e="undefined"!=typeof window?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame:null;e?e.call(window,t):clearTimeout(t)}(t)},Zt=class t{static defaultAnimationLoopProps={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>{console.error(t)},stats:void 0,autoResizeViewport:!1,animationFrameProvider:Wt};device=null;canvas=null;props;animationProps=null;timeline=null;stats;sharedStats;cpuTime;gpuTime;frameRate;display;_needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;_error=null;_lastFrameTime=0;constructor(e){if(this.props={...t.defaultAnimationLoopProps,...e},!(e=this.props).device)throw new Error("No device provided");this.stats=e.stats||new k({id:"animation-loop-"+Gt++}),this.sharedStats=it.stats.get("Animation Loop"),this.frameRate=this.stats.get("Frame Rate"),this.frameRate.setSampleSize(1),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.setProps({autoResizeViewport:e.autoResizeViewport,animationFrameProvider:e.animationFrameProvider}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null),this.device?._disableDebugGPUTime()}delete(){this.destroy()}reportError(e){this._error=e,this.props.onError(e),this.props.onError===t.defaultAnimationLoopProps.onError&&"undefined"!=typeof window&&"undefined"!=typeof ErrorEvent&&window.dispatchEvent(new ErrorEvent("error",{error:e,message:e.message}))}setNeedsRedraw(t){return this._needsRedraw=this._needsRedraw||t,this}needsRedraw(){const t=this._needsRedraw;return this._needsRedraw=!1,t}setProps(t){if("autoResizeViewport"in t&&(this.props.autoResizeViewport=t.autoResizeViewport||!1),"animationFrameProvider"in t){const e=t.animationFrameProvider||Wt;if(e!==this.props.animationFrameProvider){const t=null!==this._animationFrameId;t&&this._cancelAnimationFrame(),this.props.animationFrameProvider=e,t&&this._requestAnimationFrame()}}return this}async start(){if(this._running)return this;this._running=!0;try{if(!this._initialized){if(this._initialized=!0,await this._initDevice(),this._initialize(),!this._running)return null;await this.props.onInitialize(this._getAnimationProps())}return this._running?(this._cancelAnimationFrame(),this._requestAnimationFrame(),this):null}catch(t){const e=t instanceof Error?t:/* @__PURE__ */new Error("Unknown error");throw this.props.onError(e),e}}stop(){if(this._running){const t=this.animationProps;this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1,this._lastFrameTime=0,t&&this.props.onFinalize(t)}return this}redraw(t,e=null){return this.device?.isLost||this._error||(this._beginFrameTimers(t),this._setupFrame(),this.animationProps&&(this.animationProps.animationFrame=e),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers()),this}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport(),this.device?._enableDebugGPUTime()}_setDisplay(t){this.display&&(this.display.destroy(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_requestAnimationFrame(){this._running&&(this._animationFrameId=this.props.animationFrameProvider.requestAnimationFrame(this._animationFrame.bind(this)))}_cancelAnimationFrame(){null!==this._animationFrameId&&(this.props.animationFrameProvider.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null)}_animationFrame(t,e){if(this._running)try{this.redraw(t,e??null),this._requestAnimationFrame()}catch(i){const t=i instanceof Error?i:new Error(String(i));this.reportError(t),this.stop()}}_renderFrame(t){if(this.display)return void this.display._renderFrame(t);const e=this.props.onRender(this._getAnimationProps());this.device&&!1!==e&&this.device.submit()}_clearNeedsRedraw(){this._needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){const t=this.device?.getDefaultCanvasContext();if(!this.device||!t)throw new Error("loop");const e=t?.canvas,i=t.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:t,canvas:e,useDevicePixels:i,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,animationFrame:null,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;const{width:t,height:e,aspect:i}=this._getSizeAndAspect();t===this.animationProps.width&&e===this.animationProps.height||this.setNeedsRedraw("drawing buffer resized"),i!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=t,this.animationProps.height=e,this.animationProps.aspect=i,this.animationProps.needsRedraw=this._needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){const t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";const e=document.createElement("div");e.style.position="absolute",e.style.left="10px",e.style.bottom="10px",e.style.width="300px",e.style.background="white",this.canvas instanceof HTMLCanvasElement&&t.appendChild(this.canvas),t.appendChild(e);const i=this.props.onAddHTML(e);i&&(e.innerHTML=i)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};const[t,e]=this.device.getDefaultCanvasContext().getDrawingBufferSize();return{width:t,height:e,aspect:t>0&&e>0?t/e:1}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(t){const e=t??("undefined"!=typeof performance?performance.now():Date.now());if(this._lastFrameTime){const t=e-this._lastFrameTime;t>0&&this.frameRate.addTime(t)}this._lastFrameTime=e,this.device?._isDebugGPUTimeEnabled()&&this._consumeEncodedGpuTime(),this.cpuTime.timeStart()}_endFrameTimers(){this.device?._isDebugGPUTimeEnabled()&&this._consumeEncodedGpuTime(),this.cpuTime.timeEnd(),this._updateSharedStats()}_consumeEncodedGpuTime(){if(!this.device)return;const t=this.device.commandEncoder._gpuTimeMs;void 0!==t&&(this.gpuTime.addTime(t),this.device.commandEncoder._gpuTimeMs=void 0)}_updateSharedStats(){if(this.stats!==this.sharedStats){for(const t of Object.keys(this.sharedStats.stats))this.stats.stats[t]||delete this.sharedStats.stats[t];this.stats.forEach(t=>{const e=this.sharedStats.get(t.name,t.type);e.sampleSize=t.sampleSize,e.time=t.time,e.count=t.count,e.samples=t.samples,e.lastTiming=t.lastTiming,e.lastSampleTime=t.lastSampleTime,e.lastSampleCount=t.lastSampleCount,e._count=t._count,e._time=t._time,e._samples=t._samples,e._startTime=t._startTime,e._timerPending=t._timerPending})}}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(t){t instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[t.offsetX,t.offsetY])}_onMouseleave(t){this._getAnimationProps()._mousePosition=null}},Ht={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant",blendAlphaDstFactor:"zero"},qt=class extends It{constructor(){super(...arguments),this._colorEncoderState=null}render(t){return"pickingFBO"in t?this._drawPickingBuffer(t):{decodePickingColor:null,stats:super._render(t)}}_drawPickingBuffer({layers:t,layerFilter:e,views:i,viewports:s,onViewportActive:n,pickingFBO:r,deviceRect:{x:o,y:a,width:h,height:c},cullRect:d,effects:l,pass:p="picking",pickZ:u,canvasContext:g,shaderModuleProps:v,clearColor:m}){this.pickZ=u;const w=this._resetColorEncoder(u),f=[o,a,h,c],_=super._render({target:r,layers:t,layerFilter:e,views:i,viewports:s,onViewportActive:n,cullRect:d,effects:l?.filter(t=>t.useInPicking),pass:p,canvasContext:g,isPicking:!0,shaderModuleProps:v,clearColor:m??[0,0,0,0],colorMask:15,scissorRect:f});return this._colorEncoderState=null,{decodePickingColor:w&&Xt.bind(null,w),stats:_}}shouldDrawLayer(t){const{pickable:e,operation:i}=t.props;return e&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getShaderModuleProps(t,e,i){return{picking:{isActive:1,isAttribute:this.pickZ,disabledPickingIndices:t.internalState?.disabledPickingIndices},lighting:{enabled:!1}}}getLayerParameters(t,e,i){const s={...t.props.parameters},{pickable:n,operation:r}=t.props;return this._colorEncoderState?n&&r.includes("draw")?(Object.assign(s,Ht),s.blend=!0,"webgpu"===this.device.type?s.blendConstant=$t(this._colorEncoderState,t,i):s.blendColor=$t(this._colorEncoderState,t,i),r.includes("terrain")&&t.state?._hasPickingCover&&(s.blendAlphaSrcFactor="one")):r.includes("terrain")&&(s.blend=!1):s.blend=!1,s}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:/* @__PURE__ */new Map,byAlpha:[]},this._colorEncoderState}};function $t(t,e,i){const{byLayer:s,byAlpha:n}=t;let r,o=s.get(e);return o?(o.viewports.push(i),r=o.a):(r=s.size+1,r<=255?(o={a:r,layer:e,viewports:[i]},s.set(e,o),n[r]=o):(O.warn("Too many pickable layers, only picking the first 255")(),r=0)),[0,0,0,r/255]}function Xt(t,e){const i=t.byAlpha[e[3]];return i&&{pickedLayer:i.layer,pickedViewports:i.viewports,pickedObjectIndex:i.layer.decodePickingColor(e)}}var Yt=class{constructor(t,e,i){this._loadCount=0,this._subscribers=/* @__PURE__ */new Set,this.id=t,this.context=i,this.setData(e)}subscribe(t){this._subscribers.add(t)}unsubscribe(t){this._subscribers.delete(t)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,e){if(t===this._data&&!e)return;this._data=t;const i=++this._loadCount;let s=t;"string"==typeof t&&(s=E(t)),s instanceof Promise?(this.isLoaded=!1,this._loader=s.then(t=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=t)}).catch(t=>{this._loadCount===i&&(this.isLoaded=!0,this._error=t||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t);for(const n of this._subscribers)n.onChange(this.getData())}},Kt=class{constructor(t){this.protocol=t.protocol||"resource://",this._context={device:t.device,gl:t.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return!!t.startsWith(this.protocol)||t in this._resources}add({resourceId:t,data:e,forceUpdate:i=!1,persistent:s=!0}){let n=this._resources[t];n?n.setData(e,i):(n=new Yt(t,e,this._context),this._resources[t]=n),n.persistent=s}remove(t){const e=this._resources[t];e&&(e.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){const e=this._consumers[t];if(e){for(const t in e){const i=e[t],s=this._resources[i.resourceId];s&&s.unsubscribe(i)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:e,consumerId:i,requestId:s="default"}){const{_resources:n,protocol:r}=this;t.startsWith(r)&&(n[t=t.replace(r,"")]||this.add({resourceId:t,data:null,persistent:!1}));const o=n[t];if(this._track(i,s,o,e),o)return o.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(const t in this._resources)this._resources[t].delete()}_track(t,e,i,s){const n=this._consumers,r=n[t]=n[t]||{};let o=r[e];const a=o&&o.resourceId&&this._resources[o.resourceId];a&&(a.unsubscribe(o),this.prune()),i&&(o?(o.onChange=s,o.resourceId=i.id):o={onChange:s,resourceId:i.id},r[e]=o,i.subscribe(o))}_prune(){this._pruneRequest=null;for(const t of Object.keys(this._resources)){const e=this._resources[t];e.persistent||e.inUse()||(e.delete(),delete this._resources[t])}}},Jt=class{constructor(t,e){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=t=>{B("layerManager.activateViewport",this,t),t&&(this.context.viewport=t)};const{deck:i,stats:s,viewport:n,timeline:r}=e||{};this.layers=[],this.resourceManager=new Kt({device:t,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:t,gl:t?.gl,deck:i,shaderAssembler:yt(t?.info?.shadingLanguage||"glsl"),defaultShaderModules:[ht],renderPass:void 0,stats:s||new k({id:"deck.gl"}),viewport:n||new U({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:r||new Ut,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(const t of this.layers)this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(const i of this.layers){const s=i.getNeedsRedraw(t);e=e||s}return e}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(e=>t.find(t=>0===e.id.indexOf(t))):this.layers}setProps(t){"debug"in t&&(this._debug=t.debug),"userData"in t&&(this.context.userData=t.userData),"layers"in t&&(this._nextLayers=t.layers),"onError"in t&&(this.context.onError=t.onError)}setLayers(t,e){B("layerManager.setLayers",this,e,t),this._lastRenderedLayers=t;const i=I(t,Boolean);for(const s of i)s.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){const t=this.needsUpdate();t&&(this.setNeedsRedraw(`updating layers: ${t}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}addDefaultShaderModule(t){const{defaultShaderModules:e}=this.context;e.find(e=>e.name===t.name)||(e.push(t),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(t){const{defaultShaderModules:e}=this.context,i=e.findIndex(e=>e.name===t.name);i>=0&&(e.splice(i,1),this._defaultShaderModulesChanged=!0)}_handleError(t,e,i){i.raiseError(e,`${t} of ${i}`)}_updateLayers(t,e){const i={};for(const r of t)i[r.id]?O.warn(`Multiple old layers with same id ${r.id}`)():i[r.id]=r;if(this._defaultShaderModulesChanged){for(const e of t)e.setNeedsUpdate(),e.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}const s=[];this._updateSublayersRecursively(e,i,s),this._finalizeOldLayers(i);let n=!1;for(const r of s)if(r.hasUniformTransition()){n=`Uniform transition in ${r}`;break}this._needsUpdate=n,this.layers=s}_updateSublayersRecursively(t,e,i){for(const n of t){n.context=this.context;const t=e[n.id];null===t&&O.warn(`Multiple new layers with same id ${n.id}`)(),e[n.id]=null;let r=null;try{this._debug&&t!==n&&n.validateProps(),t?(this._transferLayerState(t,n),this._updateLayer(n)):this._initializeLayer(n),i.push(n),r=n.isComposite?n.getSubLayers():null}catch(s){this._handleError("matching",s,n)}r&&this._updateSublayersRecursively(r,e,i)}}_finalizeOldLayers(t){for(const e in t){const i=t[e];i&&this._finalizeLayer(i)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=x.INITIALIZED}catch(e){this._handleError("initialization",e,t)}}_transferLayerState(t,e){e._transferState(t),e.lifecycle=x.MATCHED,e!==t&&(t.lifecycle=x.AWAITING_GC)}_updateLayer(t){try{t._update()}catch(e){this._handleError("update",e,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||`finalized ${t}`,t.lifecycle=x.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=x.FINALIZED}catch(e){this._handleError("finalization",e,t)}}},Qt="default-canvas",te=class{constructor(t){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=t.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=t.eventManager,this._eventManagers=t.eventManagers||{},this._viewEventManagers={},this._eventCallbacks={onViewStateChange:t.onViewStateChange,onInteractionStateChange:t.onInteractionStateChange},this._pickPosition=t.pickPosition,this._getCanvasContext=t.getCanvasContext,Object.seal(this),this.setProps(t)}finalize(){for(const t in this.controllers){const e=this.controllers[t];e&&e.finalize()}this.controllers={}}needsRedraw(t={clearRedrawFlags:!1}){const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}updateViewStates(){for(const t in this.controllers){const e=this.controllers[t];e&&e.updateTransition()}}getViewports(t){return t?this._viewports.filter(e=>{const i=!t.canvasId||this.getCanvasId(e.id)===t.canvasId,s=!("x"in t)||e.containsPixel(t);return i&&s}):this._viewports}getViews(){const t={};return this.views.forEach(e=>{t[e.id]=e}),t}getView(t){return this.views.find(e=>e.id===t)}getViewState(t){const e="string"==typeof t?this.getView(t):t,i=e&&this.viewState[e.getViewStateId()]||this.viewState;return e?e.filterViewState(i):i}getViewport(t){return this._viewportMap[t]}getCanvasId(t){const e="string"==typeof t?this.getView(t):t;return e?this._viewEventManagers[e.id]?.canvasId||this._getCanvasIdFromView(e):void 0}unproject(t,e){const i=this.getViewports(),s={x:t[0],y:t[1]};for(let n=i.length-1;n>=0;--n){const r=i[n];if(r.containsPixel(s)){const i=t.slice();return i[0]-=r.x,i[1]-=r.y,r.unproject(i,e)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),("width"in t||"height"in t)&&this._setSize(t.width,t.height),"pickPosition"in t&&(this._pickPosition=t.pickPosition),"eventManagers"in t&&this._setEventManagers(t.eventManagers||{}),this._isUpdating||this._update()}_update(){this._isUpdating=!0;try{this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports())}finally{this._isUpdating=!1}}_hasViewState(t){const e=t.props.viewState;if(e&&"object"==typeof e&&!e.id)return!0;if(this.viewState[t.getViewStateId()])return!0;const i=Object.values(this.viewState);return 0===i.length||i.some(t=>!t||"object"!=typeof t||Array.isArray(t))}_setSize(t,e){t===this.width&&e===this.height||(this.width=t,this.height=e,this.setNeedsUpdate("Size changed"))}_setViews(t){t=I(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}_setViewState(t){t?(j(t,this.viewState,3)||this.setNeedsUpdate("viewState changed"),this.viewState=t):O.warn("missing `viewState` or `initialViewState`")()}_setEventManagers(t){this._eventManagers!==t&&(this._eventManagers=t,this.setNeedsUpdate("eventManagers changed"))}_getCanvasIdFromView(t){return t.props.canvasId||this._getCanvasContext?.(t.id)?.id||"default-canvas"}_getCanvasDimensions(t){const[e,i]=(this._getCanvasContext?.(t.id))?.getCSSSize()||[this.width,this.height];return{width:e,height:i}}_getViewEventManager(t){const e=this.getCanvasId(t)||"default-canvas";return{canvasId:e,eventManager:this._eventManagers[e]||this._eventManager}}_startViewportRebuild(){const t=this.controllers,e=this._viewEventManagers;return this._viewports=[],this.controllers={},this._viewEventManagers={},{oldControllers:t,oldViewEventManagers:e}}_getReusableController(t,e,i){return!t||e?.canvasId===i.canvasId&&e?.eventManager===i.eventManager?t:(t.finalize(),null)}_createController(t,e){return new(0,e.type)({timeline:this.timeline,eventManager:this._getViewEventManager(t).eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:e=>this.getView(t.id)?.makeViewport({viewState:e,...this._getCanvasDimensions(t)}),pickPosition:(e,i)=>this._pickPosition?.(e,i,t.id)})}_updateController(t,e,i,s){const n=t.controller;if(n&&i){const r={...e,...n,id:t.id,x:i.x,y:i.y,width:i.width,height:i.height};return s&&s.constructor===n.type||(s=this._createController(t,r)),s&&s.setProps(r),s}return null}_rebuildViewports(){const{views:t}=this,{oldControllers:e,oldViewEventManagers:i}=this._startViewportRebuild();let s=!1;for(let n=t.length;n--;){const r=t[n],{width:o,height:a}=this._getCanvasDimensions(r),h=this._getViewEventManager(r);this._viewEventManagers[r.id]=h;const c=this.getViewState(r),d=r.makeViewport({viewState:c,width:o,height:a});let l=this._getReusableController(e[r.id],i[r.id],h),p=Boolean(r.controller);p&&!this._hasViewState(r)&&(p=!1),p&&!l&&(s=!0),!s&&p||!l||(l.finalize(),l=null),this.controllers[r.id]=p?this._updateController(r,c,d,l):null,d&&this._viewports.unshift(d)}for(const n in e){const t=e[n];t&&!this.controllers[n]&&t.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,e){return t.length!==e.length||t.some((i,s)=>!t[s].equals(e[s]))}},ee=/^(?:\d+\.?\d*|\.\d+)$/;function ie(t){switch(typeof t){case"number":if(!Number.isFinite(t))throw new Error(`Could not parse position string ${t}`);return{type:"literal",value:t};case"string":try{const e=function(t){const e=[];let i=0;for(;i<t.length;){const s=t[i];if(/\s/.test(s))i++;else{if("+"!==s&&"-"!==s&&"("!==s&&")"!==s&&"%"!==s){if(oe(s)||"."===s){const n=i;let r="."===s;for(i++;i<t.length;){const e=t[i];if(oe(e))i++;else{if("."!==e||r)break;r=!0,i++}}const o=t.slice(n,i);if(!ee.test(o))throw new Error("Invalid number token");e.push({type:"number",value:parseFloat(o)});continue}if(ae(s)){const s=i;for(;i<t.length&&ae(t[i]);)i++;const n=t.slice(s,i).toLowerCase();e.push({type:"word",value:n});continue}throw new Error("Invalid token in position string")}e.push({type:"symbol",value:s}),i++}}return e}(t);return new re(e).parseExpression()}catch(e){const i=e instanceof Error?e.message:String(e);throw new Error(`Could not parse position string ${t}: ${i}`)}default:throw new Error(`Could not parse position string ${t}`)}}function se(t,e){switch(t.type){case"literal":return t.value;case"percentage":return Math.round(t.value*e);case"binary":const i=se(t.left,e),s=se(t.right,e);return"+"===t.operator?i+s:i-s;default:throw new Error("Unknown layout expression type")}}function ne(t,e){return se(t,e)}var re=class{constructor(t){this.index=0,this.tokens=t}parseExpression(){const t=this.parseBinaryExpression();if(this.index<this.tokens.length)throw new Error("Unexpected token at end of expression");return t}parseBinaryExpression(){let t=this.parseFactor(),e=this.peek();for(;he(e);){this.index++;const i=this.parseFactor();t={type:"binary",operator:e.value,left:t,right:i},e=this.peek()}return t}parseFactor(){const t=this.peek();if(!t)throw new Error("Unexpected end of expression");if("symbol"===t.type&&"+"===t.value)return this.index++,this.parseFactor();if("symbol"===t.type&&"-"===t.value)return this.index++,{type:"binary",operator:"-",left:{type:"literal",value:0},right:this.parseFactor()};if("symbol"===t.type&&"("===t.value){this.index++;const t=this.parseBinaryExpression();if(!this.consumeSymbol(")"))throw new Error("Missing closing parenthesis");return t}if("word"===t.type&&"calc"===t.value){if(this.index++,!this.consumeSymbol("("))throw new Error("Missing opening parenthesis after calc");const t=this.parseBinaryExpression();if(!this.consumeSymbol(")"))throw new Error("Missing closing parenthesis");return t}if("number"===t.type){this.index++;const e=t.value,i=this.peek();return i&&"symbol"===i.type&&"%"===i.value?(this.index++,{type:"percentage",value:e/100}):i&&"word"===i.type&&"px"===i.value?(this.index++,{type:"literal",value:e}):{type:"literal",value:e}}throw new Error("Unexpected token in expression")}consumeSymbol(t){const e=this.peek();return!(!e||"symbol"!==e.type||e.value!==t)&&(this.index++,!0)}peek(){return this.tokens[this.index]||null}};function oe(t){return t>="0"&&t<="9"}function ae(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}function he(t){return Boolean(t&&"symbol"===t.type&&("+"===t.value||"-"===t.value))}function ce(t,e){t=t.slice();for(let i=0;i<e.length;i++){const s=e[i];Number.isFinite(s)&&(t[i]=s)}return t}var de=class{constructor(t){const{id:e,x:i=0,y:s=0,width:n="100%",height:r="100%",padding:o=null}=t;this.id=e||this.constructor.displayName||"view",this.props={...t,id:this.id},this._x=ie(i),this._y=ie(s),this._width=ie(n),this._height=ie(r),this._padding=o&&{left:ie(o.left||0),right:ie(o.right||0),top:ie(o.top||0),bottom:ie(o.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t||this.constructor===t.constructor&&j(this.props,t.props,2)}clone(t){return new(0,this.constructor)({...this.props,...t})}makeViewport({width:t,height:e,viewState:i}){i=this.filterViewState(i);const s=this.getDimensions({width:t,height:e});return s.height&&s.width?new(this.getViewportType(i))({...i,...this.props,...s}):null}getViewStateId(){const{viewState:t}=this.props;return"string"==typeof t?t:t?.id||this.id}filterViewState(t){return this.props.viewState&&"object"==typeof this.props.viewState?this.props.viewState.id?function(t,e){const i={...t};for(const s in e)"id"!==s&&(Array.isArray(i[s])&&Array.isArray(e[s])?i[s]=ce(i[s],e[s]):i[s]=e[s]);return i}(t,this.props.viewState):this.props.viewState:t}getDimensions({width:t,height:e}){const i={x:ne(this._x,t),y:ne(this._y,e),width:ne(this._width,t),height:ne(this._height,e)};return this._padding&&(i.padding={left:ne(this._padding.left,t),top:ne(this._padding.top,e),right:ne(this._padding.right,t),bottom:ne(this._padding.bottom,e)}),i}get controller(){const t=this.props.controller;return t?!0===t?{type:this.ControllerType}:"function"==typeof t?{type:t}:{type:this.ControllerType,...t}:null}},le=()=>{},pe={mode:"preserve"},ue={mode:"hard"},ge=2,ve=3,me=t=>t,we=1,fe=class{constructor(t){this._onTransitionUpdate=t=>{const{time:e,settings:{interpolator:i,startProps:s,endProps:n,duration:r,easing:o}}=t,a=o(e/r),h=i.interpolateProps(s,n,a);this.propsInTransition=this.getControllerState({...this.props,...h},pe).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new z(t.timeline),this.onViewStateChange=t.onViewStateChange||le,this.onStateChange=t.onStateChange||le}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let e=!1;const i=this.props;if(this.props=t,!i||this._shouldIgnoreViewportChange(i,t))return!1;if(this._isTransitionEnabled(t)){let s=i;if(this.transition.inProgress){const{interruption:t,endProps:e}=this.transition.settings;s={...i,...t===ge?e:this.propsInTransition||i}}this._triggerTransition(s,t),e=!0}else this.transition.cancel();return e}updateTransition(){this.transition.update()}_isTransitionEnabled(t){const{transitionDuration:e,transitionInterpolator:i}=t;return(e>0||"auto"===e)&&Boolean(i)}_isUpdateDueToCurrentTransition(t){return!(!this.transition.inProgress||!this.propsInTransition)&&this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition)}_shouldIgnoreViewportChange(t,e){return this.transition.inProgress?this.transition.settings.interruption===ve||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e)}_triggerTransition(t,e){const i=this.getControllerState(t,pe),s=this.getControllerState(e,ue).shortestPathFrom(i),n=e.transitionInterpolator,r=n.getDuration?n.getDuration(t,e):e.transitionDuration;if(0===r)return;const o=n.initializeProps(t,s);this.propsInTransition={};const a={duration:r,easing:e.transitionEasing||me,interpolator:n,interruption:e.transitionInterruption||we,startProps:o.start,endProps:o.end,onStart:e.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(e.onTransitionInterrupt),onEnd:this._onTransitionEnd(e.onTransitionEnd)};this.transition.start(a),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return e=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(e)}}},_e=class{constructor(t){const{compare:e,extract:i,required:s}=t;this._propsToCompare=e,this._propsToExtract=i||e,this._requiredProps=s}arePropsEqual(t,e){for(const i of this._propsToCompare)if(!(i in t)||!(i in e)||!l(t[i],e[i]))return!1;return!0}initializeProps(t,e){const i={},s={};for(const n of this._propsToExtract)(n in t||n in e)&&(i[n]=t[n],s[n]=e[n]);return this._checkRequiredProps(i),this._checkRequiredProps(s),{start:i,end:s}}getDuration(t,e){return e.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(e=>{const i=t[e];P(Number.isFinite(i)||Array.isArray(i),`${e} is required for transition`)})}},ye=["longitude","latitude","zoom","bearing","pitch"],Pe=["longitude","latitude","zoom"],be=class extends _e{constructor(t={}){const e=Array.isArray(t)?t:t.transitionProps,i=Array.isArray(t)?{}:t;i.transitionProps=Array.isArray(e)?{compare:e,required:e}:e||{compare:ye,required:Pe},super(i.transitionProps),this.opts=i}initializeProps(t,e){const i=super.initializeProps(t,e),{makeViewport:s,around:n}=this.opts;if(s&&n){const r=s(t),o=s(e),a=r.unproject(n);i.start.around=n,Object.assign(i.end,{around:o.project(a),aroundPosition:a,width:e.width,height:e.height})}return i}interpolateProps(t,e,i){const s={};for(const n of this._propsToExtract)s[n]=o(t[n]||0,e[n]||0,i);if(e.aroundPosition&&this.opts.makeViewport){const n=this.opts.makeViewport({...e,...s});Object.assign(s,n.panByPosition(e.aroundPosition,o(t.around,e.around,i)))}return s}},Ce={transitionDuration:0},Me=t=>1-(1-t)*(1-t),ke=t=>1===t?1:1-Math.pow(2,-10*t),xe=["wheel"],Se=["panstart","panmove","panend"],Ee=["pinchstart","pinchmove","pinchend"],Re=["multipanstart","multipanmove","multipanend"],Le=["dblclick"],De=["dblclickdragstart","dblclickdragmove","dblclickdragend","dblclickdragcancel"],Ie=["keydown"],Te={},Ae=class{constructor(t){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this._multiPanMode=null,this._multiPanStartCenter=null,this._doubleClickDragAnchor=null,this._suppressDoubleClickUntil=0,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.doubleClickDragZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.multiTouchDrag=null,this.trackpadGesture=!1,this.zoomAround="pointer",this.keyboard=!0,this.transitionManager=new fe({...t,getControllerState:(e,i)=>new this.ControllerState({...e,constraintContext:i,makeViewport:t.makeViewport}),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport,this.pickPosition=t.pickPosition}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(const t in this._events)this._events[t]&&this.eventManager?.off(t,this.handleEvent);this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;const e=this._eventStartBlocked;switch(t.type){case"panstart":return!e&&this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return!(e||!this._isTrackpadGestureAllowed(t))&&this._onPinchStart(t);case"pinchmove":return!!this._isTrackpadGestureAllowed(t)&&this._onPinch(t);case"pinchend":return!!this._isTrackpadGestureAllowed(t)&&this._onPinchEnd(t);case"multipanstart":return!e&&this._onMultiPanStart(t);case"multipanmove":return this._onMultiPan(t);case"multipanend":return this._onMultiPanEnd(t);case"dblclick":return this._onDoubleClick(t);case"dblclickdragstart":return!e&&this._onDoubleClickDragStart(t);case"dblclickdragmove":return this._onDoubleClickDrag(t);case"dblclickdragend":case"dblclickdragcancel":return this._onDoubleClickDragEnd(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){const{x:e,y:i}=this.props,{offsetCenter:s}=t;return[s.x-e,s.y-i]}getZoomPosition(t){if("pointer"===this.zoomAround)return t;const e=this.makeViewport(this.controllerState.getViewportProps()),[i,s]=L(e.center,e.pixelProjectionMatrix);return[i,s]}isPointInBounds(t,e){const{width:i,height:s}=this.props;if(e&&e.handled)return!1;const n=t[0]>=0&&t[0]<=i&&t[1]>=0&&t[1]<=s;return n&&e&&e.stopPropagation(),n}isFunctionKeyPressed(t){const{srcEvent:e}=t;return Boolean(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){const e=setTimeout(()=>{this._eventStartBlocked===e&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=e}setProps(t){void 0===t.maxBoundsPadding&&(t.maxBoundsPadding=null),t.dragMode&&(this.dragMode=t.dragMode);const e=this.props;this.props=t,"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);const{inertia:i}=t;this.inertia=Number.isFinite(i)?i:!0===i?300:0;const{scrollZoom:s=!0,dragPan:n=!0,dragRotate:r=!0,doubleClickZoom:o=!0,doubleClickDragZoom:a=!1,touchZoom:h=!0,touchRotate:c=!1,multiTouchDrag:d=(c?"rotate":null),trackpadGesture:l=!1,zoomAround:p="pointer",keyboard:u=!0}=t,g=Boolean(this.onViewStateChange);if(this.toggleEvents(xe,g&&s),this.toggleEvents(Se,g),this.toggleEvents(Ee,g&&(h||"rotate"===d)),this.toggleEvents(Re,g&&Boolean(d)),this.toggleEvents(Le,g&&o),this.toggleEvents(De,g&&a),this.toggleEvents(Ie,g&&u),this.scrollZoom=s,this.dragPan=n,this.dragRotate=r,this.doubleClickZoom=o,this.doubleClickDragZoom=a,this.touchZoom=h,this.touchRotate="rotate"===d,this.multiTouchDrag=d,this.trackpadGesture=l,this.zoomAround=p,this.keyboard=u,(!e||e.height!==t.height||e.width!==t.width||e.maxBounds!==t.maxBounds||e.maxBoundsPadding!==t.maxBoundsPadding)&&t.maxBounds){const e=new this.ControllerState({...t,makeViewport:this.makeViewport}),i=e.getViewportProps();Object.keys(i).some(e=>!j(i[e],t[e],1))&&this.updateViewport(e)}}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,e){this.eventManager&&t.forEach(t=>{this._events[t]!==e&&(this._events[t]=e,e?this.eventManager.on(t,this.handleEvent):this.eventManager.off(t,this.handleEvent))})}updateViewport(t,e=null,i={}){const s={...t.getViewportProps(),...e},n=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(i),n){const t=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:s,interactionState:this._interactionState,oldViewState:t,viewId:this.props.id})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_getConstraintContext(t,e){return this.props.rubberBand?{mode:"update"===e?"elastic":"end"===e?"rebound":"hard"}:{mode:"hard"}}_getReboundTransition(t,e){if("rebound"!==t.mode)return null;const i=e.getViewportProps();return Object.keys(i).some(t=>!j(this.props[t],i[t],1))?{...this._getTransitionProps(),transitionDuration:300,transitionEasing:ke}:null}_onPanStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;let i=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||"pan"===this.dragMode)&&(i=!i);const s=i?"pan":"rotate",n=this._getConstraintContext(s,"start"),r=i?this.controllerState.panStart({pos:e},n):this.controllerState.rotateStart({pos:e},n);return this._panMove=i,this.updateViewport(r,Ce,{isDragging:!0}),!0}_onPan(t){return!!this.isDragging()&&(this._panMove?this._onPanMove(t):this._onPanRotate(t))}_onPanEnd(t){return!!this.isDragging()&&(this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t))}_onPanMove(t){if(!this.dragPan)return!1;const e=this.getCenter(t),i=this.controllerState.pan({pos:e},this._getConstraintContext("pan","update"));return this.updateViewport(i,Ce,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){const{inertia:e}=this;if(this.dragPan&&e&&t.velocity){const i=this.getCenter(t),s=[i[0]+t.velocityX*e/2,i[1]+t.velocityY*e/2],n=this.controllerState.pan({pos:s}).panEnd();this.updateViewport(n,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:Me},{isDragging:!1,isPanning:!0})}else{const t=this.controllerState,e=this._getConstraintContext("pan","end"),i=t.panEnd(e),s=this._getReboundTransition(e,i);this.updateViewport(i,s,{isDragging:!1,isPanning:Boolean(s)})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;const e=this.getCenter(t),i=this.controllerState.rotate({pos:e},this._getConstraintContext("rotate","update"));return this.updateViewport(i,Ce,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){const{inertia:e}=this;if(this.dragRotate&&e&&t.velocity){const i=this.getCenter(t),s=[i[0]+t.velocityX*e/2,i[1]+t.velocityY*e/2],n=this.controllerState.rotate({pos:s}).rotateEnd();this.updateViewport(n,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:Me},{isDragging:!1,isRotating:!0})}else{const t=this.controllerState,e=this._getConstraintContext("rotate","end"),i=t.rotateEnd(e),s=this._getReboundTransition(e,i);this.updateViewport(i,s,{isDragging:!1,isRotating:Boolean(s)})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;if(this.trackpadGesture&&"mouse"!==t.device)return!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;t.srcEvent.preventDefault();const{speed:i=.01,smooth:s=!1}=!0===this.scrollZoom?{}:this.scrollZoom,{delta:n}=t;let r=2/(1+Math.exp(-Math.abs(n*i)));n<0&&0!==r&&(r=1/r);const o=this.getZoomPosition(e),a=s?{...this._getTransitionProps({around:o}),transitionDuration:250}:Ce,h=this.controllerState.zoom({pos:o,scale:r});return this.updateViewport(h,a,{isZooming:!0,isPanning:!0}),s||this._setInteractionState({isZooming:!1,isPanning:!1}),!0}_onMultiPanStart(t){const{multiTouchDrag:e}=this;if(!e||!this._isMultiPanEventAllowed(t,e))return!1;const i=t.offsetCenter;if(!this.isPointInBounds(this.getCenter(t),t))return!1;const s="trackpad"===t.pointerType,n={x:i.x-(s?0:t.deltaX),y:i.y-(s?0:t.deltaY)},r={...t,offsetCenter:n},o=this.getCenter(r),a="pan"===e?this.controllerState.panStart({pos:o},this._getConstraintContext("pan","start")):this.controllerState.rotateStart({pos:o},this._getConstraintContext("rotate","start"));return this._multiPanMode=e,this._multiPanStartCenter=n,this.updateViewport(a,Ce,{isDragging:!0}),!0}_onMultiPan(t){const{mode:e,event:i}=this._getMultiPanEvent(t);return!!(e&&i&&this.isDragging())&&("pan"===e?this._onPanMove(i):this._onPanRotate(i))}_onMultiPanEnd(t){const{mode:e,event:i}=this._getMultiPanEvent(t);if(!e||!i||!this.isDragging())return this._resetMultiPan(),!1;const s="pan"===e?this._onPanMoveEnd(i):this._onPanRotateEnd(i);return this._resetMultiPan(),s}_isTrackpadGestureAllowed(t){return"trackpad"!==t.pointerType||this.trackpadGesture}_isMultiPanEventAllowed(t,e){return"trackpad"===t.pointerType?this.trackpadGesture&&("pan"===e?this.dragPan:this.dragRotate):"touch"===t.pointerType&&("pan"===e?this.dragPan:this.dragRotate)}_getMultiPanEvent(t){const e=this._multiPanMode,i=this._multiPanStartCenter;return e&&i?{mode:e,event:{...t,offsetCenter:{x:i.x+t.deltaX,y:i.y+t.deltaY}}}:{mode:null,event:null}}_resetMultiPan(){this._multiPanMode=null,this._multiPanStartCenter=null}_onPinchStart(t){this._doubleClickDragAnchor=null;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const i=this.controllerState.zoomStart({pos:this.getZoomPosition(e)},this._getConstraintContext("zoom","start")).rotateStart({pos:e},this._getConstraintContext("rotate","start"));return Te._startPinchRotation=t.rotation,Te._lastPinchEvent=t,this.updateViewport(i,Ce,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate)return!1;if(!this.isDragging())return!1;let e=this.controllerState;if(this.touchZoom){const{scale:i}=t,s=this.getCenter(t);e=e.zoom({pos:this.getZoomPosition(s),scale:i},this._getConstraintContext("zoom","update"))}if(this.touchRotate){const{rotation:i}=t;e=e.rotate({deltaAngleX:Te._startPinchRotation-i},this._getConstraintContext("rotate","update"))}return this.updateViewport(e,Ce,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),Te._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;const{inertia:e}=this,{_lastPinchEvent:i}=Te;if(this.touchZoom&&e&&i&&t.scale!==i.scale){const s=this.getCenter(t),n=this.getZoomPosition(s);let r=this.controllerState.rotateEnd();const o=Math.log2(t.scale),a=(o-Math.log2(i.scale))/(t.deltaTime-i.deltaTime),h=Math.pow(2,o+a*e/2);r=r.zoom({pos:n,scale:h}).zoomEnd(),this.updateViewport(r,{...this._getTransitionProps({around:n}),transitionDuration:e,transitionEasing:Me},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(e)}else{const t=this.controllerState,e=this._getConstraintContext("zoom","end"),i=this._getConstraintContext("rotate","end"),s=t.zoomEnd(e).rotateEnd(i),n=this._getReboundTransition(this.touchZoom?e:i,s);this.updateViewport(s,n,{isDragging:!1,isPanning:Boolean(n)&&this.touchZoom,isZooming:Boolean(n)&&this.touchZoom,isRotating:Boolean(n)&&this.touchRotate})}return Te._startPinchRotation=null,Te._lastPinchEvent=null,!0}_onDoubleClick(t){if(!this.doubleClickZoom)return!1;if(Date.now()<this._suppressDoubleClickUntil)return!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const i=this.isFunctionKeyPressed(t),s=this.getZoomPosition(e),n=this.controllerState.zoom({pos:s,scale:i?.5:2});return this.updateViewport(n,this._getTransitionProps({around:s}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onDoubleClickDragStart(t){if(!this.doubleClickDragZoom)return this._doubleClickDragAnchor=null,!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return this._doubleClickDragAnchor=null,!1;this._doubleClickDragAnchor=this.getZoomPosition(e);let i=this.controllerState.zoomStart({pos:this._doubleClickDragAnchor},this._getConstraintContext("zoom","start"));return 1!==t.scale&&(i=i.zoom({pos:this._doubleClickDragAnchor,scale:t.scale},this._getConstraintContext("zoom","update"))),this.updateViewport(i,Ce,{isDragging:!0,isPanning:!0,isZooming:!0}),!0}_onDoubleClickDrag(t){const e=this._doubleClickDragAnchor;if(!e)return!1;const i=this.controllerState.zoom({pos:e,scale:t.scale},this._getConstraintContext("zoom","update"));return this.updateViewport(i,Ce,{isDragging:!0,isPanning:!0,isZooming:!0}),!0}_onDoubleClickDragEnd(t){if(!this._doubleClickDragAnchor)return!1;this._doubleClickDragAnchor=null;const e=this.controllerState,i=this._getConstraintContext("zoom","end"),s=e.zoomEnd(i),n=this._getReboundTransition(i,s);return this.updateViewport(s,n,{isDragging:!1,isPanning:Boolean(n),isZooming:Boolean(n)}),this._suppressDoubleClickUntil=Date.now()+100,this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;const e=this.isFunctionKeyPressed(t),{zoomSpeed:i,moveSpeed:s,rotateSpeedX:n,rotateSpeedY:r}=!0===this.keyboard?{}:this.keyboard,{controllerState:o}=this;let a;const h={};switch(t.srcEvent.code){case"Minus":a=e?o.zoomOut(i).zoomOut(i):o.zoomOut(i),h.isZooming=!0;break;case"Equal":a=e?o.zoomIn(i).zoomIn(i):o.zoomIn(i),h.isZooming=!0;break;case"ArrowLeft":e?(a=o.rotateLeft(n),h.isRotating=!0):(a=o.moveLeft(s),h.isPanning=!0);break;case"ArrowRight":e?(a=o.rotateRight(n),h.isRotating=!0):(a=o.moveRight(s),h.isPanning=!0);break;case"ArrowUp":e?(a=o.rotateUp(r),h.isRotating=!0):(a=o.moveUp(s),h.isPanning=!0);break;case"ArrowDown":e?(a=o.rotateDown(r),h.isRotating=!0):(a=o.moveDown(s),h.isPanning=!0);break;default:return!1}return this.updateViewport(a,this._getTransitionProps(),h),!0}_getTransitionProps(t){const{transition:e}=this;return e&&e.transitionInterpolator?t?{...e,transitionInterpolator:new be({...t,...e.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:e:Ce}},Ve=Symbol("constraintAround"),ze=class{constructor(t,e,i,s){this.makeViewport=i,this._viewportProps=this.applyConstraints(t,s),this._state=e}getViewportProps(){return this._viewportProps}getState(){return this._state}};function Fe(t,e,i){const s=t-e;return s&&Number.isFinite(s)?e+s*i/(i+Math.abs(s)):e}function Oe(t,e,i){const s=ne(ie(i?.left??0),t),n=ne(ie(i?.right??0),t),r=ne(ie(i?.top??0),e);return{x:s,y:r,width:t-s-n,height:e-r-ne(ie(i?.bottom??0),e)}}function je(t,e,i){let[s,n]=t.project(e);return s=Number.isFinite(s)?s:t.width/2,n=Number.isFinite(n)?n:t.height/2,{left:s-i.x,right:i.x+i.width-s,top:n-i.y,bottom:i.y+i.height-n}}var Be=[[-1/0,-90],[1/0,90]];function Ne([t,e]){if(Math.abs(e)>90&&(e=90*Math.sign(e)),Number.isFinite(t)){const[s,r]=n([t,e]);return[s,i(r,0,512)]}const[,s]=n([0,e]);return[t,i(s,0,512)]}var Ue=class extends ze{constructor(t){const{width:e,height:i,latitude:s,longitude:n,zoom:r,bearing:o=0,pitch:a=0,altitude:h=1.5,position:c=[0,0,0],maxZoom:d=20,minZoom:l=0,maxPitch:p=60,minPitch:u=0,startPanLngLat:g,startZoomLngLat:v,startRotatePos:m,startRotateLngLat:w,startBearing:f,startPitch:_,startZoom:y,normalize:b=!0,rubberBand:C=!1}=t,{[Ve]:M}=t;P(Number.isFinite(n)),P(Number.isFinite(s)),P(Number.isFinite(r));super({width:e,height:i,latitude:s,longitude:n,zoom:r,bearing:o,pitch:a,altitude:h,maxZoom:d,minZoom:l,maxPitch:p,minPitch:u,normalize:b,position:c,maxBounds:t.maxBounds||(b?Be:null),maxBoundsPadding:t.maxBoundsPadding||null,rubberBand:C,[Ve]:M},{startPanLngLat:g,startZoomLngLat:v,startRotatePos:m,startRotateLngLat:w,startBearing:f,startPitch:_,startZoom:y},t.makeViewport,t.constraintContext),this.getAltitude=t.getAltitude}panStart({pos:t},e){return this._getUpdatedState({startPanLngLat:this._unproject(t)},e)}pan({pos:t,startPos:e},i){const s=this.getState().startPanLngLat||this._unproject(e);if(!s)return this;const n=this.makeViewport(this.getViewportProps()).panByPosition(s,t);return this._getUpdatedState(n,i)}panEnd(t){return this._getUpdatedState({startPanLngLat:null},t)}rotateStart({pos:t}){const e=this.getAltitude?.(t);return this._getUpdatedState({startRotatePos:t,startRotateLngLat:void 0!==e?this._unproject3D(t,e):void 0,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:e=0,deltaAngleY:i=0}){const{startRotatePos:s,startRotateLngLat:n,startBearing:r,startPitch:o}=this.getState();if(!s||void 0===r||void 0===o)return this;let a;if(a=t?this._getNewRotation(t,s,o,r):{bearing:r+e,pitch:o+i},n){const t=this.makeViewport({...this.getViewportProps(),...a}),e="panByPosition3D"in t?"panByPosition3D":"panByPosition";return this._getUpdatedState({...a,...t[e](n,s)})}return this._getUpdatedState(a)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startRotateLngLat:null,startBearing:null,startPitch:null})}zoomStart({pos:t},e){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom},e)}zoom({pos:t,startPos:e,scale:i},s){let{startZoom:n,startZoomLngLat:r}=this.getState();return r||(n=this.getViewportProps().zoom,r=this._unproject(e)||this._unproject(t)),r?this._getUpdatedState({zoom:n+Math.log2(i),[Ve]:{position:r,screenPosition:t}},s):this}zoomEnd(t){return this._getUpdatedState({startZoomLngLat:null,startZoom:null},t)}zoomIn(t=2,e){return this._zoomFromCenter(t,e)}zoomOut(t=2,e){return this._zoomFromCenter(1/t,e)}moveLeft(t=100,e){return this._panFromCenter([t,0],e)}moveRight(t=100,e){return this._panFromCenter([-t,0],e)}moveUp(t=100,e){return this._panFromCenter([0,t],e)}moveDown(t=100,e){return this._panFromCenter([0,-t],e)}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){const e=t.getViewportProps(),i={...this.getViewportProps()},{bearing:s,longitude:n}=i;return Math.abs(s-e.bearing)>180&&(i.bearing=s<0?s+360:s-360),Math.abs(n-e.longitude)>180&&(i.longitude=n<0?n+360:n-360),i}applyConstraints(t,s){const n=t,r=n[Ve];delete n[Ve];const{maxPitch:o,minPitch:a,pitch:h,bearing:c,normalize:d,maxBounds:l,rubberBand:p}=t;d&&(c<-180||c>180)&&(t.bearing=M(c+180,360)-180),t.pitch=i(h,a,o);const u=this._constrainZoom(t.zoom,t),g=p&&"elastic"===s?.mode;if(t.zoom="preserve"===s?.mode?t.zoom:g?Fe(t.zoom,u,1):u,r){const e=this.makeViewport(t);Object.assign(t,e.panByPosition(r.position,r.screenPosition))}if(d&&(t.longitude<-180||t.longitude>180)&&(t.longitude=M(t.longitude+180,360)-180),l){const n=Oe(t.width,t.height,t.maxBoundsPadding),r=je(this.makeViewport({...t,bearing:0,pitch:0}),[t.longitude,t.latitude],n),o=Ne(l[0]),a=Ne(l[1]),h=2**t.zoom,c=[o[0]+r.left/h,o[1]+r.bottom/h],d=[a[0]-r.right/h,a[1]-r.top/h],p=Ne([t.longitude,t.latitude]),u=[i(p[0],c[0],d[0]),i(p[1],c[1],d[1])],v=p.slice();if(n.width>=0&&(v[0]="preserve"===s?.mode?p[0]:g?Fe(p[0],u[0],n.width/2/h):u[0]),n.height>=0&&(v[1]="preserve"===s?.mode?p[1]:g?Fe(p[1],u[1],n.height/2/h):u[1]),v[0]!==p[0]||v[1]!==p[1]){const[i,s]=e(v);v[0]!==p[0]&&(t.longitude=i),v[1]!==p[1]&&(t.latitude=s)}}return t}_constrainZoom(t,e){e||(e=this.getViewportProps());const{maxZoom:s,maxBounds:n}=e,r=null!==n&&e.width>0&&e.height>0;let{minZoom:o}=e;if(r){const t=Oe(e.width,e.height,e.maxBoundsPadding),i=Ne(n[0]),r=Ne(n[1]),a=r[0]-i[0],h=r[1]-i[1];t.width>0&&Number.isFinite(a)&&a>0&&(o=Math.max(o,Math.log2(t.width/a))),t.height>0&&Number.isFinite(h)&&h>0&&(o=Math.max(o,Math.log2(t.height/h))),o>s&&(o=s)}return i(t,o,s)}_zoomFromCenter(t,e){const{width:i,height:s}=this.getViewportProps();return this.zoom({pos:[i/2,s/2],scale:t},e)}_panFromCenter(t,e){const{width:i,height:s}=this.getViewportProps();return this.pan({startPos:[i/2,s/2],pos:[i/2+t[0],s/2+t[1]]},e)}_getUpdatedState(t,e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t,constraintContext:e})}_unproject(t){const e=this.makeViewport(this.getViewportProps());return t&&e.unproject(t)}_unproject3D(t,e){return this.makeViewport(this.getViewportProps()).unproject(t,{targetZ:e})}_getNewRotation(t,e,s,n){const r=t[0]-e[0],o=t[1]-e[1],a=t[1],h=e[1],{width:c,height:d}=this.getViewportProps(),l=r/c;let p=0;o>0?Math.abs(d-h)>5&&(p=o/(h-d)*1.2):o<0&&h>5&&(p=1-a/h),p=i(p,-1,1);const{minPitch:u,maxPitch:g}=this.getViewportProps();let v=s;return p>0?v=s+p*(g-s):p<0&&(v=s-p*(u-s)),{pitch:v,bearing:n+180*l}}},Ge=class extends Ae{constructor(){super(...arguments),this.ControllerState=Ue,this.transition={transitionDuration:300,transitionInterpolator:new be({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan",this.rotationPivot="center",this._getAltitude=t=>{if("2d"===this.rotationPivot)return 0;if("3d"===this.rotationPivot&&this.pickPosition){const{x:e,y:i}=this.props,s=this.pickPosition(e+t[0],i+t[1]);if(s&&s.coordinate&&s.coordinate.length>=3)return s.coordinate[2]}}}setProps(t){"rotationPivot"in t&&(this.rotationPivot=t.rotationPivot||"center"),t.getAltitude=this._getAltitude,t.position=t.position||[0,0,0],t.maxBounds=t.maxBounds||(!1===t.normalize?null:Be),super.setProps(t)}updateViewport(t,e=null,i={}){const s=t.getState();i.isDragging&&s.startRotateLngLat?i={...i,rotationPivotPosition:s.startRotateLngLat}:!1===i.isDragging&&(i={...i,rotationPivotPosition:void 0}),super.updateViewport(t,e,i)}},We=class extends de{constructor(t={}){super(t)}getViewportType(){return y}get ControllerType(){return Ge}};We.displayName="MapView";var Ze=new jt;var He=class{constructor(t){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=t,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(t){const e=this._defaultEffects;if(!e.find(e=>e.id===t.id)){const i=e.findIndex(e=>{return i=t,(e.order??1/0)-(i.order??1/0)>0;var i});i<0?e.push(t):e.splice(i,0,t),t.setup(this._context),this._setEffects(this.effects)}}setProps(t){"effects"in t&&(j(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(t={clearRedrawFlags:!1}){const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}getEffects(){return this._resolvedEffects}_setEffects(t){const e={};for(const s of this.effects)e[s.id]=s;const i=[];for(const s of t){const t=e[s.id];let n=s;t&&t!==s?t.setProps?(t.setProps(s.props),n=t):t.cleanup(this._context):t||s.setup(this._context),i.push(n),delete e[s.id]}for(const s in e)e[s].cleanup(this._context);this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),t.some(t=>t instanceof jt)||this._resolvedEffects.push(Ze),this._needsRedraw="effects changed"}finalize(){for(const t of this._resolvedEffects)t.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}},qe=class extends It{shouldDrawLayer(t){const{operation:e}=t.props;return e.includes("draw")||e.includes("terrain")}render(t){return this._render(t)}},$e=class{constructor(t,e={}){this.device=t,this.stats=e.stats,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new qe(t),this.pickLayersPass=new qt(t),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(t){const e=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t};if(!t.viewports.length){const t=e.render(i),s="stats"in t?t.stats:t;return void this._updateStats(s)}i.effects&&this._preRender(i.effects,i);const s=this.lastPostProcessEffect?this.renderBuffers[0]:i.target;this.lastPostProcessEffect&&(i.clearColor=[0,0,0,0],i.clearCanvas=!0);const n=e.render({...i,target:s}),r="stats"in n?n.stats:n;i.effects&&(this.lastPostProcessEffect&&(i.clearCanvas=void 0===t.clearCanvas||t.clearCanvas),this._postRender(i.effects,i)),this.renderCount++,B("deckRenderer.renderLayers",this,r,t),this._updateStats(r)}needsRedraw(t={clearRedrawFlags:!1}){const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}finalize(){const{renderBuffers:t}=this;for(const e of t)e.delete();t.length=0}_updateStats(t){if(!this.stats)return;let e=0;for(const{visibleCount:i}of t)e+=i;this.stats.get("Layers rendered").addCount(e)}_preRender(t,e){this.lastPostProcessEffect=null,e.preRenderStats=e.preRenderStats||{};for(const i of t)e.preRenderStats[i.id]=i.preRender(e),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers(e.canvasContext)}_resizeRenderBuffers(t=this.device.canvasContext){const{renderBuffers:e}=this,i=t.getDrawingBufferSize(),[s,n]=i;0===e.length&&[0,1].map(t=>{const i=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:s,height:n});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${t}`,colorAttachments:[i]}))});for(const r of e)r.resize(i)}_postRender(t,e){const{renderBuffers:i}=this,s=e.target??e.canvasContext?.getCurrentFramebuffer()??e.target,n={...e,inputBuffer:i[0],swapBuffer:i[1]};for(const r of t)if(r.postRender){n.target=r.id===this.lastPostProcessEffect?s:void 0;const t=r.postRender(n);n.inputBuffer=t,n.swapBuffer=t===i[0]?i[1]:i[0]}}},Xe={pickedColor:null,pickedObjectIndex:-1};function Ye({pickedColors:t,decodePickingColor:e,deviceX:i,deviceY:s,deviceRadius:n,deviceRect:r}){const{x:o,y:a,width:h,height:c}=r;let d=n*n,l=-1,p=0;for(let u=0;u<c;u++){const e=u+a-s,n=e*e;if(n>d)p+=4*h;else for(let s=0;s<h;s++){if(t[p+3]-1>=0){const t=s+o-i,e=t*t+n;e<=d&&(d=e,l=p)}p+=4}}if(l>=0){const i=t.slice(l,l+4),s=e(i);if(s){const t=Math.floor(l/4/h),e=l/4-t*h;return{...s,pickedColor:i,pickedX:o+e,pickedY:a+t}}O.error("Picked non-existent layer. Is picking buffer corrupt?")()}return Xe}function Ke({pickedColors:t,decodePickingColor:e}){const i=/* @__PURE__ */new Map;if(t)for(let s=0;s<t.length;s+=4)if(t[s+3]-1>=0){const n=t.slice(s,s+4),r=n.join(",");if(!i.has(r)){const t=e(n);t?i.set(r,{...t,color:n}):O.error("Picked non-existent layer. Is picking buffer corrupt?")()}}return Array.from(i.values())}function Je({pickInfo:t,viewports:e,pixelRatio:i,x:s,y:n,z:r}){let o,a=e[0];if(e.length>1&&(a=function(t,e){for(let i=t.length-1;i>=0;i--){const s=t[i];if(s.containsPixel(e))return s}return t[0]}(t?.pickedViewports||e,{x:s,y:n})),a){const t=[s-a.x,n-a.y];void 0!==r&&(t[2]=r),o=a.unproject(t)}return{color:null,layer:null,viewport:a,index:-1,picked:!1,x:s,y:n,pixel:[s,n],coordinate:o,devicePixel:t&&"pickedX"in t?[t.pickedX,t.pickedY]:void 0,pixelRatio:i}}function Qe(t){const{pickInfo:e,lastPickedInfo:i,mode:s,layers:n}=t,{pickedColor:r,pickedLayer:o,pickedObjectIndex:a}=e,h=o?[o]:[];if("hover"===s){const t=i.index,e=i.layerId,s=o?o.props.id:null;if(s!==e||a!==t){if(s!==e){const t=n.find(t=>t.props.id===e);t&&h.unshift(t)}i.layerId=s,i.index=a,i.info=null}}const c=Je(t),d=/* @__PURE__ */new Map;return d.set(null,c),h.forEach(t=>{let e={...c};t===o&&(e.color=r,e.index=a,e.picked=!0),e=ti({layer:t,info:e,mode:s});const n=e.layer;t===o&&"hover"===s&&(i.info=e),d.set(n.id,e),"hover"===s&&n.updateAutoHighlight(e)}),d}function ti({layer:t,info:e,mode:i}){for(;t&&e;){const s=e.layer||null;e.sourceLayer=s,e.layer=t,e=t.getPickingInfo({info:e,mode:i,sourceLayer:s}),t=t.parent}return e}var ei=class{constructor(t,e={}){this._pickable=!0,this.device=t,this.stats=e.stats,this.pickLayersPass=new qt(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){"layerFilter"in t&&(this.layerFilter=t.layerFilter),"_pickable"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObjectAsync(t){return this._pickClosestObjectAsync(t)}pickObjectsAsync(t){return this._pickVisibleObjectsAsync(t)}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:e,layers:i,viewports:s},n=this.lastPickedInfo.info){const r=n&&n.layer&&n.layer.id,o=n&&n.viewport&&n.viewport.id,a=r?i.find(t=>t.id===r):null,h=o&&s.find(t=>t.id===o)||s[0],c={x:t,y:e,viewport:h,coordinate:h&&h.unproject([t-h.x,e-h.y]),layer:a};return{...n,...c}}_resizeBuffer(t=this.device.getDefaultCanvasContext()){if(!this.pickingFBO){const t=this.device.createTexture({format:"rgba8unorm",width:1,height:1,usage:w.RENDER_ATTACHMENT|w.COPY_SRC});if(this.pickingFBO=this.device.createFramebuffer({colorAttachments:[t],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float")){const t=this.device.createTexture({format:"rgba32float",width:1,height:1,usage:w.RENDER_ATTACHMENT|w.COPY_SRC}),e=this.device.createFramebuffer({colorAttachments:[t],depthStencilAttachment:"depth16unorm"});this.depthFBO=e}}const[e,i]=t.getDrawingBufferSize();this.pickingFBO?.resize({width:e,height:i}),this.depthFBO?.resize({width:e,height:i})}_getPickable(t){if(!1===this._pickable)return null;const e=t.filter(t=>this.pickLayersPass.shouldDrawLayer(t)&&!t.isComposite);return e.length?e:null}async _pickClosestObjectAsync({layers:t,views:e,viewports:i,x:s,y:n,radius:r=0,depth:o=1,mode:a="query",unproject3D:h,canvasContext:c=this.device.getDefaultCanvasContext(),onViewportActive:d,effects:l}){const p=c.cssToDeviceRatio(),u=this._getPickable(t);if(!u||0===i.length)return{result:[],emptyInfo:Je({viewports:i,x:s,y:n,pixelRatio:p})};this._resizeBuffer(c);const g=c.cssToDevicePixels([s,n],!0),v=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],m=Math.round(r*p),{width:w,height:f}=this.pickingFBO,_=this._getPickingRect({deviceX:v[0],deviceY:v[1],deviceRadius:m,deviceWidth:w,deviceHeight:f}),y={x:s-r,y:n-r,width:2*r+1,height:2*r+1};let P;const b=[],C=/* @__PURE__ */new Set;for(let M=0;M<o;M++){let t,r;if(_){t=Ye({...await this._drawAndSampleAsync({layers:u,views:e,viewports:i,onViewportActive:d,deviceRect:_,cullRect:y,effects:l,pass:`picking:${a}`,canvasContext:c}),deviceX:v[0],deviceY:v[1],deviceRadius:m,deviceRect:_})}else t={pickedColor:null,pickedObjectIndex:-1};const g=this._getDepthLayers(t,u,h);if(g.length>0){const{pickedColors:s}=await this._drawAndSampleAsync({layers:g,views:e,viewports:i,onViewportActive:d,deviceRect:{x:t.pickedX??v[0],y:t.pickedY??v[1],width:1,height:1},cullRect:y,effects:l,pass:`picking:${a}:z`,canvasContext:c},!0);s[3]&&(r=s[0])}t.pickedLayer&&M+1<o&&(C.add(t.pickedLayer),t.pickedLayer.disablePickingIndex(t.pickedObjectIndex)),P=Qe({pickInfo:t,lastPickedInfo:this.lastPickedInfo,mode:a,layers:u,viewports:i,x:s,y:n,z:r,pixelRatio:p});for(const e of P.values())e.layer&&b.push(e);if(!t.pickedColor)break}for(const M of C)M.restorePickingColors();return{result:b,emptyInfo:P.get(null)}}_pickClosestObject({layers:t,views:e,viewports:i,x:s,y:n,radius:r=0,depth:o=1,mode:a="query",unproject3D:h,canvasContext:c=this.device.getDefaultCanvasContext(),onViewportActive:d,effects:l}){const p=c.cssToDeviceRatio(),u=this._getPickable(t);if(!u||0===i.length)return{result:[],emptyInfo:Je({viewports:i,x:s,y:n,pixelRatio:p})};this._resizeBuffer(c);const g=c.cssToDevicePixels([s,n],!0),v=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],m=Math.round(r*p),{width:w,height:f}=this.pickingFBO,_=this._getPickingRect({deviceX:v[0],deviceY:v[1],deviceRadius:m,deviceWidth:w,deviceHeight:f}),y={x:s-r,y:n-r,width:2*r+1,height:2*r+1};let P;const b=[],C=/* @__PURE__ */new Set;for(let M=0;M<o;M++){let t,r;if(_){t=Ye({...this._drawAndSample({layers:u,views:e,viewports:i,onViewportActive:d,deviceRect:_,cullRect:y,effects:l,pass:`picking:${a}`,canvasContext:c}),deviceX:v[0],deviceY:v[1],deviceRadius:m,deviceRect:_})}else t={pickedColor:null,pickedObjectIndex:-1};const g=this._getDepthLayers(t,u,h);if(g.length>0){const{pickedColors:s}=this._drawAndSample({layers:g,views:e,viewports:i,onViewportActive:d,deviceRect:{x:t.pickedX??v[0],y:t.pickedY??v[1],width:1,height:1},cullRect:y,effects:l,pass:`picking:${a}:z`,canvasContext:c},!0);s[3]&&(r=s[0])}t.pickedLayer&&M+1<o&&(C.add(t.pickedLayer),t.pickedLayer.disablePickingIndex(t.pickedObjectIndex)),P=Qe({pickInfo:t,lastPickedInfo:this.lastPickedInfo,mode:a,layers:u,viewports:i,x:s,y:n,z:r,pixelRatio:p});for(const e of P.values())e.layer&&b.push(e);if(!t.pickedColor)break}for(const M of C)M.restorePickingColors();return{result:b,emptyInfo:P.get(null)}}async _pickVisibleObjectsAsync({layers:t,views:e,viewports:i,x:s,y:n,width:r=1,height:o=1,mode:a="query",maxObjects:h=null,canvasContext:c=this.device.getDefaultCanvasContext(),onViewportActive:d,effects:l}){const p=this._getPickable(t);if(!p||0===i.length)return[];this._resizeBuffer(c);const u=c.cssToDeviceRatio(),g=c.cssToDevicePixels([s,n],!0),v=g.x,m=g.y+g.height,w=c.cssToDevicePixels([s+r,n+o],!0),f=w.x+w.width,_=w.y,y={x:v,y:_,width:f-v,height:m-_},P=Ke(await this._drawAndSampleAsync({layers:p,views:e,viewports:i,onViewportActive:d,deviceRect:y,cullRect:{x:s,y:n,width:r,height:o},effects:l,pass:`picking:${a}`,canvasContext:c})),b=/* @__PURE__ */new Map,C=[],M=Number.isFinite(h);for(let k=0;k<P.length&&!(M&&C.length>=h);k++){const t=P[k];let e={color:t.pickedColor,layer:null,index:t.pickedObjectIndex,picked:!0,x:s,y:n,pixelRatio:u};e=ti({layer:t.pickedLayer,info:e,mode:a});const i=e.layer.id;b.has(i)||b.set(i,/* @__PURE__ */new Set);const r=b.get(i),o=e.object??e.index;r.has(o)||(r.add(o),C.push(e))}return C}_pickVisibleObjects({layers:t,views:e,viewports:i,x:s,y:n,width:r=1,height:o=1,mode:a="query",maxObjects:h=null,canvasContext:c=this.device.getDefaultCanvasContext(),onViewportActive:d,effects:l}){const p=this._getPickable(t);if(!p||0===i.length)return[];this._resizeBuffer(c);const u=c.cssToDeviceRatio(),g=c.cssToDevicePixels([s,n],!0),v=g.x,m=g.y+g.height,w=c.cssToDevicePixels([s+r,n+o],!0),f=w.x+w.width,_=w.y,y={x:v,y:_,width:f-v,height:m-_},P=Ke(this._drawAndSample({layers:p,views:e,viewports:i,onViewportActive:d,deviceRect:y,cullRect:{x:s,y:n,width:r,height:o},effects:l,pass:`picking:${a}`,canvasContext:c})),b=/* @__PURE__ */new Map,C=[],M=Number.isFinite(h);for(let k=0;k<P.length&&!(M&&C.length>=h);k++){const t=P[k];let e={color:t.pickedColor,layer:null,index:t.pickedObjectIndex,picked:!0,x:s,y:n,pixelRatio:u};e=ti({layer:t.pickedLayer,info:e,mode:a});const i=e.layer.id;b.has(i)||b.set(i,/* @__PURE__ */new Set);const r=b.get(i),o=e.object??e.index;r.has(o)||(r.add(o),C.push(e))}return C}async _drawAndSampleAsync({layers:t,views:e,viewports:i,onViewportActive:s,deviceRect:n,cullRect:r,effects:o,pass:a,canvasContext:h},c=!1){const d=c?this.depthFBO:this.pickingFBO,l={layers:t,layerFilter:this.layerFilter,views:e,viewports:i,onViewportActive:s,pickingFBO:d,deviceRect:n,cullRect:r,effects:o,pass:a,canvasContext:h,pickZ:c,preRenderStats:{},isPicking:!0};for(const y of o)y.useInPicking&&(l.preRenderStats[y.id]=y.preRender(l));const{decodePickingColor:p,stats:u}=this.pickLayersPass.render(l);this._updateStats(u);const{x:g,y:v,width:m,height:w}=n,f=d.colorAttachments[0]?.texture;if(!f)throw new Error("Picking framebuffer color attachment is missing");const _=await this._readTextureDataAsync(f,{x:g,y:v,width:m,height:w},c?Float32Array:Uint8Array);if(!c){let t=!1;for(let e=3;e<_.length;e+=4)if(0!==_[e]){t=!0;break}!t&&_.length>0&&O.warn("Async pick readback returned only zero alpha values",{deviceRect:n,bytes:Array.from(_.subarray(0,Math.min(_.length,16)))})()}return{pickedColors:_,decodePickingColor:p}}async _readTextureDataAsync(t,e,i){const{width:s,height:n}=e,r=t.computeMemoryLayout(e),o=this.device.createBuffer({byteLength:r.byteLength,usage:q.COPY_DST|q.MAP_READ});try{t.readBuffer(e,o);const a=await o.readAsync(0,r.byteLength),h=i.BYTES_PER_ELEMENT;if(r.bytesPerRow%h!==0)throw new Error(`Texture readback row stride ${r.bytesPerRow} is not aligned to ${h}-byte elements.`);const c=new i(a.buffer,a.byteOffset,r.byteLength/h),d=4*s,l=r.bytesPerRow/h;if(l<d)throw new Error(`Texture readback row stride ${l} is smaller than packed row length ${d}.`);const p=new i(s*n*4);for(let t=0;t<n;t++){const e=t*l;p.set(c.subarray(e,e+d),t*d)}return p}finally{o.destroy()}}_drawAndSample({layers:t,views:e,viewports:i,onViewportActive:s,deviceRect:n,cullRect:r,effects:o,pass:a,canvasContext:h},c=!1){const d=c?this.depthFBO:this.pickingFBO,l={layers:t,layerFilter:this.layerFilter,views:e,viewports:i,onViewportActive:s,pickingFBO:d,deviceRect:n,cullRect:r,effects:o,pass:a,canvasContext:h,pickZ:c,preRenderStats:{},isPicking:!0};for(const _ of o)_.useInPicking&&(l.preRenderStats[_.id]=_.preRender(l));const{decodePickingColor:p,stats:u}=this.pickLayersPass.render(l);this._updateStats(u);const{x:g,y:v,width:m,height:w}=n,f=new(c?Float32Array:Uint8Array)(m*w*4);return this.device.readPixelsToArrayWebGL(d,{sourceX:g,sourceY:v,sourceWidth:m,sourceHeight:w,target:f}),{pickedColors:f,decodePickingColor:p}}_updateStats(t){if(!this.stats)return;let e=0;for(const{visibleCount:i}of t)e+=i;this.stats.get("Layers picked").addCount(e)}_getDepthLayers(t,e,i){if(!i||!this.depthFBO)return[];const{pickedLayer:s}=t;return s&&!("drape"===s?.state?.terrainDrawMode)?[s]:e.filter(t=>t.props.operation.includes("terrain"))}_getPickingRect({deviceX:t,deviceY:e,deviceRadius:i,deviceWidth:s,deviceHeight:n}){const r=Math.max(0,t-i),o=Math.max(0,e-i),a=Math.min(s,t+i+1)-r,h=Math.min(n,e+i+1)-o;return a<=0||h<=0?null:{x:r,y:o,width:a,height:h}}},ii={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},si="top-left",ni="root",ri=class{constructor({deck:t,parentElement:e}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=t,e?.classList.add("deck-widget-container"),this.parentElement=e}getWidgets(){return this.resolvedWidgets}setProps(t){if(t.widgets&&!j(t.widgets,this.widgets,1)){const e=t.widgets.filter(Boolean);this._setWidgets(e)}}finalize(){for(const t of this.getWidgets())this._removeWidget(t);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(const t in this.containers)this.containers[t].remove()}addDefault(t){this.defaultWidgets.find(e=>e.id===t.id)||(this._addWidget(t),this.defaultWidgets.push(t),this._setWidgets(this.widgets))}onRedraw({viewports:t,layers:e}){const i=t.reduce((t,e)=>(t[e.id]=e,t),{});for(const s of this.getWidgets()){const{viewId:n}=s;if(n){const t=i[n];t&&(s.onViewportChange&&s.onViewportChange(t),s.onRedraw?.({viewports:[t],layers:e}))}else{if(s.onViewportChange)for(const e of t)s.onViewportChange(e);s.onRedraw?.({viewports:t,layers:e})}}this.lastViewports=i,this._updateContainers()}onHover(t,e){for(const i of this.getWidgets()){const{viewId:s}=i;s&&s!==t.viewport?.id||i.onHover?.(t,e)}}getCanvasBounds(t){const e=(this.deck?.getCanvas?.())?.getBoundingClientRect(),i=this.parentElement?.getBoundingClientRect(),s=this.deck?.getCanvasContext?.(t?.id);if(s&&i){s.updatePosition();const[t,e]=s.getPosition(),[n,r]=s.getCSSSize();return{x:t-i.left,y:e-i.top,width:n,height:r}}return{x:e&&i?e.left-i.left:0,y:e&&i?e.top-i.top:0,width:e?.width||this.deck?.width||0,height:e?.height||this.deck?.height||0}}onEvent(t,e){const i=c[e.type];if(i)for(const s of this.getWidgets()){const{viewId:n}=s;n&&n!==t.viewport?.id||s[i]?.(t,e)}}_setWidgets(t){const e={};for(const i of this.resolvedWidgets)e[i.id]=i;this.resolvedWidgets.length=0;for(const i of this.defaultWidgets)e[i.id]=null,this.resolvedWidgets.push(i);for(let i of t){const t=e[i.id];t?t.viewId!==i.viewId||t.placement!==i.placement?(this._removeWidget(t),this._addWidget(i)):i!==t&&(t.setProps(i.props),i=t):this._addWidget(i),e[i.id]=null,this.resolvedWidgets.push(i)}for(const i in e){const t=e[i];t&&this._removeWidget(t)}this.widgets=t}_addWidget(t){const{viewId:e=null,placement:i=si}=t,s=t.props._container??e;t.widgetManager=this,t.deck=this.deck,t.rootElement=t._onAdd({deck:this.deck,viewId:e}),t.rootElement&&this._getContainer(s,i).append(t.rootElement),t.updateHTML()}_removeWidget(t){t.onRemove?.(),t.rootElement&&t.rootElement.remove(),t.rootElement=void 0,t.deck=void 0,t.widgetManager=void 0}_getContainer(t,e){if(t&&"string"!=typeof t)return t;const i=t||ni;let s=this.containers[i];s||(s=document.createElement("div"),s.style.pointerEvents="none",s.style.position="absolute",s.style.overflow="hidden",this.parentElement?.append(s),this.containers[i]=s);let n=s.querySelector(`.${e}`);return n||(n=globalThis.document.createElement("div"),n.className=e,n.style.position="absolute",n.style.zIndex="2",Object.assign(n.style,ii[e]),s.append(n)),n}_updateContainers(){for(const t in this.containers){const e=this.lastViewports[t]||null,i=t===ni||e,s=this.containers[t];if(i){const t=this._getContainerBounds(e);s.style.display="block",s.style.left=`${t.x}px`,s.style.top=`${t.y}px`,s.style.width=`${t.width}px`,s.style.height=`${t.height}px`}else s.style.display="none"}}_getContainerBounds(t){if(!t)return{x:0,y:0,width:this.parentElement?.clientWidth||this.deck.width,height:this.parentElement?.clientHeight||this.deck.height};const e=this.getCanvasBounds(t);return{x:e.x+t.x,y:e.y+t.y,width:t.width,height:t.height}}};function oi(t,e){e&&Object.entries(e).map(([e,i])=>{e.startsWith("--")?t.style.setProperty(e,i):t.style[e]=i})}var ai=class{constructor(t){this.viewId=null,this.props={...this.constructor.defaultProps,...t},this.id=this.props.id}setProps(t){const e=this.props,i=this.rootElement;var s,n;i&&e.className!==t.className&&(e.className&&i.classList.remove(e.className),t.className&&i.classList.add(t.className)),i&&!j(e.style,t.style,1)&&(s=i,(n=e.style)&&Object.keys(n).map(t=>{t.startsWith("--")?s.style.removeProperty(t):s.style[t]=""}),oi(i,t.style)),Object.assign(this.props,t),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}get viewIds(){return this.viewId?[this.viewId]:this.deck?.getViews().map(t=>t.id)??[]}getViewState(t){return this.deck?.viewManager?.getViewState(t)||{}}setViewState(t,e){this.deck?._onViewStateChange({viewId:t,viewState:e,interactionState:{}})}onCreateRootElement(){const t=["deck-widget",this.className,this.props.className],e=document.createElement("div");return t.filter(t=>"string"==typeof t&&t.length>0).forEach(t=>e.classList.add(t)),oi(e,this.props.style),e}_onAdd(t){return this.onAdd(t)??this.onCreateRootElement()}onAdd(t){}onRemove(){}onViewportChange(t){}onRedraw(t){}onHover(t,e){}onClick(t,e){}onDrag(t,e){}onDragStart(t,e){}onDragEnd(t,e){}};ai.defaultProps={id:"widget",style:{},_container:null,className:""};var hi={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},ci=class extends ai{constructor(t={}){super(t),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(t)}onCreateRootElement(){const t=document.createElement("div");return t.className=this.className,Object.assign(t.style,hi),t}onRenderHTML(t){}onViewportChange(t){this.isVisible&&t.id===this.lastViewport?.id&&!t.equals(this.lastViewport)&&this.setTooltip(null),this.lastViewport=t}onHover(t){const{deck:e}=this,i=e&&e.props.getTooltip;if(!i)return;const s=i(t),n=this.widgetManager?.getCanvasBounds(t.viewport),r=t.x+(n?.x||0),o=t.y+(n?.y||0);this.setTooltip(s,r,o)}setTooltip(t,e,i){const s=this.rootElement;if(s){if("string"==typeof t)s.innerText=t;else{if(!t)return this.isVisible=!1,void(s.style.display="none");t.text&&(s.innerText=t.text),t.html&&(s.innerHTML=t.html),t.className&&(s.className=t.className)}this.isVisible=!0,s.style.display="block",s.style.transform=`translate(${e}px, ${i}px)`,t&&"object"==typeof t&&"style"in t&&Object.assign(s.style,t.style)}}};ci.defaultProps={...ai.defaultProps};var di=class{constructor(t){this.targets={},this.order=[],this.eventManagers={},this._eventRootToCanvasId=/* @__PURE__ */new WeakMap,this._createEventManager=t.createEventManager,this._getEventRoot=t.getEventRoot}finalize(){for(const t of Object.values(this.targets))t.eventManager.destroy(),t.presentationContext.destroy();this.targets={},this.order=[],this.eventManagers={},this._eventRootToCanvasId=/* @__PURE__ */new WeakMap}syncCanvasEntries(t){const e=this._normalizeCanvasList(t.canvases),i={},s=[],n=/* @__PURE__ */new Map;for(const{canvas:o}of e){const t=this._getEventRoot(o);n.set(t,(n.get(t)||0)+1)}for(const{id:o,canvas:a}of e){const e=this._getEventRoot(a),r=1===n.get(e)?e:a;let h=this.targets[o];if(!h||h.device!==t.device||h.canvas!==a||h.eventRoot!==r){h?.eventManager.destroy(),h?.presentationContext.destroy();const e=t.device.createPresentationContext({id:o,canvas:a,useDevicePixels:t.useDevicePixels,autoResize:!0});h={id:o,device:t.device,canvas:a,eventRoot:r,presentationContext:e,eventManager:this._createEventManager(r)}}this._eventRootToCanvasId.set(r,o),this._eventRootToCanvasId.set(a,o),i[o]=h,s.push(o)}for(const[o,a]of Object.entries(this.targets))i[o]||(a.eventManager.destroy(),a.presentationContext.destroy());this.targets=i,this.order=s;const r=Object.fromEntries(Object.entries(i).map(([t,e])=>[t,e.eventManager]));this._haveSameEventManagers(r)||(this.eventManagers=r)}getCanvasIdFromEvent(t){return t?this._eventRootToCanvasId.get(t):void 0}getTarget(t){return this.targets[t||this.order[0]||"default-canvas"]||null}_normalizeCanvasList(t=[]){const e=/* @__PURE__ */new Set;return t.map((t,i)=>{let s,n;return"string"==typeof t?(s=document.getElementById(t),P(s,`Canvas with id ${t} not found`),n=t):(s=t,n=s.id||`deckgl-canvas-${i}`),P(!e.has(n),`Duplicate canvas id ${n}`),e.add(n),{id:n,canvas:s}})}_haveSameEventManagers(t){const e=Object.keys(t),i=Object.keys(this.eventManagers);return e.length===i.length&&e.every(e=>t[e]===this.eventManagers[e])}},li={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},pi=t=>({drawBuffersWEBGL:e=>t.drawBuffers(e),COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),ui=t=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES:()=>t.createVertexArray(),deleteVertexArrayOES:e=>t.deleteVertexArray(e),isVertexArrayOES:e=>t.isVertexArray(e),bindVertexArrayOES:e=>t.bindVertexArray(e)}),gi=t=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE:(...e)=>t.drawArraysInstanced(...e),drawElementsInstancedANGLE:(...e)=>t.drawElementsInstanced(...e),vertexAttribDivisorANGLE:(...e)=>t.vertexAttribDivisor(...e)});function vi(t=!0){const e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext)return e.getContext=e.originalGetContext,void(e.originalGetContext=void 0);e.originalGetContext=e.getContext,e.getContext=function(t,e){if("webgl"===t||"experimental-webgl"===t){const t=this.originalGetContext("webgl2",e);return t instanceof HTMLElement&&function(t){t.getExtension("EXT_color_buffer_float");const e={...li,WEBGL_disjoint_timer_query:t.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:pi(t),OES_vertex_array_object:ui(t),ANGLE_instanced_arrays:gi(t)},i=t.getExtension.bind(t);t.getExtension=function(t){const s=i(t);return s||(t in e?e[t]:null)};const s=t.getSupportedExtensions;t.getSupportedExtensions=function(){return(s.apply(t)||[])?.concat(Object.keys(e))}}(t),t}return this.originalGetContext(t,e)}}var mi=new class extends st{type="webgl";enforceWebGL2(t){vi(t)}isSupported(){return"undefined"!=typeof WebGL2RenderingContext}isDeviceHandle(t){return"undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||("undefined"!=typeof WebGLRenderingContext&&t instanceof WebGLRenderingContext&&H.warn("WebGL1 is not supported",t)(),!1)}async attach(t,e={}){const{WebGLDevice:i}=await import("./webgl-device-Bht0bA0i.js").then(t=>t.n);if(t instanceof i)return t;const s=i.getDeviceFromContext(t);if(s)return s;if(!function(t){return"undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&"function"==typeof t.createVertexArray)}(t))throw new Error("Invalid WebGL2RenderingContext");e=wi(e),await fi(e);const n=!0===e.createCanvasContext?{}:e.createCanvasContext;return new i({...e,_handle:t,createCanvasContext:{canvas:t.canvas,autoResize:!1,...n}})}async create(t={}){const{WebGLDevice:e}=await import("./webgl-device-Bht0bA0i.js").then(t=>t.n);t=wi(t),await fi(t);try{const i=new e(t);H.groupCollapsed(1,`WebGLDevice ${i.id} created`)();const s=`${i._reused?"Reusing":"Created"} device with WebGL2 ${i.props.debug?"debug ":""}context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return H.probe(1,s)(),H.table(1,i.info)(),i}finally{H.groupEnd(1)(),H.info(1,"%cWebGL call tracing: luma.log.set('debug-webgl') ","color: white; background: blue; padding: 2px 6px; border-radius: 3px;")()}}};function wi(t){return{...t,debug:t.debug??a.defaultProps.debug,debugWebGL:t.debugWebGL??a.defaultProps.debugWebGL,debugSpectorJS:t.debugSpectorJS??Boolean(H.get("debug-spectorjs"))}}async function fi(t){const e=[];(t.debugWebGL||t.debug)&&e.push(F()),t.debugSpectorJS&&e.push(T(t));const i=await Promise.allSettled(e);for(const s of i)"rejected"===s.status&&H.error(`Failed to initialize debug libraries ${s.reason}`)()}function _i(){}function yi(t){return t.deviceProps?.debug??t.debug}var Pi={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,pickAsync:"auto",layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,_canvases:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:_i,onWebGLInitialized:_i,onResize:_i,onViewStateChange:_i,onInteractionStateChange:_i,onBeforeRender:_i,onAfterRender:_i,onLoad:_i,onError:t=>O.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:({isDragging:t})=>t?"grabbing":"grab",getTooltip:null,debug:!1,drawPickingColors:!1},bi=class{constructor(t){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.eventManagers={},this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this._canvasContext=null,this._deviceResizeHandler=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new k({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,layersCount:0,drawLayersCount:0,updateLayersCount:0,updateAttributesCount:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,pickLayersCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._hoverPickSequence=0,this._pointerDownPickSequence=0,this._needsRedraw="Initial render",this._canvasManager=new di({createEventManager:t=>this._createEventManager(t),getEventRoot:t=>this._getEventRoot(t)}),this._ownedCanvas=null,this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,canvasId:void 0,event:null,unproject3D:!1},this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=null,this._onPointerMove=t=>{const{_pickRequest:e}=this,i=this._getCanvasIdFromEvent(t);if("pointerleave"===t.type)e.x=-1,e.y=-1,e.radius=0,e.canvasId=i;else{if(t.leftButton||t.rightButton)return;{const s=t.offsetCenter;if(!s)return;e.x=s.x,e.y=s.y,e.radius=this.props.pickingRadius,e.canvasId=i}}this.layerManager&&(this.layerManager.context.mousePosition={x:e.x,y:e.y}),e.event=t},this._onEvent=t=>{const e=c[t.type],i=t.offsetCenter,s=this._getCanvasIdFromEvent(t);if(!e||!i||!this.layerManager)return;const n=this.layerManager.getLayers(),r=this._getInternalPickingMode();if(r){if("sync"===r){const e="click"===t.type&&this._shouldUnproject3D(n)?this._getFirstPickedInfo(this._pickPointSync(this._getPointPickOptions(i.x,i.y,{unproject3D:!0,canvasId:s},n))):this._getLastPointerDownPickingInfo(i.x,i.y,s,n);return void this._dispatchPickingEvent(e,t)}(this._lastPointerDownInfoPromise||Promise.resolve(this._getLastPointerDownPickingInfo(i.x,i.y,s,n))).then(e=>{this._dispatchPickingEvent(e,t)}).catch(t=>this.props.onError?.(t))}},this._onPointerDown=t=>{const e=t.offsetCenter,i=this._getCanvasIdFromEvent(t);if(!e)return;const s=this._getInternalPickingMode();if(!s)return;const n=this.layerManager?.getLayers()||[],r=++this._pointerDownPickSequence;if("sync"===s){const t=this._pickPointSync({x:e.x,y:e.y,canvasId:i,radius:this.props.pickingRadius}),s=this._getFirstPickedInfo(t);return this._lastPointerDownInfo=s,void(this._lastPointerDownInfoPromise=Promise.resolve(s))}const o=this._pickPointAsync(this._getPointPickOptions(e.x,e.y,{canvasId:i},n)).then(t=>this._getFirstPickedInfo(t)).then(t=>(r===this._pointerDownPickSequence&&(this._lastPointerDownInfo=t),t)).catch(t=>{this.props.onError?.(t);const s=this.deckPicker&&this.viewManager?this._getLastPointerDownPickingInfo(e.x,e.y,i,n):{};return r===this._pointerDownPickSequence&&(this._lastPointerDownInfo=s),s});this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=o};const e=t;this.props={...Pi,...t},t=this.props,this._validateCanvasConfiguration(t),t.viewState&&t.initialViewState&&O.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,t.device&&(this.device=t.device,this._setDeviceCanvasContext(t.device));let i=this.device;!i&&t.gl&&(t.gl instanceof WebGLRenderingContext&&O.error("WebGL1 context not supported.")(),i=mi.attach(t.gl,{_cacheShaders:!0,_cachePipelines:!0,...t.deviceProps,debug:yi(t)})),i||(i=this._createDevice(t)),this.animationLoop=this._createAnimationLoop(i,t),this.setProps(e),t._typedArrayManagerProps&&m.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){this._restoreDeviceResizeHandler(),this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._hoverPickSequence++,this._pointerDownPickSequence++,this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,Object.keys(this._canvasManager.targets).length||this.eventManager?.destroy(),this.eventManager=null,this.eventManagers={},this.widgetManager?.finalize(),this.widgetManager=null,this._canvasManager.finalize(),this._isMultiCanvasMode()?this.canvas=null:this.canvas&&this.canvas===this._ownedCanvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null,this._ownedCanvas=null),this._canvasContext=null}setProps(t){this.stats.get("setProps Time").timeStart(),"onLayerHover"in t&&O.removed("onLayerHover","onHover")(),"onLayerClick"in t&&O.removed("onLayerClick","onClick")(),t.initialViewState&&!j(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),P(!("_canvases"in t)||Array.isArray(t._canvases)===this._isMultiCanvasMode()),Object.assign(this.props,t),this._validateCanvasConfiguration(this.props),this._validateInternalPickingMode(),this.device&&this._isMultiCanvasMode()&&this._syncCanvasTargets(),this._setCanvasSize(this.props);const e=Object.create(this.props);if(Object.assign(e,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState(),eventManagers:this.eventManagers}),t.device&&t.device.id!==this.device?.id){const e=t.device.getDefaultCanvasContext();this.animationLoop?.stop(),this._isMultiCanvasMode()||this.canvas===e.canvas||(this.canvas?.remove(),this.eventManager?.destroy(),this.canvas=null),this._setDeviceCanvasContext(t.device),O.log(`recreating animation loop for new device! id=${t.device.id}`)(),this.animationLoop=this._createAnimationLoop(t.device,t),this.animationLoop.start()}if(this.animationLoop?.setProps(e),void 0!==t.useDevicePixels&&this._canvasContext?.setProps){this._canvasContext.setProps({useDevicePixels:t.useDevicePixels});for(const e of Object.values(this._canvasManager.targets))e.presentationContext.setProps({useDevicePixels:t.useDevicePixels})}this.layerManager&&(this.viewManager.setProps(e),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(e),this.effectManager.setProps(e),this.deckRenderer.setProps(e),this.deckPicker.setProps(e),this.widgetManager.setProps(e)),this.stats.get("setProps Time").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);const i=this.viewManager.needsRedraw(t),s=this.layerManager.needsRedraw(t),n=this.effectManager.needsRedraw(t),r=this.deckRenderer.needsRedraw(t);return e=e||i||s||n||r,e}redraw(t){if(!this.layerManager)return;let e=this.needsRedraw({clearRedrawFlags:!0});e=t||e,e&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(e):this._drawLayers(e))}get isInitialized(){return null!==this.viewManager}getViews(){return P(this.viewManager),this.viewManager.views}getView(t){return P(this.viewManager),this.viewManager.getView(t)}getViewports(t){return P(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}getCanvasContext(t){const e=t?this.viewManager?.getView(t)?.props.canvasId:void 0;return this._getCanvasContext(e)}getEventManager(t){if(!t||!this.viewManager)return this.eventManager;const e=this.viewManager.getCanvasId(t)||"default-canvas";return this.eventManagers[e]||this.eventManager}async pickObjectAsync(t){const e=(await this._pickAsync("pickObjectAsync","pickObject Time",t)).result;return e.length?e[0]:null}async pickObjectsAsync(t){return await this._pickAsync("pickObjectsAsync","pickObjects Time",t)}pickObject(t){const e=this._pick("pickObject","pickObject Time",t).result;return e.length?e[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick("pickObject","pickMultipleObjects Time",t).result}pickObjects(t){return this._pick("pickObjects","pickObjects Time",t)}_pickPositionForController(t,e,i){return"sync"!==this._getInternalPickingMode()?null:this.pickObject({x:t,y:e,radius:0,unproject3D:!0,canvasId:i?this.viewManager?.getCanvasId(i):void 0})}_addResources(t,e=!1){for(const i in t)this.layerManager.resourceManager.add({resourceId:i,data:t[i],forceUpdate:e})}_removeResources(t){for(const e of t)this.layerManager.resourceManager.remove(e)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_addDefaultShaderModule(t){this.layerManager.addDefaultShaderModule(t)}_removeDefaultShaderModule(t){this.layerManager?.removeDefaultShaderModule(t)}_resolveInternalPickingMode(){const{pickAsync:t}=this.props,e=this.device?.type||this.props.deviceProps?.type;if("auto"===t)return"webgpu"===e?"async":"sync";if("sync"===t&&"webgpu"===e)throw new Error('`pickAsync: "sync"` is not supported when Deck is using a WebGPU device.');return t}_getInternalPickingMode(){try{return this._resolveInternalPickingMode()}catch(t){return this.props.onError?.(t),null}}_validateInternalPickingMode(){this._getInternalPickingMode()}_getFirstPickedInfo({result:t,emptyInfo:e}){return t[0]||e}_shouldUnproject3D(t=this.layerManager?.getLayers()||[]){return t.some(t=>"3d"===t.props.pickable)}_getPointPickOptions(t,e,i={},s=this.layerManager?.getLayers()||[]){return{x:t,y:e,canvasId:i.canvasId,radius:this.props.pickingRadius,unproject3D:this._shouldUnproject3D(s),...i}}_pickPointSync(t){return this._pick("pickObject","pickObject Time",t)}_pickPointAsync(t){return this._pickAsync("pickObjectAsync","pickObject Time",t)}_getLastPointerDownPickingInfo(t,e,i,s=this.layerManager?.getLayers()||[]){return this.deckPicker.getLastPickedObject({x:t,y:e,layers:s,viewports:this.getViewports({x:t,y:e,canvasId:i})},this._lastPointerDownInfo)}_applyHoverCallbacks({result:t,emptyInfo:e},i){if(!this.widgetManager)return;this.cursorState.isHovering=t.length>0;let s=e,n=!1;for(const r of t)s=r,n=r.layer?.onHover(r,i)||n;n||(this.props.onHover?.(s,i),this.widgetManager.onHover(s,i))}_dispatchPickingEvent(t,e){if(!this.layerManager||!this.widgetManager)return;const i=c[e.type];if(!i)return;const{layer:s}=t,n=s&&(s[i]||s.props[i]),r=this.props[i];let o=!1;n&&(o=n.call(s,t,e)),o||(r?.(t,e),this.widgetManager.onEvent(t,e))}_pickAsync(t,e,i){P(this.deckPicker);const{stats:s}=this,n=this._isMultiCanvasMode()?i.canvasId||this._getDefaultCanvasId():i.canvasId,r=this._getCanvasContext(n)||void 0;s.get("Pick Count").incrementCount(),s.get(e).timeStart(),this._resizeForCanvasTarget(n);const o=this.deckPicker[t]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports({...i,canvasId:n}),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i,canvasId:n,canvasContext:r});return s.get(e).timeEnd(),o}_pick(t,e,i){P(this.deckPicker);const{stats:s}=this,n=this._isMultiCanvasMode()?i.canvasId||this._getDefaultCanvasId():i.canvasId,r=this._getCanvasContext(n)||void 0;s.get("Pick Count").incrementCount(),s.get(e).timeStart(),this._resizeForCanvasTarget(n);const o=this.deckPicker[t]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports({...i,canvasId:n}),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i,canvasId:n,canvasContext:r});return s.get(e).timeEnd(),o}_createCanvas(t){let e=t.canvas;return"string"==typeof e&&(e=document.getElementById(e),P(e)),e?this._ownedCanvas=null:(e=document.createElement("canvas"),e.id=t.id||"deckgl-overlay",t.width&&"number"==typeof t.width&&(e.width=t.width),t.height&&"number"==typeof t.height&&(e.height=t.height),(t.parent||document.body).appendChild(e),this._ownedCanvas=e),Object.assign(e.style,t.style),e}_isMultiCanvasMode(){return Array.isArray(this.props._canvases)}_getDefaultCanvasId(){return this._canvasManager.order[0]||"default-canvas"}_validateCanvasConfiguration(t){Array.isArray(t._canvases)&&(P(!t.canvas),P(!t.gl),P(!t.device?.canvasContext||t.device.getDefaultCanvasContext().offscreenCanvas))}_createEventManager(t){const e=new f(t,{touchAction:this.props.touchAction,recognizers:Object.keys(G).map(t=>{const[e,i,s,n]=G[t],r=this.props.eventRecognizerOptions?.[t];return{recognizer:new e({...i,...r,event:t}),recognizeWith:s,requireFailure:n}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const i in c)"dblclick"===i?e.watch(i,this._onEvent):e.on(i,this._onEvent);return e}_getEventRoot(t){return t.closest(".deck-events-root")||this.props.parent?.querySelector(".deck-events-root")||t}_syncCanvasTargets(){if(!this.device||!this._isMultiCanvasMode())return;this._canvasManager.syncCanvasEntries({device:this.device,canvases:this.props._canvases||[],useDevicePixels:this.props.useDevicePixels}),this.eventManagers=this._canvasManager.eventManagers;const t=this._getDefaultCanvasId();this.eventManager=this.eventManagers[t]||null,this.canvas=this._canvasManager.targets[t]?.canvas||null}_setCanvasContext(t){this._canvasContext=t,"style"in t.canvas&&(this.canvas=t.canvas)}_setDeviceCanvasContext(t,e={}){const i=t.getDefaultCanvasContext();this._setCanvasContext(i),this._setDeviceResizeHandler(t,e)}_setDeviceResizeHandler(t,e={}){const i=Boolean(e.syncDrawingBuffer);if(this._deviceResizeHandler?.device===t)return void(this._deviceResizeHandler.syncDrawingBuffer=i);this._restoreDeviceResizeHandler();const s=t=>{this._isMultiCanvasMode()?this._updateMultiCanvasDimensions():t===this._canvasContext&&this._canvasContext&&this._onCanvasContextResize(this._canvasContext,{syncDrawingBuffer:this._deviceResizeHandler?.syncDrawingBuffer})};t.props.onResize=s,this._deviceResizeHandler={device:t,onResize:s,syncDrawingBuffer:i}}_restoreDeviceResizeHandler(){const t=this._deviceResizeHandler;t&&t.device.props?.onResize===t.onResize&&(t.device.props.onResize=_i),this._deviceResizeHandler=null}_setCanvasSize(t){if(this._isMultiCanvasMode()||!this.canvas)return;const{width:e,height:i}=t;if(e||0===e){const t=Number.isFinite(e)?`${e}px`:e;this.canvas.style.width=t}if(i||0===i){const e=Number.isFinite(i)?`${i}px`:i;this.canvas.style.position=t.style?.position||"absolute",this.canvas.style.height=e}}_getCanvasIdFromEvent(t){return this._canvasManager.getCanvasIdFromEvent(t?.rootElement)}_getCanvasContext(t){return this._canvasManager.getTarget(t)?.presentationContext||this._canvasContext}_resizeForCanvasTarget(t){const e=this._canvasManager.getTarget(t);if(!e||!this.device?.canvasContext)return;const[i,s]=e.presentationContext.getDrawingBufferSize();this.device.canvasContext.setDrawingBufferSize(i,s)}_createDeviceCanvas(t){if(this._isMultiCanvasMode()){const e=globalThis.OffscreenCanvas;if(!e)throw new Error("`_canvases` requires OffscreenCanvas support.");return new e("number"==typeof t.width&&Number.isFinite(t.width)?t.width:1,"number"==typeof t.height&&Number.isFinite(t.height)?t.height:1)}return this._createCanvas(t)}_updateCanvasSize(t=this._canvasContext){if(this._isMultiCanvasMode())return void this._updateMultiCanvasDimensions();const{canvas:e}=this,[i,s]=t?t.getCSSSize():[e?.clientWidth??e?.width??0,e?.clientHeight??e?.height??0];i===this.width&&s===this.height||(this.width=i,this.height=s,this.viewManager?.setProps({width:i,height:s}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:i,height:s},t||void 0))}_onCanvasContextResize(t,e={}){if(e.syncDrawingBuffer){const{width:e,height:i}=t.canvas;t.setDrawingBufferSize(e,i)}this._needsRedraw="Canvas resized",this._updateCanvasSize(t)}_updateMultiCanvasDimensions(){const[t,e]=this._getCanvasContext()?.getCSSSize()||[0,0];t===this.width&&e===this.height||(this.width=t,this.height=e,this.props.onResize({width:t,height:e})),this._needsRedraw="Canvas resized",this.viewManager?.setNeedsUpdate("Canvas resized"),this.viewManager?.setProps({width:this.width,height:this.height})}_createAnimationLoop(t,e){const{gl:i,onError:s}=e;return new Zt({device:t,autoResizeDrawingBuffer:!i&&!Array.isArray(e._canvases),autoResizeViewport:!1,onInitialize:t=>this._setDevice(t.device),onRender:this._onRenderFrame.bind(this),onError:s})}_createDevice(t){const e=this.props.deviceProps?.createCanvasContext,i="object"==typeof e?e:void 0,s={adapters:[],_cacheShaders:!0,_cachePipelines:!0,...t.deviceProps,debug:yi(t)};s.adapters.includes(mi)||s.adapters.push(mi);const n={alphaMode:"webgpu"===this.props.deviceProps?.type?"premultiplied":void 0};return it.createDevice({_reuseDevices:!0,type:"webgl",...s,createCanvasContext:{...n,...i,canvas:this._createDeviceCanvas(t),useDevicePixels:this.props.useDevicePixels,autoResize:!0}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){const{views:t}=this.props,e=Array.isArray(t)?t:t?[t]:[new We({id:"default-view"})];return e.length&&this.props.controller&&(e[0]=e[0].clone({controller:this.props.controller})),e}_onContextLost(){const{onError:t}=this.props;this.animationLoop&&t&&t(/* @__PURE__ */new Error("WebGL context is lost"))}_pickAndCallback(){const{_pickRequest:t}=this;if(t.event){const e=t.event,i=this.layerManager?.getLayers()||[],s=this._getPointPickOptions(t.x,t.y,{canvasId:t.canvasId,radius:t.radius,mode:t.mode},i),n=this._getInternalPickingMode(),r=++this._hoverPickSequence;if(t.event=null,t.canvasId=void 0,!n)return;if("sync"===n)return void this._applyHoverCallbacks(this._pickPointSync(s),e);this._pickPointAsync(s).then(({result:t,emptyInfo:i})=>{r===this._hoverPickSequence&&this._applyHoverCallbacks({result:t,emptyInfo:i},e)}).catch(t=>this.props.onError?.(t))}}_updateCursor(){const t=this.props.getCursor(this.cursorState);if(this._isMultiCanvasMode()){for(const e of Object.values(this._canvasManager.targets))e.canvas.style.cursor=t;return}const e=this.props.parent||this.canvas;e&&(e.style.cursor=t)}_setDevice(t){if(this.device=t,this._validateInternalPickingMode(),!this.animationLoop)return;this._setDeviceCanvasContext(t,{syncDrawingBuffer:Boolean(this.props.gl&&this.props.device!==t)}),this._isMultiCanvasMode()?this._syncCanvasTargets():this.canvas&&!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild),"webgl"===this.device.type&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),"webgl"===this.device.type&&this.props.onWebGLInitialized(this.device.gl);const e=new Ut;if(e.play(),this.animationLoop.attachTimeline(e),!this._isMultiCanvasMode()){const t=this.canvas&&this._getEventRoot(this.canvas);P(t),this.eventManager=this._createEventManager(t),this.eventManagers={[Qt]:this.eventManager}}this.viewManager=new te({timeline:e,eventManager:this.eventManager,eventManagers:this.eventManagers,getCanvasContext:this._isMultiCanvasMode()?this.getCanvasContext.bind(this):void 0,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),pickPosition:this._pickPositionForController.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});const i=this.viewManager.getViewports()[0];this.layerManager=new Jt(this.device,{deck:this,stats:this.stats,viewport:i,timeline:e}),this.effectManager=new He({deck:this,device:this.device}),this.deckRenderer=new $e(this.device,{stats:this.stats}),this.deckPicker=new ei(this.device,{stats:this.stats});const s=this.props.parent?.querySelector(".deck-widgets-root")||(this._isMultiCanvasMode()?this.props.parent||this.canvas?.parentElement:null)||this.canvas?.parentElement;this.widgetManager=new ri({deck:this,parentElement:s}),this.widgetManager.addDefault(new ci),this.setProps({}),this._updateCanvasSize(this._canvasContext),this.props.onLoad()}_drawLayers(t,e){const{device:i,gl:s}=this.layerManager.context;this.props.onBeforeRender({device:i,gl:s});const n={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...e};if(this._isMultiCanvasMode()&&"screen"===n.pass&&!n.target&&this._canvasManager.order.length)for(const r of this._canvasManager.order){const t=n.viewports.filter(t=>this.viewManager.getCanvasId(t.id)===r);if(!t.length){const t=this._canvasManager.targets[r];this._resizeForCanvasTarget(r),this.deckRenderer?.renderLayers({...n,canvasContext:t.presentationContext,target:t.presentationContext.getCurrentFramebuffer(),viewports:[],clearCanvas:!0}),t.presentationContext.present();continue}const e=this._canvasManager.targets[r];this._resizeForCanvasTarget(r);const i=e.presentationContext.getCurrentFramebuffer();this.deckRenderer?.renderLayers({...n,canvasContext:e.presentationContext,target:i,viewports:t}),e.presentationContext.present()}else this.deckRenderer?.renderLayers(n);"screen"===n.pass&&this.widgetManager.onRedraw({viewports:n.viewports,layers:n.layers}),this.props.onAfterRender({device:i,gl:s})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60==0&&(this._getMetrics(),this.stats.reset(),O.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){const e=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:e},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){const{stats:t}=this;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();const e=this.animationLoop.stats;t.get("GPU Time").addTime(e.get("GPU Time").lastTiming),t.get("CPU Time").addTime(e.get("CPU Time").lastTiming)}_getMetrics(){const{metrics:t,stats:e}=this;t.fps=e.get("frameRate").getHz(),t.setPropsTime=e.get("setProps Time").time,t.updateAttributesTime=e.get("Update Attributes").time,t.framesRedrawn=e.get("Redraw Count").count,t.pickTime=e.get("pickObject Time").time+e.get("pickMultipleObjects Time").time+e.get("pickObjects Time").time,t.pickCount=e.get("Pick Count").count,t.layersCount=this.layerManager?.layers.length??0,t.drawLayersCount=e.get("Layers rendered").lastSampleCount,t.pickLayersCount=e.get("Layers picked").lastSampleCount,t.updateLayersCount=e.get("Layer updates").count,t.updateAttributesCount=e.get("Attributes updated").count,t.gpuTime=e.get("GPU Time").time,t.cpuTime=e.get("CPU Time").time,t.gpuTimePerFrame=e.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=e.get("CPU Time").getAverageTime();const i=it.stats.get("GPU Time and Memory");t.bufferMemory=i.get("Buffer Memory").count,t.textureMemory=i.get("Texture Memory").count,t.renderbufferMemory=i.get("Renderbuffer Memory").count,t.gpuMemory=i.get("GPU Memory").count}};bi.defaultProps=Pi,bi.VERSION=Q;var Ci=Math.PI/180,Mi=180/Math.PI,ki=class t{static toPosition(t,e){const i=e*Ci,s=t*Ci,n=Math.cos(i);return[n*Math.cos(s),n*Math.sin(s),Math.sin(i)]}static toLngLat(t){return[Math.atan2(t[1],t[0])*Mi,Math.asin(i(t[2],-1,1))*Mi]}static tangentBasis(t,e){const i=e*Ci,s=t*Ci,n=Math.sin(i),r=Math.cos(i),o=Math.sin(s),a=Math.cos(s);return{N:[-n*a,-n*o,r],E:[-o,a,0]}}static upVector(e,i,s){const{N:n,E:r}=t.tangentBasis(e,i),o=s*Ci,a=Math.cos(o),h=Math.sin(o);return[n[0]*a+r[0]*h,n[1]*a+r[1]*h,n[2]*a+r[2]*h]}static bearing(e,i,s){const{N:n,E:r}=t.tangentBasis(i,s);return Math.atan2(C(e,r),C(e,n))*Mi}static cameraFrame(e,i,s){const n=t.toPosition(e,i),r=t.upVector(e,i,s),{N:o,E:a}=t.tangentBasis(e,i),h=s*Ci,c=Math.cos(h),d=Math.sin(h),l=[a[0]*c-o[0]*d,a[1]*c-o[1]*d,a[2]*c-o[2]*d];return{position:n,up:r,axisHorizontal:R([],n,l),axisVertical:R([],n,r),longitude:e,latitude:i,bearing:s}}static angularDistance(e,s){const n=t.toPosition(e.longitude,e.latitude),r=t.toPosition(s.longitude,s.latitude);return Math.acos(i(C(n,r),-1,1))}static greatCircleAxis(e,i){const s=t.toPosition(e.longitude,e.latitude),n=t.toPosition(i.longitude,i.latitude);return N([],R([],s,n))}static rotate(t,e,i){const s=(new Y).fromAxisRotation(e,i);return S([],t,s)}static rotateFrame(e,i,s,n){let r=t.rotate(e.position,e.axisHorizontal,i);r=t.rotate(r,e.axisVertical,s);let o=t.rotate(e.up,e.axisHorizontal,i);o=t.rotate(o,e.axisVertical,s);const[a,h]=t.toLngLat(r),c=n?0:t.bearing(o,a,h);return{...e,position:r,up:o,longitude:a,latitude:h,bearing:c}}},xi=1/(1-Math.exp(-5)),Si=t=>(1-Math.exp(-5*t))*xi,Ei=class extends _e{constructor(t){const e="axis"in t;super({compare:["longitude","latitude"],extract:e?["longitude","latitude","zoom","bearing"]:["longitude","latitude","zoom"],required:["longitude","latitude"]}),e?(this._mode="rotation",this._axis=t.axis,this._totalAngle=t.totalAngle):(this._mode="linear",this._targetLongitude=t.targetLongitude)}initializeProps(t,e){const i=super.initializeProps(t,e);return this._startZoom=t.zoom,"rotation"===this._mode?this._startFrame={...ki.cameraFrame(t.longitude,t.latitude,t.bearing||0),axisHorizontal:this._axis}:i.end.longitude=this._targetLongitude,i}interpolateProps(t,e,i){if("rotation"===this._mode){const{longitude:t,latitude:e,bearing:s}=ki.rotateFrame(this._startFrame,this._totalAngle*i,0);return{bearing:s,longitude:t,latitude:e,zoom:this._startZoom+X(e,!0)-X(this._startFrame.latitude,!0)}}const s=t.longitude+(e.longitude-t.longitude)*i,n=t.latitude+(e.latitude-t.latitude)*i;return{longitude:s,latitude:n,zoom:this._startZoom+X(n,!0)-X(t.latitude,!0)}}},Ri=Math.PI/180,Li=180/Math.PI;function Di(t,e=0){const i=Math.min(180,t)*Ri;return 512*Math.sin(i/2)*Math.pow(2,e)}function Ii(t,e=0){const i=t/Math.pow(2,e);return 2*Math.asin(Math.min(1,i/256/2))*Li}var Ti=class extends Ue{constructor(t){const{startPanPos:e,startPanCameraFrame:i,startPanAngularRate:s,startPanLockBearing:n,...r}=t;r.normalize=!1,super(r);const o=this._state;void 0!==e&&(o.startPanPos=e),void 0!==i&&(o.startPanCameraFrame=i),void 0!==s&&(o.startPanAngularRate=s),void 0!==n&&(o.startPanLockBearing=n)}panStart({pos:t}){const{latitude:e,longitude:i,zoom:s,bearing:n=0}=this.getViewportProps(),r=ki.cameraFrame(i,e,n),o=Math.abs(n)<1;o&&(r.axisHorizontal=[0,0,1]);const a=.25/Math.pow(2,s-X(e,!0))*Ri;return this._getUpdatedState({startPanPos:t,startPanCameraFrame:r,startPanAngularRate:a,startPanLockBearing:o,startZoom:s})}pan({pos:t,startPos:e}){const n=this.getState(),r=n.startPanPos||e;if(!r)return this;const o=n.startPanCameraFrame,a=n.startPanAngularRate,h=n.startZoom??this.getViewportProps().zoom;if(!o||!a)return this;const c=r[0]-t[0];let d=c*a,l=-(r[1]-t[1])*a;const p=n.startPanLockBearing;if(p){const t=Math.cos(o.latitude*Ri);d=c*a/Math.max(t,.25);const e=(s-o.latitude)*Ri,n=-(s+o.latitude)*Ri;l=i(l,n,e)}const u=ki.rotateFrame(o,d,l,p),g=h+X(u.latitude,!0)-X(o.latitude,!0);return this._getUpdatedState({longitude:u.longitude,latitude:u.latitude,bearing:u.bearing,zoom:g})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanCameraFrame:null,startPanAngularRate:null,startPanLockBearing:null,startZoom:null})}_panFromCenter(t){const{width:e,height:i}=this.getViewportProps(),s=[e/2,i/2];return this.panStart({pos:s}).pan({pos:[s[0]+t[0],s[1]+t[1]]}).panEnd()}applyConstraints(t){const e=t,s=e[Ve];delete e[Ve];const{latitude:n,maxBounds:r}=t;if(t.zoom=this._constrainZoom(t.zoom,t),s){const e=this.makeViewport(t);Object.assign(t,e.panByPosition(s.position,s.screenPosition))}(t.longitude<-180||t.longitude>180)&&(t.longitude=M(t.longitude+180,360)-180),t.latitude=i(t.latitude,-90,90),(t.bearing<-180||t.bearing>180)&&(t.bearing=M(t.bearing+180,360)-180),t.pitch=i(t.pitch,t.minPitch,t.maxPitch);const o=r?Oe(t.width,t.height,t.maxBoundsPadding):null;if(r&&o&&(o.width>=0&&(t.longitude=i(t.longitude,r[0][0],r[1][0])),o.height>=0&&(t.latitude=i(t.latitude,r[0][1],r[1][1]))),r&&o){const e=je(this.makeViewport({...t,bearing:0,pitch:0}),[t.longitude,t.latitude],o),s=t.zoom-X(n),a=r[1][0]-r[0][0],h=r[1][1]-r[0][1];if(o.height>=0&&h>0&&h<180){const n=Math.min(Ii(o.height,s),h),a=o.height?n*e.bottom/o.height:Ii(e.bottom,s),c=o.height?n*e.top/o.height:Ii(e.top,s);t.latitude=i(t.latitude,r[0][1]+a,r[1][1]-c)}if(o.width>=0&&a>0&&a<360){const n=Math.min(Ii(o.width/Math.cos(t.latitude*Ri),s),a),h=o.width?n*e.left/o.width:Ii(e.left/Math.cos(t.latitude*Ri),s),c=o.width?n*e.right/o.width:Ii(e.right/Math.cos(t.latitude*Ri),s);t.longitude=i(t.longitude,r[0][0]+h,r[1][0]-c)}}return t.latitude!==n&&(t.zoom+=X(t.latitude,!0)-X(n,!0)),t}_constrainZoom(t,e){e||(e=this.getViewportProps());const{maxZoom:s,maxBounds:n}=e;let{minZoom:r}=e;if(null!==n&&e.width>0&&e.height>0){const t=Oe(e.width,e.height,e.maxBoundsPadding),i=n[0][1],o=n[1][1],a=Math.sign(i)===Math.sign(o)?Math.min(Math.abs(i),Math.abs(o)):0,h=X(0),c=Di(n[1][0]-n[0][0])*Math.cos(a*Ri),d=Di(n[1][1]-n[0][1]);t.width>0&&c>0&&(r=Math.max(r,Math.log2(t.width/c)+h)),t.height>0&&d>0&&(r=Math.max(r,Math.log2(t.height/d)+h)),r>s&&(r=s)}const o=X(e.latitude,!0)-X(0,!0);return i(t,r+o,s+o)}},Ai=class extends Ae{constructor(){super(...arguments),this.ControllerState=Ti,this.transition={transitionDuration:300,transitionInterpolator:new be({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan",this._panHistory=[]}getZoomPosition(t){const e=super.getZoomPosition(t),i=this.makeViewport(this.controllerState.getViewportProps());return!(i instanceof K)||i.getZoomAnchorStrength(e)>0?e:i.project([i.longitude,i.latitude])}_onPanStart(t){return this._panHistory=[],super._onPanStart(t)}_onMultiPanStart(t){return this._panHistory=[],super._onMultiPanStart(t)}_onPanMove(t){if(!this.dragPan)return!1;const e=this.getCenter(t),i=this.controllerState.pan({pos:e});this.updateViewport(i,{transitionDuration:0},{isDragging:!0,isPanning:!0});const{longitude:s,latitude:n}=i.getViewportProps();return this._panHistory.push({longitude:s,latitude:n,timestamp:Date.now()}),this._panHistory.length>5&&this._panHistory.shift(),!0}_onPanMoveEnd(t){const{inertia:e}=this;if(this.dragPan&&e&&this._panHistory.length>=2){const t=this._panHistory[0],s=this._panHistory[this._panHistory.length-1],n=s.timestamp-t.timestamp;if(n>0){const r=this.controllerState.getViewportProps(),o=this.controllerState.getState(),a=ki.angularDistance(t,s)/n;if(a>1e-6){const h=a*e/2;let c,d,l;if(o.startPanLockBearing){let o=s.longitude-t.longitude;o>180?o-=360:o<-180&&(o+=360);const a=o/n,h=(s.latitude-t.latitude)/n;d=r.longitude+a*e/2,l=i(r.latitude+h*e/2,-90,90),c=new Ei({targetLongitude:d})}else{const e=ki.greatCircleAxis(t,s),n=ki.cameraFrame(r.longitude,r.latitude,r.bearing||0),o=ki.rotateFrame({...n,axisHorizontal:e},h,0);d=o.longitude,l=i(o.latitude,-90,90),c=new Ei({axis:e,totalAngle:h})}const p=this.controllerState.panEnd();return this.updateViewport(p,{transitionInterpolator:c,transitionDuration:e,transitionEasing:Si,longitude:d,latitude:l},{isDragging:!1,isPanning:!0}),this._panHistory=[],!0}}}this._panHistory=[];const s=this.controllerState.panEnd();return this.updateViewport(s,null,{isDragging:!1,isPanning:!1}),!0}},Vi={cullMode:"back"},zi=class extends de{constructor(t={}){super({...t,parameters:{...Vi,...t.parameters}})}getViewportType(t){return t.zoom>12?y:K}get ControllerType(){return Ai}};zi.displayName="GlobeView";var Fi=class{constructor(t){P(t.id,"id is required"),this.id=t.id,this.type="custom",this.renderingMode=t.renderingMode||"3d",this.slot=t.slot,this.beforeId=t.beforeId,this.map=null}onAdd(t,e){this.map=t}render(t,e){this.map&&function(t,e,i,s){if(!t.isInitialized)return;let{currentViewport:n}=t.userData,r=!1;n||(n=Xi(t,e,s),t.userData.currentViewport=n,r=!0);if(!n)return;t._drawLayers("mapbox-repaint",{viewports:[n],layerFilter:e=>{if(t.props.layerFilter&&!t.props.layerFilter(e))return!1;const s=e.layer;return s.props.beforeId===i.beforeId&&s.props.slot===i.slot},clearStack:r,clearCanvas:!1})}(this.map.__deck,this.map,this,e)}},Oi="__UNDEFINED__";function ji(t){return t.props.beforeId?`deck-layer-group-before:${t.props.beforeId}`:t.props.slot?`deck-layer-group-slot:${t.props.slot}`:"deck-layer-group-last"}var Bi="mapbox",Ni=512,Ui=Math.PI/180;function Gi({map:t,deck:e}){if(t.__deck)return t.__deck;const i=e.props._customRender,s=e.props.onLoad,n={...e.props,_customRender:()=>{t.triggerRepaint(),i?.("")}};return n.views||(n.views=qi(t)),Object.assign(n,{width:null,height:null,touchAction:"unset",viewState:$i(t)}),e.isInitialized?Wi(e,t):n.onLoad=()=>{Wi(e,t),Yi(e,t),s?.()},e.setProps(n),t.__deck=e,t.on("render",()=>{e.isInitialized&&function(t,e){const i=I(t.props.layers,Boolean).some(t=>t&&!e.getLayer(ji(t)));let s=t.getViewports();const n=s.findIndex(t=>t.id===Bi),r=s.length>1||n<0;if(i||r){if(n>=0){s=s.slice();const i=Xi(t,e);i?s[n]=i:s.splice(n,1)}t._drawLayers("mapbox-repaint",{viewports:s,layerFilter:i=>(!t.props.layerFilter||t.props.layerFilter(i))&&("mapbox"!==i.viewport.id||!e.getLayer(ji(i.layer))),clearCanvas:!1})}else{const e=t.device,i=e?.gl;t.props.onBeforeRender?.({device:e,gl:i}),t.props.onAfterRender?.({device:e,gl:i})}t.userData.currentViewport=null}(e,t)}),e}function Wi(t,e){const i=()=>{t.isInitialized?Yi(t,e):e.off("move",i)};e.on("move",i)}function Zi(t,e){return e?{depthWriteEnabled:!0,depthCompare:"less-equal",depthBias:0,blend:!0,blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one-minus-src-alpha",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha",blendColorOperation:"add",blendAlphaOperation:"add"}:{}}function Hi(t){let e;try{e=t.getProjection?.()}catch{return"mercator"}const i=e?.type||e?.name;if("globe"===i)return"globe";if(i&&"mercator"!==i)throw new Error("Unsupported projection");return"mercator"}function qi(t){return"globe"===Hi(t)?new zi({id:Bi}):new We({id:Bi})}function $i(t){const{lng:e,lat:i}=t.getCenter(),s={longitude:(e+540)%360-180,latitude:i,zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch(),padding:t.getPadding(),repeat:t.getRenderWorldCopies()};return t.getTerrain?.()&&function(t,e){if(t.getFreeCameraOptions){const{position:i}=t.getFreeCameraOptions();if(!i||void 0===i.z)return;const s=t.transform.height,{longitude:r,latitude:o,pitch:a}=e,h=i.x*Ni,c=(1-i.y)*Ni,d=i.z*Ni,l=n([r,o]),p=h-l[0],u=c-l[1],g=Math.sqrt(p*p+u*u),v=a*Ui,m=1.5*s,w=v<.001?m*Math.cos(v)/d:m*Math.sin(v)/g;e.zoom=Math.log2(w),e.position=[0,0,(d-m*Math.cos(v)/w)/D(o)]}else"number"==typeof t.transform.elevation&&(e.position=[0,0,t.transform.elevation])}(t,s),s}function Xi(t,e,i){const s=$i(e),n=t.getView("mapbox")||qi(e);i&&(n.props.nearZMultiplier=.2);const r=i?.nearZ??e.transform._nearZ,o=i?.farZ??e.transform._farZ;return Number.isFinite(r)&&(s.nearZ=r/e.transform.height,s.farZ=o/e.transform.height),n.makeViewport({width:t.width,height:t.height,viewState:s})}function Yi(t,e){t.setProps({viewState:$i(e)}),t.needsRedraw({clearRedrawFlags:!0})}var Ki=class{constructor(t){this._handleStyleChange=()=>{this._resolveLayers(this._map,this._deck,this._props.layers,this._props.layers),this._map&&Hi(this._map)&&this._deck?.setProps({views:this._getViews(this._map)})},this._updateContainerSize=()=>{if(this._map&&this._container){const{clientWidth:t,clientHeight:e}=this._map.getContainer();Object.assign(this._container.style,{width:`${t}px`,height:`${e}px`})}},this._updateViewState=()=>{const t=this._deck,e=this._map;t&&e&&(t.setProps({views:this._getViews(e),viewState:$i(e)}),t.isInitialized&&t.redraw())},this._handleMouseEvent=t=>{const e=this._deck;if(!e||!e.isInitialized)return;const i={type:t.type,offsetCenter:t.point,srcEvent:t},s=this._lastMouseDownPoint;switch(!t.point&&s&&(i.deltaX=t.originalEvent.clientX-s.clientX,i.deltaY=t.originalEvent.clientY-s.clientY,i.offsetCenter={x:s.x+i.deltaX,y:s.y+i.deltaY}),i.type){case"mousedown":e._onPointerDown(i),this._lastMouseDownPoint={...t.point,clientX:t.originalEvent.clientX,clientY:t.originalEvent.clientY};break;case"dragstart":i.type="panstart",e._onEvent(i);break;case"drag":i.type="panmove",e._onEvent(i);break;case"dragend":i.type="panend",e._onEvent(i);break;case"click":i.tapCount=1,e._onEvent(i);break;case"dblclick":i.type="click",i.tapCount=2,e._onEvent(i);break;case"mousemove":i.type="pointermove",e._onPointerMove(i);break;case"mouseout":i.type="pointerleave",e._onPointerMove(i);break;default:return}};const{interleaved:e=!1}=t;this._interleaved=e,this._props=this.filterProps(t)}filterProps(t){const{interleaved:e,useDevicePixels:i,...s}=t;return this._interleaved||void 0===i||(s.useDevicePixels=i),s}setProps(t){this._interleaved&&t.layers&&this._resolveLayers(this._map,this._deck,this._props.layers,t.layers),Object.assign(this._props,this.filterProps(t)),this._deck&&this._map&&this._deck.setProps({...this._props,views:this._getViews(this._map),parameters:{...Zi(this._map,this._interleaved),...this._props.parameters}})}onAdd(t){return this._map=t,this._interleaved?this._onAddInterleaved(t):this._onAddOverlaid(t)}_onAddOverlaid(t){const e=document.createElement("div");return Object.assign(e.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=e,this._deck=new bi({...this._props,parent:e,deviceProps:{...this._props.deviceProps,createCanvasContext:{..."object"==typeof this._props.deviceProps?.createCanvasContext?this._props.deviceProps.createCanvasContext:void 0,pixelSizeSource:"css-dpr"}},parameters:{...Zi(0,!1),...this._props.parameters},views:this._getViews(t),viewState:$i(t)}),t.on("resize",this._updateContainerSize),t.on("render",this._updateViewState),t.on("mousedown",this._handleMouseEvent),t.on("dragstart",this._handleMouseEvent),t.on("drag",this._handleMouseEvent),t.on("dragend",this._handleMouseEvent),t.on("mousemove",this._handleMouseEvent),t.on("mouseout",this._handleMouseEvent),t.on("click",this._handleMouseEvent),t.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),e}_onAddInterleaved(t){const e=t.painter.context.gl;return e instanceof WebGLRenderingContext&&O.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=Gi({map:t,deck:new bi({...this._props,views:this._getViews(t),gl:e,parameters:{...Zi(0,!0),...this._props.parameters}})}),t.on("styledata",this._handleStyleChange),this._resolveLayers(t,this._deck,[],this._props.layers),document.createElement("div")}_resolveLayers(t,e,i,s){!function(t,e,i){if(!t||!t.style||!t.style._loaded)return;const s=I(i,Boolean);if(e!==i){const i=I(e,Boolean),n=new Set(i.map(t=>ji(t))),r=new Set(s.map(t=>ji(t)));for(const e of n)r.has(e)||t.getLayer(e)&&t.removeLayer(e)}const n={};for(const o of s){const e=ji(o),i=t.getLayer(e);if(i)n[e]=i.implementation||i;else{const i=new Fi({id:e,slot:o.props.slot,beforeId:o.props.beforeId});n[e]=i,t.addLayer(i,o.props.beforeId)}}const r=t.style._order;for(const[o,a]of Object.entries(n)){const e=a.beforeId||Oi,i=e===Oi?r.length:r.indexOf(e);if(-1!==i&&r.indexOf(o)!==i-1){const i=e===Oi?void 0:e;t.moveLayer(o,i)}}}(t,i,s)}onRemove(){const t=this._map;t&&(this._interleaved?this._onRemoveInterleaved(t):this._onRemoveOverlaid(t)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(t){t.off("resize",this._updateContainerSize),t.off("render",this._updateViewState),t.off("mousedown",this._handleMouseEvent),t.off("dragstart",this._handleMouseEvent),t.off("drag",this._handleMouseEvent),t.off("dragend",this._handleMouseEvent),t.off("mousemove",this._handleMouseEvent),t.off("mouseout",this._handleMouseEvent),t.off("click",this._handleMouseEvent),t.off("dblclick",this._handleMouseEvent),this._deck?.finalize(),this._container?.remove()}_onRemoveInterleaved(t){t.off("styledata",this._handleStyleChange),this._resolveLayers(t,this._deck,this._props.layers,[]),function(t){t.__deck?.finalize(),t.__deck=null}(t)}getDefaultPosition(){return"top-left"}pickObject(t){return P(this._deck),this._deck.pickObject(t)}pickMultipleObjects(t){return P(this._deck),this._deck.pickMultipleObjects(t)}pickObjects(t){return P(this._deck),this._deck.pickObjects(t)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}_getViews(t){if(!this._props.views)return qi(t);const e=Array.isArray(this._props.views)?this._props.views:[this._props.views];return e.some(t=>"mapbox"===t.id)?this._props.views:[qi(t),...e]}};export{Ki as MapboxOverlay};
@@ -0,0 +1,2 @@
1
+ /*! Web-kit v1.2.0-develop.11 | (c) 2026 MapVX */
2
+ !function(){try{var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7090717e-4f3a-4275-939f-392f8c478ac8",e._sentryDebugIdIdentifier="sentry-dbid-7090717e-4f3a-4275-939f-392f8c478ac8")}catch(e){}}();import{Ht as e,Vt as t,en as r}from"./debug-hooks-A7fGcVSJ.js";import{d as s,f as i,i as n,l as o,p as a,r as f,s as u,u as h}from"./shader-type-decoder-DV9QwQh3.js";import{c,l as d,m as l,p as y,s as g,u as b}from"./webgl-device-Bht0bA0i.js";function p(e){return function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(e)||function(e){return!!Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}(e)}var m=class e extends s{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(t,r){super(t,r,e.defaultProps),this.shaderLayout=r.shaderLayout}static defaultProps={...s.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0}},w=class e{static defaultProps={...y.defaultProps};static getDefaultPipelineFactory(t){const r=t.getModuleData("@luma.gl/core");return r.defaultPipelineFactory||=new e(t),r.defaultPipelineFactory}device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};_sharedRenderPipelineCache={};get[Symbol.toStringTag](){return"PipelineFactory"}toString(){return`PipelineFactory(${this.device.id})`}constructor(e){this.device=e}createRenderPipeline(e){if(!this.device.props._cachePipelines)return this.device.createRenderPipeline(e);const t={...y.defaultProps,...e},r=this._renderPipelineCache,s=this._hashRenderPipeline(t);let n=r[s]?.resource;if(n)r[s].useCount++,this.device.props.debugFactories&&a.log(3,`${this}: ${r[s].resource} reused, count=${r[s].useCount}, (id=${e.id})`)();else{const e="webgl"===this.device.type&&this.device.props._sharePipelines?this.createSharedRenderPipeline(t):void 0;n=this.device.createRenderPipeline({...t,id:t.id?`${t.id}-cached`:i("unnamed-cached"),_sharedRenderPipeline:e}),n.hash=s,r[s]={resource:n,useCount:1},this.device.props.debugFactories&&a.log(3,`${this}: ${n} created, count=${r[s].useCount}`)()}return n}createComputePipeline(e){if(!this.device.props._cachePipelines)return this.device.createComputePipeline(e);const t={...m.defaultProps,...e},r=this._computePipelineCache,s=this._hashComputePipeline(t);let i=r[s]?.resource;return i?(r[s].useCount++,this.device.props.debugFactories&&a.log(3,`${this}: ${r[s].resource} reused, count=${r[s].useCount}, (id=${e.id})`)()):(i=this.device.createComputePipeline({...t,id:t.id?`${t.id}-cached`:void 0}),i.hash=s,r[s]={resource:i,useCount:1},this.device.props.debugFactories&&a.log(3,`${this}: ${i} created, count=${r[s].useCount}`)()),i}release(e){if(!this.device.props._cachePipelines)return void e.destroy();const t=this._getCache(e),r=e.hash;t[r].useCount--,0===t[r].useCount?(this._destroyPipeline(e),this.device.props.debugFactories&&a.log(3,`${this}: ${e} released and destroyed`)()):t[r].useCount<0?(a.error(`${this}: ${e} released, useCount < 0, resetting`)(),t[r].useCount=0):this.device.props.debugFactories&&a.log(3,`${this}: ${e} released, count=${t[r].useCount}`)()}createSharedRenderPipeline(e){const t=this._hashSharedRenderPipeline(e);let r=this._sharedRenderPipelineCache[t];return r||(r={resource:this.device._createSharedRenderPipelineWebGL(e),useCount:0},this._sharedRenderPipelineCache[t]=r),r.useCount++,r.resource}releaseSharedRenderPipeline(e){if(!e.sharedRenderPipeline)return;const t=this._hashSharedRenderPipeline(e.sharedRenderPipeline.props),r=this._sharedRenderPipelineCache[t];r&&(r.useCount--,0===r.useCount&&(r.resource.destroy(),delete this._sharedRenderPipelineCache[t]))}_destroyPipeline(e){const t=this._getCache(e);return!!this.device.props._destroyPipelines&&(delete t[e.hash],e.destroy(),e instanceof y&&this.releaseSharedRenderPipeline(e),!0)}_getCache(e){let t;if(e instanceof m&&(t=this._computePipelineCache),e instanceof y&&(t=this._renderPipelineCache),!t)throw new Error(`${this}`);if(!t[e.hash])throw new Error(`${this}: ${e} matched incorrect entry`);return t}_hashComputePipeline(e){const{type:t}=this.device;return`${t}/C/${this._getHash(e.shader.source)}SL${this._getHash(JSON.stringify(e.shaderLayout))}`}_hashRenderPipeline(e){const t=e.vs?this._getHash(e.vs.source):0,r=e.fs?this._getHash(e.fs.source):0,s=this._getWebGLVaryingHash(e),i=this._getHash(JSON.stringify(e.shaderLayout)),n=this._getHash(JSON.stringify(e._uniformBlockLayouts)),o=this._getHash(JSON.stringify(e.bufferLayout)),{type:a}=this.device;if("webgl"===a){const f=this._getHash(JSON.stringify(e.parameters));return`${a}/R/${t}/${r}V${s}T${e.topology}P${f}SL${i}UBL${n}BL${o}`}{const n=this._getHash(JSON.stringify({vertexEntryPoint:e.vertexEntryPoint,fragmentEntryPoint:e.fragmentEntryPoint})),f=this._getHash(JSON.stringify(e.parameters)),u=this._getWebGPUAttachmentHash(e);return`${a}/R/${t}/${r}V${s}T${e.topology}EP${n}P${f}SL${i}BL${o}A${u}`}}_hashSharedRenderPipeline(e){return`webgl/S/${e.vs?this._getHash(e.vs.source):0}/${e.fs?this._getHash(e.fs.source):0}V${this._getWebGLVaryingHash(e)}`}_getHash(e){return void 0===this._hashes[e]&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}_getWebGLVaryingHash(e){const{varyings:t=[],bufferMode:r=null}=e;return this._getHash(JSON.stringify({varyings:t,bufferMode:r}))}_getWebGPUAttachmentHash(e){const t=e.colorAttachmentFormats??[this.device.preferredColorFormat],r=e.depthStencilAttachmentFormat??(e.parameters?.depthWriteEnabled?this.device.preferredDepthFormat:null);return this._getHash(JSON.stringify({colorAttachmentFormats:t,depthStencilAttachmentFormat:r}))}},v=class e{static defaultProps={...l.defaultProps};static getDefaultShaderFactory(t){const r=t.getModuleData("@luma.gl/core");return r.defaultShaderFactory||=new e(t),r.defaultShaderFactory}device;_cache={};get[Symbol.toStringTag](){return"ShaderFactory"}toString(){return`${this[Symbol.toStringTag]}(${this.device.id})`}constructor(e){this.device=e}createShader(e){if(!this.device.props._cacheShaders)return this.device.createShader(e);const t=this._hashShader(e);let r=this._cache[t];if(r)r.useCount++,this.device.props.debugFactories&&a.log(3,`${this}: Reusing shader ${r.resource.id} count=${r.useCount}`)();else{const s=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[t]=r={resource:s,useCount:1},this.device.props.debugFactories&&a.log(3,`${this}: Created new shader ${s.id}`)()}return r.resource}release(e){if(!this.device.props._cacheShaders)return void e.destroy();const t=this._hashShader(e),r=this._cache[t];if(r)if(r.useCount--,0===r.useCount)this.device.props._destroyShaders&&(delete this._cache[t],r.resource.destroy(),this.device.props.debugFactories&&a.log(3,`${this}: Releasing shader ${e.id}, destroyed`)());else{if(r.useCount<0)throw new Error(`ShaderFactory: Shader ${e.id} released too many times`);this.device.props.debugFactories&&a.log(3,`${this}: Releasing shader ${e.id} count=${r.useCount}`)()}}_hashShader(e){return`${e.stage}:${e.source}`}};function _(e){return Array.isArray(e)?0===e.length||"number"==typeof e[0]:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(e)}var B=class{layout;constructor(e){this.layout=e}has(e){return Boolean(this.layout.fields[e])}get(e){const t=this.layout.fields[e];return t?{offset:t.offset,size:t.size}:void 0}getFlatUniformValues(e){const t={};for(const[r,s]of Object.entries(e)){const e=this.layout.uniformTypes[r];e?this._flattenCompositeValue(t,r,e,s):this.layout.fields[r]&&(t[r]=s)}return t}getData(e){const t=g(this.layout.byteLength);new Uint8Array(t,0,this.layout.byteLength).fill(0);const r={i32:new Int32Array(t),u32:new Uint32Array(t),f32:new Float32Array(t),f16:new Uint16Array(t)},s=this.getFlatUniformValues(e);for(const[i,n]of Object.entries(s))this._writeLeafValue(r,i,n);return new Uint8Array(t,0,this.layout.byteLength)}_flattenCompositeValue(e,t,r,s){if(void 0!==s)if("string"==typeof r||this.layout.fields[t])e[t]=s;else{if(Array.isArray(r)){const i=r[0],n=r[1];if(Array.isArray(i))throw new Error(`Nested arrays are not supported for ${t}`);if("string"==typeof i&&_(s))return void this._flattenPackedArray(e,t,i,n,s);if(!Array.isArray(s))return void a.warn(`Unsupported uniform array value for ${t}:`,s)();for(let r=0;r<Math.min(s.length,n);r++){const n=s[r];void 0!==n&&this._flattenCompositeValue(e,`${t}[${r}]`,i,n)}return}if(d(r)&&function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)&&!ArrayBuffer.isView(e)}(s))for(const[i,n]of Object.entries(s)){if(void 0===n)continue;const s=`${t}.${i}`;this._flattenCompositeValue(e,s,r[i],n)}else a.warn(`Unsupported uniform value for ${t}:`,s)()}}_flattenPackedArray(e,t,r,s,i){const n=i,o=c(r,this.layout.layout).components;for(let a=0;a<s;a++){const r=a*o;if(r>=n.length)break;e[`${t}[${a}]`]=1===o?Number(n[r]):L(i,r,r+o)}}_writeLeafValue(e,t,r){const s=this.layout.fields[t];if(!s)return void a.warn(`Uniform ${t} not found in layout`)();const{type:i,components:n,columns:o,rows:f,offset:u,columnStride:h}=s,c=e[i];if(1===n)return void(c[u]=Number(r));const d=r;if(1===o){for(let e=0;e<n;e++)c[u+e]=Number(d[e]??0);return}let l=0;for(let a=0;a<o;a++){const e=u+a*h;for(let t=0;t<f;t++)c[e+t]=Number(d[l++]??0)}}};function L(e,t,r){return Array.prototype.slice.call(e,t,r)}var E=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){const t=e?.shaderLayout.bindings?.find(t=>"uniform"===t.type&&t.name===e?.name);if(!t)throw new Error(e?.name);const r=t;for(const e of r.uniforms||[])this.bindingLayout[e.name]=e}}setUniforms(e){for(const[t,r]of Object.entries(e))this._setUniform(t,r)&&!this.needsRedraw&&this.setNeedsRedraw(`${this.name}.${t}=${r}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){return!function(e,t,r=16){if(e===t)return!0;const s=e,i=t;if(!_(s)||!_(i))return!1;if(s.length!==i.length)return!1;const n=Math.min(r,128);if(s.length>n)return!1;for(let o=0;o<s.length;++o)if(i[o]!==s[o])return!1;return!0}(this.uniforms[e],t)&&(this.uniforms[e]=_(r=t)?r.slice():r,this.modifiedUniforms[e]=!0,this.modified=!0,!0);var r}},P=class{device;uniformBlocks=/* @__PURE__ */new Map;shaderBlockLayouts=/* @__PURE__ */new Map;shaderBlockWriters=/* @__PURE__ */new Map;uniformBuffers=/* @__PURE__ */new Map;constructor(e,t){this.device=e;for(const[r,s]of Object.entries(t)){const t=r,i=b(s.uniformTypes??{},{layout:s.layout??S(e)}),n=new B(i);this.shaderBlockLayouts.set(t,i),this.shaderBlockWriters.set(t,n);const o=new E({name:r});o.setUniforms(n.getFlatUniformValues(s.defaultUniforms||{})),this.uniformBlocks.set(t,o)}}destroy(){for(const e of this.uniformBuffers.values())e.destroy()}setUniforms(e,t){for(const[r,s]of Object.entries(e)){const e=r,t=this.shaderBlockWriters.get(e)?.getFlatUniformValues(s||{});this.uniformBlocks.get(e)?.setUniforms(t||{})}this.updateUniformBuffers(t)}getUniformBufferByteLength(e){const t=this.shaderBlockLayouts.get(e)?.byteLength||0;return Math.max(t,1024)}getUniformBufferData(e){const t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.shaderBlockWriters.get(e)?.getData(t)||/* @__PURE__ */new Uint8Array(0)}createUniformBuffer(e,t){t&&this.setUniforms(t);const r=this.getUniformBufferByteLength(e),s=this.device.createBuffer({usage:h.UNIFORM|h.COPY_DST,byteLength:r}),i=this.getUniformBufferData(e);return s.write(i),s}getManagedUniformBuffer(e){if(!this.uniformBuffers.get(e)){const t=this.getUniformBufferByteLength(e),r=this.device.createBuffer({usage:h.UNIFORM|h.COPY_DST,byteLength:t});this.uniformBuffers.set(e,r)}return this.uniformBuffers.get(e)}updateUniformBuffers(e){let t=!1;for(const r of this.uniformBlocks.keys()){const s=this.updateUniformBuffer(r,e);t||=s}return t&&a.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(e,t){const r=this.uniformBlocks.get(e);let s=this.uniformBuffers.get(e),i=!1;if(s&&r?.needsRedraw){i||=r.needsRedraw;const n=this.getUniformBufferData(e);if(s=this.uniformBuffers.get(e),s&&(t?this.device.writeBufferViaCommandEncoder(t,s,n):s.write(n)),a.level>=4){const t=this.uniformBlocks.get(e)?.getAllUniforms();a.log(4,`Writing to uniform buffer ${String(e)}`,n,t)()}}return i}};function S(e){return"webgpu"===e.type?"wgsl-uniform":"std140"}var $=/^(vs|fs):(?:#(?:decl|main-start|main-end)|[A-Za-z_][\w-]*)$/;function D(e=[],t){const r=[],s={},i={},n={},o={};for(const a of e)O({modules:r,defines:s,injections:i,vertexInputs:n,varyings:o},a),O({modules:r,defines:s,injections:i,vertexInputs:n,varyings:o},a[t]);for(const a of Object.keys(o))if(n[a])throw new Error(`ShaderPlugin name "${a}" cannot be both a vertex input and a varying`);return{modules:r,defines:s,injections:i,vertexInputs:n,varyings:o}}function U(e=[],t=[]){const r=[...e],s=new Set(r.map(e=>e.name));for(const i of t)s.has(i.name)||(r.push(i),s.add(i.name));return r}function O(e,t){if(t){t.modules?.length&&e.modules.push(...t.modules),t.defines&&Object.assign(e.defines,t.defines);for(const[r,s]of Object.entries(t.vertexInputs||{})){V(r,"vertex input");const t=e.vertexInputs[r];if(t&&t!==s)throw new Error(`ShaderPlugin vertex input "${r}" has conflicting types "${t}" and "${s}"`);e.vertexInputs[r]=s}for(const[r,s]of Object.entries(t.varyings||{})){V(r,"varying");const t=T(r,s),i=e.varyings[r];if(i&&(i.type!==t.type||i.interpolation!==t.interpolation))throw new Error(`ShaderPlugin varying "${r}" has conflicting declarations "${i.type}/${i.interpolation}" and "${t.type}/${t.interpolation}"`);e.varyings[r]=t}for(const r of t.injections||[])A(r.target),e.injections[r.target]||(e.injections[r.target]=[]),e.injections[r.target].push({injection:r.injection,order:r.order??0})}}function V(e,t){if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)||e.startsWith("_luma_"))throw new Error(`ShaderPlugin ${t} "${e}" must be a valid non-reserved identifier`)}function T(e,t){const{primitiveType:r}=f.getAttributeShaderTypeInfo(t.type),s="i32"===r||"u32"===r,i=t.interpolation||(s?"flat":"smooth");if(s&&"smooth"===i)throw new Error(`ShaderPlugin integer varying "${e}" must use flat interpolation`);return{type:t.type,interpolation:i}}function A(e){if(!$.test(e))throw new Error(`ShaderPlugin injection target "${e}" must be a named shader anchor or hook`)}var C={};function G(e="id"){return C[e]=C[e]||1,`${e}-${C[e]++}`}function x(e,t){if(!e||!t.some(e=>e.bindingLayout?.length))return e;const r={...e,bindings:e.bindings.map(e=>({...e}))};"attributes"in(e||{})&&(r.attributes=e?.attributes||[]);for(const s of t)for(const e of s.bindingLayout||[])for(const t of k(e.name)){const s=r.bindings.find(e=>e.name===t);0===s?.group&&(s.group=e.group),s&&void 0!==e.visibility&&(s.visibility=e.visibility)}return r}function R(e,t,r=[]){return e?t?{...e,attributes:e.attributes.length?F(e.attributes,t.attributes.filter(e=>r.includes(e.name))):t.attributes,bindings:N(e.bindings,t.bindings)}:e:t}function z(e){return Boolean(e.uniformTypes&&!function(e){for(const t in e)return!1;return!0}(e.uniformTypes))}function j(r){const s=[];for(const i of r){const r=e(i),n=new Set([i.vs,i.fs].flatMap(e=>e?t(e).filter(e=>e.isStd140).map(e=>e.blockName):[])),o=n.has(r)?r:1===n.size?n.values().next().value:void 0;z(i)&&o&&s.push({name:o,uniformTypes:i.uniformTypes})}return s}function M(e,t){const r=[],s=/* @__PURE__ */new Set;for(const i of[...e||[],...t||[]])s.has(i.name)||(s.add(i.name),r.push(i));return r}function k(e){const t=/* @__PURE__ */new Set([e,`${e}Uniforms`]);return e.endsWith("Uniforms")||t.add(`${e}Sampler`),[...t]}function N(e,t){const r=e.map(e=>({...e})),s=new Set(e.map(e=>e.name)),i=new Set(e.map(e=>`${e.group}:${e.location}`));for(const n of t){const e=`${n.group}:${n.location}`;s.has(n.name)||i.has(e)||r.push({...n})}return r}function F(e,t){const r=e.map(e=>({...e})),s=new Map(e.map(e=>[e.name,e])),i=new Map(e.map(e=>[e.location,e]));for(const n of t){const e=s.get(n.name);if(e){if(e.type!==n.type||e.location!==n.location)throw new Error(`Shader attribute "${n.name}" conflicts with its inferred type or location`);continue}const t=i.get(n.location);if(t)throw new Error(`Shader attributes "${t.name}" and "${n.name}" both use location ${n.location}`);r.push({...n})}return r}function I(e,t={}){const r={bindings:{},uniforms:{}};return Object.keys(e).forEach(s=>{const i=e[s];var n;Object.prototype.hasOwnProperty.call(t,s)||(p(n=i)||"number"==typeof n||"boolean"==typeof n)?r.uniforms[s]=i:r.bindings[s]=i}),r}var H=class{options={disableWarnings:!1};modules;moduleUniforms;moduleBindings;directBindings={};constructor(e,t){Object.assign(this.options,t);const s=r(Object.values(e).filter(Z));for(const r of s)e[r.name]=r;a.log(1,"Creating ShaderInputs with modules",Object.keys(e))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(const[r,i]of Object.entries(e))i&&(this._addModule(i),i.name&&r!==i.name&&!this.options.disableWarnings&&a.warn(`Module name: ${r} vs ${i.name}`)())}destroy(){}setProps(e){e.bindings&&Object.assign(this.directBindings,e.bindings);for(const t of Object.keys(e)){if("bindings"===t)continue;const r=t,s=e[r]||{},i=this.modules[r];if(i){const e=this.moduleUniforms[r],t=this.moduleBindings[r],n=i.getUniforms?.(s,e)||s,{uniforms:o,bindings:a}=I(n,i.uniformTypes);this.moduleUniforms[r]=Y(e,o,i.uniformTypes),this.moduleBindings[r]={...t,...a}}else this.options.disableWarnings||a.warn(`Module ${t} not found`)()}}getModules(){return Object.values(this.modules)}addModules(e){const t=r(e);for(const r of t){const e=r.name;this.modules[e]||(this.modules[e]=r,this._addModule(r))}}getUniformValues(){return this.moduleUniforms}getBindingValues(){const e={};for(const t of Object.values(this.moduleBindings))Object.assign(e,t);return Object.assign(e,this.directBindings),e}getModuleBindingValues(e){const t=this.moduleBindings[e];return t?{...t}:{}}getDebugTable(){const e={};for(const[t,r]of Object.entries(this.moduleUniforms))for(const[s,i]of Object.entries(r))e[`${t}.${s}`]={type:this.modules[t].uniformTypes?.[s],value:String(i)};return e}_addModule(e){const t=e.name;this.moduleUniforms[t]=Y({},e.defaultUniforms||{},e.uniformTypes),this.moduleBindings[t]={}}};function Y(e={},t={},r={}){const s={...e};for(const[i,n]of Object.entries(t))void 0!==n&&(s[i]=W(e[i],n,r[i]));return s}function W(e,t,r){if(!r||"string"==typeof r)return q(t);if(Array.isArray(r)){if(J(t)||!Array.isArray(t))return q(t);const s=Array.isArray(e)&&!J(e)?[...e]:[],i=s.slice();for(let e=0;e<t.length;e++){const n=t[e];void 0!==n&&(i[e]=W(s[e],n,r[0]))}return i}if(!X(t))return q(t);const s=r,i=X(e)?e:{},n={...i};for(const[o,a]of Object.entries(t))void 0!==a&&(n[o]=W(i[o],a,s[o]));return n}function q(e){return ArrayBuffer.isView(e)?Array.prototype.slice.call(e):Array.isArray(e)?J(e)?e.slice():e.map(e=>void 0===e?void 0:q(e)):X(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,void 0===t?void 0:q(t)])):e}function J(e){return ArrayBuffer.isView(e)||Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}function X(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)&&!ArrayBuffer.isView(e)}function Z(e){return Boolean(e?.dependencies)}var K=h.DEBUG_DATA_MAX_LENGTH,Q=class{device;id;ready;usage;props;isReady=!0;destroyed=!1;generation=0;updateTimestamp;debugData=/* @__PURE__ */new ArrayBuffer(0);_debugDataEnabled;_maxDebugDataByteLength;_ownsBuffer;_buffer;get buffer(){return this._buffer}get byteLength(){return this._buffer.byteLength}get[Symbol.toStringTag](){return"DynamicBuffer"}toString(){return`DynamicBuffer:"${this.id}":${this.byteLength}B`}toJSON(){return this.toString()}constructor(e,t){const{debugData:r=!1,buffer:s,ownsBuffer:i=!0,...n}=t;if(s&&s.device!==e)throw new Error("DynamicBuffer adopted buffers must belong to the supplied device");if(s&&(void 0!==n.byteLength||void 0!==n.data))throw new Error("DynamicBuffer cannot combine an adopted buffer with byteLength or data");const o=t.id||s?.id||G("dynamic-buffer"),a={...n,id:o,usage:n.usage??s?.usage,indexType:n.indexType??s?.indexType};(a.usage||0)&h.INDEX&&!a.indexType&&(n.data instanceof Uint32Array?a.indexType="uint32":n.data instanceof Uint16Array?a.indexType="uint16":n.data instanceof Uint8Array&&(a.indexType="uint8")),delete a.data,delete a.byteOffset,this.device=e,this.id=o,this.props=a,this.usage=a.usage||0,this._debugDataEnabled=Boolean(r),this._maxDebugDataByteLength="object"==typeof r&&void 0!==r.maxByteLength?r.maxByteLength:K,this._ownsBuffer=i,this._buffer=s??this.device.createBuffer({...n,id:o}),this.ready=Promise.resolve(this._buffer),this.updateTimestamp=this._buffer.updateTimestamp,this._resetDebugData(this._buffer.byteLength),n.data&&this._writeDebugData(n.data,n.byteOffset||0)}write(e,t=0){this._buffer.write(e,t),this._touch(),this._writeDebugData(e,t)}async mapAndWriteAsync(e,t=0,r=this.byteLength-t){let s=null;await this._buffer.mapAndWriteAsync(async(t,i)=>{await e(t,i),s=new Uint8Array(t.slice(0,r))},t,r),this._touch(),s&&this._writeDebugData(s,t)}async readAsync(e=0,t=this.byteLength-e){const r=await this._buffer.readAsync(e,t);return this._writeDebugData(r,e)&&this._touch(),r}async mapAndReadAsync(e,t=0,r=this.byteLength-t){let s=null;const i=await this._buffer.mapAndReadAsync(async(t,r)=>(s=new Uint8Array(t.slice(0)),await e(t,r)),t,r);return s&&this._writeDebugData(s,t)&&this._touch(),i}resize(e){const{byteLength:t,preserveData:r=!1}=e;if(t===this.byteLength)return!1;const s=Math.min(e.copyByteLength??Math.min(this.byteLength,t),this.byteLength,t),i=this._buffer,n=this.debugData.slice(0),{data:o,byteOffset:a,...f}=this.props,u=this.device.createBuffer({...f,byteLength:t});return r&&s>0&&this._copyBufferContents(i,u,s),this._buffer=u,this._resetDebugData(t),r&&n.byteLength>0&&this._writeDebugData(n,0),this._ownsBuffer&&i.destroy(),this._ownsBuffer=!0,this.generation++,this._touch(),!0}ensureSize(e,t){return!(e<=this.byteLength)&&this.resize({byteLength:e,preserveData:t?.preserveData})}getBinding(e){return void 0===e?.offset&&void 0===e?.size?this._buffer:{buffer:this._buffer,offset:e?.offset,size:e?.size}}destroy(){this.destroyed||(this._ownsBuffer&&this._buffer.destroy(),this.destroyed=!0,this.debugData=/* @__PURE__ */new ArrayBuffer(0))}_copyBufferContents(e,t,r){const s="webgpu"===this.device.type?4*Math.ceil(r/4):r,i=this.device.createCommandEncoder();i.copyBufferToBuffer({sourceBuffer:e,destinationBuffer:t,size:s}),this.device.submit(i.finish())}_touch(){this.updateTimestamp=this.device.incrementTimestamp()}_resetDebugData(e){this._debugDataEnabled?this.debugData=new ArrayBuffer(Math.min(e,this._maxDebugDataByteLength)):this.debugData=/* @__PURE__ */new ArrayBuffer(0)}_writeDebugData(e,t){if(!this._debugDataEnabled||0===this.debugData.byteLength||t>=this.debugData.byteLength)return!1;const r=ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),s=new Uint8Array(this.debugData),i=Math.min(r.byteLength,s.byteLength-t);return s.set(r.subarray(0,i),t),i>0}};function ee(e){return null!==e&&"object"==typeof e&&"buffer"in e}function te(e){return e instanceof Q?e:ee(e)&&e.buffer instanceof Q?e.buffer:null}function re(e){return{buffer:(t=e.buffer,t instanceof Q?t.buffer:t),offset:e.offset,size:e.size};var t}var se=/^vertex-list<([^<>]+)>$/,ie=/^value-list<([^<>]+)>$/;function ne(e){return se.test(e)}function oe(e){return ie.test(e)}function ae(e){const t=function(e){const t=se.exec(e),r=ie.exec(e),s=t?.[1]??r?.[1]??e;try{n.getVertexFormatInfo(s)}catch{throw new Error(`Unsupported GPUVector format ${e}`)}return s}(e),r=ne(e),s=oe(e),i=n.getVertexFormatInfo(t),o=i.type,a=i.normalized,f=function(e,t){if(t)return"f32";switch(e){case"float32":return"f32";case"float16":return"f16";case"uint8":case"uint16":case"uint32":return"u32";case"sint8":case"sint16":case"sint32":return"i32";default:throw new Error(`Unsupported GPUVector component type ${e}`)}}(o,a);return{format:e,elementFormat:t,vertexList:r,valueList:s,type:o,signedDataType:fe(t,o),primitiveType:f,components:i.components,byteLength:i.byteLength,integer:i.integer,signed:i.signed,normalized:a,...i.webglOnly?{webglOnly:!0}:{}}}function fe(e,t){if("unorm10-10-10-2"===e)return"uint32";switch(t){case"unorm8":return"uint8";case"snorm8":return"sint8";case"unorm16":return"uint16";case"snorm16":return"sint16";default:return t}}var ue=class{buffer;format;length;byteOffset;byteStride;constructor(e){const t=n.getVertexFormatInfo(e.format).byteLength,r=e.byteOffset??0,s=e.byteStride??t;if(he(e.length,"GPUDataView length"),he(r,"GPUDataView byteOffset"),he(s,"GPUDataView byteStride"),s<t)throw new Error(`GPUDataView byteStride ${s} is smaller than ${e.format} byte length ${t}`);const i=0===e.length?0:(e.length-1)*s+t,o=r+i;if(!Number.isSafeInteger(i)||!Number.isSafeInteger(o))throw new Error("GPUDataView byte range must use safe integers");if(o>e.buffer.byteLength)throw new Error("GPUDataView exceeds its backing buffer byte length");this.buffer=e.buffer,this.format=e.format,this.length=e.length,this.byteOffset=r,this.byteStride=s}get elementByteLength(){return n.getVertexFormatInfo(this.format).byteLength}get byteLength(){return 0===this.length?0:(this.length-1)*this.byteStride+this.elementByteLength}};function he(e,t){if(!Number.isSafeInteger(e)||e<0)throw new Error(`${t} must be a non-negative safe integer`)}function ce(e){return Boolean(e&&"object"==typeof e&&"struct"===e.type)}function de(e,t){const r=Object.entries(e);if(0===r.length)throw new Error("GPUData struct format must declare at least one field");return"packed"===t?function(e){const t=[];let r=0,s=0;for(const[i,o]of e){const e=n.getVertexFormatInfo(o);if(e.webglOnly)throw new Error(`Packed GPUData struct field "${i}" uses WebGL-only format ${o}`);r=ge(r,Math.min(4,e.byteLength)),t.push([i,Object.freeze({format:o,byteOffset:r,byteLength:e.byteLength})]),r+=e.byteLength,s+=e.components}return Object.freeze({type:"struct",layout:"packed",fields:Object.freeze(Object.fromEntries(t)),components:s,byteStride:ge(r,4),rowByteLength:r})}(r):function(e){const t=Object.fromEntries(e.map(([e,t])=>[e,le(t)])),r=b(t,{layout:"wgsl-storage"}),s=[];let i=0,o=0;for(const[a,f]of e){const e=n.getVertexFormatInfo(f),t=4*r.fields[a].offset;s.push([a,Object.freeze({format:f,byteOffset:t,byteLength:e.byteLength})]),i=Math.max(i,t+e.byteLength),o+=e.components}return Object.freeze({type:"struct",layout:"wgsl-storage",fields:Object.freeze(Object.fromEntries(s)),components:o,byteStride:r.byteLength,rowByteLength:i})}(r)}function le(e){const t=n.getVertexFormatInfo(e);switch(t.type){case"float32":return ye("f32",t.components);case"sint32":return ye("i32",t.components);case"uint32":return ye("u32",t.components);default:return ye("u32",Math.ceil(t.byteLength/4))}}function ye(e,t){return 1===t?e:`vec${t}<${e}>`}function ge(e,t){return Math.ceil(e/t)*t}var be=class{buffer;ownsDataBuffer;constructor(e,t){this.buffer=e,this.ownsDataBuffer=t}get ownsBuffer(){return this.ownsDataBuffer}transferBufferOwnership(e){if(e.buffer!==this.buffer)throw new Error("GPUData ownership can only be transferred to the same buffer");e.ownsDataBuffer=this.ownsDataBuffer,this.ownsDataBuffer=!1}destroy(){this.ownsDataBuffer&&(this.buffer.destroy(),this.ownsDataBuffer=!1)}},pe=class extends be{dataType;format;length;valueLength;stride;byteOffset;byteStride;rowByteLength;readbackMetadata;valueOffsets;nullBitmap;valueByteLength;constructor(e){const{buffer:t,format:r,length:s,valueLength:i,stride:n,byteOffset:o=0,byteStride:a,rowByteLength:f,ownsBuffer:u=!1,readbackMetadata:h,valueOffsets:c,nullBitmap:d,valueByteLength:l,dataType:y}=e;let g;super(t,u),g=r?"string"==typeof r?r:de(r,e.layout??"wgsl-storage"):void 0;const b=ce(g)?g:void 0,p="string"==typeof g?ae(g):void 0;if(this.dataType=y,this.format=g,this.length=s,this.valueLength=i??s,this.stride=n??p?.components??b?.components??a??f??1,this.byteOffset=o,this.rowByteLength=f??b?.rowByteLength??p?.byteLength??a??this.stride,this.byteStride=a??b?.byteStride??this.rowByteLength,b){if(this.rowByteLength<b.rowByteLength)throw new Error(`GPUData rowByteLength ${this.rowByteLength} is smaller than struct format row byte length ${b.rowByteLength}`);if(this.byteStride<Math.max(b.byteStride,this.rowByteLength))throw new Error(`GPUData byteStride ${this.byteStride} is smaller than its struct row layout`)}this.readbackMetadata=h,this.valueOffsets=c,this.nullBitmap=d,this.valueByteLength=l}getChild(e){if(!ce(this.format))return null;const t=this.format.fields[e];return t?new ue({buffer:this.buffer,format:t.format,length:this.length,byteOffset:this.byteOffset+t.byteOffset,byteStride:this.byteStride}):null}getChildAt(e){if(!ce(this.format))return null;const t=Object.values(this.format.fields)[e];return t?new ue({buffer:this.buffer,format:t.format,length:this.length,byteOffset:this.byteOffset+t.byteOffset,byteStride:this.byteStride}):null}},me=class{name;dataType;format;length;valueLength;stride;byteOffset;byteStride;rowByteLength;bufferLayout;data=[];device;bufferProps;isAppendable=!1;ownsDataChunks=!0;ownedVectors=[];appendableByteLength=0;constructor(e){switch(e.type){case"buffer":{const{name:t,buffer:r,format:s,length:i,valueLength:n=i,byteOffset:o=0,ownsBuffer:a=!1}=e,{stride:f,byteStride:u,rowByteLength:h}=we(e);return this.name=t,this.dataType=e.dataType,this.format=s,this.length=i,this.valueLength=n,this.stride=f,this.byteOffset=o,this.byteStride=u,this.rowByteLength=h,void this.data.push(new pe({buffer:r,format:s,length:i,valueLength:n,stride:f,byteOffset:o,byteStride:u,rowByteLength:h,ownsBuffer:a,dataType:e.dataType}))}case"interleaved":{const{name:t,buffer:r,format:s,length:i,valueLength:n=i,byteOffset:o=0,byteStride:a,attributes:f,ownsBuffer:u=!1}=e;return this.name=t,this.dataType=e.dataType,this.format=s,this.length=i,this.valueLength=n,this.stride=a,this.byteOffset=o,this.byteStride=a,this.rowByteLength=a,this.bufferLayout={name:t,byteStride:a,attributes:f},void this.data.push(new pe({buffer:r,format:s,length:i,valueLength:n,stride:a,byteOffset:o,byteStride:a,rowByteLength:a,ownsBuffer:u,dataType:e.dataType}))}case"data":{const t=e.format??function(e){return e[0]?.format}(e.data),r=t?ae(t):void 0,{name:s,data:i,stride:n=i[0]?.stride??r?.components??1,valueLength:o=i.reduce((e,t)=>e+t.valueLength,0),byteStride:a=i[0]?.byteStride??r?.byteLength,rowByteLength:f=i[0]?.rowByteLength??r?.byteLength,bufferLayout:u,ownsData:h=!1}=e;if(void 0===a||void 0===f)throw new Error("GPUVector requires format or explicit byte layout metadata");return t&&function(e,t){if(e.find(e=>e.format!==t))throw new Error("GPUVector data chunks must share the declared format")}(i,t),this.name=s,this.dataType=e.dataType,this.format=t,this.length=i.reduce((e,t)=>e+t.length,0),this.valueLength=o,this.stride=n,this.byteOffset=1===i.length?i[0].byteOffset:0,this.byteStride=a,this.rowByteLength=f,this.bufferLayout=u,this.ownsDataChunks=h,void this.data.push(...i)}case"appendable":{const{name:t,device:r,format:s,valueLength:i=0,bufferProps:n}=e,{stride:o,byteStride:a,rowByteLength:f}=we(e);return this.name=t,this.dataType=e.dataType,this.format=s,this.length=0,this.valueLength=i,this.stride=o,this.byteOffset=0,this.byteStride=a,this.rowByteLength=f,this.device=r,this.bufferProps=n,void(this.isAppendable=!0)}}}get ownsBuffer(){return this.ownsDataChunks&&this.data.some(e=>e.ownsBuffer)||this.ownedVectors.some(e=>e.ownsBuffer)}get capacityRows(){return this.isAppendable?this.length:void 0}get appendedByteLength(){return this.appendableByteLength}addData(e){if(this.format&&e.format!==this.format)throw new Error("GPUVector.addData() requires matching formats");if(e.byteStride!==this.byteStride)throw new Error("GPUVector.addData() requires matching byteStride");if(e.rowByteLength!==this.rowByteLength)throw new Error("GPUVector.addData() requires matching rowByteLength");return this.data.push(e),this.length+=e.length,this.valueLength+=e.valueLength,this}appendDataChunk(e,t=this.appendableByteLength+e.buffer.byteLength){if(!this.isAppendable)throw new Error("GPUVector.appendDataChunk() requires appendable vector storage");if(this.format&&e.format!==this.format)throw new Error("GPUVector.appendDataChunk() requires matching formats");if(e.byteStride!==this.byteStride||e.rowByteLength!==this.rowByteLength)throw new Error("GPUVector.appendDataChunk() requires matching byte layout metadata");return this.data.push(e),this.length+=e.length,this.valueLength+=e.valueLength,this.appendableByteLength=t,this}resetLastBatch(){if(!this.isAppendable)throw new Error("GPUVector.resetLastBatch() requires appendable vector storage");for(const e of this.data.splice(0))e.destroy();return this.length=0,this.valueLength=0,this.appendableByteLength=0,this}retainOwnedVectors(e){return this.ownedVectors.push(...e),this}transferBufferOwnership(e){const t=this.data[0],r=e.data[0];if(!t||!r||t.buffer!==r.buffer)throw new Error("GPUVector ownership can only be transferred to the same buffer");t.transferBufferOwnership(r)}destroy(){if(this.ownsDataChunks)for(const e of this.data)e.destroy();for(const e of this.ownedVectors.splice(0))e.destroy()}};function we(e){const t=e.format?ae(e.format):void 0,r=e.rowByteLength??e.byteStride??t?.byteLength;if(void 0===r)throw new Error("GPUVector requires format or explicit rowByteLength");return{stride:e.stride??t?.components??1,byteStride:e.byteStride??r,rowByteLength:r}}var ve=new class{poolSize=20;bufferPools;constructor(){this.bufferPools=/* @__PURE__ */new Map}createOrReuse(e,t){if(t>e.limits.maxBufferSize)throw new Error(`Buffer pool cannot allocate ${t} bytes: device.limits.maxBufferSize is ${e.limits.maxBufferSize}`);const r=this.bufferPools.get(e),s=r?r.findIndex(e=>e.byteLength>=t):-1;if(s<0)return e.createBuffer({usage:h.VERTEX|h.STORAGE|h.COPY_DST|h.COPY_SRC,byteLength:t});const[i]=r.splice(s,1);return i}recycle(e){const t=e.device;this.bufferPools.has(t)||this.bufferPools.set(t,[]);const r=this.bufferPools.get(t),s=r.findIndex(t=>t.byteLength>e.byteLength);s<0?r.push(e):r.splice(s,0,e),this.purge()}purge(){for(const[e,t]of this.bufferPools){const r=e.isLost?0:this.poolSize;for(;t.length>r;)t.shift().destroy();0===t.length&&this.bufferPools.delete(e)}}},_e=class e{static get bufferPoolSize(){return ve.poolSize}static set bufferPoolSize(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("GPUDataEvaluator.bufferPoolSize must be a non-negative safe integer");ve.poolSize=e,ve.purge()}type;size;get offset(){return this._offset}get stride(){return this._stride}normalized;isConstant;length;get byteLength(){return this._byteLength}ValueType;source=null;format;_id;_destroyed=!1;_value;_offset;_stride;_byteLength;_gpuVector;_bufferOwnership="owned";_targetBuffer;static fromArray(t,{type:r,size:s=1,offset:i=0,stride:n=0,normalized:a=!1}){let f,h=r;Array.isArray(t)?(h=h||"float32",f=new(o(h))(t)):t instanceof Float64Array?(h="uint32",s*=2,i*=2,n*=2,f=new Uint32Array(t.buffer,t.byteOffset,t.byteLength/4)):(h=h||u(t),f=t);return new e({id:`<${h} * ${s}>`,type:h,size:s,offset:i,stride:n,normalized:a,value:f})}static fromConstant(t,r="float32"){const s=o(r);let i;return Array.isArray(t)?i=`[${t.join(",")}]`:(i=String(t),t=[t]),new e({id:i,isConstant:!0,type:r,size:t.length,value:new s(t)})}static fromGPUData(t,r={}){!function(e){if(!e.format)throw new Error("GPUDataEvaluator.fromGPUData() requires GPUData format metadata");if(ne(e.format)||oe(e.format))throw new Error("GPUDataEvaluator.fromGPUData() does not support variable-length input");const t=ae(e.format).byteLength;if(e.rowByteLength!==t)throw new Error(`GPUDataEvaluator.fromGPUData() requires rowByteLength ${t} for GPUData`)}(t);const s=new ue({buffer:t.buffer,format:t.format,length:t.length,byteOffset:t.byteOffset,byteStride:t.byteStride});return new e({...Le(s),id:r.id,gpuData:t})}static fromGPUDataView(t,r={}){return new e({...Le(t),id:r.id,buffer:t.buffer})}constructor(t){const{id:r,value:s,buffer:i,gpuData:n,format:a,source:f=null,isConstant:u=!1}=t;if(!(f||s||i||n))throw new Error("GPUDataEvaluator must have a value source");let{type:h,size:c,offset:d,stride:l,normalized:y,length:g}=t;if(f instanceof e?(h=h??f.type,c=c??f.size,d=d??f.offset,l=l??f.stride,y=y??f.normalized,g=g??f.length):(c=c??1,d=d??0,y=y??!1,g=u?1:g),!h)throw new Error("GPUDataEvaluator: type not defined");if(this._id=r,this.type=h,this.size=c,this.ValueType=o(this.type),this._offset=d,this._stride=l||this.ValueType.BYTES_PER_ELEMENT*c,this.normalized=y,this.source=f,this.format=a,void 0===g)if(u)g=1;else{if(!s)throw new Error("GPUDataEvaluator: length not defined");g=Math.ceil(s.byteLength/this.stride)}this.isConstant=u,this.length=g;const b=this.ValueType.BYTES_PER_ELEMENT*this.size;this._byteLength=0===g?0:(g-1)*this.stride+b,this._value=s,this._bufferOwnership=f instanceof e||i||n?"borrowed":"owned",n?this._gpuVector=new me({type:"data",name:this._id??"data",format:n.format,data:[n],stride:n.stride,byteStride:n.byteStride,rowByteLength:n.rowByteLength}):i&&(this._gpuVector=this.createGPUVectorView({buffer:i,name:this._id,format:this.format}))}get value(){return this._value||(this.source instanceof e?this.source.value:void 0)}get evaluated(){return Boolean(this._gpuVector)}get id(){return this._id}get gpuVector(){if(!this._gpuVector)throw new Error(`${this} not evaluated`);return this._gpuVector}get buffer(){return Ee(this.gpuVector)}setTargetBuffer({buffer:t,byteOffset:r=0,byteStride:s=this.stride}){if(this._destroyed)throw new Error(`GPUDataEvaluator ${this} already destroyed`);if(this._gpuVector)throw new Error(`GPUDataEvaluator ${this} already evaluated`);if(!this.source||this.source instanceof e)throw new Error("GPUDataEvaluator target buffers require a deferred operation source");this._targetBuffer={buffer:t,byteOffset:r,byteStride:s}}async evaluate(t,r={}){if(this._destroyed)throw new Error(`GPUDataEvaluator ${this} already destroyed`);if(this._gpuVector)return this._gpuVector;let s;if(this.source instanceof e){const e=await this.source.evaluate(t);return this._gpuVector=this.createGPUVectorView({...r,buffer:Ee(e)}),this._gpuVector}if(s=this._getEvaluationBuffer(t),this._value)s.write(this._value);else{const e=await this.source.execute(t,s);if(!e.success)throw e.error||/* @__PURE__ */new Error(`${this.source} evaluation failed`);e.value&&(this._value=e.value)}return this._gpuVector=this.createGPUVectorView({...r,buffer:s}),this._gpuVector}evaluateSync(t,r={}){if(this._destroyed)throw new Error(`GPUDataEvaluator ${this} already destroyed`);if(this._gpuVector)return this._gpuVector;let s;if(this.source instanceof e){const e=this.source.evaluateSync(t);return this._gpuVector=this.createGPUVectorView({...r,buffer:Ee(e)}),this._gpuVector}if(s=this._getEvaluationBuffer(t),this._value)s.write(this._value);else{const e=this.source.executeSync(t,s);if(!e.success)throw e.error||/* @__PURE__ */new Error(`${this.source} evaluation failed`);e.value&&(this._value=e.value)}return this._gpuVector=this.createGPUVectorView({...r,buffer:s}),this._gpuVector}createGPUVectorView(e){const t=e.name??this._id??"vector",r=e.format??this.format??function(e,t,r=!1){return t>=1&&t<=4?Se(e,t,r):void 0}(this.type,this.size,this.normalized);if(e.interleaved){const r="object"==typeof e.interleaved&&e.interleaved.attributes?e.interleaved.attributes:function(e){const t=[];return Pe(e,t,{byteOffset:0}),t}(this);return new me({type:"interleaved",name:t,buffer:e.buffer,format:e.format??this.format,length:this.length,byteOffset:this.offset,byteStride:this.stride,attributes:r,ownsBuffer:!1})}return new me({type:"buffer",name:t,buffer:e.buffer,format:r,length:this.length,stride:this.size,byteOffset:this.offset,byteStride:this.stride,rowByteLength:this.ValueType.BYTES_PER_ELEMENT*this.size,ownsBuffer:!1})}_getEvaluationBuffer(e){const t=this._targetBuffer;if(!t)return ve.createOrReuse(e,this.byteLength);if(t.buffer.device!==e)throw new Error("GPUDataEvaluator target buffer belongs to a different device");const r=this.ValueType.BYTES_PER_ELEMENT*this.size,s=0===this.length?0:(this.length-1)*t.byteStride+r;if(t.byteOffset+s>t.buffer.byteLength)throw new Error("GPUDataEvaluator target buffer is too small for the output layout");return this._offset=t.byteOffset,this._stride=t.byteStride,this._byteLength=s,this._bufferOwnership="borrowed",this._targetBuffer=void 0,t.buffer}async readValue(e=0,t){const{ValueType:r}=this,{size:s,offset:i,stride:n,length:o}=this,a=r.BYTES_PER_ELEMENT*s;if(t=t??o,e=Math.max(0,Math.min(o,e)),t=Math.max(e,Math.min(o,t)),this._value)return function(e,t,r,s){const{ValueType:i,size:n,offset:o,stride:a}=e,f=a/i.BYTES_PER_ELEMENT,u=o/i.BYTES_PER_ELEMENT,h=s-r;if(f===n){const e=u+r*f;return t.subarray(e,e+h*n)}const c=new i(h*n);for(let d=0;d<h;d++){const e=u+(r+d)*f;c.set(t.subarray(e,e+n),d*n)}return c}(this,this._value,e,t);const f=t-e;if(0===f)return new r(0);const u=i+e*n,h=n===a?f*a:(f-1)*n+a,c=await this.buffer.readAsync(u,h),d=new r(c.buffer,c.byteOffset,c.byteLength/r.BYTES_PER_ELEMENT);if(n===a)return d;const l=new Uint8Array(a*f);for(let y=0;y<f;y++){const e=y*n;l.set(c.subarray(e,e+a),y*a)}return new r(l.buffer)}async ensureCPUValue(){const e=this.value;if(e)return e;const t=await this.buffer.readAsync(0,this.offset+this.byteLength);if(t.byteLength%this.ValueType.BYTES_PER_ELEMENT!==0)throw new Error(`${this} backing buffer byte length is not aligned to its scalar type`);const r=t.slice();return this._value=new this.ValueType(r.buffer,r.byteOffset,r.byteLength/this.ValueType.BYTES_PER_ELEMENT),this._value}ensureCPUValueSync(){const e=this.value;if(e)return e;throw new Error(`${this} CPU value is not available for synchronous evaluation`)}toString(){return this._id??this.source?.toString()??this.constructor.name}destroy(){this._gpuVector&&("owned"===this._bufferOwnership&&ve.recycle(Ee(this._gpuVector)),this._gpuVector=void 0),this._targetBuffer=void 0,this._destroyed=!0}};function Be(e){if(e instanceof _e)return e;if("number"==typeof e||Array.isArray(e))return _e.fromConstant(e);if(e instanceof pe)return _e.fromGPUData(e);if(e instanceof ue)return _e.fromGPUDataView(e);throw new Error("getGPUDataEvaluator() requires GPUDataEvaluator, GPUData, GPUDataView, number, or number[]")}function Le(e){const t=ae(e.format),r=o(t.signedDataType),s=r.BYTES_PER_ELEMENT*t.components;if(t.byteLength!==s)throw new Error(`GPUDataEvaluator does not support packed vertex format ${e.format}: ${t.byteLength} physical bytes cannot expose ${t.components} ${t.signedDataType} components`);if(e.byteOffset%r.BYTES_PER_ELEMENT!==0||e.byteStride%r.BYTES_PER_ELEMENT!==0)throw new Error(`GPUDataEvaluator requires ${e.format} offset and stride aligned to ${r.BYTES_PER_ELEMENT} bytes`);return{type:t.signedDataType,size:t.components,offset:e.byteOffset,stride:e.byteStride,normalized:t.normalized,length:e.length,format:e.format}}function Ee(e){const t=function(e){const[t,...r]=e.data;if(!t||r.length>0)throw new Error(`GPUDataEvaluator requires exactly one GPUData chunk for "${e.name}"`);return t}(e).buffer;return t instanceof Q?t.buffer:t}function Pe(e,t,r){const s=e.source;if(!s||s instanceof _e||"interleave"!==s.name)t.push({attribute:e.id??e.toString(),format:Se(e.type,e.size,e.normalized),byteOffset:r.byteOffset}),r.byteOffset+=e.ValueType.BYTES_PER_ELEMENT*e.size;else for(const i of Object.values(s.inputs))i instanceof _e&&Pe(i,t,r)}function Se(e,t,r=!1){if(t<1||t>4)throw new Error(`Cannot synthesize a GPUVector vertex format with ${t} components`);let s=e;if(r)switch(e){case"uint8":s="unorm8";break;case"sint8":s="snorm8";break;case"uint16":s="unorm16";break;case"sint16":s="snorm16";break;case"float32":s="float32";break;default:throw new Error(`Unsupported normalized vertex format for ${e}`)}return"uint8"!==s&&"sint8"!==s&&"uint16"!==s&&"sint16"!==s&&"unorm8"!==s&&"snorm8"!==s&&"unorm16"!==s&&"snorm16"!==s||3!==t?`${s}${1===t?"":`x${t}`}`:`${s}x3-webgl`}var $e={add:{arity:2,symbol:"arithmetic_add"},subtract:{arity:2,symbol:"arithmetic_subtract"},multiply:{arity:2,symbol:"arithmetic_multiply"},divide:{arity:2,symbol:"arithmetic_divide"},pow:{arity:2,symbol:"pow"},sqrt:{arity:1,symbol:"sqrt"},abs:{arity:1,symbol:"abs"},sin:{arity:1,symbol:"sin"},cos:{arity:1,symbol:"cos"},tan:{arity:1,symbol:"arithmetic_tan"},exp:{arity:1,symbol:"exp"},log:{arity:1,symbol:"log"}};function De(e,{operations:t,inputs:r}){switch(e.kind){case"input":if(!(e.name in r))throw new Error(`Unknown expression input '${e.name}'`);return;case"literal":if(Array.isArray(e.value)){for(const t of e.value)if(!Number.isFinite(t))throw new Error(`Expression literal array must contain only finite values, got ${t}`)}else if(!Number.isFinite(e.value))throw new Error(`Expression literal must be finite, got ${e.value}`);return;case"call":{const s=t[e.op];if(!s)throw new Error(`Unknown expression op '${e.op}'`);if(e.args.length!==s.arity)throw new Error(`Expression op '${e.op}' expects ${s.arity} args, got ${e.args.length}`);for(const i of e.args)De(i,{operations:t,inputs:r});return}default:throw new Error(`Unsupported expression node ${e.kind}`)}}function Ue(e,t){return De(e,t),Oe(e,t)}function Oe(e,t){switch(e.kind){case"input":{const r=t.inputs[e.name];return t.laneIndex<r.size?t.formatInput(e.name):t.formatOutOfBoundsInput(e.name)}case"literal":return t.formatLiteral(e.value);case"call":{const r=t.operations[e.op],s=e.args.map(e=>Oe(e,t));return t.formatCall(r.symbol,s)}default:throw new Error(`Unsupported expression node ${e.kind}`)}}export{m as C,w as S,G as _,ve as a,P as b,te as c,H as d,j as f,z as g,M as h,Be as i,ee as l,x as m,$e as n,me as o,R as p,_e as r,Q as s,Ue as t,re as u,U as v,p as w,v as x,D as y};
@@ -0,0 +1,2 @@
1
+ /*! Web-kit v1.2.0-develop.11 | (c) 2026 MapVX */
2
+ !function(){try{var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="56b1e3c0-acca-4555-8551-98f6a77e7c06",t._sentryDebugIdIdentifier="sentry-dbid-56b1e3c0-acca-4555-8551-98f6a77e7c06")}catch(t){}}();import{$ as t,C as e,Ct as n,Dt as i,E as r,G as s,J as a,K as o,Ot as h,Pt as c,Q as u,R as g,T as l,Tt as f,W as m,X as d,Y as p,Z as y,_t as w,at as M,b,bn as x,dt as k,ft as v,ht as I,it as E,jt as T,kt as j,lt as U,mt as D,ot as S,q as P,rt as L,st as R,ut as A,v as q,vt as B,wt as _,yn as z}from"./debug-hooks-A7fGcVSJ.js";var C=globalThis.loaders?.parseImageNode,Z="undefined"!=typeof Image,O="undefined"!=typeof ImageBitmap,N=!!z||Boolean(C);function G(t){const e=function(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&t instanceof Image?"image":t&&"object"==typeof t&&t.data&&t.width&&t.height?"data":null}(t);if(!e)throw new Error("Not an image");return e}function V(t){switch(G(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("getImageData");return e.width=t.width,e.height=t.height,n.drawImage(t,0,0),n.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}var F=/^data:image\/svg\+xml/,Y=/\.svg((\?|#).*)?$/;function X(t){return t&&(F.test(t)||Y.test(t))}function $(t,e){if(X(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function H(t,e,n){const i=function(t,e){if(X(e)){let e=(new TextDecoder).decode(t);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(e=unescape(encodeURIComponent(e)))}catch(n){throw new Error(n.message)}return`data:image/svg+xml;base64,${btoa(e)}`}return $(t,e)}(t,n),r=self.URL||self.webkitURL,s="string"!=typeof i&&r.createObjectURL(i);try{return await async function(t,e){const n=new Image;if(n.src=t,e.image&&e.image.decode&&n.decode)return await n.decode(),n;return await new Promise((t,e)=>{try{n.onload=()=>t(n),n.onerror=t=>{const n=t instanceof Error?t.message:"error";e(new Error(n))}}catch(i){e(i)}})}(s||i,e)}finally{s&&r.revokeObjectURL(s)}}var Q=!0;async function W(t,e,n){let i;i=X(n)?await H(t,e,n):$(t,n);const r=e&&e.imagebitmap;return await async function(t,e=null){!function(t){if(!t)return!0;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e)&&Q||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(n){console.warn(n),Q=!1}return await createImageBitmap(t)}(i,r)}function J(t){return function(t,e,n=0){const i=(r=e,[...r].map(t=>t.charCodeAt(0)));var r;for(let s=0;s<i.length;++s)if(i[s]!==t[s+n])return!1;return!0}(t,"ftyp",4)&&96&t[8]?function(t){switch((e=t,n=8,i=12,String.fromCharCode(...e.slice(n,i))).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}var e,n,i}(t):null}var K=!1,tt=!0;function et(t){const e=nt(t);return function(t){const e=nt(t);return e.byteLength>=24&&2303741511===e.getUint32(0,K)?{mimeType:"image/png",width:e.getUint32(16,K),height:e.getUint32(20,K)}:null}(e)||function(t){const e=nt(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,K)&&255===e.getUint8(2)))return null;const{tableMarkers:n,sofMarkers:i}=function(){const t=/* @__PURE__ */new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);return{tableMarkers:t,sofMarkers:/* @__PURE__ */new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}();let r=2;for(;r+9<e.byteLength;){const t=e.getUint16(r,K);if(i.has(t))return{mimeType:"image/jpeg",height:e.getUint16(r+5,K),width:e.getUint16(r+7,K)};if(!n.has(t))return null;r+=2,r+=e.getUint16(r,K)}return null}(e)||function(t){const e=nt(t);return e.byteLength>=10&&1195984440===e.getUint32(0,K)?{mimeType:"image/gif",width:e.getUint16(6,tt),height:e.getUint16(8,tt)}:null}(e)||function(t){const e=nt(t);return e.byteLength>=14&&16973===e.getUint16(0,K)&&e.getUint32(2,tt)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,tt),height:e.getUint32(22,tt)}:null}(e)||function(t){const e=new Uint8Array(t instanceof DataView?t.buffer:t),n=J(e);return n?{mimeType:n.mimeType,width:0,height:0}:null}(e)}function nt(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}var it,rt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:"4.5.4",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],parse:async function(t,e,n){const i=((e=e||{}).image||{}).type||"auto",{url:r}=n||{};let s;switch(function(t){switch(t){case"auto":case"data":return function(){if(O)return"imagebitmap";if(Z)return"image";if(N)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return O||Z||N;case"imagebitmap":return O;case"image":return Z;case"data":return N;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}(t),t}}(i)){case"imagebitmap":s=await W(t,e,r);break;case"image":s=await H(t,e,r);break;case"data":s=await async function(t){const{mimeType:e}=et(t)||{},n=globalThis.loaders?.parseImageNode;return x(n),await n(t,e)}(t);break;default:x(!1)}return"data"===i&&(s=V(s)),s},tests:[t=>Boolean(et(new DataView(t)))],options:{image:{type:"auto",decode:!0}}},st=class t extends f{static get ZERO(){return it||(it=new t(0,0,0,0),Object.freeze(it)),it}constructor(t=0,e=0,n=0,r=0){super(-0,-0,-0,-0),c(t)&&1===arguments.length?this.copy(t):(T.debug&&(i(t),i(e),i(n),i(r)),this[0]=t,this[1]=e,this[2]=n,this[3]=r)}set(t,e,n,i){return this[0]=t,this[1]=e,this[2]=n,this[3]=i,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return T.debug&&(i(t.x),i(t.y),i(t.z),i(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=i(t)}get w(){return this[3]}set w(t){this[3]=i(t)}transform(t){return D(this,this,t),this.check()}transformByMatrix3(t){return B(this,this,t),this.check()}transformByMatrix2(t){return w(this,this,t),this.check()}transformByQuaternion(t){return I(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};function at(t,e){if(t===e){const n=e[1],i=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=i,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function ot(t,e){const n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],h=e[6],c=e[7],u=e[8],g=u*a-o*c,l=-u*s+o*h,f=c*s-a*h;let m=n*g+i*l+r*f;return m?(m=1/m,t[0]=g*m,t[1]=(-u*i+r*c)*m,t[2]=(o*i-r*a)*m,t[3]=l*m,t[4]=(u*n-r*h)*m,t[5]=(-o*n+r*s)*m,t[6]=f*m,t[7]=(-c*n+i*h)*m,t[8]=(a*n-i*s)*m,t):null}function ht(t){const e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],h=t[7],c=t[8];return e*(c*s-a*h)+n*(-c*r+a*o)+i*(h*r-s*o)}function ct(t,e,n){const i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],h=e[5],c=e[6],u=e[7],g=e[8],l=n[0],f=n[1],m=n[2],d=n[3],p=n[4],y=n[5],w=n[6],M=n[7],b=n[8];return t[0]=l*i+f*a+m*c,t[1]=l*r+f*o+m*u,t[2]=l*s+f*h+m*g,t[3]=d*i+p*a+y*c,t[4]=d*r+p*o+y*u,t[5]=d*s+p*h+y*g,t[6]=w*i+M*a+b*c,t[7]=w*r+M*o+b*u,t[8]=w*s+M*h+b*g,t}function ut(t,e,n){const i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],h=e[5],c=e[6],u=e[7],g=e[8],l=n[0],f=n[1];return t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=o,t[5]=h,t[6]=l*i+f*a+c,t[7]=l*r+f*o+u,t[8]=l*s+f*h+g,t}function gt(t,e,n){const i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],h=e[5],c=e[6],u=e[7],g=e[8],l=Math.sin(n),f=Math.cos(n);return t[0]=f*i+l*a,t[1]=f*r+l*o,t[2]=f*s+l*h,t[3]=f*a-l*i,t[4]=f*o-l*r,t[5]=f*h-l*s,t[6]=c,t[7]=u,t[8]=g,t}function lt(t,e,n){const i=n[0],r=n[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=r*e[3],t[4]=r*e[4],t[5]=r*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function ft(t,e){const n=e[0],i=e[1],r=e[2],s=e[3],a=n+n,o=i+i,h=r+r,c=n*a,u=i*a,g=i*o,l=r*a,f=r*o,m=r*h,d=s*a,p=s*o,y=s*h;return t[0]=1-g-m,t[3]=u-y,t[6]=l+p,t[1]=u+y,t[4]=1-c-m,t[7]=f-d,t[2]=l-p,t[5]=f+d,t[8]=1-c-g,t}function mt(){const t=new n(4);return n!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function dt(t,e,n){n*=.5;const i=Math.sin(n);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n),t}function pt(t,e,n){const i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],h=n[1],c=n[2],u=n[3];return t[0]=i*u+a*o+r*c-s*h,t[1]=r*u+a*h+s*o-i*c,t[2]=s*u+a*c+i*h-r*o,t[3]=a*u-i*o-r*h-s*c,t}function yt(t,e,n,i){const r=e[0],s=e[1],a=e[2],o=e[3];let h,c,u,g,l,f=n[0],m=n[1],d=n[2],p=n[3];return h=r*f+s*m+a*d+o*p,h<0&&(h=-h,f=-f,m=-m,d=-d,p=-p),1-h>1e-6?(c=Math.acos(h),l=Math.sin(c),u=Math.sin((1-i)*c)/l,g=Math.sin(i*c)/l):(u=1-i,g=i),t[0]=u*r+g*f,t[1]=u*s+g*m,t[2]=u*a+g*d,t[3]=u*o+g*p,t}function wt(t,e){const n=e[0]+e[4]+e[8];let i;if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);const r=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[3*n+n]-e[3*r+r]-e[3*s+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[3*r+s]-e[3*s+r])*i,t[r]=(e[3*r+n]+e[3*n+r])*i,t[s]=(e[3*s+n]+e[3*n+s])*i}return t}var Mt=s,bt=d,xt=o,kt=a,vt=P,It=y,Et=p,Tt=function(){const t=L(),e=S(1,0,0),n=S(0,1,0);return function(i,r,s){const a=M(r,s);return a<-.999999?(E(t,e,r),R(t)<1e-6&&E(t,n,r),A(t,t),dt(i,t,Math.PI),i):a>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(E(t,r,s),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+a,Et(i,i))}}(),jt=(function(){const t=mt(),e=mt()}(),function(){const t=function(){const t=new n(9);return n!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}()}(),[0,0,0,1]),Ut=class extends j{constructor(t=0,e=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,n,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,n,i){return this[0]=t,this[1]=e,this[2]=n,this[3]=i,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return wt(this,t),this.check()}fromAxisRotation(t,e){return dt(this,t,e),this.check()}identity(){var t;return(t=this)[0]=0,t[1]=0,t[2]=0,t[3]=1,this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=i(t)}get y(){return this[1]}set y(t){this[1]=i(t)}get z(){return this[2]}set z(t){this[2]=i(t)}get w(){return this[3]}set w(t){this[3]=i(t)}len(){return vt(this)}lengthSquared(){return It(this)}dot(t){return xt(this,t)}rotationTo(t,e){return Tt(this,t,e),this.check()}add(t){return Mt(this,this,t),this.check()}calculateW(){return function(t,e){const n=e[0],i=e[1],r=e[2];t[0]=n,t[1]=i,t[2]=r,t[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r))}(this,this),this.check()}conjugate(){var t,e;return e=this,(t=this)[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],this.check()}invert(){return function(t,e){const n=e[0],i=e[1],r=e[2],s=e[3],a=n*n+i*i+r*r+s*s,o=a?1/a:0;t[0]=-n*o,t[1]=-i*o,t[2]=-r*o,t[3]=s*o}(this,this),this.check()}lerp(t,e,n){return void 0===n?this.lerp(this,t,e):(kt(this,t,e,n),this.check())}multiplyRight(t){return pt(this,this,t),this.check()}multiplyLeft(t){return pt(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,n){n*=.5;const i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),h=Math.cos(n);t[0]=i*h+a*o,t[1]=r*h+s*o,t[2]=s*h-r*o,t[3]=a*h-i*o}(this,this,t),this.check()}rotateY(t){return function(t,e,n){n*=.5;const i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),h=Math.cos(n);t[0]=i*h-s*o,t[1]=r*h+a*o,t[2]=s*h+i*o,t[3]=a*h-r*o}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){n*=.5;const i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),h=Math.cos(n);t[0]=i*h+r*o,t[1]=r*h-i*o,t[2]=s*h+a*o,t[3]=a*h-s*o}(this,this,t),this.check()}scale(t){return bt(this,this,t),this.check()}slerp(t,e,n){let i,r,s;switch(arguments.length){case 1:({start:i=jt,target:r,ratio:s}=t);break;case 2:i=this,r=t,s=e;break;default:i=t,r=e,s=n}return yt(this,i,r,s),this.check()}transformVector4(e,n=new st){return t(n,e,this),h(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}},Dt=Math.PI/180,St=180/Math.PI,Pt=6370972;function Lt(){const t=256/Pt,e=Math.PI/180*256;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[24886.609375,24886.609375,24886.609375],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,24886.609375]}}var Rt=class extends q{constructor(t={}){const{longitude:n=0,bearing:i=0,pitch:s=0,zoom:a=0,nearZMultiplier:o=.5,farZMultiplier:h=1,resolution:c=10}=t;let{latitude:u=0,height:g,altitude:f=1.5,fovy:d}=t;u=Math.max(Math.min(u,90),-90),g=g||1,d?f=r(d):d=l(f);const p=Math.max(Math.min(u,e),-e),y=Math.pow(2,a-At(p)),w=s*Dt,M=t.nearZ??o,b=t.farZ??(f+512*y/g/Math.max(Math.cos(w),.1))*h,x=(new m).lookAt({eye:[0,-f,0],up:[0,0,1]}).rotateX(-w).rotateY(-i*Dt).rotateX(u*Dt).rotateZ(-n*Dt).scale(y/g);super({...t,height:g,viewMatrix:x,longitude:n,latitude:u,zoom:a,distanceScales:Lt(),fovy:d,focalDistance:f,near:M,far:b}),this.scale=y,this.latitude=u,this.longitude=n,this.bearing=i,this.pitch=s,this.fovy=d,this.resolution=c}get projectionMode(){return g.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(t={}){const e={targetZ:t.z||0},n=this.unproject([0,this.height/2],e),i=this.unproject([this.width/2,0],e),r=this.unproject([this.width,this.height/2],e),s=this.unproject([this.width/2,this.height],e);return r[0]<this.longitude&&(r[0]+=360),n[0]>this.longitude&&(n[0]-=360),[Math.min(n[0],r[0],i[0],s[0]),Math.min(n[1],r[1],i[1],s[1]),Math.max(n[0],r[0],i[0],s[0]),Math.max(n[1],r[1],i[1],s[1])]}_getRayToGlobe(t,{topLeft:e=!0,targetZ:n}={}){const[i,r]=t,s=e?r:this.height-r,{pixelUnprojectionMatrix:a}=this,o=qt(a,[i,s,-1,1]),h=qt(a,[i,s,1,1]),c=256*((n||0)/Pt+1),u=k(v([],o,h)),g=k(o),l=k(h);return{rayStartPosition:o,rayEndPosition:h,radius:c,rayLengthSquared:u,rayStartDistanceSquared:g,distanceToCenterSquared:(4*g*l-(u-g-l)**2)/16*4/u}}_getRayDistanceToGlobeCenterRatio(t,e){const{distanceToCenterSquared:n,radius:i}=this._getRayToGlobe(t,e);return Math.sqrt(Math.max(0,n))/i}getZoomAnchorStrength(t){const e=this._getRayDistanceToGlobeCenterRatio(t);return e>1.15?0:1-.65*Math.max(0,Math.min(1,(e-.75)/.25))}unproject(t,{topLeft:e=!0,targetZ:n}={}){const[i,r,s]=t,a=e?r:this.height-r,{pixelUnprojectionMatrix:o}=this;let h;if(Number.isFinite(s))h=qt(o,[i,a,s,1]);else{const{rayStartPosition:i,rayEndPosition:r,radius:s,rayLengthSquared:a,rayStartDistanceSquared:o,distanceToCenterSquared:c}=this._getRayToGlobe(t,{topLeft:e,targetZ:n}),u=(Math.sqrt(o-c)-Math.sqrt(Math.max(0,s*s-c)))/Math.sqrt(a);h=U([],i,r,u)}const[c,u,g]=this.unprojectPosition(h);return Number.isFinite(s)?[c,u,g]:Number.isFinite(n)?[c,u,n]:[c,u]}projectPosition(t){const[e,n,i=0]=t,r=e*Dt,s=n*Dt,a=Math.cos(s),o=256*(i/Pt+1);return[Math.sin(r)*a*o,-Math.cos(r)*a*o,Math.sin(s)*o]}unprojectPosition(t){const[e,n,i]=t,r=R(t),s=Math.asin(i/r);return[Math.atan2(e,-n)*St,s*St,(r/256-1)*Pt]}projectFlat(t){return t}unprojectFlat(t){return t}panByPosition(t,e,n){if(!n){const n=this.getZoomAnchorStrength(e);if(0===n)return{longitude:this.longitude,latitude:this.latitude};const i=this.unproject(e),r=b(t[0]-i[0]+180,360)-180;return{longitude:this.longitude+r*n,latitude:Math.max(Math.min(this.latitude+(t[1]-i[1])*n,90),-90)}}const[i,r,s]=t,a=.25/Math.pow(2,this.zoom-At(this.latitude)),o=i+a*(n[0]-e[0]);let h=r-a*(n[1]-e[1]);h=Math.max(Math.min(h,90),-90);const c={longitude:o,latitude:h,zoom:s-At(r)};return c.zoom+=At(c.latitude),c}};function At(t,n){n&&(t=Math.max(Math.min(t,e),-e));const i=Math.PI*Math.cos(t*Math.PI/180);return Math.log2(i)}function qt(t,e){const n=u([],e,t);return d(n,n,1/n[3]),n}Rt.displayName="GlobeViewport";export{ft as a,gt as c,at as d,rt as f,ht as i,lt as l,V as m,At as n,ot as o,et as p,Ut as r,ct as s,Rt as t,ut as u};
@@ -0,0 +1,2 @@
1
+ /*! Web-kit v1.2.0-develop.11 | (c) 2026 MapVX */
2
+ !function(){try{var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ee02b527-5f08-4480-a004-1fb48ecafc03",e._sentryDebugIdIdentifier="sentry-dbid-ee02b527-5f08-4480-a004-1fb48ecafc03")}catch(e){}}();var e="data:image/svg+xml,%3csvg%20width='22'%20height='22'%20viewBox='0%200%2022%2022'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='11'%20cy='11'%20r='11'%20fill='%23E7F1F7'/%3e%3ccircle%20cx='11.0002'%20cy='10.9999'%20r='6.61538'%20fill='%23396FE5'%20stroke='white'%20stroke-width='2'/%3e%3c/svg%3e";export{e as default};
@@ -0,0 +1,2 @@
1
+ /*! Web-kit v1.2.0-develop.11 | (c) 2026 MapVX */
2
+ !function(){try{var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},b=(new a.Error).stack;b&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[b]="8b7a1e33-2374-44de-a974-d4d861f38f1f",a._sentryDebugIdIdentifier="sentry-dbid-8b7a1e33-2374-44de-a974-d4d861f38f1f")}catch(a){}}();var a=function(){var a=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),b=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var c,e=WebAssembly.validate(a)?d("b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaocwffagRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbahaocdffagRb:q:W:cjbfhokalcdfhlaiczfgiaQ6mbkkaohAaoTmoka8EaQfh8Ea5cefg5cl9hmbkdndndndnawTmbaza8Acd4fRbbglciGPlbedwbkaQTmdavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep9Ta8Fpxeeeeeeeeeeeeeeeegap9op9Hp9rg8Fa8Jp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ugap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp9Ugap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp9Ugap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9AbbbaladfhlaoczfgoaQ6mbxikkaQTmeavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep:nea8Fpxebebebebebebebebgap9op:bep9rg8Fa8Jp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oegap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp:oegap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp:oegap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9AbbbaladfhlaoczfgoaQ6mbxdkkaQTmbcbhocbalcl4gl9Rc8FGhiavcjdfa8Afhrava8Afpbdbhainaravcj;cbfaofpblbg8JaYaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaLaofpblbg8MaKaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Faap9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8LaypmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb"):d("b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb"),i=WebAssembly.instantiate(e,{}).then(function(a){(c=a.instance).exports.__wasm_call_ctors()});function d(a){for(var c=new Uint8Array(a.length),e=0;e<a.length;++e){var i=a.charCodeAt(e);c[e]=i>96?i-97:i>64?i-39:i+4}var d=0;for(e=0;e<a.length;++e)c[d++]=c[e]<60?b[c[e]]:64*(c[e]-60)+c[++e];return c.buffer.slice(0,d)}function p(a,b,c,e,i,d,p){var g=a.exports.sbrk,f=e+3&-4,h=g(f*i),l=g(d.length),o=new Uint8Array(a.exports.memory.buffer);o.set(d,l);var s=b(h,e,i,l,d.length);if(0==s&&p&&p(h,f,i),c.set(o.subarray(h,h+e*i)),g(h-g(0)),0!=s)throw new Error("Malformed buffer data: "+s)}var g={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},f={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},h=[],l=0;function o(a){var b={object:new Worker(a),pending:0,requests:{}};return b.object.onmessage=function(a){var c=a.data;b.pending-=c.count,b.requests[c.id][c.action](c.value),delete b.requests[c.id]},b}function s(a){var b=a.data;self.ready.then(function(a){if(!b.id)return self.close();try{var c=new Uint8Array(b.count*b.size);p(a,a.exports[b.mode],c,b.count,b.size,b.source,a.exports[b.filter]),self.postMessage({id:b.id,count:b.count,action:"resolve",value:c},[c.buffer])}catch(e){self.postMessage({id:b.id,count:b.count,action:"reject",value:e})}})}return{ready:i,supported:!0,useWorkers:function(a){!function(a){for(var b="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(e)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+s.name+";"+p.toString()+s.toString(),c=new Blob([b],{type:"text/javascript"}),i=URL.createObjectURL(c),d=h.length;d<a;++d)h[d]=o(i);for(d=a;d<h.length;++d)h[d].object.postMessage({});h.length=a,URL.revokeObjectURL(i)}(a)},decodeVertexBuffer:function(a,b,e,i,d){p(c,c.exports.meshopt_decodeVertexBuffer,a,b,e,i,c.exports[g[d]])},decodeIndexBuffer:function(a,b,e,i){p(c,c.exports.meshopt_decodeIndexBuffer,a,b,e,i)},decodeIndexSequence:function(a,b,e,i){p(c,c.exports.meshopt_decodeIndexSequence,a,b,e,i)},decodeGltfBuffer:function(a,b,e,i,d,h){p(c,c.exports[f[d]],a,b,e,i,c.exports[g[h]])},decodeGltfBufferAsync:function(a,b,e,d,o){return h.length>0?function(a,b,c,e,i){for(var d=h[0],p=1;p<h.length;++p)h[p].pending<d.pending&&(d=h[p]);return new Promise(function(p,g){var f=new Uint8Array(c),h=++l;d.pending+=a,d.requests[h]={resolve:p,reject:g},d.object.postMessage({id:h,count:a,size:b,source:f,mode:e,filter:i},[f.buffer])})}(a,b,e,f[d],g[o]):i.then(function(){var i=new Uint8Array(a*b);return p(c,c.exports[f[d]],i,a,b,e,c.exports[g[o]]),i})}}}();export{a as MeshoptDecoder};