@arcgis/core 4.23.0-next.20220119 → 4.23.0-next.20220123

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 (168) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0bf079e752ab79468478.js +1 -0
  3. package/assets/esri/core/workers/chunks/199670a3a564ebe3bd79.js +1 -0
  4. package/assets/esri/core/workers/chunks/1e4d37c2b9dc83d20a11.js +1 -0
  5. package/assets/esri/core/workers/chunks/{99f0d896c17dd09cd285.js → 2629adf79e7fd9f25f07.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{8a250ec51097f16feb66.js → 40a1e713f63ec77110c0.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{4b69129c0557852d9b3d.js → 4c9084a04948b6924749.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{1b28042fdf3f4dbc8ea5.js → 5383a8f3e4ec1a8a4fcd.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{9d9dffc8884d66a258e4.js → 5538639a49c7cc2eca63.js} +1 -1
  10. package/assets/esri/core/workers/chunks/5a4a5585ec8027079f32.js +1 -0
  11. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +1 -0
  12. package/assets/esri/core/workers/chunks/68a59ce98177d8513337.js +1 -0
  13. package/assets/esri/core/workers/chunks/739e579150bf466d43ae.js +1 -0
  14. package/assets/esri/core/workers/chunks/74df1f3e1e2e524a89d2.js +1 -0
  15. package/assets/esri/core/workers/chunks/7baf6b1f3f050aa67ae4.js +1 -0
  16. package/assets/esri/core/workers/chunks/{47395d225229d237f0ac.js → 7bc5cc5dbf1b7b70ddac.js} +1 -1
  17. package/assets/esri/core/workers/chunks/8fa0a14165d43ffe87a5.js +1 -0
  18. package/assets/esri/core/workers/chunks/94b8dbf859df71858d1c.js +1 -0
  19. package/assets/esri/core/workers/chunks/{e2d68bcd2f99a65387bf.js → 9cb2ae42a8e328b1d98d.js} +1 -1
  20. package/assets/esri/core/workers/chunks/9d3c58a0ef634d95b7bd.js +1 -0
  21. package/assets/esri/core/workers/chunks/a78757b9c7e8cbea08fa.js +1 -0
  22. package/assets/esri/core/workers/chunks/a96afc176041f698c7a1.js +1 -0
  23. package/assets/esri/core/workers/chunks/{b10fcbe1393c812fc219.js → aa861b8eae6c85f3dad4.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{a960074644c3722be71e.js → afa6912454f2a5ffadce.js} +1 -1
  25. package/assets/esri/core/workers/chunks/b0b036ad3ad3cd956747.js +1 -0
  26. package/assets/esri/core/workers/chunks/b2beb6e1fd2ee6503830.js +1 -0
  27. package/assets/esri/core/workers/chunks/bab1cfd0a901181622af.js +1 -0
  28. package/assets/esri/core/workers/chunks/bf6dda4a2af14c4b7716.js +1 -0
  29. package/assets/esri/core/workers/chunks/{ed0297fc61014e848c18.js → c080114a69fa95b88d22.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{573dc3064e84ca86844d.js → c959e0d1cf7dce0421b9.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1fd48459afb58a6cf14f.js → ca2f5faa01d99c21ec14.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{7aa543a97f055cddea99.js → cc146c57bbdac8029fd8.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{631c5b514bb73782c570.js → cd7d83d127e085d52584.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{7e596478507466953e65.js → cef4af64860ebbfc1c47.js} +1 -1
  35. package/assets/esri/core/workers/chunks/d72488db62fcf39447b6.js +1 -0
  36. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +981 -0
  37. package/assets/esri/core/workers/chunks/e079cb1d53aca15b7df2.js +1 -0
  38. package/assets/esri/core/workers/chunks/{f7fc4c993536e62f7f3e.js → e97e986120aaadad7d4c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/f8e7755240a94b499e1f.js +1 -0
  40. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  41. package/chunks/CloudsComposition.glsl.js +4 -4
  42. package/chunks/vxlLayer.js +1 -1
  43. package/core/has.js +1 -1
  44. package/core/workers/workerFactory.js +1 -1
  45. package/geometry/support/heightModelInfoUtils.js +1 -1
  46. package/interfaces.d.ts +279 -76
  47. package/layers/RouteLayer.js +1 -1
  48. package/layers/VoxelLayer.js +1 -1
  49. package/layers/VoxelWasmPerScene.js +1 -1
  50. package/layers/support/RasterWorker.js +1 -1
  51. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  52. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  53. package/libs/vxl/enums.js +1 -1
  54. package/package.json +1 -1
  55. package/portal/schemas/buildingSceneLayerItem.js +1 -1
  56. package/portal/schemas/definitions.js +1 -1
  57. package/portal/schemas/integratedMeshLayerItem.js +1 -1
  58. package/portal/schemas/pointCloudLayerItem.js +1 -1
  59. package/portal/schemas/sceneLayerItem.js +1 -1
  60. package/portal/schemas/webScene.js +1 -1
  61. package/rest/find.js +1 -1
  62. package/rest/geometryService/generalize.js +1 -1
  63. package/rest/geometryService/lengths.js +1 -1
  64. package/rest/geometryService/offset.js +1 -1
  65. package/rest/geometryService/relation.js +1 -1
  66. package/rest/geometryService/trimExtend.js +1 -1
  67. package/rest/identify.js +1 -1
  68. package/{tasks → rest}/operations/find.js +0 -0
  69. package/{tasks → rest}/operations/generalize.js +0 -0
  70. package/rest/operations/identify.js +5 -0
  71. package/{tasks → rest}/operations/lengths.js +0 -0
  72. package/{tasks → rest}/operations/offset.js +0 -0
  73. package/{tasks → rest}/operations/relation.js +0 -0
  74. package/{tasks → rest}/operations/trimExtend.js +0 -0
  75. package/{tasks → rest}/operations/urlUtils.js +0 -0
  76. package/rest/print.js +1 -1
  77. package/rest/query/operations/query.js +1 -1
  78. package/rest/query/operations/queryAttachments.js +1 -1
  79. package/rest/query/operations/queryRelatedRecords.js +1 -1
  80. package/rest/query/operations/queryTopFeatures.js +1 -1
  81. package/rest/route/utils.js +1 -1
  82. package/rest/support/NetworkServiceDescription.js +1 -1
  83. package/rest/support/RouteInfo.js +1 -1
  84. package/rest/support/RouteParameters.js +1 -1
  85. package/rest/support/RouteSettings.js +5 -0
  86. package/rest/support/Stop.js +1 -1
  87. package/rest/support/networkEnums.js +1 -1
  88. package/support/revision.js +1 -1
  89. package/symbols/Font.js +1 -1
  90. package/symbols/TextSymbol.js +1 -1
  91. package/symbols/TextSymbol3DLayer.js +1 -1
  92. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  93. package/symbols/support/cimSymbolUtils.js +1 -1
  94. package/symbols/support/textUtils.js +5 -0
  95. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  96. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  97. package/views/2d/support/engineHelpers.js +1 -1
  98. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  99. package/views/3d/environment/CloudsComposition.js +1 -1
  100. package/views/3d/environment/CloudsGenerator.js +1 -1
  101. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  102. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  103. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  104. package/views/3d/layers/GraphicsView3D.js +1 -1
  105. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  106. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  107. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  108. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  109. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  110. package/views/3d/layers/graphics/{Graphics3DFeatureLikeLayerView.js → Graphics3DFeatureProcessor.js} +1 -1
  111. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  112. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  113. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  114. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  115. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  116. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  117. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  118. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  119. package/views/3d/layers/graphics/{Graphics3DGraphicLikeLayerView.js → GraphicsProcessor.js} +1 -1
  120. package/views/3d/layers/graphics/IGraphics3DFeatureProcessor.js +4 -0
  121. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  122. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +12 -14
  123. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  124. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  125. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  126. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  127. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  128. package/views/SceneView.js +1 -1
  129. package/views/webgl/ContextState.js +1 -1
  130. package/views/webgl/FramebufferObject.js +1 -1
  131. package/views/webgl/Program.js +1 -1
  132. package/views/webgl/Renderbuffer.js +1 -1
  133. package/views/webgl/RenderingContext.js +1 -1
  134. package/views/webgl/Texture.js +1 -1
  135. package/views/webgl/Util.js +1 -1
  136. package/views/webgl/enums.js +1 -1
  137. package/views/webgl/rasterUtils.js +1 -1
  138. package/views/webgl/testFloatBufferBlend.js +1 -1
  139. package/widgets/Feature/FeatureExpression.js +1 -1
  140. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  141. package/widgets/Feature/FeatureMedia.js +1 -1
  142. package/widgets/Feature/FeatureViewModel.js +1 -1
  143. package/widgets/LayerList/LayerListViewModel.js +1 -1
  144. package/widgets/support/geolocationUtils.js +1 -1
  145. package/assets/esri/core/workers/chunks/01ef8de7f76a8c61b464.js +0 -1
  146. package/assets/esri/core/workers/chunks/05db312a0ca6bd3f014a.js +0 -1
  147. package/assets/esri/core/workers/chunks/0f254c3e91e8fee55f28.js +0 -1
  148. package/assets/esri/core/workers/chunks/21a77eed1a4ef5b0ff08.js +0 -1
  149. package/assets/esri/core/workers/chunks/3564e14010953def6df9.js +0 -1
  150. package/assets/esri/core/workers/chunks/403c7d64f12f00330d88.js +0 -1
  151. package/assets/esri/core/workers/chunks/4409d77c9734de4e82a7.js +0 -1
  152. package/assets/esri/core/workers/chunks/615aa2d3ecafe30c80c0.js +0 -1
  153. package/assets/esri/core/workers/chunks/618076e6de605873e433.js +0 -1
  154. package/assets/esri/core/workers/chunks/6c1e92ff4c732dfda756.js +0 -1
  155. package/assets/esri/core/workers/chunks/722a10c65456844d72b9.js +0 -1
  156. package/assets/esri/core/workers/chunks/75d53b28afe732c459b2.js +0 -1
  157. package/assets/esri/core/workers/chunks/8fdd5bca3716816d359b.js +0 -1
  158. package/assets/esri/core/workers/chunks/a28b53c61bddefb6616e.js +0 -1
  159. package/assets/esri/core/workers/chunks/b9de831ac379cf1d2969.js +0 -1
  160. package/assets/esri/core/workers/chunks/c3eca92d02958732e141.js +0 -1
  161. package/assets/esri/core/workers/chunks/c8f976e53e232e8da9cc.js +0 -981
  162. package/assets/esri/core/workers/chunks/cb68db7169b9dfd1c3ff.js +0 -1
  163. package/assets/esri/core/workers/chunks/cc96608b2802fbfe7a08.js +0 -1
  164. package/assets/esri/core/workers/chunks/cd02fe27eb07681cb366.js +0 -1
  165. package/assets/esri/core/workers/chunks/dd433c160f7a0c120b82.js +0 -1
  166. package/assets/esri/core/workers/chunks/ef8b75b92cf549e0507e.js +0 -1
  167. package/symbols/support/constants.js +0 -5
  168. package/tasks/operations/identify.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as t,isSome as e}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import"./BufferObject.js";import"./FramebufferObject.js";import"../../core/has.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ContextType as a}from"./context-util.js";import{BufferType as r,Face as n,BASE_TEXTURE_UNIT as l,ClearBufferBit as h,TextureType as o,SyncCondition as f,ClientWaitSyncStatus as _,BlendFactor as u,BlendOperation as c,CullMode as d,CompareFunction as g,StencilOperation as b,PrimitiveType as p}from"./enums.js";import"./ShaderTranspiler.js";import{ProgramCache as F}from"./ProgramCache.js";import{Texture as B}from"./Texture.js";import"./VertexArrayObject.js";import{ContextState as E}from"./ContextState.js";import{InstanceCounter as m}from"./InstanceCounter.js";import{StateTracker as T}from"./renderState.js";import{WebGLDriverTest as R}from"./WebGLDriverTest.js";import{Capabilities as O}from"./capabilities/Capabilities.js";import x from"./capabilities/isWebGL2Context.js";class U{constructor(t,e){this.gl=t,this.instanceCounter=new m,this.programCache=new F(this),this._state=new E,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=x(t)?a.WEBGL2:a.WEBGL1,this._loadExtensions(),this.configure(e)}configure(t){this._capabilities=new O(this.gl,t),this._parameters=this._loadParameters(t);const e=this.gl.getParameter(this.gl.VIEWPORT);this._state=new E,this._state.viewport={x:e[0],y:e[1],width:e[2],height:e[3]},this._stateTracker=new T({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),this._driverTest=new R(this)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}dispose(){this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(r.ARRAY_BUFFER),this.unbindBuffer(r.ELEMENT_ARRAY_BUFFER),x(this.gl)&&(this.unbindBuffer(r.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(r.PIXEL_PACK_BUFFER),this.unbindBuffer(r.PIXEL_UNPACK_BUFFER),this.unbindBuffer(r.COPY_READ_BUFFER),this.unbindBuffer(r.COPY_WRITE_BUFFER)),this._state.textureUnitMap.length=0,i()&&this.instanceCounter.printResourceCount()}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){var t;null==(t=this._state.program)||t.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){const t=this.capabilities.vao;t&&(t.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(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=n.FRONT_AND_BACK,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){this._state.stencilOperation.face===n.FRONT_AND_BACK&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=n.FRONT_AND_BACK,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(l+t),this._state.activeTexture=t),s}clear(t){t&&this.gl.clear(t)}clearSafe(t,e=255){t&&(t&h.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),t&h.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),t&h.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(e),this.gl.clear(t))}drawArrays(t,e,s){i()&&(this._numOfDrawCalls++,this._numOfTriangles+=C(t,s)),this.gl.drawArrays(t,e,s)}drawElements(t,e,s,a){i()&&(this._numOfDrawCalls++,this._numOfTriangles+=C(t,e)),this.gl.drawElements(t,e,s,a)}logIno(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}getViewport(){return{x:this._state.viewport.x,y:this._state.viewport.y,width:this._state.viewport.width,height:this._state.viewport.height}}useProgram(t){var e,s;this._state.program!==t&&(null==(e=this._state.program)||e.stop(),this._state.program=t,this.gl.useProgram(null!=(s=null==t?void 0:t.glName)?s:null))}bindTexture(s,i,a=!1){(i>=this.parameters.maxTextureImageUnits||i<0)&&console.error("Input texture unit is out of range of available units!");const r=this._state.textureUnitMap[i];return t(s)||null==s.glName?(e(r)&&(this.setActiveTexture(i,a),this.gl.bindTexture(r.descriptor.target,null)),this._state.textureUnitMap[i]=null,r):a||r!==s?(this.setActiveTexture(i,a),this.gl.bindTexture(s.descriptor.target,s.glName),s.applyChanges(),this._state.textureUnitMap[i]=s,r):(s.isDirty&&(this.setActiveTexture(i,a),s.applyChanges()),r)}unbindTextureAllUnits(t){for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(e,s=!1,i=o.TEXTURE_2D){if(t(e))return this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),void(this._state.framebuffer=null);(s||this._state.framebuffer!==e)&&(e.initializeAndBind(i),this._state.framebuffer=e)}bindBuffer(t,e){if(t)switch(null!=e||(e=t.bufferType),e){case r.ARRAY_BUFFER:this._state.vertexBuffer=A(this.gl,t,e,this._state.vertexBuffer);break;case r.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=A(this.gl,t,e,this._state.indexBuffer);break;case r.UNIFORM_BUFFER:this._state.uniformBuffer=A(this.gl,t,e,this._state.uniformBuffer);break;case r.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=A(this.gl,t,e,this._state.pixelPackBuffer);break;case r.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=A(this.gl,t,e,this._state.pixelUnpackBuffer);break;case r.COPY_READ_BUFFER:this._state.copyReadBuffer=A(this.gl,t,e,this._state.copyReadBuffer);break;case r.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=A(this.gl,t,e,this._state.copyWriteBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(e,s){if(s>=this.parameters.maxUniformBufferBindings||s<0)return console.error("Uniform buffer binding point is out of range!"),null;const i=this._state.uniformBufferBindingPoints;let a=i[s];return t(a)&&(a={buffer:null,offset:0,size:0},i[s]=a),a}bindBufferBase(e,s,i){const a=this._getBufferBinding(e,s);if(t(a))return;if(a.buffer===i&&0===a.offset&&0===a.size)return;this.gl.bindBufferBase(e,s,i?i.glName:null),a.buffer=i,a.offset=0,a.size=0}bindBufferRange(e,s,i,a,r){const n=this._getBufferBinding(e,s);if(t(n))return;if(n.buffer===i&&n.offset===a&&n.size===r)return;if(a%this._parameters.uniformBufferOffsetAlignment!=0)return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment");this.gl.bindBufferRange(e,s,i.glName,a,r),n.buffer=i,n.offset=a,n.size=r}bindUBO(e,s,a,n){t(s)?this.bindBufferBase(r.UNIFORM_BUFFER,e,null):(i()&&(null!=n?n:s.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),s.initialize(),void 0!==a&&void 0!==n?this.bindBufferRange(r.UNIFORM_BUFFER,e,s.buffer,a,n):this.bindBufferBase(r.UNIFORM_BUFFER,e,s.buffer))}unbindUBO(t){for(let s=0,i=this._state.uniformBufferBindingPoints.length;s<i;s++){const i=this._state.uniformBufferBindingPoints[s];e(i)&&i.buffer===t.buffer&&this.bindBufferBase(r.UNIFORM_BUFFER,s,null)}}unbindBuffer(t){switch(t){case r.ARRAY_BUFFER:this._state.vertexBuffer=A(this.gl,null,t,this._state.vertexBuffer);break;case r.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=A(this.gl,null,t,this._state.indexBuffer);break;case r.UNIFORM_BUFFER:this._state.uniformBuffer=A(this.gl,null,t,this._state.uniformBuffer);break;case r.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=A(this.gl,null,t,this._state.pixelPackBuffer);break;case r.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=A(this.gl,null,t,this._state.pixelUnpackBuffer);break;case r.COPY_READ_BUFFER:this._state.copyReadBuffer=A(this.gl,null,t,this._state.copyReadBuffer);break;case r.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=A(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(e=null){t(e)?this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null):this._state.vertexArrayObject!==e&&(e.bind(),this._state.vertexArrayObject=e)}async clientWaitAsync(t=0){const e=this.gl,i=e.fenceSync(f.SYNC_GPU_COMMANDS_COMPLETE,0);let a;e.flush();do{await s(t),a=e.clientWaitSync(i,0,0)}while(a===_.TIMEOUT_EXPIRED);if(e.deleteSync(i),a===_.WAIT_FAILED)throw new Error("Client wait failed")}getBoundFramebufferObject(){return this._state.framebuffer}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null),this.unbindBuffer(r.ARRAY_BUFFER),this.unbindBuffer(r.ELEMENT_ARRAY_BUFFER),x(this.gl)&&(this.unbindBuffer(r.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(r.PIXEL_PACK_BUFFER),this.unbindBuffer(r.PIXEL_UNPACK_BUFFER),this.unbindBuffer(r.COPY_READ_BUFFER),this.unbindBuffer(r.COPY_WRITE_BUFFER));for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(u.ONE,u.ZERO),this.setBlendEquation(c.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(n.BACK),this.setFrontFace(d.CCW),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(g.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(g.ALWAYS,0,0),this.setStencilOp(b.KEEP,b.KEEP,b.KEEP),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(){var t,s,a,n;const h=this.gl,f=this.capabilities.vao;f&&f.bindVertexArray(null);for(let e=0;e<this.parameters.maxVertexAttributes;e++)h.disableVertexAttribArray(e);if(this._state.vertexBuffer?h.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):h.bindBuffer(r.ARRAY_BUFFER,null),this._state.indexBuffer?h.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):h.bindBuffer(r.ELEMENT_ARRAY_BUFFER,null),x(h)){this._state.uniformBuffer?h.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):h.bindBuffer(r.UNIFORM_BUFFER,null);for(let t=0;t<this._parameters.maxUniformBufferBindings;t++){const s=this._state.uniformBufferBindingPoints[t];if(e(s)&&null!==s.buffer){const{buffer:e,offset:i,size:a}=s;0===i&&0===a?h.bindBufferBase(r.UNIFORM_BUFFER,t,e.glName):h.bindBufferRange(r.UNIFORM_BUFFER,t,e.glName,i,a)}else h.bindBufferBase(r.UNIFORM_BUFFER,t,null)}this._state.pixelPackBuffer?h.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):h.bindBuffer(r.PIXEL_PACK_BUFFER,null),this._state.pixelUnpackBuffer?h.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):h.bindBuffer(r.PIXEL_UNPACK_BUFFER,null),this._state.copyReadBuffer?h.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):h.bindBuffer(r.COPY_READ_BUFFER,null),this._state.copyWriteBuffer?h.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):h.bindBuffer(r.COPY_WRITE_BUFFER,null)}if(f&&this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}h.bindFramebuffer(h.FRAMEBUFFER,null!=(t=null==(s=this._state.framebuffer)?void 0:s.glName)?t:null),h.useProgram(null!=(a=null==(n=this._state.program)?void 0:n.glName)?a:null),h.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),h.bindRenderbuffer(h.RENDERBUFFER,this._state.renderbuffer?this._state.renderbuffer.glName:null),!0===this._state.blend?h.enable(this.gl.BLEND):h.disable(this.gl.BLEND),h.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),h.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),h.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),h.clearDepth(this._state.clearDepth),h.clearStencil(this._state.clearStencil),h.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),h.cullFace(this._state.cullFace),h.depthFunc(this._state.depthFunction),h.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),h.depthMask(this._state.depthWrite),h.frontFace(this._state.frontFace),h.lineWidth(1),!0===this._state.faceCulling?h.enable(h.CULL_FACE):h.disable(h.CULL_FACE),h.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?h.enable(h.POLYGON_OFFSET_FILL):h.disable(h.POLYGON_OFFSET_FILL),h.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?h.enable(h.SCISSOR_TEST):h.disable(h.SCISSOR_TEST),h.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),h.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?h.enable(h.STENCIL_TEST):h.disable(h.STENCIL_TEST),h.stencilMask(this._state.stencilWriteMask);for(let i=0;i<this.parameters.maxTextureImageUnits;i++){h.activeTexture(l+i),h.bindTexture(o.TEXTURE_2D,null),h.bindTexture(o.TEXTURE_CUBE_MAP,null),x(h)&&h.bindTexture(o.TEXTURE_3D,null);const t=this._state.textureUnitMap[i];e(t)&&h.bindTexture(t.descriptor.target,t.glName)}h.activeTexture(l+this._state.activeTexture),h.viewport(this._state.viewport.x,this._state.viewport.y,this._state.viewport.width,this._state.viewport.height),i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}_loadExtensions(){this.type===a.WEBGL1&&this.gl.getExtension("OES_element_index_uint"),this.gl.getExtension("KHR_parallel_shader_compile")}_loadParameters(t){var e;const s=this.capabilities.textureFilterAnisotropic,i=null!=(e=t.maxAnisotropy)?e:1/0,a=x(this.gl),r=this.gl,n={versionString:this.gl.getParameter(this.gl.VERSION),maxVertexTextureImageUnits:this.gl.getParameter(this.gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxVertexAttributes:this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),maxMaxAnisotropy:s?Math.min(this.gl.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY),i):1,maxTextureImageUnits:this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),maxTextureSize:this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE),maxUniformBufferBindings:a?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0,maxVertexUniformBlocks:a?r.getParameter(r.MAX_VERTEX_UNIFORM_BLOCKS):0,maxFragmentUniformBlocks:a?r.getParameter(r.MAX_FRAGMENT_UNIFORM_BLOCKS):0,maxUniformBlockSize:a?r.getParameter(r.MAX_UNIFORM_BLOCK_SIZE):0,uniformBufferOffsetAlignment:a?r.getParameter(r.UNIFORM_BUFFER_OFFSET_ALIGNMENT):1};return B.TEXTURE_UNIT_FOR_UPDATES=n.maxTextureImageUnits-1,n}}function A(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function C(t,e){switch(t){case p.POINTS:return 2*e;case p.TRIANGLES:return e/3;case p.TRIANGLE_STRIP:case p.TRIANGLE_FAN:return e-2;default:return 0}}export{U as RenderingContext};
5
+ import{isNone as t,isSome as e,unwrapOr as s}from"../../core/maybe.js";import{after as i}from"../../core/promiseUtils.js";import"./BufferObject.js";import"./FramebufferObject.js";import"../../core/has.js";import{webglDebugEnabled as a}from"./checkWebGLError.js";import{ContextType as r}from"./context-util.js";import{BufferType as n,Face as l,BASE_TEXTURE_UNIT as h,ClearBufferBit as f,FramebufferTarget as o,TextureSamplingMode as _,SyncCondition as u,ClientWaitSyncStatus as c,BlendFactor as d,BlendOperation as b,CullMode as F,CompareFunction as g,StencilOperation as p,TextureType as E,PrimitiveType as B}from"./enums.js";import"./ShaderTranspiler.js";import{ProgramCache as m}from"./ProgramCache.js";import{Texture as R}from"./Texture.js";import"./VertexArrayObject.js";import{ContextState as T}from"./ContextState.js";import{InstanceCounter as A}from"./InstanceCounter.js";import{StateTracker as x}from"./renderState.js";import{WebGLDriverTest as O}from"./WebGLDriverTest.js";import{Capabilities as U}from"./capabilities/Capabilities.js";import C from"./capabilities/isWebGL2Context.js";class S{constructor(t,e){this.gl=t,this.instanceCounter=new A,this.programCache=new m(this),this._state=new T,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=C(t)?r.WEBGL2:r.WEBGL1,this._loadExtensions(),this.configure(e)}configure(t){this._capabilities=new U(this.gl,t),this._parameters=this._loadParameters(t);const e=this.gl.getParameter(this.gl.VIEWPORT);this._state=new T,this._state.viewport={x:e[0],y:e[1],width:e[2],height:e[3]},this._stateTracker=new x({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),this._driverTest=new O(this)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}dispose(){this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(n.ARRAY_BUFFER),this.unbindBuffer(n.ELEMENT_ARRAY_BUFFER),C(this.gl)&&(this.unbindBuffer(n.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(n.PIXEL_PACK_BUFFER),this.unbindBuffer(n.PIXEL_UNPACK_BUFFER),this.unbindBuffer(n.COPY_READ_BUFFER),this.unbindBuffer(n.COPY_WRITE_BUFFER)),this._state.textureUnitMap.length=0,a()&&this.instanceCounter.printResourceCount()}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){var t;null==(t=this._state.program)||t.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){const t=this.capabilities.vao;t&&(t.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(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=l.FRONT_AND_BACK,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){this._state.stencilOperation.face===l.FRONT_AND_BACK&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=l.FRONT_AND_BACK,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(h+t),this._state.activeTexture=t),s}clear(t){t&&this.gl.clear(t)}clearSafe(t,e=255){t&&(t&f.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),t&f.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),t&f.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(e),this.gl.clear(t))}drawArrays(t,e,s){a()&&(this._numOfDrawCalls++,this._numOfTriangles+=M(t,s)),this.gl.drawArrays(t,e,s)}drawElements(t,e,s,i){a()&&(this._numOfDrawCalls++,this._numOfTriangles+=M(t,e)),this.gl.drawElements(t,e,s,i)}logIno(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}getViewport(){return{x:this._state.viewport.x,y:this._state.viewport.y,width:this._state.viewport.width,height:this._state.viewport.height}}useProgram(t){var e,s;this._state.program!==t&&(null==(e=this._state.program)||e.stop(),this._state.program=t,this.gl.useProgram(null!=(s=null==t?void 0:t.glName)?s:null))}bindTexture(s,i,a=!1){(i>=this.parameters.maxTextureImageUnits||i<0)&&console.error("Input texture unit is out of range of available units!");const r=this._state.textureUnitMap[i];return t(s)||null==s.glName?(e(r)&&(this.setActiveTexture(i,a),this.gl.bindTexture(r.descriptor.target,null)),this._state.textureUnitMap[i]=null,r):a||r!==s?(this.setActiveTexture(i,a),this.gl.bindTexture(s.descriptor.target,s.glName),s.applyChanges(),this._state.textureUnitMap[i]=s,r):(s.isDirty&&(this.setActiveTexture(i,a),s.applyChanges()),r)}unbindTextureAllUnits(t){for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(e,s=!1){if(s||this._state.readFramebuffer!==e||this._state.drawFramebuffer!==e){if(t(e))return this.gl.bindFramebuffer(o.FRAMEBUFFER,null),this._state.readFramebuffer=null,void(this._state.drawFramebuffer=null);e.initializeAndBind(o.FRAMEBUFFER),this._state.readFramebuffer=e,this._state.drawFramebuffer=e}}bindFramebufferSeparate(e,i,a=!1){const r=i===o.READ_FRAMEBUFFER,n=r?this._state.readFramebuffer:this._state.drawFramebuffer;(a||n!==e)&&(t(e)?this.gl.bindFramebuffer(i,null):e.initializeAndBind(i),r?this._state.readFramebuffer=s(e,null):this._state.drawFramebuffer=s(e,null))}blitFramebuffer(t,e,s=0,i=0,a=t.width,r=t.height,n=0,l=0,h=e.width,u=e.height,c=f.COLOR_BUFFER_BIT,d=_.NEAREST){this.bindFramebufferSeparate(t,o.READ_FRAMEBUFFER),this.bindFramebufferSeparate(e,o.DRAW_FRAMEBUFFER);this.gl.blitFramebuffer(s,i,a,r,n,l,h,u,c,d)}bindBuffer(t,e){if(t)switch(null!=e||(e=t.bufferType),e){case n.ARRAY_BUFFER:this._state.vertexBuffer=P(this.gl,t,e,this._state.vertexBuffer);break;case n.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=P(this.gl,t,e,this._state.indexBuffer);break;case n.UNIFORM_BUFFER:this._state.uniformBuffer=P(this.gl,t,e,this._state.uniformBuffer);break;case n.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=P(this.gl,t,e,this._state.pixelPackBuffer);break;case n.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=P(this.gl,t,e,this._state.pixelUnpackBuffer);break;case n.COPY_READ_BUFFER:this._state.copyReadBuffer=P(this.gl,t,e,this._state.copyReadBuffer);break;case n.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=P(this.gl,t,e,this._state.copyWriteBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(e,s){if(s>=this.parameters.maxUniformBufferBindings||s<0)return console.error("Uniform buffer binding point is out of range!"),null;const i=this._state.uniformBufferBindingPoints;let a=i[s];return t(a)&&(a={buffer:null,offset:0,size:0},i[s]=a),a}bindBufferBase(e,s,i){const a=this._getBufferBinding(e,s);if(t(a))return;if(a.buffer===i&&0===a.offset&&0===a.size)return;this.gl.bindBufferBase(e,s,i?i.glName:null),a.buffer=i,a.offset=0,a.size=0}bindBufferRange(e,s,i,a,r){const n=this._getBufferBinding(e,s);if(t(n))return;if(n.buffer===i&&n.offset===a&&n.size===r)return;if(a%this._parameters.uniformBufferOffsetAlignment!=0)return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment");this.gl.bindBufferRange(e,s,i.glName,a,r),n.buffer=i,n.offset=a,n.size=r}bindUBO(e,s,i,r){t(s)?this.bindBufferBase(n.UNIFORM_BUFFER,e,null):(a()&&(null!=r?r:s.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),s.initialize(),void 0!==i&&void 0!==r?this.bindBufferRange(n.UNIFORM_BUFFER,e,s.buffer,i,r):this.bindBufferBase(n.UNIFORM_BUFFER,e,s.buffer))}unbindUBO(t){for(let s=0,i=this._state.uniformBufferBindingPoints.length;s<i;s++){const i=this._state.uniformBufferBindingPoints[s];e(i)&&i.buffer===t.buffer&&this.bindBufferBase(n.UNIFORM_BUFFER,s,null)}}unbindBuffer(t){switch(t){case n.ARRAY_BUFFER:this._state.vertexBuffer=P(this.gl,null,t,this._state.vertexBuffer);break;case n.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=P(this.gl,null,t,this._state.indexBuffer);break;case n.UNIFORM_BUFFER:this._state.uniformBuffer=P(this.gl,null,t,this._state.uniformBuffer);break;case n.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=P(this.gl,null,t,this._state.pixelPackBuffer);break;case n.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=P(this.gl,null,t,this._state.pixelUnpackBuffer);break;case n.COPY_READ_BUFFER:this._state.copyReadBuffer=P(this.gl,null,t,this._state.copyReadBuffer);break;case n.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=P(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(e=null){t(e)?this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null):this._state.vertexArrayObject!==e&&(e.bind(),this._state.vertexArrayObject=e)}async clientWaitAsync(t=0){const e=this.gl,s=e.fenceSync(u.SYNC_GPU_COMMANDS_COMPLETE,0);let a;e.flush();do{await i(t),a=e.clientWaitSync(s,0,0)}while(a===c.TIMEOUT_EXPIRED);if(e.deleteSync(s),a===c.WAIT_FAILED)throw new Error("Client wait failed")}getBoundFramebufferObject(t=o.FRAMEBUFFER){return t===o.READ_FRAMEBUFFER?this._state.readFramebuffer:this._state.drawFramebuffer}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(n.ARRAY_BUFFER),this.unbindBuffer(n.ELEMENT_ARRAY_BUFFER),C(this.gl)&&(this.unbindBuffer(n.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(n.PIXEL_PACK_BUFFER),this.unbindBuffer(n.PIXEL_UNPACK_BUFFER),this.unbindBuffer(n.COPY_READ_BUFFER),this.unbindBuffer(n.COPY_WRITE_BUFFER));for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(d.ONE,d.ZERO),this.setBlendEquation(b.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(l.BACK),this.setFrontFace(F.CCW),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(g.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(g.ALWAYS,0,0),this.setStencilOp(p.KEEP,p.KEEP,p.KEEP),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(){var t,s;const i=this.gl,r=this.capabilities.vao;r&&r.bindVertexArray(null);for(let e=0;e<this.parameters.maxVertexAttributes;e++)i.disableVertexAttribArray(e);if(this._state.vertexBuffer?i.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):i.bindBuffer(n.ARRAY_BUFFER,null),this._state.indexBuffer?i.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):i.bindBuffer(n.ELEMENT_ARRAY_BUFFER,null),C(i)){var l,f,_,u;this._state.uniformBuffer?i.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):i.bindBuffer(n.UNIFORM_BUFFER,null);for(let t=0;t<this._parameters.maxUniformBufferBindings;t++){const s=this._state.uniformBufferBindingPoints[t];if(e(s)&&null!==s.buffer){const{buffer:e,offset:a,size:r}=s;0===a&&0===r?i.bindBufferBase(n.UNIFORM_BUFFER,t,e.glName):i.bindBufferRange(n.UNIFORM_BUFFER,t,e.glName,a,r)}else i.bindBufferBase(n.UNIFORM_BUFFER,t,null)}this._state.pixelPackBuffer?i.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):i.bindBuffer(n.PIXEL_PACK_BUFFER,null),this._state.pixelUnpackBuffer?i.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):i.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),this._state.copyReadBuffer?i.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):i.bindBuffer(n.COPY_READ_BUFFER,null),this._state.copyWriteBuffer?i.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):i.bindBuffer(n.COPY_WRITE_BUFFER,null),i.bindFramebuffer(o.READ_FRAMEBUFFER,null!=(l=null==(f=this._state.readFramebuffer)?void 0:f.glName)?l:null),i.bindFramebuffer(o.DRAW_FRAMEBUFFER,null!=(_=null==(u=this._state.drawFramebuffer)?void 0:u.glName)?_:null)}else{var c,d;this._state.readFramebuffer=this._state.drawFramebuffer,i.bindFramebuffer(o.FRAMEBUFFER,null!=(c=null==(d=this._state.drawFramebuffer)?void 0:d.glName)?c:null)}if(r&&this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}i.useProgram(null!=(t=null==(s=this._state.program)?void 0:s.glName)?t:null),i.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),i.bindRenderbuffer(i.RENDERBUFFER,this._state.renderbuffer?this._state.renderbuffer.glName:null),!0===this._state.blend?i.enable(this.gl.BLEND):i.disable(this.gl.BLEND),i.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),i.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),i.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),i.clearDepth(this._state.clearDepth),i.clearStencil(this._state.clearStencil),i.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),i.cullFace(this._state.cullFace),i.depthFunc(this._state.depthFunction),i.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),i.depthMask(this._state.depthWrite),i.frontFace(this._state.frontFace),i.lineWidth(1),!0===this._state.faceCulling?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),i.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL),i.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?i.enable(i.SCISSOR_TEST):i.disable(i.SCISSOR_TEST),i.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),i.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),i.stencilMask(this._state.stencilWriteMask);for(let a=0;a<this.parameters.maxTextureImageUnits;a++){i.activeTexture(h+a),i.bindTexture(E.TEXTURE_2D,null),i.bindTexture(E.TEXTURE_CUBE_MAP,null),C(i)&&(i.bindTexture(E.TEXTURE_3D,null),i.bindTexture(E.TEXTURE_2D_ARRAY,null));const t=this._state.textureUnitMap[a];e(t)&&i.bindTexture(t.descriptor.target,t.glName)}i.activeTexture(h+this._state.activeTexture),i.viewport(this._state.viewport.x,this._state.viewport.y,this._state.viewport.width,this._state.viewport.height),a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}_loadExtensions(){this.type===r.WEBGL1&&this.gl.getExtension("OES_element_index_uint"),this.gl.getExtension("KHR_parallel_shader_compile")}_loadParameters(t){var e;const s=this.capabilities.textureFilterAnisotropic,i=null!=(e=t.maxAnisotropy)?e:1/0,a=C(this.gl),r=this.gl,n={versionString:this.gl.getParameter(this.gl.VERSION),maxVertexTextureImageUnits:this.gl.getParameter(this.gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxVertexAttributes:this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),maxMaxAnisotropy:s?Math.min(this.gl.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY),i):1,maxTextureImageUnits:this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),maxTextureSize:this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE),maxUniformBufferBindings:a?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0,maxVertexUniformBlocks:a?r.getParameter(r.MAX_VERTEX_UNIFORM_BLOCKS):0,maxFragmentUniformBlocks:a?r.getParameter(r.MAX_FRAGMENT_UNIFORM_BLOCKS):0,maxUniformBlockSize:a?r.getParameter(r.MAX_UNIFORM_BLOCK_SIZE):0,uniformBufferOffsetAlignment:a?r.getParameter(r.UNIFORM_BUFFER_OFFSET_ALIGNMENT):1,maxArrayTextureLayers:a?r.getParameter(r.MAX_ARRAY_TEXTURE_LAYERS):1,maxSamples:a?r.getParameter(r.MAX_SAMPLES):1};return R.TEXTURE_UNIT_FOR_UPDATES=n.maxTextureImageUnits-1,n}}function P(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function M(t,e){switch(t){case B.POINTS:return 2*e;case B.TRIANGLES:return e/3;case B.TRIANGLE_STRIP:case B.TRIANGLE_FAN:return e-2;default:return 0}}export{S as RenderingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isPowerOfTwo as t}from"../../core/mathUtils.js";import{isSome as e}from"../../core/maybe.js";import{checkWebGLError as i}from"./checkWebGLError.js";import{ContextType as a}from"./context-util.js";import{ResourceType as r,TextureType as s,TextureSamplingMode as o,TextureWrapMode as p,PixelType as n,PixelFormat as _}from"./enums.js";import h from"./capabilities/isWebGL2Context.js";const l=4;class d{constructor(t,e,i=null){this._context=t,this.type="texture",this._glName=null,this._descriptor=void 0,this._samplingModeDirty=!1,this._wrapModeDirty=!1,t.instanceCounter.increment(r.Texture,this),this._descriptor={target:s.TEXTURE_2D,samplingMode:o.LINEAR,wrapMode:p.REPEAT,flipped:!1,hasMipmap:!1,isOpaque:!1,unpackAlignment:4,preMultiplyAlpha:!1,...e},this._descriptor.target===s.TEXTURE_CUBE_MAP?this._setDataCubeMap(i):this.setData(i)}get glName(){return this._glName}get descriptor(){return this._descriptor}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}dispose(){this._context.gl&&this._glName&&(this._context.unbindTextureAllUnits(this),this._context.gl.deleteTexture(this._glName),this._glName=null,this._context.instanceCounter.decrement(r.Texture,this))}release(){this.dispose()}resize(t,e){const i=this._descriptor;i.width===t&&i.height===e||(i.width=t,i.height=e,this._descriptor.target===s.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null))}_setDataCubeMap(t=null){for(let e=s.TEXTURE_CUBE_MAP_POSITIVE_X;e<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z;e++)this.setData(t,e)}setData(t,a=s.TEXTURE_2D){if(!this._context||!this._context.gl)return;const r=this._context.gl;this._glName||(this._glName=r.createTexture()),void 0===t&&(t=null),null===t&&(this._descriptor.width=this._descriptor.width||l,this._descriptor.height=this._descriptor.height||l);const o=this._context.bindTexture(this,d.TEXTURE_UNIT_FOR_UPDATES),p=this._descriptor;d._validateTexture(this._context,p),r.pixelStorei(r.UNPACK_ALIGNMENT,p.unpackAlignment),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,p.flipped?1:0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.preMultiplyAlpha?1:0);const n=p.pixelFormat;let _=p.internalFormat?p.internalFormat:this._deriveInternalFormat(n,p.dataType);if(t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement){let e=t.width,s=t.height;t instanceof HTMLVideoElement&&(e=t.videoWidth,s=t.videoHeight),p.width&&p.height,r.texImage2D(a,0,_,n,p.dataType,t),i(r),p.hasMipmap&&this.generateMipmap(),void 0===p.width&&(p.width=e),void 0===p.height&&(p.height=s)}else{null!=p.width&&null!=p.height||console.error("Width and height must be specified!"),r.DEPTH24_STENCIL8&&_===r.DEPTH_STENCIL&&(_=r.DEPTH24_STENCIL8);let s=p.width,o=p.height;if(E(t)){const e=Math.round(Math.log(Math.max(s,o))/Math.LN2)+1;p.hasMipmap=p.hasMipmap&&e===t.levels.length;for(let i=0;;++i){const e=t.levels[Math.min(i,t.levels.length-1)];if(r.compressedTexImage2D(a,i,_,s,o,0,e),1===s&&1===o||!p.hasMipmap)break;s=Math.max(1,s>>1),o=Math.max(1,o>>1)}}else if(e(t))r.texImage2D(a,0,_,s,o,0,n,p.dataType,t),i(r),p.hasMipmap&&this.generateMipmap();else for(let t=0;r.texImage2D(a,t,_,s,o,0,n,p.dataType,null),i(r),(1!==s||1!==o)&&p.hasMipmap;++t)s=Math.max(1,s>>1),o=Math.max(1,o>>1)}d._applySamplingMode(r,this._descriptor),d._applyWrapMode(r,this._descriptor),d._applyAnisotropicFilteringParameters(this._context,this._descriptor),i(r),this._context.bindTexture(o,d.TEXTURE_UNIT_FOR_UPDATES)}updateData(t,e,i,a,r,o,p=s.TEXTURE_2D){o||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const n=this._context.gl,_=this._descriptor,h=this._context.bindTexture(this,d.TEXTURE_UNIT_FOR_UPDATES);(e<0||i<0||a>_.width||r>_.height||e+a>_.width||i+r>_.height)&&console.error("An attempt to update out of bounds of the texture!"),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipped?1:0),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.preMultiplyAlpha?1:0),o instanceof ImageData||o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement?n.texSubImage2D(p,t,e,i,_.pixelFormat,_.dataType,o):n.texSubImage2D(p,t,e,i,a,r,_.pixelFormat,_.dataType,o),this._context.bindTexture(h,d.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const t=this._descriptor;t.hasMipmap||(t.hasMipmap=!0,this._samplingModeDirty=!0,d._validateTexture(this._context,t)),t.samplingMode===o.LINEAR?(this._samplingModeDirty=!0,t.samplingMode=o.LINEAR_MIPMAP_NEAREST):t.samplingMode===o.NEAREST&&(this._samplingModeDirty=!0,t.samplingMode=o.NEAREST_MIPMAP_NEAREST);const e=this._context.bindTexture(this,d.TEXTURE_UNIT_FOR_UPDATES);this._context.gl.generateMipmap(t.target),this._context.bindTexture(e,d.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,d._validateTexture(this._context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const t=this._context.gl,e=this._descriptor;this._samplingModeDirty&&(d._applySamplingMode(t,e),this._samplingModeDirty=!1),this._wrapModeDirty&&(d._applyWrapMode(t,e),this._wrapModeDirty=!1)}_deriveInternalFormat(t,e){if(this._context.type===a.WEBGL1)return t;if(e===n.FLOAT)switch(t){case _.RGBA:return _.RGBA32F;case _.RGB:return _.RGB32F;default:throw new Error("Unable to derive format")}return t}static _validateTexture(e,i){(i.width<0||i.height<0)&&console.error("Negative dimension parameters are not allowed!");const a=t(i.width)&&t(i.height);h(e.gl)||a||("number"==typeof i.wrapMode?i.wrapMode!==p.CLAMP_TO_EDGE&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):i.wrapMode.s===p.CLAMP_TO_EDGE&&i.wrapMode.t===p.CLAMP_TO_EDGE||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),i.hasMipmap&&console.error("Mipmapping requires power-of-two textures!"))}static _applySamplingMode(t,e){let i=e.samplingMode,a=e.samplingMode;i===o.LINEAR_MIPMAP_NEAREST||i===o.LINEAR_MIPMAP_LINEAR?(i=o.LINEAR,e.hasMipmap||(a=o.LINEAR)):i!==o.NEAREST_MIPMAP_NEAREST&&i!==o.NEAREST_MIPMAP_LINEAR||(i=o.NEAREST,e.hasMipmap||(a=o.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,a)}static _applyWrapMode(t,e){"number"==typeof e.wrapMode?(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))}static _applyAnisotropicFilteringParameters(t,e){var i;const a=t.capabilities.textureFilterAnisotropic;if(!a)return;t.gl.texParameterf(e.target,a.TEXTURE_MAX_ANISOTROPY,null!=(i=e.maxAnisotropy)?i:1)}}function E(t){return e(t)&&"type"in t&&"compressed"===t.type}d.TEXTURE_UNIT_FOR_UPDATES=0;export{d as Texture};
5
+ import"../../core/has.js";import{isPowerOfTwo as t}from"../../core/mathUtils.js";import{isSome as e,unwrap as i}from"../../core/maybe.js";import{checkWebGLError as r}from"./checkWebGLError.js";import{ContextType as a}from"./context-util.js";import{ResourceType as s,TextureType as o,TextureSamplingMode as n,TextureWrapMode as p,CompressedTextureFormat as h,PixelType as l,PixelFormat as _,SizedPixelFormat as m}from"./enums.js";import d from"./capabilities/isWebGL2Context.js";const c=4;class u{constructor(t,e,i=null){if(this._context=t,this.type="texture",this._glName=null,this._descriptor=void 0,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,t.instanceCounter.increment(s.Texture,this),this._descriptor={target:o.TEXTURE_2D,samplingMode:n.LINEAR,wrapMode:p.REPEAT,flipped:!1,hasMipmap:!1,isOpaque:!1,unpackAlignment:4,preMultiplyAlpha:!1,isImmutable:!1,...e},t.type!==a.WEBGL2&&(this._descriptor.isImmutable&&(this._descriptor.isImmutable=!1),A(this._descriptor.target)))throw new Error("3D and array textures are not supported in WebGL1");this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(i):this.setData(i)}get glName(){return this._glName}get descriptor(){return this._descriptor}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}dispose(){this._context.gl&&this._glName&&(this._context.unbindTextureAllUnits(this),this._context.gl.deleteTexture(this._glName),this._glName=null,this._context.instanceCounter.decrement(s.Texture,this))}release(){this.dispose()}resize(t,e){const i=this._descriptor;if(i.width!==t||i.height!==e){if(this._wasImmutablyAllocated)throw new Error("Immutable textures can't be resized!");i.width=t,i.height=e,this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}_setDataCubeMap(t=null){for(let e=o.TEXTURE_CUBE_MAP_POSITIVE_X;e<=o.TEXTURE_CUBE_MAP_NEGATIVE_Z;e++)this._setData(t,e)}setData(t){this._setData(t)}_setData(t,i){if(!this._context||!this._context.gl)return;const a=this._context.gl;this._glName||(this._glName=a.createTexture()),void 0===t&&(t=null);const s=this._descriptor;null!=i||(i=s.target);const o=A(i);var n;null===t&&(s.width=s.width||c,s.height=s.height||c,o&&(s.depth=null!=(n=s.depth)?n:1));const p=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),u._validateTexture(this._context,s),this._configurePixelStorage();const h=s.pixelFormat;let l=s.internalFormat?s.internalFormat:this._deriveInternalFormat(h,s.dataType);if(M(t)){let e=t.width,n=t.height;const p=1;t instanceof HTMLVideoElement&&(e=t.videoWidth,n=t.videoHeight),s.width&&s.height,o&&s.depth,s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(i,l,s.hasMipmap,e,n,p),this._texImage(i,0,l,e,n,p,t),r(a),s.hasMipmap&&this.generateMipmap(),void 0===s.width&&(s.width=e),void 0===s.height&&(s.height=n),o&&void 0===s.depth&&(s.depth=p)}else{const{width:n,height:p,depth:h}=s;if(null!=n&&null!=p||console.error("Width and height must be specified!"),o&&null==h&&console.error("Depth must be specified!"),s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(i,l,s.hasMipmap,n,p,h),a.DEPTH24_STENCIL8&&l===a.DEPTH_STENCIL&&(l=a.DEPTH24_STENCIL8),g(t)){const e=t.levels,r=I(i,n,p,h),o=Math.min(r-1,e.length-1);d(a)?a.texParameteri(s.target,a.TEXTURE_MAX_LEVEL,o):s.hasMipmap=s.hasMipmap&&r===e.length;const _=l;if(!T(_))throw new Error("Attempting to use compressed data with an umcompressed format!");this._forEachMipmapLevel(((t,r,a,s)=>{const o=e[Math.min(t,e.length-1)];this._compressedTexImage(i,t,_,r,a,s,o)}),o)}else e(t)?(this._texImage(i,0,l,n,p,h,t),r(a),s.hasMipmap&&this.generateMipmap()):this._forEachMipmapLevel(((t,e,s,o)=>{this._texImage(i,t,l,e,s,o,null),r(a)}))}u._applySamplingMode(a,this._descriptor),u._applyWrapMode(a,this._descriptor),u._applyAnisotropicFilteringParameters(this._context,this._descriptor),r(a),this._context.bindTexture(p,u.TEXTURE_UNIT_FOR_UPDATES)}updateData(t,e,i,r,a,s){s||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const o=this._context.gl,n=this._descriptor,{pixelFormat:p,internalFormat:h,dataType:l,isImmutable:_,target:m}=n;if(_&&!this._wasImmutablyAllocated)throw new Error("Cannot update immutable texture before allocation!");const d=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);(e<0||i<0||r>n.width||a>n.height||e+r>n.width||i+a>n.height)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),M(s)?o.texSubImage2D(m,t,e,i,p,l,s):g(s)?o.compressedTexSubImage2D(m,t,e,i,r,a,h,s.levels[t]):o.texSubImage2D(m,t,e,i,r,a,p,l,s),this._context.bindTexture(d,u.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,e,i,r,a,s,o,n){n||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const p=this._context.gl;if(!d(p))throw new Error("3D textures are not supported in WebGL1");const h=this._descriptor,{pixelFormat:l,dataType:_,isImmutable:m,target:c,internalFormat:E}=h;if(m&&!this._wasImmutablyAllocated)throw new Error("Cannot update immutable texture before allocation!");A(c)||console.warn("Attempting to set 3D texture data on a non-3D texture");const T=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);if(this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),(e<0||i<0||r<0||a>h.width||s>h.height||o>h.depth||e+a>h.width||i+s>h.height||r+o>h.depth)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),g(n))n=n.levels[t],p.compressedTexSubImage3D(c,t,e,i,r,a,s,o,E,n);else{const h=n;p.texSubImage3D(c,t,e,i,r,a,s,o,l,_,h)}this._context.bindTexture(T,u.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const t=this._descriptor;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new Error("Cannot add mipmaps to immutable texture after allocation");t.hasMipmap=!0,this._samplingModeDirty=!0,u._validateTexture(this._context,t)}t.samplingMode===n.LINEAR?(this._samplingModeDirty=!0,t.samplingMode=n.LINEAR_MIPMAP_NEAREST):t.samplingMode===n.NEAREST&&(this._samplingModeDirty=!0,t.samplingMode=n.NEAREST_MIPMAP_NEAREST);const e=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES);this._context.gl.generateMipmap(t.target),this._context.bindTexture(e,u.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,u._validateTexture(this._context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const t=this._context.gl,e=this._descriptor;this._samplingModeDirty&&(u._applySamplingMode(t,e),this._samplingModeDirty=!1),this._wrapModeDirty&&(u._applyWrapMode(t,e),this._wrapModeDirty=!1)}_deriveInternalFormat(t,e){if(this._context.type===a.WEBGL1)return t;switch(e){case l.FLOAT:switch(t){case _.RGBA:return m.RGBA32F;case _.RGB:return m.RGB32F;default:throw new Error("Unable to derive format")}case l.UNSIGNED_BYTE:switch(t){case _.RGBA:return m.RGBA8;case _.RGB:return m.RGB8}default:return t}}_configurePixelStorage(){const t=this._context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_texStorage(t,e,i,r,a,s){const o=this._context.gl;if(!d(o))throw new Error("Immutable textures are not supported in WebGL1");if(!E(e))throw new Error("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const n=i?I(t,r,a,s):1;A(t)?o.texStorage3D(t,n,e,r,a,s):o.texStorage2D(t,n,e,r,a),this._wasImmutablyAllocated=!0}_texImage(t,r,s,o,n,p,h){const l=this._context.gl;let _=null;const m=this._context.type===a.WEBGL2,d=A(t),{isImmutable:c,pixelFormat:u,dataType:E}=this._descriptor;if(m&&(_=l),m||!M(h))if(c){if(e(h)){const e=h;d?_.texSubImage3D(t,r,0,0,0,o,n,p,u,E,e):l.texSubImage2D(t,r,0,0,o,n,u,E,e)}}else{const e=i(h);d?_.texImage3D(t,r,s,o,n,p,0,u,E,e):l.texImage2D(t,r,s,o,n,0,u,E,e)}else l.texImage2D(t,0,s,u,E,h)}_compressedTexImage(t,i,r,s,o,n,p){const h=this._context.gl;let l=null;const _=A(t),m=this._descriptor.isImmutable;if(_){if(this._context.type!==a.WEBGL2)throw new Error("3D textures are not supported in WebGL1");l=h}m?e(p)&&(_?l.compressedTexSubImage3D(t,i,0,0,0,s,o,n,r,p):h.compressedTexSubImage2D(t,i,0,0,s,o,r,p)):_?l.compressedTexImage3D(t,i,r,s,o,n,0,p):h.compressedTexImage2D(t,i,r,s,o,0,p)}_forEachMipmapLevel(t,e=1/0){let{width:i,height:r,depth:a,hasMipmap:s,target:n}=this._descriptor;const p=n===o.TEXTURE_3D;for(let o=0;t(o,i,r,a),s&&(1!==i||1!==r||p&&1!==a)&&!(o>=e);++o)i=Math.max(1,i>>1),r=Math.max(1,r>>1),p&&(a=Math.max(1,a>>1))}static _validateTexture(e,i){(i.width<0||i.height<0||i.depth<0)&&console.error("Negative dimension parameters are not allowed!");const r=d(e.gl),a=t(i.width)&&t(i.height);r||!i.isImmutable&&!A(i.target)||console.error("Immutable and 3D-like textures are not supported in WebGL1!"),r||a||("number"==typeof i.wrapMode?i.wrapMode!==p.CLAMP_TO_EDGE&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):i.wrapMode.s===p.CLAMP_TO_EDGE&&i.wrapMode.t===p.CLAMP_TO_EDGE||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),i.hasMipmap&&console.error("Mipmapping requires power-of-two textures!"))}static _applySamplingMode(t,e){let i=e.samplingMode,r=e.samplingMode;i===n.LINEAR_MIPMAP_NEAREST||i===n.LINEAR_MIPMAP_LINEAR?(i=n.LINEAR,e.hasMipmap||(r=n.LINEAR)):i!==n.NEAREST_MIPMAP_NEAREST&&i!==n.NEAREST_MIPMAP_LINEAR||(i=n.NEAREST,e.hasMipmap||(r=n.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}static _applyWrapMode(t,e){"number"==typeof e.wrapMode?(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))}static _applyAnisotropicFilteringParameters(t,e){var i;const r=t.capabilities.textureFilterAnisotropic;if(!r)return;t.gl.texParameterf(e.target,r.TEXTURE_MAX_ANISOTROPY,null!=(i=e.maxAnisotropy)?i:1)}}function E(t){return t in m}function T(t){return t in h}function g(t){return e(t)&&"type"in t&&"compressed"===t.type}function x(t){return e(t)&&"byteLength"in t}function M(t){return e(t)&&!g(t)&&!x(t)}function A(t){return t===o.TEXTURE_3D||t===o.TEXTURE_2D_ARRAY}function I(t,e,i,r=1){let a=Math.max(e,i);return t===o.TEXTURE_3D&&(a=Math.max(a,r)),Math.round(Math.log(a)/Math.LN2)+1}u.TEXTURE_UNIT_FOR_UPDATES=0;export{u as Texture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{isNone as e}from"../../core/maybe.js";import{BufferType as r,CompressedTextureFormat as t,PixelFormat as i,RenderbufferFormat as s}from"./enums.js";function o(e,r){return e.vertexBuffers[r].size/n(e.layout[r])}function n(e){return e[0].stride}function a(e,r,t,i,s=0){const o=e.gl,n=e.capabilities.instancing;e.bindBuffer(t);for(const a of i){const e=r.get(a.name);void 0===e&&console.error(`There is no location for vertex attribute '${a.name}' defined.`);const t=s*a.stride;if(a.count<=4)o.vertexAttribPointer(e,a.count,a.type,a.normalized,a.stride,a.offset+t),o.enableVertexAttribArray(e),a.divisor>0&&n&&n.vertexAttribDivisor(e,a.divisor);else if(9===a.count)for(let r=0;r<3;r++)o.vertexAttribPointer(e+r,3,a.type,a.normalized,a.stride,a.offset+12*r+t),o.enableVertexAttribArray(e+r),a.divisor>0&&n&&n.vertexAttribDivisor(e+r,a.divisor);else if(16===a.count)for(let r=0;r<4;r++)o.vertexAttribPointer(e+r,4,a.type,a.normalized,a.stride,a.offset+16*r+t),o.enableVertexAttribArray(e+r),a.divisor>0&&n&&n.vertexAttribDivisor(e+r,a.divisor);else console.error("Unsupported vertex attribute element count: "+a.count)}}function c(e,t,i,s){const o=e.gl,n=e.capabilities.instancing;e.bindBuffer(i);for(const r of s){const e=t.get(r.name);if(r.count<=4)o.disableVertexAttribArray(e),r.divisor&&r.divisor>0&&n&&n.vertexAttribDivisor(e,0);else if(9===r.count)for(let t=0;t<3;t++)o.disableVertexAttribArray(e+t),r.divisor&&r.divisor>0&&n&&n.vertexAttribDivisor(e+t,0);else if(16===r.count)for(let t=0;t<4;t++)o.disableVertexAttribArray(e+t),r.divisor&&r.divisor>0&&n&&n.vertexAttribDivisor(e+t,0);else console.error("Unsupported vertex attribute element count: "+r.count)}e.unbindBuffer(r.ARRAY_BUFFER)}function E(e){switch(e){case i.ALPHA:case i.LUMINANCE:case s.STENCIL_INDEX8:return 1;case i.LUMINANCE_ALPHA:case i.RGBA4:case i.R16F:case s.RGBA4:case s.DEPTH_COMPONENT16:return 2;case i.RGB:case i.DEPTH_COMPONENT:return 3;case i.RGBA:case i.DEPTH_STENCIL:case i.R32F:case i.R11F_G11F_B10F:case i.RG16F:case s.DEPTH_STENCIL:return 4;case i.RG32F:case i.RGBA16F:return 8;case i.RGB32F:return 12;case i.RGBA32F:return 16;case t.COMPRESSED_RGB_S3TC_DXT1_EXT:case t.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case t.COMPRESSED_RGBA_S3TC_DXT3_EXT:case t.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case t.COMPRESSED_R11_EAC:case t.COMPRESSED_SIGNED_R11_EAC:case t.COMPRESSED_RGB8_ETC2:case t.COMPRESSED_SRGB8_ETC2:case t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case t.COMPRESSED_RG11_EAC:case t.COMPRESSED_SIGNED_RG11_EAC:case t.COMPRESSED_RGBA8_ETC2_EAC:case t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}function _(r){if(e(r))return 0;if("descriptor"in r)return r.glName?_(r.descriptor):0;const t=r.internalFormat||"pixelFormat"in r&&r.pixelFormat;if(!t)return 0;const i="hasMipmap"in r&&r.hasMipmap?1.3:1,s=r.width*r.height;return E(t)*s*i}export{a as bindVertexBufferLayout,E as getBytesPerElementFormat,_ as getGpuMemoryUsage,n as getStride,c as unbindVertexBufferLayout,o as vertexCount};
5
+ import"../../core/has.js";import{isNone as e}from"../../core/maybe.js";import{BufferType as r,CompressedTextureFormat as s,SizedPixelFormat as t,RenderbufferFormat as a,PixelFormat as c}from"./enums.js";function i(e,r){return e.vertexBuffers[r].size/R(e.layout[r])}function R(e){return e[0].stride}function o(e,r,s,t,a=0){const c=e.gl,i=e.capabilities.instancing;e.bindBuffer(s);for(const R of t){const e=r.get(R.name);void 0===e&&console.error(`There is no location for vertex attribute '${R.name}' defined.`);const s=a*R.stride;if(R.count<=4)c.vertexAttribPointer(e,R.count,R.type,R.normalized,R.stride,R.offset+s),c.enableVertexAttribArray(e),R.divisor>0&&i&&i.vertexAttribDivisor(e,R.divisor);else if(9===R.count)for(let r=0;r<3;r++)c.vertexAttribPointer(e+r,3,R.type,R.normalized,R.stride,R.offset+12*r+s),c.enableVertexAttribArray(e+r),R.divisor>0&&i&&i.vertexAttribDivisor(e+r,R.divisor);else if(16===R.count)for(let r=0;r<4;r++)c.vertexAttribPointer(e+r,4,R.type,R.normalized,R.stride,R.offset+16*r+s),c.enableVertexAttribArray(e+r),R.divisor>0&&i&&i.vertexAttribDivisor(e+r,R.divisor);else console.error("Unsupported vertex attribute element count: "+R.count)}}function n(e,s,t,a){const c=e.gl,i=e.capabilities.instancing;e.bindBuffer(t);for(const r of a){const e=s.get(r.name);if(r.count<=4)c.disableVertexAttribArray(e),r.divisor&&r.divisor>0&&i&&i.vertexAttribDivisor(e,0);else if(9===r.count)for(let s=0;s<3;s++)c.disableVertexAttribArray(e+s),r.divisor&&r.divisor>0&&i&&i.vertexAttribDivisor(e+s,0);else if(16===r.count)for(let s=0;s<4;s++)c.disableVertexAttribArray(e+s),r.divisor&&r.divisor>0&&i&&i.vertexAttribDivisor(e+s,0);else console.error("Unsupported vertex attribute element count: "+r.count)}e.unbindBuffer(r.ARRAY_BUFFER)}function E(e){switch(e){case c.ALPHA:case c.LUMINANCE:case c.RED:case c.RED_INTEGER:case t.R8:case t.R8I:case t.R8UI:case t.R8_SNORM:case a.STENCIL_INDEX8:return 1;case c.LUMINANCE_ALPHA:case c.RG:case c.RG_INTEGER:case t.RGBA4:case t.R16F:case t.R16I:case t.R16UI:case t.RG8:case t.RG8I:case t.RG8UI:case t.RG8_SNORM:case t.RGB565:case t.RGB5_A1:case a.DEPTH_COMPONENT16:return 2;case c.DEPTH_COMPONENT:case c.RGB:case c.RGB_INTEGER:case t.RGB8:case t.RGB8I:case t.RGB8UI:case t.RGB8_SNORM:case t.SRGB8:case a.DEPTH_COMPONENT24:return 3;case c.DEPTH_STENCIL:case c.RGBA:case c.RGBA_INTEGER:case t.RGBA8:case t.R32F:case t.R11F_G11F_B10F:case t.RG16F:case t.R32I:case t.R32UI:case t.RG16I:case t.RG16UI:case t.RGBA8I:case t.RGBA8UI:case t.RGBA8_SNORM:case t.SRGB8_ALPHA8:case t.RGB9_E5:case t.RGB10_A2UI:case t.RGB10_A2:case a.DEPTH_STENCIL:case a.DEPTH_COMPONENT32F:case a.DEPTH24_STENCIL8:return 4;case a.DEPTH32F_STENCIL8:return 5;case t.RGB16F:case t.RGB16I:case t.RGB16UI:return 6;case t.RG32F:case t.RG32I:case t.RG32UI:case t.RGBA16F:case t.RGBA16I:case t.RGBA16UI:return 8;case t.RGB32F:case t.RGB32I:case t.RGB32UI:return 12;case t.RGBA32F:case t.RGBA32I:case t.RGBA32UI:return 16;case s.COMPRESSED_RGB_S3TC_DXT1_EXT:case s.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case s.COMPRESSED_RGBA_S3TC_DXT3_EXT:case s.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case s.COMPRESSED_R11_EAC:case s.COMPRESSED_SIGNED_R11_EAC:case s.COMPRESSED_RGB8_ETC2:case s.COMPRESSED_SRGB8_ETC2:case s.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case s.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case s.COMPRESSED_RG11_EAC:case s.COMPRESSED_SIGNED_RG11_EAC:case s.COMPRESSED_RGBA8_ETC2_EAC:case s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}function _(r){if(e(r))return 0;if("descriptor"in r)return r.glName?_(r.descriptor):0;const s=r.internalFormat||"pixelFormat"in r&&r.pixelFormat;if(!s)return 0;const t="hasMipmap"in r&&r.hasMipmap?1.3:1,a=r.width*r.height;return E(s)*a*t}export{o as bindVertexBufferLayout,E as getBytesPerElementFormat,_ as getGpuMemoryUsage,R as getStride,n as unbindVertexBufferLayout,i as vertexCount};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- var E,_,T,A,R,N,C,S,O,I,L,D,M,P,U,F,B,G,H,n,Y;!function(E){E[E.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",E[E.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",E[E.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(E||(E={})),function(E){E[E.POINTS=0]="POINTS",E[E.LINES=1]="LINES",E[E.LINE_LOOP=2]="LINE_LOOP",E[E.LINE_STRIP=3]="LINE_STRIP",E[E.TRIANGLES=4]="TRIANGLES",E[E.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",E[E.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(_||(_={})),function(E){E[E.ZERO=0]="ZERO",E[E.ONE=1]="ONE",E[E.SRC_COLOR=768]="SRC_COLOR",E[E.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",E[E.SRC_ALPHA=770]="SRC_ALPHA",E[E.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",E[E.DST_ALPHA=772]="DST_ALPHA",E[E.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",E[E.DST_COLOR=774]="DST_COLOR",E[E.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",E[E.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",E[E.CONSTANT_COLOR=32769]="CONSTANT_COLOR",E[E.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",E[E.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",E[E.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(T||(T={})),function(E){E[E.ADD=32774]="ADD",E[E.SUBTRACT=32778]="SUBTRACT",E[E.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(A||(A={})),function(E){E[E.ARRAY_BUFFER=34962]="ARRAY_BUFFER",E[E.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",E[E.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",E[E.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",E[E.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",E[E.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",E[E.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER"}(R||(R={})),function(E){E[E.FRONT=1028]="FRONT",E[E.BACK=1029]="BACK",E[E.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(N||(N={})),function(E){E[E.CW=2304]="CW",E[E.CCW=2305]="CCW"}(C||(C={})),function(E){E[E.BYTE=5120]="BYTE",E[E.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",E[E.SHORT=5122]="SHORT",E[E.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",E[E.INT=5124]="INT",E[E.UNSIGNED_INT=5125]="UNSIGNED_INT",E[E.FLOAT=5126]="FLOAT"}(S||(S={})),function(E){E[E.NEVER=512]="NEVER",E[E.LESS=513]="LESS",E[E.EQUAL=514]="EQUAL",E[E.LEQUAL=515]="LEQUAL",E[E.GREATER=516]="GREATER",E[E.NOTEQUAL=517]="NOTEQUAL",E[E.GEQUAL=518]="GEQUAL",E[E.ALWAYS=519]="ALWAYS"}(O||(O={})),function(E){E[E.ZERO=0]="ZERO",E[E.KEEP=7680]="KEEP",E[E.REPLACE=7681]="REPLACE",E[E.INCR=7682]="INCR",E[E.DECR=7683]="DECR",E[E.INVERT=5386]="INVERT",E[E.INCR_WRAP=34055]="INCR_WRAP",E[E.DECR_WRAP=34056]="DECR_WRAP"}(I||(I={})),function(E){E[E.NEAREST=9728]="NEAREST",E[E.LINEAR=9729]="LINEAR",E[E.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",E[E.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",E[E.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",E[E.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(L||(L={})),function(E){E[E.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",E[E.REPEAT=10497]="REPEAT",E[E.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(D||(D={})),function(E){E[E.TEXTURE_2D=3553]="TEXTURE_2D",E[E.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",E[E.TEXTURE_3D=32879]="TEXTURE_3D",E[E.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",E[E.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",E[E.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",E[E.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",E[E.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",E[E.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(M||(M={})),function(E){E[E.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",E[E.ALPHA=6406]="ALPHA",E[E.RGB=6407]="RGB",E[E.RGBA=6408]="RGBA",E[E.LUMINANCE=6409]="LUMINANCE",E[E.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",E[E.RGBA4=32854]="RGBA4",E[E.DEPTH_STENCIL=34041]="DEPTH_STENCIL",E[E.R16F=33325]="R16F",E[E.RG16F=33327]="RG16F",E[E.RGB32F=34837]="RGB32F",E[E.RGBA16F=34842]="RGBA16F",E[E.R32F=33326]="R32F",E[E.RG32F=33328]="RG32F",E[E.RGBA32F=34836]="RGBA32F",E[E.R11F_G11F_B10F=35898]="R11F_G11F_B10F"}(P||(P={})),function(E){E[E.FLOAT=5126]="FLOAT",E[E.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",E[E.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",E[E.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",E[E.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",E[E.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5"}(U||(U={})),function(E){E[E.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",E[E.STENCIL_INDEX8=36168]="STENCIL_INDEX8",E[E.DEPTH_STENCIL=34041]="DEPTH_STENCIL",E[E.RGBA4=32854]="RGBA4"}(F||(F={})),function(E){E[E.STATIC_DRAW=35044]="STATIC_DRAW",E[E.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",E[E.STREAM_DRAW=35040]="STREAM_DRAW",E[E.STATIC_READ=35045]="STATIC_READ",E[E.DYNAMIC_READ=35049]="DYNAMIC_READ",E[E.STREAM_READ=35041]="STREAM_READ",E[E.STATIC_COPY=35046]="STATIC_COPY",E[E.DYNAMIC_COPY=35050]="DYNAMIC_COPY",E[E.STREAM_COPY=35042]="STREAM_COPY"}(B||(B={})),function(E){E[E.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",E[E.VERTEX_SHADER=35633]="VERTEX_SHADER"}(G||(G={})),function(E){E[E.FRAMEBUFFER=36160]="FRAMEBUFFER",E[E.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",E[E.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(H||(H={})),function(E){E[E.TEXTURE=0]="TEXTURE",E[E.RENDER_BUFFER=1]="RENDER_BUFFER",E[E.CUBEMAP=2]="CUBEMAP"}(n||(n={})),function(E){E[E.NONE=0]="NONE",E[E.DEPTH_RENDER_BUFFER=1]="DEPTH_RENDER_BUFFER",E[E.STENCIL_RENDER_BUFFER=2]="STENCIL_RENDER_BUFFER",E[E.DEPTH_STENCIL_RENDER_BUFFER=3]="DEPTH_STENCIL_RENDER_BUFFER",E[E.DEPTH_STENCIL_TEXTURE=4]="DEPTH_STENCIL_TEXTURE"}(Y||(Y={}));const X=33984;var V,f;!function(E){E[E.Texture=0]="Texture",E[E.Buffer=1]="Buffer",E[E.VAO=2]="VAO",E[E.Shader=3]="Shader",E[E.Program=4]="Program",E[E.Framebuffer=5]="Framebuffer",E[E.Renderbuffer=6]="Renderbuffer",E[E.COUNT=7]="COUNT"}(V||(V={})),function(E){E[E.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",E[E.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",E[E.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",E[E.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",E[E.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",E[E.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",E[E.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",E[E.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",E[E.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",E[E.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",E[E.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",E[E.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",E[E.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",E[E.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",E[E.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",E[E.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(f||(f={}));const u=33306;var o,t,c,i,W,r,e;!function(E){E[E.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",E[E.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",E[E.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",E[E.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",E[E.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",E[E.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",E[E.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",E[E.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",E[E.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(o||(o={})),function(E){E[E.FLOAT=5126]="FLOAT",E[E.FLOAT_VEC2=35664]="FLOAT_VEC2",E[E.FLOAT_VEC3=35665]="FLOAT_VEC3",E[E.FLOAT_VEC4=35666]="FLOAT_VEC4",E[E.INT=5124]="INT",E[E.INT_VEC2=35667]="INT_VEC2",E[E.INT_VEC3=35668]="INT_VEC3",E[E.INT_VEC4=35669]="INT_VEC4",E[E.BOOL=35670]="BOOL",E[E.BOOL_VEC2=35671]="BOOL_VEC2",E[E.BOOL_VEC3=35672]="BOOL_VEC3",E[E.BOOL_VEC4=35673]="BOOL_VEC4",E[E.FLOAT_MAT2=35674]="FLOAT_MAT2",E[E.FLOAT_MAT3=35675]="FLOAT_MAT3",E[E.FLOAT_MAT4=35676]="FLOAT_MAT4",E[E.SAMPLER_2D=35678]="SAMPLER_2D",E[E.SAMPLER_CUBE=35680]="SAMPLER_CUBE",E[E.UNSIGNED_INT=5125]="UNSIGNED_INT",E[E.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",E[E.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",E[E.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",E[E.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",E[E.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",E[E.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",E[E.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",E[E.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",E[E.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",E[E.SAMPLER_3D=35679]="SAMPLER_3D",E[E.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",E[E.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",E[E.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",E[E.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",E[E.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",E[E.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",E[E.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",E[E.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",E[E.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",E[E.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",E[E.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",E[E.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(t||(t={})),function(E){E[E.OBJECT_TYPE=37138]="OBJECT_TYPE",E[E.SYNC_CONDITION=37139]="SYNC_CONDITION",E[E.SYNC_STATUS=37140]="SYNC_STATUS",E[E.SYNC_FLAGS=37141]="SYNC_FLAGS"}(c||(c={})),function(E){E[E.UNSIGNALED=37144]="UNSIGNALED",E[E.SIGNALED=37145]="SIGNALED"}(i||(i={})),function(E){E[E.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",E[E.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",E[E.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",E[E.WAIT_FAILED=37149]="WAIT_FAILED"}(W||(W={})),function(E){E[E.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(r||(r={})),function(E){E[E.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(e||(e={}));export{X as BASE_TEXTURE_UNIT,T as BlendFactor,A as BlendOperation,R as BufferType,E as ClearBufferBit,W as ClientWaitSyncStatus,f as ColorAttachment,O as CompareFunction,o as CompressedTextureFormat,C as CullMode,S as DataType,u as DepthStencilAttachment,Y as DepthStencilTargetType,N as Face,H as FramebufferTarget,P as PixelFormat,U as PixelType,_ as PrimitiveType,F as RenderbufferFormat,V as ResourceType,G as ShaderType,I as StencilOperation,r as SyncCondition,e as SyncFlag,c as SyncParameter,i as SyncStatus,n as TargetType,L as TextureSamplingMode,M as TextureType,D as TextureWrapMode,t as UniformType,B as Usage};
5
+ var _,E,R,T,A,N,S,C,I,O,L,D,M,P,U,G,B,F,H,n,Y,V;!function(_){_[_.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",_[_.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",_[_.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(_||(_={})),function(_){_[_.POINTS=0]="POINTS",_[_.LINES=1]="LINES",_[_.LINE_LOOP=2]="LINE_LOOP",_[_.LINE_STRIP=3]="LINE_STRIP",_[_.TRIANGLES=4]="TRIANGLES",_[_.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",_[_.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(E||(E={})),function(_){_[_.ZERO=0]="ZERO",_[_.ONE=1]="ONE",_[_.SRC_COLOR=768]="SRC_COLOR",_[_.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",_[_.SRC_ALPHA=770]="SRC_ALPHA",_[_.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",_[_.DST_ALPHA=772]="DST_ALPHA",_[_.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",_[_.DST_COLOR=774]="DST_COLOR",_[_.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",_[_.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",_[_.CONSTANT_COLOR=32769]="CONSTANT_COLOR",_[_.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",_[_.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",_[_.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(R||(R={})),function(_){_[_.ADD=32774]="ADD",_[_.SUBTRACT=32778]="SUBTRACT",_[_.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(T||(T={})),function(_){_[_.ARRAY_BUFFER=34962]="ARRAY_BUFFER",_[_.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",_[_.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",_[_.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",_[_.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",_[_.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",_[_.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER"}(A||(A={})),function(_){_[_.FRONT=1028]="FRONT",_[_.BACK=1029]="BACK",_[_.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(N||(N={})),function(_){_[_.CW=2304]="CW",_[_.CCW=2305]="CCW"}(S||(S={})),function(_){_[_.BYTE=5120]="BYTE",_[_.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",_[_.SHORT=5122]="SHORT",_[_.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",_[_.INT=5124]="INT",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.FLOAT=5126]="FLOAT"}(C||(C={})),function(_){_[_.NEVER=512]="NEVER",_[_.LESS=513]="LESS",_[_.EQUAL=514]="EQUAL",_[_.LEQUAL=515]="LEQUAL",_[_.GREATER=516]="GREATER",_[_.NOTEQUAL=517]="NOTEQUAL",_[_.GEQUAL=518]="GEQUAL",_[_.ALWAYS=519]="ALWAYS"}(I||(I={})),function(_){_[_.ZERO=0]="ZERO",_[_.KEEP=7680]="KEEP",_[_.REPLACE=7681]="REPLACE",_[_.INCR=7682]="INCR",_[_.DECR=7683]="DECR",_[_.INVERT=5386]="INVERT",_[_.INCR_WRAP=34055]="INCR_WRAP",_[_.DECR_WRAP=34056]="DECR_WRAP"}(O||(O={})),function(_){_[_.NEAREST=9728]="NEAREST",_[_.LINEAR=9729]="LINEAR",_[_.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",_[_.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",_[_.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",_[_.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(L||(L={})),function(_){_[_.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",_[_.REPEAT=10497]="REPEAT",_[_.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(D||(D={})),function(_){_[_.TEXTURE_2D=3553]="TEXTURE_2D",_[_.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",_[_.TEXTURE_3D=32879]="TEXTURE_3D",_[_.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",_[_.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",_[_.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",_[_.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",_[_.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",_[_.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",_[_.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(M||(M={})),function(_){_[_.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",_[_.DEPTH_STENCIL=34041]="DEPTH_STENCIL",_[_.ALPHA=6406]="ALPHA",_[_.RGB=6407]="RGB",_[_.RGBA=6408]="RGBA",_[_.LUMINANCE=6409]="LUMINANCE",_[_.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",_[_.RED=6403]="RED",_[_.RG=33319]="RG",_[_.RED_INTEGER=36244]="RED_INTEGER",_[_.RG_INTEGER=33320]="RG_INTEGER",_[_.RGB_INTEGER=36248]="RGB_INTEGER",_[_.RGBA_INTEGER=36249]="RGBA_INTEGER"}(P||(P={})),function(_){_[_.RGBA4=32854]="RGBA4",_[_.R16F=33325]="R16F",_[_.RG16F=33327]="RG16F",_[_.RGB32F=34837]="RGB32F",_[_.RGBA16F=34842]="RGBA16F",_[_.R32F=33326]="R32F",_[_.RG32F=33328]="RG32F",_[_.RGBA32F=34836]="RGBA32F",_[_.R11F_G11F_B10F=35898]="R11F_G11F_B10F",_[_.RGB8=32849]="RGB8",_[_.RGBA8=32856]="RGBA8",_[_.RGB5_A1=32855]="RGB5_A1",_[_.R8=33321]="R8",_[_.RG8=33323]="RG8",_[_.R8I=33329]="R8I",_[_.R8UI=33330]="R8UI",_[_.R16I=33331]="R16I",_[_.R16UI=33332]="R16UI",_[_.R32I=33333]="R32I",_[_.R32UI=33334]="R32UI",_[_.RG8I=33335]="RG8I",_[_.RG8UI=33336]="RG8UI",_[_.RG16I=33337]="RG16I",_[_.RG16UI=33338]="RG16UI",_[_.RG32I=33339]="RG32I",_[_.RG32UI=33340]="RG32UI",_[_.RGB16F=34843]="RGB16F",_[_.RGB9_E5=35901]="RGB9_E5",_[_.SRGB8=35905]="SRGB8",_[_.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",_[_.RGB565=36194]="RGB565",_[_.RGBA32UI=36208]="RGBA32UI",_[_.RGB32UI=36209]="RGB32UI",_[_.RGBA16UI=36214]="RGBA16UI",_[_.RGB16UI=36215]="RGB16UI",_[_.RGBA8UI=36220]="RGBA8UI",_[_.RGB8UI=36221]="RGB8UI",_[_.RGBA32I=36226]="RGBA32I",_[_.RGB32I=36227]="RGB32I",_[_.RGBA16I=36232]="RGBA16I",_[_.RGB16I=36233]="RGB16I",_[_.RGBA8I=36238]="RGBA8I",_[_.RGB8I=36239]="RGB8I",_[_.R8_SNORM=36756]="R8_SNORM",_[_.RG8_SNORM=36757]="RG8_SNORM",_[_.RGB8_SNORM=36758]="RGB8_SNORM",_[_.RGBA8_SNORM=36759]="RGBA8_SNORM",_[_.RGB10_A2=32857]="RGB10_A2",_[_.RGB10_A2UI=36975]="RGB10_A2UI"}(U||(U={})),function(_){_[_.FLOAT=5126]="FLOAT",_[_.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",_[_.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",_[_.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",_[_.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",_[_.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",_[_.BYTE=5120]="BYTE",_[_.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",_[_.SHORT=5122]="SHORT",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.INT=5124]="INT",_[_.HALF_FLOAT=5131]="HALF_FLOAT",_[_.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",_[_.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",_[_.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",_[_.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(G||(G={})),function(_){_[_.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",_[_.STENCIL_INDEX8=36168]="STENCIL_INDEX8",_[_.DEPTH_STENCIL=34041]="DEPTH_STENCIL",_[_.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",_[_.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",_[_.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",_[_.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(B||(B={})),function(_){_[_.STATIC_DRAW=35044]="STATIC_DRAW",_[_.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",_[_.STREAM_DRAW=35040]="STREAM_DRAW",_[_.STATIC_READ=35045]="STATIC_READ",_[_.DYNAMIC_READ=35049]="DYNAMIC_READ",_[_.STREAM_READ=35041]="STREAM_READ",_[_.STATIC_COPY=35046]="STATIC_COPY",_[_.DYNAMIC_COPY=35050]="DYNAMIC_COPY",_[_.STREAM_COPY=35042]="STREAM_COPY"}(F||(F={})),function(_){_[_.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",_[_.VERTEX_SHADER=35633]="VERTEX_SHADER"}(H||(H={})),function(_){_[_.FRAMEBUFFER=36160]="FRAMEBUFFER",_[_.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",_[_.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(n||(n={})),function(_){_[_.TEXTURE=0]="TEXTURE",_[_.RENDER_BUFFER=1]="RENDER_BUFFER",_[_.CUBEMAP=2]="CUBEMAP"}(Y||(Y={})),function(_){_[_.NONE=0]="NONE",_[_.DEPTH_RENDER_BUFFER=1]="DEPTH_RENDER_BUFFER",_[_.STENCIL_RENDER_BUFFER=2]="STENCIL_RENDER_BUFFER",_[_.DEPTH_STENCIL_RENDER_BUFFER=3]="DEPTH_STENCIL_RENDER_BUFFER",_[_.DEPTH_STENCIL_TEXTURE=4]="DEPTH_STENCIL_TEXTURE"}(V||(V={}));const X=33984;var f,u;!function(_){_[_.Texture=0]="Texture",_[_.Buffer=1]="Buffer",_[_.VAO=2]="VAO",_[_.Shader=3]="Shader",_[_.Program=4]="Program",_[_.Framebuffer=5]="Framebuffer",_[_.Renderbuffer=6]="Renderbuffer",_[_.COUNT=7]="COUNT"}(f||(f={})),function(_){_[_.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",_[_.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",_[_.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",_[_.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",_[_.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",_[_.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",_[_.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",_[_.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",_[_.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",_[_.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",_[_.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",_[_.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",_[_.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",_[_.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",_[_.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",_[_.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(u||(u={}));const o=33306;var t,c,i,W,r,e,x;!function(_){_[_.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",_[_.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",_[_.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",_[_.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",_[_.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",_[_.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",_[_.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",_[_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",_[_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(t||(t={})),function(_){_[_.FLOAT=5126]="FLOAT",_[_.FLOAT_VEC2=35664]="FLOAT_VEC2",_[_.FLOAT_VEC3=35665]="FLOAT_VEC3",_[_.FLOAT_VEC4=35666]="FLOAT_VEC4",_[_.INT=5124]="INT",_[_.INT_VEC2=35667]="INT_VEC2",_[_.INT_VEC3=35668]="INT_VEC3",_[_.INT_VEC4=35669]="INT_VEC4",_[_.BOOL=35670]="BOOL",_[_.BOOL_VEC2=35671]="BOOL_VEC2",_[_.BOOL_VEC3=35672]="BOOL_VEC3",_[_.BOOL_VEC4=35673]="BOOL_VEC4",_[_.FLOAT_MAT2=35674]="FLOAT_MAT2",_[_.FLOAT_MAT3=35675]="FLOAT_MAT3",_[_.FLOAT_MAT4=35676]="FLOAT_MAT4",_[_.SAMPLER_2D=35678]="SAMPLER_2D",_[_.SAMPLER_CUBE=35680]="SAMPLER_CUBE",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",_[_.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",_[_.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",_[_.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",_[_.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",_[_.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",_[_.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",_[_.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",_[_.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",_[_.SAMPLER_3D=35679]="SAMPLER_3D",_[_.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",_[_.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",_[_.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",_[_.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",_[_.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",_[_.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",_[_.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",_[_.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",_[_.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",_[_.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",_[_.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",_[_.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(c||(c={})),function(_){_[_.OBJECT_TYPE=37138]="OBJECT_TYPE",_[_.SYNC_CONDITION=37139]="SYNC_CONDITION",_[_.SYNC_STATUS=37140]="SYNC_STATUS",_[_.SYNC_FLAGS=37141]="SYNC_FLAGS"}(i||(i={})),function(_){_[_.UNSIGNALED=37144]="UNSIGNALED",_[_.SIGNALED=37145]="SIGNALED"}(W||(W={})),function(_){_[_.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",_[_.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",_[_.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",_[_.WAIT_FAILED=37149]="WAIT_FAILED"}(r||(r={})),function(_){_[_.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(e||(e={})),function(_){_[_.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(x||(x={}));export{X as BASE_TEXTURE_UNIT,R as BlendFactor,T as BlendOperation,A as BufferType,_ as ClearBufferBit,r as ClientWaitSyncStatus,u as ColorAttachment,I as CompareFunction,t as CompressedTextureFormat,S as CullMode,C as DataType,o as DepthStencilAttachment,V as DepthStencilTargetType,N as Face,n as FramebufferTarget,P as PixelFormat,G as PixelType,E as PrimitiveType,B as RenderbufferFormat,f as ResourceType,H as ShaderType,U as SizedPixelFormat,O as StencilOperation,e as SyncCondition,x as SyncFlag,i as SyncParameter,W as SyncStatus,Y as TargetType,L as TextureSamplingMode,M as TextureType,D as TextureWrapMode,c as UniformType,F as Usage};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{ContextType as e}from"./context-util.js";import{PixelType as t,TextureType as n,PixelFormat as a,TextureSamplingMode as i,TextureWrapMode as r,TargetType as o,DepthStencilTargetType as u,UniformType as s}from"./enums.js";import{FramebufferObject as f}from"./FramebufferObject.js";import{Texture as l}from"./Texture.js";function m(o,u,s="nearest",f=!1){var m;const c=!(f&&"u8"===u.pixelType),_=c?t.FLOAT:t.UNSIGNED_BYTE,E=null==u.pixels||0===u.pixels.length?null:c?u.getAsRGBAFloat():u.getAsRGBA(),T=null==(m=o.capabilities.textureFloat)?void 0:m.textureFloatLinear,p={width:u.width,height:u.height,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:o.type===e.WEBGL2&&c?a.RGBA32F:a.RGBA,samplingMode:!T||"bilinear"!==s&&"cubic"!==s?i.NEAREST:i.LINEAR,dataType:_,wrapMode:r.CLAMP_TO_EDGE,flipped:!1};return new l(o,p,E)}function c(e,s,m,c){const _=c?t.UNSIGNED_BYTE:t.FLOAT,E={width:s,height:m,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,samplingMode:i.NEAREST,dataType:_,wrapMode:r.CLAMP_TO_EDGE,flipped:!1},T=new l(e,E);return new f(e,{colorTarget:o.TEXTURE,depthStencilTarget:u.DEPTH_STENCIL_RENDER_BUFFER,width:s,height:m},T)}function _(o,u){const s=4*u.size[0],f=u.size[1],m={width:s,height:f,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:o.type===e.WEBGL2?a.RGBA32F:a.RGBA,dataType:t.FLOAT,samplingMode:i.NEAREST,wrapMode:r.CLAMP_TO_EDGE,flipped:!1},c=new Float32Array(s*f*4);let _=0;for(let e=0;e<u.coefficients.length;e++)c[_++]=u.coefficients[e],e%3==2&&(c[_++]=1);return new l(o,m,c)}function E(e,o){const u={width:o.length/4,height:1,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,dataType:t.UNSIGNED_BYTE,samplingMode:i.NEAREST,wrapMode:r.CLAMP_TO_EDGE,flipped:!1};return new l(e,u,o)}function T(e,t,n,a=1,i=!0,r=!1){return{u_flipY:i,u_isFloatTexture:r,u_applyTransform:!!e,u_opacity:a,u_transformSpacing:e?e.spacing:null,u_transformGridSize:e?e.size:null,u_targetImageSize:t,u_srcImageSize:n}}function p(e,t){return{u_colormapOffset:t||0,u_colormapMaxIndex:e?e.length/4-1:null}}function g(e,t){return{u_scale:e,u_offset:t}}function A(e){return{u_bandCount:e.bandCount,u_minOutput:e.outMin,u_maxOutput:e.outMax,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 h(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}}function d(e,t){const n=e.gl,a=t.glName,i=n.getProgramParameter(a,n.ACTIVE_UNIFORMS),r=new Map;let o;for(let u=0;u<i;u++)o=n.getActiveUniform(a,u),o&&r.set(o.name,{location:n.getUniformLocation(a,o.name),info:o});return r}function O(e,t,n){Object.keys(n).forEach((a=>{const i=t.get(a)||t.get(a+"[0]");i&&R(e,a,n[a],i)}))}function F(e,t,n,a){n.length===a.length&&(a.some((e=>null==e))||n.some((e=>null==e))||n.forEach(((n,i)=>{t.setUniform1i(n,i),e.bindTexture(a[i],i)})))}function R(e,t,n,a){if(null===a||null==n)return!1;const{info:i}=a;switch(i.type){case s.FLOAT:i.size>1?e.setUniform1fv(t,n):e.setUniform1f(t,n);break;case s.FLOAT_VEC2:e.setUniform2fv(t,n);break;case s.FLOAT_VEC3:e.setUniform3fv(t,n);break;case s.FLOAT_VEC4:e.setUniform4fv(t,n);break;case s.FLOAT_MAT3:e.setUniformMatrix3fv(t,n);break;case s.FLOAT_MAT4:e.setUniformMatrix4fv(t,n);break;case s.INT:i.size>1?e.setUniform1iv(t,n):e.setUniform1i(t,n);break;case s.BOOL:e.setUniform1i(t,n?1:0);break;case s.INT_VEC2:case s.BOOL_VEC2:e.setUniform2iv(t,n);break;case s.INT_VEC3:case s.BOOL_VEC3:e.setUniform3iv(t,n);break;case s.INT_VEC4:case s.BOOL_VEC4:e.setUniform4iv(t,n);break;default:return!1}return!0}export{E as createColormapTexture,c as createFrameBuffer,m as createRasterTexture,_ as createTransformTexture,g as getBasicGridUniforms,p as getColormapUniforms,T as getCommonUniforms,h as getShadedReliefUniforms,A as getStretchUniforms,d as getUniformLocationInfos,F as setTextures,O as setUniforms};
5
+ import{ContextType as e}from"./context-util.js";import{PixelType as t,TextureType as n,PixelFormat as a,SizedPixelFormat as i,TextureSamplingMode as r,TextureWrapMode as o,TargetType as u,DepthStencilTargetType as s,UniformType as f}from"./enums.js";import{FramebufferObject as l}from"./FramebufferObject.js";import{Texture as m}from"./Texture.js";function c(u,s,f="nearest",l=!1){var c;const _=!(l&&"u8"===s.pixelType),E=_?t.FLOAT:t.UNSIGNED_BYTE,T=null==s.pixels||0===s.pixels.length?null:_?s.getAsRGBAFloat():s.getAsRGBA(),p=null==(c=u.capabilities.textureFloat)?void 0:c.textureFloatLinear,g={width:s.width,height:s.height,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:u.type===e.WEBGL2&&_?i.RGBA32F:a.RGBA,samplingMode:!p||"bilinear"!==f&&"cubic"!==f?r.NEAREST:r.LINEAR,dataType:E,wrapMode:o.CLAMP_TO_EDGE,flipped:!1};return new m(u,g,T)}function _(e,i,f,c){const _=c?t.UNSIGNED_BYTE:t.FLOAT,E={width:i,height:f,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,samplingMode:r.NEAREST,dataType:_,wrapMode:o.CLAMP_TO_EDGE,flipped:!1},T=new m(e,E);return new l(e,{colorTarget:u.TEXTURE,depthStencilTarget:s.DEPTH_STENCIL_RENDER_BUFFER,width:i,height:f},T)}function E(u,s){const f=4*s.size[0],l=s.size[1],c={width:f,height:l,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:u.type===e.WEBGL2?i.RGBA32F:a.RGBA,dataType:t.FLOAT,samplingMode:r.NEAREST,wrapMode:o.CLAMP_TO_EDGE,flipped:!1},_=new Float32Array(f*l*4);let E=0;for(let e=0;e<s.coefficients.length;e++)_[E++]=s.coefficients[e],e%3==2&&(_[E++]=1);return new m(u,c,_)}function T(e,i){const u={width:i.length/4,height:1,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,dataType:t.UNSIGNED_BYTE,samplingMode:r.NEAREST,wrapMode:o.CLAMP_TO_EDGE,flipped:!1};return new m(e,u,i)}function p(e,t,n,a=1,i=!0,r=!1){return{u_flipY:i,u_isFloatTexture:r,u_applyTransform:!!e,u_opacity:a,u_transformSpacing:e?e.spacing:null,u_transformGridSize:e?e.size:null,u_targetImageSize:t,u_srcImageSize:n}}function g(e,t){return{u_colormapOffset:t||0,u_colormapMaxIndex:e?e.length/4-1:null}}function A(e,t){return{u_scale:e,u_offset:t}}function h(e){return{u_bandCount:e.bandCount,u_minOutput:e.outMin,u_maxOutput:e.outMax,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 d(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}}function O(e,t){const n=e.gl,a=t.glName,i=n.getProgramParameter(a,n.ACTIVE_UNIFORMS),r=new Map;let o;for(let u=0;u<i;u++)o=n.getActiveUniform(a,u),o&&r.set(o.name,{location:n.getUniformLocation(a,o.name),info:o});return r}function F(e,t,n){Object.keys(n).forEach((a=>{const i=t.get(a)||t.get(a+"[0]");i&&U(e,a,n[a],i)}))}function R(e,t,n,a){n.length===a.length&&(a.some((e=>null==e))||n.some((e=>null==e))||n.forEach(((n,i)=>{t.setUniform1i(n,i),e.bindTexture(a[i],i)})))}function U(e,t,n,a){if(null===a||null==n)return!1;const{info:i}=a;switch(i.type){case f.FLOAT:i.size>1?e.setUniform1fv(t,n):e.setUniform1f(t,n);break;case f.FLOAT_VEC2:e.setUniform2fv(t,n);break;case f.FLOAT_VEC3:e.setUniform3fv(t,n);break;case f.FLOAT_VEC4:e.setUniform4fv(t,n);break;case f.FLOAT_MAT3:e.setUniformMatrix3fv(t,n);break;case f.FLOAT_MAT4:e.setUniformMatrix4fv(t,n);break;case f.INT:i.size>1?e.setUniform1iv(t,n):e.setUniform1i(t,n);break;case f.BOOL:e.setUniform1i(t,n?1:0);break;case f.INT_VEC2:case f.BOOL_VEC2:e.setUniform2iv(t,n);break;case f.INT_VEC3:case f.BOOL_VEC3:e.setUniform3iv(t,n);break;case f.INT_VEC4:case f.BOOL_VEC4:e.setUniform4iv(t,n);break;default:return!1}return!0}export{T as createColormapTexture,_ as createFrameBuffer,c as createRasterTexture,E as createTransformTexture,A as getBasicGridUniforms,g as getColormapUniforms,p as getCommonUniforms,d as getShadedReliefUniforms,h as getStretchUniforms,O as getUniformLocationInfos,R as setTextures,F as setUniforms};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{blendingAlpha as e}from"../3d/webgl-engine/lib/OrderIndependentTransparency.js";import{BufferObject as t}from"./BufferObject.js";import{ContextType as r}from"./context-util.js";import{TargetType as n,DepthStencilTargetType as o,TextureType as i,TextureWrapMode as a,PixelFormat as u,PixelType as f,TextureSamplingMode as l,Usage as c,DataType as s,PrimitiveType as d}from"./enums.js";import{FramebufferObject as g}from"./FramebufferObject.js";import{makePipelineState as b}from"./renderState.js";import{VertexArrayObject as E}from"./VertexArrayObject.js";import{VertexElementDescriptor as p}from"./VertexElementDescriptor.js";var m,T,_,v={exports:{}};function F(m){var T,_,F,x,A;if(!m.gl)return!1;if(m.type===r.WEBGL1)return(null==(x=m.capabilities.textureFloat)?void 0:x.textureFloat)&&(null==(A=m.capabilities.colorBufferFloat)?void 0:A.textureFloat);if(!((null==(T=m.capabilities.textureFloat)?void 0:T.textureFloat)&&(null==(_=m.capabilities.colorBufferFloat)?void 0:_.textureFloat)&&(null==(F=m.capabilities.colorBufferFloat)?void 0:F.floatBlend)))return!1;const R=new g(m,{colorTarget:n.TEXTURE,depthStencilTarget:o.NONE},{target:i.TEXTURE_2D,wrapMode:a.CLAMP_TO_EDGE,pixelFormat:u.RGBA,dataType:f.FLOAT,internalFormat:u.RGBA32F,samplingMode:l.NEAREST,width:1,height:1}),S=t.createVertex(m,c.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),h=new E(m,new Map([["a_pos",0]]),{geometry:[new p("a_pos",2,s.UNSIGNED_SHORT,0,4)]},{geometry:S}),P="\n precision highp float;\n attribute vec2 a_pos;\n\n void main() {\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n }\n ",L="\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ",B=m.programCache.acquire(P,L,new Map([["a_pos",0]]));m.useProgram(B);const C=m.getBoundFramebufferObject(),{x:w,y:O,width:N,height:I}=m.getViewport();m.bindFramebuffer(R),m.setViewport(0,0,1,1),m.bindVAO(h),m.drawArrays(d.TRIANGLE_STRIP,0,4);const U=b({blending:e});m.setPipelineState(U),m.drawArrays(d.TRIANGLE_STRIP,0,4),v.exports.init(m);const y=m.gl.getError();return m.setViewport(w,O,N,I),m.bindFramebuffer(C),B.dispose(),h.dispose(!1),S.dispose(),R.dispose(),1282!==y||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}m=v,T=function(){var e=function(e){window.console&&window.console.log&&window.console.log(e)},t=function(t){window.console&&window.console.error?window.console.error(t):e(t)},r={enable:{1:{0:!0}},disable:{1:{0:!0}},getParameter:{1:{0:!0}},drawArrays:{3:{0:!0}},drawElements:{4:{0:!0,2:!0}},createShader:{1:{0:!0}},getShaderParameter:{2:{1:!0}},getProgramParameter:{2:{1:!0}},getShaderPrecisionFormat:{2:{0:!0,1:!0}},getVertexAttrib:{2:{1:!0}},vertexAttribPointer:{6:{2:!0}},bindTexture:{2:{0:!0}},activeTexture:{1:{0:!0}},getTexParameter:{2:{0:!0,1:!0}},texParameterf:{3:{0:!0,1:!0}},texParameteri:{3:{0:!0,1:!0,2:!0}},texImage2D:{9:{0:!0,2:!0,6:!0,7:!0},6:{0:!0,2:!0,3:!0,4:!0}},texSubImage2D:{9:{0:!0,6:!0,7:!0},7:{0:!0,4:!0,5:!0}},copyTexImage2D:{8:{0:!0,2:!0}},copyTexSubImage2D:{8:{0:!0}},generateMipmap:{1:{0:!0}},compressedTexImage2D:{7:{0:!0,2:!0}},compressedTexSubImage2D:{8:{0:!0,6:!0}},bindBuffer:{2:{0:!0}},bufferData:{3:{0:!0,2:!0}},bufferSubData:{3:{0:!0}},getBufferParameter:{2:{0:!0,1:!0}},pixelStorei:{2:{0:!0,1:!0}},readPixels:{7:{4:!0,5:!0}},bindRenderbuffer:{2:{0:!0}},bindFramebuffer:{2:{0:!0}},checkFramebufferStatus:{1:{0:!0}},framebufferRenderbuffer:{4:{0:!0,1:!0,2:!0}},framebufferTexture2D:{5:{0:!0,1:!0,2:!0}},getFramebufferAttachmentParameter:{3:{0:!0,1:!0,2:!0}},getRenderbufferParameter:{2:{0:!0,1:!0}},renderbufferStorage:{4:{0:!0,1:!0}},clear:{1:{0:{enumBitwiseOr:["COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT"]}}},depthFunc:{1:{0:!0}},blendFunc:{2:{0:!0,1:!0}},blendFuncSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},blendEquation:{1:{0:!0}},blendEquationSeparate:{2:{0:!0,1:!0}},stencilFunc:{3:{0:!0}},stencilFuncSeparate:{4:{0:!0,1:!0}},stencilMaskSeparate:{2:{0:!0}},stencilOp:{3:{0:!0,1:!0,2:!0}},stencilOpSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},cullFace:{1:{0:!0}},frontFace:{1:{0:!0}},drawArraysInstancedANGLE:{4:{0:!0}},drawElementsInstancedANGLE:{5:{0:!0,2:!0}},blendEquationEXT:{1:{0:!0}}},n=null,o=null;function i(e){if(null==n)for(var t in n={},o={},e)"number"==typeof e[t]&&(n[e[t]]=t,o[t]=e[t])}function a(){if(null==n)throw"WebGLDebugUtils.init(ctx) not called"}function u(e){return a(),void 0!==n[e]}function f(e){a();var t=n[e];return void 0!==t?"gl."+t:"/*UNKNOWN WebGL ENUM*/ 0x"+e.toString(16)}function l(e,t,n,i){var a;if(void 0!==(a=r[e])&&void 0!==(a=a[t])&&a[n]){if("object"==typeof a[n]&&void 0!==a[n].enumBitwiseOr){for(var u=a[n].enumBitwiseOr,l=0,c=[],s=0;s<u.length;++s){var d=o[u[s]];0!=(i&d)&&(l|=d,c.push(f(d)))}return l===i?c.join(" | "):f(i)}return f(i)}return null===i?"null":void 0===i?"undefined":i.toString()}function c(e,t){for(var r="",n=t.length,o=0;o<n;++o)r+=(0==o?"":", ")+l(e,n,o,t[o]);return r}function s(e,t,r){e.__defineGetter__(r,(function(){return t[r]})),e.__defineSetter__(r,(function(e){t[r]=e}))}function d(e,r,n,o){o=o||e,i(e),r=r||function(e,r,n){for(var o="",i=n.length,a=0;a<i;++a)o+=(0==a?"":", ")+l(r,i,a,n[a]);t("WebGL error "+f(e)+" in "+r+"("+o+")")};var a={};function u(e,t){return function(){n&&n(t,arguments);var i=e[t].apply(e,arguments),u=o.getError();return 0!=u&&(a[u]=!0,r(u,t,arguments)),i}}var c={};for(var g in e)if("function"==typeof e[g])if("getExtension"!=g)c[g]=u(e,g);else{var b=u(e,g);c[g]=function(){return d(b.apply(e,arguments),r,n,o)}}else s(c,e,g);return c.getError=function(){for(var t in a)if(a.hasOwnProperty(t)&&a[t])return a[t]=!1,t;return e.NO_ERROR},c}function g(e){var t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r);for(var n=0;n<t;++n)e.disableVertexAttribArray(n),e.vertexAttribPointer(n,4,e.FLOAT,!1,0,0),e.vertexAttrib1f(n,0);e.deleteBuffer(r);var o=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);for(n=0;n<o;++n)e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_CUBE_MAP,null),e.bindTexture(e.TEXTURE_2D,null);for(e.activeTexture(e.TEXTURE0),e.useProgram(null),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindRenderbuffer(e.RENDERBUFFER,null),e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.DITHER),e.disable(e.SCISSOR_TEST),e.blendColor(0,0,0,0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.clearColor(0,0,0,0),e.clearDepth(1),e.clearStencil(-1),e.colorMask(!0,!0,!0,!0),e.cullFace(e.BACK),e.depthFunc(e.LESS),e.depthMask(!0),e.depthRange(0,1),e.frontFace(e.CCW),e.hint(e.GENERATE_MIPMAP_HINT,e.DONT_CARE),e.lineWidth(1),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.UNPACK_COLORSPACE_CONVERSION_WEBGL&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.polygonOffset(0,0),e.sampleCoverage(1,!1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilMask(4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.viewport(0,0,e.canvas.width,e.canvas.height),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT);e.getError(););}function b(e){var t,r,n=[],o=[],i={},a=1,u=!1,f=[],l=0,c=0,d=!1,b=0,E={};function p(e){return"function"==typeof e?e:function(t){e.handleEvent(t)}}e.getContext=(r=e.getContext,function(){var n=r.apply(e,arguments);if(n instanceof WebGLRenderingContext){if(n!=t){if(t)throw"got different context";i=S(t=n)}return i}return n});var m=function(e){n.push(p(e))},T=function(e){o.push(p(e))};function _(e){var t=e.addEventListener;e.addEventListener=function(r,n,o){switch(r){case"webglcontextlost":m(n);break;case"webglcontextrestored":T(n);break;default:t.apply(e,arguments)}}}function v(){for(var e=Object.keys(E),t=0;t<e.length;++t)delete E[e]}function F(){++c,u||l==c&&e.loseContext()}function x(e,t){var r=e[t];return function(){if(F(),!u)return r.apply(e,arguments)}}function A(){for(var e=0;e<f.length;++e){var r=f[e];r instanceof WebGLBuffer?t.deleteBuffer(r):r instanceof WebGLFramebuffer?t.deleteFramebuffer(r):r instanceof WebGLProgram?t.deleteProgram(r):r instanceof WebGLRenderbuffer?t.deleteRenderbuffer(r):r instanceof WebGLShader?t.deleteShader(r):r instanceof WebGLTexture&&t.deleteTexture(r)}}function R(e){return{statusMessage:e,preventDefault:function(){d=!0}}}return _(e),e.loseContext=function(){if(!u){for(u=!0,l=0,++a;t.getError(););v(),E[t.CONTEXT_LOST_WEBGL]=!0;var r=R("context lost"),o=n.slice();setTimeout((function(){for(var t=0;t<o.length;++t)o[t](r);b>=0&&setTimeout((function(){e.restoreContext()}),b)}),0)}},e.restoreContext=function(){u&&o.length&&setTimeout((function(){if(!d)throw"can not restore. webglcontestlost listener did not call event.preventDefault";A(),g(t),u=!1,c=0,d=!1;for(var e=o.slice(),r=R("context restored"),n=0;n<e.length;++n)e[n](r)}),0)},e.loseContextInNCalls=function(e){if(u)throw"You can not ask a lost contet to be lost";l=c+e},e.getNumCalls=function(){return c},e.setRestoreTimeout=function(e){b=e},e;function S(e){for(var r in e)"function"==typeof e[r]?i[r]=x(e,r):s(i,e,r);i.getError=function(){if(F(),!u)for(;e=t.getError();)E[e]=!0;for(var e in E)if(E[e])return delete E[e],e;return i.NO_ERROR};for(var n=["createBuffer","createFramebuffer","createProgram","createRenderbuffer","createShader","createTexture"],o=0;o<n.length;++o){var l=n[o];i[l]=function(t){return function(){if(F(),u)return null;var r=t.apply(e,arguments);return r.__webglDebugContextLostId__=a,f.push(r),r}}(e[l])}var c=["getActiveAttrib","getActiveUniform","getBufferParameter","getContextAttributes","getAttachedShaders","getFramebufferAttachmentParameter","getParameter","getProgramParameter","getProgramInfoLog","getRenderbufferParameter","getShaderParameter","getShaderInfoLog","getShaderSource","getTexParameter","getUniform","getUniformLocation","getVertexAttrib"];for(o=0;o<c.length;++o)l=c[o],i[l]=function(t){return function(){return F(),u?null:t.apply(e,arguments)}}(i[l]);var d=["isBuffer","isEnabled","isFramebuffer","isProgram","isRenderbuffer","isShader","isTexture"];for(o=0;o<d.length;++o)l=d[o],i[l]=function(t){return function(){return F(),!u&&t.apply(e,arguments)}}(i[l]);return i.checkFramebufferStatus=function(t){return function(){return F(),u?i.FRAMEBUFFER_UNSUPPORTED:t.apply(e,arguments)}}(i.checkFramebufferStatus),i.getAttribLocation=function(t){return function(){return F(),u?-1:t.apply(e,arguments)}}(i.getAttribLocation),i.getVertexAttribOffset=function(t){return function(){return F(),u?0:t.apply(e,arguments)}}(i.getVertexAttribOffset),i.isContextLost=function(){return u},i}}return{init:i,mightBeEnum:u,glEnumToString:f,glFunctionArgToString:l,glFunctionArgsToString:c,makeDebugContext:d,makeLostContextSimulatingCanvas:b,resetToInitialState:g}},void 0!==(_=T())&&(m.exports=_);export{F as testFloatBufferBlend};
5
+ import{blendingAlpha as e}from"../3d/webgl-engine/lib/OrderIndependentTransparency.js";import{BufferObject as t}from"./BufferObject.js";import{ContextType as r}from"./context-util.js";import{TargetType as n,DepthStencilTargetType as o,TextureType as i,TextureWrapMode as a,PixelFormat as u,PixelType as f,SizedPixelFormat as l,TextureSamplingMode as c,Usage as s,DataType as d,PrimitiveType as g}from"./enums.js";import{FramebufferObject as b}from"./FramebufferObject.js";import{makePipelineState as E}from"./renderState.js";import{VertexArrayObject as p}from"./VertexArrayObject.js";import{VertexElementDescriptor as m}from"./VertexElementDescriptor.js";var T,_,v,F={exports:{}};function x(T){var _,v,x,A,R;if(!T.gl)return!1;if(T.type===r.WEBGL1)return(null==(A=T.capabilities.textureFloat)?void 0:A.textureFloat)&&(null==(R=T.capabilities.colorBufferFloat)?void 0:R.textureFloat);if(!((null==(_=T.capabilities.textureFloat)?void 0:_.textureFloat)&&(null==(v=T.capabilities.colorBufferFloat)?void 0:v.textureFloat)&&(null==(x=T.capabilities.colorBufferFloat)?void 0:x.floatBlend)))return!1;const S=new b(T,{colorTarget:n.TEXTURE,depthStencilTarget:o.NONE},{target:i.TEXTURE_2D,wrapMode:a.CLAMP_TO_EDGE,pixelFormat:u.RGBA,dataType:f.FLOAT,internalFormat:l.RGBA32F,samplingMode:c.NEAREST,width:1,height:1}),h=t.createVertex(T,s.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),P=new p(T,new Map([["a_pos",0]]),{geometry:[new m("a_pos",2,d.UNSIGNED_SHORT,0,4)]},{geometry:h}),L="\n precision highp float;\n attribute vec2 a_pos;\n\n void main() {\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n }\n ",B="\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ",C=T.programCache.acquire(L,B,new Map([["a_pos",0]]));T.useProgram(C);const w=T.getBoundFramebufferObject(),{x:O,y:N,width:I,height:U}=T.getViewport();T.bindFramebuffer(S),T.setViewport(0,0,1,1),T.bindVAO(P),T.drawArrays(g.TRIANGLE_STRIP,0,4);const y=E({blending:e});T.setPipelineState(y),T.drawArrays(g.TRIANGLE_STRIP,0,4),F.exports.init(T);const D=T.gl.getError();return T.setViewport(O,N,I,U),T.bindFramebuffer(w),C.dispose(),P.dispose(!1),h.dispose(),S.dispose(),1282!==D||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}T=F,_=function(){var e=function(e){window.console&&window.console.log&&window.console.log(e)},t=function(t){window.console&&window.console.error?window.console.error(t):e(t)},r={enable:{1:{0:!0}},disable:{1:{0:!0}},getParameter:{1:{0:!0}},drawArrays:{3:{0:!0}},drawElements:{4:{0:!0,2:!0}},createShader:{1:{0:!0}},getShaderParameter:{2:{1:!0}},getProgramParameter:{2:{1:!0}},getShaderPrecisionFormat:{2:{0:!0,1:!0}},getVertexAttrib:{2:{1:!0}},vertexAttribPointer:{6:{2:!0}},bindTexture:{2:{0:!0}},activeTexture:{1:{0:!0}},getTexParameter:{2:{0:!0,1:!0}},texParameterf:{3:{0:!0,1:!0}},texParameteri:{3:{0:!0,1:!0,2:!0}},texImage2D:{9:{0:!0,2:!0,6:!0,7:!0},6:{0:!0,2:!0,3:!0,4:!0}},texSubImage2D:{9:{0:!0,6:!0,7:!0},7:{0:!0,4:!0,5:!0}},copyTexImage2D:{8:{0:!0,2:!0}},copyTexSubImage2D:{8:{0:!0}},generateMipmap:{1:{0:!0}},compressedTexImage2D:{7:{0:!0,2:!0}},compressedTexSubImage2D:{8:{0:!0,6:!0}},bindBuffer:{2:{0:!0}},bufferData:{3:{0:!0,2:!0}},bufferSubData:{3:{0:!0}},getBufferParameter:{2:{0:!0,1:!0}},pixelStorei:{2:{0:!0,1:!0}},readPixels:{7:{4:!0,5:!0}},bindRenderbuffer:{2:{0:!0}},bindFramebuffer:{2:{0:!0}},checkFramebufferStatus:{1:{0:!0}},framebufferRenderbuffer:{4:{0:!0,1:!0,2:!0}},framebufferTexture2D:{5:{0:!0,1:!0,2:!0}},getFramebufferAttachmentParameter:{3:{0:!0,1:!0,2:!0}},getRenderbufferParameter:{2:{0:!0,1:!0}},renderbufferStorage:{4:{0:!0,1:!0}},clear:{1:{0:{enumBitwiseOr:["COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT"]}}},depthFunc:{1:{0:!0}},blendFunc:{2:{0:!0,1:!0}},blendFuncSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},blendEquation:{1:{0:!0}},blendEquationSeparate:{2:{0:!0,1:!0}},stencilFunc:{3:{0:!0}},stencilFuncSeparate:{4:{0:!0,1:!0}},stencilMaskSeparate:{2:{0:!0}},stencilOp:{3:{0:!0,1:!0,2:!0}},stencilOpSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},cullFace:{1:{0:!0}},frontFace:{1:{0:!0}},drawArraysInstancedANGLE:{4:{0:!0}},drawElementsInstancedANGLE:{5:{0:!0,2:!0}},blendEquationEXT:{1:{0:!0}}},n=null,o=null;function i(e){if(null==n)for(var t in n={},o={},e)"number"==typeof e[t]&&(n[e[t]]=t,o[t]=e[t])}function a(){if(null==n)throw"WebGLDebugUtils.init(ctx) not called"}function u(e){return a(),void 0!==n[e]}function f(e){a();var t=n[e];return void 0!==t?"gl."+t:"/*UNKNOWN WebGL ENUM*/ 0x"+e.toString(16)}function l(e,t,n,i){var a;if(void 0!==(a=r[e])&&void 0!==(a=a[t])&&a[n]){if("object"==typeof a[n]&&void 0!==a[n].enumBitwiseOr){for(var u=a[n].enumBitwiseOr,l=0,c=[],s=0;s<u.length;++s){var d=o[u[s]];0!=(i&d)&&(l|=d,c.push(f(d)))}return l===i?c.join(" | "):f(i)}return f(i)}return null===i?"null":void 0===i?"undefined":i.toString()}function c(e,t){for(var r="",n=t.length,o=0;o<n;++o)r+=(0==o?"":", ")+l(e,n,o,t[o]);return r}function s(e,t,r){e.__defineGetter__(r,(function(){return t[r]})),e.__defineSetter__(r,(function(e){t[r]=e}))}function d(e,r,n,o){o=o||e,i(e),r=r||function(e,r,n){for(var o="",i=n.length,a=0;a<i;++a)o+=(0==a?"":", ")+l(r,i,a,n[a]);t("WebGL error "+f(e)+" in "+r+"("+o+")")};var a={};function u(e,t){return function(){n&&n(t,arguments);var i=e[t].apply(e,arguments),u=o.getError();return 0!=u&&(a[u]=!0,r(u,t,arguments)),i}}var c={};for(var g in e)if("function"==typeof e[g])if("getExtension"!=g)c[g]=u(e,g);else{var b=u(e,g);c[g]=function(){return d(b.apply(e,arguments),r,n,o)}}else s(c,e,g);return c.getError=function(){for(var t in a)if(a.hasOwnProperty(t)&&a[t])return a[t]=!1,t;return e.NO_ERROR},c}function g(e){var t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r);for(var n=0;n<t;++n)e.disableVertexAttribArray(n),e.vertexAttribPointer(n,4,e.FLOAT,!1,0,0),e.vertexAttrib1f(n,0);e.deleteBuffer(r);var o=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);for(n=0;n<o;++n)e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_CUBE_MAP,null),e.bindTexture(e.TEXTURE_2D,null);for(e.activeTexture(e.TEXTURE0),e.useProgram(null),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindRenderbuffer(e.RENDERBUFFER,null),e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.DITHER),e.disable(e.SCISSOR_TEST),e.blendColor(0,0,0,0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.clearColor(0,0,0,0),e.clearDepth(1),e.clearStencil(-1),e.colorMask(!0,!0,!0,!0),e.cullFace(e.BACK),e.depthFunc(e.LESS),e.depthMask(!0),e.depthRange(0,1),e.frontFace(e.CCW),e.hint(e.GENERATE_MIPMAP_HINT,e.DONT_CARE),e.lineWidth(1),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.UNPACK_COLORSPACE_CONVERSION_WEBGL&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.polygonOffset(0,0),e.sampleCoverage(1,!1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilMask(4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.viewport(0,0,e.canvas.width,e.canvas.height),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT);e.getError(););}function b(e){var t,r,n=[],o=[],i={},a=1,u=!1,f=[],l=0,c=0,d=!1,b=0,E={};function p(e){return"function"==typeof e?e:function(t){e.handleEvent(t)}}e.getContext=(r=e.getContext,function(){var n=r.apply(e,arguments);if(n instanceof WebGLRenderingContext){if(n!=t){if(t)throw"got different context";i=S(t=n)}return i}return n});var m=function(e){n.push(p(e))},T=function(e){o.push(p(e))};function _(e){var t=e.addEventListener;e.addEventListener=function(r,n,o){switch(r){case"webglcontextlost":m(n);break;case"webglcontextrestored":T(n);break;default:t.apply(e,arguments)}}}function v(){for(var e=Object.keys(E),t=0;t<e.length;++t)delete E[e]}function F(){++c,u||l==c&&e.loseContext()}function x(e,t){var r=e[t];return function(){if(F(),!u)return r.apply(e,arguments)}}function A(){for(var e=0;e<f.length;++e){var r=f[e];r instanceof WebGLBuffer?t.deleteBuffer(r):r instanceof WebGLFramebuffer?t.deleteFramebuffer(r):r instanceof WebGLProgram?t.deleteProgram(r):r instanceof WebGLRenderbuffer?t.deleteRenderbuffer(r):r instanceof WebGLShader?t.deleteShader(r):r instanceof WebGLTexture&&t.deleteTexture(r)}}function R(e){return{statusMessage:e,preventDefault:function(){d=!0}}}return _(e),e.loseContext=function(){if(!u){for(u=!0,l=0,++a;t.getError(););v(),E[t.CONTEXT_LOST_WEBGL]=!0;var r=R("context lost"),o=n.slice();setTimeout((function(){for(var t=0;t<o.length;++t)o[t](r);b>=0&&setTimeout((function(){e.restoreContext()}),b)}),0)}},e.restoreContext=function(){u&&o.length&&setTimeout((function(){if(!d)throw"can not restore. webglcontestlost listener did not call event.preventDefault";A(),g(t),u=!1,c=0,d=!1;for(var e=o.slice(),r=R("context restored"),n=0;n<e.length;++n)e[n](r)}),0)},e.loseContextInNCalls=function(e){if(u)throw"You can not ask a lost contet to be lost";l=c+e},e.getNumCalls=function(){return c},e.setRestoreTimeout=function(e){b=e},e;function S(e){for(var r in e)"function"==typeof e[r]?i[r]=x(e,r):s(i,e,r);i.getError=function(){if(F(),!u)for(;e=t.getError();)E[e]=!0;for(var e in E)if(E[e])return delete E[e],e;return i.NO_ERROR};for(var n=["createBuffer","createFramebuffer","createProgram","createRenderbuffer","createShader","createTexture"],o=0;o<n.length;++o){var l=n[o];i[l]=function(t){return function(){if(F(),u)return null;var r=t.apply(e,arguments);return r.__webglDebugContextLostId__=a,f.push(r),r}}(e[l])}var c=["getActiveAttrib","getActiveUniform","getBufferParameter","getContextAttributes","getAttachedShaders","getFramebufferAttachmentParameter","getParameter","getProgramParameter","getProgramInfoLog","getRenderbufferParameter","getShaderParameter","getShaderInfoLog","getShaderSource","getTexParameter","getUniform","getUniformLocation","getVertexAttrib"];for(o=0;o<c.length;++o)l=c[o],i[l]=function(t){return function(){return F(),u?null:t.apply(e,arguments)}}(i[l]);var d=["isBuffer","isEnabled","isFramebuffer","isProgram","isRenderbuffer","isShader","isTexture"];for(o=0;o<d.length;++o)l=d[o],i[l]=function(t){return function(){return F(),!u&&t.apply(e,arguments)}}(i[l]);return i.checkFramebufferStatus=function(t){return function(){return F(),u?i.FRAMEBUFFER_UNSUPPORTED:t.apply(e,arguments)}}(i.checkFramebufferStatus),i.getAttribLocation=function(t){return function(){return F(),u?-1:t.apply(e,arguments)}}(i.getAttribLocation),i.getVertexAttribOffset=function(t){return function(){return F(),u?0:t.apply(e,arguments)}}(i.getVertexAttribOffset),i.isContextLost=function(){return u},i}}return{init:i,mightBeEnum:u,glEnumToString:f,glFunctionArgToString:l,glFunctionArgsToString:c,makeDebugContext:d,makeLostContextSimulatingCanvas:b,resetToInitialState:g}},void 0!==(v=_())&&(T.exports=v);export{x as testFloatBufferBlend};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{init as t}from"../../core/watchUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import i from"../Widget.js";import s from"./FeatureContent.js";import n from"./FeatureFields.js";import d from"./FeatureMedia.js";import a from"./FeatureExpression/FeatureExpressionViewModel.js";import"../support/widgetUtils.js";import"../../core/Logger.js";import{tsx as l}from"../support/jsxFactory.js";const p={iconLoading:"esri-icon-loading-indicator esri-rotating",base:"esri-feature-expression",loadingSpinnerContainer:"esri-feature__loading-container",spinner:"esri-feature__loading-spinner"};let c=class extends i{constructor(e,t){super(e,t),this.viewModel=new a}initialize(){t(this,"viewModel.contentElementViewModel",(()=>this._setupExpressionWidget()))}destroy(){var e;null==(e=this._contentWidget)||e.destroy(),this._contentWidget=null}renderLoading(){return l("div",{key:"loading-container",class:p.loadingSpinnerContainer},l("span",{class:this.classes(p.iconLoading,p.spinner)}))}render(){var e;const{state:t}=this.viewModel;return l("div",{class:p.base},"loading"===t?this.renderLoading():"disabled"===t?null:null==(e=this._contentWidget)?void 0:e.render())}_setupExpressionWidget(){var e;const{contentElementViewModel:t,contentElement:o}=this.viewModel,r=null==o?void 0:o.type;null==(e=this._contentWidget)||e.destroy(),this._contentWidget=null;const i=t?"fields"===r?new n({viewModel:t}):"media"===r?new d({viewModel:t}):"text"===r?new s({viewModel:t}):null:null;this._contentWidget=i,this.scheduleRender()}};e([o({type:a})],c.prototype,"viewModel",void 0),c=e([r("esri.widgets.Feature.FeatureExpression")],c);const u=c;export{u as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{init as t}from"../../core/watchUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import i from"../Widget.js";import r from"./FeatureContent.js";import n from"./FeatureFields.js";import d from"./FeatureMedia.js";import a from"./FeatureExpression/FeatureExpressionViewModel.js";import"../support/widgetUtils.js";import"../../core/Logger.js";import{tsx as l}from"../support/jsxFactory.js";const p={iconLoading:"esri-icon-loading-indicator esri-rotating",base:"esri-feature-expression",loadingSpinnerContainer:"esri-feature__loading-container",spinner:"esri-feature__loading-spinner"};let c=class extends i{constructor(e,t){super(e,t),this.viewModel=new a}initialize(){t(this,"viewModel.contentElementViewModel",(()=>this._setupExpressionWidget()))}destroy(){this._destroyContentWidget()}renderLoading(){return l("div",{key:"loading-container",class:p.loadingSpinnerContainer},l("span",{class:this.classes(p.iconLoading,p.spinner)}))}render(){var e;const{state:t}=this.viewModel;return l("div",{class:p.base},"loading"===t?this.renderLoading():"disabled"===t?null:null==(e=this._contentWidget)?void 0:e.render())}_destroyContentWidget(){const{_contentWidget:e}=this;e&&(e.viewModel=null,e.destroy()),this._contentWidget=null}_setupExpressionWidget(){const{contentElementViewModel:e,contentElement:t}=this.viewModel,o=null==t?void 0:t.type;this._destroyContentWidget();const s=e?"fields"===o?new n({viewModel:e}):"media"===o?new d({viewModel:e}):"text"===o?new r({viewModel:e}):null:null;this._contentWidget=s,this.scheduleRender()}};e([o({type:a})],c.prototype,"viewModel",void 0),c=e([s("esri.widgets.Feature.FeatureExpression")],c);const u=c;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../../popup/FieldInfo.js";import a from"../../../popup/content/support/ChartMediaInfoValueSeries.js";import{substituteFieldsInLinksAndAttributes as s,fixTokens as l,substituteAttributes as n,getFixedFieldNames as d,getFixedFieldName as p,isRelatedField as u,formatValueToFieldInfo as f,getFieldInfo as m,getFieldInfoLabel as c}from"../support/featureUtils.js";import{getRelatedFieldInfo as h}from"../support/relatedFeatureUtils.js";let y=class extends e{constructor(t){super(t),this.activeMediaInfoIndex=0,this.attributes=null,this.description=null,this.fieldInfoMap=null,this.formattedAttributes=null,this.expressionAttributes=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null}get activeMediaInfo(){return this.formattedMediaInfos[this.activeMediaInfoIndex]||null}get formattedMediaInfos(){return this._formatMediaInfos()||[]}get formattedMediaInfoCount(){return this.formattedMediaInfos.length}setActiveMedia(t){this._setContentElementMedia(t)}next(){this._pageContentElementMedia(1)}previous(){this._pageContentElementMedia(-1)}_setContentElementMedia(t){const{formattedMediaInfoCount:e}=this,o=(t+e)%e;this.activeMediaInfoIndex=o}_pageContentElementMedia(t){const{activeMediaInfoIndex:e}=this,o=e+t;this._setContentElementMedia(o)}_formatMediaInfos(){const{attributes:t,mediaInfos:e,formattedAttributes:o,expressionAttributes:i,fieldInfoMap:r,layer:a}=this;return null==e?void 0:e.map((e=>{const l=null==e?void 0:e.clone();if(!l)return null;if(l.title=s({attributes:t,fieldInfoMap:r,globalAttributes:o,expressionAttributes:i,layer:a,text:l.title}),l.caption=s({attributes:t,fieldInfoMap:r,globalAttributes:o,expressionAttributes:i,layer:a,text:l.caption}),l.altText=s({attributes:t,fieldInfoMap:r,globalAttributes:o,expressionAttributes:i,layer:a,text:l.altText}),"image"===l.type){const{value:t}=l;return this._setImageValue({value:t,formattedAttributes:o,layer:a}),l.value.sourceURL?l:void 0}if("pie-chart"===l.type||"line-chart"===l.type||"column-chart"===l.type||"bar-chart"===l.type){const{value:e}=l;return this._setChartValue({value:e,chartType:l.type,attributes:t,formattedAttributes:o,layer:a}),l}return null})).filter(Boolean)}_setImageValue(t){const{fieldInfoMap:e}=this,{value:o,formattedAttributes:i,layer:r}=t,{linkURL:a,sourceURL:s}=o;if(s){const t=l(s,r);o.sourceURL=n({formattedAttributes:i,template:t,fieldInfoMap:e})}if(a){const t=l(a,r);o.linkURL=n({formattedAttributes:i,template:t,fieldInfoMap:e})}}_setChartValue(t){const{value:e,attributes:o,formattedAttributes:i,chartType:r,layer:a}=t,{popupTemplate:s,relatedInfos:l}=this,{fields:n,normalizeField:f}=e;e.fields=d(n,a),f&&(e.normalizeField=p(f,a));if(!n.some((t=>!!(null!=i[t]||u(t)&&l.size))))return;const m=null==s?void 0:s.fieldInfos;n.forEach((t=>{if(u(t))return void(e.series=[...e.series,...this._getRelatedChartInfos({fieldInfos:m,fieldName:t,formattedAttributes:i,chartType:r,value:e})]);const a=this._getChartOption({value:e,attributes:o,chartType:r,formattedAttributes:i,fieldName:t,fieldInfos:m});e.series.push(a)}))}_getRelatedChartInfos(t){var e;const{fieldInfos:o,fieldName:i,formattedAttributes:r,chartType:a,value:s}=t,l=[],n=h(i),{layerId:d,fieldName:p}=n,u=null==(e=this.relatedInfos)?void 0:e.get(d.toString());if(!u)return l;const{relatedFeatures:f,relation:m}=u;if(!m||!f)return l;const{cardinality:c}=m;f.forEach((t=>{const{attributes:e}=t;e&&Object.keys(e).forEach((t=>{t===p&&l.push(this._getChartOption({value:s,attributes:e,formattedAttributes:r,fieldName:i,chartType:a,relatedFieldName:t,fieldInfos:o}))}))}));return"one-to-many"===c||"many-to-many"===c?l:[l[0]]}_getTooltip({label:t,value:e,chartType:o}){return"pie-chart"===o?t:`${t}: ${e}`}_getChartOption(t){var e;const{value:o,attributes:i,formattedAttributes:s,fieldName:l,relatedFieldName:n,fieldInfos:d,chartType:y}=t,{layer:I}=this,{normalizeField:v,tooltipField:b}=o,M=v?u(v)?i[h(v).fieldName]:i[v]:null,g=n&&void 0!==i[n]?i[n]:void 0!==i[l]?i[l]:s[l],A=void 0===g?null:g&&M?g/M:g,_=new a({value:A});if(u(l)){const t=h(l),e=h(b),o=e?e.fieldName:null,r=f(A,{fieldInfos:d,fieldName:n,layer:I,preventPlacesFormatting:!!M}),a=t?t.label||t.fieldName:n,s=o&&void 0!==i[o]?i[o]:a;return _.tooltip=this._getTooltip({label:s,value:r,chartType:y}),_}const x=m(d,l),T=p(l,I),C=b&&void 0!==s[b]?s[b]:c(x||new r({fieldName:T}),null==(e=this.popupTemplate)?void 0:e.expressionInfos),F=s[T];return _.tooltip=this._getTooltip({label:C,value:F,chartType:y}),_}};t([o()],y.prototype,"activeMediaInfoIndex",void 0),t([o({readOnly:!0})],y.prototype,"activeMediaInfo",null),t([o()],y.prototype,"attributes",void 0),t([o()],y.prototype,"description",void 0),t([o()],y.prototype,"fieldInfoMap",void 0),t([o()],y.prototype,"formattedAttributes",void 0),t([o()],y.prototype,"expressionAttributes",void 0),t([o({readOnly:!0})],y.prototype,"formattedMediaInfos",null),t([o()],y.prototype,"layer",void 0),t([o({readOnly:!0})],y.prototype,"formattedMediaInfoCount",null),t([o()],y.prototype,"mediaInfos",void 0),t([o()],y.prototype,"popupTemplate",void 0),t([o()],y.prototype,"relatedInfos",void 0),t([o()],y.prototype,"title",void 0),y=t([i("esri.widgets.Feature.FeatureMedia.FeatureMediaViewModel")],y);const I=y;export{I as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{cast as o}from"../../../core/accessorSupport/decorators/cast.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../popup/FieldInfo.js";import s from"../../../popup/content/support/ChartMediaInfoValueSeries.js";import{substituteFieldsInLinksAndAttributes as l,fixTokens as n,substituteAttributes as d,getFixedFieldNames as p,getFixedFieldName as u,isRelatedField as f,formatValueToFieldInfo as c,getFieldInfo as m,getFieldInfoLabel as h}from"../support/featureUtils.js";import{getRelatedFieldInfo as y}from"../support/relatedFeatureUtils.js";const v={chartAnimation:!0};let I=class extends e{constructor(t){super(t),this.abilities={...v},this.activeMediaInfoIndex=0,this.attributes=null,this.description=null,this.fieldInfoMap=null,this.formattedAttributes=null,this.expressionAttributes=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null}castAbilities(t){return{...v,...t}}get activeMediaInfo(){return this.formattedMediaInfos[this.activeMediaInfoIndex]||null}get formattedMediaInfos(){return this._formatMediaInfos()||[]}get formattedMediaInfoCount(){return this.formattedMediaInfos.length}setActiveMedia(t){this._setContentElementMedia(t)}next(){this._pageContentElementMedia(1)}previous(){this._pageContentElementMedia(-1)}_setContentElementMedia(t){const{formattedMediaInfoCount:e}=this,i=(t+e)%e;this.activeMediaInfoIndex=i}_pageContentElementMedia(t){const{activeMediaInfoIndex:e}=this,i=e+t;this._setContentElementMedia(i)}_formatMediaInfos(){const{attributes:t,mediaInfos:e,formattedAttributes:i,expressionAttributes:o,fieldInfoMap:r,layer:a}=this;return null==e?void 0:e.map((e=>{const s=null==e?void 0:e.clone();if(!s)return null;if(s.title=l({attributes:t,fieldInfoMap:r,globalAttributes:i,expressionAttributes:o,layer:a,text:s.title}),s.caption=l({attributes:t,fieldInfoMap:r,globalAttributes:i,expressionAttributes:o,layer:a,text:s.caption}),s.altText=l({attributes:t,fieldInfoMap:r,globalAttributes:i,expressionAttributes:o,layer:a,text:s.altText}),"image"===s.type){const{value:t}=s;return this._setImageValue({value:t,formattedAttributes:i,layer:a}),s.value.sourceURL?s:void 0}if("pie-chart"===s.type||"line-chart"===s.type||"column-chart"===s.type||"bar-chart"===s.type){const{value:e}=s;return this._setChartValue({value:e,chartType:s.type,attributes:t,formattedAttributes:i,layer:a}),s}return null})).filter(Boolean)}_setImageValue(t){const{fieldInfoMap:e}=this,{value:i,formattedAttributes:o,layer:r}=t,{linkURL:a,sourceURL:s}=i;if(s){const t=n(s,r);i.sourceURL=d({formattedAttributes:o,template:t,fieldInfoMap:e})}if(a){const t=n(a,r);i.linkURL=d({formattedAttributes:o,template:t,fieldInfoMap:e})}}_setChartValue(t){const{value:e,attributes:i,formattedAttributes:o,chartType:r,layer:a}=t,{popupTemplate:s,relatedInfos:l}=this,{fields:n,normalizeField:d}=e;e.fields=p(n,a),d&&(e.normalizeField=u(d,a));if(!n.some((t=>!!(null!=o[t]||f(t)&&l.size))))return;const c=null==s?void 0:s.fieldInfos;n.forEach((t=>{if(f(t))return void(e.series=[...e.series,...this._getRelatedChartInfos({fieldInfos:c,fieldName:t,formattedAttributes:o,chartType:r,value:e})]);const a=this._getChartOption({value:e,attributes:i,chartType:r,formattedAttributes:o,fieldName:t,fieldInfos:c});e.series.push(a)}))}_getRelatedChartInfos(t){var e;const{fieldInfos:i,fieldName:o,formattedAttributes:r,chartType:a,value:s}=t,l=[],n=y(o),{layerId:d,fieldName:p}=n,u=null==(e=this.relatedInfos)?void 0:e.get(d.toString());if(!u)return l;const{relatedFeatures:f,relation:c}=u;if(!c||!f)return l;const{cardinality:m}=c;f.forEach((t=>{const{attributes:e}=t;e&&Object.keys(e).forEach((t=>{t===p&&l.push(this._getChartOption({value:s,attributes:e,formattedAttributes:r,fieldName:o,chartType:a,relatedFieldName:t,fieldInfos:i}))}))}));return"one-to-many"===m||"many-to-many"===m?l:[l[0]]}_getTooltip({label:t,value:e,chartType:i}){return"pie-chart"===i?t:`${t}: ${e}`}_getChartOption(t){var e;const{value:i,attributes:o,formattedAttributes:r,fieldName:l,relatedFieldName:n,fieldInfos:d,chartType:p}=t,{layer:v}=this,{normalizeField:I,tooltipField:b}=i,M=I?f(I)?o[y(I).fieldName]:o[I]:null,A=n&&void 0!==o[n]?o[n]:void 0!==o[l]?o[l]:r[l],g=void 0===A?null:A&&M?A/M:A,_=new s({value:g});if(f(l)){const t=y(l),e=y(b),i=e?e.fieldName:null,r=c(g,{fieldInfos:d,fieldName:n,layer:v,preventPlacesFormatting:!!M}),a=t?t.label||t.fieldName:n,s=i&&void 0!==o[i]?o[i]:a;return _.tooltip=this._getTooltip({label:s,value:r,chartType:p}),_}const x=m(d,l),T=u(l,v),C=b&&void 0!==r[b]?r[b]:h(x||new a({fieldName:T}),null==(e=this.popupTemplate)?void 0:e.expressionInfos),F=r[T];return _.tooltip=this._getTooltip({label:C,value:F,chartType:p}),_}};t([i()],I.prototype,"abilities",void 0),t([o("abilities")],I.prototype,"castAbilities",null),t([i()],I.prototype,"activeMediaInfoIndex",void 0),t([i({readOnly:!0})],I.prototype,"activeMediaInfo",null),t([i()],I.prototype,"attributes",void 0),t([i()],I.prototype,"description",void 0),t([i()],I.prototype,"fieldInfoMap",void 0),t([i()],I.prototype,"formattedAttributes",void 0),t([i()],I.prototype,"expressionAttributes",void 0),t([i({readOnly:!0})],I.prototype,"formattedMediaInfos",null),t([i()],I.prototype,"layer",void 0),t([i({readOnly:!0})],I.prototype,"formattedMediaInfoCount",null),t([i()],I.prototype,"mediaInfos",void 0),t([i()],I.prototype,"popupTemplate",void 0),t([i()],I.prototype,"relatedInfos",void 0),t([i()],I.prototype,"title",void 0),I=t([r("esri.widgets.Feature.FeatureMedia.FeatureMediaViewModel")],I);const b=I;export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{eventKey as t}from"../../core/events.js";import{init as i}from"../../core/watchUtils.js";import{aliasOf as r}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import s from"../Widget.js";import n from"./FeatureMedia/FeatureMediaViewModel.js";import l from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as d}from"./support/featureUtils.js";import{loadChartsModule as c,getColorSet as m}from"../support/chartUtils.js";import{isRTL as u}from"../support/widgetUtils.js";import{messageBundle as h}from"../support/decorators/messageBundle.js";import"../../core/Logger.js";import{tsx as p}from"../support/jsxFactory.js";import{isDarkTheme as f}from"../support/widgetThemeUtils.js";const v={base:"esri-feature-media",mediaContainer:"esri-feature-media__container",mediaItemContainer:"esri-feature-media__item-container",mediaItem:"esri-feature-media__item",mediaItemTitle:"esri-feature-media__item-title",mediaItemCaption:"esri-feature-media__item-caption",mediaPrevious:"esri-feature-media__previous",mediaPreviousIconLTR:"esri-feature-media__previous-icon",mediaPreviousIconRTL:"esri-feature-media__previous-icon--rtl",mediaNext:"esri-feature-media__next",mediaNextIconLTR:"esri-feature-media__next-icon",mediaNextIconRTL:"esri-feature-media__next-icon--rtl",mediaChart:"esri-feature-media__chart",mediaButton:"esri-feature-media__button",mediaIcon:"esri-feature-media__icon",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconRightTriangleArrow:"esri-icon-right-triangle-arrow"},_=.05,I=.95,M=15;let w=class extends s{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this.attributes=null,this.activeMediaInfoIndex=null,this.description=null,this.fieldInfoMap=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null,this.viewModel=new n,this.messages=null,this._getChartDependencies=async e=>{const t=await c(),{destroyed:i,viewModel:r}=this;if(i||!r||!e)return;const{activeMediaInfo:a}=r;this._renderChart({chartDiv:e,mediaInfo:a,chartsModule:t})}}initialize(){this._featureElementInfo=new l,this.own(i(this,["viewModel.activeMediaInfo","viewModel.activeMediaInfoIndex"],(()=>this._setupMediaRefreshTimer())),i(this,["viewModel.description","viewModel.title"],(()=>this._setupFeatureElementInfo())))}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo.destroy()}render(){var e;return p("div",{bind:this,class:v.base,onkeyup:this._handleMediaKeyup},null==(e=this._featureElementInfo)?void 0:e.render(),this.renderMedia())}renderMedia(){const{formattedMediaInfoCount:e}=this.viewModel;return e?p("div",{key:"media-element-container",class:v.mediaContainer},this.renderMediaPageButton("previous"),this.renderMediaInfo(),this.renderMediaPageButton("next")):null}renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:o,altText:s,title:n,type:l}=e,{sourceURL:c,linkURL:m}=a,u=d(m)?"_blank":"_self",h="_blank"===u?"noreferrer":"",f=o?t:null,v=f?f.timestamp:0,_=f?f.sourceURL:c,I=p("img",{alt:s||n,key:`media-${l}-${i}-${r}-${v}`,src:_}),M=m?p("a",{title:n,href:m,rel:h,target:u},I):null;return M||I}renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return p("div",{key:`media-${e.type}-${t}-${i}`,bind:this,class:v.mediaChart,afterCreate:this._getChartDependencies})}renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this.renderImageMediaInfo(e):-1!==e.type.indexOf("chart")?this.renderChartMediaInfo(e):null:null}renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e.title?p("div",{key:"media-title",class:v.mediaItemTitle,innerHTML:e.title}):null,i=e.caption?p("div",{key:"media-caption",class:v.mediaItemCaption,innerHTML:e.caption}):null;return p("div",{key:"media-container",class:v.mediaItemContainer},p("div",{key:"media-item-container",class:v.mediaItem},this.renderMediaInfoType()),t,i)}renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?this.classes(v.mediaButton,v.mediaPrevious):this.classes(v.mediaButton,v.mediaNext),a=t?this.classes(v.mediaIcon,v.mediaPreviousIconLTR,v.iconLeftTriangleArrow):this.classes(v.mediaIcon,v.mediaNextIconLTR,v.iconRightTriangleArrow),o=t?this.classes(v.mediaIcon,v.mediaPreviousIconRTL,v.iconRightTriangleArrow):this.classes(v.mediaIcon,v.mediaNextIconRTL,v.iconLeftTriangleArrow),s=t?"media-previous":"media-next",n=t?this._previous:this._next;return p("button",{type:"button",key:s,title:i,"aria-label":i,tabIndex:0,class:r,bind:this,onclick:n},p("span",{"aria-hidden":"true",class:a}),p("span",{"aria-hidden":"true",class:o}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_handleMediaKeyup(e){const i=t(e);"ArrowLeft"===i&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===i&&(e.stopPropagation(),this.viewModel.next())}_renderChart(e){const{chartsModule:t,chartDiv:i,mediaInfo:r}=e,{value:a,type:o}=r,{am4core:s}=t,n=m(s);function l(e){e instanceof s.ColorSet&&n&&(e.list=n)}f()&&s.useTheme(t.am4themes_dark),s.useTheme(t.am4themes_animated),s.useTheme(l);const d="pie-chart"===o?this._createPieChart(e):this._createXYChart(e);i.setAttribute("aria-label",r.altText||r.title),d.data=a.series.map((e=>({tooltip:e.tooltip,value:e.value}))).filter((e=>"pie-chart"!==o||e.value>0))}_customizeChartTooltip(e,t){e.label.wrap=!0,e.label.maxWidth=200,e.autoTextColor=!1,e.getFillFromObject=!1,e.label.fill=t.color("#ffffff"),e.background.fill=t.color({r:0,g:0,b:0,a:.7})}_createPieChart(e){const{chartDiv:t,chartsModule:i}=e,{am4core:r,am4charts:a}=i,o=r.create(t,a.PieChart);o.rtl=u(this.container);const s=o.series.push(new a.PieSeries);return s.labels.template.disabled=!0,s.ticks.template.disabled=!0,s.dataFields.value="value",s.dataFields.category="tooltip",this._customizeChartTooltip(s.tooltip,r),o}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}_createColumnChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueY="value",c.dataFields.categoryX="tooltip",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarX=new o.Scrollbar)}_createBarChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.yAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.inversed=!0,n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dx=n.tooltip.contentWidth}));const l=e.xAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueX="value",c.dataFields.categoryY="tooltip",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarY=new o.Scrollbar)}_createLineChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.LineSeries);c.dataFields.categoryX="tooltip",c.dataFields.valueY="value",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarX=new o.Scrollbar)}_createXYChart(e){const{chartDiv:t,chartsModule:i,mediaInfo:r}=e,{type:a}=r,{am4core:o,am4charts:s}=i,n=o.create(t,s.XYChart);return n.rtl=u(this.container),"column-chart"===a&&this._createColumnChart(n,e),"bar-chart"===a&&this._createBarChart(n,e),"line-chart"===a&&this._createLineChart(n,e),n}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:this._getImageSource(e,t)},this.scheduleRender()}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&"image"===e.type&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e;if(!t)return;const r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=-1!==e.indexOf("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([r("viewModel.attributes")],w.prototype,"attributes",void 0),e([r("viewModel.activeMediaInfoIndex")],w.prototype,"activeMediaInfoIndex",void 0),e([r("viewModel.description")],w.prototype,"description",void 0),e([r("viewModel.fieldInfoMap")],w.prototype,"fieldInfoMap",void 0),e([r("viewModel.layer")],w.prototype,"layer",void 0),e([r("viewModel.mediaInfos")],w.prototype,"mediaInfos",void 0),e([r("viewModel.popupTemplate")],w.prototype,"popupTemplate",void 0),e([r("viewModel.relatedInfos")],w.prototype,"relatedInfos",void 0),e([r("viewModel.title")],w.prototype,"title",void 0),e([a({type:n})],w.prototype,"viewModel",void 0),e([a(),h("esri/widgets/Feature/t9n/Feature")],w.prototype,"messages",void 0),w=e([o("esri.widgets.Feature.FeatureMedia")],w);const g=w;export{g as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{eventKey as t}from"../../core/events.js";import{init as i}from"../../core/watchUtils.js";import{aliasOf as r}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import s from"../Widget.js";import n from"./FeatureMedia/FeatureMediaViewModel.js";import l from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as d}from"./support/featureUtils.js";import{loadChartsModule as c,getColorSet as m}from"../support/chartUtils.js";import{isRTL as u}from"../support/widgetUtils.js";import{messageBundle as h}from"../support/decorators/messageBundle.js";import"../../core/Logger.js";import{tsx as p}from"../support/jsxFactory.js";import{isDarkTheme as f}from"../support/widgetThemeUtils.js";const v={base:"esri-feature-media",mediaContainer:"esri-feature-media__container",mediaItemContainer:"esri-feature-media__item-container",mediaItem:"esri-feature-media__item",mediaItemTitle:"esri-feature-media__item-title",mediaItemCaption:"esri-feature-media__item-caption",mediaPrevious:"esri-feature-media__previous",mediaPreviousIconLTR:"esri-feature-media__previous-icon",mediaPreviousIconRTL:"esri-feature-media__previous-icon--rtl",mediaNext:"esri-feature-media__next",mediaNextIconLTR:"esri-feature-media__next-icon",mediaNextIconRTL:"esri-feature-media__next-icon--rtl",mediaChart:"esri-feature-media__chart",mediaButton:"esri-feature-media__button",mediaIcon:"esri-feature-media__icon",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconRightTriangleArrow:"esri-icon-right-triangle-arrow"},_=.05,I=.95,M=15;let w=class extends s{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this.attributes=null,this.activeMediaInfoIndex=null,this.description=null,this.fieldInfoMap=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null,this.viewModel=new n,this.messages=null,this._getChartDependencies=async e=>{const t=await c(),{destroyed:i,viewModel:r}=this;if(i||!r||!e)return;const{activeMediaInfo:a}=r;this._renderChart({chartDiv:e,mediaInfo:a,chartsModule:t})}}initialize(){this._featureElementInfo=new l,this.own(i(this,["viewModel.activeMediaInfo","viewModel.activeMediaInfoIndex"],(()=>this._setupMediaRefreshTimer())),i(this,["viewModel.description","viewModel.title"],(()=>this._setupFeatureElementInfo())))}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo.destroy()}render(){var e;return p("div",{bind:this,class:v.base,onkeyup:this._handleMediaKeyup},null==(e=this._featureElementInfo)?void 0:e.render(),this.renderMedia())}renderMedia(){const{formattedMediaInfoCount:e}=this.viewModel;return e?p("div",{key:"media-element-container",class:v.mediaContainer},this.renderMediaPageButton("previous"),this.renderMediaInfo(),this.renderMediaPageButton("next")):null}renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:o,altText:s,title:n,type:l}=e,{sourceURL:c,linkURL:m}=a,u=d(m)?"_blank":"_self",h="_blank"===u?"noreferrer":"",f=o?t:null,v=f?f.timestamp:0,_=f?f.sourceURL:c,I=p("img",{alt:s||n,key:`media-${l}-${i}-${r}-${v}`,src:_}),M=m?p("a",{title:n,href:m,rel:h,target:u},I):null;return M||I}renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return p("div",{key:`media-${e.type}-${t}-${i}`,bind:this,class:v.mediaChart,afterCreate:this._getChartDependencies})}renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this.renderImageMediaInfo(e):-1!==e.type.indexOf("chart")?this.renderChartMediaInfo(e):null:null}renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e.title?p("div",{key:"media-title",class:v.mediaItemTitle,innerHTML:e.title}):null,i=e.caption?p("div",{key:"media-caption",class:v.mediaItemCaption,innerHTML:e.caption}):null;return p("div",{key:"media-container",class:v.mediaItemContainer},p("div",{key:"media-item-container",class:v.mediaItem},this.renderMediaInfoType()),t,i)}renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?this.classes(v.mediaButton,v.mediaPrevious):this.classes(v.mediaButton,v.mediaNext),a=t?this.classes(v.mediaIcon,v.mediaPreviousIconLTR,v.iconLeftTriangleArrow):this.classes(v.mediaIcon,v.mediaNextIconLTR,v.iconRightTriangleArrow),o=t?this.classes(v.mediaIcon,v.mediaPreviousIconRTL,v.iconRightTriangleArrow):this.classes(v.mediaIcon,v.mediaNextIconRTL,v.iconLeftTriangleArrow),s=t?"media-previous":"media-next",n=t?this._previous:this._next;return p("button",{type:"button",key:s,title:i,"aria-label":i,tabIndex:0,class:r,bind:this,onclick:n},p("span",{"aria-hidden":"true",class:a}),p("span",{"aria-hidden":"true",class:o}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_handleMediaKeyup(e){const i=t(e);"ArrowLeft"===i&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===i&&(e.stopPropagation(),this.viewModel.next())}_renderChart(e){const{abilities:t}=this.viewModel,{chartsModule:i,chartDiv:r,mediaInfo:a}=e,{value:o,type:s}=a,{am4core:n}=i,l=m(n);function d(e){e instanceof n.ColorSet&&l&&(e.list=l)}f()&&n.useTheme(i.am4themes_dark);const c=window.matchMedia("(prefers-reduced-motion: reduce)");t.chartAnimation&&!c.matches?n.useTheme(i.am4themes_animated):n.unuseTheme(i.am4themes_animated),n.useTheme(d);const u="pie-chart"===s?this._createPieChart(e):this._createXYChart(e);r.setAttribute("aria-label",a.altText||a.title),u.data=o.series.map((e=>({tooltip:e.tooltip,value:e.value}))).filter((e=>"pie-chart"!==s||e.value>0))}_customizeChartTooltip(e,t){e.label.wrap=!0,e.label.maxWidth=200,e.autoTextColor=!1,e.getFillFromObject=!1,e.label.fill=t.color("#ffffff"),e.background.fill=t.color({r:0,g:0,b:0,a:.7})}_createPieChart(e){const{chartDiv:t,chartsModule:i}=e,{am4core:r,am4charts:a}=i,o=r.create(t,a.PieChart);o.rtl=u(this.container);const s=o.series.push(new a.PieSeries);return s.labels.template.disabled=!0,s.ticks.template.disabled=!0,s.dataFields.value="value",s.dataFields.category="tooltip",this._customizeChartTooltip(s.tooltip,r),o}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}_createColumnChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueY="value",c.dataFields.categoryX="tooltip",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarX=new o.Scrollbar)}_createBarChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.yAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.inversed=!0,n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dx=n.tooltip.contentWidth}));const l=e.xAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueX="value",c.dataFields.categoryY="tooltip",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarY=new o.Scrollbar)}_createLineChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.LineSeries);c.dataFields.categoryX="tooltip",c.dataFields.valueY="value",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarX=new o.Scrollbar)}_createXYChart(e){const{chartDiv:t,chartsModule:i,mediaInfo:r}=e,{type:a}=r,{am4core:o,am4charts:s}=i,n=o.create(t,s.XYChart);return n.rtl=u(this.container),"column-chart"===a&&this._createColumnChart(n,e),"bar-chart"===a&&this._createBarChart(n,e),"line-chart"===a&&this._createLineChart(n,e),n}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:this._getImageSource(e,t)},this.scheduleRender()}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&"image"===e.type&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e;if(!t)return;const r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=-1!==e.indexOf("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([r("viewModel.attributes")],w.prototype,"attributes",void 0),e([r("viewModel.activeMediaInfoIndex")],w.prototype,"activeMediaInfoIndex",void 0),e([r("viewModel.description")],w.prototype,"description",void 0),e([r("viewModel.fieldInfoMap")],w.prototype,"fieldInfoMap",void 0),e([r("viewModel.layer")],w.prototype,"layer",void 0),e([r("viewModel.mediaInfos")],w.prototype,"mediaInfos",void 0),e([r("viewModel.popupTemplate")],w.prototype,"popupTemplate",void 0),e([r("viewModel.relatedInfos")],w.prototype,"relatedInfos",void 0),e([r("viewModel.title")],w.prototype,"title",void 0),e([a({type:n})],w.prototype,"viewModel",void 0),e([a(),h("esri/widgets/Feature/t9n/Feature")],w.prototype,"messages",void 0),w=e([o("esri.widgets.Feature.FeatureMedia")],w);const g=w;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as r}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import i from"../../core/Accessor.js";import o from"../../core/Handles.js";import s from"../../core/Logger.js";import{isSome as n}from"../../core/maybe.js";import{isAbortError as a,eachAlways as l}from"../../core/promiseUtils.js";import{throttle as p}from"../../core/throttle.js";import{init as c}from"../../core/watchUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as u}from"../../core/accessorSupport/decorators/cast.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../popup/content/TextContent.js";import m from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import _ from"./FeatureContent/FeatureContentViewModel.js";import y from"./FeatureExpression/FeatureExpressionViewModel.js";import b from"./FeatureFields/FeatureFieldsViewModel.js";import g from"./FeatureMedia/FeatureMediaViewModel.js";import{createCompiledExpressions as I}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as A,preRequestCallback as v,createfieldInfoMap as M,getAllFieldInfos as x,getSourceLayer as w,substituteFieldsInLinksAndAttributes as C,isExpressionField as F,isRelatedField as E,formatEditInfo as T,graphicCallback as V,queryUpdatedFeature as P,formatAttributes as j}from"./support/featureUtils.js";import{queryLayerInfos as L,queryRelatedFeatures as R,setRelatedFeatures as O,getRelatedFieldInfo as S,createRelatedInfo as k,updateRelatedInfo as U}from"./support/relatedFeatureUtils.js";var N;const q=1,D="content-view-models",Q="esri.widgets.FeatureViewModel",B=s.getLogger(Q),G={attachmentsContent:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0};let H=N=class extends i{constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this.graphicChangedThrottled=p(this._graphicChanged,q,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...G},this.content=null,this.contentViewModels=[],this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&t.attachmentsContent||"custom"===e.type&&t.customContent||"fields"===e.type&&t.fieldsContent||"media"===e.type&&t.mediaContent||"text"===e.type&&t.textContent||"expression"===e.type&&t.expressionContent},this._handles.add(c(this,["graphic","_effectivePopupTemplate","abilities"],(()=>this.graphicChangedThrottled())))}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this._handles=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return n(this.graphic)?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return M(x(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return w(this.graphic)}castAbilities(e){return{...G,...e}}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.get("view.spatialReference")||null}set spatialReference(e){void 0!==e?this._override("spatialReference",e):this._clearOverride("spatialReference")}get map(){return this.get("view.map")||null}set map(e){void 0!==e?this._override("map",e):this._clearOverride("map")}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const r=this.contentViewModels[e];r instanceof g&&r.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.previous()}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(r){a(r)||(this._error=r,B.error("error","The popupTemplate could not be displayed for this feature.",{error:r,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))):"string"==typeof e?this._compileText(new h({text:e}),0).text:e}_destroyContentViewModels(){var e;null==(e=this._handles)||e.remove(D),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_setExpressionContentVM(e,t){const{formattedAttributes:r}=this,{contentElement:i,contentElementViewModel:o}=e,s=null==i?void 0:i.type;o&&s&&("fields"===s&&(this._createFieldsFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),o.set(this._createFieldsVMParams(i,t))),"media"===s&&(this._createMediaFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),o.set(this._createMediaVMParams(i,t))),"text"===s&&o.set(this._createTextVMParams(i)))}_compileExpression(e,t){const{expressionInfo:r}=e,{graphic:i,map:o,spatialReference:s,view:n}=this,a=new y({expressionInfo:r,graphic:i,interceptor:N.interceptor,map:o,spatialReference:s,view:n});return this.contentViewModels[t]=a,this._handles.add(c(a,"contentElementViewModel",(()=>this._setExpressionContentVM(a,t))),D),e}_compileAttachments(e,t){const{graphic:r}=this,{description:i,title:o}=e;return this.contentViewModels[t]=new m({graphic:r,...this._compileTitleAndDesc({title:o,description:i})}),e}_compileCustom(e,t){const{graphic:r}=this,{creator:i,destroyer:o}=e;return this.contentViewModels[t]=new _({graphic:r,creator:i,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:r,_sourceLayer:i,graphic:o,formattedAttributes:s,_expressionAttributes:n}=this,{attributes:a}=o,l=s.global;return{title:C({attributes:a,fieldInfoMap:r,globalAttributes:l,expressionAttributes:n,layer:i,text:e}),description:C({attributes:a,fieldInfoMap:r,globalAttributes:l,expressionAttributes:n,layer:i,text:t})}}_createFieldsVMParams(e,t){const{_effectivePopupTemplate:r,formattedAttributes:i}=this,o={...i.global,...i.content[t]},s=(null==e?void 0:e.fieldInfos)||(null==r?void 0:r.fieldInfos),n=null==s?void 0:s.filter((({fieldName:e})=>F(e)||E(e)||o.hasOwnProperty(e))),a=null==r?void 0:r.expressionInfos,{description:l,title:p}=e;return{attributes:o,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const r=e.clone(),i=new b(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=i,r.fieldInfos=i.formattedFieldInfos.slice(0),r}_createMediaVMParams(e,t){const{graphic:r,_fieldInfoMap:i,formattedAttributes:o,_effectivePopupTemplate:s,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,{attributes:p}=r,{description:c,mediaInfos:d,title:u}=e;return{activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:p,layer:a,fieldInfoMap:i,formattedAttributes:{...o.global,...o.content[t]},expressionAttributes:l,mediaInfos:d,popupTemplate:s,relatedInfos:n,...this._compileTitleAndDesc({title:u,description:c})}}_compileMedia(e,t){const r=e.clone(),i=new g(this._createMediaVMParams(e,t));return r.mediaInfos=i.formattedMediaInfos.slice(0),this.contentViewModels[t]=i,r}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:r,_sourceLayer:i,_expressionAttributes:o}=this;if(e&&e.text){const{attributes:s}=t,n=this.formattedAttributes.global;e.text=C({attributes:s,fieldInfoMap:r,globalAttributes:n,expressionAttributes:o,layer:i,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const r=e.clone();return this.contentViewModels[t]=new _(this._createTextVMParams(r)),r}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:r}=this;if(!e)return;const{lastEditInfoEnabled:i}=e,o=null==t?void 0:t.editFieldsInfo;return i&&o?T(o,r.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:r,graphic:i,_expressionAttributes:o}=this,{attributes:s}=i,n=this.formattedAttributes.global;return C({attributes:s,fieldInfoMap:t,globalAttributes:n,expressionAttributes:o,layer:r,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.title;return V(r,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.content;return V(r,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:r,graphic:i,_effectivePopupTemplate:o,spatialReference:s,map:n,view:a}=this,{content:{value:p},title:{value:c}}=await l({content:this._getContent(),title:this._getTitle()});if(t!==this._featureAbortController||!i)return;await P({graphic:i,popupTemplate:o,layer:r,spatialReference:s},e);const{expressionAttributes:{value:d}}=await l({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:I({expressionInfos:null==o?void 0:o.expressionInfos,spatialReference:s,graphic:i,map:n,interceptor:N.interceptor,view:a})});t===this._featureAbortController&&i&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...i.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(p)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){const{_effectivePopupTemplate:i,graphic:o,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;r.content[t]=j({fieldInfos:null==i?void 0:i.fieldInfos,graphic:o,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:s})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){if(e.fieldInfos){const{graphic:i,relatedInfos:o,_sourceLayer:s,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;r.content[t]=j({fieldInfos:e.fieldInfos,graphic:i,attributes:{...a,...e.attributes},layer:s,fieldInfoMap:n,relatedInfos:o})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:r,relatedInfos:i,_sourceLayer:o,_fieldInfoMap:s,_graphicExpressionAttributes:n}=this,a=null==t?void 0:t.fieldInfos,l={global:j({fieldInfos:a,graphic:r,attributes:n,layer:o,fieldInfoMap:s,relatedInfos:i}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:r}=this;return this._queryRelatedInfos(t,x(r),e)}async _queryRelatedInfos(e,t,r){const{relatedInfos:i,_sourceLayer:o}=this;i.clear();const s=n(o.associatedLayer)?await o.associatedLayer.load(r):o;if(!s)return;const a=t.filter((e=>e&&E(e.fieldName)));if(!a||!a.length)return;t.forEach((e=>this._configureRelatedInfo(e,s)));const l=await L({relatedInfos:i,layer:s},r);Object.keys(l).forEach((e=>{var t;const r=i.get(e.toString()),o=null==(t=l[e])?void 0:t.value;r&&o&&(r.layerInfo=o.data)}));const p=await R({graphic:e,relatedInfos:i,layer:s},r);Object.keys(p).forEach((e=>{var t;O(null==(t=p[e])?void 0:t.value,i.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:r}=this,i=S(e.fieldName);if(!i)return;const{layerId:o,fieldName:s}=i;if(!o)return;const n=r.get(o.toString())||k(o,t);n&&(U({relatedInfo:n,fieldName:s,fieldInfo:e}),this.relatedInfos.set(o,n))}};H.interceptor=new r(A,v),e([d()],H.prototype,"_error",void 0),e([d()],H.prototype,"_featureAbortController",void 0),e([d({readOnly:!0})],H.prototype,"_effectivePopupTemplate",null),e([d({readOnly:!0})],H.prototype,"_fieldInfoMap",null),e([d({readOnly:!0})],H.prototype,"_sourceLayer",null),e([d()],H.prototype,"abilities",void 0),e([u("abilities")],H.prototype,"castAbilities",null),e([d({readOnly:!0})],H.prototype,"content",void 0),e([d({readOnly:!0})],H.prototype,"contentViewModels",void 0),e([d({type:Boolean})],H.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],H.prototype,"state",null),e([d({readOnly:!0})],H.prototype,"formattedAttributes",void 0),e([d({type:t,value:null})],H.prototype,"graphic",null),e([d({readOnly:!0})],H.prototype,"lastEditInfo",void 0),e([d({readOnly:!0})],H.prototype,"relatedInfos",void 0),e([d()],H.prototype,"spatialReference",null),e([d({readOnly:!0})],H.prototype,"title",void 0),e([d()],H.prototype,"map",null),e([d({readOnly:!0})],H.prototype,"waitingForContent",null),e([d()],H.prototype,"view",void 0),H=N=e([f(Q)],H);const z=H;export{z as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as r}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import i from"../../core/Accessor.js";import o from"../../core/Handles.js";import s from"../../core/Logger.js";import{isSome as n}from"../../core/maybe.js";import{isAbortError as a,eachAlways as l}from"../../core/promiseUtils.js";import{throttle as p}from"../../core/throttle.js";import{init as c}from"../../core/watchUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as u}from"../../core/accessorSupport/decorators/cast.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../popup/content/TextContent.js";import m from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import _ from"./FeatureContent/FeatureContentViewModel.js";import y from"./FeatureExpression/FeatureExpressionViewModel.js";import b from"./FeatureFields/FeatureFieldsViewModel.js";import g from"./FeatureMedia/FeatureMediaViewModel.js";import{createCompiledExpressions as A}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as I,preRequestCallback as v,createfieldInfoMap as M,getAllFieldInfos as x,getSourceLayer as w,substituteFieldsInLinksAndAttributes as C,isExpressionField as F,isRelatedField as E,formatEditInfo as T,graphicCallback as V,queryUpdatedFeature as P,formatAttributes as j}from"./support/featureUtils.js";import{queryLayerInfos as L,queryRelatedFeatures as R,setRelatedFeatures as O,getRelatedFieldInfo as S,createRelatedInfo as k,updateRelatedInfo as U}from"./support/relatedFeatureUtils.js";var N;const q=1,D="content-view-models",Q="esri.widgets.FeatureViewModel",B=s.getLogger(Q),G={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0};let H=N=class extends i{constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this.graphicChangedThrottled=p(this._graphicChanged,q,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...G},this.content=null,this.contentViewModels=[],this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&t.attachmentsContent||"custom"===e.type&&t.customContent||"fields"===e.type&&t.fieldsContent||"media"===e.type&&t.mediaContent||"text"===e.type&&t.textContent||"expression"===e.type&&t.expressionContent},this._handles.add(c(this,["graphic","_effectivePopupTemplate","abilities"],(()=>this.graphicChangedThrottled())))}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this._handles=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return n(this.graphic)?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return M(x(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return w(this.graphic)}castAbilities(e){return{...G,...e}}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.get("view.spatialReference")||null}set spatialReference(e){void 0!==e?this._override("spatialReference",e):this._clearOverride("spatialReference")}get map(){return this.get("view.map")||null}set map(e){void 0!==e?this._override("map",e):this._clearOverride("map")}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const r=this.contentViewModels[e];r instanceof g&&r.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.previous()}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(r){a(r)||(this._error=r,B.error("error","The popupTemplate could not be displayed for this feature.",{error:r,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))):"string"==typeof e?this._compileText(new h({text:e}),0).text:e}_destroyContentViewModels(){var e;null==(e=this._handles)||e.remove(D),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_setExpressionContentVM(e,t){const{formattedAttributes:r}=this,{contentElement:i,contentElementViewModel:o}=e,s=null==i?void 0:i.type;o&&s&&("fields"===s&&(this._createFieldsFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),o.set(this._createFieldsVMParams(i,t))),"media"===s&&(this._createMediaFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),o.set(this._createMediaVMParams(i,t))),"text"===s&&o.set(this._createTextVMParams(i)))}_compileExpression(e,t){const{expressionInfo:r}=e,{graphic:i,map:o,spatialReference:s,view:n}=this,a=new y({expressionInfo:r,graphic:i,interceptor:N.interceptor,map:o,spatialReference:s,view:n});return this.contentViewModels[t]=a,this._handles.add(c(a,"contentElementViewModel",(()=>this._setExpressionContentVM(a,t))),D),e}_compileAttachments(e,t){const{graphic:r}=this,{description:i,title:o}=e;return this.contentViewModels[t]=new m({graphic:r,...this._compileTitleAndDesc({title:o,description:i})}),e}_compileCustom(e,t){const{graphic:r}=this,{creator:i,destroyer:o}=e;return this.contentViewModels[t]=new _({graphic:r,creator:i,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:r,_sourceLayer:i,graphic:o,formattedAttributes:s,_expressionAttributes:n}=this,{attributes:a}=o,l=s.global;return{title:C({attributes:a,fieldInfoMap:r,globalAttributes:l,expressionAttributes:n,layer:i,text:e}),description:C({attributes:a,fieldInfoMap:r,globalAttributes:l,expressionAttributes:n,layer:i,text:t})}}_createFieldsVMParams(e,t){const{_effectivePopupTemplate:r,formattedAttributes:i}=this,o={...i.global,...i.content[t]},s=(null==e?void 0:e.fieldInfos)||(null==r?void 0:r.fieldInfos),n=null==s?void 0:s.filter((({fieldName:e})=>F(e)||E(e)||o.hasOwnProperty(e))),a=null==r?void 0:r.expressionInfos,{description:l,title:p}=e;return{attributes:o,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const r=e.clone(),i=new b(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=i,r.fieldInfos=i.formattedFieldInfos.slice(0),r}_createMediaVMParams(e,t){const{abilities:r,graphic:i,_fieldInfoMap:o,formattedAttributes:s,_effectivePopupTemplate:n,relatedInfos:a,_sourceLayer:l,_expressionAttributes:p}=this,{attributes:c}=i,{description:d,mediaInfos:u,title:f}=e;return{abilities:{chartAnimation:r.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,layer:l,fieldInfoMap:o,formattedAttributes:{...s.global,...s.content[t]},expressionAttributes:p,mediaInfos:u,popupTemplate:n,relatedInfos:a,...this._compileTitleAndDesc({title:f,description:d})}}_compileMedia(e,t){const r=e.clone(),i=new g(this._createMediaVMParams(e,t));return r.mediaInfos=i.formattedMediaInfos.slice(0),this.contentViewModels[t]=i,r}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:r,_sourceLayer:i,_expressionAttributes:o}=this;if(e&&e.text){const{attributes:s}=t,n=this.formattedAttributes.global;e.text=C({attributes:s,fieldInfoMap:r,globalAttributes:n,expressionAttributes:o,layer:i,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const r=e.clone();return this.contentViewModels[t]=new _(this._createTextVMParams(r)),r}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:r}=this;if(!e)return;const{lastEditInfoEnabled:i}=e,o=null==t?void 0:t.editFieldsInfo;return i&&o?T(o,r.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:r,graphic:i,_expressionAttributes:o}=this,{attributes:s}=i,n=this.formattedAttributes.global;return C({attributes:s,fieldInfoMap:t,globalAttributes:n,expressionAttributes:o,layer:r,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.title;return V(r,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.content;return V(r,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:r,graphic:i,_effectivePopupTemplate:o,spatialReference:s,map:n,view:a}=this,{content:{value:p},title:{value:c}}=await l({content:this._getContent(),title:this._getTitle()});if(t!==this._featureAbortController||!i)return;await P({graphic:i,popupTemplate:o,layer:r,spatialReference:s},e);const{expressionAttributes:{value:d}}=await l({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:A({expressionInfos:null==o?void 0:o.expressionInfos,spatialReference:s,graphic:i,map:n,interceptor:N.interceptor,view:a})});t===this._featureAbortController&&i&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...i.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(p)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){const{_effectivePopupTemplate:i,graphic:o,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;r.content[t]=j({fieldInfos:null==i?void 0:i.fieldInfos,graphic:o,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:s})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){if(e.fieldInfos){const{graphic:i,relatedInfos:o,_sourceLayer:s,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;r.content[t]=j({fieldInfos:e.fieldInfos,graphic:i,attributes:{...a,...e.attributes},layer:s,fieldInfoMap:n,relatedInfos:o})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:r,relatedInfos:i,_sourceLayer:o,_fieldInfoMap:s,_graphicExpressionAttributes:n}=this,a=null==t?void 0:t.fieldInfos,l={global:j({fieldInfos:a,graphic:r,attributes:n,layer:o,fieldInfoMap:s,relatedInfos:i}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:r}=this;return this._queryRelatedInfos(t,x(r),e)}async _queryRelatedInfos(e,t,r){const{relatedInfos:i,_sourceLayer:o}=this;i.clear();const s=n(o.associatedLayer)?await o.associatedLayer.load(r):o;if(!s)return;const a=t.filter((e=>e&&E(e.fieldName)));if(!a||!a.length)return;t.forEach((e=>this._configureRelatedInfo(e,s)));const l=await L({relatedInfos:i,layer:s},r);Object.keys(l).forEach((e=>{var t;const r=i.get(e.toString()),o=null==(t=l[e])?void 0:t.value;r&&o&&(r.layerInfo=o.data)}));const p=await R({graphic:e,relatedInfos:i,layer:s},r);Object.keys(p).forEach((e=>{var t;O(null==(t=p[e])?void 0:t.value,i.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:r}=this,i=S(e.fieldName);if(!i)return;const{layerId:o,fieldName:s}=i;if(!o)return;const n=r.get(o.toString())||k(o,t);n&&(U({relatedInfo:n,fieldName:s,fieldInfo:e}),this.relatedInfos.set(o,n))}};H.interceptor=new r(I,v),e([d()],H.prototype,"_error",void 0),e([d()],H.prototype,"_featureAbortController",void 0),e([d({readOnly:!0})],H.prototype,"_effectivePopupTemplate",null),e([d({readOnly:!0})],H.prototype,"_fieldInfoMap",null),e([d({readOnly:!0})],H.prototype,"_sourceLayer",null),e([d()],H.prototype,"abilities",void 0),e([u("abilities")],H.prototype,"castAbilities",null),e([d({readOnly:!0})],H.prototype,"content",void 0),e([d({readOnly:!0})],H.prototype,"contentViewModels",void 0),e([d({type:Boolean})],H.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],H.prototype,"state",null),e([d({readOnly:!0})],H.prototype,"formattedAttributes",void 0),e([d({type:t,value:null})],H.prototype,"graphic",null),e([d({readOnly:!0})],H.prototype,"lastEditInfo",void 0),e([d({readOnly:!0})],H.prototype,"relatedInfos",void 0),e([d()],H.prototype,"spatialReference",null),e([d({readOnly:!0})],H.prototype,"title",void 0),e([d()],H.prototype,"map",null),e([d({readOnly:!0})],H.prototype,"waitingForContent",null),e([d()],H.prototype,"view",void 0),H=N=e([f(Q)],H);const z=H;export{z as default};