@arcgis/core 4.32.0-next.20250212 → 4.32.0-next.20250213

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 (136) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/04f9fb33fb2e33712290.js +1 -0
  3. package/assets/esri/core/workers/chunks/1a6b6d43eda7986d2349.js +1 -0
  4. package/assets/esri/core/workers/chunks/{12d6baeffd55a98a7c75.js → 1bf646c9fc352f98d1ca.js} +1 -1
  5. package/assets/esri/core/workers/chunks/1c357cdb067e28aff3f0.js +1 -0
  6. package/assets/esri/core/workers/chunks/{00780271be2fd6e298c1.js → 24964548c6a3e2eb527d.js} +1 -1
  7. package/assets/esri/core/workers/chunks/31f0dd191602b93c02c2.js +1 -0
  8. package/assets/esri/core/workers/chunks/{f429d95eb986f3d215f3.js → 391c200274bbeb92404c.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{c0af54cc5938176ce764.js → 3fe7be535affae31de7e.js} +1 -1
  10. package/assets/esri/core/workers/chunks/401b731c0601f4d84ead.js +1 -0
  11. package/assets/esri/core/workers/chunks/4565cfc85f60960e3ea1.js +1 -0
  12. package/assets/esri/core/workers/chunks/4a4739cda8aac510004b.js +1 -0
  13. package/assets/esri/core/workers/chunks/{d0656e9d30eb3a66a8db.js → 4be39bc2d2edd94bdb75.js} +1 -1
  14. package/assets/esri/core/workers/chunks/5328b2de0d1ac2536ecf.js +1 -0
  15. package/assets/esri/core/workers/chunks/{62a1d60ad4bf6469c4dd.js → 584216b52413cf85fecc.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{8191dd3d7451b2e7b95e.js → 637e996209e0d241fbf7.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{77bfd4f819096cb754ae.js → 6e92569a4a82592b95dc.js} +1 -1
  18. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +1 -0
  19. package/assets/esri/core/workers/chunks/744bdf2bb0cc38e6a7b1.js +1 -0
  20. package/assets/esri/core/workers/chunks/802a390c67f4cdf3d8d9.js +1 -0
  21. package/assets/esri/core/workers/chunks/{6c30a25adf22d73d4977.js → 86f3a004addc087ad6c6.js} +1 -1
  22. package/assets/esri/core/workers/chunks/9306bfe7ab58e71b75ea.js +1 -0
  23. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +1 -0
  24. package/assets/esri/core/workers/chunks/a01213d446be33d203e3.js +1 -0
  25. package/assets/esri/core/workers/chunks/a490a988896b0b02f96b.js +1 -0
  26. package/assets/esri/core/workers/chunks/a60db83cabdf689b923b.js +1 -0
  27. package/assets/esri/core/workers/chunks/{b9d9a1dc3c5d799e2685.js → bd3487b587851b20ff2a.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{94490937dca566fe2640.js → bd5e0a11d2a688a65d23.js} +1 -1
  29. package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +1 -0
  30. package/assets/esri/core/workers/chunks/c9aed9a43d9935e7c768.js +314 -0
  31. package/assets/esri/core/workers/chunks/{8d8f5f08d730270e1165.js → cb9a27176bd5de2c34ca.js} +1 -1
  32. package/assets/esri/core/workers/chunks/ceb648604a4b6d316f4b.js +1 -0
  33. package/assets/esri/core/workers/chunks/d31e25a63f967fedb149.js +1 -0
  34. package/assets/esri/core/workers/chunks/{da1157e288dbc6ba842a.js → d3d0c7624eb139994213.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{f198f4ba7d3d52882d98.js → de8044dfab4ad253b126.js} +1 -1
  36. package/assets/esri/core/workers/chunks/ecd66dbc4ff446c64984.js +1 -0
  37. package/assets/esri/core/workers/chunks/f78b63620386b2676f1f.js +1 -0
  38. package/assets/esri/core/workers/chunks/fca056536e46aeb98e98.js +1 -0
  39. package/assets/esri/themes/base/widgets/_Directions.scss +30 -9
  40. package/assets/esri/themes/dark/main.css +1 -1
  41. package/assets/esri/themes/light/main.css +1 -1
  42. package/assets/esri/themes/light/view.css +1 -1
  43. package/chunks/ComponentShader.glsl.js +6 -6
  44. package/core/deprecate.js +1 -1
  45. package/interfaces.d.ts +525 -55
  46. package/layers/FeatureLayer.js +1 -1
  47. package/layers/GeoJSONLayer.js +1 -1
  48. package/layers/OGCFeatureLayer.js +1 -1
  49. package/layers/RouteLayer.js +1 -1
  50. package/layers/SubtypeGroupLayer.js +1 -1
  51. package/layers/WFSLayer.js +1 -1
  52. package/layers/graphics/data/queryUtils.js +1 -1
  53. package/layers/mixins/TrackableLayer.d.ts +4 -0
  54. package/layers/support/SubtypeSublayer.js +1 -1
  55. package/layers/support/TitleCreator.js +5 -0
  56. package/layers/support/TrackInfo.d.ts +4 -0
  57. package/layers/support/TrackPartInfo.d.ts +4 -0
  58. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  59. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  60. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  61. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  62. package/networks/UtilityNetwork.js +1 -1
  63. package/networks/support/networkFieldUtils.js +5 -0
  64. package/package.json +1 -1
  65. package/rest/query/executeForIds.js +1 -1
  66. package/rest/support/BinParametersBase.js +1 -1
  67. package/support/revision.js +1 -1
  68. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  69. package/symbols/cim/rasterizingUtils.js +1 -1
  70. package/symbols/support/previewCIMSymbol.js +1 -1
  71. package/symbols/support/previewSymbol2D.js +1 -1
  72. package/symbols/support/symbolUtils.js +1 -1
  73. package/views/2d/layers/RouteLayerView2D.js +1 -1
  74. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  75. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  76. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  77. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  78. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  79. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  80. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  81. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  82. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  83. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  84. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  85. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  86. package/views/View.js +1 -1
  87. package/views/layers/FeatureLayerView.js +1 -1
  88. package/views/support/RequiredFieldsOptions.js +5 -0
  89. package/widgets/BasemapGallery.js +1 -1
  90. package/widgets/BasemapToggle.js +1 -1
  91. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  92. package/widgets/Compass/CompassViewModel.js +1 -1
  93. package/widgets/DirectionalPad.js +1 -1
  94. package/widgets/Directions/DirectionsViewModel.js +1 -1
  95. package/widgets/Directions.js +1 -1
  96. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  97. package/widgets/Editor.js +1 -1
  98. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  99. package/widgets/Fullscreen.js +1 -1
  100. package/widgets/Home.js +1 -1
  101. package/widgets/Legend/LegendViewModel.js +1 -1
  102. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  103. package/widgets/Legend.js +1 -1
  104. package/widgets/Locate.js +1 -1
  105. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  106. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  107. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  108. package/widgets/ScaleBar.js +1 -1
  109. package/widgets/Swipe.js +1 -1
  110. package/widgets/Track.js +1 -1
  111. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  112. package/widgets/UtilityNetworkTrace.js +1 -1
  113. package/widgets/support/GoTo.js +1 -1
  114. package/widgets/support/goToUtils.js +5 -0
  115. package/assets/esri/core/workers/chunks/01c3507d78398baaf61b.js +0 -1
  116. package/assets/esri/core/workers/chunks/177d4c2c10ef7369006f.js +0 -1
  117. package/assets/esri/core/workers/chunks/26a2bd432e7a1b3870c3.js +0 -1
  118. package/assets/esri/core/workers/chunks/44abd2cd17aae3299ede.js +0 -1
  119. package/assets/esri/core/workers/chunks/594d923400fd74881833.js +0 -1
  120. package/assets/esri/core/workers/chunks/61795bde00f2e16d04f1.js +0 -1
  121. package/assets/esri/core/workers/chunks/7058001bf66f9f3d5d45.js +0 -1
  122. package/assets/esri/core/workers/chunks/746c964cf07e4306f21f.js +0 -1
  123. package/assets/esri/core/workers/chunks/7bf08823f861628144a1.js +0 -1
  124. package/assets/esri/core/workers/chunks/8c32cee395da0a7b9a8e.js +0 -1
  125. package/assets/esri/core/workers/chunks/91384398f01485631f70.js +0 -1
  126. package/assets/esri/core/workers/chunks/946a9890f3621d1dfbc5.js +0 -1
  127. package/assets/esri/core/workers/chunks/a2409d4921c02614169a.js +0 -1
  128. package/assets/esri/core/workers/chunks/af917f69d9c6e9937263.js +0 -1
  129. package/assets/esri/core/workers/chunks/cc75bbfd779f409943a3.js +0 -1
  130. package/assets/esri/core/workers/chunks/d339dee99c4820b63f39.js +0 -1
  131. package/assets/esri/core/workers/chunks/d35efcbe439500bf18bc.js +0 -1
  132. package/assets/esri/core/workers/chunks/d44d210e94406509e980.js +0 -314
  133. package/assets/esri/core/workers/chunks/de638753a30c9aa41bad.js +0 -1
  134. package/assets/esri/core/workers/chunks/e5e3b6d00d27b5bb354f.js +0 -1
  135. package/assets/esri/core/workers/chunks/f14b318bab5efcf43419.js +0 -1
  136. package/assets/esri/core/workers/chunks/f29715459ecd46180829.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{p as s,J as a}from"../../../../../../chunks/vec32.js";import{freeze as i,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as h,fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as p}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as d}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as m,IntegratedMeshMode as g}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as x}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as f}from"./shader/VertexDiscardMode.js";import{MaterialBase as v,parameter as b,parameterBlock as M,MaterialParameterBlock as y}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as T}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as w}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as O}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as C}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as S}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as P}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as N}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as D,CullFaceOptions as A}from"../../../lib/basicInterfaces.js";import{OITPass as q}from"../../../lib/OITPass.js";import{advancedMRRFactors as R}from"../../../materials/pbrUtils.js";import{alphaCutoff as F}from"../../../../../../webscene/support/AlphaCutoff.js";class I extends v{constructor(e,s){super(),this.toMapSpace=s,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=R,this.emissiveFactor=i(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new k,this.componentParameters=new L,this.textureAlphaCutoff=F,this.alphaDiscardMode=D.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=N.Earth,this.hasOccludees=!1;const a=new j(e.position),l=o(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=a.low,this.transformWorldFromModelTH=a.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get hasEmissions(){return null!=this.emissionTexture||!s(this.emissiveFactor,l)}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,r,o){const s=new m(e.context.spherical,e.context.doublePrecisionRequiresObfuscation);s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.oitPass=t.identifier===T.Material&&null!=r.oitPass?r.oitPass:q.NONE,s.terrainDepthTest=t.identifier===T.Material&&r.terrainDepthTest,s.cullAboveTerrain=t.identifier===T.Material&&r.cullAboveTerrain,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?S.View:S.None,s.hasColorTexture=null!=this.baseColorTexture;const a=this._computeWhichMaterialPass();if(s.blendingEnabled=a===E.Transparent||a===E.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?_(r)?H(r)?g.ColorOverlayWithWater:g.ColorOverlay:g.NoOverlay:g.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===g.ColorOverlayWithWater?P.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.shadeNormals&&this.isIntegratedMesh?P.Disabled:P.Schematic:P.Normal:P.Disabled,s.emissionSource=null!=this.emissionTexture?C.Texture:s.pbrMode===P.Normal?C.Value:C.None,s.shadeNormals=o.shadeNormals,s.normalType=s.hasNormals?O.Compressed:O.ScreenDerivative,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,t.identifier===T.ShadowMap)s.output=w.Shadow,s.vertexDiscardMode=f.None;else if(t.identifier===T.ViewshedShadowMap)s.output=w.ViewshedShadow,s.vertexDiscardMode=f.None;else if(t.identifier===T.Highlight)s.output=w.Highlight,s.vertexDiscardMode=f.None;else{switch(a===E.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?f.Opaque:f.Transparent:s.vertexDiscardMode=f.None,s.output=t.output,s.receiveAmbientOcclusion=s.receiveShadows=!1,t.output){case w.Color:case w.ColorEmission:s.receiveAmbientOcclusion=o.applySSAO&&null!=r.ssao,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.screenSpaceReflections=null!=r.ssr.lastFrameColor,s.cloudReflections=null!=r.clouds.data;break;case w.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}const i=e.get(c,s);return this._setClean(),i}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}submit(e,t,r){if(0===this.objectOpacity)return;const{componentData:o,renderable:s}=r,{geometry:a}=s,i=s.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:h}=o;switch(this._computeWhichMaterialPass()){case E.Opaque:e.materialOpaque.submitDraw(this,a,l,i);break;case E.Transparent:e.materialTransparent.submitDraw(this,a,l,i);break;case E.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,a,l,i),e.materialTransparent.submitDraw(this,a,l,i);break;case E.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,a,l,i),B(t)&&e.highlightIntegratedMesh.submitDraw(this,a,l,i)}const u=this.componentParameters.castShadows!==W.None;if(u&&e.shadowMap.submitDraw(this,a,l,i),null!=n)for(const p of n)e.highlight.submitDraw(this,a,p[1],i,p[0]),u&&e.highlightShadowMap.submitDraw(this,a,p[1],i,p[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,a,l,i),u&&null!=h&&e.defaultShadowMap.submitDraw(this,a,h,i)}_computeWhichMaterialPass(){return this.isIntegratedMesh?E.IntegratedMesh:this.objectOpacity<1?E.Transparent:this.componentParameters.opaqueOverride===W.All?E.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===D.Blend||this.alphaDiscardMode===D.MaskBlend?E.Transparent:this.componentParameters.transparent===W.None?E.Opaque:this.componentParameters.transparent===W.All?E.Transparent:E.OpaqueAndTransparent}}var E,W;e([b({vectorOps:n})],I.prototype,"baseColor",void 0),e([b()],I.prototype,"usePBR",void 0),e([b()],I.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:a})],I.prototype,"mrrFactors",void 0),e([b({vectorOps:a})],I.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],I.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],I.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],I.prototype,"emissionTexture",void 0),e([b({dispose:!0})],I.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],I.prototype,"normalTexture",void 0),e([b()],I.prototype,"objectOpacity",void 0),e([M()],I.prototype,"commonMaterialParameters",void 0),e([M()],I.prototype,"componentParameters",void 0),e([b()],I.prototype,"textureAlphaCutoff",void 0),e([b()],I.prototype,"alphaDiscardMode",void 0),e([b()],I.prototype,"isIntegratedMesh",void 0),e([b()],I.prototype,"polygonOffsetEnabled",void 0),e([b()],I.prototype,"ellipsoidMode",void 0),e([b()],I.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(E||(E={}));class k extends y{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=A.Back,this.hasSlicePlane=!0}}e([b()],k.prototype,"doubleSided",void 0),e([b()],k.prototype,"cullFace",void 0),e([b()],k.prototype,"hasSlicePlane",void 0);class L extends y{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=p.Multiply,this.castShadows=W.All}get transparent(){return this.externalColor[3]<1?W.All:W.None}get opaqueOverride(){return this.externalColorMixMode===p.Replace&&1===this.externalColor[3]?W.All:W.None}get visible(){return this.externalColor[3]>0?W.All:W.None}get type(){return x.Uniform}}e([b({vectorOps:n})],L.prototype,"externalColor",void 0),e([b()],L.prototype,"externalColorMixMode",void 0),e([b()],L.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(W||(W={}));class V extends y{constructor(){super(...arguments),this.texture=null,this.transparent=W.None,this.opaqueOverride=W.None,this.castShadows=W.None}get type(){return x.Varying}}function B(e){return null!=e.overlay?.getTexture(d.Highlight)}function H(e){return null!=e.overlay?.getTexture(d.WaterNormal)}function _(e){return null!=e.overlay?.getTexture(d.ColorNoRasterImage)}e([b()],V.prototype,"texture",void 0),e([b()],V.prototype,"transparent",void 0),e([b()],V.prototype,"opaqueOverride",void 0),e([b()],V.prototype,"castShadows",void 0);export{k as CommonMaterialParameters,I as ComponentMaterial,W as ComponentParameterSummary,L as ComponentParametersUniform,V as ComponentParametersVarying};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{p as s,J as a}from"../../../../../../chunks/vec32.js";import{freeze as i,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as h,fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as p}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as c}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as d}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as m,IntegratedMeshMode as g}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as f}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as x}from"./shader/VertexDiscardMode.js";import{MaterialBase as v,parameter as b,parameterBlock as M,MaterialParameterBlock as y}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as T}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as w}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as O}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as C}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as S}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as P}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as N}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as D,CullFaceOptions as A}from"../../../lib/basicInterfaces.js";import{OITPass as q}from"../../../lib/OITPass.js";import{advancedMRRFactors as R}from"../../../materials/pbrUtils.js";import{defaultHighlightName as F}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as I}from"../../../../../../webscene/support/AlphaCutoff.js";class E extends v{constructor(e,s){super(),this.toMapSpace=s,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=R,this.emissiveFactor=i(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new L,this.componentParameters=new V,this.textureAlphaCutoff=I,this.alphaDiscardMode=D.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=N.Earth,this.hasOccludees=!1;const a=new j(e.position),l=o(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=a.low,this.transformWorldFromModelTH=a.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get hasEmissions(){return null!=this.emissionTexture||!s(this.emissiveFactor,l)}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,r,o){const s=new m(e.context.spherical,e.context.doublePrecisionRequiresObfuscation);s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.oitPass=t.identifier===T.Material&&null!=r.oitPass?r.oitPass:q.NONE,s.terrainDepthTest=t.identifier===T.Material&&r.terrainDepthTest,s.cullAboveTerrain=t.identifier===T.Material&&r.cullAboveTerrain,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?S.View:S.None,s.hasColorTexture=null!=this.baseColorTexture;const a=this._computeWhichMaterialPass();if(s.blendingEnabled=a===W.Transparent||a===W.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?U(r)?_(r)?g.ColorOverlayWithWater:g.ColorOverlay:g.NoOverlay:g.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===g.ColorOverlayWithWater?P.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.shadeNormals&&this.isIntegratedMesh?P.Disabled:P.Schematic:P.Normal:P.Disabled,s.emissionSource=null!=this.emissionTexture?C.Texture:s.pbrMode===P.Normal?C.Value:C.None,s.shadeNormals=o.shadeNormals,s.normalType=s.hasNormals?O.Compressed:O.ScreenDerivative,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,t.identifier===T.ShadowMap)s.output=w.Shadow,s.vertexDiscardMode=x.None;else if(t.identifier===T.ViewshedShadowMap)s.output=w.ViewshedShadow,s.vertexDiscardMode=x.None;else if(t.identifier===T.Highlight)s.output=w.Highlight,s.vertexDiscardMode=x.None;else{switch(a===W.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?x.Opaque:x.Transparent:s.vertexDiscardMode=x.None,s.output=t.output,s.receiveAmbientOcclusion=s.receiveShadows=!1,t.output){case w.Color:case w.ColorEmission:s.receiveAmbientOcclusion=o.applySSAO&&null!=r.ssao,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.screenSpaceReflections=null!=r.ssr.lastFrameColor,s.cloudReflections=null!=r.clouds.data;break;case w.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}const i=e.get(d,s);return this._setClean(),i}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}submit(e,t,r){if(0===this.objectOpacity)return;const{componentData:o,renderable:s}=r,{geometry:a}=s,i=s.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:h}=o;switch(this._computeWhichMaterialPass()){case W.Opaque:e.materialOpaque.submitDraw(this,a,l,i);break;case W.Transparent:e.materialTransparent.submitDraw(this,a,l,i);break;case W.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,a,l,i),e.materialTransparent.submitDraw(this,a,l,i);break;case W.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,a,l,i),H(t)&&e.highlightIntegratedMesh.submitDraw(this,a,l,i)}if(this.componentParameters.castShadows!==k.None){if(null!=n)for(const t of n)t[0]===F&&e.highlightShadowMap.submitDraw(this,a,t[1],i,t[0]);null!=h&&e.nonHighlightShadowMap.submitDraw(this,a,h,i),e.shadowMap.submitDraw(this,a,l,i)}if(null!=n)for(const u of n)e.highlight.submitDraw(this,a,u[1],i,u[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,a,l,i)}_computeWhichMaterialPass(){return this.isIntegratedMesh?W.IntegratedMesh:this.objectOpacity<1?W.Transparent:this.componentParameters.opaqueOverride===k.All?W.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===D.Blend||this.alphaDiscardMode===D.MaskBlend?W.Transparent:this.componentParameters.transparent===k.None?W.Opaque:this.componentParameters.transparent===k.All?W.Transparent:W.OpaqueAndTransparent}}var W,k;e([b({vectorOps:n})],E.prototype,"baseColor",void 0),e([b()],E.prototype,"usePBR",void 0),e([b()],E.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:a})],E.prototype,"mrrFactors",void 0),e([b({vectorOps:a})],E.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],E.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],E.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],E.prototype,"emissionTexture",void 0),e([b({dispose:!0})],E.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],E.prototype,"normalTexture",void 0),e([b()],E.prototype,"objectOpacity",void 0),e([M()],E.prototype,"commonMaterialParameters",void 0),e([M()],E.prototype,"componentParameters",void 0),e([b()],E.prototype,"textureAlphaCutoff",void 0),e([b()],E.prototype,"alphaDiscardMode",void 0),e([b()],E.prototype,"isIntegratedMesh",void 0),e([b()],E.prototype,"polygonOffsetEnabled",void 0),e([b()],E.prototype,"ellipsoidMode",void 0),e([b()],E.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(W||(W={}));class L extends y{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=A.Back,this.hasSlicePlane=!0}}e([b()],L.prototype,"doubleSided",void 0),e([b()],L.prototype,"cullFace",void 0),e([b()],L.prototype,"hasSlicePlane",void 0);class V extends y{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=p.Multiply,this.castShadows=k.All}get transparent(){return this.externalColor[3]<1?k.All:k.None}get opaqueOverride(){return this.externalColorMixMode===p.Replace&&1===this.externalColor[3]?k.All:k.None}get visible(){return this.externalColor[3]>0?k.All:k.None}get type(){return f.Uniform}}e([b({vectorOps:n})],V.prototype,"externalColor",void 0),e([b()],V.prototype,"externalColorMixMode",void 0),e([b()],V.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(k||(k={}));class B extends y{constructor(){super(...arguments),this.texture=null,this.transparent=k.None,this.opaqueOverride=k.None,this.castShadows=k.None}get type(){return f.Varying}}function H(e){return null!=e.overlay?.getTexture(c.Highlight)}function _(e){return null!=e.overlay?.getTexture(c.WaterNormal)}function U(e){return null!=e.overlay?.getTexture(c.ColorNoRasterImage)}e([b()],B.prototype,"texture",void 0),e([b()],B.prototype,"transparent",void 0),e([b()],B.prototype,"opaqueOverride",void 0),e([b()],B.prototype,"castShadows",void 0);export{L as CommonMaterialParameters,E as ComponentMaterial,k as ComponentParameterSummary,V as ComponentParametersUniform,B as ComponentParametersVarying};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as t,transpose as a,invert as r}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as h}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{i as o,c as n}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as l,ShadowMapPassParameters as c,HighlightPassParameters as p,ViewshedShadowMapPassParameters as u,RenderPassIdentifier as d}from"./AllRenderPasses.js";import{RenderPass as _,RenderPassSorting as g}from"./RenderPass.js";import{ShaderOutput as w}from"../shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as P}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as f}from"../../effects/RenderPlugin.js";import{DepthRange as R}from"../../lib/DepthRange.js";import{RenderSlot as S}from"../../lib/RenderSlot.js";let E=class extends f{constructor(){super({}),this._passes=null,this.produces=new Map([[S.OPAQUE_MATERIAL,s=>this._produces(s)],[S.TRANSPARENT_MATERIAL,s=>!!(this._passes&&this._passes.materialTransparent.count>0)&&this._produces(s)],[S.INTEGRATED_MESH,s=>this._produces(s)]]),this._materialPassParameters=new l,this._shadowPassParameters=new c,this._highlightPassParameters=new p,this._viewshedPassParameters=new u,this._systems=new Set}initializeRenderContext(s){this._context=s;const e=s.renderContext.rctx,t=s.techniques;this._passes={materialOpaque:new _(e,t),materialTransparent:new _(e,t,g.BackToFront),materialIntegratedMesh:new _(e,t),shadowMap:new _(e,t),highlight:new _(e,t),highlightIntegratedMesh:new _(e,t),highlightShadowMap:new _(e,t),viewshedShadowMap:new _(e,t),defaultShadowMap:new _(e,t)}}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear()}register(s){this._systems.add(s)}_produces(s){return 0!==this._systems.size&&null!==this._passes&&(s===w.Highlight?this._passes.highlight.count>0||this._passes.highlightIntegratedMesh.count>0:s!==w.ShadowHighlight||this._passes.highlight.count>0)}prepareRender(s){if(0!==this._systems.size&&null!==this._passes){for(const s of Object.values(this._passes))s.prepareSubmit();this._systems.forEach((e=>e.submit(this._passes,s.bind)));for(const s of Object.values(this._passes))s.finishSubmit()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=s.output===w.Shadow||s.output===w.ShadowHighlight||s.output===w.ShadowExcludeHighlight?this._shadowPassParameters:s.output===w.ViewshedShadow?this._viewshedPassParameters:s.output===w.Highlight?this._highlightPassParameters:this._materialPassParameters,t=s.bind;return this._updateParameters(t.camera,e,t.slot===S.TRANSPARENT_MATERIAL),this._materialPassParameters.output=s.output,this._invoke(s,((e,t)=>e.acquire(t,s.bind)))}render(s,e){this._invoke(s,((t,a)=>t.dispatch(a,s.bind,e)))}_invoke(s,e){if(null===this._passes)return null;const t=s.output;switch(s.bind.slot){case S.OPAQUE_MATERIAL:switch(t){case w.Color:case w.ColorEmission:case w.Depth:case w.Normal:case w.ObjectAndLayerIdColor:return e(this._passes.materialOpaque,this._materialPassParameters);case w.Highlight:return e(this._passes.highlight,this._highlightPassParameters);case w.Shadow:return e(this._passes.shadowMap,this._shadowPassParameters);case w.ShadowHighlight:return e(this._passes.highlightShadowMap,this._shadowPassParameters);case w.ShadowExcludeHighlight:return e(this._passes.defaultShadowMap,this._shadowPassParameters);case w.ViewshedShadow:return e(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case S.TRANSPARENT_MATERIAL:switch(t){case w.Color:case w.ColorEmission:case w.Depth:case w.Normal:case w.ObjectAndLayerIdColor:return e(this._passes.materialTransparent,this._materialPassParameters)}break;case S.INTEGRATED_MESH:switch(t){case w.Color:case w.ColorEmission:case w.Depth:case w.Normal:case w.ObjectAndLayerIdColor:return e(this._passes.materialIntegratedMesh,this._materialPassParameters);case w.Highlight:return e(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(s){const e=new R;return this._systems.forEach((t=>e.union(t.queryDepthRange(s)))),e}get hasEmissions(){let s=!1;return this._systems.forEach((e=>s=e.hasEmissions||s)),s}_updateParameters(s,e,i){const m=s.viewInverseTransposeMatrix;o(b,m[3],m[7],m[11]),j.set(b),n(e.transformWorldFromViewTH,j.high),n(e.transformWorldFromViewTL,j.low),n(e.slicePlaneLocalOrigin,b),t(e.transformViewFromCameraRelativeRS,s.viewMatrix),h(e.transformProjFromView,s.projectionMatrix),e.identifier===d.Material&&(this._materialPassParameters.transparent=i,a(M,e.transformViewFromCameraRelativeRS),r(e.transformNormalViewFromGlobal,M))}hasHighlightOptions(s){for(const e of this._systems)if(e.hasHighlightOptions(s))return!0;return!1}};E=s([e("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],E);const b=m(),M=i(),j=new P;export{E as RenderPassManager};
