@arcgis/core 6.0.0-next.36 → 6.0.0-next.37

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 (163) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0202eb8c2b2865f99981.js → 00311d1b18d5952a014b.js} +1 -1
  3. package/assets/esri/core/workers/chunks/0b21d0e2e5a91c34a108.js +1 -0
  4. package/assets/esri/core/workers/chunks/{f717005e14a7e9141df7.js → 2050c844b5a29b1df28a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2c3612379111457c3221.js +1 -0
  6. package/assets/esri/core/workers/chunks/2f9072563194026e320e.js +1 -0
  7. package/assets/esri/core/workers/chunks/{d9a240a3c6bf85124474.js → 342a97974a78007b25e0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/34467f7d84baffd772a3.js +1 -0
  9. package/assets/esri/core/workers/chunks/{4d18b48d4a282a0f341c.js → 427d929dc7f89b0a1ea9.js} +1 -1
  10. package/assets/esri/core/workers/chunks/432728c557be5dfa26b5.js +1 -0
  11. package/assets/esri/core/workers/chunks/46969f379623810b2eca.js +1 -0
  12. package/assets/esri/core/workers/chunks/592b5db1459c02cf6a0c.js +1 -0
  13. package/assets/esri/core/workers/chunks/6a21dc13a465757ba007.js +1 -0
  14. package/assets/esri/core/workers/chunks/{379db67f78161ebd5468.js → 7023651ed6398dcf8efb.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{90360c0bd053d3e3fd77.js → 7027a0e7bfabb3bb7fc2.js} +1 -1
  16. package/assets/esri/core/workers/chunks/78818c2a898444f7e890.js +1 -0
  17. package/assets/esri/core/workers/chunks/{40c2674dae73f0942751.js → 7d497df6e13162156342.js} +1 -1
  18. package/assets/esri/core/workers/chunks/8a3dfe997712dc2ddead.js +1 -0
  19. package/assets/esri/core/workers/chunks/{81bcc495e6eaf2cf7474.js → 8f82a0a6747f673a2a7e.js} +1 -1
  20. package/assets/esri/core/workers/chunks/9826baa3c15ea2062669.js +1 -0
  21. package/assets/esri/core/workers/chunks/{d3369ffed19f4c264dcd.js → 9ab0735e86cf8932bf9d.js} +1 -1
  22. package/assets/esri/core/workers/chunks/ab0ea4042f4e13874aed.js +1 -0
  23. package/assets/esri/core/workers/chunks/ab98ade3257360015d6c.js +1 -0
  24. package/assets/esri/core/workers/chunks/{796c6195b6bf59dcc9bd.js → b25a05c58b0fd0f6ac60.js} +1 -1
  25. package/assets/esri/core/workers/chunks/b90271ce38522bcf813b.js +1 -0
  26. package/assets/esri/core/workers/chunks/ba91df9835cdea7698a9.js +1 -0
  27. package/assets/esri/core/workers/chunks/bfe13ac9fa1aafb190a1.js +1 -0
  28. package/assets/esri/core/workers/chunks/ce0274847ccce6a1ac53.js +1 -0
  29. package/assets/esri/core/workers/chunks/cf2e5f827cea7d7319ce.js +1 -0
  30. package/assets/esri/core/workers/chunks/dae2036faa28dade2119.js +1 -0
  31. package/assets/esri/core/workers/chunks/{e8fb2ba7b7a4f0916325.js → eed4b90494a54f8b337b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/fc77eb7683e708774168.js +1 -0
  33. package/chunks/Clouds.glsl.js +7 -11
  34. package/config.js +1 -1
  35. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  36. package/kernel.js +1 -1
  37. package/layers/BaseElevationLayer.js +1 -1
  38. package/layers/ElevationLayer.js +1 -1
  39. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  40. package/layers/IntegratedMeshLayer.d.ts +2 -0
  41. package/layers/IntegratedMeshLayer.js +1 -1
  42. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  43. package/layers/support/ElevationQuery.js +1 -1
  44. package/layers/video/VideoController.js +3 -3
  45. package/layers/video/types.d.ts +12 -0
  46. package/package.json +3 -3
  47. package/views/2d/engine/Bitmap.js +1 -1
  48. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  49. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  50. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  51. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  52. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  53. package/views/2d/engine/webgl/Overlay.js +1 -1
  54. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  55. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  56. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  57. package/views/2d/engine/webgl/animations/store/AnimationStore.js +1 -1
  58. package/views/2d/engine/webgl/collisions/LabelStore.js +1 -1
  59. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  60. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  61. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  62. package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
  63. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  64. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
  66. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  67. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  68. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  69. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  70. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
  71. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTexture.js +1 -1
  72. package/views/2d/engine/webgl/textureUtils.js +1 -1
  73. package/views/2d/layers/LayerView2D.js +1 -1
  74. package/views/2d/webglDeps.js +1 -1
  75. package/views/3d/GroundView3D.js +1 -1
  76. package/views/3d/input/SceneInputManager.js +1 -1
  77. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  78. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  79. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  80. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  81. package/views/3d/support/engineContent/line.js +1 -1
  82. package/views/3d/support/engineContent/marker.js +1 -1
  83. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  84. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  85. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  86. package/views/3d/support/flow/geometryUtils.js +1 -1
  87. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  88. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  89. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  90. package/views/3d/support/gaussianSplatting/GaussianTileBuilder.js +2 -0
  91. package/views/3d/support/gaussianSplatting/formatConstants.js +2 -0
  92. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  93. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  94. package/views/3d/terrain/OverlayRenderer.js +1 -1
  95. package/views/3d/terrain/TerrainRenderer.js +1 -1
  96. package/views/3d/terrain/TerrainSurface.js +1 -1
  97. package/views/3d/terrain/TileCompositor.js +1 -1
  98. package/views/3d/terrain/TileRenderer.js +1 -1
  99. package/views/3d/webgl/RenderNode.d.ts +1 -1
  100. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  101. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  102. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  103. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +15 -11
  104. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
  105. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  106. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
  107. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  108. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  109. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  110. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  111. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  112. package/views/3d/webgl-engine/lib/AttributeView.js +1 -1
  113. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  114. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  115. package/views/3d/webgl-engine/lib/DDSUtil.js +1 -1
  116. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  117. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  118. package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
  119. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  120. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  121. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  122. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  123. package/views/3d/webgl-engine/lib/VerticesView.js +2 -0
  124. package/views/3d/webgl-engine/lib/attributeViewUtils.js +1 -1
  125. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  126. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  127. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  128. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  129. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  130. package/views/3d/webgl-engine/materials/internal/lineMarkerBufferUtils.js +2 -0
  131. package/views/3d/webgl-engine/materials/internal/ribbonLineBufferUtils.js +2 -0
  132. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  133. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  134. package/views/draw/support/ManagedTooltipField.js +1 -1
  135. package/views/support/TextureCompressionHelper.js +1 -1
  136. package/views/support/imageReprojection.js +1 -1
  137. package/views/webgl/FramebufferObject.js +1 -1
  138. package/views/webgl/RenderingContext.js +1 -1
  139. package/views/webgl/Texture.js +1 -1
  140. package/views/webgl/rasterUtils.js +1 -1
  141. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  142. package/views/webgl/textureUtils.js +1 -1
  143. package/widgets/ScaleRangeSlider/types.d.ts +3 -3
  144. package/assets/esri/core/workers/chunks/039d9bc5b5015012f811.js +0 -1
  145. package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +0 -1
  146. package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +0 -1
  147. package/assets/esri/core/workers/chunks/29c610ce1c81ebb84a6b.js +0 -1
  148. package/assets/esri/core/workers/chunks/3223f9fbc76ba9ef8d13.js +0 -1
  149. package/assets/esri/core/workers/chunks/3fdcc383bbd9cf0d274c.js +0 -1
  150. package/assets/esri/core/workers/chunks/46c290108a90518ef695.js +0 -1
  151. package/assets/esri/core/workers/chunks/48b8b57f559a53c6c513.js +0 -1
  152. package/assets/esri/core/workers/chunks/4a979fce1c971b614a18.js +0 -1
  153. package/assets/esri/core/workers/chunks/5bd1414220e42cb8ebcf.js +0 -1
  154. package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +0 -1
  155. package/assets/esri/core/workers/chunks/723df53cfa0189837d01.js +0 -1
  156. package/assets/esri/core/workers/chunks/7400b8c454b47ee4fb3c.js +0 -1
  157. package/assets/esri/core/workers/chunks/7af4edc6e87d27b9d467.js +0 -1
  158. package/assets/esri/core/workers/chunks/990e96139b5a1dccb061.js +0 -1
  159. package/assets/esri/core/workers/chunks/a607541959169741a943.js +0 -1
  160. package/assets/esri/core/workers/chunks/aa779896fd9e5c341349.js +0 -1
  161. package/assets/esri/core/workers/chunks/c131e0dd180a4c10e12e.js +0 -1
  162. package/assets/esri/core/workers/chunks/f3b4159c0722df8ffe13.js +0 -1
  163. package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +0 -1
@@ -1,4 +1,4 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import has from"../../core/has.js";import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{after as n}from"../../core/promiseUtils.js";import{Milliseconds as r}from"../../core/time.js";import{webglDebugEnabled as i,checkWebGLError as a,getErrorMessage as o,webglValidateShadersEnabled as s}from"./checkWebGLError.js";import{ContextState as c}from"./ContextState.js";import{baseTextureUnit as l,DrawBufferBack as u,DrawBufferNone as d,ResourceType as f,ColorAttachment0 as p,PrimitiveType as m}from"./enums.js";import{InstanceCounter as h}from"./InstanceCounter.js";import{Parameters as g}from"./Parameters.js";import{ProgramCache as _}from"./ProgramCache.js";import{StateTracker as v}from"./renderState.js";import y from"./Texture.js";import{WebGLDriverTest as b}from"./WebGLDriverTest.js";import{Capabilities as x}from"./capabilities/Capabilities.js";const S=()=>e.getLogger(`esri.views.webgl.RenderingContext`);let C=class{constructor(e,t){this.gl=e,this.instanceCounter=new h,this._programCache=new _(this),this._transformFeedbackRequestInfo=null,this._state=new c,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=t,this.configure(t)}configure(e){this._options=e,this._capabilities=new x(this.gl,e),this._parameters=new g(this.gl,this._capabilities,e),y.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;let n=this.gl.getParameter(this.gl.VIEWPORT);this._state=new c,this._state.viewport={x:n[0],y:n[1],width:n[2],height:n[3]},this._stateTracker=new v({setBlending:e=>{if(e){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(e.opRgb,e.opAlpha),this.setBlendFunctionSeparate(e.srcRgb,e.dstRgb,e.srcAlpha,e.dstAlpha);let t=e.color;this.setBlendColor(t.r,t.g,t.b,t.a)}else this.setBlendingEnabled(!1)},setCulling:e=>{e?(this.setFaceCullingEnabled(!0),this.setCullFace(e.face),this.setFrontFace(e.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:e=>{e?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(e.factor,e.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:e=>{e?(this.setDepthTestEnabled(!0),this.setDepthFunction(e.func)):this.setDepthTestEnabled(!1)},setStencilTest:e=>{if(e){this.setStencilTestEnabled(!0);let{ref:t,readMask:n,stencilFront:r,stencilBack:i}=e;r.compare===i.compare?this.setStencilFunction(r.compare,t,n):(this.setStencilFunctionSeparate(1028,r.compare,t,n),this.setStencilFunctionSeparate(1029,i.compare,t,n)),r.fail===i.fail&&r.zFail===i.zFail&&r.zPass===i.zPass?this.setStencilOp(r.fail,r.zFail,r.zPass):(this.setStencilOpSeparate(1028,r.fail,r.zFail,r.zPass),this.setStencilOpSeparate(1029,i.fail,i.zFail,i.zPass))}else this.setStencilTestEnabled(!1)},setDepthWrite:e=>{e?(this.setDepthWriteEnabled(!0),this.setDepthRange(e.zNear,e.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:e=>{e?this.setColorMask(e.r,e.g,e.b,e.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:e=>{e?this.setStencilWriteMask(e.mask):this.setStencilWriteMask(0)}}),this.enforceState(),t(this._driverTest),this._driverTest=new b(this)}updateOptions(e){this._options={...this._options,...e},this._parameters=new g(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=t(this._driverTest),this._programCache=t(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this.bindUniformBufferBindingPoints([]),this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state.textureUnitSamplerMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null;let e=i()&&this.instanceCounter.resourceInformation;e&&console.log(e)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(e){this._stateTracker.setPipeline(e)}getPipelineState(){return this._stateTracker.getPipelineState()}setBlendingEnabled(e){this._state.blend!==e&&(e===!0?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=e,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(e,t){for(let t=0;t<e.length;++t){let n=e[t];this._state.textureUnitMap[n]=null,this._state.textureUnitSamplerMap[n]=null}t>=0&&(this._state.activeTexture=t)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(e,t,n,r){(e!==this._state.blendColor.r||t!==this._state.blendColor.g||n!==this._state.blendColor.b||r!==this._state.blendColor.a)&&(this.gl.blendColor(e,t,n,r),this._state.blendColor.r=e,this._state.blendColor.g=t,this._state.blendColor.b=n,this._state.blendColor.a=r,this._stateTracker.invalidateBlending())}setBlendFunction(e,t){(e!==this._state.blendFunction.srcRGB||t!==this._state.blendFunction.dstRGB)&&(this.gl.blendFunc(e,t),this._state.blendFunction.srcRGB=e,this._state.blendFunction.srcAlpha=e,this._state.blendFunction.dstRGB=t,this._state.blendFunction.dstAlpha=t,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(e,t,n,r){(this._state.blendFunction.srcRGB!==e||this._state.blendFunction.srcAlpha!==n||this._state.blendFunction.dstRGB!==t||this._state.blendFunction.dstAlpha!==r)&&(this.gl.blendFuncSeparate(e,t,n,r),this._state.blendFunction.srcRGB=e,this._state.blendFunction.srcAlpha=n,this._state.blendFunction.dstRGB=t,this._state.blendFunction.dstAlpha=r,this._stateTracker.invalidateBlending())}setBlendEquation(e){this._state.blendEquation.mode!==e&&(this.gl.blendEquation(e),this._state.blendEquation.mode=e,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(e,t){(this._state.blendEquation.mode!==e||this._state.blendEquation.modeAlpha!==t)&&(this.gl.blendEquationSeparate(e,t),this._state.blendEquation.mode=e,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setColorMask(e,t,n,r){(this._state.colorMask.r!==e||this._state.colorMask.g!==t||this._state.colorMask.b!==n||this._state.colorMask.a!==r)&&(this.gl.colorMask(e,t,n,r),this._state.colorMask.r=e,this._state.colorMask.g=t,this._state.colorMask.b=n,this._state.colorMask.a=r,this._stateTracker.invalidateColorWrite())}setClearColor(e,t,n,r){(this._state.clearColor.r!==e||this._state.clearColor.g!==t||this._state.clearColor.b!==n||this._state.clearColor.a!==r)&&(this.gl.clearColor(e,t,n,r),this._state.clearColor.r=e,this._state.clearColor.g=t,this._state.clearColor.b=n,this._state.clearColor.a=r)}setFaceCullingEnabled(e){this._state.faceCulling!==e&&(e===!0?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=e,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(e){this._state.polygonOffsetFill!==e&&(e===!0?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=e,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(e,t){(this._state.polygonOffset[0]!==e||this._state.polygonOffset[1]!==t)&&(this._state.polygonOffset[0]=e,this._state.polygonOffset[1]=t,this.gl.polygonOffset(e,t),this._stateTracker.invalidatePolygonOffset())}setCullFace(e){this._state.cullFace!==e&&(this.gl.cullFace(e),this._state.cullFace=e,this._stateTracker.invalidateCulling())}setFrontFace(e){this._state.frontFace!==e&&(this.gl.frontFace(e),this._state.frontFace=e,this._stateTracker.invalidateCulling())}setScissorTestEnabled(e){this._state.scissorTest!==e&&(e===!0?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=e)}setScissorRect(e,t,n,r){(this._state.scissorRect.x!==e||this._state.scissorRect.y!==t||this._state.scissorRect.width!==n||this._state.scissorRect.height!==r)&&(this.gl.scissor(e,t,n,r),this._state.scissorRect.x=e,this._state.scissorRect.y=t,this._state.scissorRect.width=n,this._state.scissorRect.height=r)}setDepthTestEnabled(e){this._state.depthTest!==e&&(e===!0?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=e,this._stateTracker.invalidateDepthTest())}setClearDepth(e){this._state.clearDepth!==e&&(this.gl.clearDepth(e),this._state.clearDepth=e)}setDepthFunction(e){this._state.depthFunction!==e&&(this.gl.depthFunc(e),this._state.depthFunction=e,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(e){this._state.depthWrite!==e&&(this.gl.depthMask(e),this._state.depthWrite=e,this._stateTracker.invalidateDepthWrite())}setDepthRange(e,t){(this._state.depthRange.zNear!==e||this._state.depthRange.zFar!==t)&&(this.gl.depthRange(e,t),this._state.depthRange.zNear=e,this._state.depthRange.zFar=t,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(e){this._state.stencilTest!==e&&(e===!0?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=e,this._stateTracker.invalidateStencilTest())}setClearStencil(e){e!==this._state.clearStencil&&(this.gl.clearStencil(e),this._state.clearStencil=e)}setStencilFunction(e,t,n){(this._state.stencilFunction.face!==1032||this._state.stencilFunction.func!==e||this._state.stencilFunction.ref!==t||this._state.stencilFunction.mask!==n)&&(this.gl.stencilFunc(e,t,n),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=t,this._state.stencilFunction.mask=n,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(e,t,n,r){(this._state.stencilFunction.face!==e||this._state.stencilFunction.func!==t||this._state.stencilFunction.ref!==n||this._state.stencilFunction.mask!==r)&&(this.gl.stencilFuncSeparate(e,t,n,r),this._state.stencilFunction.face=e,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=n,this._state.stencilFunction.mask=r,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(e){this._state.stencilWriteMask!==e&&(this.gl.stencilMask(e),this._state.stencilWriteMask=e,this._stateTracker.invalidateStencilWrite())}setStencilOp(e,t,n){(this._state.stencilOperation.face!==1032||this._state.stencilOperation.fail!==e||this._state.stencilOperation.zFail!==t||this._state.stencilOperation.zPass!==n)&&(this.gl.stencilOp(e,t,n),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=t,this._state.stencilOperation.zPass=n,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(e,t,n,r){(this._state.stencilOperation.face!==e||this._state.stencilOperation.fail!==t||this._state.stencilOperation.zFail!==n||this._state.stencilOperation.zPass!==r)&&(this.gl.stencilOpSeparate(e,t,n,r),this._state.stencilOperation.face=e,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=n,this._state.stencilOperation.zPass=r,this._stateTracker.invalidateStencilTest())}setActiveTexture(e,t=!1){let n=this._state.activeTexture;return e>=0&&(t||e!==this._state.activeTexture)&&(this.gl.activeTexture(l+e),this._state.activeTexture=e),n}setDrawBuffers(e){let t=this.drawBuffers;if(t.length===e.length&&t.every((t,n)=>t===e[n]))return t;if(e.length>this.parameters.maxDrawBuffers)return S().error(`Setting more active draw buffers (${e.length}) than GL.MAX_DRAW_BUFFERS allows ( ${this.parameters.maxDrawBuffers}).`),t;let n=this._state.drawFramebuffer,r=n===null;if(r){if(e.length>1)return S().error(`The default framebuffer can only have 1 active draw buffer but was requested with ${e.length}.`),t;if(e[0]!==u&&e[0]!==d)return S().error(`The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers but got ${e[0]}`),t}else if(e.includes(u))return S().error(`A framebuffer object can only use the constants GL.COLOR_ATTACHMENTx or GL.NONE as draw buffers.`),t;return this.gl.drawBuffers(e),a(this.gl),r?this._state.drawBuffers.defaultFramebuffer=e:this._state.drawBuffers.fbos.set(n,e),t}get drawBuffers(){let e=this._state.drawFramebuffer;return e===null?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e)??[]}clear(e,t=255){e&&(e&16384&&this.setColorMask(!0,!0,!0,!0),e&256&&this.setDepthWriteEnabled(!0),e&1024&&this.setStencilWriteMask(t),this.gl.clear(e))}clearFramebuffer(e,t=!1,n=!1){let r=0;if(e){let t=Math.max(1e-13,e[3]);this.setClearColor(e[0],e[1],e[2],t),r|=16384}t&&(r|=256),n===!1?n=0:(n===!0&&(n=255),r|=1024),r&&this.clear(r,n)}clearBuffer(e,t,n=6144,r){this.gl.clearBufferfv(n,e,t,r)}clearBufferInteger(e,t,n=6144,r){this.gl.clearBufferiv(n,e,t,r)}clearBufferUnsignedInteger(e,t,n=6144,r){this.gl.clearBufferuiv(n,e,t,r)}drawArrays(e,t,n){if(this._transformFeedbackRequestInfo){if(e!==this._transformFeedbackRequestInfo.primitiveType)throw Error(`DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request`);if(this._state.program?.hasTransformFeedbackVaryings==null)throw Error(`DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying`)}if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=T(e,n),has(`enable-feature:webgl-debug:textureReadWrite`))){let e=this._state.textureUnitMap;for(let t=0;t<e.length;t++){let n=e[t];if(n!=null&&n===this._state.drawFramebuffer?.colorTexture)throw Error(`Detected readWrite. Texture already bound at index ${t}`)}}this.gl.drawArrays(e,t,n),a(this.gl)}drawArraysInstanced(e,t,n,r){this.gl.drawArraysInstanced(e,t,n,r),a(this.gl)}drawElements(e,t,n,r){if(this._transformFeedbackRequestInfo)throw Error(`Cannot called drawElements during a transform feedback request`);if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=T(e,t)),this.gl.drawElements(e,t,n,r),i()){let i=o(this.gl);if(i){let a=this.getBoundVAO(),o=a?.indexBuffer,s={indexBuffer:o,vertexBuffers:a?.buffers},c={mode:e,count:t,type:n,offset:r},l=o?.size??0,u=r+t,d=l<u?`. Buffer is too small. Attempted to draw index ${u} of ${l}`:``;S().error(`drawElements: ${i}${d}`,{args:c,vao:s})}}}drawElementsInstanced(e,t,n,r,i){this.gl.drawElementsInstanced(e,t,n,r,i),a(this.gl)}logInfo(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(e,t,n,r){n=Math.max(Math.round(n),1),r=Math.max(Math.round(r),1);let i=this._state.viewport;(i.x!==e||i.y!==t||i.width!==n||i.height!==r)&&(i.x=e,i.y=t,i.width=n,i.height=r,this.gl.viewport(e,t,n,r))}setViewport4fv(e){this.setViewport(e[0],e[1],e[2],e[3])}restoreViewport({x:e,y:t,width:n,height:r}){this.setViewport(e,t,n,r)}getViewport(){let e=this._state.viewport;return{x:e.x,y:e.y,width:e.width,height:e.height}}useProgram(e){if(this._state.program!==e){if(e&&e.glName==null&&s())throw Error(`Attempting to use disposed or invalid Program`);this._state.program?.stop(),this._state.program=e,this.gl.useProgram(e?.glName??null)}}bindTexture(e,t,n=!1,r=null){(t>=this.parameters.maxTextureImageUnits||t<0)&&S().error(`Input texture unit (${t}) is out of range of available units (0...${this.parameters.maxTextureImageUnits})
2
+ import has from"../../core/has.js";import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{after as n}from"../../core/promiseUtils.js";import{Milliseconds as r}from"../../core/time.js";import{webglDebugEnabled as i,checkWebGLError as a,getErrorMessage as o,webglValidateShadersEnabled as s}from"./checkWebGLError.js";import{ContextState as c}from"./ContextState.js";import{baseTextureUnit as l,DrawBufferBack as u,DrawBufferNone as d,ResourceType as f,ColorAttachment0 as p,PrimitiveType as m}from"./enums.js";import{InstanceCounter as h}from"./InstanceCounter.js";import{Parameters as g}from"./Parameters.js";import{ProgramCache as _}from"./ProgramCache.js";import{StateTracker as v}from"./renderState.js";import{Texture as y}from"./Texture.js";import{WebGLDriverTest as b}from"./WebGLDriverTest.js";import{Capabilities as x}from"./capabilities/Capabilities.js";const S=()=>e.getLogger(`esri.views.webgl.RenderingContext`);let C=class{constructor(e,t){this.gl=e,this.instanceCounter=new h,this._programCache=new _(this),this._transformFeedbackRequestInfo=null,this._state=new c,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=t,this.configure(t)}configure(e){this._options=e,this._capabilities=new x(this.gl,e),this._parameters=new g(this.gl,this._capabilities,e),y.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;let n=this.gl.getParameter(this.gl.VIEWPORT);this._state=new c,this._state.viewport={x:n[0],y:n[1],width:n[2],height:n[3]},this._stateTracker=new v({setBlending:e=>{if(e){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(e.opRgb,e.opAlpha),this.setBlendFunctionSeparate(e.srcRgb,e.dstRgb,e.srcAlpha,e.dstAlpha);let t=e.color;this.setBlendColor(t.r,t.g,t.b,t.a)}else this.setBlendingEnabled(!1)},setCulling:e=>{e?(this.setFaceCullingEnabled(!0),this.setCullFace(e.face),this.setFrontFace(e.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:e=>{e?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(e.factor,e.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:e=>{e?(this.setDepthTestEnabled(!0),this.setDepthFunction(e.func)):this.setDepthTestEnabled(!1)},setStencilTest:e=>{if(e){this.setStencilTestEnabled(!0);let{ref:t,readMask:n,stencilFront:r,stencilBack:i}=e;r.compare===i.compare?this.setStencilFunction(r.compare,t,n):(this.setStencilFunctionSeparate(1028,r.compare,t,n),this.setStencilFunctionSeparate(1029,i.compare,t,n)),r.fail===i.fail&&r.zFail===i.zFail&&r.zPass===i.zPass?this.setStencilOp(r.fail,r.zFail,r.zPass):(this.setStencilOpSeparate(1028,r.fail,r.zFail,r.zPass),this.setStencilOpSeparate(1029,i.fail,i.zFail,i.zPass))}else this.setStencilTestEnabled(!1)},setDepthWrite:e=>{e?(this.setDepthWriteEnabled(!0),this.setDepthRange(e.zNear,e.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:e=>{e?this.setColorMask(e.r,e.g,e.b,e.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:e=>{e?this.setStencilWriteMask(e.mask):this.setStencilWriteMask(0)}}),this.enforceState(),t(this._driverTest),this._driverTest=new b(this)}updateOptions(e){this._options={...this._options,...e},this._parameters=new g(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=t(this._driverTest),this._programCache=t(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this.bindUniformBufferBindingPoints([]),this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state.textureUnitSamplerMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null;let e=i()&&this.instanceCounter.resourceInformation;e&&console.log(e)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(e){this._stateTracker.setPipeline(e)}getPipelineState(){return this._stateTracker.getPipelineState()}setBlendingEnabled(e){this._state.blend!==e&&(e===!0?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=e,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(e,t){for(let t=0;t<e.length;++t){let n=e[t];this._state.textureUnitMap[n]=null,this._state.textureUnitSamplerMap[n]=null}t>=0&&(this._state.activeTexture=t)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(e,t,n,r){(e!==this._state.blendColor.r||t!==this._state.blendColor.g||n!==this._state.blendColor.b||r!==this._state.blendColor.a)&&(this.gl.blendColor(e,t,n,r),this._state.blendColor.r=e,this._state.blendColor.g=t,this._state.blendColor.b=n,this._state.blendColor.a=r,this._stateTracker.invalidateBlending())}setBlendFunction(e,t){(e!==this._state.blendFunction.srcRGB||t!==this._state.blendFunction.dstRGB)&&(this.gl.blendFunc(e,t),this._state.blendFunction.srcRGB=e,this._state.blendFunction.srcAlpha=e,this._state.blendFunction.dstRGB=t,this._state.blendFunction.dstAlpha=t,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(e,t,n,r){(this._state.blendFunction.srcRGB!==e||this._state.blendFunction.srcAlpha!==n||this._state.blendFunction.dstRGB!==t||this._state.blendFunction.dstAlpha!==r)&&(this.gl.blendFuncSeparate(e,t,n,r),this._state.blendFunction.srcRGB=e,this._state.blendFunction.srcAlpha=n,this._state.blendFunction.dstRGB=t,this._state.blendFunction.dstAlpha=r,this._stateTracker.invalidateBlending())}setBlendEquation(e){this._state.blendEquation.mode!==e&&(this.gl.blendEquation(e),this._state.blendEquation.mode=e,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(e,t){(this._state.blendEquation.mode!==e||this._state.blendEquation.modeAlpha!==t)&&(this.gl.blendEquationSeparate(e,t),this._state.blendEquation.mode=e,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setColorMask(e,t,n,r){(this._state.colorMask.r!==e||this._state.colorMask.g!==t||this._state.colorMask.b!==n||this._state.colorMask.a!==r)&&(this.gl.colorMask(e,t,n,r),this._state.colorMask.r=e,this._state.colorMask.g=t,this._state.colorMask.b=n,this._state.colorMask.a=r,this._stateTracker.invalidateColorWrite())}setClearColor(e,t,n,r){(this._state.clearColor.r!==e||this._state.clearColor.g!==t||this._state.clearColor.b!==n||this._state.clearColor.a!==r)&&(this.gl.clearColor(e,t,n,r),this._state.clearColor.r=e,this._state.clearColor.g=t,this._state.clearColor.b=n,this._state.clearColor.a=r)}setFaceCullingEnabled(e){this._state.faceCulling!==e&&(e===!0?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=e,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(e){this._state.polygonOffsetFill!==e&&(e===!0?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=e,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(e,t){(this._state.polygonOffset[0]!==e||this._state.polygonOffset[1]!==t)&&(this._state.polygonOffset[0]=e,this._state.polygonOffset[1]=t,this.gl.polygonOffset(e,t),this._stateTracker.invalidatePolygonOffset())}setCullFace(e){this._state.cullFace!==e&&(this.gl.cullFace(e),this._state.cullFace=e,this._stateTracker.invalidateCulling())}setFrontFace(e){this._state.frontFace!==e&&(this.gl.frontFace(e),this._state.frontFace=e,this._stateTracker.invalidateCulling())}setScissorTestEnabled(e){this._state.scissorTest!==e&&(e===!0?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=e)}setScissorRect(e,t,n,r){(this._state.scissorRect.x!==e||this._state.scissorRect.y!==t||this._state.scissorRect.width!==n||this._state.scissorRect.height!==r)&&(this.gl.scissor(e,t,n,r),this._state.scissorRect.x=e,this._state.scissorRect.y=t,this._state.scissorRect.width=n,this._state.scissorRect.height=r)}setDepthTestEnabled(e){this._state.depthTest!==e&&(e===!0?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=e,this._stateTracker.invalidateDepthTest())}setClearDepth(e){this._state.clearDepth!==e&&(this.gl.clearDepth(e),this._state.clearDepth=e)}setDepthFunction(e){this._state.depthFunction!==e&&(this.gl.depthFunc(e),this._state.depthFunction=e,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(e){this._state.depthWrite!==e&&(this.gl.depthMask(e),this._state.depthWrite=e,this._stateTracker.invalidateDepthWrite())}setDepthRange(e,t){(this._state.depthRange.zNear!==e||this._state.depthRange.zFar!==t)&&(this.gl.depthRange(e,t),this._state.depthRange.zNear=e,this._state.depthRange.zFar=t,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(e){this._state.stencilTest!==e&&(e===!0?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=e,this._stateTracker.invalidateStencilTest())}setClearStencil(e){e!==this._state.clearStencil&&(this.gl.clearStencil(e),this._state.clearStencil=e)}setStencilFunction(e,t,n){(this._state.stencilFunction.face!==1032||this._state.stencilFunction.func!==e||this._state.stencilFunction.ref!==t||this._state.stencilFunction.mask!==n)&&(this.gl.stencilFunc(e,t,n),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=t,this._state.stencilFunction.mask=n,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(e,t,n,r){(this._state.stencilFunction.face!==e||this._state.stencilFunction.func!==t||this._state.stencilFunction.ref!==n||this._state.stencilFunction.mask!==r)&&(this.gl.stencilFuncSeparate(e,t,n,r),this._state.stencilFunction.face=e,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=n,this._state.stencilFunction.mask=r,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(e){this._state.stencilWriteMask!==e&&(this.gl.stencilMask(e),this._state.stencilWriteMask=e,this._stateTracker.invalidateStencilWrite())}setStencilOp(e,t,n){(this._state.stencilOperation.face!==1032||this._state.stencilOperation.fail!==e||this._state.stencilOperation.zFail!==t||this._state.stencilOperation.zPass!==n)&&(this.gl.stencilOp(e,t,n),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=t,this._state.stencilOperation.zPass=n,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(e,t,n,r){(this._state.stencilOperation.face!==e||this._state.stencilOperation.fail!==t||this._state.stencilOperation.zFail!==n||this._state.stencilOperation.zPass!==r)&&(this.gl.stencilOpSeparate(e,t,n,r),this._state.stencilOperation.face=e,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=n,this._state.stencilOperation.zPass=r,this._stateTracker.invalidateStencilTest())}setActiveTexture(e,t=!1){let n=this._state.activeTexture;return e>=0&&(t||e!==this._state.activeTexture)&&(this.gl.activeTexture(l+e),this._state.activeTexture=e),n}setDrawBuffers(e){let t=this.drawBuffers;if(t.length===e.length&&t.every((t,n)=>t===e[n]))return t;if(e.length>this.parameters.maxDrawBuffers)return S().error(`Setting more active draw buffers (${e.length}) than GL.MAX_DRAW_BUFFERS allows ( ${this.parameters.maxDrawBuffers}).`),t;let n=this._state.drawFramebuffer,r=n===null;if(r){if(e.length>1)return S().error(`The default framebuffer can only have 1 active draw buffer but was requested with ${e.length}.`),t;if(e[0]!==u&&e[0]!==d)return S().error(`The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers but got ${e[0]}`),t}else if(e.includes(u))return S().error(`A framebuffer object can only use the constants GL.COLOR_ATTACHMENTx or GL.NONE as draw buffers.`),t;return this.gl.drawBuffers(e),a(this.gl),r?this._state.drawBuffers.defaultFramebuffer=e:this._state.drawBuffers.fbos.set(n,e),t}get drawBuffers(){let e=this._state.drawFramebuffer;return e===null?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e)??[]}clear(e,t=255){e&&(e&16384&&this.setColorMask(!0,!0,!0,!0),e&256&&this.setDepthWriteEnabled(!0),e&1024&&this.setStencilWriteMask(t),this.gl.clear(e))}clearFramebuffer(e,t=!1,n=!1){let r=0;if(e){let t=Math.max(1e-13,e[3]);this.setClearColor(e[0],e[1],e[2],t),r|=16384}t&&(r|=256),n===!1?n=0:(n===!0&&(n=255),r|=1024),r&&this.clear(r,n)}clearBuffer(e,t,n=6144,r){this.gl.clearBufferfv(n,e,t,r)}clearBufferInteger(e,t,n=6144,r){this.gl.clearBufferiv(n,e,t,r)}clearBufferUnsignedInteger(e,t,n=6144,r){this.gl.clearBufferuiv(n,e,t,r)}drawArrays(e,t,n){if(this._transformFeedbackRequestInfo){if(e!==this._transformFeedbackRequestInfo.primitiveType)throw Error(`DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request`);if(this._state.program?.hasTransformFeedbackVaryings==null)throw Error(`DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying`)}if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=T(e,n),has(`enable-feature:webgl-debug:textureReadWrite`))){let e=this._state.textureUnitMap;for(let t=0;t<e.length;t++){let n=e[t];if(n!=null&&n===this._state.drawFramebuffer?.colorTexture)throw Error(`Detected readWrite. Texture already bound at index ${t}`)}}this.gl.drawArrays(e,t,n),a(this.gl)}drawArraysInstanced(e,t,n,r){this.gl.drawArraysInstanced(e,t,n,r),a(this.gl)}drawElements(e,t,n,r){if(this._transformFeedbackRequestInfo)throw Error(`Cannot called drawElements during a transform feedback request`);if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=T(e,t)),this.gl.drawElements(e,t,n,r),i()){let i=o(this.gl);if(i){let a=this.getBoundVAO(),o=a?.indexBuffer,s={indexBuffer:o,vertexBuffers:a?.buffers},c={mode:e,count:t,type:n,offset:r},l=o?.size??0,u=r+t,d=l<u?`. Buffer is too small. Attempted to draw index ${u} of ${l}`:``;S().error(`drawElements: ${i}${d}`,{args:c,vao:s})}}}drawElementsInstanced(e,t,n,r,i){this.gl.drawElementsInstanced(e,t,n,r,i),a(this.gl)}logInfo(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(e,t,n,r){n=Math.max(Math.round(n),1),r=Math.max(Math.round(r),1);let i=this._state.viewport;(i.x!==e||i.y!==t||i.width!==n||i.height!==r)&&(i.x=e,i.y=t,i.width=n,i.height=r,this.gl.viewport(e,t,n,r))}setViewport4fv(e){this.setViewport(e[0],e[1],e[2],e[3])}restoreViewport({x:e,y:t,width:n,height:r}){this.setViewport(e,t,n,r)}getViewport(){let e=this._state.viewport;return{x:e.x,y:e.y,width:e.width,height:e.height}}useProgram(e){if(this._state.program!==e){if(e&&e.glName==null&&s())throw Error(`Attempting to use disposed or invalid Program`);this._state.program?.stop(),this._state.program=e,this.gl.useProgram(e?.glName??null)}}bindTexture(e,t,n=!1,r=null){(t>=this.parameters.maxTextureImageUnits||t<0)&&S().error(`Input texture unit (${t}) is out of range of available units (0...${this.parameters.maxTextureImageUnits})
3
3
  `);let i=this._state.textureUnitMap[t],a=this._state.textureUnitSamplerMap[t],{gl:o}=this;return e?.glName==null?(i!=null&&(this.setActiveTexture(t,n),o.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[t]=null,a!=null&&(this._state.textureUnitSamplerMap[t]=null,o.bindSampler(t,null)),i):(a!==r&&(o.bindSampler(t,r?.glName??null),this._state.textureUnitSamplerMap[t]=r),!n&&i===e?(e.isDirty&&(this.setActiveTexture(t,n),e.applyChanges()),i):(this.setActiveTexture(t,n),o.bindTexture(e.descriptor.target,e.glName),e.applyChanges(),this._state.textureUnitMap[t]=e,i))}unbindTexture(e){if(e!=null)for(let t=0;t<this.parameters.maxTextureImageUnits;t++)this._state.textureUnitMap[t]===e&&(this.bindTexture(null,t),this._state.textureUnitMap[t]=null)}bindFramebuffer(e,t=!1){let n=E(e);!t&&this._state.readFramebuffer===e&&this._state.drawFramebuffer===e?this.setDrawBuffers(n):e==null?(this.gl.bindFramebuffer(36160,null),this._state.readFramebuffer=this._state.drawFramebuffer=null,this.setDrawBuffers(n)):(e.initializeAndBind(36160),this._state.readFramebuffer=e,this._state.drawFramebuffer=e,this.setDrawBuffers(n))}bindFramebufferSeparate(e,t,n=!1){let r=t===36008,i=r?this._state.readFramebuffer:this._state.drawFramebuffer;(n||i!==e)&&(e==null?this.gl.bindFramebuffer(t,null):e.initializeAndBind(t),r?this._state.readFramebuffer=e??null:(this._state.drawFramebuffer=e??null,this.setDrawBuffers(E(e))))}blitFramebuffer(e,t,n=16384,r=9728,i=0,a=0,o=e.width,s=e.height,c=0,l=0,u=t.width,d=t.height){this.bindFramebufferSeparate(e,36008,!0),this.bindFramebufferSeparate(t,36009,!0),this.gl.blitFramebuffer(i,a,o,s,c,l,u,d,n,r)}bindBuffer(e,t){if(e)switch(t??=e.bufferType,t){case 34962:this._state.vertexBuffer=w(this.gl,e,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=w(this.gl,e,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=w(this.gl,e,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=w(this.gl,e,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=w(this.gl,e,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=w(this.gl,e,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=w(this.gl,e,t,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=w(this.gl,e,t,this._state.transformFeedbackBuffer)}}bindRenderbuffer(e){let t=this.gl;e||(t.bindRenderbuffer(t.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==e&&(t.bindRenderbuffer(t.RENDERBUFFER,e.glName),this._state.renderbuffer=e)}_getBufferBinding(e,t){if(t>=this.parameters.maxUniformBufferBindings||t<0)return S().error(`Uniform buffer binding point (${t}) is out of range (0...${this.parameters.maxUniformBufferBindings})
4
4
  `),null;let n=e===35345?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints,r=n[t];return r??(r={buffer:null,offset:0,size:0},n[t]=r),r}bindBufferBase(e,t,n){let r=this._getBufferBinding(e,t);r!=null&&(r.buffer!==n||r.offset!==0||r.size!==0)&&(this.gl.bindBufferBase(e,t,n?n.glName:null),e===35345?this._state.uniformBuffer=n:this._state.transformFeedbackBuffer=n,r.buffer=n,r.offset=0,r.size=0)}bindBufferRange(e,t,n,r,i){let a=this._getBufferBinding(e,t);a!=null&&(a.buffer!==n||a.offset!==r||a.size!==i)&&(r%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(e,t,n.glName,r,i),this._state.uniformBuffer=n,a.buffer=n,a.offset=r,a.size=i):S().error(`Uniform buffer binding offset is not a multiple of the context offset alignment`))}bindUniformBufferBindingPoints(e){let t=this._state.uniformBufferBindingPoints,n=Math.max(t.length,e.length);t.length=0;for(let r=0;r<n;r++){let n=e[r];if(n?.buffer!=null){let{buffer:e,offset:t,size:i}=n;t===0&&i===0?this.gl.bindBufferBase(35345,r,e.glName):this.gl.bindBufferRange(35345,r,e.glName,t,i),this._state.uniformBuffer=e}else this.gl.bindBufferBase(35345,r,null),this._state.uniformBuffer=null;r<e.length&&(t[r]=n?{buffer:n.buffer,offset:n.offset,size:n.size}:{buffer:null,offset:0,size:0})}}bindUBO(e,t,n,r){t==null?this.bindBufferBase(35345,e,null):(i()&&(r??t.byteLength)>this._parameters.maxUniformBlockSize&&S().error(`Attempting to bind more data than the maximum uniform block size`),t.initialize(),n!==void 0&&r!==void 0?this.bindBufferRange(35345,e,t.buffer,n,r):this.bindBufferBase(35345,e,t.buffer))}unbindUBO(e){for(let t=0,n=this._state.uniformBufferBindingPoints.length;t<n;t++){let n=this._state.uniformBufferBindingPoints[t];n!=null&&n.buffer===e.buffer&&this.bindBufferBase(35345,t,null)}}unbindBuffer(e){switch(e){case 34962:this._state.vertexBuffer=w(this.gl,null,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=w(this.gl,null,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=w(this.gl,null,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=w(this.gl,null,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=w(this.gl,null,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=w(this.gl,null,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=w(this.gl,null,e,this._state.copyWriteBuffer)}}bindVAO(e,t){e==null?(this._state.vertexArrayObject?.unbind(),this._state.vertexArrayObject=null):this._state.vertexArrayObject!==e&&(e.bind(t),this._state.vertexArrayObject=e)}bindTransformFeedback(e){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,e.glName)}beginTransformFeedback(e,t){if(this._transformFeedbackRequestInfo)throw Error(`Already in a transform feedback request`);let{gl:n}=this;n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,e.glName),n.beginTransformFeedback(t),this._transformFeedbackRequestInfo={primitiveType:t}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw Error(`Not in a transform feedback request`);let{gl:e}=this;e.endTransformFeedback(),e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(e=r(10),t){let{gl:i}=this,a=i.fenceSync(37143,0);if(!a)throw Error(`Client wait failed, could not create sync object`);this.instanceCounter.increment(f.Sync,a),i.flush();try{let r;do await n(e,null,t),r=i.clientWaitSync(a,0,0);while(r===37147);if(r===37149)throw Error(`Client wait failed`)}finally{this.instanceCounter.decrement(f.Sync,a),i.deleteSync(a)}}get boundFramebuffer(){return this._state.drawFramebuffer}get uniformBufferBindingPoints(){return this._state.uniformBufferBindingPoints.map(e=>e&&{buffer:e.buffer,offset:e.offset,size:e.size})}temporaryBindFramebuffer(e,t,n=!1){let r=this.boundFramebuffer,i={...this._state.viewport};try{this.bindFramebuffer(e,n),e&&this.setViewport(0,0,e.width,e.height),t()}finally{this.bindFramebuffer(r,n),e&&this.setViewport(i.x,i.y,i.width,i.height)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this.bindUniformBufferBindingPoints([]),this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let e=0;e<this.parameters.maxTextureImageUnits;++e)this.bindTexture(null,e);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){let{gl:e}=this;e.bindVertexArray(null);for(let t=0;t<this.parameters.maxVertexAttributes;t++)e.disableVertexAttribArray(t);this._state.vertexBuffer?e.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):e.bindBuffer(34962,null),this._state.indexBuffer?e.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):e.bindBuffer(34963,null);for(let t=0;t<this._parameters.maxUniformBufferBindings;t++){let n=this._state.uniformBufferBindingPoints[t];if(n!=null){let{buffer:r,offset:i,size:a}=n;r===null?e.bindBufferBase(35345,t,null):i===0&&a===0?e.bindBufferBase(35345,t,r.glName):e.bindBufferRange(35345,t,r.glName,i,a)}}if(this._state.uniformBuffer?e.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):e.bindBuffer(35345,null),this._state.pixelPackBuffer?e.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):e.bindBuffer(35051,null),this._state.pixelUnpackBuffer?e.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):e.bindBuffer(35052,null),this._state.copyReadBuffer?e.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):e.bindBuffer(36662,null),this._state.copyWriteBuffer?e.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):e.bindBuffer(36663,null),e.bindFramebuffer(36008,null),e.readBuffer(e.BACK),this._state.readFramebuffer&&(e.bindFramebuffer(36008,this._state.readFramebuffer.glName),e.readBuffer(p)),e.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),this._state.drawFramebuffer===null){let t=this._state.drawBuffers.defaultFramebuffer;e.drawBuffers(t??[u])}else{let t=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);e.drawBuffers(t??[p])}if(this._state.vertexArrayObject){let e=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(e)}e.useProgram(this._state.program?.glName??null),e.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),e.bindRenderbuffer(e.RENDERBUFFER,this._state.renderbuffer?.glName??null),this._state.blend===!0?e.enable(this.gl.BLEND):e.disable(this.gl.BLEND),e.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),e.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),e.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),e.clearDepth(this._state.clearDepth),e.clearStencil(this._state.clearStencil),e.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),e.cullFace(this._state.cullFace),e.depthFunc(this._state.depthFunction),e.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),this._state.depthTest===!0?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),e.depthMask(this._state.depthWrite),e.frontFace(this._state.frontFace),e.lineWidth(1),this._state.faceCulling===!0?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),e.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),this._state.polygonOffsetFill===!0?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),e.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),this._state.scissorTest===!0?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST),e.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),e.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),this._state.stencilTest===!0?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),e.stencilMask(this._state.stencilWriteMask);for(let t=0;t<this.parameters.maxTextureImageUnits;t++){e.activeTexture(l+t),e.bindTexture(3553,null),e.bindTexture(34067,null),e.bindTexture(32879,null),e.bindTexture(35866,null),e.bindSampler(t,null);let n=this._state.textureUnitMap[t];n!=null&&e.bindTexture(n.descriptor.target,n.glName);let r=this._state.textureUnitSamplerMap[t];r!=null&&e.bindSampler(t,r?.glName)}e.activeTexture(l+this._state.activeTexture);let t=this._state.viewport;e.viewport(t.x,t.y,t.width,t.height),this.resetInfo()}};function w(e,t,n,r){return t?r!==t&&e.bindBuffer(n,t.glName):e.bindBuffer(n,null),t}function T(e,t){switch(e){case m.POINTS:return 2*t;case m.TRIANGLES:return t/3;case m.TRIANGLE_STRIP:return t-2;case m.TRIANGLE_FAN:return t-2;default:return 0}}function E(e){return e?e.colorAttachments.length>0?e.colorAttachments:[d]:[u]}export{C as RenderingContext,E as getFramebufferDrawBuffers};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../core/Error.js";import has from"../../core/has.js";import t from"../../core/Logger.js";import{abortMaybe as n}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as i,isAbortError as a}from"../../core/promiseUtils.js";import{checkWebGLError as o}from"./checkWebGLError.js";import{ResourceType as s,CompressedTextureFormat as c}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as u,deriveInternalFormat as d,isTexImageSource as f,is3DTarget as p,validateTexture as m,isCompressedFormat as h,getDimensions as g,isSizedPixelFormat as _,calcMipmapLevels as v}from"./textureUtils.js";import{ValidatedTextureDescriptor as y}from"./ValidatedTextureDescriptor.js";const b=!!has(`esri-tests-disable-gpu-memory-measurements`),x=()=>t.getLogger(`esri/views/webgl/Texture`);class S{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(t,n=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,`context`in t)this._descriptor=t,r=n;else{let r=y.validate(t,n);if(!r)throw new e(`texture:invalid-descriptor`,`Texture descriptor invalid`);this._descriptor=r}this._descriptor.target===34067?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(s.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(t,n){let r=this._descriptor;if(r.width!==t||r.height!==n){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-resize`,`Immutable textures can't be resized!`);r.width=t,r.height=n,this._descriptor.target===34067?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!u(e)&&this._descriptor.internalFormat&&r(c,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!u(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(t,n,r,i,a,o,s=0){o||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update uninitialized texture!`);let c=this._descriptor;c.internalFormat=d(c);let{context:l,pixelFormat:p,dataType:m,target:h,isImmutable:g}=c;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);let _=l.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES,!0);(n<0||r<0||n+i>c.width||r+a>c.height)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:v}=l;s&&(i&&a||x().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),v.pixelStorei(v.UNPACK_SKIP_ROWS,s)),f(o)?v.texSubImage2D(h,t,n,r,i,a,p,m,o):u(o)?v.compressedTexSubImage2D(h,t,n,r,i,a,c.internalFormat,o.levels[t]):v.texSubImage2D(h,t,n,r,i,a,p,m,o),s&&v.pixelStorei(v.UNPACK_SKIP_ROWS,0),l.bindTexture(_,S.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,n,r,i,a,o,s,c){c||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update an uninitialized texture!`);let l=this._descriptor;l.internalFormat=d(l);let{context:f,pixelFormat:m,dataType:h,isImmutable:g,target:_}=l;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);p(_)||x().warn(`Attempting to set 3D texture data on a non-3D texture`);let v=f.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);f.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),(n<0||r<0||i<0||n+a>l.width||r+o>l.height||i+s>l.depth)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:y}=f;if(u(c))c=c.levels[t],y.compressedTexSubImage3D(_,t,n,r,i,a,o,s,l.internalFormat,c);else{let e=c;y.texSubImage3D(_,t,n,r,i,a,o,s,m,h,e)}f.bindTexture(v,S.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){let t=this._descriptor;if(t.width===0||t.height===0)return;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot add mipmaps to immutable texture after allocation`);t.hasMipmap=!0,this._samplingModeDirty=!0,m(t)}t.samplingMode===9729?(this._samplingModeDirty=!0,t.samplingMode=9985):t.samplingMode===9728&&(this._samplingModeDirty=!0,t.samplingMode=9984);let n=this._descriptor.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(t.target),this._descriptor.context.bindTexture(n,S.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){let t=this._descriptor;if(t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot delete mipmaps to immutable texture after allocation`);t.hasMipmap=!1,this._samplingModeDirty=!0,m(t)}t.samplingMode===9985?(this._samplingModeDirty=!0,t.samplingMode=9729):t.samplingMode===9984&&(this._samplingModeDirty=!0,t.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,m(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),m(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&=(this._applySamplingMode(),!1),this._wrapModeDirty&&=(this._applyWrapMode(),!1),this._shadowFilterDirty&&=(this._applyShadowMode(),!1)}abortCompression(){this._compressionAbortController=n(this._compressionAbortController)}_setData(t,n){let r=this._descriptor,i=r.context?.gl;if(!i)return;o(i),this.hasWebGLTextureObject||(this._glName=i.createTexture(),r.context.instanceCounter.increment(s.Texture,this)),m(r);let a=r.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),o(i);let c=n??r.target,l=p(c);if(f(t))this._setDataFromTexImageSource(t,c);else{let{width:n,height:a,depth:s}=r;if(n==null||a==null)throw new e(`texture:missing-size`,`Width and height must be specified!`);if(l&&s==null)throw new e(`texture:missing-depth`,`Depth must be specified!`);if(r.internalFormat=d(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(c,r.internalFormat,r.hasMipmap,n,a,s),u(t)){if(!h(r.internalFormat))throw new e(`texture:format-mismatch`,`Attempting to use compressed data with an uncompressed format!`);this._setDataFromCompressedSource(t,r.internalFormat,c)}else this._texImage(c,0,r.internalFormat,n,a,s,t),o(i),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),o(i),r.context.bindTexture(a,S.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){let e=this._descriptor.context.gl,{unpackAlignment:t,flipped:n,preMultiplyAlpha:r}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,+!!n),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,+!!r)}_setDataFromTexImageSource(e,t){let{gl:n}=this._descriptor.context,r=this._descriptor;r.internalFormat=d(r);let i=p(t),{width:a,height:s,depth:c}=g(e);r.width&&r.height,r.width||=a,r.height||=s,i&&r.depth,i&&(r.depth=c),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,r.internalFormat,r.hasMipmap,a,s,c),this._texImage(t,0,r.internalFormat,a,s,c,e),o(n),r.hasMipmap&&(this.generateMipmap(),o(n))}_setDataFromCompressedSource(e,t,n){let r=this._descriptor,{width:i,height:a,depth:o}=r,s=e.levels,c=v(n,i,a,o),l=Math.min(c,s.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((e,r,i,a)=>{let o=s[Math.min(e,s.length-1)];this._compressedTexImage(n,e,t,r,i,a,o)},l)}_texStorage(t,n,r,i,a,o){let{gl:s}=this._descriptor.context;if(!_(n)&&!h(n))throw new e(`texture:missing-format`,`Immutable textures must have a sized or compressed internal format`);if(!this._descriptor.isImmutable)return;let c=r?v(t,i,a,o):1;if(p(t)){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);s.texStorage3D(t,c,n,i,a,o)}else s.texStorage2D(t,c,n,i,a);this._wasImmutablyAllocated=!0}_texImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t),{isImmutable:u,pixelFormat:d,dataType:f}=this._descriptor;if(u){if(s!=null){let r=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texSubImage3D(t,n,0,0,0,i,a,o,d,f,r)}else c.texSubImage2D(t,n,0,0,i,a,d,f,r)}}else{let u=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texImage3D(t,n,r,i,a,o,0,d,f,u)}else c.texImage2D(t,n,r,i,a,0,d,f,u)}}_compressedTexImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t);if(this._descriptor.isImmutable){if(s!=null){if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexSubImage3D(t,n,0,0,0,i,a,o,r,s)}else c.compressedTexSubImage2D(t,n,0,0,i,a,r,s)}}else if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexImage3D(t,n,r,i,a,o,0,s)}else c.compressedTexImage2D(t,n,r,i,a,0,s)}async _compressOnWorker(e){let{width:t,height:n,context:r,flipped:o,preMultiplyAlpha:s,hasMipmap:c,compress:l}=this._descriptor;if(!l)return;let{compressionTracker:u,compressionCallback:d,preserveSourceBitmap:f}=l,{compressedTextureETC:p,compressedTextureS3TC:m}=r.capabilities;if(!S.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!p&&!m)return;this.abortCompression();let h=new AbortController;this._compressionAbortController=h,u?.increment();let g,_=!1,v=!1;try{e instanceof ImageBitmap?f?(g=await createImageBitmap(e),i(h),v=!0):g=e:e instanceof Uint8Array?(g=e.buffer,_=this.descriptor.flipped):(g=await createImageBitmap(e,{imageOrientation:o?`flipY`:`none`}),i(h),v=!0);let r={data:g,width:t,height:n,needsFlip:_,components:this._descriptor.pixelFormat===6408?4:3,preMultiplyAlpha:s,isOpaque:this._descriptor.isOpaque,hasMipmap:c,hasETC:!!p,hasS3TC:!!m},a=await S.compressionWorkerHandle.invoke(r,h.signal,1);if(i(h),a.compressedTexture&&this.hasWebGLTextureObject){let e=this.usedMemory;this._descriptor.internalFormat=a.internalFormat,this._setData(a.compressedTexture),d?.(e-this.usedMemory)}}catch(e){a(e)||x().error(`Texture compression failed!`)}finally{u?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),v&&g instanceof ImageBitmap&&g.close()}}_forEachMipmapLevel(t,n=1/0){let{width:r,height:i,depth:a,hasMipmap:o,target:s}=this._descriptor,c=s===32879;if(r==null||i==null||c&&a==null)throw new e(`texture:missing-size`,`Missing texture dimensions for mipmap calculation`);for(let e=0;t(e,r,i,a),!(!o||r===1&&i===1&&(!c||a===1)||e>=n);++e)r=Math.max(1,r>>1),i=Math.max(1,i>>1),c&&(a=Math.max(1,a>>1))}_applySamplingMode(){let e=this._descriptor,t=e.context?.gl,n=e.samplingMode,r=e.samplingMode;n===9985||n===9987?(n=9729,e.hasMipmap||(r=9729)):(n===9984||n===9986)&&(n=9728,e.hasMipmap||(r=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,n),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r),e.maxMipLevel!=null&&t.texParameteri(e.target,t.TEXTURE_MAX_LEVEL,e.maxMipLevel)}_applyWrapMode(){let e=this._descriptor,t=e.context?.gl;typeof e.wrapMode==`number`?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){let e=this._descriptor,t=e.context?.gl,n=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,n),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),o(t)}_applyAnisotropicFilteringParameters(){let e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}export{S as default};
2
+ import e from"../../core/Error.js";import has from"../../core/has.js";import t from"../../core/Logger.js";import{abortMaybe as n}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as i,isAbortError as a}from"../../core/promiseUtils.js";import{checkWebGLError as o}from"./checkWebGLError.js";import{ResourceType as s,CompressedTextureFormat as c}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as u,deriveInternalFormat as d,isTexImageSource as f,is3DTarget as p,validateTexture as m,isCompressedFormat as h,getDimensions as g,isSizedPixelFormat as _,calcMipmapLevels as v}from"./textureUtils.js";import{ValidatedTextureDescriptor as y}from"./ValidatedTextureDescriptor.js";const b=!!has(`esri-tests-disable-gpu-memory-measurements`),x=()=>t.getLogger(`esri/views/webgl/Texture`);class S{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(t,n=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,`context`in t)this._descriptor=t,r=n;else{let r=y.validate(t,n);if(!r)throw new e(`texture:invalid-descriptor`,`Texture descriptor invalid`);this._descriptor=r}this._descriptor.target===34067?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(s.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(t,n){let r=this._descriptor;if(r.width!==t||r.height!==n){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-resize`,`Immutable textures can't be resized!`);r.width=t,r.height=n,this._descriptor.target===34067?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!u(e)&&this._descriptor.internalFormat&&r(c,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!u(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(t,n,r,i,a,o,s=0){o||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update uninitialized texture!`);let c=this._descriptor;c.internalFormat=d(c);let{context:l,pixelFormat:p,dataType:m,target:h,isImmutable:g}=c;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);let _=l.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES,!0);(n<0||r<0||n+i>c.width||r+a>c.height)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:v}=l;s&&(i&&a||x().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),v.pixelStorei(v.UNPACK_SKIP_ROWS,s)),f(o)?v.texSubImage2D(h,t,n,r,i,a,p,m,o):u(o)?v.compressedTexSubImage2D(h,t,n,r,i,a,c.internalFormat,o.levels[t]):v.texSubImage2D(h,t,n,r,i,a,p,m,o),s&&v.pixelStorei(v.UNPACK_SKIP_ROWS,0),l.bindTexture(_,S.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,n,r,i,a,o,s,c){c||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update an uninitialized texture!`);let l=this._descriptor;l.internalFormat=d(l);let{context:f,pixelFormat:m,dataType:h,isImmutable:g,target:_}=l;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);p(_)||x().warn(`Attempting to set 3D texture data on a non-3D texture`);let v=f.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);f.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),(n<0||r<0||i<0||n+a>l.width||r+o>l.height||i+s>l.depth)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:y}=f;if(u(c))c=c.levels[t],y.compressedTexSubImage3D(_,t,n,r,i,a,o,s,l.internalFormat,c);else{let e=c;y.texSubImage3D(_,t,n,r,i,a,o,s,m,h,e)}f.bindTexture(v,S.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){let t=this._descriptor;if(t.width===0||t.height===0)return;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot add mipmaps to immutable texture after allocation`);t.hasMipmap=!0,this._samplingModeDirty=!0,m(t)}t.samplingMode===9729?(this._samplingModeDirty=!0,t.samplingMode=9985):t.samplingMode===9728&&(this._samplingModeDirty=!0,t.samplingMode=9984);let n=this._descriptor.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(t.target),this._descriptor.context.bindTexture(n,S.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){let t=this._descriptor;if(t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot delete mipmaps to immutable texture after allocation`);t.hasMipmap=!1,this._samplingModeDirty=!0,m(t)}t.samplingMode===9985?(this._samplingModeDirty=!0,t.samplingMode=9729):t.samplingMode===9984&&(this._samplingModeDirty=!0,t.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,m(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),m(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&=(this._applySamplingMode(),!1),this._wrapModeDirty&&=(this._applyWrapMode(),!1),this._shadowFilterDirty&&=(this._applyShadowMode(),!1)}abortCompression(){this._compressionAbortController=n(this._compressionAbortController)}_setData(t,n){let r=this._descriptor,i=r.context?.gl;if(!i)return;o(i),this.hasWebGLTextureObject||(this._glName=i.createTexture(),r.context.instanceCounter.increment(s.Texture,this)),m(r);let a=r.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),o(i);let c=n??r.target,l=p(c);if(f(t))this._setDataFromTexImageSource(t,c);else{let{width:n,height:a,depth:s}=r;if(n==null||a==null)throw new e(`texture:missing-size`,`Width and height must be specified!`);if(l&&s==null)throw new e(`texture:missing-depth`,`Depth must be specified!`);if(r.internalFormat=d(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(c,r.internalFormat,r.hasMipmap,n,a,s),u(t)){if(!h(r.internalFormat))throw new e(`texture:format-mismatch`,`Attempting to use compressed data with an uncompressed format!`);this._setDataFromCompressedSource(t,r.internalFormat,c)}else this._texImage(c,0,r.internalFormat,n,a,s,t),o(i),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),o(i),r.context.bindTexture(a,S.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){let e=this._descriptor.context.gl,{unpackAlignment:t,flipped:n,preMultiplyAlpha:r}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,+!!n),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,+!!r)}_setDataFromTexImageSource(e,t){let{gl:n}=this._descriptor.context,r=this._descriptor;r.internalFormat=d(r);let i=p(t),{width:a,height:s,depth:c}=g(e);r.width&&r.height,r.width||=a,r.height||=s,i&&r.depth,i&&(r.depth=c),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,r.internalFormat,r.hasMipmap,a,s,c),this._texImage(t,0,r.internalFormat,a,s,c,e),o(n),r.hasMipmap&&(this.generateMipmap(),o(n))}_setDataFromCompressedSource(e,t,n){let r=this._descriptor,{width:i,height:a,depth:o}=r,s=e.levels,c=v(n,i,a,o),l=Math.min(c,s.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((e,r,i,a)=>{let o=s[Math.min(e,s.length-1)];this._compressedTexImage(n,e,t,r,i,a,o)},l)}_texStorage(t,n,r,i,a,o){let{gl:s}=this._descriptor.context;if(!_(n)&&!h(n))throw new e(`texture:missing-format`,`Immutable textures must have a sized or compressed internal format`);if(!this._descriptor.isImmutable)return;let c=r?v(t,i,a,o):1;if(p(t)){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);s.texStorage3D(t,c,n,i,a,o)}else s.texStorage2D(t,c,n,i,a);this._wasImmutablyAllocated=!0}_texImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t),{isImmutable:u,pixelFormat:d,dataType:f}=this._descriptor;if(u){if(s!=null){let r=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texSubImage3D(t,n,0,0,0,i,a,o,d,f,r)}else c.texSubImage2D(t,n,0,0,i,a,d,f,r)}}else{let u=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texImage3D(t,n,r,i,a,o,0,d,f,u)}else c.texImage2D(t,n,r,i,a,0,d,f,u)}}_compressedTexImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t);if(this._descriptor.isImmutable){if(s!=null){if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexSubImage3D(t,n,0,0,0,i,a,o,r,s)}else c.compressedTexSubImage2D(t,n,0,0,i,a,r,s)}}else if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexImage3D(t,n,r,i,a,o,0,s)}else c.compressedTexImage2D(t,n,r,i,a,0,s)}async _compressOnWorker(e){let{width:t,height:n,context:r,flipped:o,preMultiplyAlpha:s,hasMipmap:c,compress:l}=this._descriptor;if(!l)return;let{compressionTracker:u,compressionCallback:d,preserveSourceBitmap:f}=l,{compressedTextureETC:p,compressedTextureS3TC:m}=r.capabilities;if(!S.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!p&&!m)return;this.abortCompression();let h=new AbortController;this._compressionAbortController=h,u?.increment();let g,_=!1,v=!1;try{e instanceof ImageBitmap?f?(g=await createImageBitmap(e),i(h),v=!0):g=e:e instanceof Uint8Array?(g=e.buffer,_=this.descriptor.flipped):(g=await createImageBitmap(e,{imageOrientation:o?`flipY`:`none`}),i(h),v=!0);let r={data:g,width:t,height:n,needsFlip:_,components:this._descriptor.pixelFormat===6408?4:3,preMultiplyAlpha:s,isOpaque:this._descriptor.isOpaque,hasMipmap:c,hasETC:!!p,hasS3TC:!!m},a=await S.compressionWorkerHandle.invoke(r,h.signal,1);if(i(h),a.compressedTexture&&this.hasWebGLTextureObject){let e=this.usedMemory;this._descriptor.internalFormat=a.internalFormat,this._setData(a.compressedTexture),d?.(e-this.usedMemory)}}catch(e){a(e)||x().error(`Texture compression failed!`)}finally{u?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),v&&g instanceof ImageBitmap&&g.close()}}_forEachMipmapLevel(t,n=1/0){let{width:r,height:i,depth:a,hasMipmap:o,target:s}=this._descriptor,c=s===32879;if(r==null||i==null||c&&a==null)throw new e(`texture:missing-size`,`Missing texture dimensions for mipmap calculation`);for(let e=0;t(e,r,i,a),!(!o||r===1&&i===1&&(!c||a===1)||e>=n);++e)r=Math.max(1,r>>1),i=Math.max(1,i>>1),c&&(a=Math.max(1,a>>1))}_applySamplingMode(){let e=this._descriptor,t=e.context?.gl,n=e.samplingMode,r=e.samplingMode;n===9985||n===9987?(n=9729,e.hasMipmap||(r=9729)):(n===9984||n===9986)&&(n=9728,e.hasMipmap||(r=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,n),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r),e.maxMipLevel!=null&&t.texParameteri(e.target,t.TEXTURE_MAX_LEVEL,e.maxMipLevel)}_applyWrapMode(){let e=this._descriptor,t=e.context?.gl;typeof e.wrapMode==`number`?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){let e=this._descriptor,t=e.context?.gl,n=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,n),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),o(t)}_applyAnisotropicFilteringParameters(){let e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}export{S as Texture};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{ZEROS as e}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{SizedPixelFormat as t,PixelType as n}from"./enums.js";import r from"./Texture.js";import{TextureDescriptor as i}from"./TextureDescriptor.js";function a(e,a,o=`nearest`,s=!1){let c=!(s&&a.pixelType===`u8`),l=c?n.FLOAT:n.UNSIGNED_BYTE,u=a.pixels==null||a.pixels.length===0?null:c?a.getAsRGBAFloat():a.getAsRGBA(),d=e.capabilities.textureFloatLinear,f=new i(a.width,a.height);return f.internalFormat=c?t.RGBA32F:6408,f.samplingMode=d&&(o===`bilinear`||o===`cubic`)?9729:9728,f.dataType=l,f.wrapMode=33071,new r(e,f,u)}function o(e,a){let{spacing:o,offsets:s,coefficients:c,size:[l,u]}=a,d=o[0]>1,f=new i(d?l*4:l,u);f.internalFormat=t.RGBA32F,f.dataType=n.FLOAT,f.samplingMode=9728,f.wrapMode=33071;let p=new Float32Array(d?l*u*16:s.length*2);if(d&&c!=null)for(let e=0,t=0;e<c.length;e++)p[t++]=c[e],e%3==2&&(p[t++]=1);else for(let e=0;e<u;e++)for(let t=0;t<l;t++){let n=(e*l+t)*4,r=(t*u+e)*2;p[n]=s[r],p[n+1]=s[r+1],p[n+3]=s[r]===-1?0:1}return new r(e,f,p)}function s(e,t){let n=new i(t.length/4,1);return n.internalFormat=6408,n.samplingMode=9728,n.wrapMode=33071,new r(e,n,t)}function c(e,t,a){let o=new i(a[0],a[1]);return o.internalFormat=6406,o.pixelFormat=6406,o.dataType=n.UNSIGNED_BYTE,o.samplingMode=9728,o.wrapMode=33071,new r(e,o,t)}function l(t,n,r,i=1,a=!0){return{u_flipY:a,u_applyTransform:!!t,u_opacity:i,u_transformSpacing:t?t.spacing:e,u_transformGridSize:t?t.size:e,u_targetImageSize:n,u_srcImageSize:r}}function u(e,t){return{u_colormapOffset:t||0,u_colormapMaxIndex:e?e.length/4-1:0}}function d(e){return{u_bandCount:e.bandCount,u_minOutput:e.minOutput,u_maxOutput:e.maxOutput,u_minCutOff:e.minCutOff,u_maxCutOff:e.maxCutOff,u_factor:e.factor,u_useGamma:e.useGamma,u_gamma:e.gamma,u_gammaCorrection:e.gammaCorrection}}function f(e){return{u_hillshadeType:e.hillshadeType,u_sinZcosAs:e.sinZcosAs,u_sinZsinAs:e.sinZsinAs,u_cosZs:e.cosZs,u_weights:e.weights,u_factor:e.factor,u_minValue:e.minValue,u_maxValue:e.maxValue}}export{s as createColormapTexture,c as createPixelMaskTexture,a as createRasterTexture,o as createTransformTexture,u as getColormapUniforms,l as getCommonUniforms,f as getShadedReliefUniforms,d as getStretchUniforms};
2
+ import{ZEROS as e}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{SizedPixelFormat as t,PixelType as n}from"./enums.js";import{Texture as r}from"./Texture.js";import{TextureDescriptor as i}from"./TextureDescriptor.js";function a(e,a,o=`nearest`,s=!1){let c=!(s&&a.pixelType===`u8`),l=c?n.FLOAT:n.UNSIGNED_BYTE,u=a.pixels==null||a.pixels.length===0?null:c?a.getAsRGBAFloat():a.getAsRGBA(),d=e.capabilities.textureFloatLinear,f=new i(a.width,a.height);return f.internalFormat=c?t.RGBA32F:6408,f.samplingMode=d&&(o===`bilinear`||o===`cubic`)?9729:9728,f.dataType=l,f.wrapMode=33071,new r(e,f,u)}function o(e,a){let{spacing:o,offsets:s,coefficients:c,size:[l,u]}=a,d=o[0]>1,f=new i(d?l*4:l,u);f.internalFormat=t.RGBA32F,f.dataType=n.FLOAT,f.samplingMode=9728,f.wrapMode=33071;let p=new Float32Array(d?l*u*16:s.length*2);if(d&&c!=null)for(let e=0,t=0;e<c.length;e++)p[t++]=c[e],e%3==2&&(p[t++]=1);else for(let e=0;e<u;e++)for(let t=0;t<l;t++){let n=(e*l+t)*4,r=(t*u+e)*2;p[n]=s[r],p[n+1]=s[r+1],p[n+3]=s[r]===-1?0:1}return new r(e,f,p)}function s(e,t){let n=new i(t.length/4,1);return n.internalFormat=6408,n.samplingMode=9728,n.wrapMode=33071,new r(e,n,t)}function c(e,t,a){let o=new i(a[0],a[1]);return o.internalFormat=6406,o.pixelFormat=6406,o.dataType=n.UNSIGNED_BYTE,o.samplingMode=9728,o.wrapMode=33071,new r(e,o,t)}function l(t,n,r,i=1,a=!0){return{u_flipY:a,u_applyTransform:!!t,u_opacity:i,u_transformSpacing:t?t.spacing:e,u_transformGridSize:t?t.size:e,u_targetImageSize:n,u_srcImageSize:r}}function u(e,t){return{u_colormapOffset:t||0,u_colormapMaxIndex:e?e.length/4-1:0}}function d(e){return{u_bandCount:e.bandCount,u_minOutput:e.minOutput,u_maxOutput:e.maxOutput,u_minCutOff:e.minCutOff,u_maxCutOff:e.maxCutOff,u_factor:e.factor,u_useGamma:e.useGamma,u_gamma:e.gamma,u_gammaCorrection:e.gammaCorrection}}function f(e){return{u_hillshadeType:e.hillshadeType,u_sinZcosAs:e.sinZcosAs,u_sinZsinAs:e.sinZsinAs,u_cosZs:e.cosZs,u_weights:e.weights,u_factor:e.factor,u_minValue:e.minValue,u_maxValue:e.maxValue}}export{s as createColormapTexture,c as createPixelMaskTexture,a as createRasterTexture,o as createTransformTexture,u as getColormapUniforms,l as getCommonUniforms,f as getShadedReliefUniforms,d as getStretchUniforms};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{PrimitiveType as e,PixelType as t}from"./enums.js";import{DisposableFramebufferObject as n}from"./FramebufferObject.js";import r from"./Texture.js";import{TextureDescriptor as i}from"./TextureDescriptor.js";import{VertexArrayObject as a}from"./VertexArrayObject.js";import{Pos2usLocations as o,Pos2us as s}from"./VertexAttributeLayouts.js";import{VertexBuffer as c}from"./VertexBuffer.js";import{WebGLDriverTestModule as l}from"./WebGLDriverTestModule.js";class u extends l{constructor(e){super(),this._rctx=e,this._program=e.programCache.get(`
2
+ import{PrimitiveType as e,PixelType as t}from"./enums.js";import{DisposableFramebufferObject as n}from"./FramebufferObject.js";import{Texture as r}from"./Texture.js";import{TextureDescriptor as i}from"./TextureDescriptor.js";import{VertexArrayObject as a}from"./VertexArrayObject.js";import{Pos2usLocations as o,Pos2us as s}from"./VertexAttributeLayouts.js";import{VertexBuffer as c}from"./VertexBuffer.js";import{WebGLDriverTestModule as l}from"./WebGLDriverTestModule.js";class u extends l{constructor(e){super(),this._rctx=e,this._program=e.programCache.get(`
3
3
  precision highp float;
4
4
 
5
5
  attribute vec2 position;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../core/Error.js";import t from"../../core/Logger.js";import{hasValue as n}from"../../core/object.js";import{PixelType as r,SizedPixelFormat as i,SizedDepthStencilFormat as a,SizedDepthFormat as o,CompressedTextureFormat as s,sizedPixelFormatValues as c}from"./enums.js";const l=()=>t.getLogger(`esri/views/webgl/textureUtils`);function u(e){let{width:t,height:n,depth:r}=e;(t!=null&&t<0||n!=null&&n<0||r!=null&&r<0)&&l().error(`Negative dimension parameters are not allowed!`);let{internalFormat:i}=e;if(i&&(p(i)||m(i))){let{linearFilterDepth:t,compareEnabled:n,samplingMode:r,hasMipmap:i}=e;i&&l().error(`Depth textures cannot have mipmaps`),t?r!==9729&&r!==9728&&l().error(`Depth textures cannot sample mipmaps`):(r!==9728&&l().error(`Depth textures without filtering must use NEAREST filtering`),n&&l().error(`Depth textures without filtering cannot use compare function`))}}function d(e){return f(e)||p(e)||m(e)}function f(e){return c.includes(e)}function p(e){return n(o,e)}function m(e){return n(a,e)}function h(e){return e!=null&&n(s,e)}function g(e){return e!=null&&`type`in e&&e.type===`compressed`}function _(e){return e!=null&&`byteLength`in e}function v(e){return e!=null&&!g(e)&&!_(e)}function y(e){return e===32879||e===35866}function b(e,t,n,r=1){let i=Math.max(t,n);return e===32879&&(i=Math.max(i,r)),Math.floor(Math.log2(i))+1}function x(t){if(t.internalFormat!=null)return t.internalFormat;switch(t.dataType){case r.FLOAT:switch(t.pixelFormat){case 6408:return i.RGBA32F;case 6407:return i.RGB32F;default:throw new e(`texture:unknown-format`,`Unable to derive format`)}case r.UNSIGNED_BYTE:switch(t.pixelFormat){case 6408:return i.RGBA8;case 6407:return i.RGB8}}let{pixelFormat:n}=t;return t.internalFormat=n===34041?a.DEPTH24_STENCIL8:n===6402?o.DEPTH_COMPONENT24:n,t.internalFormat}function S(e){let t=`width`in e?e.width:e.codedWidth,n=`height`in e?e.height:e.codedHeight;return e instanceof HTMLVideoElement&&(t=e.videoWidth,n=e.videoHeight),{width:t,height:n,depth:1}}export{b as calcMipmapLevels,x as deriveInternalFormat,S as getDimensions,y as is3DTarget,_ as isArrayBufferView,g as isCompressedData,h as isCompressedFormat,f as isSizedColorFormat,p as isSizedDepthFormat,m as isSizedDepthStencilFormat,d as isSizedPixelFormat,v as isTexImageSource,u as validateTexture};
2
+ import e from"../../core/Error.js";import t from"../../core/Logger.js";import{hasValue as n}from"../../core/object.js";import{PixelType as r,SizedPixelFormat as i,SizedDepthStencilFormat as a,SizedDepthFormat as o,sizedPixelFormatValues as s,CompressedTextureFormat as c}from"./enums.js";const l=()=>t.getLogger(`esri/views/webgl/textureUtils`);function u(e){let{width:t,height:n,depth:r}=e;(t!=null&&t<0||n!=null&&n<0||r!=null&&r<0)&&l().error(`Negative dimension parameters are not allowed!`);let{internalFormat:i}=e;if(i&&(p(i)||m(i))){let{linearFilterDepth:t,compareEnabled:n,samplingMode:r,hasMipmap:i}=e;i&&l().error(`Depth textures cannot have mipmaps`),t?r!==9729&&r!==9728&&l().error(`Depth textures cannot sample mipmaps`):(r!==9728&&l().error(`Depth textures without filtering must use NEAREST filtering`),n&&l().error(`Depth textures without filtering cannot use compare function`))}}function d(e){return f(e)||p(e)||m(e)}function f(e){return s.includes(e)}function p(e){return n(o,e)}function m(e){return n(a,e)}function h(e){return e!=null&&n(c,e)}function g(e){return e!=null&&`type`in e&&e.type===`compressed`}function _(e){return e!=null&&`byteLength`in e}function v(e){return e!=null&&!g(e)&&!_(e)}function y(e){return e===32879||e===35866}function b(e,t,n,r=1){let i=Math.max(t,n);return e===32879&&(i=Math.max(i,r)),Math.floor(Math.log2(i))+1}function x(t){if(t.internalFormat!=null)return t.internalFormat;switch(t.dataType){case r.FLOAT:switch(t.pixelFormat){case 6408:return i.RGBA32F;case 6407:return i.RGB32F;default:throw new e(`texture:unknown-format`,`Unable to derive format`)}case r.UNSIGNED_BYTE:switch(t.pixelFormat){case 6408:return i.RGBA8;case 6407:return i.RGB8}}let{pixelFormat:n}=t;return t.internalFormat=n===34041?a.DEPTH24_STENCIL8:n===6402?o.DEPTH_COMPONENT24:n,t.internalFormat}function S(e){let t=`width`in e?e.width:e.codedWidth,n=`height`in e?e.height:e.codedHeight;return e instanceof HTMLVideoElement&&(t=e.videoWidth,n=e.videoHeight),{width:t,height:n,depth:1}}export{b as calcMipmapLevels,x as deriveInternalFormat,S as getDimensions,y as is3DTarget,_ as isArrayBufferView,g as isCompressedData,h as isCompressedFormat,f as isSizedColorFormat,p as isSizedDepthFormat,m as isSizedDepthStencilFormat,d as isSizedPixelFormat,v as isTexImageSource,u as validateTexture};
@@ -77,19 +77,19 @@
77
77
  * | `VI` | U.S. Virgin Islands|
78
78
  * | `ZA` | South Africa|
79
79
  *
80
- * @deprecated since 5.2. Use the [Scale Range Slider component SupportedRegion](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/spriteSheetsUtils/#SupportedRegion) instead.
80
+ * @deprecated since 5.2. Use the [Scale Range Slider component Region](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/#Region) instead.
81
81
  * @since 5.0
82
82
  */
83
83
  export type SupportedRegion = LowerCaseRegion | UpperCaseRegion;
84
84
 
85
85
  /**
86
- * @deprecated since 5.2. Use the [Scale Range Slider component LowerCaseRegion](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/spriteSheetsUtils/#LowerCaseRegion) instead.
86
+ * @deprecated since 5.2. Use the [Scale Range Slider component Region](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/#Region) instead.
87
87
  * @since 5.0
88
88
  */
89
89
  export type LowerCaseRegion = "ae" | "ar" | "at" | "au" | "be" | "bg" | "bo" | "br" | "ca" | "ch" | "ci" | "cl" | "cn" | "co" | "cr" | "cz" | "de" | "dk" | "ee" | "eg" | "es" | "fi" | "fr" | "gb" | "gl" | "gr" | "gt" | "hk" | "id" | "ie" | "il" | "in" | "iq" | "is" | "it" | "jp" | "ke" | "kr" | "kw" | "li" | "lt" | "lu" | "lv" | "ma" | "mg" | "ml" | "mo" | "mx" | "my" | "ni" | "nl" | "no" | "nz" | "pe" | "pl" | "pr" | "pt" | "ro" | "ru" | "rw" | "se" | "sg" | "sk" | "sr" | "sv" | "th" | "tn" | "tw" | "us" | "ve" | "vi" | "za";
90
90
 
91
91
  /**
92
- * @deprecated since 5.2. Use the [Scale Range Slider component UpperCaseRegion](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/spriteSheetsUtils/#UpperCaseRegion) instead.
92
+ * @deprecated since 5.2. Use the [Scale Range Slider component Region](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/#Region) instead.
93
93
  * @since 5.0
94
94
  */
95
95
  export type UpperCaseRegion = Uppercase<LowerCaseRegion>;
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6874],{66344(e,t,i){i.d(t,{q:()=>o});const r=!!(0,i(44208).A)("esri-tests-disable-gpu-memory-measurements");Symbol.iterator;class s{get size(){return this._size}constructor(e=10485760,t=.3){this._maxSize=e,this._maxClientSizeRatio=t,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._clients=new Map,this._sizeLimits=new Map}destroy(){this.clearAll(),this._sizeLimits.clear(),this._clients.clear(),this._db.clear()}register(e){this._clients.set(e.id.slice(0,-1),e)}deregister(e){this.clear(e),this._sizeLimits.delete(e),this._clients.delete(e.id.slice(0,-1))}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,-1),this._checkSize()}get _maxClientSize(){return this._maxSize*this._maxClientSizeRatio}getSize(e,t){return this._db.get(e.id+t)?.size??0}put(e,t,i,s,a){t=e.id+t;let o=this._db.get(t);if(o&&(this._size-=o.size,e.size-=o.size,this._db.delete(t),o.entry!==i&&this._notifyRemove(t,o.entry,o.size,0)),s>this._maxSize)return void this._notifyRemove(t,i,s,0);if(void 0===i)return void console.warn("Refusing to cache undefined entry ");if(!s||s<0)return r||console.warn(`Refusing to cache entry with size ${s} for key ${t}`),void this._notifyRemove(t,i,0,0);let n=1+Math.max(a,-4)- -3;this._db.set(t,new l(i,s,n)),this._size+=s,e.size+=s,this._checkSize()}updateSize(e,t){t=e.id+t;let i=this._db.get(t);if(!i)return;this._size-=i.size,e.size-=i.size;let r=i.entry.usedMemory;for(;r>this._maxSize;){let e=this._notifyRemove(t,i.entry,r,1);if(!(null!=e&&e>0))return void this._db.delete(t);r=e}i.size=r,this._size+=r,e.size+=r,this._checkSize()}pop(e,t){t=e.id+t;let i=this._db.get(t);if(i)return this._size-=i.size,e.size-=i.size,this._db.delete(t),++this._hit,i.entry;++this._miss}get(e,t){t=e.id+t;let i=this._db.get(t);if(void 0!==i)return this._db.delete(t),i.lives=i.lifetime,this._db.set(t,i),++this._hit,i.entry;++this._miss}peek(e,t){let i=this._db.get(e.id+t);return i?++this._hit:++this._miss,i?.entry}get performanceInfo(){let e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},t={},i=[];this._db.forEach((e,r)=>{let s=e.lifetime;i[s]=(i[s]||0)+e.size,this._clients.forEach(i=>{let{id:s,name:l}=i;if(r.startsWith(s)){let i=t[l]||0;t[l]=i+e.size}})});let r={};this._clients.forEach(e=>{let i=e.name;if("hitRate"in e&&"number"==typeof e.hitRate&&!isNaN(e.hitRate)&&e.hitRate>0){let s=t[i]||0;t[i]=s,r[i]=Math.round(100*e.hitRate)+"%"}else r[i]="0%"});let s=Object.keys(t);s.sort((e,i)=>t[i]-t[e]),s.forEach(i=>e[i]=Math.round(t[i]/2**20)+"MB / "+r[i]);for(let t=i.length-1;t>=0;--t){let r=i[t];r&&(e["Priority "+(t+-3-1)]=Math.round(r/this._size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._clients.forEach(e=>e.resetHitRate())}clear(e){let t=e.id;this._db.forEach((e,i)=>{i.startsWith(t)&&(this._size-=e.size,this._db.delete(i),this._notifyRemove(i,e.entry,e.size,0))}),e.size=0}clearAll(){this._db.forEach((e,t)=>this._notifyRemove(t,e.entry,e.size,0)),this._clients.forEach(e=>e.size=0),this._size=0,this._db.clear()}*values(e){for(let[t,i]of this._db)t.startsWith(e.id)&&(yield i.entry)}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,t,i,r){let s=this._clients.get(e.split(a)[0])?.removeFunc,l=s?.(t,r,i);return"number"==typeof l?l:null}_checkSize(){this._sizeLimits.forEach((e,t)=>this._checkSizeLimits(e,t)),this._clients.forEach(e=>this._checkSizeLimits(this._maxClientSize,e)),this._checkSizeLimits(this.maxSize)}setMaxClientSize(e,t){null==t||t<=0?this._sizeLimits.delete(e):this._sizeLimits.set(e,t)}_checkSizeLimits(e,t){let i=t??this;if(i.size<=e)return;let r=t?.id,s=!0;for(;s;){s=!1;for(let[l,o]of this._db)if(0===o.lifetime&&(!r||l.startsWith(r))){let r=t??this._clients.get(l.split(a)[0]);if(this._purgeItem(l,o,r),i.size<=.9*e)return;s||=this._db.has(l)}}for(let[s,l]of this._db)if(!r||s.startsWith(r)){let r=t??this._clients.get(s.split(a)[0]);if(this._purgeItem(s,l,r),i.size<=.9*e)return}}_purgeItem(e,t,i){if(this._db.delete(e),t.lives<=1){this._size-=t.size,i&&(i.size-=t.size);let r=this._notifyRemove(e,t.entry,t.size,1);null!=r&&r>0&&(this._size+=r,i&&(i.size+=r),t.lives=t.lifetime,t.size=r,this._db.set(e,t))}else--t.lives,this._db.set(e,t)}}new s(0);class l{constructor(e,t,i){this.entry=e,this.size=t,this.lifetime=i,this.lives=i}}const a=":";class o{constructor(e,t){this.removeFunc=t,this.id="",this.name="",this.size=0,this._storage=new s(e,1),this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(e,t,i=1){this._storage.put(this,e,t,i,1)}pop(e){return this._storage.pop(this,e)}get(e){return this._storage.get(this,e)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}resetHitRate(){}}},60999(e,t,i){i.d(t,{DZ:()=>f,Ke:()=>p,QA:()=>g,Tj:()=>u,UT:()=>y,aD:()=>v,jJ:()=>h});var r=i(32198),s=i(69622),l=i(97768),a=i(17676),o=i(10107),n=i(64108);function h(e,t,i){return(0,a.Lx)(e.map((e,r)=>t.apply(i,[e,r])))}async function u(e,t,i){return(await(0,a.Lx)(e.map((e,r)=>t.apply(i,[e,r])))).map(e=>e.value)}function c(e){return{ok:!0,value:e}}function d(e){return{ok:!1,error:e}}async function p(e){if(null==e)return{ok:!1,error:Error("no promise provided")};try{return c(await e)}catch(e){return d(e)}}async function f(e){try{return c(await e)}catch(e){return(0,a.QP)(e),d(e)}}function g(e){if(!0===e.ok)return e.value;throw e.error}function y(e,t){return new m(e,t)}let m=class extends s.A{get value(){return null!=(e=this._result)&&!0===e.ok?e.value:null;var e}get error(){return null!=(e=this._result)&&!1===e.ok?e.error:null;var e}get finished(){return null!=this._result}constructor(e,t){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,l.DC)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;let{signal:i}=this._abortController;this.promise=e(i),this.promise.then(e=>{this._result=c(e),this._cleanup()},e=>{this._result=d(e),this._cleanup()}),this._abortHandle=(0,a.u7)(t,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,l.xt)(this._abortHandle),this._abortController=null}};(0,r.Cg)([(0,o.MZ)()],m.prototype,"value",null),(0,r.Cg)([(0,o.MZ)()],m.prototype,"error",null),(0,r.Cg)([(0,o.MZ)()],m.prototype,"finished",null),(0,r.Cg)([(0,o.MZ)()],m.prototype,"promise",void 0),(0,r.Cg)([(0,o.MZ)()],m.prototype,"_result",void 0),m=(0,r.Cg)([(0,n.$)("esri.core.asyncUtils.ReactiveTask")],m);class v{constructor(){this._sequence=Promise.resolve()}async acquire(){let e;this._sequence=new Promise(t=>{e=this._sequence.then(()=>t,()=>t)});let t=await e;return{[Symbol.dispose]:t}}async run(e){let t={stack:[],error:void 0,hasError:!1};try{return(0,r.mS)(t,await this.acquire(),!1),await e()}catch(e){t.error=e,t.hasError=!0}finally{(0,r.hk)(t)}}}},69397(e,t,i){i.d(t,{Qf:()=>n,Qh:()=>a,lM:()=>l,ro:()=>h,rq:()=>u});var r=i(44208),s=i(34275);function l(e){if(!e)return 0;let t=c;for(let i in e)e.hasOwnProperty(i)&&(t+=o(e[i],!1));return t}function a(e){if(!e)return 0;if("number"==typeof e[0])return n(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return u(e,8);let i=d;for(let r=0;r<t;r++)i+=o(e[r]);return i}(e);let t=c;for(let i in e)e.hasOwnProperty(i)&&(t+=o(e[i]));return t}function o(e,t=!0){switch(typeof e){case"object":return t?a(e):c;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function n(...e){return e.reduce((e,t)=>e+h(t),0)}function h(e,t=16){return e?(0,s.iu)(e)?e.byteLength+f:Array.isArray(e)?u(e,t):0:0}function u(e,t){return d+e.length*t}const c=32,d=16,p=(0,r.A)("ios")||!(0,r.A)("chrome")&&!(0,r.A)("opr")?8:4,f=145;i.d(t,["JY",0,p])},83027(e,t,i){const r=i(29953).ho;i.d(t,["h",0,r])},35982(e,t,i){i.d(t,{B:()=>u});var r=i(4576),s=i(71511),l=i(36563),a=i(53966),o=i(97768),n=i(17676),h=i(83027);class u{constructor(e,t,i,r,s={}){this._mainMethod=t,this._transferLists=i,this._listeners=[],this._onClientConnectedHandle=null,this._destroyed=!1,this._promise=(0,h.h)(e,{...s,schedule:r}).then(e=>{null!=this._thread||this._destroyed?e.close():(this._thread=e,this._promise=null,this._onClientConnectedHandle=this._thread.onClientConnected(e=>{s.hasInitialize&&e.invoke("initialize",{}).catch(()=>{});for(let t of this._listeners)this._connectListenerToClient(t,e);this._onClientConnected(e)}))}),this._promise.catch(t=>a.A.getLogger("esri.core.workers.WorkerHandle").error(`Failed to initialize ${e} worker: ${t}`))}on(e,t){let i=new c(e,t);return this._listeners.push(i),this._connectListener(i),(0,l.hA)(()=>{(0,r.TF)(this._listeners,i),i.destroy()})}[Symbol.dispose](){this.destroy()}destroy(){this._onClientConnectedHandle=(0,o.xt)(this._onClientConnectedHandle),this._thread&&=(this._thread.close(),null),this._promise=null;for(let e of this._listeners)e.destroy();this._listeners.length=0,this._transferLists={},this._destroyed=!0}invoke(e,t,i){return this.invokeMethod(this._mainMethod,e,t,i)}invokeMethod(e,t,i,r){return this._invokeMethod(e,[t],i,r)}invokeMethodWithArgs(e,t,i,r){return this._invokeMethod(e,t,i,r)}_invokeMethod(e,t,i,r){if(this._thread){let s=this._transferLists[e],l=s?s(...t):[];return this._thread.apply(e,t,{transferList:l,signal:i,jobPriority:r})}return this._promise?this._promise.then(()=>((0,n.Te)(i),this._invokeMethod(e,t,i,r))):Promise.reject((0,n.NK)())}broadcast(e,t){return this._thread?Promise.all(this._thread.broadcast(t,e)).then(d):this._promise?this._promise.then(()=>this.broadcast(e,t)):Promise.reject((0,n.NK)())}get promise(){return this._promise}_onClientConnected(e){}_connectListener(e){this._thread&&e.add(this._thread.on(e.eventName,e.callback))}_connectListenerToClient(e,t){e.add(t.on(e.eventName,e.callback))}}class c{constructor(e,t){this.eventName=e,this.callback=t,this._handles=new s.A}add(e){this._handles.add(e)}destroy(){this._handles.destroy()}}function d(){}},54239(e,t,i){i.d(t,{A:()=>m});var r,s=i(32198),l=i(4576),a=i(66552),o=i(25482),n=i(86211),h=i(67076),u=i(91429),c=i(97348),d=i(43937),p=i(36005);const f=(0,a.O)()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),g=f.jsonValues.slice();(0,l.Xy)(g,"orthometric");const y=(0,a.O)()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let m=r=class extends o.o{constructor(e){super(e),this.origin=0,this.associatedSpatialReference=null,this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}read(e,t){super.read(e,t),("service"===t?.origin||"web-scene"===t?.origin)&&(this.origin="service"===t.origin?2:1,this.associatedSpatialReference=null)}writeHeightModel(e,t,i){return f.write(e,t,i)}readHeightModel(e,t,i){return f.read(e)||(i?.messages&&i.messages.push(function(e,t){return new h.A("height-model:unsupported",`Height model of value '${e}' is not supported`,t)}(e,{context:i})),null)}readHeightUnit(e,t,i){return y.read(e)||(i?.messages&&i.messages.push(v(e,{context:i})),null)}readHeightUnitService(e,t,i){return(0,n.LA)(e)||y.read(e)||(i?.messages&&i.messages.push(v(e,{context:i})),null)}readVertCRS(e,t){return t.vertCRS||t.ellipsoid||t.geoid}clone(){return new r({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS,origin:this.origin,associatedSpatialReference:this.associatedSpatialReference})}equals(e){return!!e&&(this===e||this.heightModel===e.heightModel&&this.heightUnit===e.heightUnit&&this.vertCRS===e.vertCRS)}static fromSpatialReference(e){let{latestVcsWkid:t,vcsWkid:i}=e;if(!i)return null;let s=(null==t?null:c.B.get(t))??c.B.get(i);return s?new r({heightModel:0===s.type?"gravity-related-height":"ellipsoidal",heightUnit:(0,n.LA)(s.unit.name),vertCRS:s.datum,origin:3,associatedSpatialReference:e}):null}write(e,t){return t={origin:"web-scene",...t},super.write(e,t)}static fromJSON(e){if(!e)return null;let t=new r;return t.read(e,{origin:"web-scene"}),t}};function v(e,t){return new h.A("height-unit:unsupported",`Height unit of value '${e}' is not supported`,t)}(0,s.Cg)([(0,u.MZ)()],m.prototype,"origin",void 0),(0,s.Cg)([(0,u.MZ)()],m.prototype,"associatedSpatialReference",void 0),(0,s.Cg)([(0,u.MZ)({type:f.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:g,default:"ellipsoidal",write:{isRequired:!0,alwaysWriteDefaults:!0}}}}})],m.prototype,"heightModel",void 0),(0,s.Cg)([(0,d.K)("web-scene","heightModel")],m.prototype,"writeHeightModel",null),(0,s.Cg)([(0,p.w)(["web-scene","service"],"heightModel")],m.prototype,"readHeightModel",null),(0,s.Cg)([(0,u.MZ)({type:y.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:y.jsonValues,write:{writer:y.write,isRequired:!0}}}}})],m.prototype,"heightUnit",void 0),(0,s.Cg)([(0,p.w)("web-scene","heightUnit")],m.prototype,"readHeightUnit",null),(0,s.Cg)([(0,p.w)("service","heightUnit")],m.prototype,"readHeightUnitService",null),(0,s.Cg)([(0,u.MZ)({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],m.prototype,"vertCRS",void 0),(0,s.Cg)([(0,p.w)("service","vertCRS",["vertCRS","ellipsoid","geoid"])],m.prototype,"readVertCRS",null),m=r=(0,s.Cg)([(0,u.$K)("esri.geometry.HeightModelInfo")],m)},38732(e,t,i){i.r(t),i.d(t,{default:()=>S});var r=i(32198),s=i(56507),l=i(49186),a=i(97768),o=i(25728),n=i(17676),h=i(84952),u=i(91429),c=i(4146),d=i(89186),p=i(18768),f=i(85707),g=i(34287),y=i(8303),m=i(10873),v=i(87378),_=i(35982);class w extends _.B{constructor(e=null){super("LercWorker","_decode",{_decode:e=>[e.buffer]},e,{strategy:"dedicated"}),this.schedule=e,this.ref=0}decode(e,t,i){return e&&0!==e.byteLength?this.invoke({buffer:e,options:t},i):Promise.resolve(null)}release(){--this.ref<=0&&(b.forEach((e,t)=>{e===this&&b.delete(t)}),this.destroy())}}const b=new Map;var C=i(36005);let M=class extends((0,f.a)((0,d.f)((0,p.b)((0,g.q)((0,y.A)((0,o.M)(c.A))))))){constructor(...e){super(...e),this.capabilities={operations:{supportsTileMap:!1}},this.copyright=null,this.path=null,this.minScale=void 0,this.maxScale=void 0,this.opacity=1,this.operationalLayerType="ArcGISTiledElevationServiceLayer",this.sourceJSON=null,this.type="elevation",this.url=null,this.version=null,this._lercDecoder=function(e=null){let t=b.get(e);return t||(null==e?(t=new w,b.set(null,t)):(t=new w(t=>e.immediate.schedule(t)),b.set(e,t))),++t.ref,t}()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._lercDecoder=(0,a.Gz)(this._lercDecoder)}readCapabilities(e,t){let i=t.capabilities&&t.capabilities.split(",").map(e=>e.toLowerCase().trim());return i?{operations:{supportsTileMap:i.includes("tilemap")}}:{operations:{supportsTileMap:!1}}}get memoizedElevationQueryDependencies(){return[this.loadStatus,this.tileInfo,this.fullExtent,this.spatialReference]}readVersion(e,t){let i=t.currentVersion;return i||=9.3,i}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"],supportsData:!1,validateItem:e=>{if(e.typeKeywords)for(let t=0;t<e.typeKeywords.length;t++)if("elevation 3d layer"===e.typeKeywords[t].toLowerCase())return!0;throw new l.A("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}' ",{type:"Image Service",expectedType:"Image Service Elevation 3D Layer"})}},e).catch(n.QP).then(()=>this._fetchImageService(t))),Promise.resolve(this)}async fetchTile(e,t,i,r){let a=r?.signal,o={responseType:"array-buffer",signal:a,useQueue:r?.useQueue,priority:r?.priority},n={noDataValue:r?.noDataValue};await this.load(),await this._fetchTileAvailability(e,t,i,r);let h=await(0,s.A)(this.getTileUrl(e,t,i),o),u=await this._lercDecoder.decode(h.data,n,a);if(!u)throw new l.A("elevation-layer:tile-decode-failed","Failed to decode elevation tile data.");return new v.A({values:u.pixelData,width:u.width,height:u.height,noDataValue:u.noDataValue})}getTileUrl(e,t,i){let r=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,s=(0,h.x0)({...this.parsedUrl.query,blankTile:!r&&null});return`${this.parsedUrl.path}/tile/${e}/${t}/${i}${s?"?"+s:""}`}async queryElevation(e,t){let{query:r}=await i.e(4943).then(()=>i(54943));return(0,n.Te)(t),r(this,e,t)}async createElevationSampler(e,t){let{createSampler:r}=await i.e(4943).then(()=>i(54943));return(0,n.Te)(t),r(this,e,t)}_fetchTileAvailability(e,t,i,r){return this.tilemapCache?this.tilemapCache.fetchAvailability(e,t,i,r):Promise.resolve("unknown")}async _fetchImageService(e){if(this.sourceJSON)return this.sourceJSON;let t={query:{f:"json",...this.parsedUrl.query},responseType:"json",signal:e},i=await(0,s.A)(this.parsedUrl.path,t);i.ssl&&(this.url=this.url?.replace(/^http:/i,"https:")),this.sourceJSON=i.data,this.read(i.data,{origin:"service",url:this.parsedUrl})}get hasOverriddenFetchTile(){return!this.fetchTile[A]}};(0,r.Cg)([(0,u.MZ)({readOnly:!0})],M.prototype,"capabilities",void 0),(0,r.Cg)([(0,C.w)("service","capabilities",["capabilities"])],M.prototype,"readCapabilities",null),(0,r.Cg)([(0,u.MZ)({json:{read:{source:"copyrightText"}}})],M.prototype,"copyright",void 0),(0,r.Cg)([(0,u.MZ)({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],M.prototype,"path",void 0),(0,r.Cg)([(0,u.MZ)({type:["show","hide"]})],M.prototype,"listMode",void 0),(0,r.Cg)([(0,u.MZ)({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],M.prototype,"minScale",void 0),(0,r.Cg)([(0,u.MZ)({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],M.prototype,"maxScale",void 0),(0,r.Cg)([(0,u.MZ)({json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],M.prototype,"opacity",void 0),(0,r.Cg)([(0,u.MZ)({type:["ArcGISTiledElevationServiceLayer"]})],M.prototype,"operationalLayerType",void 0),(0,r.Cg)([(0,u.MZ)()],M.prototype,"sourceJSON",void 0),(0,r.Cg)([(0,u.MZ)({json:{read:!1},value:"elevation",readOnly:!0})],M.prototype,"type",void 0),(0,r.Cg)([(0,u.MZ)()],M.prototype,"memoizedElevationQueryDependencies",null),(0,r.Cg)([(0,u.MZ)(m.OZ)],M.prototype,"url",void 0),(0,r.Cg)([(0,u.MZ)()],M.prototype,"version",void 0),(0,r.Cg)([(0,C.w)("version",["currentVersion"])],M.prototype,"readVersion",null),M=(0,r.Cg)([(0,u.$K)("esri.layers.ElevationLayer")],M);const A=Symbol("default-fetch-tile");M.prototype.fetchTile[A]=!0;const S=M},89186(e,t,i){var r=i(32198),s=i(91429),l=i(16930),a=i(87045),o=i(65509),n=i(25943),h=i(36005);i.d(t,["f",0,e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.copyright=null,this.minScale=0,this.maxScale=0,this.spatialReference=null,this.tileInfo=null,this.tilemapCache=null}destroy(){this.tilemapCache?.destroy?.()}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}get supportsBlankTile(){return this.version>=10.2}readTilemapCache(e,t,i){let r=t.capabilities?.toLowerCase().includes("tilemap"),{minLOD:s,maxLOD:l,minScale:h,maxScale:u}=t;if(null==s&&null==l&&(0!==h||0!==u)){let e=e=>Math.round(1e4*e)/1e4;h=e(h||t.tileInfo.lods[0].scale),u=e(u||t.tileInfo.lods[t.tileInfo.lods.length-1].scale);for(let i of t.tileInfo.lods){let t=e(i.scale);s=t>=h?i.level:s,l=t>=u?i.level:l}}if(r)return new n.d({layer:this,minLOD:s,maxLOD:l});if(t.tileInfo){let e=new a.A;return e.read(t.tileInfo,i),new o.A(e,s,l)}return null}};return(0,r.Cg)([(0,s.MZ)({json:{read:{source:"copyrightText"}}})],i.prototype,"copyright",void 0),(0,r.Cg)([(0,s.MZ)()],i.prototype,"minScale",void 0),(0,r.Cg)([(0,h.w)("service","minScale")],i.prototype,"readMinScale",null),(0,r.Cg)([(0,s.MZ)()],i.prototype,"maxScale",void 0),(0,r.Cg)([(0,h.w)("service","maxScale")],i.prototype,"readMaxScale",null),(0,r.Cg)([(0,s.MZ)({type:l.A})],i.prototype,"spatialReference",void 0),(0,r.Cg)([(0,s.MZ)({readOnly:!0})],i.prototype,"supportsBlankTile",null),(0,r.Cg)([(0,s.MZ)({type:a.A})],i.prototype,"tileInfo",void 0),(0,r.Cg)([(0,s.MZ)()],i.prototype,"tilemapCache",void 0),(0,r.Cg)([(0,h.w)("service","tilemapCache",["capabilities","tileInfo"])],i.prototype,"readTilemapCache",null),(0,r.Cg)([(0,s.MZ)()],i.prototype,"version",void 0),i=(0,r.Cg)([(0,s.$K)("esri.layers.mixins.ArcGISCachedService")],i),i}])},18768(e,t,i){var r=i(32198),s=i(53966),l=i(91429),a=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,a.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,a.Jf)(e,s.A.getLogger(this)))}};return(0,r.Cg)([(0,l.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,l.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,l.$K)("esri.layers.mixins.ArcGISService")],i),i}])},85707(e,t,i){var r=i(32198),s=i(91429),l=i(54239);i.d(t,["a",0,e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.heightModelInfo=null}read(e,t){super.read(e,t),"service"===t?.origin&&2===this.heightModelInfo?.origin&&(this.heightModelInfo.associatedSpatialReference=this.getAtOrigin("spatialReference","service"))}};return(0,r.Cg)([(0,s.MZ)({readOnly:!0,type:l.A})],i.prototype,"heightModelInfo",void 0),i=(0,r.Cg)([(0,s.$K)("esri.layers.mixins.HeightModelInfoMixin")],i),i}])},8303(e,t,i){var r=i(32198),s=i(92602),l=i(70333),a=i(56507),o=i(60999),n=i(49186),h=i(36563),u=i(53966),c=i(97768),d=i(17676),p=i(84952),f=i(91429),g=i(77548),y=i(20655),m=i(80812),v=i(41318),_=i(10407),w=i(26121),b=i(36005),C=i(43937);const M={credential:null,user:null};i.d(t,["A",0,e=>{let t=e,A=class extends t{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){super.destroy(),this.portalItem=(0,c.pR)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}get portalItem(){return this._get("portalItem")}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,i){if(t.itemId)return new m.default({id:t.itemId,portal:i?.portal})}writePortalItem(e,t){e?.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem?.id)try{let{load:r}=await i.e(1204).then(()=>i(41204));return(0,d.Te)(t),await r({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap,populateGroupLayer:e.populateGroupLayer},t)}catch(e){throw(0,d.zf)(e)||u.A.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async reloadFromPortal(e,t){if(!this.loaded||!this.portalItem?.id)return!1;let r=t?.signal?null:new AbortController;try{let{reload:s}=await i.e(1204).then(()=>i(41204));return r&&this.addHandles((0,h.rE)(r),"reloadFromPortal"),await s({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap,populateGroupLayer:e.populateGroupLayer},t?.signal?t:{signal:r.signal})}catch(e){throw(0,d.zf)(e)||u.A.getLogger(this).warn(`Failed to reload layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}finally{r&&this.removeHandles("reloadFromPortal")}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch(e=>((0,d.QP)(e),!0)))}async setUserPrivileges(e,t){if(!s.A.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{let{features:{edit:i,fullEdit:r},content:{updateItem:s}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",i),this._set("userHasFullEditingPrivileges",r),this._set("userHasUpdateItemPrivileges",s)}catch(e){(0,d.QP)(e)}}async _fetchUserPrivileges(e,t){let i=this.portalItem;if(!e||!i||!i.loaded||i.sourceUrl)return this._fetchFallbackUserPrivileges(t);let r,s,a=!l.id?.findCredential(this.url),o=e===i.id;if(o&&i.portal.user)return this._getUserPrivileges(i,a);if(o)r=i.portal.url;else try{r=await(0,g.wI)(this.url,t)}catch(e){(0,d.QP)(e)}if(!r||!(0,p.b8)(r,i.portal.url))return this._fetchFallbackUserPrivileges(t);try{let e=null==t?null:t.signal;s=await(l.id?.getCredential(`${r}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,d.QP)(e)}if(!s)return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}};try{if(o?await i.reload():(i=new m.default({id:e,portal:{url:r}}),await i.load(t)),i.portal.user)return this._getUserPrivileges(i,a)}catch(e){(0,d.QP)(e)}return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}}}_getUserPrivileges(e,t){let i=(0,_.It)(e);return t&&(i.features.edit=!0),i}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,d.QP)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){let t=this.url?l.id?.findCredential(this.url):null;if(!t)return!0;let i=M.credential===t?M.user:await this._fetchEditingUser(e);return M.credential=t,M.user=i,null==i?.privileges||i.privileges.includes("features:user:edit")}async _fetchEditingUser(e){let t=this.portalItem?.portal?.user;if(t)return t;let i=l.id?.findServerInfo(this.url??"");if(!i?.owningSystemUrl)return null;let r=`${i.owningSystemUrl}/sharing/rest`,s=y.A.getDefault();if(s&&s.loaded&&(0,p.S8)(s.restUrl)===(0,p.S8)(r))return s.user;let n=`${r}/community/self`,h=null==e?null:e.signal,u=await(0,o.Ke)((0,a.A)(n,{authMode:"no-prompt",query:{f:"json"},signal:h}));return u.ok?v.A.fromJSON(u.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){return(0,w.wN)(this.portalItem,t)?(t?.messages?.push(new n.A("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,r.Cg)([(0,f.MZ)({type:m.default})],A.prototype,"portalItem",null),(0,r.Cg)([(0,b.w)("web-document","portalItem",["itemId"])],A.prototype,"readPortalItem",null),(0,r.Cg)([(0,C.K)("web-document","portalItem",{itemId:{type:String}})],A.prototype,"writePortalItem",null),(0,r.Cg)([(0,f.MZ)({clonable:!1})],A.prototype,"resourceReferences",void 0),(0,r.Cg)([(0,f.MZ)({type:Boolean,readOnly:!0})],A.prototype,"userHasEditingPrivileges",void 0),(0,r.Cg)([(0,f.MZ)({type:Boolean,readOnly:!0})],A.prototype,"userHasFullEditingPrivileges",void 0),(0,r.Cg)([(0,f.MZ)({type:Boolean,readOnly:!0})],A.prototype,"userHasUpdateItemPrivileges",void 0),A=(0,r.Cg)([(0,f.$K)("esri.layers.mixins.PortalLayer")],A),A}])},87378(e,t,i){i.d(t,{A:()=>o});var r,s=i(34275),l=i(78888);const a=Symbol("ElevationTileDataClass");class o{static{r=a}constructor({values:e,width:t,height:i,noDataValue:l}){this[r]=!0,this._hasNoDataValues=null,this._minValue=null,this._maxValue=null,this.values=(0,s.vZ)(e)?e:new Float32Array(e),this.width=t,this.height=i,this.noDataValue=l}get hasNoDataValues(){if(null==this._hasNoDataValues){let e=this.noDataValue;this._hasNoDataValues=this.values.includes(e)}return this._hasNoDataValues}get minValue(){return this._ensureBounds(),this._minValue}get maxValue(){return this._ensureBounds(),this._maxValue}get usedMemory(){return this.values.byteLength+256}_ensureBounds(){if(null!=this._minValue)return;let{noDataValue:e,values:t}=this,i=1/0,r=-1/0,s=!0;for(let l of t)l===e?this._hasNoDataValues=!0:(i=l<i?l:i,r=l>r?l:r,s=!1);s?(this._minValue=0,this._maxValue=0):(this._minValue=i,this._maxValue=r>-3e38?r:0)}static{this.from=(0,l.qf)(o)}}},91806(e,t,i){i.d(t,{A:()=>n});var r,s=i(32198),l=i(25482),a=i(91429),o=i(78888);let n=class extends l.o{static{r=this}constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new r({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,s.Cg)([(0,a.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],n.prototype,"cols",void 0),(0,s.Cg)([(0,a.MZ)({type:o.jz,json:{write:!0}})],n.prototype,"level",void 0),(0,s.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],n.prototype,"levelValue",void 0),(0,s.Cg)([(0,a.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],n.prototype,"origin",void 0),(0,s.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],n.prototype,"resolution",void 0),(0,s.Cg)([(0,a.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],n.prototype,"rows",void 0),(0,s.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],n.prototype,"scale",void 0),n=r=(0,s.Cg)([(0,a.$K)("esri.layers.support.LOD")],n)},87045(e,t,i){i.d(t,{A:()=>_});var r,s=i(32198),l=i(66552),a=i(25482),o=i(86211),n=i(91429),h=i(78888),u=i(86738),c=i(16930),d=i(21325),p=i(28735),f=i(91806),g=i(72802),y=i(36005),m=i(43937);const v=new l.J({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",JPEGPlus:"jpgplus",pbf:"pbf"});let _=class extends a.o{static{r=this}static create(e={}){let{resolutionFactor:t=1,scales:i,size:s=256,spatialReference:l=c.A.WebMercator,numLODs:a=24}=e;if(!(0,d.fn)(l)){let e=[];if(i)for(let t=0;t<i.length;t++){let r=i[t];e.push(new f.A({level:t,scale:r,resolution:r}))}else{let t=5e-4;for(let i=a-1;i>=0;i--)e.unshift(new f.A({level:i,scale:t,resolution:t})),t*=2}return new r({dpi:96,lods:e,origin:new u.A(0,0,l),size:[s,s],spatialReference:l})}let n=(0,d.Vp)(l),h=e.origin?new u.A({x:e.origin.x,y:e.origin.y,spatialReference:l}):n?new u.A({x:n.origin[0],y:n.origin[1],spatialReference:l}):new u.A({x:0,y:0,spatialReference:l}),p=1/(39.37*(0,o.GA)(l)*96),g=[];if(i)for(let e=0;e<i.length;e++){let t=i[e],r=t*p;g.push(new f.A({level:e,scale:t,resolution:r}))}else{let e=(0,d.EA)(l)?512/s*591657527.5917094:256/s*591657527.591555,i=Math.ceil(a/t);g.push(new f.A({level:0,scale:e,resolution:e*p}));for(let r=1;r<i;r++){let i=e/2**t,s=i*p;g.push(new f.A({level:r,scale:i,resolution:s})),e=i}}return new r({dpi:96,lods:g,origin:h,size:[s,s],spatialReference:l})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){let{spatialReference:e,origin:t}=this;if(e&&t){let i=(0,d.Vp)(e);return e.isWrappable&&!!i&&Math.abs(i.origin[0]-t.x)<=i.dx}return!1}readOrigin(e,t){return u.A.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,i=0,r=[],s=this._levelToLOD={};e&&(t=-1/0,i=1/0,e.forEach(e=>{r.push(e.scale),t=e.scale>t?e.scale:t,i=e.scale<i?e.scale:i,s[e.level]=e})),this._set("scales",r),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){let t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];let i=Math.floor(e),r=i+1;return t[i]/(t[i]/t[r])**(e-i)}scaleToZoom(e){let t=this.scales,i=t.length-1,r=0;for(;r<i;r++){let i=t[r],s=t[r+1];if(i<=e)return r;if(s===e)return r+1;if(i>e&&s<e)return r+Math.log(i/e)/Math.log(i/s)}return r}tileAt(e,t,i,r){let s,l,a=this.lodAt(e);if(!a)return null;if("number"==typeof t)s=t,l=i;else if((0,d.aI)(t.spatialReference,this.spatialReference))s=t.x,l=t.y,r=i;else{let e=(0,p.Cv)(t,this.spatialReference);if(null==e)return null;s=e.x,l=e.y,r=i}let o=a.resolution*this.size[0],n=a.resolution*this.size[1];return r??=new g.U(0,0,0),r.level=e,r.row=Math.floor((this.origin.y-l)/n+.001),r.col=Math.floor((s-this.origin.x)/o+.001),this.updateTileInfo(r),r}updateTileInfo(e,t=0){if(!("extent"in e))return!1;let i=this.lodAt(e.level);if(!i&&1===t){let t=this.lods[this.lods.length-1];t.level<e.level&&(i=t)}if(!i)return!1;let r=e.level-i.level,s=i.resolution*this.size[0]/2**r,l=i.resolution*this.size[1]/2**r;return e.extent[0]=this.origin.x+e.col*s,e.extent[1]=this.origin.y-(e.row+1)*l,e.extent[2]=e.extent[0]+s,e.extent[3]=e.extent[1]+l,!0}upsampleTile(e){let t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel||(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,t){let i=this.lodAt(t.level);if(null==i)return null;let{resolution:r}=i,s=r*this.size[0],l=r*this.size[1];return e[0]=this.origin.x+t.col*s,e[1]=this.origin.y-(t.row+1)*l,e[2]=e[0]+s,e[3]=e[1]+l,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return r.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===e)return null;let t=(512===this.size[0]&&256===e?-1:0)+ +!!this.spatialReference.isGeographic;if(this.size[0]===e&&0===t)return this;let i=[],s=this.lods.length-t;for(let e=0;e<s;e++){let r=e+t,{scale:s,resolution:l}=r>=0?this.lods[r]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};i.push(new f.A({level:e,scale:s,resolution:l}))}return new r({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:i})}_initializeUpsampleLevels(){let e=this.lods;this._upsampleLevels=[];let t=null;for(let i=0;i<e.length;i++){let r=e[i];this._upsampleLevels[r.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/r.resolution:0},t=r}}};(0,s.Cg)([(0,n.MZ)({type:Number,json:{write:!0}})],_.prototype,"compressionQuality",void 0),(0,s.Cg)([(0,n.MZ)({type:Number,json:{write:!0}})],_.prototype,"dpi",void 0),(0,s.Cg)([(0,n.MZ)({type:String,json:{read:v.read,write:v.write,origins:{"web-scene":{read:!1,write:!1}}}})],_.prototype,"format",void 0),(0,s.Cg)([(0,n.MZ)({readOnly:!0})],_.prototype,"isWrappable",null),(0,s.Cg)([(0,n.MZ)({type:u.A,json:{write:!0}})],_.prototype,"origin",void 0),(0,s.Cg)([(0,y.w)("origin")],_.prototype,"readOrigin",null),(0,s.Cg)([(0,n.MZ)({type:[f.A],value:null,json:{write:!0}})],_.prototype,"lods",null),(0,s.Cg)([(0,n.MZ)({readOnly:!0})],_.prototype,"scales",void 0),(0,s.Cg)([(0,n.MZ)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],_.prototype,"size",void 0),(0,s.Cg)([(0,y.w)("size",["rows","cols"])],_.prototype,"readSize",null),(0,s.Cg)([(0,m.K)("size",{cols:{type:h.jz},rows:{type:h.jz}})],_.prototype,"writeSize",null),(0,s.Cg)([(0,n.MZ)({type:c.A,json:{write:!0}})],_.prototype,"spatialReference",void 0),_=r=(0,s.Cg)([(0,n.$K)("esri.layers.support.TileInfo")],_)},65509(e,t,i){i.d(t,{A:()=>l});var r=i(49186),s=i(17676);class l{constructor(e,t=0,i=e.lods[e.lods.length-1].level){this.tileInfo=e,this.minLOD=t,this.maxLOD=i,e.lodAt(t)||(this.minLOD=e.lods[0].level),e.lodAt(i)||(this.maxLOD=e.lods[e.lods.length-1].level)}get effectiveMinLOD(){return this.minLOD??this.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.tileInfo.lods[this.tileInfo.lods.length-1].level}getAvailability(e,t,i){let r=this.tileInfo?.lodAt(e);return!r||e<this.minLOD||e>this.maxLOD?"unavailable":r.cols&&r.rows?i>=r.cols[0]&&i<=r.cols[1]&&t>=r.rows[0]&&t<=r.rows[1]?"unknown":"unavailable":"unknown"}async fetchAvailability(e,t,i,l){await(0,s.NO)(l);let a=this.getAvailability(e,t,i);if("unavailable"===a)throw new r.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i});return a}async fetchAvailabilityUpsample(e,t,i,r,l){await(0,s.NO)(l),r.level=e,r.row=t,r.col=i;let a=this.tileInfo;return a.updateTileInfo(r),this.fetchAvailability(e,t,i,l).catch(e=>{if((0,s.zf)(e))throw e;if(a.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,l);throw e})}}},72802(e,t,i){i.d(t,{U:()=>s});var r=i(19419);class s{constructor(e,t,i,s=(0,r.vt)()){this._level=e,this._row=t,this._col=i,this.extent=s}get id(){return this._id??=`${this.level}/${this.row}/${this.col}`,this._id}get level(){return this._level}set level(e){this._level=e,this._id=null}get row(){return this._row}set row(e){this._row=e,this._id=null}get col(){return this._col}set col(e){this._col=e,this._id=null}toJSON(){return{level:this._level,row:this._row,col:this._col,extent:this.extent}}static fromJSON(e){return new s(e.level,e.row,e.col,e.extent)}}},25943(e,t,i){i.d(t,{d:()=>C});var r,s=i(32198),l=i(56507),a=i(69622),o=i(49186),n=i(36563),h=(i(44208),i(66344)),u=i(15142),c=i(17676),d=i(36708),p=i(76030),f=i(84952),g=i(91429),y=i(72802),m=i(4718),v=i(69397);class _{constructor(e){!function(e){if(!e?.location)throw new o.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new o.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new o.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new o.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new o.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,m.o8)(t));let r=this.location.width,s=this.location.height,l=!0,a=!0,n=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*s/32)),h=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(a=!1,n[h]|=1<<t):l=!1,31===t&&++h}a?(this._availability="unavailable",this.byteSize=40):l?(this._availability="available",this.byteSize=40):(this._availability=n,this.byteSize=40+(0,v.Qf)(n))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,s=i>>5,l=this._availability;return s<0||s>l.length?"unknown":l[s]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||l.A,{row:r,col:s,width:a,height:n}=e,h={query:{f:"json"}};return t=t?{...h,...t}:h,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:s,width:a,height:n},valid:!0,data:Array(a*n).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==s||e.location.width!==a||e.location.height!==n))throw new o.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:s,width:a,height:n}});return _.fromJSON(e)})}static fromJSON(e){return Object.freeze(new _(e))}}function w(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new o.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let C=class extends a.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=l.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new h.q(2097152),this.addHandles((0,d.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),d.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof _){let s=r.getAvailability(t,i);if("unavailable"===s)throw b(e,t,i);return s}if((0,c.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,s){r.level=e,r.row=t,r.col=i;let l=this.layer.tileInfo;l.updateTileInfo(r);let a=this.fetchAvailability(e,t,i,s).catch(e=>{if((0,c.zf)(e))throw e;if(l.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,s);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,s,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,s,l){if(!this._prefetchingEnabled)return;let a=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(a))return;let o=new AbortController;l.then(()=>o.abort(),()=>o.abort());let h=!1,u=(0,n.hA)(()=>{h||(h=!0,o.abort())});if(this.addHandles(u,a),await(0,p.md)(10,o.signal).catch(()=>{}),h||(h=!0,this.removeHandles(a)),(0,c.G4)(o))return;let d=new y.U(e,t,i),f={...s,signal:o.signal},g=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&g.upsampleTile(d);++e){let e=this.fetchAvailability(d.level,d.row,d.col,f);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new u.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new o.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let s=this._tmpTilemapDefinition,l=this._tilemapFromCache(e,t,i,s);if(l)return Promise.resolve(l);let a=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,c.u7)(a,()=>t((0,c.NK)()));let i=w(s),l=this._pendingTilemapRequests[i];if(!l){l=_.fromDefinition(s,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=l,l.then(e,e)}l.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,f.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let s=w(r);return this._tilemapCache.get(s)}get test(){}};(0,s.Cg)([(0,g.MZ)({constructOnly:!0})],C.prototype,"layer",void 0),(0,s.Cg)([(0,g.MZ)({constructOnly:!0})],C.prototype,"minLOD",void 0),(0,s.Cg)([(0,g.MZ)({constructOnly:!0})],C.prototype,"maxLOD",void 0),(0,s.Cg)([(0,g.MZ)({constructOnly:!0})],C.prototype,"request",void 0),(0,s.Cg)([(0,g.MZ)({constructOnly:!0})],C.prototype,"size",void 0),C=r=(0,s.Cg)([(0,g.$K)("esri.layers.support.TilemapCache")],C)},10407(e,t,i){i.d(t,{It:()=>p,LG:()=>a,OM:()=>h,Sm:()=>u,Y:()=>o,bK:()=>n,sQ:()=>c});var r=i(99917),s=i(16930),l=i(28735);function a(e,t){if(!o(e,t)){let i=e.typeKeywords;i?i.push(t):e.typeKeywords=[t]}}function o(e,t){return!!e.typeKeywords?.includes(t)}function n(e){return o(e,d.HOSTED_SERVICE)}function h(e,t){let i=e.typeKeywords;if(i){let e=i.indexOf(t);e>-1&&i.splice(e,1)}}function u(e,t,i){i?a(e,t):h(e,t)}async function c(e){let t,i=e.clone().normalize();if(i.length>1)for(let e of i)t?e.width>t.width&&(t=e):t=e;else t=i[0];return async function(e){let t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,l.ci)(e);let i=s.A.WGS84;return await(0,r.initializeProjection)(t,i),(0,r.project)(e,i)}(t)}const d={CHARTS:"Charts",CATALOG_LAYER:"CatalogLayer",DYNAMIC:"Dynamic",DEVELOPER_BASEMAP:"DeveloperBasemap",GROUP_LAYER_MAP:"Map",HOSTED_SERVICE:"Hosted Service",JSAPI:"ArcGIS API for JavaScript",LOCAL_SCENE:"ViewingMode-Local",METADATA:"Metadata",MULTI_LAYER:"Multilayer",ORIENTED_IMAGERY_LAYER:"OrientedImageryLayer",PARCEL_FABRIC:"ParcelFabric",SINGLE_LAYER:"Singlelayer",SUBTYPE_GROUP_LAYER:"SubtypeGroupLayer",SUBTYPE_GROUP_TABLE:"SubtypeGroupTable",TABLE:"Table",TILED_IMAGERY:"Tiled Imagery",UTILITY_NETWORK:"UtilityNetwork"};function p(e){let{portal:t,isOrgItem:i,itemControl:r}=e,s=t.user?.privileges,l=!s||s.includes("features:user:edit"),a=!!i&&!!s?.includes("features:user:fullEdit"),o="update"===r||"admin"===r;return o?a=l=!0:a&&(l=!0),{features:{edit:l,fullEdit:a},content:{updateItem:o}}}i.d(t,["mm",0,d])},78553(e,t,i){i.d(t,{D:()=>l,p:()=>s});var r=i(78888);function s(e){let t=(0,r.Vr)(100*(1-e));return Math.max(0,Math.min(t,100))}function l(e){let t=1-e/100;return Math.max(0,Math.min(t,1))}},26121(e,t,i){i.d(t,{I6:()=>u,ci:()=>h,dL:()=>n,wN:()=>c});var r=i(49186),s=i(84952),l=i(77548),a=i(20655),o=i(59923);async function n(e){let t=[];for(let i of e.allLayers)if("beforeSave"in i&&"function"==typeof i.beforeSave){let e=i.beforeSave();e&&t.push(e)}await Promise.allSettled(t)}function h(e,t,i){let s=(e.messages??[]).filter(({type:e})=>"error"===e).map(({name:e,message:t,details:i})=>new r.A(e,t,i));if(e.blockedRelativeUrls&&(s=s.concat(e.blockedRelativeUrls.map(e=>(0,o.GL)("url",`Relative url '${e}' is not supported`)))),i){let{ignoreUnsupported:e,supplementalUnsupportedErrors:t=[],requiredPropertyChecksDisabled:r}=i;e&&(s=s.filter(({name:e})=>!(o.MG.has(e)||t.includes(e)))),r&&(s=s.filter(e=>"web-document-write:property-required"!==e.name))}if(s.length>0)throw new r.A(t.errorName,"Failed to save due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:s})}function u(e){return(0,l.qd)(e).some(e=>!!e.charts?.length)}function c(e,t){let i=t?.portal,r=e?.id&&(e.portal||a.A.getDefault());return!!i&&!!r&&!(0,s.ut)(r.restUrl,i.restUrl)}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6553,8241],{56512(e,t,i){function r(e){let t,i,r=[],o=!1;return function(...n){return o&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(n,r)||(i=e.apply(this,n),t=this,r=n,o=!0),i}}i.d(t,{B:()=>r})},76553(e,t,i){function r(e){return e&&"getAtOrigin"in e&&"originOf"in e}i.d(t,{H:()=>r})},65806(e,t,i){i.d(t,{g:()=>s});var r=i(51850),o=i(99917),n=i(9762);function s(e,t,i,r){if((0,o.canProjectWithoutEngine)(e.spatialReference,i))return l[0]=e.x,l[1]=e.y,l[2]=e.z??0,(0,n.projectBuffer)(l,e.spatialReference,0,t,i,0);let s=(0,o.tryProject)(e,i,r);return!!s&&(t[0]=s.x,t[1]=s.y,t[2]=s.z??0,!0)}const l=(0,r.vt)()},27993(e,t,i){i.d(t,{F:()=>l});var r=i(99917),o=i(16930),n=i(9762),s=i(65806);function l(e,t,i,o){return!(null==t||null==o||e.length<2)&&((0,r.canProjectWithoutEngine)(t,o)?(0,n.projectBuffer)(e,t,0,i,o,0,1):(a.x=e[0],a.y=e[1],a.z=e[2],a.spatialReference=t,(0,s.g)(a,i,o)))}const a={x:0,y:0,z:0,hasZ:!0,hasM:!1,spatialReference:o.A.WGS84,type:"point"}},80754(e,t,i){i.d(t,{kS:()=>u,kd:()=>a});var r=i(82799),o=i(16930),n=i(60408),s=i(52006);const l={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new r.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:o.A.WebMercator}),minus180Line:new r.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:o.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new r.A({paths:[[[180,-180],[180,180]]],spatialReference:o.A.WGS84}),minus180Line:new r.A({paths:[[[-180,-180],[-180,180]]],spatialReference:o.A.WGS84})}};function a(e,t){return Math.ceil((e-t)/(2*t))}function u(e,t){if((0,s.Ed)(e))for(let i of function(e){return(0,n.Bi)(e)?e.curveRings:e.curvePaths}(e))for(let e of i)if((0,s.aO)(e)){let[i,r]=e.c;i[0]+=t,r[0]+=t}else if((0,s.FG)(e)){let[i,r]=e.a;i[0]+=t,r[0]+=t}else if((0,s.n1)(e)){let[i,r,o]=e.b;i[0]+=t,r[0]+=t,o[0]+=t}else e[0]+=t;for(let i of function(e){return(0,n.Bi)(e)?e.rings:e.paths}(e))for(let e of i)e[0]+=t;return e}i.d(t,["j7",0,l])},61528(e,t,i){i.r(t);var r=i(32198),o=i(56507),n=i(69540),s=i(49186),l=i(44208),a=i(53966),u=i(25728),h=i(17676),p=i(36708),c=i(91429),d=i(87024),f=i(5443),g=i(16930),y=i(4146),m=i(52136),v=i(18768),S=i(69208),_=i(34287),C=i(8303),M=i(25036),A=i(10873),w=i(58325),x=i(88546),R=i(20655),T=i(24212),E=i(80215),b=i(97159),Z=i(16215),k=i(72772),I=i(98697),G=i(36005);let P=class extends((0,v.b)((0,_.q)((0,C.A)((0,M.j)((0,u.M)((0,S.d)((0,m.p)((0,n.OU)(y.A))))))))){readModifications(e,t,i){this._modificationsSource={url:(0,b.f)(e,i),context:i}}initialize(){this.addHandles([(0,p.on)(()=>this.modifications,"after-changes",()=>{this.modifications=this.modifications,this._modificationsGeneration++},p.OH),(0,p.wB)(()=>this.modifications,()=>this._modificationsGeneration++)])}constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.modifications=null,this._modificationsSource=null,this.spatialReference=x.Zx,this.fullExtent=x.zq,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null,this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0,this._rootTilesetJSON=null,this._rootTileset=null,this._key=null,this._session=null,this._rootRequestPromise=null,this.queryElevationCallback=null,this._modificationsGeneration=0,this._simulateGoogleUrl=!1}get supportedSpatialReferences(){return this.initialized&&this.esriCrsSpatialReference?[g.A.WGS84,this.esriCrsSpatialReference]:[g.A.WGS84]}get fullExtents(){let e=this.fullExtent??x.zq;return this.initialized&&this.esriCrsFullExtent?[e,this.esriCrsFullExtent]:[e]}set elevationInfo(e){(null==e||"absolute-height"===e.mode)&&this._set("elevationInfo",e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get rootTilesetJSON(){return this._rootTilesetJSON}get rootTileset(){return this._rootTileset}get key(){return this._key}get session(){return this._session}_findSessionParameter(e){let t=[e];for(;t?.length>0;){let e=t.pop();if(!e)return;for(let[i,r]of Object.entries(e)){if("uri"===i)try{let e=new URL("https://tmp"+r).searchParams.get("session");if(e)return e}catch{}"object"==typeof r&&r&&t.push(r)}}return null}async requestRootAndSession(e){let t=(e,t)=>new s.A("3dtiles-init:"+e,t);return this._rootRequestPromise||=new Promise((i,r)=>{this.url||r(t("url-missing","Layer url missing")),this._key=this.customParameters?this.customParameters.key:null,new Promise((e,i)=>{if(this.replacesTerrain&&!this._key){let r=this.portalItem?.portal||this.parent?.portalItem?.portal||R.A.getDefault();r.signIn().then(()=>{r.g3dTilesEnabled?(0,o.A)(r.restUrl+"/portals/self/modules/g3dtiles",{responseType:"json",query:{f:"json"}}).then(t=>{this._key=t.data.keyString,e()},()=>i(t("g3dtiles-key-error","Error fetching Google 3D Tiles key from portal"))):i(t("g3dTilesEnabled-false","Google 3D Tiles are not enabled on Portal "+r.url))},()=>i(t("sign-in-failed","Error signing in to Portal")))}else e()}).then(()=>{(0,o.A)(this.url,{query:this._key?{key:this._key,token:this.apiKey}:{token:this.apiKey},responseType:"array-buffer",signal:e}).then(e=>{try{this._rootTilesetJSON=JSON.parse((new TextDecoder).decode(e.data))}catch(e){return void r(t("root-parse-failed","Error parsing root tile, details: "+e))}this._rootTilesetJSON?(this._session=this._findSessionParameter(this._rootTilesetJSON),this._rootTileset=e.data,this.fullExtent=(0,x.uB)(this._rootTilesetJSON),(0,x._8)(this._rootTilesetJSON)&&(this.esriCrsFullExtent=(0,x.uB)(this._rootTilesetJSON,!0),this.esriCrsSpatialReference=this.esriCrsFullExtent.spatialReference,this.spatialReference=this.esriCrsSpatialReference),i(),this._rootRequestPromise=null):r(t("root-is-null","Root tile is null."))},e=>{(0,h.QP)(e),r(t("root-load-failed","Error loading root tile")),this._rootRequestPromise=null,a.A.getLogger("IntegratedMesh3DTilesLayer").error("Layer loading failed",e)})},e=>r(e))}),this._rootRequestPromise}_haveWGS84ZModifications(e){for(let t of e)if(!t.geometry?.spatialReference||115700===t.geometry?.spatialReference.vcsWkid&&4326===t.geometry?.spatialReference.wkid)return!0;return!1}async _doLoad(e){let t=null==e?null:e.signal;try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new s.A("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(e){(0,h.QP)(e)}if(null!=this._modificationsSource){let t=await w.A.fromUrl(this._modificationsSource.url,this.spatialReference,e,!0);if(this._haveWGS84ZModifications(t)){await(0,k.initialize)();try{let e=(0,I.Ir)(null,t.toArray(),g.A.WGS84),i=(0,k.switchMeshModificationPolygonVCSSync)({modifications:e,inVCS:115700});i.success&&i.modifications&&(0,I.H1)(i.modifications,t)}catch(e){a.A.getLogger(this).error("convert-mesh-modification-z-error","Error when converting:",e)}}this.setAtOrigin("modifications",t,this._modificationsSource.context.origin),this._modificationsSource=null}await this.requestRootAndSession(t)}async beforeSave(){if(null==this._modificationsSource){let{modifications:e}=this;e&&e.length>0&&await(0,k.initialize)()}else await this.load().then(()=>{},()=>{})}get memoizedElevationQueryDependencies(){return[this.loadStatus,null!=this.queryElevationCallback,(0,T.M7)(this.elevationInfo),this._modificationsGeneration]}get hasAttributionData(){return!1}_validateElevationInfo(e){let t="Integrated mesh 3d tiles layers";(0,T.XF)(a.A.getLogger(this),(0,T.B)(t,"absolute-height",e)),(0,T.XF)(a.A.getLogger(this),(0,T.tW)(t,e))}get replacesTerrain(){return this.hasGoogleUrl&&this.isUsedAsGroundLayer}get isUsedAsGroundLayer(){return(0,l.A)("enable-feature:im-as-ground")?(0,Z.S)(this.parent)||(0,E.Q)(this.parent):(0,Z.S)(this.parent)}get hasGoogleUrl(){return this._simulateGoogleUrl||!!this.url?.match(/.+\.googleapis.com/)}get test(){}};(0,r.Cg)([(0,c.MZ)({type:["IntegratedMesh3DTilesLayer"]})],P.prototype,"operationalLayerType",void 0),(0,r.Cg)([(0,c.MZ)({type:w.A,clonable:e=>e?.clone()??null}),(0,d.P)({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],P.prototype,"modifications",void 0),(0,r.Cg)([(0,c.MZ)({clonable:e=>e?{...e}:null})],P.prototype,"_modificationsSource",void 0),(0,r.Cg)([(0,G.w)(["web-scene","portal-item"],"modifications")],P.prototype,"readModifications",null),(0,r.Cg)([(0,c.MZ)({type:g.A})],P.prototype,"spatialReference",void 0),(0,r.Cg)([(0,c.MZ)({type:f.A})],P.prototype,"fullExtent",void 0),(0,r.Cg)([(0,c.MZ)({readOnly:!0})],P.prototype,"supportedSpatialReferences",null),(0,r.Cg)([(0,c.MZ)({type:[f.A]})],P.prototype,"fullExtents",null),(0,r.Cg)([(0,c.MZ)(A.Yj)],P.prototype,"elevationInfo",null),(0,r.Cg)([(0,c.MZ)({type:["show","hide"]})],P.prototype,"listMode",void 0),(0,r.Cg)([(0,c.MZ)(A.OZ)],P.prototype,"url",void 0),(0,r.Cg)([(0,c.MZ)({readOnly:!0})],P.prototype,"type",void 0),(0,r.Cg)([(0,c.MZ)({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],P.prototype,"path",void 0),(0,r.Cg)([(0,c.MZ)({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:!1,write:!1}}}})],P.prototype,"minScale",void 0),(0,r.Cg)([(0,c.MZ)({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:!1,write:!1}}}})],P.prototype,"maxScale",void 0),(0,r.Cg)([(0,c.MZ)()],P.prototype,"queryElevationCallback",void 0),(0,r.Cg)([(0,c.MZ)()],P.prototype,"_modificationsGeneration",void 0),(0,r.Cg)([(0,c.MZ)()],P.prototype,"memoizedElevationQueryDependencies",null),(0,r.Cg)([(0,c.MZ)({readOnly:!0})],P.prototype,"hasAttributionData",null),(0,r.Cg)([(0,c.MZ)()],P.prototype,"replacesTerrain",null),(0,r.Cg)([(0,c.MZ)()],P.prototype,"isUsedAsGroundLayer",null),(0,r.Cg)([(0,c.MZ)()],P.prototype,"hasGoogleUrl",null),(0,r.Cg)([(0,c.MZ)()],P.prototype,"_simulateGoogleUrl",void 0),P=(0,r.Cg)([(0,c.$K)("esri.layers.IntegratedMesh3DTilesLayer")],P);const O=P;i.d(t,["default",0,O])},52136(e,t,i){var r=i(32198),o=i(91429);i.d(t,["p",0,e=>{let t=e,i=class extends t{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null==e?(this._clearOverride("apiKey"),this.clear("apiKey","user")):this._override("apiKey",e)}};return(0,r.Cg)([(0,o.MZ)({type:String})],i.prototype,"apiKey",null),i=(0,r.Cg)([(0,o.$K)("esri.layers.mixins.APIKeyMixin")],i),i}])},24212(e,t,i){i.d(t,{$7:()=>a,B:()=>l,M7:()=>p,XF:()=>h,tW:()=>u,w7:()=>s});var r=i(56512),o=i(86211),n=i(16271);function s(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:d}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function a(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function h(e,t){t&&e.warn(".elevationInfo=",t)}function p(e){return(e?.offset??0)*(0,n.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",n=(0,o.mq)(i);return n?(0,o.oU)(e,r,n):0});const c={mode:"absolute-height",offset:0},d={mode:"on-the-ground",offset:null}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9078],{32198(t,e,r){function n(t,e,r,n){var s,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(i<3?s(a):i>3?s(e,r,a):s(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function s(t,e,r){if(null!=e){if("object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(t){return Promise.reject(t)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}r.d(e,{Cg:()=>n,hk:()=>a,mS:()=>s}),Object.create,Object.create;var i="function"==typeof SuppressedError?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};function a(t){function e(e){t.error=t.hasError?new i(e,t.error,"An error was suppressed during disposal."):e,t.hasError=!0}var r,n=0;return function s(){for(;r=t.stack.pop();)try{if(!r.async&&1===n)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(t){return e(t),s()})}else n|=1}catch(t){e(t)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}},9093(t,e,r){function n(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function s(t){return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}r.d(e,{o8:()=>s,vt:()=>n});const i=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:i,clone:s,create:n,fromValues:function(t,e,r,n,s,i,a,o,u,l,h,c,p,f,d,g){return[t,e,r,n,s,i,a,o,u,l,h,c,p,f,d,g]}},Symbol.toStringTag,{value:"Module"})),r.d(e,["zK",0,i])},35522(t,e,r){r.d(e,{$A:()=>k,Bw:()=>i,C:()=>a,Cc:()=>P,DI:()=>v,Io:()=>_,Ln:()=>m,Om:()=>S,Qr:()=>c,Re:()=>l,S8:()=>w,T9:()=>g,WQ:()=>u,Z0:()=>I,_S:()=>f,aI:()=>R,ei:()=>T,fw:()=>q,gL:()=>A,hG:()=>M,hZ:()=>o,hs:()=>y,jk:()=>d,lw:()=>h,m3:()=>b,oW:()=>E,t2:()=>C,tn:()=>p,ze:()=>x});var n=r(51850),s=r(34304);function i(t){let e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function u(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function l(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function h(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function c(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function p(t,e){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t}function f(t,e){return t[0]=Math.sign(e[0]),t[1]=Math.sign(e[1]),t[2]=Math.sign(e[2]),t}function d(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function g(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function y(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function m(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function _(t,e){let r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return Math.sqrt(r*r+n*n+s*s)}function M(t,e){let r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return r*r+n*n+s*s}function b(t){let e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function x(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function v(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function w(t,e=t){let r=e[0],n=e[1],s=e[2],i=r*r+n*n+s*s;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i),t}function S(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function k(t,e,r){let n=e[0],s=e[1],i=e[2],a=r[0],o=r[1],u=r[2];return t[0]=s*u-i*o,t[1]=i*a-n*u,t[2]=n*o-s*a,t}function P(t,e,r,n){let s=e[0],i=e[1],a=e[2];return t[0]=s+n*(r[0]-s),t[1]=i+n*(r[1]-i),t[2]=a+n*(r[2]-a),t}function I(t,e,r){let n=e[0],s=e[1],i=e[2];return t[0]=r[0]*n+r[4]*s+r[8]*i+r[12],t[1]=r[1]*n+r[5]*s+r[9]*i+r[13],t[2]=r[2]*n+r[6]*s+r[10]*i+r[14],t}function T(t,e,r){let n=e[0],s=e[1],i=e[2];return t[0]=n*r[0]+s*r[3]+i*r[6],t[1]=n*r[1]+s*r[4]+i*r[7],t[2]=n*r[2]+s*r[5]+i*r[8],t}function A(t,e,r){return q(t,e,r[0],r[1],r[2],r[3])}function q(t,e,r,n,s,i){let a=e[0],o=e[1],u=e[2],l=n*u-s*o,h=s*a-r*u,c=r*o-n*a,p=n*c-s*h,f=s*l-r*c,d=r*h-n*l,g=2*i;return t[0]=a+l*g+2*p,t[1]=o+h*g+2*f,t[2]=u+c*g+2*d,t}const G=(0,n.vt)(),V=(0,n.vt)();function C(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function R(t,e){if(t===e)return!0;let r=t[0],n=t[1],i=t[2],a=e[0],o=e[1],u=e[2],l=(0,s.FD)();return Math.abs(r-a)<=l*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=l*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=l*Math.max(1,Math.abs(i),Math.abs(u))}function E(t,e,r){let n=r[0]-e[0],s=r[1]-e[1],i=r[2]-e[2],a=n*n+s*s+i*i;return a>0?(a=1/Math.sqrt(a),t[0]=n*a,t[1]=s*a,t[2]=i*a,t):(t[0]=0,t[1]=0,t[2]=0,t)}const F=l,U=h,Z=c,D=_,O=M,L=i,j=b;Object.freeze(Object.defineProperty({__proto__:null,abs:p,add:u,angle:function(t,e){w(G,t),w(V,e);let r=S(G,V);return r>1?0:r<-1?Math.PI:Math.acos(r)},bezier:function(t,e,r,n,s,i){let a=1-i,o=a*a,u=i*i,l=o*a,h=3*i*o,c=3*u*a,p=u*i;return t[0]=e[0]*l+r[0]*h+n[0]*c+s[0]*p,t[1]=e[1]*l+r[1]*h+n[1]*c+s[1]*p,t[2]=e[2]*l+r[2]*h+n[2]*c+s[2]*p,t},ceil:function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},clamp:function(t,e=0,r=1){return t[0]=Math.min(Math.max(t[0],e),r),t[1]=Math.min(Math.max(t[1],e),r),t[2]=Math.min(Math.max(t[2],e),r),t},copy:a,cross:k,crossAndNormalize:function(t,e,r){let n=e[0],s=e[1],i=e[2],a=r[0],o=r[1],u=r[2],l=s*u-i*o,h=i*a-n*u,c=n*o-s*a,p=Math.sqrt(l*l+h*h+c*c);return t[0]=l/p,t[1]=h/p,t[2]=c/p,t},direction:E,dist:D,distance:_,div:Z,divide:c,dot:S,equals:R,exactEquals:C,floor:function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},hermite:function(t,e,r,n,s,i){let a=i*i,o=a*(2*i-3)+1,u=a*(i-2)+i,l=a*(i-1),h=a*(3-2*i);return t[0]=e[0]*o+r[0]*u+n[0]*l+s[0]*h,t[1]=e[1]*o+r[1]*u+n[1]*l+s[1]*h,t[2]=e[2]*o+r[2]*u+n[2]*l+s[2]*h,t},inverse:v,len:L,length:i,lerp:P,max:g,min:d,mul:U,multiply:h,negate:x,normalize:w,random:function(t,e=1){let r=s.Ov,n=2*r()*Math.PI,i=2*r()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*a,t[1]=Math.sin(n)*a,t[2]=i*e,t},rotateX:function(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0],i[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),i[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t},rotateY:function(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),i[1]=s[1],i[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t},rotateZ:function(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),i[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),i[2]=s[2],t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t},round:function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},scale:y,scaleAndAdd:m,scaleTo:function(t,e){return y(t,t,e/L(t))},set:o,sign:f,sqrDist:O,sqrLen:j,squaredDistance:M,squaredLength:b,str:function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},sub:F,subtract:l,transformMat3:T,transformMat4:I,transformMat4Z:function(t,e){return e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]},transformQuat:A,transformQuatValues:q},Symbol.toStringTag,{value:"Module"})),r.d(e,["Il",0,L,"jb",0,F,"lo",0,O,"uE",0,j])},69397(t,e,r){r.d(e,{Qf:()=>u,Qh:()=>a,lM:()=>i,ro:()=>l,rq:()=>h});var n=r(44208),s=r(34275);function i(t){if(!t)return 0;let e=c;for(let r in t)t.hasOwnProperty(r)&&(e+=o(t[r],!1));return e}function a(t){if(!t)return 0;if("number"==typeof t[0])return u(t);if(Array.isArray(t))return function(t){let e=t.length;if(0===e||"number"==typeof t[0])return h(t,8);let r=p;for(let n=0;n<e;n++)r+=o(t[n]);return r}(t);let e=c;for(let r in t)t.hasOwnProperty(r)&&(e+=o(t[r]));return e}function o(t,e=!0){switch(typeof t){case"object":return e?a(t):c;case"string":return function(t){return 32+t.length}(t);case"number":return 16;case"boolean":return 4;default:return 8}}function u(...t){return t.reduce((t,e)=>t+l(e),0)}function l(t,e=16){return t?(0,s.iu)(t)?t.byteLength+d:Array.isArray(t)?h(t,e):0:0}function h(t,e){return p+t.length*e}const c=32,p=16,f=(0,n.A)("ios")||!(0,n.A)("chrome")&&!(0,n.A)("opr")?8:4,d=145;r.d(e,["JY",0,f])},51624(t,e,r){r.d(e,{A:()=>l});var n=r(44208),s=r(69397),i=r(93687);const a=4294967296,o=new TextDecoder("utf-8"),u=(0,n.A)("safari")||(0,n.A)("ios")?6:(0,n.A)("ff")?12:32;class l{constructor(t,e,r=0,n=t?.byteLength??0){this._tag=0,this._dataType=99,this._init(t,e,r,n)}[Symbol.dispose](){this.release()}_init(t,e,r,n){this._data=t,this._dataView=e,this._pos=r,this._end=n}get usedMemory(){return 64+(0,s.Qf)(this._data)}asUnsafe(){return this}clone(){return new l(this._data,this._dataView,this._pos,this._end)}clonePooled(){return l.constructPooled(this._data,this._dataView,this._pos,this._end)}static constructPooled(t,e,r=0,n=t?.byteLength??0){let s=l.pool.acquire();return s._init(t,e,r,n),s}pos(){return this._pos}move(t){this._pos=t}nextTag(t){for(;;){if(this._pos===this._end)return!1;let e=this._decodeVarint();if(this._tag=e>>3,this._dataType=7&e,!t||t===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;let t=this._decodeVarint();return this._tag=t>>3,this._dataType=7&t,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let t=4294967295;if(t=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128||(t=(t|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128)||(t=(t|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128)||(t=(t|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128)||(t=(t|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128))return t;throw Error("Varint overflow")}getPackedEnd(){let t=this.getUInt32();return this._pos+t}getUInt64(){return this._decodeVarint()}getSInt32(){let t=this.getUInt32();return t>>>1^-(1&t)}getSInt64(){return this._decodeSVarint()}getBool(){let t=0!==this._data[this._pos];return this._skip(1),t}getEnum(){return this._decodeVarint()}getFixed64(){let t=this._dataView,e=this._pos,r=t.getUint32(e,!0)+t.getUint32(e+4,!0)*a;return this._skip(8),r}getSFixed64(){let t=this._dataView,e=this._pos,r=t.getUint32(e,!0)+t.getInt32(e+4,!0)*a;return this._skip(8),r}getDouble(){let t=this._dataView.getFloat64(this._pos,!0);return this._skip(8),t}getFixed32(){let t=this._dataView.getUint32(this._pos,!0);return this._skip(4),t}getSFixed32(){let t=this._dataView.getInt32(this._pos,!0);return this._skip(4),t}getFloat(){let t=this._dataView.getFloat32(this._pos,!0);return this._skip(4),t}getString(){let t=this._getLength(),e=this._pos,r=this._toString(this._data,e,e+t);return this._skip(t),r}getBytes(){let t=this._getLength(),e=this._pos,r=this._toBytes(this._data,e,e+t);return this._skip(t),r}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(t,e,r,n){let s=this.getMessage(),i=t(s,e,r,n);return s.release(),i}processMessage(t){let e=this.getMessage(),r=t(e);return e.release(),r}getMessage(){let t=this._getLength(),e=l.pool.acquire();return e._init(this._data,this._dataView,this._pos,this._pos+t),this._skip(t),e}release(){l.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case 0:this._decodeVarint();break;case 1:this._skip(8);break;case 2:this._skip(this._getLength());break;case 5:this._skip(4);break;default:throw Error("Invalid data type!")}}skipToEnd(){for(;this.next();)this.skip()}skipLen(t){this._skip(t)}_skip(t){if(this._pos+t>this._end)throw Error("Attempt to skip past the end of buffer!");this._pos+=t}_decodeVarint(){let t=this._data,e=this._pos,r=0,n=0;if(this._end-e>=10){if(n=t[e++],r|=127&n,128&n&&(n=t[e++],r|=(127&n)<<7,128&n&&(n=t[e++],r|=(127&n)<<14,128&n&&(n=t[e++],r|=(127&n)<<21,128&n&&(n=t[e++],r+=268435456*(127&n),128&n&&(n=t[e++],r+=34359738368*(127&n),128&n&&(n=t[e++],r+=4398046511104*(127&n),128&n&&(n=t[e++],r+=562949953421312*(127&n),128&n&&(n=t[e++],r+=72057594037927940*(127&n),128&n&&(n=t[e++],r+=0x8000000000000000*(127&n),128&n))))))))))throw Error("Varint too long!")}else{let s=1;for(;e!==this._end&&(n=t[e],128&n);)++e,r+=(127&n)*s,s*=128;if(e===this._end)throw Error("Varint overrun!");++e,r+=n*s}return this._pos=e,r}_decodeSVarint(){let t,e=this._data,r=0,n=0,s=1&e[this._pos];if(n=e[this._pos++],r|=127&n,!(128&n&&(n=e[this._pos++],r|=(127&n)<<7,128&n)&&(n=e[this._pos++],r|=(127&n)<<14,128&n)&&(n=e[this._pos++],r|=(127&n)<<21,128&n)&&(n=e[this._pos++],r+=268435456*(127&n),128&n)&&(n=e[this._pos++],r+=34359738368*(127&n),128&n)&&(n=e[this._pos++],r+=4398046511104*(127&n),128&n)))return s?-(r+1)/2:r/2;if(t=BigInt(r),n=e[this._pos++],t+=562949953421312n*BigInt(127&n),!(128&n&&(n=e[this._pos++],t+=72057594037927936n*BigInt(127&n),128&n)&&(n=e[this._pos++],t+=9223372036854775808n*BigInt(127&n),128&n)))return Number(s?-(t+1n)/2n:t/2n);throw Error("Varint too long!")}_getLength(){if(2!==this._dataType)throw Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(t,e,r){if((r=Math.min(this._end,r))-e>u){let n=t.subarray(e,r);return o.decode(n)}let n="",s="";for(let i=e;i<r;++i){let e=t[i];128&e?s+="%"+e.toString(16):(n+=decodeURIComponent(s)+String.fromCharCode(e),s="")}return s.length&&(n+=decodeURIComponent(s)),n}_toBytes(t,e,r){return r=Math.min(this._end,r),new Uint8Array(t.buffer,e,r-e)}static{this.pool=new i.A(()=>new l(null,null),void 0,t=>{t._data=null,t._dataView=null})}}},48526(t,e,r){r.d(e,{A:()=>y});var n,s=r(32198),i=r(4576),a=r(4718),o=r(91429),u=r(5443),l=r(91075),h=r(86738),c=r(16930),p=r(90634),f=r(47610),d=r(56993),g=r(43937);let y=n=class extends l.A{constructor(t){super(function(t){if(!t)return;let{points:e,hasM:r,hasZ:n,spatialReference:s}=t;switch(e??=[],e?.at(0)?.length){case 4:n??=!0,r??=!0;break;case 3:n??=!0!==r,r??=!n;break;default:n??=!1,r??=!1}return s??=c.A.WGS84,{...t,hasM:r,hasZ:n,points:e,spatialReference:s}}(t)),this.points=[],this.type="multipoint"}get cache(){return this.commitProperty("points"),this.commitProperty("hasZ"),this.commitProperty("hasM"),this.commitProperty("spatialReference"),{}}get extent(){let t=(0,p.ge)(this);return t?new u.A({...t,spatialReference:this.spatialReference}):null}writePoints(t,e){e.points=(0,a.o8)(this.points)}clone(){let{points:t,spatialReference:e,hasM:r,hasZ:s}=this;return new n({points:(0,a.o8)(t),spatialReference:e.clone(),hasM:r,hasZ:s})}equals(t){if(this===t)return!0;if(null==t)return!1;let e=this.spatialReference,r=t.spatialReference;return!(null!=e!=(null!=r)||null!=e&&null!=r&&!e.equals(r))&&(0,i.aI)(this.points,t.points,f.v6)}addPoint(t){return(0,d.h)(this,t),Array.isArray(t)?this.points.push(t):this.points.push(t.toArray()),this.notifyChange("points"),this}getPoint(t){if(!this._validateInputs(t))return null;let e=this.points[t],r={x:e[0],y:e[1],spatialReference:this.spatialReference},n=2;return this.hasZ&&(r.z=e[2],n=3),this.hasM&&(r.m=e[n]),new h.A(r)}removePoint(t){if(!this._validateInputs(t))return null;let e=new h.A(this.points.splice(t,1)[0],this.spatialReference);return this.notifyChange("points"),e}setPoint(t,e){return this._validateInputs(t)&&((0,d.h)(this,e),Array.isArray(e)||(e=e.toArray()),this.points[t]=e,this.notifyChange("points")),this}toJSON(t){return this.write({},t)}_validateInputs(t){return null!=t&&t>=0&&t<this.points.length}};(0,s.Cg)([(0,o.MZ)({readOnly:!0})],y.prototype,"cache",null),(0,s.Cg)([(0,o.MZ)({readOnly:!0})],y.prototype,"extent",null),(0,s.Cg)([(0,o.MZ)({type:[[Number]],json:{write:{isRequired:!0}}})],y.prototype,"points",void 0),(0,s.Cg)([(0,g.K)("points")],y.prototype,"writePoints",null),y=n=(0,s.Cg)([(0,o.$K)("esri.geometry.Multipoint")],y),y.prototype.toJSON.isDefaultToJSON=!0},82799(t,e,r){r.d(e,{A:()=>d});var n,s=r(32198),i=r(4718),a=r(91429),o=r(5443),u=r(91075),l=r(86738),h=r(16930),c=r(90634),p=r(56993),f=r(43937);let d=n=class extends u.A{constructor(t){super(function(t){if(!t)return;let{paths:e,hasM:r,hasZ:n,spatialReference:s}=t;switch(e??=[],function(t){return"number"==typeof t[0]?.[0]}(e)&&(e=[e]),e[0]?.[0]?.length){case 4:n??=!0,r??=!0;break;case 3:n??=!0!==r,r??=!n;break;default:n??=!1,r??=!1}return s??=h.A.WGS84,{...t,hasM:r,hasZ:n,paths:e,spatialReference:s}}(t)),this.curvePaths=void 0,this.paths=[],this.type="polyline"}get cache(){return this.commitProperty("curvePaths"),this.commitProperty("hasM"),this.commitProperty("hasZ"),this.commitProperty("paths"),this.commitProperty("spatialReference"),{}}writeCurvePaths(t,e){e.curvePaths=(0,i.o8)(t)}get extent(){let t=(0,c.Z3)(this),{spatialReference:e}=this;return t?new o.A({...t,spatialReference:e}):null}writePaths(t,e){e.paths=(0,i.o8)(this.paths)}addPath(t){if(!t)return;let e=this.paths,r=e.length;if(function(t){return!Array.isArray(t[0])}(t)){let n=[];for(let e=0,r=t.length;e<r;e++)n[e]=t[e].toArray();e[r]=n}else e[r]=t.slice();return this.notifyChange("paths"),this}clone(){let t=new n;return t.spatialReference=this.spatialReference,t.paths=(0,i.o8)(this.paths),t.curvePaths=(0,i.o8)(this.curvePaths),t.hasZ=this.hasZ,t.hasM=this.hasM,t}getPoint(t,e){if(!this._validateInputs(t,e))return null;let r=this.paths[t][e],n=this.hasZ,s=this.hasM;return n&&!s?new l.A(r[0],r[1],r[2],void 0,this.spatialReference):s&&!n?new l.A(r[0],r[1],void 0,r[2],this.spatialReference):n&&s?new l.A(r[0],r[1],r[2],r[3],this.spatialReference):new l.A(r[0],r[1],this.spatialReference)}insertPoint(t,e,r){return this._validateInputs(t,e,!0)&&((0,p.h)(this,r),Array.isArray(r)||(r=r.toArray()),this.paths[t].splice(e,0,r),this.notifyChange("paths")),this}removePath(t){if(!this._validateInputs(t,null))return null;let e=this.paths.splice(t,1)[0],r=this.spatialReference,n=e.map(t=>new l.A(t,r));return this.notifyChange("paths"),n}removePoint(t,e){if(!this._validateInputs(t,e))return null;let r=new l.A(this.paths[t].splice(e,1)[0],this.spatialReference);return this.notifyChange("paths"),r}setPoint(t,e,r){return this._validateInputs(t,e)&&((0,p.h)(this,r),Array.isArray(r)||(r=r.toArray()),this.paths[t][e]=r,this.notifyChange("paths")),this}_validateInputs(t,e,r=!1){if(null==t||t<0||t>=this.paths.length)return!1;if(null!=e){let n=this.paths[t];if(r&&(e<0||e>n.length)||!r&&(e<0||e>=n.length))return!1}return!0}toJSON(t){return this.write({},t)}};(0,s.Cg)([(0,a.MZ)({readOnly:!0})],d.prototype,"cache",null),(0,s.Cg)([(0,a.MZ)({json:{write:!0,origins:{"portal-item":{write:!1},"web-map":{write:!1},"web-scene":{write:!1}}}})],d.prototype,"curvePaths",void 0),(0,s.Cg)([(0,f.K)("curvePaths")],d.prototype,"writeCurvePaths",null),(0,s.Cg)([(0,a.MZ)({readOnly:!0})],d.prototype,"extent",null),(0,s.Cg)([(0,a.MZ)({type:[[[Number]]],json:{write:{isRequired:!0}}})],d.prototype,"paths",void 0),(0,s.Cg)([(0,f.K)("paths")],d.prototype,"writePaths",null),d=n=(0,s.Cg)([(0,a.$K)("esri.geometry.Polyline")],d),d.prototype.toJSON.isDefaultToJSON=!0},4197(t,e,r){r.d(e,{Vj:()=>a,cj:()=>i,jh:()=>s});var n=r(9093);function s(t){return t<=1024?Array(t).fill(0):new Float64Array(t)}function i(t){return[...t]}function a(t){let e=(0,n.vt)();for(let r=0;r<16;++r)e[r]=t[r];return e}},70328(t,e,r){r.d(e,{BI:()=>I,C:()=>a,DC:()=>p,Ej:()=>M,Ie:()=>k,Jt:()=>P,Lu:()=>x,Ne:()=>v,RF:()=>c,TF:()=>m,VL:()=>d,aI:()=>A,fA:()=>o,gE:()=>l,gX:()=>_,hZ:()=>S,iT:()=>f,is:()=>T,pg:()=>b,uJ:()=>y,vI:()=>w,vY:()=>u,vt:()=>i,w1:()=>h,yr:()=>g}),r(35522);var n=r(5443),s=(r(19419),r(4197));function i(t=G){return[t[0],t[1],t[2],t[3],t[4],t[5]]}function a(t,e){for(let r=0;r<6;r++)t[r]=e[r];return t}function o(t,e,r,n,s,a,o=i()){return o[0]=t,o[1]=e,o[2]=r,o[3]=n,o[4]=s,o[5]=a,o}function u(t,e=i()){return function(t,e,r,n=i()){return S(n,q),function(t,e,r=0,n=e.length/3){let s=t[0],i=t[1],a=t[2],o=t[3],u=t[4],l=t[5];for(let t=0;t<n;t++)s=Math.min(s,e[r+3*t]),i=Math.min(i,e[r+3*t+1]),a=Math.min(a,e[r+3*t+2]),o=Math.max(o,e[r+3*t]),u=Math.max(u,e[r+3*t+1]),l=Math.max(l,e[r+3*t+2]);t[0]=s,t[1]=i,t[2]=a,t[3]=o,t[4]=u,t[5]=l}(n,t,e,r),n}(t,0,t.length/3,e)}function l(t,e=(0,s.jh)(24)){let[r,n,i,a,o,u]=t;return e[0]=r,e[1]=n,e[2]=i,e[3]=r,e[4]=n,e[5]=u,e[6]=r,e[7]=o,e[8]=i,e[9]=r,e[10]=o,e[11]=u,e[12]=a,e[13]=n,e[14]=i,e[15]=a,e[16]=n,e[17]=u,e[18]=a,e[19]=o,e[20]=i,e[21]=a,e[22]=o,e[23]=u,e}function h(t,e){return isFinite(t[2])||isFinite(t[5])?new n.A({xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],zmin:t[2],zmax:t[5],spatialReference:e}):new n.A({xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],spatialReference:e})}function c(t,e,r=t){r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r[2]=Math.min(t[2],e[2]),r[3]=Math.max(t[3],e[3]),r[4]=Math.max(t[4],e[4]),r[5]=Math.max(t[5],e[5])}function p(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[3]=Math.max(t[3],e[2]),t[4]=Math.max(t[4],e[3])}function f(t,[e,r,n]){!function(t,e,r,n){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],r),t[2]=Math.min(t[2],n),t[3]=Math.max(t[3],e),t[4]=Math.max(t[4],r),t[5]=Math.max(t[5],n)}(t,e,r,n)}function d(t){return t[0]>=t[3]?0:t[3]-t[0]}function g(t){return t[1]>=t[4]?0:t[4]-t[1]}function y(t){return t[2]>=t[5]?0:t[5]-t[2]}function m(t){let e=d(t),r=y(t),n=g(t);return e*e+r*r+n*n}function _(t,e=[0,0,0]){return e[0]=t[0]+d(t)/2,e[1]=t[1]+g(t)/2,e[2]=t[2]+y(t)/2,e}function M(t,e=[0,0,0]){return e[0]=d(t),e[1]=g(t),e[2]=y(t),e}function b(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function x(t,e){return e[0]=t[3],e[1]=t[4],e[2]=t[5],e}function v(t,e,r=t){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r!==t&&(r[3]=t[3],r[4]=t[4],r[5]=t[5]),r}function w(t,e,r=t){return r[3]=e[0],r[4]=e[1],r[5]=e[2],r!==t&&(r[0]=t[0],r[1]=t[1],r[2]=t[2]),t}function S(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function k(t){return t?S(t,q):i(q)}function P(t,e){return t[0]=e[0],t[1]=e[1],t[2]=-1/0,t[3]=e[2],t[4]=e[3],t[5]=1/0,t}function I(t,e,r,n,s){return t[0]=e,t[1]=r,t[2]=-1/0,t[3]=n,t[4]=s,t[5]=1/0,t}function T(t){return 6===t.length}function A(t,e,r){if(null==t||null==e)return t===e;if(!T(t)||!T(e))return!1;if(r){for(let n=0;n<t.length;n++)if(!r(t[n],e[n]))return!1}else for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}const q=[1/0,1/0,1/0,-1/0,-1/0,-1/0],G=[0,0,0,0,0,0];i(),r.d(e,["qv",0,q,"v_",0,G])},50498(t,e,r){var n=r(66552),s=r(5443),i=r(91075),a=r(48526),o=r(86738),u=r(39829),l=r(82799);const h=(0,n.O)()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon"}),c=(0,n.O)()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh"}),p={base:i.A,key:"type",typeMap:{extent:s.A,multipoint:a.A,point:o.A,polyline:l.A,polygon:u.A}},f=new n.J({esriGeometryBezier3Curve:"cubic-bezier",esriGeometryCircularArc:"circular-arc",esriGeometryEllipticArc:"elliptic-arc"},{ignoreUnknown:!0});r.d(e,["Ye",0,c,"gy",0,h,"iI",0,f,"yR",0,p])},62815(t,e,r){r.d(e,{N:()=>o,d:()=>u});var n=r(86211),s=r(73941),i=r(21325),a=r(52006);function o(t,e,r){let n=u(e,r);if(1!==n)switch(t){case"point":case"esriGeometryPoint":return t=>function(t,e){null!=t?.z&&(t.z*=e)}(t,n);case"polyline":case"esriGeometryPolyline":return t=>function(t,e){if(t){if(t.curvePaths)for(let r of t.curvePaths)for(let t of r){let r=(0,a.yP)(t);r.length>2&&(r[2]*=e)}if(t.paths)for(let r of t.paths)for(let t of r)t.length>2&&(t[2]*=e)}}(t,n);case"polygon":case"esriGeometryPolygon":return t=>function(t,e){if(t){if(t.curveRings)for(let r of t.curveRings)for(let t of r){let r=(0,a.yP)(t);r.length>2&&(r[2]*=e)}if(t.rings)for(let r of t.rings)for(let t of r)t.length>2&&(t[2]*=e)}}(t,n);case"multipoint":case"esriGeometryMultipoint":return t=>function(t,e){if(t)for(let r of t.points)r.length>2&&(r[2]*=e)}(t,n);case"extent":case"esriGeometryEnvelope":return t=>function(t,e){t&&null!=t.zmin&&null!=t.zmax&&(t.zmin*=e,t.zmax*=e)}(t,n);default:return}}function u(t,e){return null==t||null==e||(0,i.aI)(t,e)||(0,s.xP)(t)||(0,s.xP)(e)?1:(0,n.G9)(t)/(0,n.G9)(e)}},53655(t,e,r){r.d(e,{SH:()=>C,ae:()=>T,cn:()=>g});var n=r(32198),s=r(49186),i=r(51624),a=r(50498);const o=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],u=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML","esriFieldTypeBigInteger","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"],l="sqlTypeBigInt.sqlTypeBinary.sqlTypeBit.sqlTypeChar.sqlTypeDate.sqlTypeDecimal.sqlTypeDouble.sqlTypeFloat.sqlTypeGeometry.sqlTypeGUID.sqlTypeInteger.sqlTypeLongNVarchar.sqlTypeLongVarbinary.sqlTypeLongVarchar.sqlTypeNChar.sqlTypeNVarchar.sqlTypeOther.sqlTypeReal.sqlTypeSmallInt.sqlTypeSqlXml.sqlTypeTime.sqlTypeTimestamp.sqlTypeTimestamp2.sqlTypeTinyInt.sqlTypeVarbinary.sqlTypeVarchar".split("."),h=["upperLeft","lowerLeft"];function c(t,e){let r=t.getEnum();return r<e.length?e[r]:void 0}function p(t,e){t.featureSet.geometryType=t.usesShortGeometryTypes?a.gy.fromJSON(e):e}function f(t,e=t.featureSet.geometryType){return t.usesShortGeometryTypes?a.gy.toJSON(e):e}function d(t){let e=t.asUnsafe();for(;e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getSInt32();case 5:return e.getUInt32();case 6:return e.getInt64();case 7:return e.getUInt64();case 8:return e.getSInt64();case 9:return e.getBool();default:return e.skip(),null}return null}function g(t){let e=t.asUnsafe(),r={type:u[0]};for(;e.next();)switch(e.tag()){case 1:r.name=e.getString();break;case 2:r.type=c(e,u);break;case 3:r.alias=e.getString();break;case 4:r.sqlType=c(e,l);break;case 5:default:e.skip();break;case 6:r.defaultValue=e.getString()}return r}function y(t){let e={},r=t.asUnsafe();for(;r.next();)switch(r.tag()){case 1:e.name=r.getString();break;case 2:e.isSystemMaintained=r.getBool();break;default:r.skip()}return e}let m=[];function _(t,e,r){let n=f(e),s=0,i=t.asUnsafe();for(;i.next();)switch(i.tag()){case 1:1===r?n=c(i,o):i.skip();continue;case 2:for(let t=i.getPackedEnd();i.pos()<t;)m[s++]=i.getUInt32();continue;case 3:s>0?(m.length=s,null!=e.geometry(r,n,m)&&(m=[])):e.geometry(r,n,[]);for(let t=i.getPackedEnd();i.pos()<t;)e.coord(i.getSInt64());continue;default:i.skip()}}function M(t,e){let r=[],n=t.asUnsafe();for(;n.next();)if(3!==n.tag())n.skip();else for(let t=n.getPackedEnd();n.pos()<t;)r.push(n.getSInt64());e.centroid(r)}let b=[],x=[],v=[];function w(t,e){let r={stack:[],error:void 0,hasError:!1};try{let s=0,i=m,a=0,o=t.asUnsafe(),u=(0,n.mS)(r,o.clonePooled().asUnsafe(),!1);for(;o.next();)switch(o.tag()){case 2:for(let l=o.getPackedEnd();o.pos()<l;)i[s++]=o.getUInt32();continue;case 3:if(!("curvedGeometry"in e))throw Error(`Tried to parse curved geometry in a ${e.constructor.name}, which doesn't support them.`);o.processMessageWithArgs(S,a++);continue;case 4:{let h=o.getUInt32(),c=o.pos()+h;if(0===a||0===s||0===h){o.move(c);continue}i.length=s,v.length=x.length=a,e.curvedGeometry(f(e),i,x,v);let{hasZ:p,hasM:d}=e.featureSet,g=[],y=[0,0];function _(){for(let t=0;t<y.length;++t)g[t]=y[t],y[t]=o.getSInt64()}p&&y.push(0),d&&y.push(0);let M=[0,0],w=[0,0],k=M,P=M,I=0;for(let T=0;T<s;++T){_(),g.fill(0),e.startCurvedPart(y);for(let A=I+i[T];I<A;++I){let q=x[I],G=v[I];switch(q){case 0:for(let V=0;V<G;++V)_(),y[0]+=g[0],y[1]+=g[1],e.lineSegment(g,y);continue;case 1:for(let C=0;C<G;++C)_(),k[0]=o.getSInt64(),k[1]=o.getSInt64(),e.circularArcSegment(g,y,k);continue;case 2:for(let R=0;R<G;++R)_(),M[0]=o.getSInt64(),M[1]=o.getSInt64(),w[0]=o.getSInt64(),w[1]=o.getSInt64(),e.bezierSegment(g,y,M,w);continue;case 3:if(u.move(b[I]),u.getUInt32()<7*G)throw Error("Not implemented: compressed full circle encoding");for(let E=0;E<G;++E){_(),P[0]=u.getDouble(),P[1]=u.getDouble();let F=u.getDouble(),U=u.getDouble(),Z=u.getDouble(),D=u.getDouble(),O=u.getDouble();e.ellipticArcSegment(g,y,P,F,U,Z,D,O)}continue}}e.finishCurvedPart(y)}continue}default:o.skip()}}catch(L){r.error=L,r.hasError=!0}finally{(0,n.hk)(r)}}function S(t,e){let r=t.asUnsafe(),n=0,s=0,i=0;for(;r.next();)switch(r.tag()){case 1:n=r.getEnum();continue;case 2:s=r.getUInt32();continue;case 3:i=r.pos(),r.skip();continue;default:r.skip()}if(3===n&&0===i)throw Error("An elliptic arc segment set did not include a parameters array");x[e]=n,v[e]=s,b[e]=i}function k(t,e){e.feature();let r=e.featureSet.features.at(-1),n=0,{fields:s}=e.featureSet;for(;t.next();)switch(t.tag()){case 1:if(null==s)throw Error("A Feature had attributes but the FeatureResult didn't include any fields");r.attributes[s[n++].name]=t.processMessage(d);continue;case 2:t.processMessageWithArgs(_,e,0);continue;case 4:t.processMessageWithArgs(M,e);continue;case 7:t.processMessageWithArgs(w,e);continue;case 11:r.distance=t.getDouble();continue;default:t.skip();continue}e.finishFeature?.()}function P(t){let e=[1,1,1,1],r=t.asUnsafe();for(;r.next();)switch(r.tag()){case 1:e[0]=r.getDouble();break;case 2:e[1]=r.getDouble();break;case 4:e[2]=r.getDouble();break;case 3:e[3]=r.getDouble();break;default:r.skip()}return e}function I(t){let e=[0,0,0,0],r=t.asUnsafe();for(;r.next();)switch(r.tag()){case 1:e[0]=r.getDouble();break;case 2:e[1]=r.getDouble();break;case 4:e[2]=r.getDouble();break;case 3:e[3]=r.getDouble();break;default:r.skip()}return e}function T(t){let e={originPosition:h[0]},r=t.asUnsafe();for(;r.next();)switch(r.tag()){case 1:e.originPosition=c(r,h);break;case 2:e.scale=r.processMessage(P);break;case 3:e.translate=r.processMessage(I);break;default:r.skip()}return e}function A(t){let e={},r=t.asUnsafe();for(;r.next();)switch(r.tag()){case 1:e.shapeAreaFieldName=r.getString();break;case 2:e.shapeLengthFieldName=r.getString();break;case 3:e.units=r.getString();break;default:r.skip()}return e}function q(t){let e={};for(;t.next();)switch(t.tag()){case 1:e.wkid=t.getUInt32();break;case 5:e.wkt=t.getString();break;case 2:e.latestWkid=t.getUInt32();break;case 3:e.vcsWkid=t.getUInt32();break;case 4:e.latestVcsWkid=t.getUInt32();break;default:t.skip()}return e}function G(t,e){let r=t.asUnsafe();if(e.featureSet.features.length=0,"features"===e.parseOnly?.type){let t=e.parseOnly.indices.values(),n=0,s=t.next().value;for(;r.next();)15!==r.tag()||n++!==s?r.skip():(s=t.next().value,r.processMessageWithArgs(k,e));return}let n=!1;for("metadata"===e.parseOnly?.type&&(n=!0,e.parseOnly.featureCount=0),p(e,"esriGeometryPoint");r.next();)switch(r.tag()){case 1:e.idField(r.getString());continue;case 3:e.featureSet.globalIdFieldName=r.getString();continue;case 4:e.featureSet.geohashFieldName=r.getString();continue;case 5:e.featureSet.geometryProperties=r.processMessage(A);continue;case 7:p(e,c(r,o));continue;case 8:e.featureSet.spatialReference=r.processMessageWithArgs(q);continue;case 10:e.featureSet.hasZ=r.getBool();continue;case 11:e.featureSet.hasM=r.getBool();continue;case 12:e.featureSet.transform=r.processMessage(T);continue;case 9:e.featureSet.exceededTransferLimit=r.getBool();continue;case 13:e.featureSet.fields??=[],e.featureSet.fields.push(r.processMessage(g));continue;case 15:if(n){++e.parseOnly.featureCount,r.skip();continue}r.processMessageWithArgs(k,e);continue;case 2:e.idField(r.processMessage(y));continue;default:r.skip()}}function V(t,e,r){let n=-1;for(;t.next();)switch(t.tag()){case 4:n=t.pos(),t.skip();continue;case 1:t.processMessageWithArgs(G,e);continue;default:t.skip()}if(-1!==n){if(!e.queryGeometry()){let r=t.pos();t.move(n),t.processMessageWithArgs(_,e,1),t.move(r)}r.queryGeometryType=e.queryGeometryType(),r.queryGeometry=e.queryGeometry()}e.finish(),r.featureResult=e.featureSet}function C(t,e){let r={stack:[],error:void 0,hasError:!1};try{(0,n.mS)(r,{[Symbol.dispose](){m=[],b=[],x=[],v=[]}},!1);try{let r={stack:[],error:void 0,hasError:!1};try{let s,a=(0,n.mS)(r,i.A.constructPooled(new Uint8Array(t),new DataView(t)),!1);for(;a.next();)2===a.tag()?(s={},a.processMessageWithArgs(V,e,s)):a.skip();return s}catch(t){r.error=t,r.hasError=!0}finally{(0,n.hk)(r)}}catch(t){throw new s.A("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:t})}}catch(t){r.error=t,r.hasError=!0}finally{(0,n.hk)(r)}}},63746(t,e,r){function n(t){return class{constructor(){for(let e of t)this[e]=null}}}function s(t,e=1){let{transform:r,hasZ:n,hasM:s}=t;if(null==r)return n&&1!==e?t=>{t[2]*=e}:null;let[i,a]=function(t,e,r,n){let{scale:s,translate:i,originPosition:a}=t;return"upperLeft"===a&&(s=s.map((t,e)=>1===e?-t:t)),e&&(s=s.map((t,e)=>2===e?t*n:t),i=i.map((t,e)=>2===e?t*n:t)),!e&&r&&(s=s.filter((t,e)=>2!==e),i=i.filter((t,e)=>2!==e)),[s,i]}(r,n,s,e),o=t.hasZ?3:2;return t=>{for(let e=0;e<t.length&&(e!==o||0!==t[e]);++e)t[e]=t[e]*i[e]+a[e]}}r.d(e,{M:()=>s,_:()=>n})},66208(t,e,r){r.d(e,{m:()=>s});var n=r(53655);function s(t,e){let{featureResult:r}=(0,n.SH)(t,e);return r}},39078(t,e,r){r.r(e),r.d(e,{default:()=>c});var n=r(24326),s=r(62815);r(69397),r(16930),r(70328),r(19419),r(50498),r(44208),r(34727),r(21325);class i{constructor(t,e,r){this.uid=t,this.geometry=e,this.attributes=r,this.visible=!0,this.objectId=null,this.centroid=null}}class a{constructor(){this.exceededTransferLimit=!1,this.features=[],this.fields=[],this.hasM=!1,this.hasZ=!1,this.geometryType=null,this.objectIdFieldName=null,this.globalIdFieldName=null,this.geometryProperties=null,this.geohashFieldName=null,this.spatialReference=null,this.transform=null,this.missingAttributes=null}}var o=r(63746);class u{constructor(t){this._options=t,this.featureSet=new a,this.usesShortGeometryTypes=!0,this.transferList=[],this.coordinates=[],this._queryGeometryType=null,this._queryGeometry=null,this._queryCoordinates=null,this.parseOnly=null,this.missingAttributes=[],this._transformInPlace=null,this._attributesClass=null,this._previousX=0,this._previousY=0,this._point=null,this._lengths=null,this._coords=null,this._coordinateIndex=0,this._partIndex=0,this._partEnd=0,this._vertex=[],this._i=0,this._finishVertex=null}queryGeometryType(){return this._queryGeometryType}queryGeometry(){return this._queryGeometry}queryCoordinates(){return this._queryCoordinates}idField(t){"string"==typeof t&&(this.featureSet.objectIdFieldName=t)}finish(){this._options.applyTransform&&(this.featureSet.transform=null)}_setVertexTransformer(){let{sourceSpatialReference:t}=this._options,{spatialReference:e,hasZ:r}=this.featureSet,n=r?(0,s.d)(t,e):1;this._transformInPlace??=(0,o.M)(this.featureSet,n)}feature(){this._attributesClass??=(0,o._)(this.featureSet.fields?.map(t=>t.name)??[]),this.featureSet.features.push(new i((0,n.c)(),null,new this._attributesClass)),this.coordinates.push(null),this._options.applyTransform&&this._setVertexTransformer()}finishFeature(){let{maxStringAttributeLength:t,maxStringAttributeFields:e}=this._options,{attributes:r}=this.featureSet.features.at(-1),n=r[this.featureSet.objectIdFieldName];!function(t,e,r,n){if(e?.size&&null!=r&&t)for(let s in t){if(!e.has(s))continue;let i=t[s];"string"==typeof i&&i.length>r&&(n(s),t[s]="")}}(r,e,t,t=>{null!=n&&this.missingAttributes.push({objectId:n,attribute:t})})}_createPoint(){let{hasZ:t,hasM:e}=this.featureSet,r={type:"point",x:0,y:0,spatialReference:null,hasZ:t,hasM:e};return t&&(r.z=0),e&&(r.m=0),r}centroid(t){let{hasZ:e,hasM:r}=this.featureSet,n={type:"point",x:0,y:0,spatialReference:null,hasZ:e,hasM:r};[n.x,n.y]=t,e&&(n.z=t[2]),r&&(n.m=t.at(-1)),this.featureSet.features.at(-1).centroid=n}geometry(t,e,r){this._previousX=this._previousY=0,this._lengths=r;let{hasZ:n,hasM:s}=this.featureSet;n??=!1,s??=!1,this._vertex=[0,0],n&&this._vertex.push(0),s&&this._vertex.push(0);let i,a=null;switch(e){case"esriGeometryPoint":this._point=this._createPoint(),i=this._point,this._finishVertex=n?s?u._finishVertexPointXYZM:u._finishVertexPointXYZ:s?u._finishVertexPointXYM:u._finishVertexPointXY;break;case"esriGeometryMultipoint":this._createPackedCoordinates(r),a={coords:this._coords,lengths:r.slice()},i={type:"multipoint",points:null,spatialReference:null,hasZ:n,hasM:s};break;case"esriGeometryPolyline":case"esriGeometryPolygon":this._createPackedCoordinates(r),a={coords:this._coords,lengths:r.slice()},i="esriGeometryPolygon"===e?{type:"polygon",rings:null,spatialReference:null,hasZ:n,hasM:s}:{type:"polyline",paths:null,spatialReference:null,hasZ:n,hasM:s}}1===t?(this._queryGeometry=i,this._queryCoordinates=a,this._queryGeometryType=e,this._options.applyTransform||this._setVertexTransformer()):(this.featureSet.features.at(-1).geometry=i,this.coordinates[this.coordinates.length-1]=a)}_createPackedCoordinates(t){let e=this._vertex.length;for(this._coords=new Float64Array(t.reduce((t,e)=>t+e,0)*e),this._coordinateIndex=this._partIndex=0,this._partEnd=(t[0]??0)*e;0===this._partEnd&&++this._partIndex<t.length;)this._partEnd+=t[this._partIndex]*e;this._finishVertex=u._finishVertexPacked,this.transferList.push(this._coords.buffer)}coord(t){let e=this._vertex;e[this._i++]=t,this._i<e.length||(this._i=0,this._transformInPlace&&(e[0]+=this._previousX,e[1]+=this._previousY,[this._previousX,this._previousY]=e,this._transformInPlace(e)),this._finishVertex(this))}static _finishVertexPointXY({_point:t,_vertex:e}){[t.x,t.y]=e}static _finishVertexPointXYZ({_point:t,_vertex:e}){[t.x,t.y,t.z]=e}static _finishVertexPointXYM({_point:t,_vertex:e}){[t.x,t.y,t.m]=e}static _finishVertexPointXYZM({_point:t,_vertex:e}){[t.x,t.y,t.z,t.m]=e}static _finishVertexPacked(t){let{_vertex:e,_coords:r,_lengths:n}=t;if(r.set(e,t._coordinateIndex),t._coordinateIndex+=e.length,t._coordinateIndex===t._partEnd)for(t._previousX=t._previousY=0;t._coordinateIndex===t._partEnd&&++t._partIndex<n.length;)t._partEnd+=n[t._partIndex]*e.length}}var l=r(66208);class h{parseFeatureQuery(t){let e=new u(t.options),r=(0,l.m)(t.buffer,e);r.missingAttributes=e.missingAttributes;let n={featureSet:r,coordinates:e.coordinates,queryGeometry:e.queryGeometry()??null,queryCoordinates:e.queryCoordinates()??null};return Promise.resolve({result:n,transferList:e.transferList})}}function c(){return new h}}}]);