@arcgis/core 4.31.0-next.20240712 → 4.31.0-next.20240713
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.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/192f64e12728626372ab.js +1 -0
- package/assets/esri/core/workers/chunks/1dc7a3a7fc39fd3060f4.js +1 -0
- package/assets/esri/core/workers/chunks/{0928dfb82b92a7b4c377.js → 2d92a9db4a300cdbc7fd.js} +1 -1
- package/assets/esri/core/workers/chunks/{53a07f99b34a4fce6175.js → 69e432e24f581aa08ce3.js} +1 -1
- package/assets/esri/core/workers/chunks/{e487369636b6cb21528d.js → 89b9332f052d11df6a71.js} +1 -1
- package/assets/esri/core/workers/chunks/{f4d63feb971fe1fdc4be.js → 8d9bc39077d8261df151.js} +1 -1
- package/assets/esri/core/workers/chunks/a30f52f903d5e87f5401.js +1 -0
- package/assets/esri/core/workers/chunks/{56ff916e894207779993.js → b6be871be5ac97d13288.js} +1 -1
- package/assets/esri/core/workers/chunks/{a4da52df90974695d9a2.js → bff4b67cbb1a9eaf1f0b.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b3b0c00cc6a4408fc49.js → cdbb209cf240e8bc29f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{15574dbf40b7b93d47ef.js → e070bcd8e69ce3efb8fd.js} +1 -1
- package/assets/esri/libs/linkchartlayout/lclayout.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/interfaces.d.ts +0 -7
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +5 -0
- package/package.json +1 -1
- package/rest/knowledgeGraph/wasmInterface/WasmClientDataInterfaces.js +5 -0
- package/rest/knowledgeGraph/wasmInterface/clientDataToWasmEncodedFactories.js +5 -0
- package/rest/knowledgeGraph/wasmInterface/wasmToClientDataFactories.js +5 -0
- package/rest/knowledgeGraph/wasmInterface/wasmUtils.js +5 -0
- package/rest/knowledgeGraphService.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/support/HighlightDefault.js +5 -0
- package/views/3d/support/HighlightOptions.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/support/HighlightDefaults.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/support/listUtils.js +5 -0
- package/assets/esri/core/workers/chunks/17c37078ab65f8d4046b.js +0 -1
- package/assets/esri/core/workers/chunks/3de4fe7458b7844e2aae.js +0 -1
- package/assets/esri/core/workers/chunks/482f7dfc9486a283a529.js +0 -1
- package/views/3d/support/HighlightOptionsBase.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{throwIfAborted as d}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as _,initial as u,sync as p}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as f,invert as g,multiply as b}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as A}from"../../../../chunks/vec42.js";import{fromValues as P,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as S}from"../../../../chunks/boundedPlane.js";import{InternalRenderCategory as C,RenderCategory as w}from"../../webgl.js";import{debugFlags as O}from"../../support/debugFlags.js";import{TransparencyMode as y}from"../../terrain/TransparencyMode.js";import{DepthFormat as I,ColorFormat as D}from"../../webgl/formats.js";import{FBOCache as N,defaultWebGLFBO as x}from"../core/FBOCache.js";import{RenderPassManager as M}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as H}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as v}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as F}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as q}from"../effects/RenderPlugin.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as G}from"../effects/blit/Blit.js";import{AnimationTimeStep as j}from"./AnimationTimeStep.js";import{Decorations as V,RenderRequestType as B,StencilBits as Q}from"./basicInterfaces.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{zero as z,union as W}from"./depthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as Y}from"./MainFramebuffer.js";import{RenderOccludedFlag as J}from"./Material.js";import{RenderContext as K,defaultRenderOccludedMask as $}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as Z,RendererTarget as ee}from"./rendererUtils.js";import{setupFeatureDefaults as te,RenderFeature as re}from"./RenderFeature.js";import{RenderPluginInput as se}from"./RenderPluginInput.js";import{RenderSlot as ie}from"./RenderSlot.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne,SnapshotSlot as he}from"./ShadowMap.js";import oe from"./SliceHelper.js";import{TransparencyPassType as de}from"./TransparencyPassType.js";import{Transparency as le}from"./edgeRendering/interfaces.js";import{MergedRenderer as _e}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ue}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as pe}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as ce,PerformanceCategory as me}from"../statistics/RendererPerformanceInfo.js";import{RenderState as fe}from"../../../support/RenderState.js";import{DepthStencilAttachment as ge,PixelFormat as be,PixelType as Te,FramebufferBit as Ee,TextureType as Ae,ColorAttachment as Pe}from"../../../webgl/enums.js";class Re{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._renderers=new Map,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=P(0,0,0,1),this._sliceHelper=new oe,this._blit=null,this._state=c(fe.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=y.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new j,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new se,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new N(i),this._renderStateFeatures=c(te(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new Y(this.fboCache),this.performanceInfo=new ce(this._rctx),this._shadowMap=new ne(this.fboCache,e.viewingMode),this._shadowAccumulator=new ae(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(H.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new K(this._rctx,this._shadowMap,this._sliceHelper,this._framebuffer),this._nodes=new F(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new M,this._plugins.add(this.renderPassManager),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),_),l((()=>O.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(le.TRANSPARENT):()=>{},n()}),u),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):R;A(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),_),l((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=L}),_)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=a(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=n(this._blit),k.prune()}get _bindParameters(){return this._renderContext.bindParameters}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=te(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(re.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(re.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(H.Highlight,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL,ie.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(re.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(re.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(re.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth),this._pluginInput.release("highlight mix")}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");d(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this._stage.view.resourceController)});return this._handles.push(l((()=>r.updating),(()=>this._requestRender()),p)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}getMaterialRenderer(e){return this._renderers.get(e)}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;Z(e).forEach(((r,s)=>{if(t.done)return;let i=this._renderers.get(s);null==i&&r.adds.length>0&&(i=new _e({material:s}),i.initializeRenderContext(this._plugins._context),this._plugins.add(i),this._renderers.set(s,i)),i&&(i.modify(r),0===i.numGeometries&&(this._renderers.delete(i.material),this._plugins.remove(i),i.destroy())),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),this.updateHasFlags(),this._requestRender()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(H.Color,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),has.water=this._plugins.produces(H.Normal,ie.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ee.Default,s=V.ON){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return{screen:this._pluginInput.get("final-color"),oid:null}}_render(e,t,r=ee.Default,s=V.ON){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===ee.Default,this._disposeBindBuffers();const i=this._framebuffer,{camera:a,contentCamera:n,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(me.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=de.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED);const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),u=S(this._sliceHelper.plane);s===V.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=i.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===V.ON;const c=this._plugins.produces(H.Color,ie.OPAQUE_TERRAIN)&&(this._terrainTransparency===y.Transparent||this._terrainTransparency===y.InvisibleWithDraped),m=this._highQualityTransparency&&c,f=this._plugins.produces(H.Color,...Oe);this._prepareShaders(m,f),this.performanceInfo.advance(me.PREPARE);const g=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,g),this._ensureBindParametersCamera(a,n);let b=this._renderNormals();this._pluginInput.set("normals",b);const T=this._needsDepth;if(b){let e=null;T&&(e=b.getAttachment(ge),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(T,e),b=null}else this._renderAllGeometryDepth(T);this._renderShadowAccumulation(g,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=H.Color,i.bind(),this._bindParameters.mainDepth=i.depth.attachment;const E=this.plugins.produces(H.Color,...we);E&&this._renderOpaqueGeometry(),i.update((e=>this._renderNodes(w.OPAQUE,e,E))),this.fboCache.debugCallback?.("opaque-color",i.color.fbo),this._renderPlugins(ie.OPAQUE_ENVIRONMENT,me.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(m),this._setMultipassTerrain(m),this._renderEdges(le.OPAQUE),i.bind(),this._renderPlugins(ie.VOXEL,me.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(Se.Geometry):this._renderTransparentMaterial()),i.update((e=>this._renderNodes(w.TRANSPARENT,e,f))),this.fboCache.debugCallback?.("transparent-color",i.color.fbo),this._renderMultipassGeometryDepth(m),this._renderHUDVisibility(),m||this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS);const A=r===ee.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(le.TRANSPARENT);const P=c?this._renderTransparentTerrain():null;P&&(this.performanceInfo.advance(me.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(v.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,P.getTexture())),this._renderHUD(v.Occluded,i.color))),this._setTerrainCulling(!1),P&&(i.bind(),this._compositingHelper.composite(this._bindParameters,P.getTexture(),ue.PremultipliedAlpha),P.release(),m&&(this._renderEdges(le.OPAQUE),f&&(this._oitEnabled?this._renderOITPass(Se.Geometry):this._renderTransparentMaterial(),this.performanceInfo.advance(me.TRANSPARENT)),this._renderEdges(le.TRANSPARENT))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(v.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),i.update((e=>this._renderNodes(C.VIEWSHED,e))),i.update((e=>this._renderNodes(C.LASERLINES,e))),this._renderOccluded(),this._pluginInput.set("highlights",this._renderHighlightPrepass()),i.update((e=>this._renderNodes(w.COMPOSITE,e)));const R=this._nodes.produces("aa-color"),O=!(r!==ee.Default||_||l&&s===V.ON&&r===ee.Default),I=this._pluginInput.get("composite-color"),D=O?x:this.fboCache.acquire(I.fbo.width,I.fbo.height,"aa-color"),N=R?this._renderNodes(C.ANTIALIASING,D):this._blitFBO(I,D,!1);this._pluginInput.set(C.ANTIALIASING,N),this._renderHUD(v.NotOccluded,N);const M=this._renderNodes(C.HIGHLIGHTS,N),L=this._renderNodes(C.MAGNIFIER,M);return l&&s===V.ON&&r===ee.Default&&!_&&this._blitFBO(L),_?(L.attachDepth(i.depth),this._blitFBO(this._renderNodes(w.FINAL,L)),L.detachDepth()):this._pluginInput.set(w.FINAL,L),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),i.release(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ee.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:A}}_prepareShaders(e,t){this._renderContext.output=H.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ie.LINE_CALLOUTS),t&&this._prepareTransparencySlots(),this._plugins.prepare(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"oid");return r.acquireDepth(I.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(H.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=v.NotOccluded,this._plugins.render(this._pluginInput,ie.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(me.OBJECT_AND_LAYER_ID_COLOR),r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===B.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0,s=t?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer([0,0,0,0]),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],be.RGBA,Te.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,be.RGBA,Te.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"edges"),i=()=>t.render(this._bindParameters,e),a=this._bindParameters.multipassGeometry.depth;this.renderToTargets(i,s,a??this._framebuffer.depth,Ce),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),ue.Alpha),s.release(),this.performanceInfo.advance(e===le.OPAQUE?me.OPAQUE_EDGES:me.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(re.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(H.ShadowHighlight,this._shadowMap),s.moveSnapshot(he.Highlight),this._renderShadowCascades(H.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(he.ExcludeHighlight),this._renderShadowCascades(H.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(H.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(me.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this._renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(H.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e,t){if(!e||!t)return void(this._bindParameters.depth=h(this._bindParameters.depth));const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"depth");s.attachDepth(t),t.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(H.Depth),h(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(me.DEPTH)}_renderAllGeometryDepth(e){if(!e)return void(this._bindParameters.depth=h(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth").acquireDepth(I.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(H.Depth),h(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(me.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=H.Depth;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(I.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=s.obtainDepthTexture(),this._renderContext.output=t,s.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"geometry depth").acquireDepth(I.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(H.Depth),this._renderContext.output=t,h(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return z;const t=X(e,this._plugins.plugins,this._stage.layers);return W(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color","laserline-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"normals",D.RGBA);s.acquireDepth(I.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderGeometryForSSAO(H.Normal);const i=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color","viewshed-color");return s.retain(t+i-1),this.performanceInfo.advance(me.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();x.setName("ssao");const t=this._nodes.render(x,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(me.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}renderAllGeometryForShadowMap(e,t){const{camera:r,contentCamera:s}=this._bindParameters;t.setGLViewport(this._rctx),this._ensureBindParametersCamera(t,t),this._renderAllGeometry(e),this._ensureBindParametersCamera(r,s),this._bindParameters.camera.setGLViewport(this._rctx)}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.OPAQUE_NO_SSAO_DEPTH,ie.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...we,ie.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...we)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...Oe)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ie.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ie.TRANSPARENT_TERRAIN);if(e!==H.Color)return void t();const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"transparent terrain");return this.renderToTargets(t,s,this._framebuffer.depth,[0,0,0,0]),s}_renderHUDVisibility(){if(this._plugins.produces(this._renderContext.output,ie.OCCLUSION_PIXELS)){const e=()=>{const e=this._framebufferSize;let t=this._bindParameters.hudVisibility;const r=this._bindParameters.multipassGeometry.depth;return t?.fbo?.width===e.width&&t?.fbo?.height===e.height||(t?.release(),t=this.fboCache.acquire(e.width,e.height,"hud visibility",D.RGBA4)),t.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ie.OCCLUSION_PIXELS),t.detachDepth(),t};this._bindParameters.hudVisibility=e(),this._framebuffer.bind(),this.performanceInfo.advance(me.HUD_VISIBILITY)}else this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===v.Occluded){const e=()=>this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(I.DEPTH16_BUFFER,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS)}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(Se.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),ue.PremultipliedAlpha),r.release()}else if(e===v.Occluded){this._renderContext.output=H.Color;const t=()=>this._renderHUDElements(e),r=this._framebufferSize,s=this.fboCache.acquireDepth(I.DEPTH16_BUFFER,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._renderContext.output=H.Color,t.acquireDepth(I.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===v.Occluded?me.HUD_OCCLUDED:me.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(H.ShadowHighlight,ie.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,s=this._framebufferSize;let i=this._pluginInput.get("highlight mix");null==i&&(i=e.acquire(s.width,s.height,"highlight mix",D.RGBA),this._pluginInput.set("highlight mix",i),r.highlightTexture=i.getTexture()),t.bindFramebuffer(i.fbo);const a=[0,0,0,0];t.clearFramebuffer(a);const n=i.getTexture(),h=e.acquire(s.width,s.height,"highlights",D.RGBA);h.acquireDepth(I.DEPTH16_BUFFER),t.bindFramebuffer(h.fbo),t.clearFramebuffer(a,!0);const{highlightOrder:o}=this._stage.view,d=Math.min(16,o.length),{highlightGroupMap:l}=r;l.clear();for(let _=0;_<d;++_){const e=o.at(_);e&&l.set(e,_)}for(let _=0;_<d;++_)r.highlightLevel=_,r.highlightGroup=o.at(_),t.bindFramebuffer(h.fbo),t.clearFramebuffer(void 0,!0),this._renderAllGeometry(H.Highlight),0===_&&(t.clear(Ee.DEPTH),this._renderHUDElements(v.Both)),t.clear(Ee.DEPTH),t.bindTexture(n,0),t.gl.copyTexImage2D(Ae.TEXTURE_2D,0,be.RGBA,0,0,s.width,s.height,0);return h}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(me.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(){this._renderContext.output=H.Color,this._bindParameters.transparencyPassType=de.ColorAlpha,this._plugins.prepare(...Oe),this._bindParameters.transparencyPassType=de.FrontFace,this._plugins.prepare(...Oe),this._bindParameters.transparencyPassType=de.NONE,this._techniques.acquire(pe).release()}_renderOITPass(e,t=v.Both){const r=e===Se.HUD,s=this._framebufferSize,i=r?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentMaterial(),n=this._renderContext.output;return this._renderContext.output=H.Color,this._renderOIT(this._bindParameters,a,i),this._renderContext.output=n,i}_renderOIT(e,t,r){const s=this._framebufferSize;e.transparencyPassType=de.ColorAlpha;const i=r?"oit hud color alpha":"oit color alpha",a=this.fboCache.acquire(s.width,s.height,i,D.RGBA16F);a.acquireColor(Pe.COLOR_ATTACHMENT1,D.R16F),r||a.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(a.fbo),this._rctx.clearFramebuffer([0,0,0,1]),t(),a.detachDepth(),e.transparencyPassType=de.FrontFace;const n=this.fboCache.acquire(s.width,s.height,r?"oit hud front":"oit front");r?n.acquireDepth(I.DEPTH16_BUFFER):n.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(n.fbo),this._rctx.clearFramebuffer([0,0,0,0],!!r),t(),n.detachDepth(),e.transparencyPassType=de.NONE,r?(this._rctx.bindFramebuffer(r.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Ee.COLOR)):this._framebuffer.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Pe.COLOR_ATTACHMENT1),n.getTexture()),r?.detachDepth(),n.release(),a.release()}_renderOccluded(){let e=0;ye.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;t.queryRenderOccludedState(J.OccludeAndTransparentStencil)&&(e|=J.OccludeAndTransparentStencil,ye.push(t))}));const t=this._framebuffer,r=(r,s,i,a,n)=>{if(!(e&s))return;const h=this._framebufferSize,o=this.fboCache.acquire(h.width,h.height,"tmp color");let d;d=a?this.fboCache.acquireDepth(I.DEPTH_STENCIL_TEXTURE,h.width,h.height,"tmp depth"):t.depth,this.renderToTargets(i,o,d,[0,0,0,0],a,n),t.bind(),this._compositingHelper.composite(this._bindParameters,o.getTexture(),ue.PremultipliedAlpha,r),a&&d.release(),o.release()},s=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(q(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==ye.length&&(s(ie.OCCLUDER_MATERIAL,ye),r(.5,J.OccludeAndTransparentStencil,(()=>s(ie.TRANSPARENT_OCCLUDER_MATERIAL,ye)),!1,!1));const i=ye.length>0;ye.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;const r=t.queryRenderOccludedState(J.OccludeAndTransparent),s=t.queryRenderOccludedState(J.Transparent),i=t.queryRenderOccludedState(J.Opaque);(r||s||i)&&(e|=r?J.OccludeAndTransparent:s?J.Transparent:J.Opaque,ye.push(t))}));const a=this._plugins.renderOccludedFlags;if(e|=a,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,a>J.Occlude&&this._plugins.render(this._pluginInput,ie.OCCLUDED_TERRAIN),s(ie.OPAQUE_MATERIAL,ye),s(ie.TRANSPARENT_MATERIAL,ye),s(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ye),this._renderContext.renderOccludedMask=$};this._renderContext.output=H.Color,r(.5,J.OccludeAndTransparent,(()=>n(J.OccludeAndTransparent)),!0,Q.OutlineVisualElementMask),r(.5,J.Transparent,(()=>n(J.Transparent)),!0,Q.OutlineVisualElementMask),r(1,J.Opaque,(()=>n(J.Opaque)),!0,Q.OutlineVisualElementMask),(i||ye.length>0)&&this.performanceInfo.advance(me.OCCLUDED),ye.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._framebuffer.bind(),this._plugins.render(this._pluginInput,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(me.TRANSPARENT_ENVIRONMENT)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;t.setName(e),this._pluginInput.set(e,t);const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitFBO(e,t=x,r=!0){return this._blit??=new G(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(g(De,this._bindParameters.camera.viewMatrix),g(Ie,this._bindParameters.camera.projectionMatrix),b(Ne,De,Ie),b(Ne,this._renderContext.lastFrameCamera.viewMatrix,Ne),b(Ne,this._renderContext.lastFrameCamera.projectionMatrix,Ne),this._reprojectionMatrix=Ne);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}}var Se;e([m({readOnly:!0})],Re.prototype,"fullResolutionAtmosphere",null),e([m()],Re.prototype,"_edgeView",void 0),e([m()],Re.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Se||(Se={}));const Ce=[0,0,0,0],we=[ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.OPAQUE_NO_SSAO_DEPTH],Oe=[ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH],ye=new o,Ie=E(),De=E(),Ne=E();function xe(e){return t=>e.immediate.schedule(t)}export{Re as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as i}from"../../../../core/mathUtils.js";import{removeMaybe as a,abortMaybe as n,destroyMaybe as h,releaseMaybe as o}from"../../../../core/maybe.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as g,invert as b,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as E,create as A}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as P}from"../../../../chunks/vec42.js";import{fromValues as R,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as C}from"../../../../chunks/boundedPlane.js";import{InternalRenderCategory as w,RenderCategory as O}from"../../webgl.js";import{debugFlags as y}from"../../support/debugFlags.js";import{TransparencyMode as I}from"../../terrain/TransparencyMode.js";import{DepthFormat as D,ColorFormat as N}from"../../webgl/formats.js";import{FBOCache as x,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as L}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as F}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as U}from"../effects/RenderPlugin.js";import{RenderPluginManager as j}from"../effects/RenderPluginManager.js";import{Blit as G}from"../effects/blit/Blit.js";import{AnimationTimeStep as V}from"./AnimationTimeStep.js";import{Decorations as B,RenderRequestType as Q,StencilBits as k}from"./basicInterfaces.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{zero as W,union as X}from"./depthRange.js";import{depthRangeFromScene as Y}from"./depthRangeUtils.js";import{MainFramebuffer as J}from"./MainFramebuffer.js";import{RenderOccludedFlag as K}from"./Material.js";import{RenderContext as $,defaultRenderOccludedMask as Z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as ee,RendererTarget as te}from"./rendererUtils.js";import{setupFeatureDefaults as re,RenderFeature as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{RenderSlot as ae}from"./RenderSlot.js";import{ShadowAccumulator as ne}from"./ShadowAccumulator.js";import{ShadowMap as he,SnapshotSlot as oe}from"./ShadowMap.js";import de from"./SliceHelper.js";import{TransparencyPassType as le}from"./TransparencyPassType.js";import{Transparency as _e}from"./edgeRendering/interfaces.js";import{MergedRenderer as ue}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as pe}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as ce}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as me,PerformanceCategory as fe}from"../statistics/RendererPerformanceInfo.js";import{defaultHighlightName as ge}from"../../../support/HighlightDefaults.js";import{RenderState as be}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as Ee,PixelType as Ae,FramebufferBit as Pe,TextureType as Re,ColorAttachment as Se}from"../../../webgl/enums.js";class Ce{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._renderers=new Map,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=R(0,0,0,1),this._sliceHelper=new de,this._blit=null,this._state=m(be.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=I.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new V,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new x(i),this._renderStateFeatures=m(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new J(this.fboCache),this.performanceInfo=new me(this._rctx),this._shadowMap=new he(this.fboCache,e.viewingMode),this._shadowAccumulator=new ne(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(v.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new $(this._rctx,this._shadowMap,this._sliceHelper,this._framebuffer),this._nodes=new q(this._renderContext),this._plugins=new j({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new H,this._plugins.add(this.renderPassManager),this._handles=[_((()=>this._stage.view.state.camera),(()=>n()),u),_((()=>y.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),p),_((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):S;P(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=F}),u)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=a(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=n(this._loadEdgeViewTask),this._edgeView=h(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=h(this._blit),z.prune()}get _bindParameters(){return this._renderContext.bindParameters}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(se.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(se.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(v.Highlight,ae.OPAQUE_MATERIAL,ae.TRANSPARENT_MATERIAL,ae.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(se.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(se.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(se.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=o(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth),this._pluginInput.release("highlight mix")}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=o(this._bindParameters.depth),this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:He(this._stage.view.resourceController)});return this._handles.push(_((()=>r.updating),(()=>this._requestRender()),c)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}getMaterialRenderer(e){return this._renderers.get(e)}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;ee(e).forEach(((r,s)=>{if(t.done)return;let i=this._renderers.get(s);null==i&&r.adds.length>0&&(i=new ue({material:s}),i.initializeRenderContext(this._plugins._context),this._plugins.add(i),this._renderers.set(s,i)),i&&(i.modify(r),0===i.numGeometries&&(this._renderers.delete(i.material),this._plugins.remove(i),i.destroy())),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),this.updateHasFlags(),this._requestRender()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(v.Color,ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL),has.water=this._plugins.produces(v.Normal,ae.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?a(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=te.Default,s=B.ON){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return{screen:this._pluginInput.get("final-color"),oid:null}}_render(e,t,r=te.Default,s=B.ON){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===te.Default,this._disposeBindBuffers();const i=this._framebuffer,{camera:a,contentCamera:n,mode:h,alignPixelEnabled:d}=e;this._state.value=h,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=le.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._nodes.produces(w.VIEWSHED);const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),u=C(this._sliceHelper.plane);s===B.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=i.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===B.ON;const c=this._plugins.produces(v.Color,ae.OPAQUE_TERRAIN)&&(this._terrainTransparency===I.Transparent||this._terrainTransparency===I.InvisibleWithDraped),m=this._highQualityTransparency&&c,f=this._plugins.produces(v.Color,...Ie);this._prepareShaders(m,f),this.performanceInfo.advance(fe.PREPARE);const g=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,g),this._ensureBindParametersCamera(a,n);let b=this._renderNormals();this._pluginInput.set("normals",b);const T=this._needsDepth;if(b){let e=null;T&&(e=b.getAttachment(Te),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(T,e),b=null}else this._renderAllGeometryDepth(T);this._renderShadowAccumulation(g,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=v.Color,i.bind(),this._bindParameters.mainDepth=i.depth.attachment;const E=this.plugins.produces(v.Color,...ye);E&&this._renderOpaqueGeometry(),i.update((e=>this._renderNodes(O.OPAQUE,e,E))),this.fboCache.debugCallback?.("opaque-color",i.color.fbo),this._renderPlugins(ae.OPAQUE_ENVIRONMENT,fe.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(m),this._setMultipassTerrain(m),this._renderEdges(_e.OPAQUE),i.bind(),this._renderPlugins(ae.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(we.Geometry):this._renderTransparentMaterial()),i.update((e=>this._renderNodes(O.TRANSPARENT,e,f))),this.fboCache.debugCallback?.("transparent-color",i.color.fbo),this._renderMultipassGeometryDepth(m),this._renderHUDVisibility(),m||this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS);const A=r===te.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const P=c?this._renderTransparentTerrain():null;P&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(L.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,P.getTexture())),this._renderHUD(L.Occluded,i.color))),this._setTerrainCulling(!1),P&&(i.bind(),this._compositingHelper.composite(this._bindParameters,P.getTexture(),pe.PremultipliedAlpha),P.release(),m&&(this._renderEdges(_e.OPAQUE),f&&(this._oitEnabled?this._renderOITPass(we.Geometry):this._renderTransparentMaterial(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=o(this._bindParameters.ssao),m&&this._renderLineCallouts(L.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),i.update((e=>this._renderNodes(w.VIEWSHED,e))),i.update((e=>this._renderNodes(w.LASERLINES,e))),this._renderOccluded(),this._pluginInput.set("highlights",this._renderHighlightPrepass()),i.update((e=>this._renderNodes(O.COMPOSITE,e)));const R=this._nodes.produces("aa-color"),S=!(r!==te.Default||_||l&&s===B.ON&&r===te.Default),y=this._pluginInput.get("composite-color"),D=S?M:this.fboCache.acquire(y.fbo.width,y.fbo.height,"aa-color"),N=R?this._renderNodes(w.ANTIALIASING,D):this._blitFBO(y,D,!1);this._pluginInput.set(w.ANTIALIASING,N),this._renderHUD(L.NotOccluded,N);const x=this._renderNodes(w.HIGHLIGHTS,N),H=this._renderNodes(w.MAGNIFIER,x);return l&&s===B.ON&&r===te.Default&&!_&&this._blitFBO(H),_?(H.attachDepth(i.depth),this._blitFBO(this._renderNodes(O.FINAL,H)),H.detachDepth()):this._pluginInput.set(O.FINAL,H),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),i.release(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==te.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:A}}_prepareShaders(e,t){this._renderContext.output=v.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ae.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ae.LINE_CALLOUTS),t&&this._prepareTransparencySlots(),this._plugins.prepare(ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ae.TRANSPARENT_ENVIRONMENT),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"oid");return r.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(v.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=L.NotOccluded,this._plugins.render(this._pluginInput,ae.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(fe.OBJECT_AND_LAYER_ID_COLOR),r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Q.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0,s=t?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer([0,0,0,0]),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],Ee.RGBA,Ae.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,Ee.RGBA,Ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"edges"),i=()=>t.render(this._bindParameters,e),a=this._bindParameters.multipassGeometry.depth;this.renderToTargets(i,s,a??this._framebuffer.depth,Oe),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),pe.Alpha),s.release(),this.performanceInfo.advance(e===_e.OPAQUE?fe.OPAQUE_EDGES:fe.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(se.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),s.moveSnapshot(oe.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(oe.ExcludeHighlight),this._renderShadowCascades(v.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(v.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(fe.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this._renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(v.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e,t){if(!e||!t)return void(this._bindParameters.depth=o(this._bindParameters.depth));const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"depth");s.attachDepth(t),t.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(e){if(!e)return void(this._bindParameters.depth=o(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(fe.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=v.Depth;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=s.obtainDepthTexture(),this._renderContext.output=t,s.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"geometry depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(v.Depth),this._renderContext.output=t,o(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const t=Y(e,this._plugins.plugins,this._stage.layers);return X(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color","laserline-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"normals",N.RGBA);s.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderGeometryForSSAO(v.Normal);const i=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color","viewshed-color");return s.retain(t+i-1),this.performanceInfo.advance(fe.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName("ssao");const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ae.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}renderAllGeometryForShadowMap(e,t){const{camera:r,contentCamera:s}=this._bindParameters;t.setGLViewport(this._rctx),this._ensureBindParametersCamera(t,t),this._renderAllGeometry(e),this._ensureBindParametersCamera(r,s),this._bindParameters.camera.setGLViewport(this._rctx)}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ae.TRANSPARENT_MATERIAL,ae.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ae.INTEGRATED_MESH,ae.OPAQUE_TERRAIN,ae.OPAQUE_MATERIAL,ae.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ae.OPAQUE_NO_SSAO_DEPTH,ae.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...ye,ae.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...ye)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ae.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ae.TRANSPARENT_TERRAIN);if(e!==v.Color)return void t();const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"transparent terrain");return this.renderToTargets(t,s,this._framebuffer.depth,[0,0,0,0]),s}_renderHUDVisibility(){if(this._plugins.produces(this._renderContext.output,ae.OCCLUSION_PIXELS)){const e=()=>{const e=this._framebufferSize;let t=this._bindParameters.hudVisibility;const r=this._bindParameters.multipassGeometry.depth;return t?.fbo?.width===e.width&&t?.fbo?.height===e.height||(t?.release(),t=this.fboCache.acquire(e.width,e.height,"hud visibility",N.RGBA4)),t.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ae.OCCLUSION_PIXELS),t.detachDepth(),t};this._bindParameters.hudVisibility=e(),this._framebuffer.bind(),this.performanceInfo.advance(fe.HUD_VISIBILITY)}else this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===L.Occluded){const e=()=>this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS)}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(we.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),pe.PremultipliedAlpha),r.release()}else if(e===L.Occluded){this._renderContext.output=v.Color;const t=()=>this._renderHUDElements(e),r=this._framebufferSize,s=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._renderContext.output=v.Color,t.acquireDepth(D.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===L.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(v.ShadowHighlight,ae.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,s=this._framebufferSize;let a=this._pluginInput.get("highlight mix");null==a&&(a=e.acquire(s.width,s.height,"highlight mix",N.RGBA),this._pluginInput.set("highlight mix",a),r.highlightTexture=a.getTexture()),t.bindFramebuffer(a.fbo);const n=[0,0,0,0];t.clearFramebuffer(n);const h=a.getTexture(),o=e.acquire(s.width,s.height,"highlights",N.RGBA);o.acquireDepth(D.DEPTH16_BUFFER),t.bindFramebuffer(o.fbo),t.clearFramebuffer(n,!0);const{highlights:d}=this._stage.view,l=i(d.length,1,16),{highlightGroupMap:_}=r;_.clear(),_.set(ge,0);for(let i=1;i<l;++i){const e=d.at(i-1)?.name;e&&_.set(e,i)}for(let i=0;i<l;++i)r.highlightLevel=i,r.highlightGroup=0===i?ge:d.at(i-1).name,t.bindFramebuffer(o.fbo),t.clearFramebuffer(void 0,!0),this._renderAllGeometry(v.Highlight),0===i&&(t.clear(Pe.DEPTH),this._renderHUDElements(L.Both)),t.clear(Pe.DEPTH),t.bindTexture(h,0),t.gl.copyTexImage2D(Re.TEXTURE_2D,0,Ee.RGBA,0,0,s.width,s.height,0);return o}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(fe.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(){this._renderContext.output=v.Color,this._bindParameters.transparencyPassType=le.ColorAlpha,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=le.FrontFace,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=le.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t=L.Both){const r=e===we.HUD,s=this._framebufferSize,i=r?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentMaterial(),n=this._renderContext.output;return this._renderContext.output=v.Color,this._renderOIT(this._bindParameters,a,i),this._renderContext.output=n,i}_renderOIT(e,t,r){const s=this._framebufferSize;e.transparencyPassType=le.ColorAlpha;const i=r?"oit hud color alpha":"oit color alpha",a=this.fboCache.acquire(s.width,s.height,i,N.RGBA16F);a.acquireColor(Se.COLOR_ATTACHMENT1,N.R16F),r||a.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(a.fbo),this._rctx.clearFramebuffer([0,0,0,1]),t(),a.detachDepth(),e.transparencyPassType=le.FrontFace;const n=this.fboCache.acquire(s.width,s.height,r?"oit hud front":"oit front");r?n.acquireDepth(D.DEPTH16_BUFFER):n.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(n.fbo),this._rctx.clearFramebuffer([0,0,0,0],!!r),t(),n.detachDepth(),e.transparencyPassType=le.NONE,r?(this._rctx.bindFramebuffer(r.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Pe.COLOR)):this._framebuffer.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Se.COLOR_ATTACHMENT1),n.getTexture()),r?.detachDepth(),n.release(),a.release()}_renderOccluded(){let e=0;De.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;t.queryRenderOccludedState(K.OccludeAndTransparentStencil)&&(e|=K.OccludeAndTransparentStencil,De.push(t))}));const t=this._framebuffer,r=(r,s,i,a,n)=>{if(!(e&s))return;const h=this._framebufferSize,o=this.fboCache.acquire(h.width,h.height,"tmp color");let d;d=a?this.fboCache.acquireDepth(D.DEPTH_STENCIL_TEXTURE,h.width,h.height,"tmp depth"):t.depth,this.renderToTargets(i,o,d,[0,0,0,0],a,n),t.bind(),this._compositingHelper.composite(this._bindParameters,o.getTexture(),pe.PremultipliedAlpha,r),a&&d.release(),o.release()},s=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(U(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==De.length&&(s(ae.OCCLUDER_MATERIAL,De),r(.5,K.OccludeAndTransparentStencil,(()=>s(ae.TRANSPARENT_OCCLUDER_MATERIAL,De)),!1,!1));const i=De.length>0;De.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;const r=t.queryRenderOccludedState(K.OccludeAndTransparent),s=t.queryRenderOccludedState(K.Transparent),i=t.queryRenderOccludedState(K.Opaque);(r||s||i)&&(e|=r?K.OccludeAndTransparent:s?K.Transparent:K.Opaque,De.push(t))}));const a=this._plugins.renderOccludedFlags;if(e|=a,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,a>K.Occlude&&this._plugins.render(this._pluginInput,ae.OCCLUDED_TERRAIN),s(ae.OPAQUE_MATERIAL,De),s(ae.TRANSPARENT_MATERIAL,De),s(ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,De),this._renderContext.renderOccludedMask=Z};this._renderContext.output=v.Color,r(.5,K.OccludeAndTransparent,(()=>n(K.OccludeAndTransparent)),!0,k.OutlineVisualElementMask),r(.5,K.Transparent,(()=>n(K.Transparent)),!0,k.OutlineVisualElementMask),r(1,K.Opaque,(()=>n(K.Opaque)),!0,k.OutlineVisualElementMask),(i||De.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),De.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._framebuffer.bind(),this._plugins.render(this._pluginInput,ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ae.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(fe.TRANSPARENT_ENVIRONMENT)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;t.setName(e),this._pluginInput.set(e,t);const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitFBO(e,t=M,r=!0){return this._blit??=new G(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=E:(b(xe,this._bindParameters.camera.viewMatrix),b(Ne,this._bindParameters.camera.projectionMatrix),T(Me,xe,Ne),T(Me,this._renderContext.lastFrameCamera.viewMatrix,Me),T(Me,this._renderContext.lastFrameCamera.projectionMatrix,Me),this._reprojectionMatrix=Me);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=E,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}}var we;e([f({readOnly:!0})],Ce.prototype,"fullResolutionAtmosphere",null),e([f()],Ce.prototype,"_edgeView",void 0),e([f()],Ce.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(we||(we={}));const Oe=[0,0,0,0],ye=[ae.INTEGRATED_MESH,ae.OPAQUE_TERRAIN,ae.OPAQUE_MATERIAL,ae.OPAQUE_NO_SSAO_DEPTH],Ie=[ae.TRANSPARENT_MATERIAL,ae.TRANSPARENT_NO_SSAO_DEPTH],De=new d,Ne=A(),xe=A(),Me=A();function He(e){return t=>e.immediate.schedule(t)}export{Ce as Renderer};
|
package/views/SceneView.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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o,handlesGroup as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{destroyMaybe as h,maybeProperty as d}from"../core/maybe.js";import{ObservableChangesType as c}from"../core/ObservableChangesType.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import g from"../core/ReactiveMap.js";import{on as m,watch as y,initial as f,syncAndInitial as w,whenOnce as v,sync as _}from"../core/reactiveUtils.js";import{setFrameDuration as b}from"../core/scheduling.js";import{createScreenPoint as M,createScreenPointArray as S}from"../core/screenUtils.js";import{getMetersPerUnitForSR as V}from"../core/unitUtils.js";import{initialize as j}from"../core/workers/workers.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{cast as C}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as O}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as T,ensureClass as x}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as E}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as L}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as H}from"../core/support/OwningCollection.js";import A from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as P,project as I}from"../geometry/projection.js";import{projectBoundingRect as G}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as D}from"../geometry/projection/projectPointToVector.js";import{create as F,toExtent as U}from"../geometry/support/aaBoundingRect.js";import{B as W,c as k}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as q}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as z}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as B,isTiledLayer as N,isVoxelLayer as Q,isIntegratedMeshLayer as Y}from"../layers/support/layerUtils.js";import{AnalysesCollection as Z}from"../support/AnalysesCollection.js";import{BreakpointsOwner as $}from"./BreakpointsOwner.js";import{DOMContainer as J}from"./DOMContainer.js";import K from"./GroundView.js";import{PopupView as X}from"./PopupView.js";import ee from"./View.js";import te from"./ViewAnimation.js";import{ViewingMode as ie,stringFromViewingMode as re,viewingModeFromString as se}from"./ViewingMode.js";import{layerView3DImporter as ne}from"./3d/layerViewModuleImportUtils.js";import ae from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as oe}from"./3d/constraints/Constraints.js";import le from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as pe}from"./3d/environment/SceneViewEnvironmentManager.js";import he from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as de}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ce}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ue}from"./3d/layers/support/FeatureTileTree3D.js";import ge from"./3d/state/ViewState.js";import{ViewStateManager as me}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ye}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as fe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as we}from"./3d/support/debugFlags.js";import ve from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as _e}from"./3d/support/ElevationProvider.js";import be from"./3d/support/HighlightOptions.js";import{toMap as Me,hitTest as Se}from"./3d/support/hitTest.js";import{popupHitTest as Ve}from"./3d/support/popupHitTest.js";import{PropertiesPool as je}from"./3d/support/PropertiesPool.js";import Re from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Ce}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Oe}from"./3d/support/ResourceController.js";import Te from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as xe}from"./3d/support/SharedSymbolResources.js";import{TextureCollection as Ee}from"./3d/support/TextureCollection.js";import{PointsOfInterest as Le}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import He from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ae,getTiledLayerInfo as Pe,checkIfTileInfoSupportedForView as Ie}from"./3d/terrain/terrainUtils.js";import{Stage as Ge}from"./3d/webgl-engine/Stage.js";import{Decorations as De}from"./3d/webgl-engine/lib/basicInterfaces.js";import{defaultTolerance as Fe}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Ue}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as We}from"./support/HighlightDefaults.js";import{occludeesSupported as ke}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as qe,createScreenPointFromSupportedEvent as ze}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Be}from"./support/spatialReferenceSupport.js";import{check as Ne}from"./support/WebGLRequirements.js";import Qe from"./ui/DefaultUI.js";import Ye from"./ui/3d/DefaultUI3D.js";import Ze from"../webscene/Environment.js";import $e from"../geometry/Extent.js";import Je from"../geometry/SpatialReference.js";import Ke from"../geometry/Point.js";let Xe=class extends($(X(J(ee)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new je({slicePlane:W},this),this._resourceController=Oe(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new de({view:this}),this.labeler=new ce({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Z,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new oe,this.environment=new le,this.environmentManager=new pe,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ae({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ge,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Ye,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new be,this.highlights=new g,this.highlightOrder=new r([We]),j();const t=(e=null)=>{null!=e&&e.type===c.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([m((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),y((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new he({view:this}),this.stateManager=new me({view:this})}initialize(){this.groundView=new K({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(m((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),f),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),f),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>b(e>0?1e3/Math.ceil(e):0)),f),this.updatingHandles.add((()=>this.map?.ground),e,w),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),w),this.addHandles(y((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),_))}destroy(){this.destroyed||(this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=h(this.sharedSymbolResources),this._set("labeler",h(this.labeler)),this._set("deconflictor",h(this.deconflictor)),this._resourceController=h(this._resourceController),this._set("stateManager",h(this.stateManager)),this._set("inputManager",h(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",h(this.environmentManager)),this._set("environment",h(this.environment)),this.groundView=h(this.groundView),this._exitBasemapTerrain(),this._stage?.destroy(),this.highlights.clear(),this.highlightOrder.destroy())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||d(e,"clippingArea");return!this._userClippingArea&&!d(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof $e?this.spatialReference&&(t=et(t,this.spatialReference),null==t)?(p.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ie.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:et(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||Je.WGS84,i=et(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||Je.WGS84;let t;const i=i=>{const r=et(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new $e({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof le?e:e instanceof Ze?this.environment?.cloneWithWebsceneEnvironment(e)??le.fromWebsceneEnvironment(e):T(le,e):new le}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(null==this.state||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){ve.isValidProfile(e)&&(ve.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||ve.getDefaultProfile()}set slicePlane(e){if(null!=this._stage&&this._stage.renderer.setParameters({slicePlane:e}),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");k(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?z(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainScale(){return this.stateManager?.terrainScale}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?A.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ae(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))||this.textures?.updating),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return re(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?re(this.defaultsFromMap.viewingMode):Be(t,ie.Global)?"global":"local":"global"}set viewingMode(e){this.ready?p.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Te(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=qe(e)?ze(this,e):e;return Me(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?_e(this.elevationProvider,e):null)??0;return D(e,tt,this.renderSpatialReference,t),this.state.camera.projectToScreen(tt,it),M(it[0],it[1])}pixelSizeAt(e,t){if(!this.ready)return p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;D(e,tt,i);const r=this.state.camera.computeScreenPixelSizeAt(tt);return t&&i!==t?r*V(i)/V(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=qe(e)?ze(this,e):e;return Se(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Ve(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),n=await this._completeSettings(e);n.format="png";return[s,t(r[1],n,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(null==this._stage.renderView.objectAndLayerIdRenderHelper)throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ne.importLayerView(e)}hasLayerViewModule(e){return ne.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Ne(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw p.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?se(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ie.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ie.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Be(e,i)&&(null==t||(!!B(t)||(!N(t)||null!=Pe(t,e,i))&&(!Q(t)||i!==ie.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(B(t)&&(r||s)){return!s||i===ie.Local||null===Ie(t.tileInfo,t.fullExtent,e,ie.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:Je.WebMercator,viewingMode:i}]:[{spatialReference:r?Je.WGS84:Je.WebMercator,viewingMode:i}]}return N(t)||Q(t)||!r&&!s?N(t)&&r&&i!==ie.Global?[{spatialReference:e,viewingMode:i},{spatialReference:Je.WGS84,viewingMode:ie.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?Je.WGS84:Je.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${re(i)} viewing mode.`):e.isGeographic&&p.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return p.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(r.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):o()}maskOccludee(e){if(!e)return p.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&ke(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await v((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}_initBasemapTerrain(){this._set("basemapTerrain",new He({view:this})),this._set("elevationProvider",new fe({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Le({view:this})),this._set("featureTiles",new ue({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?I(U(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;null!=this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>we.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&we.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||we.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),w),this.updatingHandles.add((()=>this.clippingArea),e,w),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,w)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=q(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Ce.create(this.state.viewingMode,i)),t||this.addHandles(y((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!G(e,this.basemapTerrain.spatialReference,rt,t)||(this.renderCoordsHelper.extent=rt)}),_),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Fe/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===c.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(y((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),_),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d");return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t===De.OFF}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new ye(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Ge({view:this,options:e,container:i}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),f),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation())),a(this._stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Fe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=h(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new xe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;u(e),await v((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=se(this.viewingMode);e===ie.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(m((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?E(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect(),this._set("textures",new Ee(this._stage,this.resourceController.scheduler));const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._set("textures",h(this.textures)),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Ue);for(const e of this.map.allLayers.items)Y(e.type)&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Ue);for(const e of this.map.allLayers.items)Y(e.type)&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}};function et(e,t){return null!=e&&P(e.spatialReference,t)?I(e,t):null}Xe.type="3d",e([R()],Xe.prototype,"_userClippingArea",void 0),e([R()],Xe.prototype,"_resourceController",void 0),e([R()],Xe.prototype,"_stage",void 0),e([R({readOnly:!0})],Xe.prototype,"deconflictor",void 0),e([R({readOnly:!0})],Xe.prototype,"labeler",void 0),e([R(H(Z,"analyses"))],Xe.prototype,"analyses",void 0),e([R({type:te,readOnly:!0})],Xe.prototype,"animation",null),e([R({readOnly:!0})],Xe.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],Xe.prototype,"elevationProvider",void 0),e([R()],Xe.prototype,"camera",null),e([R({type:t})],Xe.prototype,"contentCamera",null),e([R({readOnly:!0})],Xe.prototype,"canvas",void 0),e([R({type:Ke})],Xe.prototype,"center",null),e([R({type:$e})],Xe.prototype,"clippingArea",null),e([R({type:oe})],Xe.prototype,"constraints",void 0),e([R({type:$e,readOnly:!0})],Xe.prototype,"renderDataExtent",null),e([R({readOnly:!0})],Xe.prototype,"tileInfo",null),e([R({type:$e,readOnly:!0})],Xe.prototype,"dataExtent",null),e([R({type:$e,readOnly:!0})],Xe.prototype,"_groundAndLayersExtent",null),e([R({type:le})],Xe.prototype,"environment",void 0),e([C("environment")],Xe.prototype,"castEnvironment",null),e([R({readOnly:!0})],Xe.prototype,"environmentManager",void 0),e([R({type:$e})],Xe.prototype,"extent",null),e([R()],Xe.prototype,"floors",void 0),e([R()],Xe.prototype,"screenCenter",null),e([R()],Xe.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],Xe.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],Xe.prototype,"graphicsView",void 0),e([R({readOnly:!0})],Xe.prototype,"analysisViewManager",void 0),e([R()],Xe.prototype,"groundView",void 0),e([R({type:Boolean})],Xe.prototype,"initialExtentRequired",null),e([R()],Xe.prototype,"_defaultsFromMapSettings",null),e([R()],Xe.prototype,"interacting",null),e([R()],Xe.prototype,"stationary",null),e([R()],Xe.prototype,"navigating",null),e([R()],Xe.prototype,"map",void 0),e([R()],Xe.prototype,"padding",null),e([R({type:Le,readOnly:!0})],Xe.prototype,"pointsOfInterest",void 0),e([R({type:ue,readOnly:!0})],Xe.prototype,"featureTiles",void 0),e([R()],Xe.prototype,"_featureTreeDebugger",void 0),e([R({type:Boolean})],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([R({constructOnly:!0})],Xe.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],Xe.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],Xe.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],Xe.prototype,"state",void 0),e([R({readOnly:!0})],Xe.prototype,"inputManager",void 0),e([R({readOnly:!0})],Xe.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],Xe.prototype,"qualityProfile",null),e([R({type:Re,get(){let e=this._get("qualitySettings");return e||(e=new Re,ve.apply(this.qualityProfile,e)),e}})],Xe.prototype,"qualitySettings",void 0),e([R()],Xe.prototype,"slicePlane",null),e([R({readOnly:!0})],Xe.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],Xe.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],Xe.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Xe.prototype,"resolution",null),e([R({type:Number})],Xe.prototype,"scale",null),e([R()],Xe.prototype,"heightModelInfo",null),e([R()],Xe.prototype,"spatialReference",void 0),e([R({type:Boolean,constructOnly:!0})],Xe.prototype,"alphaCompositingEnabled",void 0),e([R({constructOnly:!0})],Xe.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],Xe.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],Xe.prototype,"type",void 0),e([R(),C((e=>e instanceof Qe?e:x(Ye,e)))],Xe.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Xe.prototype,"updating",null),e([R()],Xe.prototype,"_updatingObjects",null),e([R()],Xe.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0,dependsOn:["updating"]})],Xe.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],Xe.prototype,"viewingMode",null),e([R({type:i})],Xe.prototype,"viewpoint",null),e([R({readOnly:!0})],Xe.prototype,"visibleArea",null),e([R({type:Number})],Xe.prototype,"zoom",null),e([R({type:be})],Xe.prototype,"highlightOptions",void 0),e([R({readOnly:!0})],Xe.prototype,"quality",null),e([R({readOnly:!0})],Xe.prototype,"resolutionScale",null),e([R()],Xe.prototype,"textures",void 0),Xe=e([O("esri.views.SceneView")],Xe);const tt=L(),it=S(),rt=F(),st=Xe;export{st as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o,handlesGroup as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{destroyMaybe as h,maybeProperty as d}from"../core/maybe.js";import{ObservableChangesType as c}from"../core/ObservableChangesType.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import{on as g,watch as m,initial as y,syncAndInitial as f,whenOnce as w,sync as v}from"../core/reactiveUtils.js";import{setFrameDuration as _}from"../core/scheduling.js";import{createScreenPoint as b,createScreenPointArray as M}from"../core/screenUtils.js";import{getMetersPerUnitForSR as S}from"../core/unitUtils.js";import{initialize as V}from"../core/workers/workers.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as C}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as O,ensureClass as T}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as x}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as E}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as L}from"../core/support/OwningCollection.js";import A from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as H,project as P}from"../geometry/projection.js";import{projectBoundingRect as I}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as G}from"../geometry/projection/projectPointToVector.js";import{create as D,toExtent as F}from"../geometry/support/aaBoundingRect.js";import{B as U,c as W}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as k}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as q}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as z,isTiledLayer as B,isVoxelLayer as N,isIntegratedMeshLayer as Q}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Z}from"./BreakpointsOwner.js";import{DOMContainer as $}from"./DOMContainer.js";import J from"./GroundView.js";import{PopupView as K}from"./PopupView.js";import X from"./View.js";import ee from"./ViewAnimation.js";import{ViewingMode as te,stringFromViewingMode as ie,viewingModeFromString as re}from"./ViewingMode.js";import{layerView3DImporter as se}from"./3d/layerViewModuleImportUtils.js";import ne from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as ae}from"./3d/constraints/Constraints.js";import oe from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as le}from"./3d/environment/SceneViewEnvironmentManager.js";import pe from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as he}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as de}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ce}from"./3d/layers/support/FeatureTileTree3D.js";import ue from"./3d/state/ViewState.js";import{ViewStateManager as ge}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as me}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ye}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as fe}from"./3d/support/debugFlags.js";import we from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as ve}from"./3d/support/ElevationProvider.js";import _e from"./3d/support/HighlightOptions.js";import{toMap as be,hitTest as Me}from"./3d/support/hitTest.js";import{popupHitTest as Se}from"./3d/support/popupHitTest.js";import{PropertiesPool as Ve}from"./3d/support/PropertiesPool.js";import Re from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as je}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ce}from"./3d/support/ResourceController.js";import Oe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Te}from"./3d/support/SharedSymbolResources.js";import{TextureCollection as xe}from"./3d/support/TextureCollection.js";import{PointsOfInterest as Ee}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ae,getTiledLayerInfo as He,checkIfTileInfoSupportedForView as Pe}from"./3d/terrain/terrainUtils.js";import{Stage as Ie}from"./3d/webgl-engine/Stage.js";import{Decorations as Ge}from"./3d/webgl-engine/lib/basicInterfaces.js";import{defaultTolerance as De}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{occludeesSupported as Ue}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as We,createScreenPointFromSupportedEvent as ke}from"./support/screenUtils.js";import{isSpatialReferenceSupported as qe}from"./support/spatialReferenceSupport.js";import{check as ze}from"./support/WebGLRequirements.js";import Be from"./ui/DefaultUI.js";import Ne from"./ui/3d/DefaultUI3D.js";import Qe from"../webscene/Environment.js";import Ye from"../geometry/Extent.js";import Ze from"../geometry/SpatialReference.js";import $e from"../geometry/Point.js";let Je=class extends(Z(K($(X)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new Ve({slicePlane:U},this),this._resourceController=Ce(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new he({view:this}),this.labeler=new de({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new ae,this.environment=new oe,this.environmentManager=new le,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ne({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ue,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Ne,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new _e,this.highlights=new r,V();const t=(e=null)=>{null!=e&&e.type===c.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([g((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),m((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new pe({view:this}),this.stateManager=new ge({view:this})}initialize(){this.groundView=new J({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(g((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),y),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),y),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>_(e>0?1e3/Math.ceil(e):0)),y),this.updatingHandles.add((()=>this.map?.ground),e,f),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),f),this.addHandles(m((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),v))}destroy(){this.destroyed||(this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=h(this.sharedSymbolResources),this._set("labeler",h(this.labeler)),this._set("deconflictor",h(this.deconflictor)),this._resourceController=h(this._resourceController),this._set("stateManager",h(this.stateManager)),this._set("inputManager",h(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",h(this.environmentManager)),this._set("environment",h(this.environment)),this.groundView=h(this.groundView),this._exitBasemapTerrain(),this._stage?.destroy(),this.highlights.destroy())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||d(e,"clippingArea");return!this._userClippingArea&&!d(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof Ye?this.spatialReference&&(t=Ke(t,this.spatialReference),null==t)?(p.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===te.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:Ke(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||Ze.WGS84,i=Ke(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||Ze.WGS84;let t;const i=i=>{const r=Ke(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new Ye({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof oe?e:e instanceof Qe?this.environment?.cloneWithWebsceneEnvironment(e)??oe.fromWebsceneEnvironment(e):O(oe,e):new oe}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(null==this.state||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){we.isValidProfile(e)&&(we.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||we.getDefaultProfile()}set slicePlane(e){if(null!=this._stage&&this._stage.renderer.setParameters({slicePlane:e}),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");W(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?q(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainScale(){return this.stateManager?.terrainScale}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?A.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ae(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))||this.textures?.updating),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ie(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ie(this.defaultsFromMap.viewingMode):qe(t,te.Global)?"global":"local":"global"}set viewingMode(e){this.ready?p.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Oe(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=We(e)?ke(this,e):e;return be(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?ve(this.elevationProvider,e):null)??0;return G(e,Xe,this.renderSpatialReference,t),this.state.camera.projectToScreen(Xe,et),b(et[0],et[1])}pixelSizeAt(e,t){if(!this.ready)return p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;G(e,Xe,i);const r=this.state.camera.computeScreenPixelSizeAt(Xe);return t&&i!==t?r*S(i)/S(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=We(e)?ke(this,e):e;return Me(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Se(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),n=await this._completeSettings(e);n.format="png";return[s,t(r[1],n,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(null==this._stage.renderView.objectAndLayerIdRenderHelper)throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return se.importLayerView(e)}hasLayerViewModule(e){return se.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=ze(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw p.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?re(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,te.Local),s=this._validateSpatialReferenceForViewingMode(e,t,te.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,te.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,te.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!qe(e,i)&&(null==t||(!!z(t)||(!B(t)||null!=He(t,e,i))&&(!N(t)||i!==te.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(z(t)&&(r||s)){return!s||i===te.Local||null===Pe(t.tileInfo,t.fullExtent,e,te.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:Ze.WebMercator,viewingMode:i}]:[{spatialReference:r?Ze.WGS84:Ze.WebMercator,viewingMode:i}]}return B(t)||N(t)||!r&&!s?B(t)&&r&&i!==te.Global?[{spatialReference:e,viewingMode:i},{spatialReference:Ze.WGS84,viewingMode:te.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?Ze.WGS84:Ze.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ie(i)} viewing mode.`):e.isGeographic&&p.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return p.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(r.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):o()}maskOccludee(e){if(!e)return p.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&Ue(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await w((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new ye({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ee({view:this})),this._set("featureTiles",new ce({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?P(F(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;null!=this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>fe.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&fe.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||fe.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),f),this.updatingHandles.add((()=>this.clippingArea),e,f),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,f)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=k(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",je.create(this.state.viewingMode,i)),t||this.addHandles(m((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!I(e,this.basemapTerrain.spatialReference,tt,t)||(this.renderCoordsHelper.extent=tt)}),v),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===c.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(m((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),v),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d");return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t===Ge.OFF}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new me(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Ie({view:this,options:e,container:i}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),y),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation())),a(this._stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=h(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Te({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;u(e),await w((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=re(this.viewingMode);e===te.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(g((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?x(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect(),this._set("textures",new xe(this._stage,this.resourceController.scheduler));const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._set("textures",h(this.textures)),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Fe);for(const e of this.map.allLayers.items)Q(e.type)&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Fe);for(const e of this.map.allLayers.items)Q(e.type)&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}};function Ke(e,t){return null!=e&&H(e.spatialReference,t)?P(e,t):null}Je.type="3d",e([R()],Je.prototype,"_userClippingArea",void 0),e([R()],Je.prototype,"_resourceController",void 0),e([R()],Je.prototype,"_stage",void 0),e([R({readOnly:!0})],Je.prototype,"deconflictor",void 0),e([R({readOnly:!0})],Je.prototype,"labeler",void 0),e([R(L(Y,"analyses"))],Je.prototype,"analyses",void 0),e([R({type:ee,readOnly:!0})],Je.prototype,"animation",null),e([R({readOnly:!0})],Je.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],Je.prototype,"elevationProvider",void 0),e([R()],Je.prototype,"camera",null),e([R({type:t})],Je.prototype,"contentCamera",null),e([R({readOnly:!0})],Je.prototype,"canvas",void 0),e([R({type:$e})],Je.prototype,"center",null),e([R({type:Ye})],Je.prototype,"clippingArea",null),e([R({type:ae})],Je.prototype,"constraints",void 0),e([R({type:Ye,readOnly:!0})],Je.prototype,"renderDataExtent",null),e([R({readOnly:!0})],Je.prototype,"tileInfo",null),e([R({type:Ye,readOnly:!0})],Je.prototype,"dataExtent",null),e([R({type:Ye,readOnly:!0})],Je.prototype,"_groundAndLayersExtent",null),e([R({type:oe})],Je.prototype,"environment",void 0),e([j("environment")],Je.prototype,"castEnvironment",null),e([R({readOnly:!0})],Je.prototype,"environmentManager",void 0),e([R({type:Ye})],Je.prototype,"extent",null),e([R()],Je.prototype,"floors",void 0),e([R()],Je.prototype,"screenCenter",null),e([R()],Je.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],Je.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],Je.prototype,"graphicsView",void 0),e([R({readOnly:!0})],Je.prototype,"analysisViewManager",void 0),e([R()],Je.prototype,"groundView",void 0),e([R({type:Boolean})],Je.prototype,"initialExtentRequired",null),e([R()],Je.prototype,"_defaultsFromMapSettings",null),e([R()],Je.prototype,"interacting",null),e([R()],Je.prototype,"stationary",null),e([R()],Je.prototype,"navigating",null),e([R()],Je.prototype,"map",void 0),e([R()],Je.prototype,"padding",null),e([R({type:Ee,readOnly:!0})],Je.prototype,"pointsOfInterest",void 0),e([R({type:ce,readOnly:!0})],Je.prototype,"featureTiles",void 0),e([R()],Je.prototype,"_featureTreeDebugger",void 0),e([R({type:Boolean})],Je.prototype,"screenSizePerspectiveEnabled",void 0),e([R({constructOnly:!0})],Je.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],Je.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],Je.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],Je.prototype,"state",void 0),e([R({readOnly:!0})],Je.prototype,"inputManager",void 0),e([R({readOnly:!0})],Je.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],Je.prototype,"qualityProfile",null),e([R({type:Re,get(){let e=this._get("qualitySettings");return e||(e=new Re,we.apply(this.qualityProfile,e)),e}})],Je.prototype,"qualitySettings",void 0),e([R()],Je.prototype,"slicePlane",null),e([R({readOnly:!0})],Je.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],Je.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],Je.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Je.prototype,"resolution",null),e([R({type:Number})],Je.prototype,"scale",null),e([R()],Je.prototype,"heightModelInfo",null),e([R()],Je.prototype,"spatialReference",void 0),e([R({type:Boolean,constructOnly:!0})],Je.prototype,"alphaCompositingEnabled",void 0),e([R({constructOnly:!0})],Je.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],Je.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],Je.prototype,"type",void 0),e([R(),j((e=>e instanceof Be?e:T(Ne,e)))],Je.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Je.prototype,"updating",null),e([R()],Je.prototype,"_updatingObjects",null),e([R()],Je.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0,dependsOn:["updating"]})],Je.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],Je.prototype,"viewingMode",null),e([R({type:i})],Je.prototype,"viewpoint",null),e([R({readOnly:!0})],Je.prototype,"visibleArea",null),e([R({type:Number})],Je.prototype,"zoom",null),e([R({type:_e})],Je.prototype,"highlightOptions",void 0),e([R({type:r,readOnly:!0})],Je.prototype,"highlights",void 0),e([R({readOnly:!0})],Je.prototype,"quality",null),e([R({readOnly:!0})],Je.prototype,"resolutionScale",null),e([R()],Je.prototype,"textures",void 0),Je=e([C("esri.views.SceneView")],Je);const Xe=E(),et=M(),tt=D(),it=Je;export{it 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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import o from"../../Color.js";const
|
|
5
|
+
import o from"../../Color.js";const r=new o([0,255,255]),e=1,n=.25,t=new o([0,0,0]),m=.4,p=.2,s=.25,w={};export{r as defaultColor,n as defaultFillOpacity,e as defaultHaloOpacity,w as defaultHighlightName,s as defaultOccludedFactor,t as defaultShadowColor,p as defaultShadowDifference,m as defaultShadowOpacity};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import{watch as l}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import c from"./BasemapLayerList/BasemapLayerListViewModel.js";import d from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as m}from"./BasemapLayerList/css.js";import p from"./LayerList/LayerListItem.js";import h from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as g,getLayerType as f,sortLayersToIds as b,sortChildLayersToIds as _}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as v}from"./support/globalCss.js";import{incrementHeadingLevel as y}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as L}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as F}from"./support/jsxFactory.js";const E=t.ofType(h),C=".*\\S+.*",T="data-basemap-layer-type";let M=class extends(s(a)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusTableListFlowItem=!1,this._focusEditingFlowItem=!1,this._focusCatalogFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=u,this.openTableListItem=null,this.tableList=null,this.openCatalogItem=null,this.selectedItems=new E,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=g(e);if(!l?.sortable)return!1;const n=g(t),r=f(t),a=g(i),c=f(i),d=!!r&&!!c&&r===c,m={selected:l,from:n,to:a},p=t.group,h=i.group,u=n?.layer?.type??"",b=a?.layer?.type??"",_=new Set(["map-image","catalog","knowledge-graph"]),I="sublayer";return p&&h&&"function"==typeof o?o.call(null,m):d&&!_.has(u)&&!_.has(b)&&l?.layer?.type!==I},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTablesOpen=e=>{this.openTableListItem=e,this._focusTableListFlowItem=!0},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openCatalogItem=e.parent,this._focusCatalogFlowItem=!0},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=g(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e;const n=s,r=i;if(n!==r)this._moveLayerFromChildList({toEl:r,fromEl:n,dragEl:o,newIndex:l});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(n,e)}}}initialize(){this.addHandles([l((()=>this.openCatalogItem),(e=>e?this._createCatalog():this._destroyCatalog())),l((()=>this.openTableListItem),(e=>e?this._createTableList():this._destroyTableList()))])}normalizeCtorArgs(e){return null!=e?.editingEnabled&&null!=e.visibleElements?{...e,visibleElements:new d({...e.visibleElements,editTitleButton:e.editingEnabled})}:e}loadDependencies(){return I({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _totalBaseItems(){return this.viewModel.baseItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get editingEnabled(){return i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled&&this.visibleElements.editTitleButton}set editingEnabled(e){i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.visibleElements.editTitleButton=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.editingEnabled?"single":"none"}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[v.hidden]:"loading"===e,[v.disabled]:"disabled"===e};return F("div",{class:this.classes(m.base,v.widget,v.panel,t)},this._renderItems())}_getTableListParams(e){const t=e?.layer;return"knowledge-graph"===t?.type?{...this.knowledgeGraphOptions,tables:t.tables}:null}async _createTableList(){this._destroyTableList();const{default:e}=await import("./TableList.js"),t=this._getTableListParams(this.openTableListItem);if(!t?.tables?.length)return;const{headingLevel:i,selectionMode:s,dragEnabled:o}=this;this._set("tableList",new e({headingLevel:i,selectionMode:s,dragEnabled:o,...t}))}_destroyTableList(){this.tableList?.destroy(),this._set("tableList",null)}_renderItemTooltip(e){return e?F("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}async _createCatalog(){this._destroyCatalog();const{default:e}=await import("./CatalogLayerList.js"),{headingLevel:t,catalogOptions:i,view:s,filterPlaceholder:o,baseListItemCreatedFunction:l,referenceListItemCreatedFunction:n,minFilterItems:r,selectionMode:a,visibilityAppearance:c,openCatalogItem:d,referenceItems:m}=this,p=d&&m.flatten((e=>e.children)).includes(d)?"reference":"base",h=this.openCatalogItem?.layer;this._set("catalogLayerList",new e({headingLevel:t,view:s,filterPlaceholder:o,minFilterItems:r,selectionMode:a,listItemCreatedFunction:"base"===p?l:n,visibilityAppearance:c,...i,catalogLayer:h}))}_destroyCatalog(){this.catalogLayerList?.destroy(),this._set("catalogLayerList",null)}_renderCatalogFlowItem(){const{openCatalogItem:e,messages:t}=this;if(!e)return null;const i=this._getLayerTitle(e);return F("calcite-flow-item",{afterCreate:this._focusCatalogFlowItemNode,afterUpdate:this._focusCatalogFlowItemNode,bind:this,description:i,heading:t.catalogLayers,headingLevel:this.headingLevel,key:`flow-catalog-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openCatalogItem=null,this._focusRootFlowItem=!0}},this.catalogLayerList?.render())}_focusCatalogFlowItemNode(e){this._focusCatalogFlowItem&&(this._focusCatalogFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return F("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),F("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_getLayerTitle(e){return e.title||this.messages.untitledLayer}_renderItem(e,t,i,s){return F(p,{activeItem:this._activeItem,canMove:this._canMove,css:m,dragEnabled:!t&&this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=g(i),l=g(e),n=g(t),r=j(t),a=j(e);r&&a&&this.viewModel.moveListItem({targetItem:o,fromParentItem:n,toParentItem:l,newIndex:s,from:r,to:a})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid){const i=j(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;b(s,t)}else{const i=g(e);if(!i)return;_(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>g(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return F("div",{class:m.editing},F("calcite-label",null,e.basemapTitle,F("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:C,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return F("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"half"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return F("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"half"},e.form.ok)}_renderEditingForm(){return this.editingTitle?F("form",{bind:this,onsubmit:this._formSubmit},F("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?F("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return F("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return F("div",{class:m.itemMessage},F("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_getFilteredItems(e){return e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:n,viewModel:r,referenceItems:a,baseItems:c}=this,d=this.visibleElements.referenceLayers?this._getFilteredItems(a):null,m=this.visibleElements.baseLayers?this._getFilteredItems(c):null,p=[F("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?r.basemapTitle??n.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(d),this._renderBaseSection(m,1===m?.length)),this._renderEditingForm(),this._renderPanelFlowItems(m),this._renderPanelFlowItems(d),this._renderTableListFlowItem(),this._renderCatalogFlowItem()];return t?[l?F("calcite-flow",{key:"root-flow"},p):p,this._renderItemTooltips(d),this._renderItemTooltips(m)]:null}_focusTableListFlowItemNode(e){this._focusTableListFlowItem&&(this._focusTableListFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderTableListFlowItem(){const{openTableListItem:e,messages:t}=this;if(!e)return null;const i=e.title||this.messages.untitledLayer;return F("calcite-flow-item",{afterCreate:this._focusTableListFlowItemNode,afterUpdate:this._focusTableListFlowItemNode,bind:this,description:i,heading:t.tables,headingLevel:this.headingLevel,key:`flow-table-list-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openTableListItem=null,this._focusRootFlowItem=!0}},this.tableList?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:n,baseFilterText:r,referenceFilterText:a,_baseFilterEnabled:c,_referenceFilterEnabled:d,_rootGroupUid:p}=this,h="reference"===t?s.noReferenceLayers:s.noBaseLayers,u="reference"===t?d:c;return F("calcite-block",{class:m.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:y(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(h,t):null,F("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),[T]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:u,filterPlaceholder:n,filterText:u?"reference"===t?a:r:"",group:p,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,i))),e?.length&&u?F("div",{class:m.filterNoResults,slot:"filter-no-results"},F("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(h))):null))}_renderBaseSection(e,t){return this.visibleElements.baseLayers?this._renderList(e,"base",t):null}_renderReferenceSection(e){return this.visibleElements.referenceLayers?this._renderList(e,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function j(e){return e?.closest(`[${T}]`)?.getAttribute(T)}e([n()],M.prototype,"_activeItem",void 0),e([n()],M.prototype,"_tooltipReferenceMap",void 0),e([n()],M.prototype,"_focusRootFlowItem",void 0),e([n()],M.prototype,"_focusPanelFlowItem",void 0),e([n()],M.prototype,"_focusTableListFlowItem",void 0),e([n()],M.prototype,"_focusEditingFlowItem",void 0),e([n()],M.prototype,"_focusCatalogFlowItem",void 0),e([n()],M.prototype,"_totalBaseItems",null),e([n()],M.prototype,"_totalReferenceItems",null),e([n()],M.prototype,"_baseFilterEnabled",null),e([n()],M.prototype,"_referenceFilterEnabled",null),e([n()],M.prototype,"basemapTitle",null),e([n({readOnly:!0})],M.prototype,"catalogLayerList",void 0),e([n()],M.prototype,"catalogOptions",void 0),e([n()],M.prototype,"collapsed",void 0),e([n()],M.prototype,"dragEnabled",void 0),e([n()],M.prototype,"editingTitle",void 0),e([n()],M.prototype,"filterPlaceholder",void 0),e([n()],M.prototype,"baseFilterText",void 0),e([n()],M.prototype,"referenceFilterText",void 0),e([n()],M.prototype,"listItemCanGiveFunction",void 0),e([n()],M.prototype,"listItemCanReceiveFunction",void 0),e([n()],M.prototype,"baseListItemCreatedFunction",null),e([n()],M.prototype,"editingEnabled",null),e([n()],M.prototype,"headingLevel",void 0),e([n()],M.prototype,"icon",null),e([n()],M.prototype,"knowledgeGraphOptions",void 0),e([n()],M.prototype,"label",null),e([n(),L("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],M.prototype,"messages",void 0),e([n(),L("esri/t9n/common")],M.prototype,"messagesCommon",void 0),e([n()],M.prototype,"minFilterItems",void 0),e([n()],M.prototype,"multipleSelectionEnabled",null),e([n()],M.prototype,"openTableListItem",void 0),e([n()],M.prototype,"referenceListItemCreatedFunction",null),e([n({readOnly:!0})],M.prototype,"tableList",void 0),e([n({readOnly:!0})],M.prototype,"baseItems",null),e([n()],M.prototype,"openCatalogItem",void 0),e([n({readOnly:!0})],M.prototype,"referenceItems",null),e([n()],M.prototype,"selectedItems",void 0),e([n()],M.prototype,"selectionMode",void 0),e([n()],M.prototype,"view",null),e([w("trigger-action"),n({type:c})],M.prototype,"viewModel",void 0),e([n()],M.prototype,"visibilityAppearance",void 0),e([n({type:d,nonNullable:!0})],M.prototype,"visibleElements",void 0),M=e([r("esri.widgets.BasemapLayerList")],M);const B=M;export{B as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import{watch as l}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import c from"./BasemapLayerList/BasemapLayerListViewModel.js";import d from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as m}from"./BasemapLayerList/css.js";import p from"./LayerList/LayerListItem.js";import h from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as g,getLayerType as f,sortLayersToIds as b,sortChildLayersToIds as _}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as v}from"./support/globalCss.js";import{incrementHeadingLevel as y}from"./support/Heading.js";import{calciteListFilterProps as L}from"./support/listUtils.js";import"./support/widgetUtils.js";import{messageBundle as w}from"./support/decorators/messageBundle.js";import{vmEvent as F}from"./support/decorators/vmEvent.js";import{tsx as E}from"./support/jsxFactory.js";const C=t.ofType(h),T=".*\\S+.*",M="data-basemap-layer-type";let j=class extends(s(a)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusTableListFlowItem=!1,this._focusEditingFlowItem=!1,this._focusCatalogFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=u,this.openTableListItem=null,this.tableList=null,this.openCatalogItem=null,this.selectedItems=new C,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=g(e);if(!l?.sortable)return!1;const n=g(t),r=f(t),a=g(i),c=f(i),d=!!r&&!!c&&r===c,m={selected:l,from:n,to:a},p=t.group,h=i.group,u=n?.layer?.type??"",b=a?.layer?.type??"",_=new Set(["map-image","catalog","knowledge-graph"]),I="sublayer";return p&&h&&"function"==typeof o?o.call(null,m):d&&!_.has(u)&&!_.has(b)&&l?.layer?.type!==I},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTablesOpen=e=>{this.openTableListItem=e,this._focusTableListFlowItem=!0},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openCatalogItem=e.parent,this._focusCatalogFlowItem=!0},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=g(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e;const n=s,r=i;if(n!==r)this._moveLayerFromChildList({toEl:r,fromEl:n,dragEl:o,newIndex:l});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(n,e)}}}initialize(){this.addHandles([l((()=>this.openCatalogItem),(e=>e?this._createCatalog():this._destroyCatalog())),l((()=>this.openTableListItem),(e=>e?this._createTableList():this._destroyTableList()))])}normalizeCtorArgs(e){return null!=e?.editingEnabled&&null!=e.visibleElements?{...e,visibleElements:new d({...e.visibleElements,editTitleButton:e.editingEnabled})}:e}loadDependencies(){return I({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _totalBaseItems(){return this.viewModel.baseItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get editingEnabled(){return i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled&&this.visibleElements.editTitleButton}set editingEnabled(e){i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.visibleElements.editTitleButton=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.editingEnabled?"single":"none"}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[v.hidden]:"loading"===e,[v.disabled]:"disabled"===e};return E("div",{class:this.classes(m.base,v.widget,v.panel,t)},this._renderItems())}_getTableListParams(e){const t=e?.layer;return"knowledge-graph"===t?.type?{...this.knowledgeGraphOptions,tables:t.tables}:null}async _createTableList(){this._destroyTableList();const{default:e}=await import("./TableList.js"),t=this._getTableListParams(this.openTableListItem);if(!t?.tables?.length)return;const{headingLevel:i,selectionMode:s,dragEnabled:o}=this;this._set("tableList",new e({headingLevel:i,selectionMode:s,dragEnabled:o,...t}))}_destroyTableList(){this.tableList?.destroy(),this._set("tableList",null)}_renderItemTooltip(e){return e?E("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}async _createCatalog(){this._destroyCatalog();const{default:e}=await import("./CatalogLayerList.js"),{headingLevel:t,catalogOptions:i,view:s,filterPlaceholder:o,baseListItemCreatedFunction:l,referenceListItemCreatedFunction:n,minFilterItems:r,selectionMode:a,visibilityAppearance:c,openCatalogItem:d,referenceItems:m}=this,p=d&&m.flatten((e=>e.children)).includes(d)?"reference":"base",h=this.openCatalogItem?.layer;this._set("catalogLayerList",new e({headingLevel:t,view:s,filterPlaceholder:o,minFilterItems:r,selectionMode:a,listItemCreatedFunction:"base"===p?l:n,visibilityAppearance:c,...i,catalogLayer:h}))}_destroyCatalog(){this.catalogLayerList?.destroy(),this._set("catalogLayerList",null)}_renderCatalogFlowItem(){const{openCatalogItem:e,messages:t}=this;if(!e)return null;const i=this._getLayerTitle(e);return E("calcite-flow-item",{afterCreate:this._focusCatalogFlowItemNode,afterUpdate:this._focusCatalogFlowItemNode,bind:this,description:i,heading:t.catalogLayers,headingLevel:this.headingLevel,key:`flow-catalog-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openCatalogItem=null,this._focusRootFlowItem=!0}},this.catalogLayerList?.render())}_focusCatalogFlowItemNode(e){this._focusCatalogFlowItem&&(this._focusCatalogFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return E("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),E("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_getLayerTitle(e){return e.title||this.messages.untitledLayer}_renderItem(e,t,i,s){return E(p,{activeItem:this._activeItem,canMove:this._canMove,css:m,dragEnabled:!t&&this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=g(i),l=g(e),n=g(t),r=B(t),a=B(e);r&&a&&this.viewModel.moveListItem({targetItem:o,fromParentItem:n,toParentItem:l,newIndex:s,from:r,to:a})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid){const i=B(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;b(s,t)}else{const i=g(e);if(!i)return;_(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>g(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return E("div",{class:m.editing},E("calcite-label",null,e.basemapTitle,E("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:T,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return E("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"half"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return E("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"half"},e.form.ok)}_renderEditingForm(){return this.editingTitle?E("form",{bind:this,onsubmit:this._formSubmit},E("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?E("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return E("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return E("div",{class:m.itemMessage},E("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_getFilteredItems(e){return e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:n,viewModel:r,referenceItems:a,baseItems:c}=this,d=this.visibleElements.referenceLayers?this._getFilteredItems(a):null,m=this.visibleElements.baseLayers?this._getFilteredItems(c):null,p=[E("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?r.basemapTitle??n.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(d),this._renderBaseSection(m,1===m?.length)),this._renderEditingForm(),this._renderPanelFlowItems(m),this._renderPanelFlowItems(d),this._renderTableListFlowItem(),this._renderCatalogFlowItem()];return t?[l?E("calcite-flow",{key:"root-flow"},p):p,this._renderItemTooltips(d),this._renderItemTooltips(m)]:null}_focusTableListFlowItemNode(e){this._focusTableListFlowItem&&(this._focusTableListFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderTableListFlowItem(){const{openTableListItem:e,messages:t}=this;if(!e)return null;const i=e.title||this.messages.untitledLayer;return E("calcite-flow-item",{afterCreate:this._focusTableListFlowItemNode,afterUpdate:this._focusTableListFlowItemNode,bind:this,description:i,heading:t.tables,headingLevel:this.headingLevel,key:`flow-table-list-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openTableListItem=null,this._focusRootFlowItem=!0}},this.tableList?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:n,baseFilterText:r,referenceFilterText:a,_baseFilterEnabled:c,_referenceFilterEnabled:d,_rootGroupUid:p}=this,h="reference"===t?s.noReferenceLayers:s.noBaseLayers,u="reference"===t?d:c;return E("calcite-block",{class:m.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:y(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(h,t):null,E("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),filterProps:L,[M]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:u,filterPlaceholder:n,filterText:u?"reference"===t?a:r:"",group:p,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,i))),e?.length&&u?E("div",{class:m.filterNoResults,slot:"filter-no-results"},E("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(h))):null))}_renderBaseSection(e,t){return this.visibleElements.baseLayers?this._renderList(e,"base",t):null}_renderReferenceSection(e){return this.visibleElements.referenceLayers?this._renderList(e,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function B(e){return e?.closest(`[${M}]`)?.getAttribute(M)}e([n()],j.prototype,"_activeItem",void 0),e([n()],j.prototype,"_tooltipReferenceMap",void 0),e([n()],j.prototype,"_focusRootFlowItem",void 0),e([n()],j.prototype,"_focusPanelFlowItem",void 0),e([n()],j.prototype,"_focusTableListFlowItem",void 0),e([n()],j.prototype,"_focusEditingFlowItem",void 0),e([n()],j.prototype,"_focusCatalogFlowItem",void 0),e([n()],j.prototype,"_totalBaseItems",null),e([n()],j.prototype,"_totalReferenceItems",null),e([n()],j.prototype,"_baseFilterEnabled",null),e([n()],j.prototype,"_referenceFilterEnabled",null),e([n()],j.prototype,"basemapTitle",null),e([n({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([n()],j.prototype,"catalogOptions",void 0),e([n()],j.prototype,"collapsed",void 0),e([n()],j.prototype,"dragEnabled",void 0),e([n()],j.prototype,"editingTitle",void 0),e([n()],j.prototype,"filterPlaceholder",void 0),e([n()],j.prototype,"baseFilterText",void 0),e([n()],j.prototype,"referenceFilterText",void 0),e([n()],j.prototype,"listItemCanGiveFunction",void 0),e([n()],j.prototype,"listItemCanReceiveFunction",void 0),e([n()],j.prototype,"baseListItemCreatedFunction",null),e([n()],j.prototype,"editingEnabled",null),e([n()],j.prototype,"headingLevel",void 0),e([n()],j.prototype,"icon",null),e([n()],j.prototype,"knowledgeGraphOptions",void 0),e([n()],j.prototype,"label",null),e([n(),w("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],j.prototype,"messages",void 0),e([n(),w("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([n()],j.prototype,"minFilterItems",void 0),e([n()],j.prototype,"multipleSelectionEnabled",null),e([n()],j.prototype,"openTableListItem",void 0),e([n()],j.prototype,"referenceListItemCreatedFunction",null),e([n({readOnly:!0})],j.prototype,"tableList",void 0),e([n({readOnly:!0})],j.prototype,"baseItems",null),e([n()],j.prototype,"openCatalogItem",void 0),e([n({readOnly:!0})],j.prototype,"referenceItems",null),e([n()],j.prototype,"selectedItems",void 0),e([n()],j.prototype,"selectionMode",void 0),e([n()],j.prototype,"view",null),e([F("trigger-action"),n({type:c})],j.prototype,"viewModel",void 0),e([n()],j.prototype,"visibilityAppearance",void 0),e([n({type:d,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([r("esri.widgets.BasemapLayerList")],j);const A=j;export{A as default};
|