5
+ import{_ as s}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as t,transpose as r,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as h}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{i as o,c as n}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as l,ShadowMapPassParameters as c,HighlightPassParameters as p,ViewshedShadowMapPassParameters as u,RenderPassIdentifier as d}from"./AllRenderPasses.js";import{RenderPass as g,RenderPassSorting as _}from"./RenderPass.js";import{ShaderOutput as w}from"../shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as P}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as f}from"../../effects/RenderPlugin.js";import{DepthRange as R}from"../../lib/DepthRange.js";import{RenderSlot as S}from"../../lib/RenderSlot.js";let E=class extends f{constructor(){super({}),this._passes=null,this.produces=new Map([[S.OPAQUE_MATERIAL,s=>this._produces(s)],[S.TRANSPARENT_MATERIAL,s=>!!(this._passes&&this._passes.materialTransparent.count>0)&&this._produces(s)],[S.INTEGRATED_MESH,s=>this._produces(s)]]),this._materialPassParameters=new l,this._shadowPassParameters=new c,this._highlightPassParameters=new p,this._viewshedPassParameters=new u,this._systems=new Set}initializeRenderContext(s){this._context=s;const e=s.renderContext.rctx,t=s.techniques;this._passes={materialOpaque:new g(e,t),materialTransparent:new g(e,t,_.BackToFront),materialIntegratedMesh:new g(e,t),shadowMap:new g(e,t),highlight:new g(e,t),highlightIntegratedMesh:new g(e,t),highlightShadowMap:new g(e,t),viewshedShadowMap:new g(e,t),nonHighlightShadowMap:new g(e,t)}}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear()}register(s){this._systems.add(s)}_produces(s){return 0!==this._systems.size&&null!==this._passes&&(s===w.Highlight?this._passes.highlight.count>0||this._passes.highlightIntegratedMesh.count>0:s!==w.ShadowHighlight||this._passes.highlight.count>0)}prepareRender(s){if(0!==this._systems.size&&null!==this._passes){for(const s of Object.values(this._passes))s.prepareSubmit();this._systems.forEach((e=>e.submit(this._passes,s.bind)));for(const s of Object.values(this._passes))s.finishSubmit()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=s.output===w.Shadow||s.output===w.ShadowHighlight||s.output===w.ShadowExcludeHighlight?this._shadowPassParameters:s.output===w.ViewshedShadow?this._viewshedPassParameters:s.output===w.Highlight?this._highlightPassParameters:this._materialPassParameters,t=s.bind;return this._updateParameters(t.camera,e,t.slot===S.TRANSPARENT_MATERIAL),this._materialPassParameters.output=s.output,this._invoke(s,((e,t)=>e.acquire(t,s.bind)))}render(s,e){this._invoke(s,((t,r)=>t.dispatch(r,s.bind,e)))}_invoke(s,e){if(null===this._passes)return null;const t=s.output;switch(s.bind.slot){case S.OPAQUE_MATERIAL:switch(t){case w.Color:case w.ColorEmission:case w.Depth:case w.Normal:case w.ObjectAndLayerIdColor:return e(this._passes.materialOpaque,this._materialPassParameters);case w.Highlight:return e(this._passes.highlight,this._highlightPassParameters);case w.Shadow:return e(this._passes.shadowMap,this._shadowPassParameters);case w.ShadowHighlight:return e(this._passes.highlightShadowMap,this._shadowPassParameters);case w.ShadowExcludeHighlight:return e(this._passes.nonHighlightShadowMap,this._shadowPassParameters);case w.ViewshedShadow:return e(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case S.TRANSPARENT_MATERIAL:switch(t){case w.Color:case w.ColorEmission:case w.Depth:case w.Normal:case w.ObjectAndLayerIdColor:return e(this._passes.materialTransparent,this._materialPassParameters)}break;case S.INTEGRATED_MESH:switch(t){case w.Color:case w.ColorEmission:case w.Depth:case w.Normal:case w.ObjectAndLayerIdColor:return e(this._passes.materialIntegratedMesh,this._materialPassParameters);case w.Highlight:return e(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(s){const e=new R;return this._systems.forEach((t=>e.union(t.queryDepthRange(s)))),e}get hasEmissions(){let s=!1;return this._systems.forEach((e=>s=e.hasEmissions||s)),s}_updateParameters(s,e,i){const m=s.viewInverseTransposeMatrix;o(b,m[3],m[7],m[11]),j.set(b),n(e.transformWorldFromViewTH,j.high),n(e.transformWorldFromViewTL,j.low),n(e.slicePlaneLocalOrigin,b),t(e.transformViewFromCameraRelativeRS,s.viewMatrix),h(e.transformProjFromView,s.projectionMatrix),e.identifier===d.Material&&(this._materialPassParameters.transparent=i,r(M,e.transformViewFromCameraRelativeRS),a(e.transformNormalViewFromGlobal,M))}hasHighlightOptions(s){for(const e of this._systems)if(e.hasHighlightOptions(s))return!0;return!1}};E=s([e("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],E);const b=m(),M=i(),j=new P;export{E as RenderPassManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,f as u,t as m}from"../../../../../chunks/vec32.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as A}from"../IntersectorInterfaces.js";import b from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as M}from"./InstanceOctree.js";import{LevelSelector as x}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as U}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as H}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as V,noBudget as B}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as q,unbindVertexBufferLayout as G}from"../../../../webgl/Util.js";const P=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new x(t,r)};let z=class extends E{constructor(e,t){super(e),this.type=A.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(V.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=K(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)e.push(t[1]);return e}hasHighlightOptions(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=P(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return e!==C.Highlight&&e!==C.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(B),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=!n&&t!==C.ShadowHighlight,a=t!==C.ShadowExcludeHighlight;if(s)return a?this._allRenderInstanceData:[this._defaultRenderInstanceData];if(a){if(n){const e=r.highlight?.name;if(!e)return null;const t=this._highlightRenderInstanceDataMap.get(e);return t?[t]:null}return Array.from(this._highlightRenderInstanceDataMap.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=f();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Q),e.transform.set(Q),m(Z,r,e.transform.inverse),m($,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(!!(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,Z,$,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new M(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,b.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,b.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,J),d(J,J,s);const i=u(J,t)-J[3];a.boundingSphere.getVec(n,J),d(J,J,s);const o=u(J,t)+J[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500);for(let u=0;u<l&&!e.done;++u){h===this._cycleStartIndex&&this._startUpdateCycle();const u=o.state.get(h);let m=0;if(!(u&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const f=o.lodLevel.get(h);if(u&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[f].freeTail(),u&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=this._highlightRenderInstanceDataMap.get(e);if(!t)throw new r("Internal error in lodRenderer");t[f].freeTail()}}if(u&j.REMOVE)i.freeInstance(h);else if(u&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,Y),e=a.selectLevel(Y,i.getCombinedMedianScaleFactor(h),n)),m=u&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(u&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(this._highlightRenderInstanceDataMap,t,n);if(e>=a.length)throw new r(`LodRenderer internal error - missing lodLevel ${e}`);k(a[e],o,h)}m|=j.HIGHLIGHT_ACTIVE}else k(this._defaultRenderInstanceData[e],o,h),m|=j.DEFAULT_ACTIVE;o.state.set(h,m),o.lodLevel.set(h,e)}else m=u&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,m);if(null!=this._octreeCached){const e=!!(u&j.ACTIVE),t=!!(m&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&u&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d==0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,ee);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",X[Math.min(s,X.length-1)]),o.setUniform1i("colorMixMode",U.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{q(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),G(i,R,r.buffer,u)};n.material.parameters.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function k(e,t,r){const n=e.allocateHead();W(t,r,e.view,n)}function W(e,t,r,n){H(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function K(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],z.prototype,"symbol",void 0),e([l({constructOnly:!0})],z.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],z.prototype,"metadata",void 0),e([l({constructOnly:!0})],z.prototype,"shaderTransformation",void 0),e([l()],z.prototype,"_instanceData",void 0),e([l()],z.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],z.prototype,"_enableLevelSelection",null),e([l()],z.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],z.prototype,"running",null),z=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],z);const Y=f(),J=p(),Q=h(),Z=f(),$=f(),X=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],ee=new F;export{z as LodRenderer};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,f as u,t as m}from"../../../../../chunks/vec32.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as A}from"../IntersectorInterfaces.js";import b from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=A.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)e.push(t[1]);return e}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlightOptions(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlightOptions(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=!n&&t!==C.ShadowHighlight,a=t!==C.ShadowExcludeHighlight;if(s)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;if(a){if(n){const e=r.highlight?.name;if(!e)return null;const t=this._highlightRenderInstanceDataMap.get(e);return t?[t]:null}return Array.from(this._highlightRenderInstanceDataMap.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=p();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(!!(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,b.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,b.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500);for(let u=0;u<l&&!e.done;++u){h===this._cycleStartIndex&&this._startUpdateCycle();const u=o.state.get(h);let m=0;if(!(u&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const p=o.lodLevel.get(h);if(u&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[p].freeTail(),u&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=this._highlightRenderInstanceDataMap.get(e);if(!t)throw new r("Internal error in lodRenderer");t[p].freeTail()}}if(u&j.REMOVE)i.freeInstance(h);else if(u&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),m=u&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(u&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(this._highlightRenderInstanceDataMap,t,n);if(e>=a.length)throw new r(`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}m|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),m|=j.DEFAULT_ACTIVE;o.state.set(h,m),o.lodLevel.set(h,e)}else m=u&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,m);if(null!=this._octreeCached){const e=!!(u&j.ACTIVE),t=!!(m&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&u&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d==0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("colorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.parameters.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=p(),Q=f(),Z=h(),$=p(),X=p(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{NestedMap as a}from"../../../../../core/NestedMap.js";import o from"../../../../../core/PooledArray.js";import{addMany as n}from"../../../../../core/SetUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as c,transpose as f}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as m}from"../../../support/buffer/glUtil.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as p}from"../../effects/RenderPlugin.js";import{GLMaterials as y}from"../../lib/GLMaterials.js";import{DirtyState as _}from"../../lib/ModelDirtyTypes.js";import{RenderSlot as b}from"../../lib/RenderSlot.js";import{assert as w}from"../../lib/Util.js";import{DrawParameters as v}from"../DrawParameters.js";import{BufferRange as O,mergeAdjacentRanges as C}from"./BufferRange.js";import{Instance as E}from"./Instance.js";import{PerBufferData as A,hasVao as B}from"./PerBufferData.js";import{PerOriginData as M}from"./PerOriginData.js";let S=class extends p{get _hasHighlights(){return this._highlightNames.size>0}hasHighlightOptions(e){return this._highlightNames.has(e)}constructor(e){super(e),this._dataByOrigin=new Map,this._drawParameters=new v,this._highlightNames=new Set,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=!1}destroy(){this._glMaterials=s(this._glMaterials),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this._updateProduces()}_updateProduces(){this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>!(0===this._dataByOrigin.size||!(t!==g.Highlight&&t!==g.ShadowHighlight||this._hasHighlights))&&e(t)))}))}initializeRenderContext(e,t){this._glMaterials=new y(this.material,t??e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,m(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees}get hasEmissions(){return this.material.hasEmissions}get isDecoration(){return this.material.parameters.isDecoration}queryRenderOccludedState(e){return this.material.queryRenderOccludedState(e)}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.cachedMemory),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((({geometry:t})=>e(t)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}updateHighlights(e){this.highlightOrderMap=e,this._highlightNames.clear(),this._dataByOrigin.forEach((t=>{t.buffers.forEach((t=>{t.updateHighlights(e),t.highlightNames.forEach((e=>this._highlightNames.add(e)))}))})),this._updateProduces()}_updateGeometries(e){const t=this._bufferWriter;if(null==t)return;const r=t.vertexBufferLayout.stride/4;for(const i of e){const e=i.renderGeometry,s=this._dataByOrigin.get(e.localOrigin.id),a=s?.findBuffer(e.id);if(null==a)return;const o=a.instances.get(e.id);if(i.updateType&(_.GEOMETRY|_.TRANSFORMATION)){const i=z(t.elementCount(o.geometry.geometry.attributes)*r),s=t.vertexBufferLayout.createView(i.buffer);this._writeGeometry(e,s,0),a.vao.vertexBuffers.get("geometry").setSubData(i,o.from*r,0,o.numElements*r)}i.updateType&(_.HIGHLIGHT|_.OCCLUDEE|_.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new a;for(const i of e){const e=i.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new x(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),s=t?.findBuffer(i.id);if(null==s)continue;let a=r.get(e.id,s);null==a&&(a=new x(e.vec3),r.set(e.id,s,a)),a.changes.push(i)}return r}_addAndRemoveGeometries(e,r){if(null==this._bufferWriter||null==this._vaoCache)return;const{_bufferWriter:i,_dataByOrigin:s}=this,a=i.vertexBufferLayout.stride/4,o=this._computeDeltas(e,r);o.forEach(((e,r)=>{const n=e.get(null),l=n?.changes??[];o.delete(r,null);let h=s.get(r);if(e.forEach(((e,n)=>{if(o.delete(r,n),null==n)return void w(!1,"No VAO for removed geometries");if(n.instances.size===e.changes.length)return this._vaoCache.deleteVao(n.vao),t(h.buffers,n),void(0===h.buffers.length&&0===l.length&&s.delete(r));const u=n.numElements,c=n.vao.byteSize/4,f=l.reduce(((e,t)=>e+i.elementCount(t.geometry.attributes)),0),d=e.changes.reduce(((e,t)=>e+i.elementCount(t.geometry.attributes)),0),m=Math.min((u+f-d)*a,T),g=m>c;m>L&&m<c/2?(e.changes.forEach((({id:e})=>n.deleteInstance(e))),n.instances.forEach((({geometry:e})=>l.push(e))),this._vaoCache.deleteVao(n.vao),t(h.buffers,n)):g?this._applyAndRebuild(n,l,e):this._applyRemoves(n,e)})),l.length>0)for(null==h&&(h=new M(n.origin),s.set(r,h)),h.buffers.forEach((e=>this._applyAdds(e,l)));l.length>0;)h.buffers.push(this._applyAndRebuild(new A,l,null))}))}_updateDrawCommands(){this._highlightNames.clear(),this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.updateIfDrawCommandsDirty(this.highlightOrderMap,this._bufferWriter.vertexBufferLayout.stride),e.hasHighlights&&n(this._highlightNames,e.highlightNames),this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(r)for(const d of r.changes)e.deleteInstance(d.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,a=s/4,o=Math.floor(T/a);let n=e.numElements;for(;t.length>0;){const r=t.pop(),s=i.elementCount(r.geometry.attributes);if(n+s>o&&n>0){t.push(r);break}n+=s;const a=new E(r,0,0,this.highlightOrderMap);w(null==e.instances.get(r.id)),e.addInstance(r.id,a)}const l=n*a,h=z(l),u=i.vertexBufferLayout.createView(h.buffer);let c=0;e.resetInstanceSummary(),e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,u,c);const s=c;c+=i.elementCount(t.geometry.geometry.attributes),e.updateInstance(r,s,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(W(l)),e.vao.vertexBuffers.get("geometry").setSubData(h,0,0,c*a),e.holes.clear();const f=e.holes.pushNew();return f.from=c,f.to=Math.floor(e.vao.byteSize/s),e.updateDrawCommands(this.highlightOrderMap,s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;for(const o of t.changes){const t=o.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const i=j.back();if(i){if(i.to===r.from){i.to=r.to;continue}if(i.from===r.to){i.from=r.from;continue}}const s=j.pushNew();s.from=r.from,s.to=r.to}C(j);const r=this._bufferWriter.vertexBufferLayout.stride/4,i=j.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,s=z(i);s.fill(0,0,i);const a=e.vao.vertexBuffers.get("geometry");j.forAll((e=>a.setSubData(s,e.from*r,0,e.numElements*r))),e.holes.pushArray(j.data,j.length),j.forAll(((e,t)=>j.data[t]=null)),j.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!B(e))return void this._applyAndRebuild(e,t,null);const i=this._bufferWriter,s=i.vertexBufferLayout.stride/4,a=e.numElements,o=t.reduce(((e,t)=>e+i.elementCount(t.geometry.attributes)),0),n=Math.min((a+o)*s,T),l=4*n;if(e.vao.byteSize<W(T-L)&&l>e.vao.byteSize)return void this._applyAndRebuild(e,t,null);C(e.holes);const h=new Array;for(const r of t){const t=i.elementCount(r.geometry.attributes),s=D(e.holes,t);h.push(s)}const u=e.vao.vertexBuffers.get("geometry");let c=0,f=0,d=0;const m=z(n),g=i.vertexBufferLayout.createView(m.buffer);t.forEach(((t,r)=>{const a=h[r];if(null==a)return;if(!(d===a)){const e=d-f;e>0&&u.setSubData(m,f*s,0,e*s),f=a,c=0}const o=i.elementCount(t.geometry.attributes);this._writeGeometry(t,g,c),c+=o,d=a+o;const n=new E(t,a,a+o,this.highlightOrderMap);w(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}));const p=d-f;p>0&&u.setSubData(m,f*s,0,p*s),r(t,((e,t)=>null==h[t]))}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(R,e.transformation),R[12]-=e.localOrigin.vec3[0],R[13]-=e.localOrigin.vec3[1],R[14]-=e.localOrigin.vec3[2],c(H,R),f(H,H),this._bufferWriter.write(R,H,e.geometry.attributes,e.geometry.objectAndLayerIdColor,t,r))}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){if(!this.material.shouldRender(e))return null;const{output:t,bind:r}=e,i=this.material.produces.get(r.slot);if(!i?.(t))return null;const{highlight:s,slot:a}=r,o=t===g.ShadowHighlight,n=t===g.Highlight,l=n||o,h=s?.name;if(l&&(0===this._highlightNames.size||n&&h&&!this._highlightNames.has(h)))return null;const u=e=>n&&!!h&&!e.has(h),c=t===g.ShadowExcludeHighlight,f=!(l||c);for(const{buffers:d}of this._dataByOrigin.values())for(const i of d){if(u(i.highlightNames))continue;const s=o?i.drawCommandsHighlights.size>0:l?h?i.drawCommandsHighlights.get(h):i.drawCommandsHighlights.size>0:((c&&i.needsMultipleCommands()?i.drawCommandsShadowHighlightRest:i.drawCommandsDefault)||null)?.length??!1,n=f&&i.drawCommandsOccludees||null;if(s||n?.length){const i=this._glMaterials.load(e.rctx,a,t),s=i?.beginSlot(r);if(s)return s}}return null}render(e,t){const{output:r,bind:i}=e,{slot:s,highlight:a}=i,o=r===g.Highlight,n=a?.name??"";if(o&&!a)return;const l=r===g.ShadowHighlight,h=o||l,u=r===g.ShadowExcludeHighlight,c=!(h||u),f=s===b.OCCLUDER_MATERIAL||s===b.TRANSPARENT_OCCLUDER_MATERIAL?s:null,{rctx:d}=e;d.runAppleAmdDriverHelper();const m=d.bindTechnique(t,i,this.material.parameters);for(const g of this._dataByOrigin.values())for(const e of g.buffers){if(o&&(!e.hasHighlights||!e.drawCommandsHighlights.has(n)))continue;if(l&&!e.hasHighlights)continue;const r=()=>{const t=[];for(const r of e.drawCommandsHighlights.values())t.push(r);return t},s=h&&!l?e.drawCommandsHighlights.get(n)??null:null,a=l?r():h?s?[s]:V:u&&e.needsMultipleCommands()?[e.drawCommandsShadowHighlightRest]:[e.drawCommandsDefault],p=a.some((e=>e.length>0)),y=c&&e.drawCommandsOccludees||null;if(p||y?.length){if(this._drawParameters.origin=g.origin,m.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e.vao),d.bindVAO(e.vao),p)for(const e of a)d.setPipelineState(t.getPipeline(!1,f)),e.forAll((e=>d.drawArrays(t.primitiveType,e.first,e.count)));y?.length&&(d.setPipelineState(t.getPipeline(!0,f)),y.forAll((e=>d.drawArrays(t.primitiveType,e.first,e.count))))}}}static prune(){G=new Float32Array(L)}get test(){}};e([l({constructOnly:!0})],S.prototype,"material",void 0),e([l({})],S.prototype,"highlightOrderMap",void 0),S=e([h("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],S);class x{constructor(e){this.origin=e,this.changes=new Array}}function D(e,t){const r=e.find((e=>e.numElements>=t));if(null==r)return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const R=d(),H=d(),j=new o({allocator:e=>e||new O,deallocator:null}),L=65536,N=4*L,I=1024,P=16777216,T=P/4;let G=new Float32Array(L);function z(e){return G.length<e&&(G=new Float32Array(e)),G}function W(e){const t=4*e;return t<=I?I:t<N?i(t):Math.max(Math.min(Math.ceil(1.5*t/N)*N,P),t)}const V=[];export{S as MergedRenderer,W as sizeForVao};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{NestedMap as a}from"../../../../../core/NestedMap.js";import o from"../../../../../core/PooledArray.js";import{addMany as n}from"../../../../../core/SetUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as c,transpose as f}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as m}from"../../../support/buffer/glUtil.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as p}from"../../effects/RenderPlugin.js";import{GLMaterials as y}from"../../lib/GLMaterials.js";import{DirtyState as _}from"../../lib/ModelDirtyTypes.js";import{RenderSlot as b}from"../../lib/RenderSlot.js";import{assert as w}from"../../lib/Util.js";import{DrawParameters as v}from"../DrawParameters.js";import{BufferRange as O,mergeAdjacentRanges as C}from"./BufferRange.js";import{Instance as E}from"./Instance.js";import{PerBufferData as A,hasVao as B}from"./PerBufferData.js";import{PerOriginData as M}from"./PerOriginData.js";import{defaultHighlightName as S}from"../../../../support/HighlightDefaults.js";let D=class extends p{get _hasHighlights(){return this._highlightNames.size>0}hasHighlightOptions(e){return this._highlightNames.has(e)}constructor(e){super(e),this._dataByOrigin=new Map,this._drawParameters=new v,this._highlightNames=new Set,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=!1}destroy(){this._glMaterials=s(this._glMaterials),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this._updateProduces()}_updateProduces(){this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>!(0===this._dataByOrigin.size||!(t!==g.Highlight&&t!==g.ShadowHighlight||this._hasHighlights))&&e(t)))}))}initializeRenderContext(e,t){this._glMaterials=new y(this.material,t??e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,m(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees}get hasEmissions(){return this.material.hasEmissions}get isDecoration(){return this.material.parameters.isDecoration}queryRenderOccludedState(e){return this.material.queryRenderOccludedState(e)}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.cachedMemory),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((({geometry:t})=>e(t)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}updateHighlights(e){this.highlightOrderMap=e,this._highlightNames.clear(),this._dataByOrigin.forEach((t=>{t.buffers.forEach((t=>{t.updateHighlights(e),t.highlightNames.forEach((e=>this._highlightNames.add(e)))}))})),this._updateProduces()}_updateGeometries(e){const t=this._bufferWriter;if(null==t)return;const r=t.vertexBufferLayout.stride/4;for(const i of e){const e=i.renderGeometry,s=this._dataByOrigin.get(e.localOrigin.id),a=s?.findBuffer(e.id);if(null==a)return;const o=a.instances.get(e.id);if(i.updateType&(_.GEOMETRY|_.TRANSFORMATION)){const i=z(t.elementCount(o.geometry.geometry.attributes)*r),s=t.vertexBufferLayout.createView(i.buffer);this._writeGeometry(e,s,0),a.vao.vertexBuffers.get("geometry").setSubData(i,o.from*r,0,o.numElements*r)}i.updateType&(_.HIGHLIGHT|_.OCCLUDEE|_.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new a;for(const i of e){const e=i.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new H(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),s=t?.findBuffer(i.id);if(null==s)continue;let a=r.get(e.id,s);null==a&&(a=new H(e.vec3),r.set(e.id,s,a)),a.changes.push(i)}return r}_addAndRemoveGeometries(e,r){if(null==this._bufferWriter||null==this._vaoCache)return;const{_bufferWriter:i,_dataByOrigin:s}=this,a=i.vertexBufferLayout.stride/4,o=this._computeDeltas(e,r);o.forEach(((e,r)=>{const n=e.get(null),l=n?.changes??[];o.delete(r,null);let h=s.get(r);if(e.forEach(((e,n)=>{if(o.delete(r,n),null==n)return void w(!1,"No VAO for removed geometries");if(n.instances.size===e.changes.length)return this._vaoCache.deleteVao(n.vao),t(h.buffers,n),void(0===h.buffers.length&&0===l.length&&s.delete(r));const u=n.numElements,c=n.vao.byteSize/4,f=l.reduce(((e,t)=>e+i.elementCount(t.geometry.attributes)),0),d=e.changes.reduce(((e,t)=>e+i.elementCount(t.geometry.attributes)),0),m=Math.min((u+f-d)*a,G),g=m>c;m>N&&m<c/2?(e.changes.forEach((({id:e})=>n.deleteInstance(e))),n.instances.forEach((({geometry:e})=>l.push(e))),this._vaoCache.deleteVao(n.vao),t(h.buffers,n)):g?this._applyAndRebuild(n,l,e):this._applyRemoves(n,e)})),l.length>0)for(null==h&&(h=new M(n.origin),s.set(r,h)),h.buffers.forEach((e=>this._applyAdds(e,l)));l.length>0;)h.buffers.push(this._applyAndRebuild(new A,l,null))}))}_updateDrawCommands(){this._highlightNames.clear(),this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.updateIfDrawCommandsDirty(this.highlightOrderMap,this._bufferWriter.vertexBufferLayout.stride),e.hasHighlights&&n(this._highlightNames,e.highlightNames),this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(r)for(const d of r.changes)e.deleteInstance(d.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,a=s/4,o=Math.floor(G/a);let n=e.numElements;for(;t.length>0;){const r=t.pop(),s=i.elementCount(r.geometry.attributes);if(n+s>o&&n>0){t.push(r);break}n+=s;const a=new E(r,0,0,this.highlightOrderMap);w(null==e.instances.get(r.id)),e.addInstance(r.id,a)}const l=n*a,h=z(l),u=i.vertexBufferLayout.createView(h.buffer);let c=0;e.resetInstanceSummary(),e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,u,c);const s=c;c+=i.elementCount(t.geometry.geometry.attributes),e.updateInstance(r,s,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.vertexBuffers.get("geometry").setSubData(h,0,0,c*a),e.holes.clear();const f=e.holes.pushNew();return f.from=c,f.to=Math.floor(e.vao.byteSize/s),e.updateDrawCommands(this.highlightOrderMap,s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;for(const o of t.changes){const t=o.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const i=L.back();if(i){if(i.to===r.from){i.to=r.to;continue}if(i.from===r.to){i.from=r.from;continue}}const s=L.pushNew();s.from=r.from,s.to=r.to}C(L);const r=this._bufferWriter.vertexBufferLayout.stride/4,i=L.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,s=z(i);s.fill(0,0,i);const a=e.vao.vertexBuffers.get("geometry");L.forAll((e=>a.setSubData(s,e.from*r,0,e.numElements*r))),e.holes.pushArray(L.data,L.length),L.forAll(((e,t)=>L.data[t]=null)),L.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!B(e))return void this._applyAndRebuild(e,t,null);const i=this._bufferWriter,s=i.vertexBufferLayout.stride/4,a=e.numElements,o=t.reduce(((e,t)=>e+i.elementCount(t.geometry.attributes)),0),n=Math.min((a+o)*s,G),l=4*n;if(e.vao.byteSize<V(G-N)&&l>e.vao.byteSize)return void this._applyAndRebuild(e,t,null);C(e.holes);const h=new Array;for(const r of t){const t=i.elementCount(r.geometry.attributes),s=x(e.holes,t);h.push(s)}const u=e.vao.vertexBuffers.get("geometry");let c=0,f=0,d=0;const m=z(n),g=i.vertexBufferLayout.createView(m.buffer);t.forEach(((t,r)=>{const a=h[r];if(null==a)return;if(!(d===a)){const e=d-f;e>0&&u.setSubData(m,f*s,0,e*s),f=a,c=0}const o=i.elementCount(t.geometry.attributes);this._writeGeometry(t,g,c),c+=o,d=a+o;const n=new E(t,a,a+o,this.highlightOrderMap);w(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}));const p=d-f;p>0&&u.setSubData(m,f*s,0,p*s),r(t,((e,t)=>null==h[t]))}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(R,e.transformation),R[12]-=e.localOrigin.vec3[0],R[13]-=e.localOrigin.vec3[1],R[14]-=e.localOrigin.vec3[2],c(j,R),f(j,j),this._bufferWriter.write(R,j,e.geometry.attributes,e.geometry.objectAndLayerIdColor,t,r))}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){if(!this.material.shouldRender(e))return null;const{output:t,bind:r}=e,i=this.material.produces.get(r.slot);if(!i?.(t))return null;const{highlight:s,slot:a}=r,o=t===g.ShadowHighlight,n=t===g.Highlight,l=n||o,h=s?.name;if(l&&(0===this._highlightNames.size||n&&h&&!this._highlightNames.has(h)))return null;const u=e=>n&&!!h&&!e.has(h),c=t===g.ShadowExcludeHighlight,f=!(l||c);for(const{buffers:d}of this._dataByOrigin.values())for(const i of d){if(u(i.highlightNames))continue;const s=o?i.drawCommandsHighlights.get(S):l?h?i.drawCommandsHighlights.get(h):i.drawCommandsHighlights.size>0:((c&&i.needsMultipleCommands()?i.drawCommandsShadowHighlightRest:i.drawCommandsDefault)||null)?.length??!1,n=f&&i.drawCommandsOccludees||null;if(s||n?.length){const i=this._glMaterials.load(e.rctx,a,t),s=i?.beginSlot(r);if(s)return s}}return null}render(e,t){const{output:r,bind:i}=e,{slot:s,highlight:a}=i,n=r===g.Highlight,l=a?.name??"";if(n&&!a)return;const h=r===g.ShadowHighlight,u=n||h,c=r===g.ShadowExcludeHighlight,f=!(u||c),d=s===b.OCCLUDER_MATERIAL||s===b.TRANSPARENT_OCCLUDER_MATERIAL?s:null,{rctx:m}=e;m.runAppleAmdDriverHelper();const p=m.bindTechnique(t,i,this.material.parameters);for(const g of this._dataByOrigin.values())for(const e of g.buffers){if(n&&(!e.hasHighlights||!e.drawCommandsHighlights.has(l)))continue;if(h&&(!e.hasHighlights||!e.drawCommandsHighlights.has(S)))continue;const r=()=>{const t=[],r=e.drawCommandsHighlights.get(S)??new o;return r&&t.push(r),t},s=u&&!h?e.drawCommandsHighlights.get(l)??null:null,a=h?r():u?s?[s]:U:c&&e.needsMultipleCommands()?[e.drawCommandsShadowHighlightRest]:[e.drawCommandsDefault],y=a.some((e=>e.length>0)),_=f&&e.drawCommandsOccludees||null;if(y||_?.length){if(this._drawParameters.origin=g.origin,p.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e.vao),m.bindVAO(e.vao),y)for(const e of a)m.setPipelineState(t.getPipeline(!1,d)),e.forAll((e=>m.drawArrays(t.primitiveType,e.first,e.count)));_?.length&&(m.setPipelineState(t.getPipeline(!0,d)),_.forAll((e=>m.drawArrays(t.primitiveType,e.first,e.count))))}}}static prune(){W=new Float32Array(N)}get test(){}};e([l({constructOnly:!0})],D.prototype,"material",void 0),e([l({})],D.prototype,"highlightOrderMap",void 0),D=e([h("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],D);class H{constructor(e){this.origin=e,this.changes=new Array}}function x(e,t){const r=e.find((e=>e.numElements>=t));if(null==r)return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const R=d(),j=d(),L=new o({allocator:e=>e||new O,deallocator:null}),N=65536,I=4*N,P=1024,T=16777216,G=T/4;let W=new Float32Array(N);function z(e){return W.length<e&&(W=new Float32Array(e)),W}function V(e){const t=4*e;return t<=P?P:t<I?i(t):Math.max(Math.min(Math.ceil(1.5*t/I)*I,T),t)}const U=[];export{D as MergedRenderer,V as sizeForVao};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import t from"../../../../../core/PooledArray.js";import{BufferRange as e}from"./BufferRange.js";import{DrawCommand as i}from"./DrawCommand.js";class n{constructor(){this._numElements=0,this._instances=new Map,this.holes=new t({allocator:s=>s||new e,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=o(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=o(),this.drawCommandsShadowHighlightRest=o()}get numElements(){return this._numElements}get instances(){return this._instances}get hasHighlights(){return this.highlightNames.size>0}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateIfDrawCommandsDirty(s,t){if(this.drawCommandsDirty){this.resetInstanceSummary();for(const s of this.instances.values())this.updateDrawState(s);this.updateDrawCommands(s,t)}}addInstance(s,t){this.deleteInstance(s),this._instances.set(s,t),this._numElements+=t.numElements}deleteInstance(s){const t=this._instances.get(s);t&&(this._numElements-=t.numElements,this._instances.delete(s))}updateInstance(s,t,e){const i=this._instances.get(s);i&&(this._numElements-=i.numElements,i.from=t,i.to=e,this._numElements+=i.numElements)}updateDrawState(s){if(s.isVisible){const{highlightName:t}=s;t&&this.highlightNames.add(t),s.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(s,t){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,0===this._instances.size)return;const{sortedInstances:e}=this;if(this._updateHighlightDrawCommands(s,e),!this.needsMultipleCommands()){const s=this.drawCommandsDefault.pushNew(),e=this.holes.front();return null!=this.vao&&1===this.holes.length&&e.to===Math.floor(this.vao.byteSize/t)?(s.first=0,void(s.count=e.from)):(s.first=1/0,s.count=0,this._instances.forEach((t=>{s.first=Math.min(s.first,t.from),s.count=Math.max(s.count,t.to)})),void(s.count-=s.first))}for(const i of e)i.isVisible&&r(i.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,i)}get sortedInstances(){return Array.from(this._instances.values()).sort(((s,t)=>s.from===t.from?s.to-t.to:s.from-t.from))}updateHighlights(s){this.highlightNames.clear();const t=this.sortedInstances;for(const e of t)e.updateHighlightOptions(s),e.isVisible&&e.highlightName&&this.highlightNames.add(e.highlightName);this._updateHighlightDrawCommands(s)}_updateHighlightDrawCommands(t,e=this.sortedInstances){const{drawCommandsHighlights:i,drawCommandsShadowHighlightRest:n}=this;i.clear(),n.clear();for(const a of e){if(a.updateHighlightOptions(t),!a.isVisible)continue;const{highlightName:e}=a;if(e){this.highlightNames.add(e);r(s(i,e,o),a)}else r(n,a)}}needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}}class a extends n{}function h(s){return null!=s.vao}function o(){return new t({allocator:s=>s||new i,deallocator:s=>s})}function r(s,t){const e=s.back();if(null==e){const e=s.pushNew();return e.first=t.from,void(e.count=t.numElements)}if(m(e,t)){const s=t.from-e.first+t.numElements;e.count=s}else{const e=s.pushNew();e.first=t.from,e.count=t.numElements}}function m(s,t){return s.first+s.count>=t.from}export{n as PerBufferData,a as PerVaoData,h as hasVao};
5
+ import{getOrCreateMapValue as t}from"../../../../../core/MapUtils.js";import s from"../../../../../core/PooledArray.js";import{BufferRange as e}from"./BufferRange.js";import{DrawCommand as i}from"./DrawCommand.js";import{defaultHighlightName as n}from"../../../../support/HighlightDefaults.js";class a{constructor(){this._numElements=0,this._instances=new Map,this.holes=new s({allocator:t=>t||new e,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=r(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=r(),this.drawCommandsShadowHighlightRest=r()}get numElements(){return this._numElements}get instances(){return this._instances}get hasHighlights(){return this.highlightNames.size>0}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateIfDrawCommandsDirty(t,s){if(this.drawCommandsDirty){this.resetInstanceSummary();for(const t of this.instances.values())this.updateDrawState(t);this.updateDrawCommands(t,s)}}addInstance(t,s){this.deleteInstance(t),this._instances.set(t,s),this._numElements+=s.numElements}deleteInstance(t){const s=this._instances.get(t);s&&(this._numElements-=s.numElements,this._instances.delete(t))}updateInstance(t,s,e){const i=this._instances.get(t);i&&(this._numElements-=i.numElements,i.from=s,i.to=e,this._numElements+=i.numElements)}updateDrawState(t){if(t.isVisible){const{highlightName:s}=t;s&&this.highlightNames.add(s),t.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(t,s){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,0===this._instances.size)return;const{sortedInstances:e}=this;if(this._updateHighlightDrawCommands(t,e),!this.needsMultipleCommands()){const t=this.drawCommandsDefault.pushNew(),e=this.holes.front();return null!=this.vao&&1===this.holes.length&&e.to===Math.floor(this.vao.byteSize/s)?(t.first=0,void(t.count=e.from)):(t.first=1/0,t.count=0,this._instances.forEach((s=>{t.first=Math.min(t.first,s.from),t.count=Math.max(t.count,s.to)})),void(t.count-=t.first))}for(const i of e)i.isVisible&&m(i.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,i)}get sortedInstances(){return Array.from(this._instances.values()).sort(((t,s)=>t.from===s.from?t.to-s.to:t.from-s.from))}updateHighlights(t){this.highlightNames.clear();const s=this.sortedInstances;for(const e of s)e.updateHighlightOptions(t),e.isVisible&&e.highlightName&&this.highlightNames.add(e.highlightName);this._updateHighlightDrawCommands(t)}_updateHighlightDrawCommands(s,e=this.sortedInstances){const{drawCommandsHighlights:i,drawCommandsShadowHighlightRest:a}=this;i.clear(),a.clear();for(const h of e){if(h.updateHighlightOptions(s),!h.isVisible)continue;const{highlightName:e}=h;if(e){this.highlightNames.add(e);m(t(i,e,r),h)}e&&e===n||m(a,h)}}needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}}class h extends a{}function o(t){return null!=t.vao}function r(){return new s({allocator:t=>t||new i,deallocator:t=>t})}function m(t,s){const e=t.back();if(null==e){const e=t.pushNew();return e.first=s.from,void(e.count=s.numElements)}if(l(e,s)){const t=s.from-e.first+s.numElements;e.count=t}else{const e=t.pushNew();e.first=s.from,e.count=s.numElements}}function l(t,s){return t.first+t.count>=s.from}export{a as PerBufferData,h as PerVaoData,o as hasVao};
package/views/View.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../core/Accessor.js";import{createTask as r}from"../core/asyncUtils.js";import a from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import o from"../core/Error.js";import n from"../core/Evented.js";import l from"../core/Handles.js";import has from"../core/has.js";import p from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as h,abortMaybe as y}from"../core/maybe.js";import u from"../core/Promise.js";import{after as m}from"../core/promiseUtils.js";import{watch as c,whenOnce as g,when as f,sync as w,syncAndInitial as v}from"../core/reactiveUtils.js";import{property as M}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as V}from"../core/support/OwningCollection.js";import{UpdatingHandles as R}from"../core/support/UpdatingHandles.js";import S from"../geometry/Extent.js";import T from"../geometry/HeightModelInfo.js";import j from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as F}from"../support/AnalysesCollection.js";import{GraphicsCollection as k}from"../support/GraphicsCollection.js";import x from"../time/TimeExtent.js";import{system as b,isTimeZoneValid as L}from"../time/timeZoneUtils.js";import O from"./BasemapView.js";import C from"./LayerViewManager.js";import Z from"./Magnifier.js";import I from"./SelectionManager.js";import H from"./Theme.js";import{ToolViewManager as W}from"./ToolViewManager.js";import{makeDefaultHighlightOptions as D}from"./3d/support/DefaultHighlights.js";import P from"./input/Input.js";import{ViewEvents as q}from"./input/ViewEvents.js";import A from"./navigation/Navigation.js";import{DefaultsFromMap as U}from"./support/DefaultsFromMap.js";import z from"./support/HighlightOptions.js";var G;let N=G=class extends(n.EventedMixin(u.EsriPromiseMixin(i))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.handles=new l,this.updatingHandles=new R,this.highlights=D(),this.allLayerViews=new s({getCollections:()=>[this.basemapView?.baseLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:J}),this.groundView=null,this.basemapView=null,this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new k,this.analyses=new F,this.typeSpecificPreconditionsReady=!0,this.layerViews=new a,this.magnifier=new Z,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.supportsGround=!0,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new P,this.navigation=new A,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new q(this),this.persistableViewModels=new a,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this.theme=null,this.handles.add(c((()=>this.preconditionsReady),(e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,G.views.add(this)):(this._lockedSpatialReference=null,G.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),null!=this.analysisViewManager&&this.analysisViewManager.detach(),this.layerViewManager?.clear(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask((()=>{this.fatalError=new o("startup-error",null,i)}))}null!=this.analysisViewManager&&this.analysisViewManager.attach(),this.toolViewManager.attach()}}),w))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then((()=>(this._isValid=!0,g((()=>this.ready)))))),this.basemapView=new O({view:this}),this.layerViewManager=new C({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new W({view:this}),this.selectionManager=new I({view:this}),this.addHandles([f((()=>"map-content-error"===this.readyState&&!this.spatialReference),(()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),c((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),v),c((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),w),c((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),v)])}destroy(){this.destroyed||(G.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=h(this.graphics),this.analyses=h(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),h(this.analysisViewManager),this.toolViewManager=h(this.toolViewManager),this.layerViewManager=h(this.layerViewManager),this.selectionManager=h(this.selectionManager),this.basemapView=h(this.basemapView),this.groundView?.destroy(),this.layerViews?.forEach((e=>e.destroy())),this.layerViews.length=0,this.invalidate(),this._emitter.clear(),this.handles.destroy(),this.map=h(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new U({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||p.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),p.isLoadable(e)&&e.load().catch((()=>{})),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,i=this.map.basemap?.loaded??!0;return e&&i&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=r((e=>m(has("view-readyState-waiting-delay"),null,e))),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=y(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const e=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(e&&this.defaultsFromMap?.required?.heightModelInfo){const t=e.clone();return t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,t}return e}set spatialReference(e){const t=!E(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??b}set timeZone(e){this._userTimeZone=e,L(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._cursor??"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new H}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}importLayerView(e){throw new o("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(f((()=>this.destroyed||!1===this.preconditionsReady),(()=>this._readyCycleForced=!1),{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};N.views=new a,e([M()],N.prototype,"_userSpatialReference",void 0),e([M({type:a.ofType(z)})],N.prototype,"highlights",void 0),e([M()],N.prototype,"activeTool",null),e([M({readOnly:!0})],N.prototype,"allLayerViews",void 0),e([M()],N.prototype,"groundView",void 0),e([M()],N.prototype,"animation",null),e([M()],N.prototype,"basemapView",void 0),e([M()],N.prototype,"center",null),e([M()],N.prototype,"defaultsFromMapSettings",null),e([M()],N.prototype,"defaultsFromMap",null),e([M()],N.prototype,"displayFilterEnabled",void 0),e([M()],N.prototype,"fatalError",void 0),e([M({type:S})],N.prototype,"extent",null),e([M(V(k,"graphics"))],N.prototype,"graphics",void 0),e([M(V(F,"analyses"))],N.prototype,"analyses",void 0),e([M({readOnly:!0,type:T})],N.prototype,"heightModelInfo",null),e([M({readOnly:!0})],N.prototype,"interacting",null),e([M({readOnly:!0})],N.prototype,"navigating",null),e([M({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],N.prototype,"preconditionsReady",null),e([M({readOnly:!0})],N.prototype,"typeSpecificPreconditionsReady",void 0),e([M({type:a,readOnly:!0})],N.prototype,"layerViews",void 0),e([M()],N.prototype,"resolution",null),e([M({type:Z})],N.prototype,"magnifier",void 0),e([M({value:null,type:t})],N.prototype,"map",null),e([M()],N.prototype,"padding",void 0),e([M({readOnly:!0})],N.prototype,"ready",void 0),e([M()],N.prototype,"_readyStateWaitingTask",void 0),e([M({readOnly:!0})],N.prototype,"readyState",null),e([M({type:j})],N.prototype,"spatialReference",null),e([M()],N.prototype,"stationary",null),e([M({readOnly:!0})],N.prototype,"supportsGround",void 0),e([M({type:x})],N.prototype,"timeExtent",null),e([M({type:String,nonNullable:!0})],N.prototype,"timeZone",null),e([M()],N.prototype,"tools",null),e([M()],N.prototype,"toolViewManager",void 0),e([M({readOnly:!0})],N.prototype,"type",void 0),e([M({type:Number})],N.prototype,"scale",void 0),e([M({readOnly:!0})],N.prototype,"updating",void 0),e([M({readOnly:!0})],N.prototype,"initialExtentRequired",void 0),e([M({readOnly:!0})],N.prototype,"initialExtent",null),e([M()],N.prototype,"cursor",null),e([M({readOnly:!0})],N.prototype,"input",void 0),e([M({type:A,nonNullable:!0})],N.prototype,"navigation",void 0),e([M()],N.prototype,"layerViewManager",void 0),e([M()],N.prototype,"analysisViewManager",void 0),e([M()],N.prototype,"selectionManager",void 0),e([M()],N.prototype,"width",void 0),e([M()],N.prototype,"height",void 0),e([M({readOnly:!0})],N.prototype,"resizing",void 0),e([M({value:null,readOnly:!0})],N.prototype,"size",null),e([M({readOnly:!0})],N.prototype,"suspended",void 0),e([M({readOnly:!0})],N.prototype,"viewEvents",void 0),e([M({readOnly:!0})],N.prototype,"persistableViewModels",void 0),e([M()],N.prototype,"_isValid",void 0),e([M()],N.prototype,"_readyCycleForced",void 0),e([M()],N.prototype,"_lockedSpatialReference",void 0),e([M()],N.prototype,"_userTimeZone",void 0),e([M()],N.prototype,"_lockedTimeZone",void 0),e([M()],N.prototype,"_userTimeExtent",void 0),e([M()],N.prototype,"_lockedTimeExtent",void 0),e([M({type:H})],N.prototype,"theme",void 0),e([M({readOnly:!0,type:H})],N.prototype,"effectiveTheme",null),N=G=e([_("esri.views.View")],N);const $=globalThis.$arcgis;$&&!$.views&&Object.defineProperty($,"views",{configurable:!1,enumerable:!0,writable:!1,value:N.views});const B=N;function J(e){return e.layerViews}export{B as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../core/Accessor.js";import{createTask as r}from"../core/asyncUtils.js";import a from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import o from"../core/Error.js";import n from"../core/Evented.js";import l from"../core/Handles.js";import has from"../core/has.js";import p from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as h,abortMaybe as y}from"../core/maybe.js";import u from"../core/Promise.js";import{after as m}from"../core/promiseUtils.js";import{watch as c,whenOnce as g,when as f,sync as w,syncAndInitial as v}from"../core/reactiveUtils.js";import{property as M}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as V}from"../core/support/OwningCollection.js";import{UpdatingHandles as R}from"../core/support/UpdatingHandles.js";import S from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import T from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as F}from"../support/AnalysesCollection.js";import{GraphicsCollection as k}from"../support/GraphicsCollection.js";import x from"../time/TimeExtent.js";import{system as b,isTimeZoneValid as O}from"../time/timeZoneUtils.js";import L from"./BasemapView.js";import C from"./LayerViewManager.js";import Z from"./Magnifier.js";import I from"./SelectionManager.js";import H from"./Theme.js";import{ToolViewManager as W}from"./ToolViewManager.js";import{makeDefaultHighlightOptions as D}from"./3d/support/DefaultHighlights.js";import q from"./input/Input.js";import{ViewEvents as P}from"./input/ViewEvents.js";import A from"./navigation/Navigation.js";import{DefaultsFromMap as U}from"./support/DefaultsFromMap.js";import z from"./support/HighlightOptions.js";import G from"./support/RequiredFieldsOptions.js";var N;let $=N=class extends(n.EventedMixin(u.EsriPromiseMixin(i))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.handles=new l,this.updatingHandles=new R,this.highlights=D(),this.allLayerViews=new s({getCollections:()=>[this.basemapView?.baseLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:K}),this.groundView=null,this.basemapView=null,this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new k,this.analyses=new F,this.typeSpecificPreconditionsReady=!0,this.layerViews=new a,this.magnifier=new Z,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.supportsGround=!0,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new q,this.navigation=new A,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new P(this),this.persistableViewModels=new a,this.requiredFieldsOptions=new G,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this.theme=null,this.handles.add(c((()=>this.preconditionsReady),(e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,N.views.add(this)):(this._lockedSpatialReference=null,N.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),null!=this.analysisViewManager&&this.analysisViewManager.detach(),this.layerViewManager?.clear(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask((()=>{this.fatalError=new o("startup-error",null,i)}))}null!=this.analysisViewManager&&this.analysisViewManager.attach(),this.toolViewManager.attach()}}),w))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then((()=>(this._isValid=!0,g((()=>this.ready)))))),this.basemapView=new L({view:this}),this.layerViewManager=new C({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new W({view:this}),this.selectionManager=new I({view:this}),this.addHandles([f((()=>"map-content-error"===this.readyState&&!this.spatialReference),(()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),c((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),v),c((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),w),c((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),v)])}destroy(){this.destroyed||(N.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=h(this.graphics),this.analyses=h(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),h(this.analysisViewManager),this.toolViewManager=h(this.toolViewManager),this.layerViewManager=h(this.layerViewManager),this.selectionManager=h(this.selectionManager),this.basemapView=h(this.basemapView),this.groundView?.destroy(),this.layerViews?.forEach((e=>e.destroy())),this.layerViews.length=0,this.invalidate(),this._emitter.clear(),this.handles.destroy(),this.map=h(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new U({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||p.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),p.isLoadable(e)&&e.load().catch((()=>{})),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,i=this.map.basemap?.loaded??!0;return e&&i&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=r((e=>m(has("view-readyState-waiting-delay"),null,e))),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=y(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const e=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(e&&this.defaultsFromMap?.required?.heightModelInfo){const t=e.clone();return t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,t}return e}set spatialReference(e){const t=!E(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??b}set timeZone(e){this._userTimeZone=e,O(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._cursor??"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new H}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}importLayerView(e){throw new o("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(f((()=>this.destroyed||!1===this.preconditionsReady),(()=>this._readyCycleForced=!1),{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};$.views=new a,e([M()],$.prototype,"_userSpatialReference",void 0),e([M({type:a.ofType(z)})],$.prototype,"highlights",void 0),e([M()],$.prototype,"activeTool",null),e([M({readOnly:!0})],$.prototype,"allLayerViews",void 0),e([M()],$.prototype,"groundView",void 0),e([M()],$.prototype,"animation",null),e([M()],$.prototype,"basemapView",void 0),e([M()],$.prototype,"center",null),e([M()],$.prototype,"defaultsFromMapSettings",null),e([M()],$.prototype,"defaultsFromMap",null),e([M()],$.prototype,"displayFilterEnabled",void 0),e([M()],$.prototype,"fatalError",void 0),e([M({type:S})],$.prototype,"extent",null),e([M(V(k,"graphics"))],$.prototype,"graphics",void 0),e([M(V(F,"analyses"))],$.prototype,"analyses",void 0),e([M({readOnly:!0,type:j})],$.prototype,"heightModelInfo",null),e([M({readOnly:!0})],$.prototype,"interacting",null),e([M({readOnly:!0})],$.prototype,"navigating",null),e([M({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],$.prototype,"preconditionsReady",null),e([M({readOnly:!0})],$.prototype,"typeSpecificPreconditionsReady",void 0),e([M({type:a,readOnly:!0})],$.prototype,"layerViews",void 0),e([M()],$.prototype,"resolution",null),e([M({type:Z})],$.prototype,"magnifier",void 0),e([M({value:null,type:t})],$.prototype,"map",null),e([M()],$.prototype,"padding",void 0),e([M({readOnly:!0})],$.prototype,"ready",void 0),e([M()],$.prototype,"_readyStateWaitingTask",void 0),e([M({readOnly:!0})],$.prototype,"readyState",null),e([M({type:T})],$.prototype,"spatialReference",null),e([M()],$.prototype,"stationary",null),e([M({readOnly:!0})],$.prototype,"supportsGround",void 0),e([M({type:x})],$.prototype,"timeExtent",null),e([M({type:String,nonNullable:!0})],$.prototype,"timeZone",null),e([M()],$.prototype,"tools",null),e([M()],$.prototype,"toolViewManager",void 0),e([M({readOnly:!0})],$.prototype,"type",void 0),e([M({type:Number})],$.prototype,"scale",void 0),e([M({readOnly:!0})],$.prototype,"updating",void 0),e([M({readOnly:!0})],$.prototype,"initialExtentRequired",void 0),e([M({readOnly:!0})],$.prototype,"initialExtent",null),e([M()],$.prototype,"cursor",null),e([M({readOnly:!0})],$.prototype,"input",void 0),e([M({type:A,nonNullable:!0})],$.prototype,"navigation",void 0),e([M()],$.prototype,"layerViewManager",void 0),e([M()],$.prototype,"analysisViewManager",void 0),e([M()],$.prototype,"selectionManager",void 0),e([M()],$.prototype,"width",void 0),e([M()],$.prototype,"height",void 0),e([M({readOnly:!0})],$.prototype,"resizing",void 0),e([M({value:null,readOnly:!0})],$.prototype,"size",null),e([M({readOnly:!0})],$.prototype,"suspended",void 0),e([M({readOnly:!0})],$.prototype,"viewEvents",void 0),e([M({readOnly:!0})],$.prototype,"persistableViewModels",void 0),e([M()],$.prototype,"_isValid",void 0),e([M()],$.prototype,"_readyCycleForced",void 0),e([M()],$.prototype,"_lockedSpatialReference",void 0),e([M()],$.prototype,"_userTimeZone",void 0),e([M()],$.prototype,"_lockedTimeZone",void 0),e([M()],$.prototype,"_userTimeExtent",void 0),e([M()],$.prototype,"_lockedTimeExtent",void 0),e([M({type:H})],$.prototype,"theme",void 0),e([M({readOnly:!0,type:H})],$.prototype,"effectiveTheme",null),$=N=e([_("esri.views.View")],$);const B=globalThis.$arcgis;B&&!B.views&&Object.defineProperty(B,"views",{configurable:!1,enumerable:!0,writable:!1,value:$.views});const J=$;function K(e){return e.layerViews}export{J 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import"../../core/has.js";import r from"../../core/Logger.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{watch as l,syncAndInitial as s,on as o}from"../../core/reactiveUtils.js";import{sqlAnd as n}from"../../core/sql.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{systemIsSpatialFieldName as p}from"../../layers/knowledgeGraph/constants.js";import{getEffectiveDisplayFilter as d}from"../../layers/support/displayFilterUtils.js";import f from"../../layers/support/FeatureEffect.js";import y from"../../layers/support/FeatureFilter.js";import{getSignedInUser as c}from"../../layers/support/featureLayerUtils.js";import{fixFields as h,unpackFieldNames as m,collectLabelingFields as F,collectElevationFields as g,collectFilterFields as I,collectFeatureReductionFields as b,collectOrderByInfos as w,collectFields as E,collectTrackInfoFields as v,collectDisplayFilterFields as x,collectField as R,featureHasFields as _}from"../../layers/support/fieldUtils.js";import{getFloorFilterClause as q}from"../../layers/support/floorFilterUtils.js";import j from"../../rest/support/Query.js";import{loadArcade as P}from"../../support/arcadeOnDemand.js";import{getRequiredFields as C,getFetchPopupTemplate as O}from"./support/popupUtils.js";import{WhereClauseVisitor as k}from"./support/WhereClauseVisitor.js";const L=L=>{let U=class extends L{constructor(...e){super(...e),this._updatingRequiredPromise=null,this.filter=null,this.layer=null,this.requiresCurrentUser=!1,this.requiredFields=[],this.view=null}initialize(){this.addHandles([l((()=>{const e=this.layer;return[e&&"elevationInfo"in e?e.elevationInfo?.featureExpressionInfo:null,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,e.displayFilterInfo,this.displayFilterEnabled,this.filter,this.featureEffect,this.timeExtent,"knowledge-graph-sublayer"===e?.type&&"link-chart"===e.parentCompositeLayer.type&&e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode,"parquet"===e?.type&&e.popupTemplate]}),(()=>this._handleChange()),s),o((()=>this.view?.floors),"change",(()=>this._handleChange())),o((()=>this.layer.displayFilterInfo?.filters),"change",(()=>this._handleChange())),o((()=>this.layer&&"sublayers"in this.layer?this.layer.sublayers:null),"change",(()=>this._handleChange()))])}get availableFields(){if(!this.layer)return[];const{layer:e,layer:{fieldsIndex:t},requiredFields:r}=this;return"outFields"in e&&e.outFields?h(t,[...m(t,e.outFields),...r]):h(t,r)}get displayFilterEnabled(){return(this.view?.displayFilterEnabled??!0)&&(!("displayFilterEnabled"in this.layer)||(this.layer?.displayFilterEnabled??!0))}get effectiveDisplayFilter(){const e=this.layer;return this.displayFilterEnabled&&e.displayFilterInfo?d(e.displayFilterInfo,this.view):null}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){r.getLogger(this).error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}get signedInUser(){return this.layer?.url?c(this.layer.url):Promise.resolve(null)}highlight(e,t){throw new Error("missing implementation")}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},t=null!=this.filter?this.filter.createQuery(e):new j(e);return"floorInfo"in this.layer&&this.layer.floorInfo&&(t.where=n(t.where,q(this))),this.displayFilterEnabled&&(t.where=n(t.where,this.effectiveDisplayFilter?.where)),null!=this.timeExtent&&(t.timeExtent=null!=t.timeExtent?t.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),t}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new j(e)}queryFeatures(e,t){throw new Error("missing implementation")}queryObjectIds(e,t){throw new Error("missing implementation")}queryFeatureCount(e,t){throw new Error("missing implementation")}queryExtent(e,t){throw new Error("missing implementation")}async fetchPopupFeaturesFromGraphics(e,t){return this._validateFetchPopupFeatures(e,t),this._fetchPopupFeatures(e,t)}_loadArcadeModules(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some((e=>"expression"===e.type))?P():Promise.resolve()}_handleChange(){const e=Promise.all([this._updateRequiredFields(),this._updateClientWhereClauseRequirements()]).then((()=>{}));return this._set("_updatingRequiredPromise",e),e.then((()=>{this._updatingRequiredPromise===e&&this._set("_updatingRequiredPromise",null)})),e}async _updateClientWhereClauseRequirements(){if(!this.layer||!this.view)return;const{layer:e}=this,t=new k(e.fieldsIndex);if(t.visitFilter(this.filter),"featureReduction"in e&&t.visitFeatureReduction(e.featureReduction),"labelingInfo"in e&&t.visitLabelingInfo(e.labelsVisible,e.labelingInfo),"trackInfo"in e&&t.visitTrackInfo(e.trackInfo),"2d"===this.view.type&&(t.visitFilter(this.featureEffect?.filter),t.visitDisplayFilter(this.displayFilterEnabled,e.displayFilterInfo),"featureReduction"in e&&t.visitFeatureReduction(e.featureReduction)),"subtype-group"===e.type)for(const r of e.sublayers)t.visitLabelingInfo(r.labelsVisible,r.labelingInfo);try{const e=await t.finish();this._set("requiresCurrentUser",e.requiresCurrentUser)}catch(i){r.getLogger(this).error(i)}}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e="3d"===this.view.type,{layer:t,layer:{fieldsIndex:i,objectIdField:l}}=this,s="renderer"in t&&t.renderer,o="orderBy"in t&&t.orderBy,n="featureReduction"in t?t.featureReduction:null,a=new Set,u=[s?s.collectRequiredFields(a,i):null,F(a,t),e&&"elevationInfo"in t?g(a,t):null,null!=this.filter?I(a,t,this.filter):null,e||null==this.featureEffect?null:I(a,t,this.featureEffect.filter),!e&&n?b(a,t,n):null,!e&&o?w(a,t,o):null];if("timeInfo"in t&&t.timeInfo&&this.timeExtent&&E(a,t.fieldsIndex,[t.timeInfo.startField,t.timeInfo.endField]),"timeInfo"in t&&t.timeInfo&&"trackInfo"in t&&t.trackInfo){const{trackInfo:e}=t;E(a,t.fieldsIndex,[t.timeInfo.trackIdField]),"feature"!==t.type&&"startTimeField"!==e.timeField||E(a,t.fieldsIndex,[t.timeInfo.startField]),"endTimeField"===e.timeField&&E(a,t.fieldsIndex,[t.timeInfo.endField]),await v(a,t)}if("floorInfo"in t&&t.floorInfo&&E(a,t.fieldsIndex,[t.floorInfo.floorField]),this.displayFilterEnabled&&u.push(x(a,t,t.displayFilterInfo)),"feature"===t.type&&e&&null!=t.infoFor3D&&(null==t.globalIdField&&r.getLogger(this).error("globalIdField missing on 3DObjectFeatureLayer"),E(a,t.fieldsIndex,[t.globalIdField])),"subtype-group"===t.type){R(a,i,t.subtypeField);const e=t.sublayers.map((e=>Promise.all([e.renderer?.collectRequiredFields(a,i),F(a,e)])));u.push(Promise.all(e))}if("catalog-footprint"===t.type&&t.parent){const e=t.parent;E(a,i,[e.itemNameField,e.itemSourceField,e.itemTypeField,e.maxScaleField,e.minScaleField])}"knowledge-graph-sublayer"===t.type&&"link-chart"===t.parentCompositeLayer.type&&R(a,i,p),"parquet"===t.type&&u.push(C(t,t.popupTemplate).then((e=>{for(const t of e)a.add(t)})));const d=await Promise.allSettled(u);R(a,i,l),e&&"displayField"in t&&t.displayField&&R(a,i,t.displayField);for(const p of d)"rejected"===p.status&&r.getLogger(this).error(p.reason);const f=Array.from(a).sort();this._set("requiredFields",f)}_validateFetchPopupFeatures(e,r){if(null!=r)for(const i of e){const e=i.origin&&"layer"in i.origin?i.origin.layer:i.layer;if("popupEnabled"in e&&!e.popupEnabled)throw new t("featurelayerview:fetchPopupFeatures","Popups are disabled",{layer:e});if(i.isAggregate){const r="featureReduction"in e?e.featureReduction:null,i="trackInfo"in e?e.trackInfo:null;if(null==r&&null==i||null!=r&&(!("popupTemplate"in r)||!r.popupEnabled||!r.popupTemplate)||i?.enabled&&(!("popupTemplate"in i)||!i.popupEnabled||!i.popupTemplate))throw new t("featurelayerview:fetchPopupFeatures","Popups are disabled",{layer:e})}else if("popupTemplate"in e){if(!O(e,r))throw new t("featurelayerview:fetchPopupFeatures","Layer does not define a popup template",{layer:e})}}}_popupFeatureHasRequiredFields(e,t){return _(t,e)}async _fetchPopupFeatures(e,t){const r=new Array(e.length),l=new Map,s=await this._createPopupQuery(e.map((e=>e.origin?.layer??e.layer)),t);for(let o=0;o<e.length;o++){const n=e[o];if(n.isAggregate){r[o]=n;continue}const a=n.origin?.layer??n.layer;if(!a||!("popupEnabled"in a))continue;const u=m(this.layer.fieldsIndex,s.outFields),p=O(a,t);if(null==p)continue;const d=await this._loadArcadeModules(p);i(t);d&&d.arcadeUtils.hasGeometryOperations(p)||!this._popupFeatureHasRequiredFields(n,u)?l.set(n.getObjectId(),{graphic:n,index:o}):r[o]=n}if("stream"===this.layer.type||"parquet"===this.layer.type||0===l.size)return r.filter(Boolean);s.objectIds=Array.from(l.keys());try{const e=await this.layer.queryFeatures(s,t);for(const t of e.features){const{graphic:{geometry:e,origin:i},index:s}=l.get(t.getObjectId());t.geometry||=e,t.origin=i,r[s]=t}}catch{}return r.filter(Boolean)}async _createPopupQuery(e,t){const r=this.layer.createQuery(),l=new Set;let s=!1;const o=e??[this.layer];for(const n of o){if(!("popupEnabled"in n))continue;const e=O(n,t);if(null==e)continue;const r=await this._loadArcadeModules(e);i(t);const o=r&&r.arcadeUtils.hasGeometryOperations(e);s=!("point"!==this.layer.geometryType&&!o);const a=await C(this.layer,e);i(t);for(const t of a)l.add(t)}if(r.returnGeometry=s,r.returnZ=s,r.returnM=s,r.outFields=Array.from(l),r.outSpatialReference=this.view.spatialReference,"floorInfo"in this.layer&&this.layer.floorInfo){const e=q(this);null!=e&&(r.where=r.where?`(${r.where}) AND (${e})`:e)}return r}canResume(){return!!super.canResume()&&(null==this.timeExtent||!this.timeExtent.isEmpty)}getTest(){}get test(){}};return e([a()],U.prototype,"_updatingRequiredPromise",void 0),e([a({readOnly:!0})],U.prototype,"availableFields",null),e([a({readOnly:!0})],U.prototype,"displayFilterEnabled",null),e([a({readOnly:!0})],U.prototype,"effectiveDisplayFilter",null),e([a({type:f})],U.prototype,"featureEffect",null),e([a({type:y})],U.prototype,"filter",void 0),e([a()],U.prototype,"layer",void 0),e([a({type:Number})],U.prototype,"maximumNumberOfFeatures",null),e([a({readOnly:!0,type:Boolean})],U.prototype,"maximumNumberOfFeaturesExceeded",null),e([a()],U.prototype,"requiresCurrentUser",void 0),e([a({readOnly:!0})],U.prototype,"requiredFields",void 0),e([a({readOnly:!0})],U.prototype,"signedInUser",null),e([a()],U.prototype,"suspended",void 0),e([a()],U.prototype,"view",void 0),U=e([u("esri.views.layers.FeatureLayerView")],U),U};export{L as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import"../../core/has.js";import r from"../../core/Logger.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{watch as l,syncAndInitial as s,on as o}from"../../core/reactiveUtils.js";import{sqlAnd as n}from"../../core/sql.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{systemIsSpatialFieldName as p}from"../../layers/knowledgeGraph/constants.js";import{getEffectiveDisplayFilter as d}from"../../layers/support/displayFilterUtils.js";import f from"../../layers/support/FeatureEffect.js";import y from"../../layers/support/FeatureFilter.js";import{getSignedInUser as h}from"../../layers/support/featureLayerUtils.js";import{fixFields as m,unpackFieldNames as c,collectLabelingFields as F,collectElevationFields as g,collectFilterFields as I,collectFeatureReductionFields as w,collectOrderByInfos as b,collectFields as v,collectTrackInfoFields as E,collectDisplayFilterFields as x,collectField as q,featureHasFields as R}from"../../layers/support/fieldUtils.js";import{getFloorFilterClause as _}from"../../layers/support/floorFilterUtils.js";import{getUtilityNetworkFields as j}from"../../networks/support/networkFieldUtils.js";import P from"../../rest/support/Query.js";import{loadArcade as O}from"../../support/arcadeOnDemand.js";import{getRequiredFields as k,getFetchPopupTemplate as C}from"./support/popupUtils.js";import{WhereClauseVisitor as T}from"./support/WhereClauseVisitor.js";const U=U=>{let L=class extends U{constructor(...e){super(...e),this._updatingRequiredPromise=null,this.filter=null,this.layer=null,this.requiresCurrentUser=!1,this.requiredFields=[],this.view=null}initialize(){this.addHandles([l((()=>{const e=this.layer,t=this.view;return[e&&"elevationInfo"in e?e.elevationInfo?.featureExpressionInfo:null,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,t?.requiredFieldsOptions?.featureTitleFields&&e&&"featureTitleFields"in e&&e.featureTitleFields,t?.requiredFieldsOptions?.utilityNetworkFields&&j(t,e),e.displayFilterInfo,this.displayFilterEnabled,this.filter,this.featureEffect,this.timeExtent,"knowledge-graph-sublayer"===e?.type&&"link-chart"===e.parentCompositeLayer.type&&e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode,"parquet"===e?.type&&e.popupTemplate]}),(()=>this._handleChange()),s),o((()=>this.view?.floors),"change",(()=>this._handleChange())),o((()=>this.layer.displayFilterInfo?.filters),"change",(()=>this._handleChange())),o((()=>this.layer&&"sublayers"in this.layer?this.layer.sublayers:null),"change",(()=>this._handleChange()))])}get availableFields(){if(!this.layer)return[];const{layer:e,layer:{fieldsIndex:t},requiredFields:r}=this;return"outFields"in e&&e.outFields?m(t,[...c(t,e.outFields),...r]):m(t,r)}get displayFilterEnabled(){return(this.view?.displayFilterEnabled??!0)&&(!("displayFilterEnabled"in this.layer)||(this.layer?.displayFilterEnabled??!0))}get effectiveDisplayFilter(){const e=this.layer;return this.displayFilterEnabled&&e.displayFilterInfo?d(e.displayFilterInfo,this.view):null}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){r.getLogger(this).error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}get signedInUser(){return this.layer?.url?h(this.layer.url):Promise.resolve(null)}highlight(e,t){throw new Error("missing implementation")}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},t=null!=this.filter?this.filter.createQuery(e):new P(e);return"floorInfo"in this.layer&&this.layer.floorInfo&&(t.where=n(t.where,_(this))),this.displayFilterEnabled&&(t.where=n(t.where,this.effectiveDisplayFilter?.where)),null!=this.timeExtent&&(t.timeExtent=null!=t.timeExtent?t.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),t}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new P(e)}queryFeatures(e,t){throw new Error("missing implementation")}queryObjectIds(e,t){throw new Error("missing implementation")}queryFeatureCount(e,t){throw new Error("missing implementation")}queryExtent(e,t){throw new Error("missing implementation")}async fetchPopupFeaturesFromGraphics(e,t){return this._validateFetchPopupFeatures(e,t),this._fetchPopupFeatures(e,t)}_loadArcadeModules(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some((e=>"expression"===e.type))?O():Promise.resolve()}_handleChange(){const e=Promise.all([this._updateRequiredFields(),this._updateClientWhereClauseRequirements()]).then((()=>{}));return this._set("_updatingRequiredPromise",e),e.then((()=>{this._updatingRequiredPromise===e&&this._set("_updatingRequiredPromise",null)})),e}async _updateClientWhereClauseRequirements(){if(!this.layer||!this.view)return;const{layer:e}=this,t=new T(e.fieldsIndex);if(t.visitFilter(this.filter),"featureReduction"in e&&t.visitFeatureReduction(e.featureReduction),"labelingInfo"in e&&t.visitLabelingInfo(e.labelsVisible,e.labelingInfo),"trackInfo"in e&&t.visitTrackInfo(e.trackInfo),"2d"===this.view.type&&(t.visitFilter(this.featureEffect?.filter),t.visitDisplayFilter(this.displayFilterEnabled,e.displayFilterInfo),"featureReduction"in e&&t.visitFeatureReduction(e.featureReduction)),"subtype-group"===e.type)for(const r of e.sublayers)t.visitLabelingInfo(r.labelsVisible,r.labelingInfo);try{const e=await t.finish();this._set("requiresCurrentUser",e.requiresCurrentUser)}catch(i){r.getLogger(this).error(i)}}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e="3d"===this.view.type,{layer:t,layer:{fieldsIndex:i,objectIdField:l}}=this,s="renderer"in t&&t.renderer,o="orderBy"in t&&t.orderBy,n="featureReduction"in t?t.featureReduction:null,a=new Set,u=[s?s.collectRequiredFields(a,i):null,F(a,t),e&&"elevationInfo"in t?g(a,t):null,null!=this.filter?I(a,t,this.filter):null,e||null==this.featureEffect?null:I(a,t,this.featureEffect.filter),!e&&n?w(a,t,n):null,!e&&o?b(a,t,o):null];if("timeInfo"in t&&t.timeInfo&&this.timeExtent&&v(a,t.fieldsIndex,[t.timeInfo.startField,t.timeInfo.endField]),"timeInfo"in t&&t.timeInfo&&"trackInfo"in t&&t.trackInfo){const{trackInfo:e}=t;v(a,t.fieldsIndex,[t.timeInfo.trackIdField]),"feature"!==t.type&&"startTimeField"!==e.timeField||v(a,t.fieldsIndex,[t.timeInfo.startField]),"endTimeField"===e.timeField&&v(a,t.fieldsIndex,[t.timeInfo.endField]),await E(a,t)}if("floorInfo"in t&&t.floorInfo&&v(a,t.fieldsIndex,[t.floorInfo.floorField]),"featureTitleFields"in t&&this.view?.requiredFieldsOptions?.featureTitleFields&&t.featureTitleFields&&v(a,t.fieldsIndex,t.featureTitleFields),"feature"===t.type&&t.globalIdField&&this.view?.requiredFieldsOptions?.globalIdField&&v(a,t.fieldsIndex,[t.globalIdField]),this.displayFilterEnabled&&u.push(x(a,t,t.displayFilterInfo)),"feature"===t.type&&e&&null!=t.infoFor3D&&(null==t.globalIdField&&r.getLogger(this).error("globalIdField missing on 3DObjectFeatureLayer"),v(a,t.fieldsIndex,[t.globalIdField])),"subtype-group"===t.type){q(a,i,t.subtypeField);const e=t.sublayers.map((e=>Promise.all([e.renderer?.collectRequiredFields(a,i),F(a,e)])));u.push(Promise.all(e))}if("catalog-footprint"===t.type&&t.parent){const e=t.parent;v(a,i,[e.itemNameField,e.itemSourceField,e.itemTypeField,e.maxScaleField,e.minScaleField])}"knowledge-graph-sublayer"===t.type&&"link-chart"===t.parentCompositeLayer.type&&q(a,i,p),"parquet"===t.type&&u.push(k(t,t.popupTemplate).then((e=>{for(const t of e)a.add(t)})));const d=await Promise.allSettled(u);q(a,i,l),e&&"displayField"in t&&t.displayField&&q(a,i,t.displayField);for(const p of d)"rejected"===p.status&&r.getLogger(this).error(p.reason);const f=Array.from(a).sort();this._set("requiredFields",f)}_validateFetchPopupFeatures(e,r){if(null!=r)for(const i of e){const e=i.origin&&"layer"in i.origin?i.origin.layer:i.layer;if("popupEnabled"in e&&!e.popupEnabled)throw new t("featurelayerview:fetchPopupFeatures","Popups are disabled",{layer:e});if(i.isAggregate){const r="featureReduction"in e?e.featureReduction:null,i="trackInfo"in e?e.trackInfo:null;if(null==r&&null==i||null!=r&&(!("popupTemplate"in r)||!r.popupEnabled||!r.popupTemplate)||i?.enabled&&(!("popupTemplate"in i)||!i.popupEnabled||!i.popupTemplate))throw new t("featurelayerview:fetchPopupFeatures","Popups are disabled",{layer:e})}else if("popupTemplate"in e){if(!C(e,r))throw new t("featurelayerview:fetchPopupFeatures","Layer does not define a popup template",{layer:e})}}}_popupFeatureHasRequiredFields(e,t){return R(t,e)}async _fetchPopupFeatures(e,t){const r=new Array(e.length),l=new Map,s=await this._createPopupQuery(e.map((e=>e.origin?.layer??e.layer)),t);for(let o=0;o<e.length;o++){const n=e[o];if(n.isAggregate){r[o]=n;continue}const a=n.origin?.layer??n.layer;if(!a||!("popupEnabled"in a))continue;const u=c(this.layer.fieldsIndex,s.outFields),p=C(a,t);if(null==p)continue;const d=await this._loadArcadeModules(p);i(t);d&&d.arcadeUtils.hasGeometryOperations(p)||!this._popupFeatureHasRequiredFields(n,u)?l.set(n.getObjectId(),{graphic:n,index:o}):r[o]=n}if("stream"===this.layer.type||"parquet"===this.layer.type||0===l.size)return r.filter(Boolean);s.objectIds=Array.from(l.keys());try{const e=await this.layer.queryFeatures(s,t);for(const t of e.features){const{graphic:{geometry:e,origin:i},index:s}=l.get(t.getObjectId());t.geometry||=e,t.origin=i,r[s]=t}}catch{}return r.filter(Boolean)}async _createPopupQuery(e,t){const r=this.layer.createQuery(),l=new Set;let s=!1;const o=e??[this.layer];for(const n of o){if(!("popupEnabled"in n))continue;const e=C(n,t);if(null==e)continue;const r=await this._loadArcadeModules(e);i(t);const o=r&&r.arcadeUtils.hasGeometryOperations(e);s=!("point"!==this.layer.geometryType&&!o);const a=await k(this.layer,e);i(t);for(const t of a)l.add(t)}if(r.returnGeometry=s,r.returnZ=s,r.returnM=s,r.outFields=Array.from(l),r.outSpatialReference=this.view.spatialReference,"floorInfo"in this.layer&&this.layer.floorInfo){const e=_(this);null!=e&&(r.where=r.where?`(${r.where}) AND (${e})`:e)}return r}canResume(){return!!super.canResume()&&(null==this.timeExtent||!this.timeExtent.isEmpty)}getTest(){}get test(){}};return e([a()],L.prototype,"_updatingRequiredPromise",void 0),e([a({readOnly:!0})],L.prototype,"availableFields",null),e([a({readOnly:!0})],L.prototype,"displayFilterEnabled",null),e([a({readOnly:!0})],L.prototype,"effectiveDisplayFilter",null),e([a({type:f})],L.prototype,"featureEffect",null),e([a({type:y})],L.prototype,"filter",void 0),e([a()],L.prototype,"layer",void 0),e([a({type:Number})],L.prototype,"maximumNumberOfFeatures",null),e([a({readOnly:!0,type:Boolean})],L.prototype,"maximumNumberOfFeaturesExceeded",null),e([a()],L.prototype,"requiresCurrentUser",void 0),e([a({readOnly:!0})],L.prototype,"requiredFields",void 0),e([a({readOnly:!0})],L.prototype,"signedInUser",null),e([a()],L.prototype,"suspended",void 0),e([a()],L.prototype,"view",void 0),L=e([u("esri.views.layers.FeatureLayerView")],L),L};export{U as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let t=class extends r{constructor(o){super(o),this.featureTitleFields=!1,this.utilityNetworkFields=!1,this.globalIdField=!1}};o([e()],t.prototype,"featureTitleFields",void 0),o([e()],t.prototype,"utilityNetworkFields",void 0),o([e()],t.prototype,"globalIdField",void 0),t=o([s("esri.views.support.RequiredFieldsOptions")],t);const i=t;export{i 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{when as s}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{getBasemapThumbnailUrl as r,isBasemap3D as o,isBasemapInBeta as l}from"../support/basemapUtils.js";import n from"./Widget.js";import d from"./BasemapGallery/BasemapGalleryViewModel.js";import{css as p}from"./BasemapGallery/css.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import{Heading as h}from"./support/Heading.js";import{accessibleHandler as u}from"./support/decorators/accessibleHandler.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as v}from"./support/jsxFactory.js";import"./support/widgetUtils.js";let b=class extends n{constructor(e,t){super(e,t),this.disabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new d,this._focusBasemapItemEnabled=!1}initialize(){this.addHandles(s((()=>this.source),(()=>this.viewModel.loadSource()),{sync:!0,initial:!0}))}loadDependencies(){return m({scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip")})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get icon(){return"basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="loading"===this.source.state,t=this.disabled||"disabled"===this.viewModel.state,s={[p.sourceLoading]:e,[c.disabled]:t};return v("div",{class:this.classes(p.base,c.widget,c.panel,s),key:"container"},this._getContext())}_getContext(){if("unsupported"===this.viewModel.state)return v("div",{class:c.empty,key:"empty-message"},v(h,{level:this.headingLevel},this.messages.unsupported));if("loading"===this.source.state)return v("div",{class:p.loader,key:"loader"});const e=this.viewModel.items;return e.length>0?v("ul",{"aria-disabled":this.disabled,"aria-label":this.label,bind:this,class:p.itemContainer,key:"item-container",onkeydown:this._handleKeyDown,role:"radiogroup"},e.map(((e,t)=>this._renderBasemapGalleryItem(e,t))).toArray()):v("div",{class:c.empty,key:"empty-message"},v(h,{level:this.headingLevel},this.messages.noBasemaps))}_getRoundRobinIndex(e,t){return(e+t)%t}_handleKeyDown(e){const{key:t}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t))return;e.preventDefault();const{items:s,activeBasemapIndex:a}=this.viewModel,i="ArrowUp"===t||"ArrowLeft"===t?this._getRoundRobinIndex(Math.max(a-1,-1),s.length):this._getRoundRobinIndex(a+1,s.length),r=s.at(i);"ready"===r?.state&&(this.viewModel.activeBasemap=r.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&0===e.tabIndex&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const t=e.currentTarget["data-item"];"ready"===t.state&&(this.viewModel.activeBasemap=t.basemap)}_renderBasemapGalleryItem(e,s){const a=r(e.basemap)||t("esri/themes/base/images/basemap-toggle-64.svg"),i=e.basemap.title,l=e.basemap.portalItem?.snippet,n=e.error?.message||l||i,{viewModel:{state:d,activeBasemapIndex:m}}=this,h=this.disabled||"disabled"===d,u=m===s,g=u||-1===m&&0===s?0:-1,b="loading"===d,y={[p.selectedItem]:u,[p.itemError]:"error"===e.state},w=`basemapgallery-item-${e.uid}`;return v("li",{afterUpdate:this._focusBasemapItem,"aria-checked":u.toString(),"aria-disabled":h.toString(),"aria-labelledby":w,bind:this,class:this.classes(p.item,y),"data-item":e,key:e.uid,onclick:this._handleClick,onkeydown:this._handleClick,role:"radio",tabIndex:g,title:n},v("img",{alt:"",class:p.itemThumbnail,src:a}),v("div",{class:p.itemContent,key:"content"},v("div",{class:p.itemTitle,key:"title"},v("span",{id:w},i)),o(e.basemap)?this._renderTags(e.basemap):null),"loading"===e.state||u&&b?v("calcite-scrim",null,v("span",{"aria-hidden":"true",class:c.loaderAnimation,key:"loader",role:"presentation"})):null)}_renderTags(e){return v("div",{class:p.itemTagsContainer,key:"tag"},this._render3DTag(),l(e)?this._renderBetaTag():null)}_render3DTag(){const{messages:e}=this;return v("calcite-chip",{key:"tag-3d",label:e.tag3D,scale:"s"},this.messages.tag3D)}_renderBetaTag(){const{messages:e}=this;return v("calcite-chip",{appearance:"outline-fill",key:"tag-beta",label:e.tagBeta,scale:"s"},this.messages.tagBeta)}};e([a()],b.prototype,"activeBasemap",null),e([a()],b.prototype,"disabled",void 0),e([a()],b.prototype,"headingLevel",void 0),e([a()],b.prototype,"icon",null),e([a()],b.prototype,"label",null),e([a(),g("esri/widgets/BasemapGallery/t9n/BasemapGallery")],b.prototype,"messages",void 0),e([a()],b.prototype,"source",null),e([a()],b.prototype,"view",null),e([a()],b.prototype,"viewModel",void 0),e([a()],b.prototype,"_focusBasemapItemEnabled",void 0),e([u()],b.prototype,"_handleClick",null),b=e([i("esri.widgets.BasemapGallery")],b);const y=b;export{y as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as s}from"../assets.js";import{deprecateWidget as t}from"../core/deprecate.js";import a from"../core/Logger.js";import{when as i}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{getBasemapThumbnailUrl as l,isBasemap3D as n,isBasemapInBeta as d}from"../support/basemapUtils.js";import p from"./Widget.js";import m from"./BasemapGallery/BasemapGalleryViewModel.js";import{css as c}from"./BasemapGallery/css.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as g}from"./support/Heading.js";import{accessibleHandler as v}from"./support/decorators/accessibleHandler.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{tsx as y}from"./support/jsxFactory.js";import"./support/widgetUtils.js";let w=class extends p{constructor(e,s){super(e,s),this.disabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new m,this._focusBasemapItemEnabled=!1,t(a.getLogger(this),"Basemap Gallery","arcgis-basemap-gallery",{version:"4.32"})}initialize(){this.addHandles(i((()=>this.source),(()=>this.viewModel.loadSource()),{sync:!0,initial:!0}))}loadDependencies(){return h({scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip")})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get icon(){return"basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="loading"===this.source.state,s=this.disabled||"disabled"===this.viewModel.state,t={[c.sourceLoading]:e,[u.disabled]:s};return y("div",{class:this.classes(c.base,u.widget,u.panel,t),key:"container"},this._getContext())}_getContext(){if("unsupported"===this.viewModel.state)return y("div",{class:u.empty,key:"empty-message"},y(g,{level:this.headingLevel},this.messages.unsupported));if("loading"===this.source.state)return y("div",{class:c.loader,key:"loader"});const e=this.viewModel.items;return e.length>0?y("ul",{"aria-disabled":this.disabled,"aria-label":this.label,bind:this,class:c.itemContainer,key:"item-container",onkeydown:this._handleKeyDown,role:"radiogroup"},e.map(((e,s)=>this._renderBasemapGalleryItem(e,s))).toArray()):y("div",{class:u.empty,key:"empty-message"},y(g,{level:this.headingLevel},this.messages.noBasemaps))}_getRoundRobinIndex(e,s){return(e+s)%s}_handleKeyDown(e){const{key:s}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(s))return;e.preventDefault();const{items:t,activeBasemapIndex:a}=this.viewModel,i="ArrowUp"===s||"ArrowLeft"===s?this._getRoundRobinIndex(Math.max(a-1,-1),t.length):this._getRoundRobinIndex(a+1,t.length),r=t.at(i);"ready"===r?.state&&(this.viewModel.activeBasemap=r.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&0===e.tabIndex&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const s=e.currentTarget["data-item"];"ready"===s.state&&(this.viewModel.activeBasemap=s.basemap)}_renderBasemapGalleryItem(e,t){const a=l(e.basemap)||s("esri/themes/base/images/basemap-toggle-64.svg"),i=e.basemap.title,r=e.basemap.portalItem?.snippet,o=e.error?.message||r||i,{viewModel:{state:d,activeBasemapIndex:p}}=this,m=this.disabled||"disabled"===d,h=p===t,g=h||-1===p&&0===t?0:-1,v="loading"===d,b={[c.selectedItem]:h,[c.itemError]:"error"===e.state},w=`basemapgallery-item-${e.uid}`;return y("li",{afterUpdate:this._focusBasemapItem,"aria-checked":h.toString(),"aria-disabled":m.toString(),"aria-labelledby":w,bind:this,class:this.classes(c.item,b),"data-item":e,key:e.uid,onclick:this._handleClick,onkeydown:this._handleClick,role:"radio",tabIndex:g,title:o},y("img",{alt:"",class:c.itemThumbnail,src:a}),y("div",{class:c.itemContent,key:"content"},y("div",{class:c.itemTitle,key:"title"},y("span",{id:w},i)),n(e.basemap)?this._renderTags(e.basemap):null),"loading"===e.state||h&&v?y("calcite-scrim",null,y("span",{"aria-hidden":"true",class:u.loaderAnimation,key:"loader",role:"presentation"})):null)}_renderTags(e){return y("div",{class:c.itemTagsContainer,key:"tag"},this._render3DTag(),d(e)?this._renderBetaTag():null)}_render3DTag(){const{messages:e}=this;return y("calcite-chip",{key:"tag-3d",label:e.tag3D,scale:"s"},this.messages.tag3D)}_renderBetaTag(){const{messages:e}=this;return y("calcite-chip",{appearance:"outline-fill",key:"tag-beta",label:e.tagBeta,scale:"s"},this.messages.tagBeta)}};e([r()],w.prototype,"activeBasemap",null),e([r()],w.prototype,"disabled",void 0),e([r()],w.prototype,"headingLevel",void 0),e([r()],w.prototype,"icon",null),e([r()],w.prototype,"label",null),e([r(),b("esri/widgets/BasemapGallery/t9n/BasemapGallery")],w.prototype,"messages",void 0),e([r()],w.prototype,"source",null),e([r()],w.prototype,"view",null),e([r()],w.prototype,"viewModel",void 0),e([r()],w.prototype,"_focusBasemapItemEnabled",void 0),e([v()],w.prototype,"_handleClick",null),w=e([o("esri.widgets.BasemapGallery")],w);const f=w;export{f 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{cast as s}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{getBasemapThumbnailUrl as o}from"../support/basemapUtils.js";import a from"./Widget.js";import l from"./BasemapToggle/BasemapToggleViewModel.js";import{css as r}from"./BasemapToggle/css.js";import{loadCalciteComponents as n}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import{tsx as m}from"./support/jsxFactory.js";function d(e){const t=o(e);return t?{backgroundImage:"url("+t+")"}:{backgroundImage:""}}const u={title:!1};let g=class extends a{constructor(e,t){super(e,t),this.messages=null,this.viewModel=new l,this.visibleElements={...u},this.toggle=()=>this.viewModel.toggle()}loadDependencies(){return n({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim")})}get activeBasemap(){return this.viewModel.activeBasemap}get icon(){return"layer-basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get nextBasemap(){return this.viewModel.nextBasemap}set nextBasemap(e){this.viewModel.nextBasemap=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...u,...e}}render(){const e=this.viewModel,t="disabled"===e.state?null:e.activeBasemap,s="disabled"===e.state?null:e.nextBasemap,i="loading"===e.state,o="incompatible-next-basemap"===e.state,a=s?.title??"",l=s&&"loaded"!==s.loadStatus;let n;const p=this.visibleElements.title&&a,u=o;return(p||u)&&(n=m("div",{class:r.overlay,key:"overlay"},p?m("span",{class:r.title,title:a},a):null,u?m("calcite-scrim",{class:r.overlayScrim,title:this.messages.incompatibleSpatialReference},m("calcite-icon",{icon:"exclamation-mark-triangle"})):null)),m("div",{class:this.classes(r.base,c.widget)},m("calcite-button",{appearance:"transparent","data-basemap-id":s?s.id:"",disabled:o,kind:"neutral",label:this.label,onclick:()=>{this.toggle()},title:this.label},m("div",{class:this.classes(r.container,r.secondaryBasemapImage)},m("div",{class:r.image,styles:d(t)})),m("div",{class:r.container},m("div",{class:this.classes(r.image,l?r.imageLoading:null),styles:d(s)},l||i?m("calcite-scrim",null,m("span",{"aria-hidden":"true",class:c.loaderAnimation,role:"presentation"})):null),n)))}};e([t({readOnly:!0})],g.prototype,"activeBasemap",null),e([t()],g.prototype,"icon",null),e([t()],g.prototype,"label",null),e([t(),p("esri/widgets/BasemapToggle/t9n/BasemapToggle")],g.prototype,"messages",void 0),e([t()],g.prototype,"nextBasemap",null),e([t()],g.prototype,"view",null),e([t({type:l})],g.prototype,"viewModel",void 0),e([t()],g.prototype,"visibleElements",void 0),e([s("visibleElements")],g.prototype,"castVisibleElements",null),g=e([i("esri.widgets.BasemapToggle")],g);const v=g;export{v as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{cast as i}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{getBasemapThumbnailUrl as l}from"../support/basemapUtils.js";import r from"./Widget.js";import n from"./BasemapToggle/BasemapToggleViewModel.js";import{css as c}from"./BasemapToggle/css.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as d}from"./support/decorators/messageBundle.js";import{tsx as g}from"./support/jsxFactory.js";function u(e){const t=l(e);return t?{backgroundImage:"url("+t+")"}:{backgroundImage:""}}const v={title:!1};let b=class extends r{constructor(e,o){super(e,o),this.messages=null,this.viewModel=new n,this.visibleElements={...v},this.toggle=()=>this.viewModel.toggle(),t(s.getLogger(this),"Basemap Toggle","arcgis-basemap-toggle",{version:"4.32"})}loadDependencies(){return p({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim")})}get activeBasemap(){return this.viewModel.activeBasemap}get icon(){return"layer-basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get nextBasemap(){return this.viewModel.nextBasemap}set nextBasemap(e){this.viewModel.nextBasemap=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...v,...e}}render(){const e=this.viewModel,t="disabled"===e.state?null:e.activeBasemap,s="disabled"===e.state?null:e.nextBasemap,o="loading"===e.state,i="incompatible-next-basemap"===e.state,a=s?.title??"",l=s&&"loaded"!==s.loadStatus;let r;const n=this.visibleElements.title&&a,p=i;return(n||p)&&(r=g("div",{class:c.overlay,key:"overlay"},n?g("span",{class:c.title,title:a},a):null,p?g("calcite-scrim",{class:c.overlayScrim,title:this.messages.incompatibleSpatialReference},g("calcite-icon",{icon:"exclamation-mark-triangle"})):null)),g("div",{class:this.classes(c.base,m.widget)},g("calcite-button",{appearance:"transparent","data-basemap-id":s?s.id:"",disabled:i,kind:"neutral",label:this.label,onclick:()=>{this.toggle()},title:this.label},g("div",{class:this.classes(c.container,c.secondaryBasemapImage)},g("div",{class:c.image,styles:u(t)})),g("div",{class:c.container},g("div",{class:this.classes(c.image,l?c.imageLoading:null),styles:u(s)},l||o?g("calcite-scrim",null,g("span",{"aria-hidden":"true",class:m.loaderAnimation,role:"presentation"})):null),r)))}};e([o({readOnly:!0})],b.prototype,"activeBasemap",null),e([o()],b.prototype,"icon",null),e([o()],b.prototype,"label",null),e([o(),d("esri/widgets/BasemapToggle/t9n/BasemapToggle")],b.prototype,"messages",void 0),e([o()],b.prototype,"nextBasemap",null),e([o()],b.prototype,"view",null),e([o({type:n})],b.prototype,"viewModel",void 0),e([o()],b.prototype,"visibleElements",void 0),e([i("visibleElements")],b.prototype,"castVisibleElements",null),b=e([a("esri.widgets.BasemapToggle")],b);const h=b;export{h 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Viewpoint.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Evented.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{SlideThumbnail as c}from"../../webdoc/support/SlideThumbnail.js";import p from"../../webmap/Bookmark.js";import l from"../support/GoTo.js";const m=o.ofType(p),u={width:128,height:128,format:"png"},k={takeScreenshot:!0,captureViewpoint:!0,captureRotation:!0,captureScale:!0,captureTimeExtent:!0},w={time:!0};let d=class extends(l(a.EventedAccessor)){constructor(t){super(t),this.capabilities={...w},this.activeBookmark=null,this.view=null}destroy(){this.view=null,this._set("activeBookmark",null)}castCapabilities(t){return{...w,...t}}get bookmarks(){return this.view?.map?.bookmarks??new m}set bookmarks(t){this._overrideIfSome("bookmarks",t)}set defaultCreateOptions(t){this._set("defaultCreateOptions",{...k,...t})}get defaultCreateOptions(){return k}set defaultEditOptions(t){this._set("defaultEditOptions",{...k,...t})}get defaultEditOptions(){return k}get state(){const{view:t}=this;return t&&!t.ready?"loading":"ready"}async createBookmark(t){const{view:e,defaultCreateOptions:o,capabilities:a}=this;if(!e)throw new i("create-bookmark:invalid-view","Cannot create a bookmark without a view.");const{takeScreenshot:r,screenshotSettings:n,captureViewpoint:s,captureRotation:c,captureScale:l,captureTimeExtent:m}={...o,...t},u=r?await this._createThumbnail(n):void 0,k=a.time&&m&&null!=e.timeExtent?e.timeExtent.clone():void 0;return new p({...u&&{thumbnail:u},...m&&{timeExtent:k},...s&&{viewpoint:this._createViewpoint({view:e,captureScale:l,captureRotation:c})}})}async editBookmark(t,e){if(!t)return t;const{view:o,defaultEditOptions:a}=this;if(!o)throw new i("edit-bookmark:invalid-view","Cannot edit a bookmark without a view.");const{takeScreenshot:r,screenshotSettings:n,captureViewpoint:s,captureRotation:c,captureScale:p,captureTimeExtent:l}={...a,...e},m=r?await this._createThumbnail(n):void 0;return m&&(t.thumbnail=m),s&&(t.viewpoint=this._createViewpoint({view:o,captureScale:p,captureRotation:c})),l&&null!=o.timeExtent&&(t.timeExtent=o.timeExtent.clone()),this.emit("bookmark-edit",{bookmark:t}),t}goTo(t){const{capabilities:e,view:o}=this;if(!o)throw new i("go-to:invalid-view","Cannot go to a bookmark without a view");const a=t?.viewpoint;if(!a)throw new i("go-to:invalid-bookmark","Cannot go to a bookmark that does not contain a 'viewpoint'.",{bookmark:t});this._set("activeBookmark",t);const r={target:a},n=this.callGoTo(r),s=t?.timeExtent;return e.time&&s&&(o.timeExtent=s),this.emit("bookmark-select",{bookmark:t}),n.catch((()=>{})).then((()=>this._set("activeBookmark",null))),n}async _createThumbnail(t){const{view:e}=this;if(!e)throw new i("bookmark:invalid-view","Cannot create slide thumbnail without a view");const o=await e.takeScreenshot({...u,...t});return new c({url:o.dataUrl})}_createViewpoint({view:t,captureRotation:o,captureScale:i}){const a=t.viewpoint?.clone();return new e({targetGeometry:t.extent?.clone(),rotation:(o?a?.rotation:null)??0,scale:(i?a?.scale:null)??0})}};t([r()],d.prototype,"capabilities",void 0),t([n("capabilities")],d.prototype,"castCapabilities",null),t([r({readOnly:!0})],d.prototype,"activeBookmark",void 0),t([r({type:m})],d.prototype,"bookmarks",null),t([r()],d.prototype,"defaultCreateOptions",null),t([r()],d.prototype,"defaultEditOptions",null),t([r({readOnly:!0})],d.prototype,"state",null),t([r()],d.prototype,"view",void 0),d=t([s("esri.widgets.Bookmarks.BookmarksViewModel")],d);const h=d;export{h as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Viewpoint.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Evented.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{SlideThumbnail as c}from"../../webdoc/support/SlideThumbnail.js";import p from"../../webmap/Bookmark.js";import l from"../support/GoTo.js";const m=o.ofType(p),u={width:128,height:128,format:"png"},k={takeScreenshot:!0,captureViewpoint:!0,captureRotation:!0,captureScale:!0,captureTimeExtent:!0},w={time:!0};let d=class extends(l(a.EventedAccessor)){constructor(t){super(t),this.capabilities={...w},this.activeBookmark=null,this.view=null}destroy(){this.view=null,this._set("activeBookmark",null)}castCapabilities(t){return{...w,...t}}get bookmarks(){return this.view?.map?.bookmarks??new m}set bookmarks(t){this._overrideIfSome("bookmarks",t)}set defaultCreateOptions(t){this._set("defaultCreateOptions",{...k,...t})}get defaultCreateOptions(){return k}set defaultEditOptions(t){this._set("defaultEditOptions",{...k,...t})}get defaultEditOptions(){return k}get state(){const{view:t}=this;return t&&!t.ready?"loading":"ready"}async createBookmark(t){const{view:e,defaultCreateOptions:o,capabilities:a}=this;if(!e)throw new i("create-bookmark:invalid-view","Cannot create a bookmark without a view.");const{takeScreenshot:r,screenshotSettings:n,captureViewpoint:s,captureRotation:c,captureScale:l,captureTimeExtent:m}={...o,...t},u=r?await this._createThumbnail(n):void 0,k=a.time&&m&&null!=e.timeExtent?e.timeExtent.clone():void 0;return new p({...u&&{thumbnail:u},...m&&{timeExtent:k},...s&&{viewpoint:this._createViewpoint({view:e,captureScale:l,captureRotation:c})}})}async editBookmark(t,e){if(!t)return t;const{view:o,defaultEditOptions:a}=this;if(!o)throw new i("edit-bookmark:invalid-view","Cannot edit a bookmark without a view.");const{takeScreenshot:r,screenshotSettings:n,captureViewpoint:s,captureRotation:c,captureScale:p,captureTimeExtent:l}={...a,...e},m=r?await this._createThumbnail(n):void 0;return m&&(t.thumbnail=m),s&&(t.viewpoint=this._createViewpoint({view:o,captureScale:p,captureRotation:c})),l&&null!=o.timeExtent&&(t.timeExtent=o.timeExtent.clone()),this.emit("bookmark-edit",{bookmark:t}),t}goTo(t){const{capabilities:e,view:o}=this;if(!o)throw new i("go-to:invalid-view","Cannot go to a bookmark without a view");const a=t?.viewpoint;if(!a)throw new i("go-to:invalid-bookmark","Cannot go to a bookmark that does not contain a 'viewpoint'.",{bookmark:t});this._set("activeBookmark",t);const r=this.callGoTo({target:a}),n=t?.timeExtent;return e.time&&n&&(o.timeExtent=n),this.emit("bookmark-select",{bookmark:t}),r.catch((()=>{})).then((()=>this._set("activeBookmark",null))),r}async _createThumbnail(t){const{view:e}=this;if(!e)throw new i("bookmark:invalid-view","Cannot create slide thumbnail without a view");const o=await e.takeScreenshot({...u,...t});return new c({url:o.dataUrl})}_createViewpoint({view:t,captureRotation:o,captureScale:i}){const a=t.viewpoint?.clone();return new e({targetGeometry:t.extent?.clone(),rotation:(o?a?.rotation:null)??0,scale:(i?a?.scale:null)??0})}};t([r()],d.prototype,"capabilities",void 0),t([n("capabilities")],d.prototype,"castCapabilities",null),t([r({readOnly:!0})],d.prototype,"activeBookmark",void 0),t([r({type:m})],d.prototype,"bookmarks",null),t([r()],d.prototype,"defaultCreateOptions",null),t([r()],d.prototype,"defaultEditOptions",null),t([r({readOnly:!0})],d.prototype,"state",null),t([r()],d.prototype,"view",void 0),d=t([s("esri.widgets.Bookmarks.BookmarksViewModel")],d);const h=d;export{h 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{watch as e,initial as i}from"../../core/reactiveUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{getGoToDuration as a}from"../../views/2d/navigation/duration.js";import{canShowNorth as n}from"./utils.js";import d from"../support/GoTo.js";let p=class extends(d(o)){constructor(t){super(t),this.orientation={x:0,y:0,z:0},this.view=null,this._updateForCamera=this._updateForCamera.bind(this),this._updateForRotation=this._updateForRotation.bind(this),this._updateRotationWatcher=this._updateRotationWatcher.bind(this)}initialize(){this.addHandles(e((()=>this.view),this._updateRotationWatcher,i))}destroy(){this.view=null}get canShowNorth(){return n(this.view)}get state(){return!this.view?.ready||"2d"===this.view.type&&!this.view.constraints.rotationEnabled?"disabled":this.canShowNorth?"compass":"rotation"}reset(){this.view?.ready&&("2d"===this.view?.type?this.callGoTo({target:{rotation:0},options:{animationMode:"always",duration:a()}}):this.callGoTo({target:{heading:0}}))}_updateForRotation(t){null!=t&&this._set("orientation",{z:t})}_updateForCamera(t){if(!t)return;const o=-t.heading;this._set("orientation",{x:0,y:0,z:o})}_updateRotationWatcher(t){this.removeAllHandles(),t&&this.addHandles("2d"===t.type?e((()=>t?.rotation),this._updateForRotation,i):e((()=>t?.camera),this._updateForCamera,i))}};t([r({readOnly:!0})],p.prototype,"canShowNorth",null),t([r({readOnly:!0})],p.prototype,"orientation",void 0),t([r({readOnly:!0})],p.prototype,"state",null),t([r()],p.prototype,"view",void 0),p=t([s("esri.widgets.Compass.CompassViewModel")],p);const h=p;export{h as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{initial as i,watch as e}from"../../core/reactiveUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{getGoToDuration as s}from"../../views/2d/navigation/duration.js";import{canShowNorth as n}from"./utils.js";import d from"../support/GoTo.js";let h=class extends(d(o)){constructor(t){super(t),this.orientation={x:0,y:0,z:0},this.view=null,this._updateForCamera=this._updateForCamera.bind(this),this._updateForRotation=this._updateForRotation.bind(this),this._updateRotationWatcher=this._updateRotationWatcher.bind(this)}initialize(){this._watchForView(i)}destroy(){this.view=null}get canShowNorth(){return n(this.view)}get state(){return!this.view?.ready||"2d"===this.view.type&&!this.view.constraints.rotationEnabled?"disabled":this.canShowNorth?"compass":"rotation"}reset(){this.view?.ready&&("2d"===this.view?.type?this.callGoTo({target:{rotation:0},options:{animationMode:"always",duration:s()}}):this.callGoTo({target:{heading:0}}))}_updateForRotation(t){null!=t&&this._set("orientation",{z:t})}_updateForCamera(t){if(!t)return;const o=-t.heading;this._set("orientation",{x:0,y:0,z:o})}_updateRotationWatcher(t){this.removeAllHandles(),this._watchForView(),t&&this.addHandles("2d"===t.type?e((()=>t?.rotation),this._updateForRotation,i):e((()=>t?.camera),this._updateForCamera,i))}_watchForView(t){this.addHandles(e((()=>this.view),this._updateRotationWatcher,t))}};t([r({readOnly:!0})],h.prototype,"canShowNorth",null),t([r({readOnly:!0})],h.prototype,"orientation",void 0),t([r({readOnly:!0})],h.prototype,"state",null),t([r()],h.prototype,"view",void 0),h=t([a("esri.widgets.Compass.CompassViewModel")],h);const p=h;export{p as default};