@arcgis/core 4.25.0-next.20220707 → 4.25.0-next.20220708

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.
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import o from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as p,isSome as u}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as g,isAborted as m,createAbortError as f}from"../../../core/promiseUtils.js";import{watch as T,syncAndInitial as y,sync as v,initial as w}from"../../../core/reactiveUtils.js";import{aliasOf as L}from"../../../core/accessorSupport/decorators/aliasOf.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{property as S}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{m as E}from"../../../chunks/mat4.js";import{c as D}from"../../../chunks/mat4f64.js";import{c as U}from"../../../chunks/vec3.js";import{c as x}from"../../../chunks/vec3f64.js";import{c as C}from"../../../chunks/vec4f64.js";import{WatchUpdatingTracking as P}from"../../../core/support/WatchUpdatingTracking.js";import{projectVectorToVector as R,projectPointToVector as M}from"../../../geometry/projection.js";import{getReferenceEllipsoid as j}from"../../../geometry/projectionEllipsoid.js";import{create as A,equals as I,intersection as V,intersectsSphere as O}from"../../../geometry/support/aaBoundingRect.js";import{create as N,copy as k}from"../../../geometry/support/frustum.js";import{isPlateCarree as B}from"../../../geometry/support/spatialReferenceUtils.js";import{isRefreshableLayer as q}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as G}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as W}from"../../../layers/support/layerUtils.js";import{acquireDecoder as F}from"../../../layers/support/LercDecoder.js";import{printAllocations as H}from"../../2d/engine/vectorTiles/VectorTile.js";import{directionToHeadingTilt as Q,scaleToZoom as X}from"../support/cameraUtils.js";import z from"../support/debugFlags.js";import{toBoundingRect as Y}from"../support/extentUtils.js";import{ClientType as $}from"../support/index.js";import{updatingProgress as K}from"../support/updatingProperties.js";import{ElevationBounds as J}from"./ElevationBounds.js";import{sampleElevation as Z,ElevationData as ee}from"./ElevationData.js";import{create as te}from"./ExtentHelper.js";import{LODSnapping as ie,TextureUpdate as re}from"./interfaces.js";import{LayerClass as se,LayerClasses as ae}from"./LayerClass.js";import{OverlayManager as ne}from"./OverlayManager.js";import{PlanarPatch as oe}from"./PlanarPatch.js";import{RenderOrder as le}from"./RenderOrder.js";import{SphericalPatch as he}from"./SphericalPatch.js";import{MAX_ROOT_TILES as de,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as pe,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as ue,MAX_MEMORY_LOD_BIAS as ce,ELEVATION_NODATA_VALUE as _e}from"./TerrainConst.js";import ge from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as fe,internalAssert as Te,isSurfaceLayerView as ye,isMapTileLayerView as ve,isBlendableLayerView as we,isGroupLayer as Le,isElevationLayerView as Se,isVectorTileLayerView as be,useFetchTileForLayer as Ee,isImageryTileLayerView as De,isTileLayerView as Ue,releaseTileData as xe,ENABLE_WATERPROOFNESS_TESTS as Ce,enableTerrainInternalChecks as Pe,enableTerrainWaterproofnessChecks as Re}from"./terrainUtils.js";import{SplitLimits as Me,Tile as je}from"./Tile.js";import{printAllocations as Ae}from"./TilePerLayerInfo.js";import{TileUpdate as Ie}from"./TileUpdate.js";import{IteratorPreorder as Ve,IteratorPostorder as Oe,hasLoadableSiblings as Ne,sortTilesByPOI as ke,sortTiles as Be}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Ge}from"./UpsampleInfo.js";import{isCompositeBlendMode as We,blendModeFromString as Fe}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{RenderRequestType as He}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as Qe,TaskPriority as Xe,noBudget as ze}from"../../support/Scheduler.js";const Ye=.25;let $e=class extends(a.EventedMixin(i)){constructor(e){super(e),this._elevationBounds=new J,this._iteratorPool=new c(Ve,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Oe,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visibleCached=!1,this._usedMemory=null,this._performanceInfo=new me,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=x(),this._eyePosSurfaceSR=x(),this._splitLimits=new Me,this._snapLevel=1/0,this._frustum=N(),this._viewProjectionMatrix=D(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new P,this._frameTask=Qe,this._allTiles=new _,this._upsampleInfoPool=new c(Ge),this._rootTilesExtent=A(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.backgroundColor=null,this._updatingRootTiles=!1,this.deferTileNeighborUpdate=!1,this.neighborTilesToUpdate=new Set,this.enableBatchTileGeometryUpdates=!0,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this._isGlobal=!e.view?.state?.isLocal}initialize(){this._lercDecoder=F(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(oe):new c(he);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new G(e.newCache("elevation-query")),this._set("overlayManager",new ne({surface:this})),this._handles.add([T((()=>this.overlayManager.hasHighlights),(e=>this._renderer.setNeedsHighlight(e))),T((()=>this.overlayManager.rendersOccluded),(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new ge({_overlayRenderer:this.overlayManager.renderer,_ellipsoidRadius:j(this.view.spatialReference).radius,_stage:this.view._stage,_allTiles:this._allTiles}),this._handles.add([T((()=>this.baseOpacity),(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),y),T((()=>this.hasCompositeBlendMode),(()=>{this._updateBaseOpacity(this.baseOpacity)}),y),T((()=>this.renderingDisabled),(()=>this._updateTransparentTerrain()),v),T((()=>this.backgroundColor),(e=>{this._handleLayerViewChanges(),this._renderer.updateTileBackground(e)}),y),T((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),T((()=>z.TERRAIN_TILE_TREE_SHOW_TILES),(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&z.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}),w)]),this._extentHelper=te(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>this.view?.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new qe({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester($.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester($.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(Xe.TERRAIN_SURFACE,this),this._handles.add([T((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),w),T((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),v),T((()=>this.extent),(()=>this._updateRootTiles()),w),this.view.on("resize",(()=>this._viewChangeUpdate())),T((()=>{const e=this.view,t=e.state;return[this._lodBias,this.lodSnapping,e.resourceController?.memoryController?.memoryFactor,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),y),T((()=>this.view.qualitySettings?.tiledSurface?.textureFadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),w),T((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),v)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),je.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),H(),Ae()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){const e=this.view.pointsOfInterest?.contentCameraOnSurface?.scale;if(e){const t=this.view.state.contentCamera;let i=Q(this.view,t.eye,t.viewForward,t.up).tilt;i>90&&(i=180-i);const r=2*(i/90)**2,s=X(this.view,e)-r;Math.abs(this._snapLevel-s)>Ye&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?ie.ON:ie.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(p(t)||p(e))return null;const i=A(),r=Y(t,i,e)?i:null,s=this._get("extent");return I(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=V(this.groundExtent,this._userClippingExtent,A()),t=this._get("extent");return I(e,t)?t:e}get groundExtent(){return u(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get viewingMode(){return this.view.state.viewingMode}get ready(){return u(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get spatialReference(){return this.tilingScheme?.spatialReference??null}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._updateTransparentTerrain()}_updateTransparentTerrain(){const e=!this.renderingDisabled&&!this.opaque;this.view?._stage?.renderView.setRenderParameters({transparentTerrain:e})}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}set _visible(e){e!==this._visibleCached&&(this._visibleCached=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,tt);return p(s)?null:Z(tt[0],tt[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=tt){const a=this.rootTiles;if(p(a)||!a.length)return null;if(0===a[0].layerInfo[se.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!R(s,r,s,this.tilingScheme?.spatialReference))return o.getLogger(this.declaredClass).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let n of a){if(!n.containsPoint(s))continue;for(;n&&!n.rendered&&!n.isLeaf;){let e=0;s[0]>.5*(n.extent[0]+n.extent[2])&&(e+=1),s[1]<.5*(n.extent[1]+n.extent[3])&&(e+=2),n=n.children[e]}const e=n.renderData;return(e?e.geometryState.samplerData:null)?n:null}return null}get elevationBounds(){return this._elevationBounds}getScale(e){if(this.tilingScheme){if(!M(e,tt,this.spatialReference))return o.getLogger(this.declaredClass).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(u(t))for(let e of t)if(e?.containsPoint(tt)){for(;!e.isLeaf&&!e.rendered;){let t=0;tt[0]>e.children[0].extent[2]&&(t+=1),tt[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereElevationBounds(e,t,i,r,s){if(tt[0]=e,tt[1]=t,tt[2]=i,tt[3]=r,!R(tt,s,tt,this.tilingScheme?.spatialReference))return o.getLogger(this.declaredClass).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;let a=1/0,n=-1/0;const l=e=>{if(e&&O(e.extent,tt))if(e.isLeaf||e.rendered)a=Math.min(a,e.elevationBounds[0]),n=Math.max(n,e.elevationBounds[1]);else for(const t of e.children)l(t)},h=this.rootTiles;if(u(h))for(const o of h)l(o);return{min:a,max:n}}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!M(e,tt,this.spatialReference))return o.getLogger(this.declaredClass).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;tt[3]=t;let i=null;const r=e=>{if(e&&O(e.extent,tt))if(e.isLeaf||e.rendered){const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}else for(const t of e.children)r(t)},s=this.rootTiles;if(u(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1&&!this.hasCompositeBlendMode,this._renderer.isTransparent=this._allSurfaceLayersTransparent();const i=t!==this._renderer.opaque;i&&this._updateTransparentTerrain(),this._updateTileTextures(i?re.UNFADED:re.IMMEDIATE)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;e!==this.tilingScheme&&(fe(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles()))}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return rt[0]=e,rt[1]=t,rt[2]=i,s.init(rt,r,this),s}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=it;let s=t.rootTilesInExtent(e,i,5*de);if(u(this.rootTiles)){if(s.length>de)return void o.getLogger(this.declaredClass).warn(pe);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,Je);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>Je(t,e.lij)))>-1)||(this._purgeTile(e,!0),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>de&&(o.getLogger(this.declaredClass).warn(ue),s=t.rootTilesInExtent(e,i,de)),this._setRootTiles(s.map((e=>this._newRootTile(e))));I(i,this._rootTilesExtent)||(this._rootTilesExtent=A(i)),this._visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._allTiles.forEach((e=>{e.isLoaded&&this._prepareToLoadTile(e)})),this._allTiles.forAll((e=>{e.isLoaded&&(this._updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e))})),this._updatingRootTiles=!1,this.checkAllTileWaterproofness()}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ie.SPLIT&&t.setPendingUpdate(Ie.SPLIT),this._loadTile(t),this.deferTileNeighborUpdate||t.checkGeometryWaterproofness(),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),u(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visibleCached&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Ie.GEOMETRY)&&this._updateTileGeometry(e)}_updateTilesVisibility(e){if(p(e))return;const t=Ne(e);let i=t?this._elevationBounds.min:1/0,r=t?this._elevationBounds.max:-1/0;const s=this.extent,a=this._viewProjectionMatrix;this.setTileTreeDirty();const n=this._iteratorPool.acquire();for(n.reset(e);!n.done;){const e=n.next();e.updateClippingStatus(s)&&e.resetPendingUpdate(Ie.GEOMETRY)&&this._updateTileGeometry(e),e.setPendingUpdate(Ie.RENDERDATA),e.computeVisibility(),e.updateScreenDepth(a),e.renderData&&(i=Math.min(e.elevationBounds[0],i),r=Math.max(e.elevationBounds[1],r))}n.remove(),this._viewChanged=!0,this._allTilesDirty=!0,isFinite(i)&&isFinite(r)&&(this._elevationBounds.min===i&&this._elevationBounds.max===r||(this._elevationBounds.min=i,this._elevationBounds.max=r,this.emit("elevation-bounds-change",null)))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(p(this._splitLimits.frustum)&&(this._splitLimits.frustum=N()),k(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,k(this._frustum,e.frustum),E(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),U(this._eyePosRenderSR,t.eye),R(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(Ze(e)?(this._loadChildren(e),this.deferTileNeighborUpdate||(this._checkTileNeighborsWaterproofness(e),e.children.forEach((e=>e.checkGeometryWaterproofness())))):et(e)&&this._loadParent(e))}_updateTileGeometry(e){e.updateVisibility(),this._renderer.updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e),this._elevationUpdate(e),this._usedMemory=null,this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e)}_updateTileNeighborsAfterGeometryChange(e,t){if(this.deferTileNeighborUpdate){const t=this.neighborTilesToUpdate;e.forEachLoadedNeighbor((e=>{t.add(e)}))}else e.updateNeighborsAfterGeometryChange(t)}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Ie.TEXTURE_FADING)?Ie.TEXTURE_FADING:!!e.resetPendingUpdate(Ie.TEXTURE_NOFADING)&&Ie.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_elevationUpdate(e){at.spatialReference=this.spatialReference,at.tile=e,at.extent=e.extent,this.emit("elevation-change",at)}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateTileStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done?this.requestUpdate():this._usedMemory=this._recalculateUsedMemory(),this.notifyChange("updatingProgressValue")}_updateTileStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next(),i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i!==Ie.SPLIT){if(e.resetPendingUpdate(Ie.SPLIT)&&e.updateAgentSuspension(),i===Ie.VSPLITMERGE&&e.updateAgents(se.ELEVATION),t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(Ie.MERGE),e.resetPendingUpdate(Ie.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}else e.resetPendingUpdate(Ie.MERGE),e.isLeaf&&(e.setPendingUpdate(Ie.SPLIT),t.skipSubtree())}t.remove(),this.requestUpdate(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(ke(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_prepareBatchTileGeometryUpdate(){Te(0===this.neighborTilesToUpdate.size),this.enableBatchTileGeometryUpdates&&(this.deferTileNeighborUpdate=!0)}_batchUpdateUpdatedTileNeighbors(){if(this.enableBatchTileGeometryUpdates){this.deferTileNeighborUpdate=!1;const e=this.neighborTilesToUpdate;(()=>{const t=()=>{for(const t of e)t.updateNeighborsWithChangedEdgeResolution()};(()=>{for(const t of e)t.updateNeighborDataAndGeometryIfNeeded()})(),t(),e.clear()})()}}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate(),this._prepareBatchTileGeometryUpdate();let i=!1,r=!1;for(;!e.done;){r=!0;let s=!1;const a=!this._allTiles.some((r=>{if(!i&&!r.loadable)return e.done;let a=r;if(r.resetPendingUpdate(Ie.MERGE)){if(!t)return r.setPendingUpdate(Ie.MERGE),e.done;for(;a.parent?.resetPendingUpdate(Ie.MERGE);)a=a.parent;this._mergeTile(a),s=!0,e.madeProgress()}else r.resetPendingUpdate(Ie.SPLIT)&&(this._splitTile(r),s=!0,e.madeProgress());return!e.done&&a===r&&r.resetPendingUpdate(Ie.RENDERDATA)&&(this._updateRenderData(r),e.madeProgress()),e.done}));if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),a){if(!i){i=!0;continue}if(!s)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}r||(this._allTilesDirty=!0),this._batchUpdateUpdatedTileNeighbors(),this._sortTiles(e)}_updateElevation(e){return this._prepareBatchTileGeometryUpdate(),this._allTiles.some((t=>(t.resetPendingUpdate(Ie.GEOMETRY)&&(this._updateTileGeometry(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),this._batchUpdateUpdatedTileNeighbors(),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(He.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ce}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){u(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e,!1))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this._visible=!1}_purgeDescendantTiles(e){if(e.isLeaf)return!1;let t=!1;for(let i=0;i<4;++i)t=this._purgeTile(e.children[i],!1)||t;return e.unsetChildren(),t}_purgeTile(e,t){const i=this._purgeDescendantTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),this._unloadTile(e),t&&this._updateTileNeighborsAfterGeometryChange(e),this._tilePool.release(e),i}_unloadTile(e){this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e),e.unload(this._renderer)}_splitTile(e){fe(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(Ie.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,this._emitTileScaleChange(e,t),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){nt.spatialReference=this.spatialReference,nt.extent=e.extent,nt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",nt)}_createTile(e,t,i,r){fe(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ie.SPLIT&&s.setPendingUpdate(Ie.SPLIT),s}_mergeTile(e){fe(!e.hasPendingUpdate(Ie.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(e)&&(fe(!e.renderData,"_mergeTile sanity check"),this._loadTile(e),this._updateTileNeighborsAfterGeometryChange(e),this.deferTileNeighborUpdate||this._checkTileAndNeighborsWaterproofness(e)),this._allTilesDirty=!0,++this._performanceInfo.numMerged,this._emitTileScaleChange(e)}_checkTileAndNeighborsWaterproofness(e){e.checkGeometryWaterproofness(),this._checkTileNeighborsWaterproofness(e)}_checkTileNeighborsWaterproofness(e){Ce&&e.forallNeighbors((e=>!!e.isLoaded&&(e.checkGeometryWaterproofness(),!0)))}_loadChildren(e){this.deferTileNeighborUpdate||this._checkTileAndNeighborsWaterproofness(e),fe(e.rendered,"parent should be rendered"),this._unloadTile(e);const t=e.children;t.forEach((e=>this._prepareToLoadTile(e))),t.forEach((e=>this._loadTilePrepared(e))),this._updateTileNeighborsAfterGeometryChange(e,e.level+1),this.deferTileNeighborUpdate||(t.forEach((e=>e.updateNeighborsWithChangedEdgeResolution())),t.forEach((e=>e.checkGeometryWaterproofness())),this._checkTileNeighborsWaterproofness(e))}_loadParent(e){this.deferTileNeighborUpdate||this._checkTileAndNeighborsWaterproofness(e);const t=e.parent;this._unloadChildren(t),this._loadTile(t),this._updateTileNeighborsAfterGeometryChange(t),this.deferTileNeighborUpdate||this._checkTileAndNeighborsWaterproofness(t)}_unloadChildren(e){if(!e.isLeaf)for(let t=0;t<4;++t){const i=e.children[t];this._unloadChildren(i),this._unloadTile(i)}}_postLoadTile(e){e.setPendingUpdate(Ie.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e),this._elevationUpdate(e)}_loadTile(e){e.load(this._renderer),this._postLoadTile(e)}_loadTilePrepared(e){e.loadPrepared(this._renderer),this._postLoadTile(e)}_prepareToLoadTile(e){e.prepareToLoad(this._renderer)}_elevationDataArrived(e,t,i){const r=new ee(e.lij,e.extent,i);e.dataArrived(t,se.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=ze){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),ye(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._getLayerIdxByUID(e,s.uid);u(i)&&((i<r||p(r))&&(t=!0),r=i)}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allSurfaceLayersTransparent(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),e.madeProgress()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(ve(t)&&!W(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if(we(e)){const t=Le(e.layer.parent)?"normal":e.layer.blendMode;if(We(Fe[t]))return!0}return!1}_layerClassFromLayerView(e){return Se(e)?se.ELEVATION:se.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(T((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(T((()=>e.fullOpacity),(()=>this._updateTileTextures(re.UNFADED)))),t.push(T((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),we(e)&&t.push(T((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(re.UNFADED)}))),e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(i,e.uid);u(t)&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach((e=>{if(!e.layer||e.suspended||!ye(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===se.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of ae){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),o=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const l=e.indexOf(i[t]);n[t]=l,t!==l&&(a=!0),l>-1&&(o[l]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(o,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===se.ELEVATION&&i.computeElevationBounds()}}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(se.MAP),e===re.IMMEDIATE?this.renderer.updateTileTexture(t,Ie.TEXTURE_NOFADING):t.updateRenderData(se.MAP,e)})),this._renderer.isTransparent=this._allSurfaceLayersTransparent()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=He.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||be(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,g(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===se.ELEVATION?Se(i)?this._requestElevationTileData(e,i,r):Promise.reject():ve(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{if(m(i))return;const s=this._layerIndexByUid[se.ELEVATION].get(t.uid);null!=s?(this._usedMemory=null,this.requestUpdate(),this._elevationDataArrived(e,s,r)):o.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer %d %s",se.ELEVATION,e.lij.toString())},s=i=>{g(i)||(this._dataMissing(e,se.ELEVATION,t,i),this.requestUpdate())};if(Ee(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:_e,signal:i.signal}).then((e=>{if(!m(i))return this._frameTask.schedule((()=>r(e)),i.signal,s);o.getLogger(this.declaredClass).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")}),s).finally((()=>{--this._asyncWorkItems}));const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:_e},i.signal))).then((e=>{e?r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue}):s(new Error("LERC decoding failed"))}),s).finally((()=>{--this._asyncWorkItems}))}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,xe(s),m(i)||(this._dataMissing(e,se.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),m(i)?xe(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(be(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(De(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(Ue(t)&&Ee(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(m(i))return o.getLogger(this.declaredClass).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(f());a(e)}),n);let l=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);q(t.layer)&&t.layer.refreshTimestamp&&(l+=`${l.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const h=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(l,h,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._getLayerIdxByUID(se.MAP,t.uid);u(r)?e.dataArrived(r,se.MAP,i):(xe(i),o.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer"))}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i,r){const s=this._getLayerIdxByUID(t,i.uid);u(s)?e.dataMissing(s,t,r):o.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(p(this._usedMemory)&&(this._usedMemory=this._recalculateUsedMemory()),u(this._usedMemory)?this._usedMemory:0):0}_recalculateUsedMemory(){return this.tilingScheme?this._allTiles.reduce(((e,t)=>e+t.usedMemory),0):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._getLayerIdxByUID(i,e.uid);return u(r)&&this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(p(e)||p(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return fe(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{u(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){st.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&st.push(e)}));const t=st.toArray();return Be(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}checkAllTileWaterproofness(){if(!Ce)return;const e=this.rootTiles;if(p(e))return;const t=e=>e?.renderData?.geometryInfo?.indices?.length>0??!1,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometryInfo&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometryInfo||(e.renderData.geometryInfo.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometryInfo),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.isLeaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.isLeaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get shadingEnabled(){return this._renderer.shadingEnabled}get isWebMercator(){return!!this.tilingScheme?.spatialReference.isWebMercator}get isWebMercatorOnPlateeCarree(){return this.isWebMercator&&B(this.view?.renderSpatialReference)}isEastEndWrap(e){return this.isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this.isGlobal&&0===e[2]}lijEastEnd(e){return 2**(e+(u(this.spatialReference)&&this.spatialReference.isGeographic?1:0))}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this.isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Pe(e)}enableWaterproofnessChecks(e){Re(e)}};e([S()],$e.prototype,"_renderer",void 0),e([S()],$e.prototype,"_hasPendingUpdates",void 0),e([S()],$e.prototype,"_asyncWorkItems",void 0),e([S()],$e.prototype,"_allTilesDirty",void 0),e([S()],$e.prototype,"_allTilesSorted",void 0),e([S()],$e.prototype,"_viewChanged",void 0),e([S({readOnly:!0})],$e.prototype,"_watchUpdatingTracking",void 0),e([S()],$e.prototype,"_frameTask",void 0),e([S({readOnly:!0})],$e.prototype,"snapLevel",null),e([S({readOnly:!0})],$e.prototype,"lodSnapping",null),e([S({constructOnly:!0})],$e.prototype,"view",void 0),e([S()],$e.prototype,"_userClippingExtent",null),e([S()],$e.prototype,"_rootTilesExtent",void 0),e([S({readOnly:!0})],$e.prototype,"extent",null),e([S({readOnly:!0})],$e.prototype,"groundExtent",null),e([S({readOnly:!0})],$e.prototype,"_tilingSchemeExtent",null),e([S({readOnly:!0})],$e.prototype,"updating",null),e([S(K)],$e.prototype,"updatingProgress",void 0),e([S({readOnly:!0})],$e.prototype,"updatingProgressValue",null),e([S()],$e.prototype,"_maxNumUpdating",void 0),e([S({aliasOf:"view.map.ground.opacity"})],$e.prototype,"baseOpacity",void 0),e([S()],$e.prototype,"hasCompositeBlendMode",void 0),e([S({readOnly:!0})],$e.prototype,"overlayManager",void 0),e([S({readOnly:!0})],$e.prototype,"viewingMode",null),e([S()],$e.prototype,"maxTextureScale",void 0),e([S({readOnly:!0})],$e.prototype,"ready",null),e([S({value:le.FRONT_TO_BACK})],$e.prototype,"renderOrder",null),e([S({readOnly:!0})],$e.prototype,"rootTiles",void 0),e([S({readOnly:!0})],$e.prototype,"spatialReference",null),e([S({type:t,aliasOf:"view.map.ground.surfaceColor"})],$e.prototype,"backgroundColor",void 0),e([S({value:!1})],$e.prototype,"slicePlaneEnabled",null),e([S({readOnly:!0})],$e.prototype,"tilingScheme",void 0),e([S({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeLocked"})],$e.prototype,"tilingSchemeLocked",void 0),e([S({readOnly:!0})],$e.prototype,"tilingSchemeLogic",void 0),e([S({value:!0})],$e.prototype,"velvetOverground",null),e([L("_renderer.wireframe")],$e.prototype,"wireframe",void 0),e([S({value:!1})],$e.prototype,"suspended",null),e([S({readOnly:!0,aliasOf:"view.qualitySettings.tiledSurface.textureFadeDuration"})],$e.prototype,"textureFadeDuration",void 0),e([S()],$e.prototype,"_layerViewsDirty",void 0),e([L("_renderer.renderPatchBorders")],$e.prototype,"renderPatchBorders",void 0),e([L("_renderer.renderingDisabled")],$e.prototype,"renderingDisabled",void 0),$e=e([b("esri.views.3d.terrain.TerrainSurface")],$e);const Ke=$e;function Je(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Ze(e){return!e.isLeaf&&(e.children.some((e=>e.shouldLoad))||e.children.some((e=>Ze(e))))}function et(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const tt=C(),it=A(),rt=[0,0,0],st=new _,at={spatialReference:null,tile:null,extent:null,context:"ground"},nt={spatialReference:null,extent:null,scale:0};export{Ke as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as p,isSome as u}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as g,isAborted as m,createAbortError as f}from"../../../core/promiseUtils.js";import{watch as T,syncAndInitial as y,sync as v,initial as w}from"../../../core/reactiveUtils.js";import{property as L}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";import{m as b}from"../../../chunks/mat4.js";import{c as E}from"../../../chunks/mat4f64.js";import{c as D}from"../../../chunks/vec3.js";import{c as U}from"../../../chunks/vec3f64.js";import{c as x}from"../../../chunks/vec4f64.js";import{WatchUpdatingTracking as C}from"../../../core/support/WatchUpdatingTracking.js";import{projectVectorToVector as P,projectPointToVector as R}from"../../../geometry/projection.js";import{getReferenceEllipsoid as M}from"../../../geometry/projectionEllipsoid.js";import{create as j,equals as A,intersection as I,intersectsSphere as V}from"../../../geometry/support/aaBoundingRect.js";import{create as O,copy as N}from"../../../geometry/support/frustum.js";import{isPlateCarree as k}from"../../../geometry/support/spatialReferenceUtils.js";import{isRefreshableLayer as B}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as q}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as G}from"../../../layers/support/layerUtils.js";import{acquireDecoder as W}from"../../../layers/support/LercDecoder.js";import{printAllocations as F}from"../../2d/engine/vectorTiles/VectorTile.js";import{directionToHeadingTilt as H,scaleToZoom as Q}from"../support/cameraUtils.js";import X from"../support/debugFlags.js";import{toBoundingRect as z}from"../support/extentUtils.js";import{ClientType as Y}from"../support/index.js";import{updatingProgress as $}from"../support/updatingProperties.js";import{ElevationBounds as K}from"./ElevationBounds.js";import{sampleElevation as J,ElevationData as Z}from"./ElevationData.js";import{create as ee}from"./ExtentHelper.js";import{LODSnapping as te,TextureUpdate as ie}from"./interfaces.js";import{LayerClass as re,LayerClasses as se}from"./LayerClass.js";import{OverlayManager as ae}from"./OverlayManager.js";import{PlanarPatch as ne}from"./PlanarPatch.js";import{RenderOrder as le}from"./RenderOrder.js";import{SphericalPatch as oe}from"./SphericalPatch.js";import{MAX_ROOT_TILES as he,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as de,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as pe,MAX_MEMORY_LOD_BIAS as ue,ELEVATION_NODATA_VALUE as ce}from"./TerrainConst.js";import _e from"./TerrainRenderer.js";import ge from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as me,internalAssert as fe,isSurfaceLayerView as Te,isMapTileLayerView as ye,isBlendableLayerView as ve,isGroupLayer as we,isElevationLayerView as Le,isVectorTileLayerView as Se,useFetchTileForLayer as be,isImageryTileLayerView as Ee,isTileLayerView as De,releaseTileData as Ue,ENABLE_WATERPROOFNESS_TESTS as xe,enableTerrainInternalChecks as Ce,enableTerrainWaterproofnessChecks as Pe}from"./terrainUtils.js";import{SplitLimits as Re,Tile as Me}from"./Tile.js";import{printAllocations as je}from"./TilePerLayerInfo.js";import{TileUpdate as Ae}from"./TileUpdate.js";import{IteratorPreorder as Ie,IteratorPostorder as Ve,hasLoadableSiblings as Oe,sortTilesByPOI as Ne,sortTiles as ke}from"./tileUtils.js";import{TilingSchemeLogic as Be}from"./TilingSchemeLogic.js";import{UpsampleInfo as qe}from"./UpsampleInfo.js";import{isCompositeBlendMode as Ge,blendModeFromString as We}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{RenderRequestType as Fe}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as He,TaskPriority as Qe,noBudget as Xe}from"../../support/Scheduler.js";const ze=.25;let Ye=class extends(a.EventedMixin(i)){constructor(e){super(e),this._elevationBounds=new K,this._iteratorPool=new c(Ie,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ve,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visibleCached=!1,this._usedMemory=null,this._performanceInfo=new ge,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=U(),this._eyePosSurfaceSR=U(),this._splitLimits=new Re,this._snapLevel=1/0,this._frustum=O(),this._viewProjectionMatrix=E(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new C,this._frameTask=He,this._allTiles=new _,this._upsampleInfoPool=new c(qe),this._rootTilesExtent=j(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.backgroundColor=null,this._updatingRootTiles=!1,this.deferTileNeighborUpdate=!1,this.neighborTilesToUpdate=new Set,this.enableBatchTileGeometryUpdates=!0,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this._isGlobal=!e.view?.state?.isLocal}initialize(){this._lercDecoder=W(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(ne):new c(oe);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new q(e.newCache("elevation-query")),this._set("overlayManager",new ae({surface:this})),this._handles.add([T((()=>this.overlayManager.hasHighlights),(e=>this._renderer.setNeedsHighlight(e))),T((()=>this.overlayManager.rendersOccluded),(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new _e({_overlayRenderer:this.overlayManager.renderer,_ellipsoidRadius:M(this.view.spatialReference).radius,_stage:this.view._stage,_allTiles:this._allTiles}),this._handles.add([T((()=>this.baseOpacity),(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),y),T((()=>this.hasCompositeBlendMode),(()=>{this._updateBaseOpacity(this.baseOpacity)}),y),T((()=>this.renderingDisabled),(()=>this._updateTransparentTerrain()),v),T((()=>this.backgroundColor),(e=>{this._handleLayerViewChanges(),this._renderer.updateTileBackground(e)}),y),T((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),T((()=>X.TERRAIN_TILE_TREE_SHOW_TILES),(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&X.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}),w)]),this._extentHelper=ee(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>this.view?.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new Be({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(Y.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(Y.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(Qe.TERRAIN_SURFACE,this),this._handles.add([T((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),w),T((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),v),T((()=>this.extent),(()=>this._updateRootTiles()),w),this.view.on("resize",(()=>this._viewChangeUpdate())),T((()=>{const e=this.view,t=e.state;return[this._lodBias,this.lodSnapping,e.resourceController?.memoryController?.memoryFactor,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),y),T((()=>this.view.qualitySettings?.tiledSurface?.textureFadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),w),T((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),v)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),Me.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),F(),je()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){const e=this.view.pointsOfInterest?.contentCameraOnSurface?.scale;if(e){const t=this.view.state.contentCamera;let i=H(this.view,t.eye,t.viewForward,t.up).tilt;i>90&&(i=180-i);const r=2*(i/90)**2,s=Q(this.view,e)-r;Math.abs(this._snapLevel-s)>ze&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?te.ON:te.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(p(t)||p(e))return null;const i=j(),r=z(t,i,e)?i:null,s=this._get("extent");return A(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=I(this.groundExtent,this._userClippingExtent,j()),t=this._get("extent");return A(e,t)?t:e}get groundExtent(){return u(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get viewingMode(){return this.view.state.viewingMode}get ready(){return u(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get spatialReference(){return this.tilingScheme?.spatialReference??null}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._updateTransparentTerrain()}_updateTransparentTerrain(){const e=!this.renderingDisabled&&!this.opaque;this.view?._stage?.renderView.setRenderParameters({transparentTerrain:e})}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}get wireframe(){return this._renderer.wireframe}set wireframe(e){this._renderer.wireframe=e}set _visible(e){e!==this._visibleCached&&(this._visibleCached=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,et);return p(s)?null:J(et[0],et[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=et){const a=this.rootTiles;if(p(a)||!a.length)return null;if(0===a[0].layerInfo[re.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!P(s,r,s,this.tilingScheme?.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let n of a){if(!n.containsPoint(s))continue;for(;n&&!n.rendered&&!n.isLeaf;){let e=0;s[0]>.5*(n.extent[0]+n.extent[2])&&(e+=1),s[1]<.5*(n.extent[1]+n.extent[3])&&(e+=2),n=n.children[e]}const e=n.renderData;return(e?e.geometryState.samplerData:null)?n:null}return null}get elevationBounds(){return this._elevationBounds}getScale(e){if(this.tilingScheme){if(!R(e,et,this.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(u(t))for(let e of t)if(e?.containsPoint(et)){for(;!e.isLeaf&&!e.rendered;){let t=0;et[0]>e.children[0].extent[2]&&(t+=1),et[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereElevationBounds(e,t,i,r,s){if(et[0]=e,et[1]=t,et[2]=i,et[3]=r,!P(et,s,et,this.tilingScheme?.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;let a=1/0,n=-1/0;const o=e=>{if(e&&V(e.extent,et))if(e.isLeaf||e.rendered)a=Math.min(a,e.elevationBounds[0]),n=Math.max(n,e.elevationBounds[1]);else for(const t of e.children)o(t)},h=this.rootTiles;if(u(h))for(const l of h)o(l);return{min:a,max:n}}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!R(e,et,this.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;et[3]=t;let i=null;const r=e=>{if(e&&V(e.extent,et))if(e.isLeaf||e.rendered){const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}else for(const t of e.children)r(t)},s=this.rootTiles;if(u(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1&&!this.hasCompositeBlendMode,this._renderer.isTransparent=this._allSurfaceLayersTransparent();const i=t!==this._renderer.opaque;i&&this._updateTransparentTerrain(),this._updateTileTextures(i?ie.UNFADED:ie.IMMEDIATE)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;e!==this.tilingScheme&&(me(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles()))}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return it[0]=e,it[1]=t,it[2]=i,s.init(it,r,this),s}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=tt;let s=t.rootTilesInExtent(e,i,5*he);if(u(this.rootTiles)){if(s.length>he)return void l.getLogger(this.declaredClass).warn(de);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,Ke);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>Ke(t,e.lij)))>-1)||(this._purgeTile(e,!0),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>he&&(l.getLogger(this.declaredClass).warn(pe),s=t.rootTilesInExtent(e,i,he)),this._setRootTiles(s.map((e=>this._newRootTile(e))));A(i,this._rootTilesExtent)||(this._rootTilesExtent=j(i)),this._visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._allTiles.forEach((e=>{e.isLoaded&&this._prepareToLoadTile(e)})),this._allTiles.forAll((e=>{e.isLoaded&&(this._updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e))})),this._updatingRootTiles=!1,this.checkAllTileWaterproofness()}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ae.SPLIT&&t.setPendingUpdate(Ae.SPLIT),this._loadTile(t),this.deferTileNeighborUpdate||t.checkGeometryWaterproofness(),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),u(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visibleCached&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Ae.GEOMETRY)&&this._updateTileGeometry(e)}_updateTilesVisibility(e){if(p(e))return;const t=Oe(e);let i=t?this._elevationBounds.min:1/0,r=t?this._elevationBounds.max:-1/0;const s=this.extent,a=this._viewProjectionMatrix;this.setTileTreeDirty();const n=this._iteratorPool.acquire();for(n.reset(e);!n.done;){const e=n.next();e.updateClippingStatus(s)&&e.resetPendingUpdate(Ae.GEOMETRY)&&this._updateTileGeometry(e),e.setPendingUpdate(Ae.RENDERDATA),e.computeVisibility(),e.updateScreenDepth(a),e.renderData&&(i=Math.min(e.elevationBounds[0],i),r=Math.max(e.elevationBounds[1],r))}n.remove(),this._viewChanged=!0,this._allTilesDirty=!0,isFinite(i)&&isFinite(r)&&(this._elevationBounds.min===i&&this._elevationBounds.max===r||(this._elevationBounds.min=i,this._elevationBounds.max=r,this.emit("elevation-bounds-change",null)))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(p(this._splitLimits.frustum)&&(this._splitLimits.frustum=O()),N(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,N(this._frustum,e.frustum),b(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),D(this._eyePosRenderSR,t.eye),P(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(Je(e)?(this._loadChildren(e),this.deferTileNeighborUpdate||(this._checkTileNeighborsWaterproofness(e),e.children.forEach((e=>e.checkGeometryWaterproofness())))):Ze(e)&&this._loadParent(e))}_updateTileGeometry(e){e.updateVisibility(),this._renderer.updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e),this._elevationUpdate(e),this._usedMemory=null,this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e)}_updateTileNeighborsAfterGeometryChange(e,t){if(this.deferTileNeighborUpdate){const t=this.neighborTilesToUpdate;e.forEachLoadedNeighbor((e=>{t.add(e)}))}else e.updateNeighborsAfterGeometryChange(t)}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Ae.TEXTURE_FADING)?Ae.TEXTURE_FADING:!!e.resetPendingUpdate(Ae.TEXTURE_NOFADING)&&Ae.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_elevationUpdate(e){st.spatialReference=this.spatialReference,st.tile=e,st.extent=e.extent,this.emit("elevation-change",st)}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateTileStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done?this.requestUpdate():this._usedMemory=this._recalculateUsedMemory(),this.notifyChange("updatingProgressValue")}_updateTileStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next(),i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i!==Ae.SPLIT){if(e.resetPendingUpdate(Ae.SPLIT)&&e.updateAgentSuspension(),i===Ae.VSPLITMERGE&&e.updateAgents(re.ELEVATION),t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(Ae.MERGE),e.resetPendingUpdate(Ae.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}else e.resetPendingUpdate(Ae.MERGE),e.isLeaf&&(e.setPendingUpdate(Ae.SPLIT),t.skipSubtree())}t.remove(),this.requestUpdate(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Ne(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_prepareBatchTileGeometryUpdate(){fe(0===this.neighborTilesToUpdate.size),this.enableBatchTileGeometryUpdates&&(this.deferTileNeighborUpdate=!0)}_batchUpdateUpdatedTileNeighbors(){if(this.enableBatchTileGeometryUpdates){this.deferTileNeighborUpdate=!1;const e=this.neighborTilesToUpdate;(()=>{const t=()=>{for(const t of e)t.updateNeighborsWithChangedEdgeResolution()};(()=>{for(const t of e)t.updateNeighborDataAndGeometryIfNeeded()})(),t(),e.clear()})()}}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate(),this._prepareBatchTileGeometryUpdate();let i=!1,r=!1;for(;!e.done;){r=!0;let s=!1;const a=!this._allTiles.some((r=>{if(!i&&!r.loadable)return e.done;let a=r;if(r.resetPendingUpdate(Ae.MERGE)){if(!t)return r.setPendingUpdate(Ae.MERGE),e.done;for(;a.parent?.resetPendingUpdate(Ae.MERGE);)a=a.parent;this._mergeTile(a),s=!0,e.madeProgress()}else r.resetPendingUpdate(Ae.SPLIT)&&(this._splitTile(r),s=!0,e.madeProgress());return!e.done&&a===r&&r.resetPendingUpdate(Ae.RENDERDATA)&&(this._updateRenderData(r),e.madeProgress()),e.done}));if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),a){if(!i){i=!0;continue}if(!s)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}r||(this._allTilesDirty=!0),this._batchUpdateUpdatedTileNeighbors(),this._sortTiles(e)}_updateElevation(e){return this._prepareBatchTileGeometryUpdate(),this._allTiles.some((t=>(t.resetPendingUpdate(Ae.GEOMETRY)&&(this._updateTileGeometry(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),this._batchUpdateUpdatedTileNeighbors(),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(Fe.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ue}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){u(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e,!1))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this._visible=!1}_purgeDescendantTiles(e){if(e.isLeaf)return!1;let t=!1;for(let i=0;i<4;++i)t=this._purgeTile(e.children[i],!1)||t;return e.unsetChildren(),t}_purgeTile(e,t){const i=this._purgeDescendantTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),this._unloadTile(e),t&&this._updateTileNeighborsAfterGeometryChange(e),this._tilePool.release(e),i}_unloadTile(e){this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e),e.unload(this._renderer)}_splitTile(e){me(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(Ae.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,this._emitTileScaleChange(e,t),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){at.spatialReference=this.spatialReference,at.extent=e.extent,at.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",at)}_createTile(e,t,i,r){me(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ae.SPLIT&&s.setPendingUpdate(Ae.SPLIT),s}_mergeTile(e){me(!e.hasPendingUpdate(Ae.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(e)&&(me(!e.renderData,"_mergeTile sanity check"),this._loadTile(e),this._updateTileNeighborsAfterGeometryChange(e),this.deferTileNeighborUpdate||this._checkTileAndNeighborsWaterproofness(e)),this._allTilesDirty=!0,++this._performanceInfo.numMerged,this._emitTileScaleChange(e)}_checkTileAndNeighborsWaterproofness(e){e.checkGeometryWaterproofness(),this._checkTileNeighborsWaterproofness(e)}_checkTileNeighborsWaterproofness(e){xe&&e.forallNeighbors((e=>!!e.isLoaded&&(e.checkGeometryWaterproofness(),!0)))}_loadChildren(e){this.deferTileNeighborUpdate||this._checkTileAndNeighborsWaterproofness(e),me(e.rendered,"parent should be rendered"),this._unloadTile(e);const t=e.children;t.forEach((e=>this._prepareToLoadTile(e))),t.forEach((e=>this._loadTilePrepared(e))),this._updateTileNeighborsAfterGeometryChange(e,e.level+1),this.deferTileNeighborUpdate||(t.forEach((e=>e.updateNeighborsWithChangedEdgeResolution())),t.forEach((e=>e.checkGeometryWaterproofness())),this._checkTileNeighborsWaterproofness(e))}_loadParent(e){this.deferTileNeighborUpdate||this._checkTileAndNeighborsWaterproofness(e);const t=e.parent;this._unloadChildren(t),this._loadTile(t),this._updateTileNeighborsAfterGeometryChange(t),this.deferTileNeighborUpdate||this._checkTileAndNeighborsWaterproofness(t)}_unloadChildren(e){if(!e.isLeaf)for(let t=0;t<4;++t){const i=e.children[t];this._unloadChildren(i),this._unloadTile(i)}}_postLoadTile(e){e.setPendingUpdate(Ae.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e),this._elevationUpdate(e)}_loadTile(e){e.load(this._renderer),this._postLoadTile(e)}_loadTilePrepared(e){e.loadPrepared(this._renderer),this._postLoadTile(e)}_prepareToLoadTile(e){e.prepareToLoad(this._renderer)}_elevationDataArrived(e,t,i){const r=new Z(e.lij,e.extent,i);e.dataArrived(t,re.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=Xe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),Te(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._getLayerIdxByUID(e,s.uid);u(i)&&((i<r||p(r))&&(t=!0),r=i)}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allSurfaceLayersTransparent(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),e.madeProgress()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(ye(t)&&!G(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if(ve(e)){const t=we(e.layer.parent)?"normal":e.layer.blendMode;if(Ge(We[t]))return!0}return!1}_layerClassFromLayerView(e){return Le(e)?re.ELEVATION:re.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(T((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(T((()=>e.fullOpacity),(()=>this._updateTileTextures(ie.UNFADED)))),t.push(T((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),ve(e)&&t.push(T((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(ie.UNFADED)}))),e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(i,e.uid);u(t)&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach((e=>{if(!e.layer||e.suspended||!Te(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===re.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of se){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===re.ELEVATION&&i.computeElevationBounds()}}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(re.MAP),e===ie.IMMEDIATE?this.renderer.updateTileTexture(t,Ae.TEXTURE_NOFADING):t.updateRenderData(re.MAP,e)})),this._renderer.isTransparent=this._allSurfaceLayersTransparent()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=Fe.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||Se(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,g(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===re.ELEVATION?Le(i)?this._requestElevationTileData(e,i,r):Promise.reject():ye(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{if(m(i))return;const s=this._layerIndexByUid[re.ELEVATION].get(t.uid);null!=s?(this._usedMemory=null,this.requestUpdate(),this._elevationDataArrived(e,s,r)):l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer %d %s",re.ELEVATION,e.lij.toString())},s=i=>{g(i)||(this._dataMissing(e,re.ELEVATION,t,i),this.requestUpdate())};if(be(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:ce,signal:i.signal}).then((e=>{if(!m(i))return this._frameTask.schedule((()=>r(e)),i.signal,s);l.getLogger(this.declaredClass).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")}),s).finally((()=>{--this._asyncWorkItems}));const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:ce},i.signal))).then((e=>{e?r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue}):s(new Error("LERC decoding failed"))}),s).finally((()=>{--this._asyncWorkItems}))}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Ue(s),m(i)||(this._dataMissing(e,re.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),m(i)?Ue(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(Se(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(Ee(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(De(t)&&be(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(m(i))return l.getLogger(this.declaredClass).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(f());a(e)}),n);let o=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);B(t.layer)&&t.layer.refreshTimestamp&&(o+=`${o.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const h=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(o,h,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._getLayerIdxByUID(re.MAP,t.uid);u(r)?e.dataArrived(r,re.MAP,i):(Ue(i),l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer"))}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i,r){const s=this._getLayerIdxByUID(t,i.uid);u(s)?e.dataMissing(s,t,r):l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(p(this._usedMemory)&&(this._usedMemory=this._recalculateUsedMemory()),u(this._usedMemory)?this._usedMemory:0):0}_recalculateUsedMemory(){return this.tilingScheme?this._allTiles.reduce(((e,t)=>e+t.usedMemory),0):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._getLayerIdxByUID(i,e.uid);return u(r)&&this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(p(e)||p(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return me(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{u(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){rt.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&rt.push(e)}));const t=rt.toArray();return ke(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}checkAllTileWaterproofness(){if(!xe)return;const e=this.rootTiles;if(p(e))return;const t=e=>e?.renderData?.geometryInfo?.indices?.length>0??!1,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometryInfo&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometryInfo||(e.renderData.geometryInfo.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometryInfo),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.isLeaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.isLeaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get shadingEnabled(){return this._renderer.shadingEnabled}get isWebMercator(){return!!this.tilingScheme?.spatialReference.isWebMercator}get isWebMercatorOnPlateeCarree(){return this.isWebMercator&&k(this.view?.renderSpatialReference)}isEastEndWrap(e){return this.isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this.isGlobal&&0===e[2]}lijEastEnd(e){return 2**(e+(u(this.spatialReference)&&this.spatialReference.isGeographic?1:0))}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this.isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ce(e)}enableWaterproofnessChecks(e){Pe(e)}};e([L()],Ye.prototype,"_renderer",void 0),e([L()],Ye.prototype,"_hasPendingUpdates",void 0),e([L()],Ye.prototype,"_asyncWorkItems",void 0),e([L()],Ye.prototype,"_allTilesDirty",void 0),e([L()],Ye.prototype,"_allTilesSorted",void 0),e([L()],Ye.prototype,"_viewChanged",void 0),e([L({readOnly:!0})],Ye.prototype,"_watchUpdatingTracking",void 0),e([L()],Ye.prototype,"_frameTask",void 0),e([L({readOnly:!0})],Ye.prototype,"snapLevel",null),e([L({readOnly:!0})],Ye.prototype,"lodSnapping",null),e([L({constructOnly:!0})],Ye.prototype,"view",void 0),e([L()],Ye.prototype,"_userClippingExtent",null),e([L()],Ye.prototype,"_rootTilesExtent",void 0),e([L({readOnly:!0})],Ye.prototype,"extent",null),e([L({readOnly:!0})],Ye.prototype,"groundExtent",null),e([L({readOnly:!0})],Ye.prototype,"_tilingSchemeExtent",null),e([L({readOnly:!0})],Ye.prototype,"updating",null),e([L($)],Ye.prototype,"updatingProgress",void 0),e([L({readOnly:!0})],Ye.prototype,"updatingProgressValue",null),e([L()],Ye.prototype,"_maxNumUpdating",void 0),e([L({aliasOf:"view.map.ground.opacity"})],Ye.prototype,"baseOpacity",void 0),e([L()],Ye.prototype,"hasCompositeBlendMode",void 0),e([L({readOnly:!0})],Ye.prototype,"overlayManager",void 0),e([L({readOnly:!0})],Ye.prototype,"viewingMode",null),e([L()],Ye.prototype,"maxTextureScale",void 0),e([L({readOnly:!0})],Ye.prototype,"ready",null),e([L({value:le.FRONT_TO_BACK})],Ye.prototype,"renderOrder",null),e([L({readOnly:!0})],Ye.prototype,"rootTiles",void 0),e([L({readOnly:!0})],Ye.prototype,"spatialReference",null),e([L({type:t,aliasOf:"view.map.ground.surfaceColor"})],Ye.prototype,"backgroundColor",void 0),e([L({value:!1})],Ye.prototype,"slicePlaneEnabled",null),e([L({readOnly:!0})],Ye.prototype,"tilingScheme",void 0),e([L({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeLocked"})],Ye.prototype,"tilingSchemeLocked",void 0),e([L({readOnly:!0})],Ye.prototype,"tilingSchemeLogic",void 0),e([L({value:!0})],Ye.prototype,"velvetOverground",null),e([L()],Ye.prototype,"wireframe",null),e([L({value:!1})],Ye.prototype,"suspended",null),e([L({readOnly:!0,aliasOf:"view.qualitySettings.tiledSurface.textureFadeDuration"})],Ye.prototype,"textureFadeDuration",void 0),e([L()],Ye.prototype,"_layerViewsDirty",void 0),e([L()],Ye.prototype,"renderPatchBorders",null),e([L()],Ye.prototype,"renderingDisabled",null),Ye=e([S("esri.views.3d.terrain.TerrainSurface")],Ye);const $e=Ye;function Ke(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Je(e){return!e.isLeaf&&(e.children.some((e=>e.shouldLoad))||e.children.some((e=>Je(e))))}function Ze(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const et=x(),tt=j(),it=[0,0,0],rt=new _,st={spatialReference:null,tile:null,extent:null,context:"ground"},at={spatialReference:null,extent:null,scale:0};export{$e as default};
package/webscene/Slide.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.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{JSONSupport as s}from"../core/JSONSupport.js";import a from"../core/Logger.js";import{isSome as l,removeMaybe as p}from"../core/maybe.js";import{eachAlways as m,onAbortOrThrow as h,isAbortError as c}from"../core/promiseUtils.js";import{watch as u}from"../core/reactiveUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as y}from"../core/accessorSupport/decorators/cast.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as v}from"../core/accessorSupport/ensureType.js";import{d as f}from"../chunks/vec3.js";import{c as w}from"../chunks/vec3f64.js";import b from"../layers/BuildingSceneLayer.js";import L from"../layers/Layer.js";import j from"../layers/MapImageLayer.js";import{isOperationalLayer as T}from"../layers/mixins/OperationalLayer.js";import{ensureType as _,clonePreservingTiledLayers as C}from"../support/basemapUtils.js";import{moduloPositive as S}from"../views/3d/support/mathUtils.js";import{toCamera as U}from"../views/3d/support/viewpointUtils.js";import{TaskPriority as V}from"../views/support/Scheduler.js";import{SlideThumbnail as E}from"../webdoc/support/SlideThumbnail.js";import I from"./SunLighting.js";import k from"./VirtualLighting.js";import x from"./support/Description.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import M from"./support/SlideGround.js";import{SlideVisibleLayer as R}from"./support/SlideVisibleLayer.js";import A from"./support/Title.js";let O=0;const q=r.ofType(R);let B=class extends s{constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+O++,this.title=new A,this.description=new x,this.thumbnail=new E,this.viewpoint=null,this.basemap=null,this.ground=null,this.environment=new D,this.visibleLayers=new q}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail&&this.thumbnail.destroy(),this.description=null,this.title=null,this.thumbnail=null}castTitle(e){return"string"==typeof e?new A({text:e}):v(A,e)}castDescription(e){return"string"==typeof e?new x({text:e}):v(x,e)}castThumbnail(e){return"string"==typeof e?new E({url:e}):v(E,e)}castBasemap(e){return _(e)}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),q))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if("listMode"in e||e instanceof L){const t=G(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:e.sublayerIds}:(a.getLogger(this.declaredClass).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}clone(){return new(0,this.constructor)({id:this.id,title:this.title.clone(),thumbnail:this.thumbnail.clone(),description:this.description&&this.description.clone()||null,viewpoint:this.viewpoint&&this.viewpoint.clone()||null,basemap:this.basemap&&this.basemap.clone()||null,ground:this.ground&&this.ground.clone()||null,visibleLayers:this.visibleLayers.clone(),environment:this.environment&&this.environment.clone()||null})}_updateVisibleLayersFrom(e){const t=[];return m(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=G(i);t.push(new R({id:e.layer.id,sublayerIds:n}))}})))).toArray()).then((()=>{this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}))}updateFrom(e,t){return t={screenshot:{format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t&&t.screenshot}},e.when((()=>(this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?k.prototype.clone.apply(e.environment.lighting):I.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.basemap=e.map.basemap&&e.map.basemap.clone()||null,this.ground=e.map.ground?M.fromGround(e.map.ground):null,this._updateVisibleLayersFrom(e)))).then((()=>e.takeScreenshot(t.screenshot))).then((e=>(this.thumbnail=new E({url:e.dataUrl}),this)))}async applyTo(e,t){l(this._applyToController)&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i.abort())),o=e.resourceController.scheduler.registerTask(V.SLIDE);let s=!1;t={animate:!0,...t,signal:this._applyToController.signal};const a=async()=>{await Promise.all([o.schedule((()=>s=this._setViewpointOfInterest(e,t))),o.schedule((()=>this._applyBasemap(e,t)),t.signal)]),await Promise.all([o.schedule((()=>this._applyLayerVisibility(e)),t.signal),o.schedule((()=>this._applyGround(e)),t.signal),o.schedule((()=>this._applyViewpoint(e,t)),t.signal)]),await o.schedule((()=>e.environment.weather=this.environment.weather.clone()))},p=await n(e.addUpdatingPromise(a()));if(s&&(e.contentCamera=null),o.remove(),this._applyToController===i&&(this._applyToController=null),i=null,r?.remove(),!1===p.ok)throw p.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(c(i))throw i}e.map.basemap=C(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_getLayers(e){const t=new r;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{T(e)&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t&&t.sublayerIds,n=F(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}_setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t.ignoreViewpoint||!t.useDestinationCamera)return!1;const i=U(e,this.viewpoint);return e.contentCamera=i,l(i)}async _applyViewpoint(e,t){if(this.viewpoint&&!t.ignoreViewpoint){if(l(this.viewpoint.camera)&&(this.viewpoint.camera.fov=e.camera.fov),t.animate&&this.get("environment.lighting.date"))return void await this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(this.environment.lighting.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>e.environment.applyLighting(this.environment.lighting.clone()))).finally((()=>{p(i),"virtual"!==e.environment.lighting.type&&(e.environment.lighting.cameraTrackingEnabled=!0)}))}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,o]=this._getTime(n),[s,a]=this._getTime(i.date),p=N(o,a),m=e.renderCoordsHelper,h=w();m.toRenderCoords(e.camera.position,h);const c=w(),d=w();l(this.viewpoint.camera)&&m.toRenderCoords(this.viewpoint.camera.position,c);const y=new Date;return u((()=>e.camera),(e=>{m.toRenderCoords(e.position,d);const i=f(h,d),n=f(c,d);let a=0;i+n!==0&&(a=i/(i+n));const l=r+(s-r)*a,u=W(o,p*a);t.date=this._setTime(y,l,u)}))}static createFrom(e,t){return(new this).updateFrom(e,t)}};function F(e){if(e instanceof b||e instanceof j)return e.allSublayers.toArray()}function G(e){const t=F(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}e([d({type:String,json:{write:{isRequired:!0}}})],B.prototype,"id",void 0),e([d({type:A,json:{default:()=>new A({text:""}),write:{isRequired:!0}}})],B.prototype,"title",void 0),e([y("title")],B.prototype,"castTitle",null),e([d({type:x,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],B.prototype,"description",void 0),e([y("description")],B.prototype,"castDescription",null),e([d({type:E,json:{default:()=>new E({url:""}),write:{isRequired:!0}}})],B.prototype,"thumbnail",void 0),e([y("thumbnail")],B.prototype,"castThumbnail",null),e([d({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],B.prototype,"viewpoint",void 0),e([d({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],B.prototype,"basemap",void 0),e([y("basemap")],B.prototype,"castBasemap",null),e([d({type:M,json:{write:!0}})],B.prototype,"ground",void 0),e([d({type:q,json:{write:{isRequired:!0}}})],B.prototype,"visibleLayers",null),e([y("visibleLayers")],B.prototype,"castVisibleLayers",null),e([d({type:D,json:{write:!0}})],B.prototype,"environment",void 0),B=e([g("esri.webscene.Slide")],B);const P=86400,H=43200;function N(e,t){let i=t-e;return i>H&&(i-=P),i<-H&&(i+=P),i}function W(e,t){return S(e+t,P)}const J=B;export{J as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{JSONSupport as s}from"../core/JSONSupport.js";import a from"../core/Logger.js";import{isSome as l,removeMaybe as p}from"../core/maybe.js";import{eachAlways as m,onAbortOrThrow as h,isAbortError as c}from"../core/promiseUtils.js";import{when as u}from"../core/reactiveUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as y}from"../core/accessorSupport/decorators/cast.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as v}from"../core/accessorSupport/ensureType.js";import{d as f}from"../chunks/vec3.js";import{c as w}from"../chunks/vec3f64.js";import b from"../layers/BuildingSceneLayer.js";import L from"../layers/Layer.js";import j from"../layers/MapImageLayer.js";import{isOperationalLayer as T}from"../layers/mixins/OperationalLayer.js";import{ensureType as _,clonePreservingTiledLayers as C}from"../support/basemapUtils.js";import{moduloPositive as S}from"../views/3d/support/mathUtils.js";import{toCamera as U}from"../views/3d/support/viewpointUtils.js";import{TaskPriority as V}from"../views/support/Scheduler.js";import{SlideThumbnail as E}from"../webdoc/support/SlideThumbnail.js";import I from"./SunLighting.js";import k from"./VirtualLighting.js";import x from"./support/Description.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import M from"./support/SlideGround.js";import{SlideVisibleLayer as R}from"./support/SlideVisibleLayer.js";import A from"./support/Title.js";let O=0;const q=r.ofType(R);let B=class extends s{constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+O++,this.title=new A,this.description=new x,this.thumbnail=new E,this.viewpoint=null,this.basemap=null,this.ground=null,this.environment=new D,this.visibleLayers=new q}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail&&this.thumbnail.destroy(),this.description=null,this.title=null,this.thumbnail=null}castTitle(e){return"string"==typeof e?new A({text:e}):v(A,e)}castDescription(e){return"string"==typeof e?new x({text:e}):v(x,e)}castThumbnail(e){return"string"==typeof e?new E({url:e}):v(E,e)}castBasemap(e){return _(e)}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),q))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if("listMode"in e||e instanceof L){const t=G(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:e.sublayerIds}:(a.getLogger(this.declaredClass).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}clone(){return new(0,this.constructor)({id:this.id,title:this.title.clone(),thumbnail:this.thumbnail.clone(),description:this.description&&this.description.clone()||null,viewpoint:this.viewpoint&&this.viewpoint.clone()||null,basemap:this.basemap&&this.basemap.clone()||null,ground:this.ground&&this.ground.clone()||null,visibleLayers:this.visibleLayers.clone(),environment:this.environment&&this.environment.clone()||null})}_updateVisibleLayersFrom(e){const t=[];return m(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=G(i);t.push(new R({id:e.layer.id,sublayerIds:n}))}})))).toArray()).then((()=>{this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}))}updateFrom(e,t){return t={screenshot:{format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t&&t.screenshot}},e.when((()=>(this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?k.prototype.clone.apply(e.environment.lighting):I.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.basemap=e.map.basemap&&e.map.basemap.clone()||null,this.ground=e.map.ground?M.fromGround(e.map.ground):null,this._updateVisibleLayersFrom(e)))).then((()=>e.takeScreenshot(t.screenshot))).then((e=>(this.thumbnail=new E({url:e.dataUrl}),this)))}async applyTo(e,t){l(this._applyToController)&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i.abort())),o=e.resourceController.scheduler.registerTask(V.SLIDE);let s=!1;t={animate:!0,...t,signal:this._applyToController.signal};const a=async()=>{await Promise.all([o.schedule((()=>s=this._setViewpointOfInterest(e,t))),o.schedule((()=>this._applyBasemap(e,t)),t.signal)]),await Promise.all([o.schedule((()=>this._applyLayerVisibility(e)),t.signal),o.schedule((()=>this._applyGround(e)),t.signal),o.schedule((()=>this._applyViewpoint(e,t)),t.signal)]),await o.schedule((()=>e.environment.weather=this.environment.weather.clone()))},p=await n(e.addUpdatingPromise(a()));if(s&&(e.contentCamera=null),o.remove(),this._applyToController===i&&(this._applyToController=null),i=null,r?.remove(),!1===p.ok)throw p.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(c(i))throw i}e.map.basemap=C(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_getLayers(e){const t=new r;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{T(e)&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t&&t.sublayerIds,n=F(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}_setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t.ignoreViewpoint||!t.useDestinationCamera)return!1;const i=U(e,this.viewpoint);return e.contentCamera=i,l(i)}async _applyViewpoint(e,t){if(this.viewpoint&&!t.ignoreViewpoint){if(l(this.viewpoint.camera)&&(this.viewpoint.camera.fov=e.camera.fov),t.animate&&this.get("environment.lighting.date"))return void await this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(this.environment.lighting.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>e.environment.applyLighting(this.environment.lighting.clone()))).finally((()=>{p(i),"virtual"!==e.environment.lighting.type&&(e.environment.lighting.cameraTrackingEnabled=!0)}))}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,o]=this._getTime(n),[s,a]=this._getTime(i.date),p=N(o,a),m=e.renderCoordsHelper,h=w();m.toRenderCoords(e.camera.position,h);const c=w(),d=w();l(this.viewpoint.camera)&&m.toRenderCoords(this.viewpoint.camera.position,c);const y=new Date;return u((()=>e.camera),(e=>{m.toRenderCoords(e.position,d);const i=f(h,d),n=f(c,d);let a=0;i+n!==0&&(a=i/(i+n));const l=r+(s-r)*a,u=W(o,p*a);t.date=this._setTime(y,l,u)}))}static createFrom(e,t){return(new this).updateFrom(e,t)}};function F(e){if(e instanceof b||e instanceof j)return e.allSublayers.toArray()}function G(e){const t=F(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}e([d({type:String,json:{write:{isRequired:!0}}})],B.prototype,"id",void 0),e([d({type:A,json:{default:()=>new A({text:""}),write:{isRequired:!0}}})],B.prototype,"title",void 0),e([y("title")],B.prototype,"castTitle",null),e([d({type:x,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],B.prototype,"description",void 0),e([y("description")],B.prototype,"castDescription",null),e([d({type:E,json:{default:()=>new E({url:""}),write:{isRequired:!0}}})],B.prototype,"thumbnail",void 0),e([y("thumbnail")],B.prototype,"castThumbnail",null),e([d({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],B.prototype,"viewpoint",void 0),e([d({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],B.prototype,"basemap",void 0),e([y("basemap")],B.prototype,"castBasemap",null),e([d({type:M,json:{write:!0}})],B.prototype,"ground",void 0),e([d({type:q,json:{write:{isRequired:!0}}})],B.prototype,"visibleLayers",null),e([y("visibleLayers")],B.prototype,"castVisibleLayers",null),e([d({type:D,json:{write:!0}})],B.prototype,"environment",void 0),B=e([g("esri.webscene.Slide")],B);const P=86400,H=43200;function N(e,t){let i=t-e;return i>H&&(i-=P),i<-H&&(i+=P),i}function W(e,t){return S(e+t,P)}const J=B;export{J as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends r{get canZoomIn(){return!!this.get("view.ready")}get canZoomOut(){return!!this.get("view.ready")}};o([e({readOnly:!0})],s.prototype,"canZoomIn",null),o([e({readOnly:!0})],s.prototype,"canZoomOut",null),o([e()],s.prototype,"view",void 0),s=o([t("esri.widgets.Zoom.ZoomConditions3D")],s);const c=s;export{c as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let t=class extends r{get canZoomIn(){return!!this.view.ready}get canZoomOut(){return!!this.view.ready}};o([e({readOnly:!0})],t.prototype,"canZoomIn",null),o([e({readOnly:!0})],t.prototype,"canZoomOut",null),o([e()],t.prototype,"view",void 0),t=o([s("esri.widgets.Zoom.ZoomConditions3D")],t);const c=t;export{c 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.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{ignoreAbortErrors as s}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import r from"./ZoomConditions2D.js";import n from"./ZoomConditions3D.js";let m=class extends t{constructor(o){super(o),this.canZoomIn=!1,this.canZoomOut=!1}destroy(){this.view=null}get state(){return this.get("view.ready")?"ready":"disabled"}set view(o){o?"2d"===o.type?this._zoomConditions=new r({view:o}):"3d"===o.type&&(this._zoomConditions=new n({view:o})):this._zoomConditions=null,this._set("view",o)}zoomIn(){if(!this.canZoomIn)return;const o=this.view;"2d"===o.type?o.mapViewNavigation.zoomIn():s(o.goTo({zoomFactor:2}))}zoomOut(){if(!this.canZoomOut)return;const o=this.view;"2d"===o.type?o.mapViewNavigation.zoomOut():s(o.goTo({zoomFactor:.5}))}};o([i()],m.prototype,"_zoomConditions",void 0),o([i({aliasOf:"_zoomConditions.canZoomIn",readOnly:!0})],m.prototype,"canZoomIn",void 0),o([i({aliasOf:"_zoomConditions.canZoomOut",readOnly:!0})],m.prototype,"canZoomOut",void 0),o([i({readOnly:!0})],m.prototype,"state",null),o([i()],m.prototype,"view",null),m=o([e("esri.widgets.Zoom.ZoomViewModel")],m);const a=m;export{a as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{isSome as s}from"../../core/maybe.js";import{ignoreAbortErrors as i}from"../../core/promiseUtils.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import n from"./ZoomConditions2D.js";import m from"./ZoomConditions3D.js";let p=class extends t{constructor(o){super(o)}destroy(){this.view=null}get canZoomIn(){return s(this._zoomConditions)&&this._zoomConditions.canZoomIn}get canZoomOut(){return s(this._zoomConditions)&&this._zoomConditions?.canZoomOut}get state(){return this.view?.ready?"ready":"disabled"}set view(o){o?"2d"===o.type?this._zoomConditions=new n({view:o}):"3d"===o.type&&(this._zoomConditions=new m({view:o})):this._zoomConditions=null,this._set("view",o)}zoomIn(){if(!this.canZoomIn)return;const o=this.view;"2d"===o.type?o.mapViewNavigation.zoomIn():i(o.goTo({zoomFactor:2}))}zoomOut(){if(!this.canZoomOut)return;const o=this.view;"2d"===o.type?o.mapViewNavigation.zoomOut():i(o.goTo({zoomFactor:.5}))}};o([e()],p.prototype,"_zoomConditions",void 0),o([e()],p.prototype,"canZoomIn",null),o([e()],p.prototype,"canZoomOut",null),o([e({readOnly:!0})],p.prototype,"state",null),o([e()],p.prototype,"view",null),p=o([r("esri.widgets.Zoom.ZoomViewModel")],p);const a=p;export{a as default};
package/widgets/Zoom.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.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../chunks/tslib.es6.js";import{aliasOf as t}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as e}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import"./support/widgetUtils.js";import{messageBundle as r}from"./support/decorators/messageBundle.js";import{tsx as n}from"./support/jsxFactory.js";import a from"./Zoom/IconButton.js";import m from"./Zoom/ZoomViewModel.js";const l={base:"esri-zoom esri-widget",horizontalLayout:"esri-zoom--horizontal",zoomInIcon:"esri-icon-plus",zoomOutIcon:"esri-icon-minus",widgetIcon:"esri-icon-zoom-in-magnifying-glass"};let u=class extends i{constructor(o,t){super(o,t),this.iconClass=l.widgetIcon,this.label=void 0,this.messages=null,this.view=null,this.viewModel=new m}initialize(){this._zoomInButton=new a({action:this.zoomIn.bind(this),iconClass:l.zoomInIcon}),this._zoomOutButton=new a({action:this.zoomOut.bind(this),iconClass:l.zoomOutIcon})}destroy(){this._zoomInButton.destroy(),this._zoomOutButton.destroy(),this._zoomInButton=null,this._zoomOutButton=null}set layout(o){"horizontal"!==o&&(o="vertical"),this._set("layout",o)}render(){const o=this.viewModel,t={[l.horizontalLayout]:"horizontal"===this.layout};return this._zoomInButton.enabled="ready"===o.state&&o.canZoomIn,this._zoomOutButton.enabled="ready"===o.state&&o.canZoomOut,this._zoomInButton.title=this.messages.zoomIn,this._zoomOutButton.title=this.messages.zoomOut,n("div",{class:this.classes(l.base,t)},this._zoomInButton.render(),this._zoomOutButton.render())}zoomIn(){return this.viewModel.zoomIn()}zoomOut(){return this.viewModel.zoomOut()}};o([s()],u.prototype,"iconClass",void 0),o([s({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],u.prototype,"label",void 0),o([s({value:"vertical"})],u.prototype,"layout",null),o([s(),r("esri/widgets/Zoom/t9n/Zoom")],u.prototype,"messages",void 0),o([t("viewModel.view")],u.prototype,"view",void 0),o([s({type:m})],u.prototype,"viewModel",void 0),u=o([e("esri.widgets.Zoom")],u);const c=u;export{c as default};
5
+ import{_ as o}from"../chunks/tslib.es6.js";import{destroyMaybe as t}from"../core/maybe.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as e}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import"./support/widgetUtils.js";import{messageBundle as r}from"./support/decorators/messageBundle.js";import{tsx as n}from"./support/jsxFactory.js";import m from"./Zoom/IconButton.js";import l from"./Zoom/ZoomViewModel.js";const a={base:"esri-zoom esri-widget",horizontalLayout:"esri-zoom--horizontal",zoomInIcon:"esri-icon-plus",zoomOutIcon:"esri-icon-minus",widgetIcon:"esri-icon-zoom-in-magnifying-glass"};let u=class extends i{constructor(o,t){super(o,t),this.iconClass=a.widgetIcon,this.messages=null,this.viewModel=new l}initialize(){this._zoomInButton=new m({action:this.zoomIn.bind(this),iconClass:a.zoomInIcon}),this._zoomOutButton=new m({action:this.zoomOut.bind(this),iconClass:a.zoomOutIcon})}destroy(){this._zoomInButton=t(this._zoomInButton),this._zoomOutButton=t(this._zoomOutButton)}get label(){return this._get("label")??this.messages?.widgetLabel}set label(o){this._set("label",o)}set layout(o){"horizontal"!==o&&(o="vertical"),this._set("layout",o)}set view(o){this.viewModel.view=o}get view(){return this.viewModel.view}render(){const o=this.viewModel,t={[a.horizontalLayout]:"horizontal"===this.layout},{canZoomIn:s,canZoomOut:e}=o;this._zoomInButton.enabled=s,this._zoomOutButton.enabled=e;const{zoomIn:i,zoomOut:r}=this.messages;return this._zoomInButton.title=i,this._zoomOutButton.title=r,n("div",{class:this.classes(a.base,t)},this._zoomInButton.render(),this._zoomOutButton.render())}zoomIn(){return this.viewModel.zoomIn()}zoomOut(){return this.viewModel.zoomOut()}};o([s()],u.prototype,"iconClass",void 0),o([s()],u.prototype,"label",null),o([s({value:"vertical"})],u.prototype,"layout",null),o([s(),r("esri/widgets/Zoom/t9n/Zoom")],u.prototype,"messages",void 0),o([s()],u.prototype,"view",null),o([s({type:l})],u.prototype,"viewModel",void 0),u=o([e("esri.widgets.Zoom")],u);const c=u;export{c as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8494],{92835:(e,t,r)=>{r.d(t,{Z:()=>g});var s,i=r(43697),n=r(96674),o=r(70586),a=r(35463),l=r(5600),u=(r(67676),r(80442),r(75215),r(71715)),c=r(52011),p=r(30556);let d=s=class extends n.wq{constructor(e){super(e),this.end=null,this.start=null}static get allTime(){return h}static get empty(){return y}readEnd(e,t){return null!=t.end?new Date(t.end):null}writeEnd(e,t){t.end=e?e.getTime():null}get isAllTime(){return this.equals(s.allTime)}get isEmpty(){return this.equals(s.empty)}readStart(e,t){return null!=t.start?new Date(t.start):null}writeStart(e,t){t.start=e?e.getTime():null}clone(){return new s({end:this.end,start:this.start})}equals(e){if(!e)return!1;const t=(0,o.pC)(this.start)?this.start.getTime():this.start,r=(0,o.pC)(this.end)?this.end.getTime():this.end,s=(0,o.pC)(e.start)?e.start.getTime():e.start,i=(0,o.pC)(e.end)?e.end.getTime():e.end;return t===s&&r===i}expandTo(e){if(this.isEmpty||this.isAllTime)return this.clone();const t=(0,o.yw)(this.start,(t=>(0,a.JE)(t,e))),r=(0,o.yw)(this.end,(t=>(0,a.Nm)((0,a.JE)(t,e),1,e)));return new s({start:t,end:r})}intersection(e){if(!e)return this.clone();if(this.isEmpty||e.isEmpty)return s.empty;if(this.isAllTime)return e.clone();if(e.isAllTime)return this.clone();const t=(0,o.R2)(this.start,-1/0,(e=>e.getTime())),r=(0,o.R2)(this.end,1/0,(e=>e.getTime())),i=(0,o.R2)(e.start,-1/0,(e=>e.getTime())),n=(0,o.R2)(e.end,1/0,(e=>e.getTime()));let a,l;if(i>=t&&i<=r?a=i:t>=i&&t<=n&&(a=t),r>=i&&r<=n?l=r:n>=t&&n<=r&&(l=n),!isNaN(a)&&!isNaN(l)){const e=new s;return e.start=a===-1/0?null:new Date(a),e.end=l===1/0?null:new Date(l),e}return s.empty}offset(e,t){if(this.isEmpty||this.isAllTime)return this.clone();const r=new s,{start:i,end:n}=this;return(0,o.pC)(i)&&(r.start=(0,a.Nm)(i,e,t)),(0,o.pC)(n)&&(r.end=(0,a.Nm)(n,e,t)),r}union(e){if(!e||e.isEmpty)return this.clone();if(this.isEmpty)return e.clone();if(this.isAllTime||e.isAllTime)return h.clone();const t=(0,o.pC)(this.start)&&(0,o.pC)(e.start)?new Date(Math.min(this.start.getTime(),e.start.getTime())):null,r=(0,o.pC)(this.end)&&(0,o.pC)(e.end)?new Date(Math.max(this.end.getTime(),e.end.getTime())):null;return new s({start:t,end:r})}};(0,i._)([(0,l.Cb)({type:Date,json:{write:{allowNull:!0}}})],d.prototype,"end",void 0),(0,i._)([(0,u.r)("end")],d.prototype,"readEnd",null),(0,i._)([(0,p.c)("end")],d.prototype,"writeEnd",null),(0,i._)([(0,l.Cb)({readOnly:!0,json:{read:!1}})],d.prototype,"isAllTime",null),(0,i._)([(0,l.Cb)({readOnly:!0,json:{read:!1}})],d.prototype,"isEmpty",null),(0,i._)([(0,l.Cb)({type:Date,json:{write:{allowNull:!0}}})],d.prototype,"start",void 0),(0,i._)([(0,u.r)("start")],d.prototype,"readStart",null),(0,i._)([(0,p.c)("start")],d.prototype,"writeStart",null),d=s=(0,i._)([(0,c.j)("esri.TimeExtent")],d);const h=new d,y=new d({start:void 0,end:void 0}),g=d},25929:(e,t,r)=>{r.d(t,{M:()=>y,e:()=>d,f:()=>n,i:()=>p,p:()=>m,r:()=>a,t:()=>o,w:()=>l});var s=r(70586),i=r(17452);function n(e,t){const r=t&&t.url&&t.url.path;if(e&&r&&(e=(0,i.hF)(e,r,{preserveProtocolRelative:!0}),t.portalItem&&t.readResourcePaths)){const r=(0,i.PF)(e,t.portalItem.itemUrl);c.test(r)&&t.readResourcePaths.push(t.portalItem.resourceFromPath(r).path)}return h(e,t&&t.portal)}function o(e,t,r=y.YES){if(!e)return e;!(0,i.YP)(e)&&t&&t.blockedRelativeUrls&&t.blockedRelativeUrls.push(e);let s=(0,i.hF)(e);if(t){const r=t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.rootPath||t.url&&t.url.path;if(r){const n=h(r,t.portal);s=(0,i.PF)(h(s,t.portal),n,n),s!==e&&t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.writtenUrls.push(s)}}return s=d(s,t&&t.portal),(0,i.YP)(s)&&(s=(0,i.Fv)(s)),t?.resources&&t?.portalItem&&!(0,i.YP)(s)&&!(0,i.HK)(s)&&r===y.YES&&t.resources.toKeep.push({resource:t.portalItem.resourceFromPath(s)}),s}function a(e,t,r){return n(e,r)}function l(e,t,r,s){const i=o(e,s);void 0!==i&&(t[r]=i)}const u=/\/items\/([^\/]+)\/resources\//,c=/^\.\/resources\//;function p(e){const t=(0,s.pC)(e)?e.match(u):null;return(0,s.pC)(t)?t[1]:null}function d(e,t){return t&&!t.isPortal&&t.urlKey&&t.customBaseUrl?(0,i.Ie)(e,`${t.urlKey}.${t.customBaseUrl}`,t.portalHostname):e}function h(e,t){if(!t||t.isPortal||!t.urlKey||!t.customBaseUrl)return e;const r=`${t.urlKey}.${t.customBaseUrl}`,s=(0,i.TI)();return(0,i.D6)(s,`${s.scheme}://${r}`)?(0,i.Ie)(e,t.portalHostname,r):(0,i.Ie)(e,r,t.portalHostname)}var y,g;(g=y||(y={}))[g.YES=0]="YES",g[g.NO=1]="NO";const m=Object.freeze(Object.defineProperty({__proto__:null,fromJSON:n,toJSON:o,read:a,write:l,itemIdFromResourceUrl:p,ensureMainOnlineDomain:d,get MarkKeep(){return y}},Symbol.toStringTag,{value:"Module"}))},3920:(e,t,r)=>{r.d(t,{p:()=>u,r:()=>c});var s=r(43697),i=r(15923),n=r(61247),o=r(5600),a=r(52011),l=r(72762);const u=e=>{let t=class extends e{destroy(){this.destroyed||(this._get("handles")?.destroy(),this._get("updatingHandles")?.destroy())}get handles(){return this._get("handles")||new n.Z}get updatingHandles(){return this._get("updatingHandles")||new l.t}};return(0,s._)([(0,o.Cb)({readOnly:!0})],t.prototype,"handles",null),(0,s._)([(0,o.Cb)({readOnly:!0})],t.prototype,"updatingHandles",null),t=(0,s._)([(0,a.j)("esri.core.HandleOwner")],t),t};let c=class extends(u(i.Z)){};c=(0,s._)([(0,a.j)("esri.core.HandleOwner")],c)},45091:(e,t,r)=>{r.d(t,{Z:()=>c});var s,i,n=r(80442),o=r(71143);(i=s||(s={}))[i.varint=0]="varint",i[i.fixed64=1]="fixed64",i[i.delimited=2]="delimited",i[i.fixed32=5]="fixed32",i[i.unknown=99]="unknown";const a=4294967296,l=new TextDecoder("utf-8"),u=(0,n.Z)("safari")||(0,n.Z)("ios")?6:(0,n.Z)("ff")?12:32;class c{constructor(e,t,r=0,i=(e?e.byteLength:0)){this._tag=0,this._dataType=s.unknown,this._init(e,t,r,i)}_init(e,t,r,s){this._data=e,this._dataView=t,this._pos=r,this._end=s}clone(){return new c(this._data,this._dataView,this._pos,this._end)}pos(){return this._pos}move(e){this._pos=e}nextTag(e){for(;;){if(this._pos===this._end)return!1;const t=this._decodeVarint();if(this._tag=t>>3,this._dataType=7&t,!e||e===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const e=this._decodeVarint();return this._tag=e>>3,this._dataType=7&e,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let e=4294967295;return e=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128?e:(e=(e|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128?e:void 0))))}getUInt64(){return this._decodeVarint()}getSInt32(){const e=this.getUInt32();if(void 0!==e)return e>>>1^-(1&e)|0}getSInt64(){return this._decodeSVarint()}getBool(){const e=0!==this._data[this._pos];return this._skip(1),e}getEnum(){return this._decodeVarint()}getFixed64(){const e=this._dataView,t=this._pos,r=e.getUint32(t,!0)+e.getUint32(t+4,!0)*a;return this._skip(8),r}getSFixed64(){const e=this._dataView,t=this._pos,r=e.getUint32(t,!0)+e.getInt32(t+4,!0)*a;return this._skip(8),r}getDouble(){const e=this._dataView.getFloat64(this._pos,!0);return this._skip(8),e}getFixed32(){const e=this._dataView.getUint32(this._pos,!0);return this._skip(4),e}getSFixed32(){const e=this._dataView.getInt32(this._pos,!0);return this._skip(4),e}getFloat(){const e=this._dataView.getFloat32(this._pos,!0);return this._skip(4),e}getString(){const e=this._getLength(),t=this._pos,r=this._toString(this._data,t,t+e);return this._skip(e),r}getBytes(){const e=this._getLength(),t=this._pos,r=this._toBytes(this._data,t,t+e);return this._skip(e),r}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(e,t,r,s){const i=this.getMessage(),n=e(i,t,r,s);return i.release(),n}processMessage(e){const t=this.getMessage(),r=e(t);return t.release(),r}getMessage(){const e=this._getLength(),t=c.pool.acquire();return t._init(this._data,this._dataView,this._pos,this._pos+e),this._skip(e),t}release(){c.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case s.varint:this._decodeVarint();break;case s.fixed64:this._skip(8);break;case s.delimited:this._skip(this._getLength());break;case s.fixed32:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(e){this._skip(e)}_skip(e){if(this._pos+e>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=e}_decodeVarint(){const e=this._data;let t=this._pos,r=0,s=0;if(this._end-t>=10)do{if(s=e[t++],r|=127&s,0==(128&s))break;if(s=e[t++],r|=(127&s)<<7,0==(128&s))break;if(s=e[t++],r|=(127&s)<<14,0==(128&s))break;if(s=e[t++],r|=(127&s)<<21,0==(128&s))break;if(s=e[t++],r+=268435456*(127&s),0==(128&s))break;if(s=e[t++],r+=34359738368*(127&s),0==(128&s))break;if(s=e[t++],r+=4398046511104*(127&s),0==(128&s))break;if(s=e[t++],r+=562949953421312*(127&s),0==(128&s))break;if(s=e[t++],r+=72057594037927940*(127&s),0==(128&s))break;if(s=e[t++],r+=0x8000000000000000*(127&s),0==(128&s))break;throw new Error("Varint too long!")}while(0);else{let i=1;for(;t!==this._end&&(s=e[t],0!=(128&s));)++t,r+=(127&s)*i,i*=128;if(t===this._end)throw new Error("Varint overrun!");++t,r+=s*i}return this._pos=t,r}_decodeSVarint(){const e=this._decodeVarint();return e%2?-(e+1)/2:e/2}_getLength(){if(this._dataType!==s.delimited)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(e,t,r){if((r=Math.min(this._end,r))-t>u){const s=e.subarray(t,r);return l.decode(s)}let s="",i="";for(let n=t;n<r;++n){const t=e[n];128&t?i+="%"+t.toString(16):(s+=decodeURIComponent(i)+String.fromCharCode(t),i="")}return i.length&&(s+=decodeURIComponent(i)),s}_toBytes(e,t,r){return r=Math.min(this._end,r),new Uint8Array(e.buffer,t,r-t)}}c.pool=new o.Z(c,void 0,(e=>{e._data=null,e._dataView=null}))},72762:(e,t,r)=>{r.d(t,{t:()=>p});var s=r(43697),i=r(15923),n=r(61247),o=r(70586),a=r(17445),l=r(1654),u=r(5600),c=r(52011);let p=class extends i.Z{constructor(){super(...arguments),this.updating=!1,this.handleId=0,this.handles=new n.Z,this.scheduleHandleId=0,this.pendingPromises=new Set}destroy(){this.removeAll(),this.handles.destroy()}add(e,t,r={}){return this._installWatch(e,t,r,a.YP)}addWhen(e,t,r={}){return this._installWatch(e,t,r,a.gx)}addOnCollectionChange(e,t,{initial:r=!1,final:s=!1}={}){const i=++this.handleId;return this.handles.add([(0,a.on)(e,"after-changes",this._createSyncUpdatingCallback(),a.Z_),(0,a.on)(e,"change",t,{onListenerAdd:r?e=>t({added:e.toArray(),removed:[]}):void 0,onListenerRemove:s?e=>t({added:[],removed:e.toArray()}):void 0})],i),{remove:()=>this.handles.remove(i)}}addPromise(e){if((0,o.Wi)(e))return e;const t=++this.handleId;this.handles.add({remove:()=>{this.pendingPromises.delete(e)&&(0!==this.pendingPromises.size||this.handles.has(d)||this._set("updating",!1))}},t),this.pendingPromises.add(e),this._set("updating",!0);const r=()=>this.handles.remove(t);return e.then(r,r),e}removeAll(){this.pendingPromises.clear(),this.handles.removeAll(),this._set("updating",!1)}_installWatch(e,t,r={},s){const i=++this.handleId;r.sync||this._installSyncUpdatingWatch(e,i);const n=s(e,t,r);return this.handles.add(n,i),{remove:()=>this.handles.remove(i)}}_installSyncUpdatingWatch(e,t){const r=this._createSyncUpdatingCallback(),s=(0,a.YP)(e,r,{sync:!0,equals:()=>!1});return this.handles.add(s,t),s}_createSyncUpdatingCallback(){return()=>{this.handles.remove(d),++this.scheduleHandleId;const e=this.scheduleHandleId;this._get("updating")||this._set("updating",!0),this.handles.add((0,l.Os)((()=>{e===this.scheduleHandleId&&(this._set("updating",this.pendingPromises.size>0),this.handles.remove(d))})),d)}}};(0,s._)([(0,u.Cb)({readOnly:!0})],p.prototype,"updating",void 0),p=(0,s._)([(0,c.j)("esri.core.support.WatchUpdatingTracking")],p);const d=-42;var h,y;(y=h||(h={}))[y.NONE=0]="NONE",y[y.SYNC=1]="SYNC",y[y.INIT=2]="INIT"},35463:(e,t,r)=>{r.d(t,{JE:()=>o,Nm:()=>n,rJ:()=>a}),r(80442);const s={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:26784e5,years:31536e6,decades:31536e7,centuries:31536e8},i={milliseconds:{getter:"getMilliseconds",setter:"setMilliseconds",multiplier:1},seconds:{getter:"getSeconds",setter:"setSeconds",multiplier:1},minutes:{getter:"getMinutes",setter:"setMinutes",multiplier:1},hours:{getter:"getHours",setter:"setHours",multiplier:1},days:{getter:"getDate",setter:"setDate",multiplier:1},weeks:{getter:"getDate",setter:"setDate",multiplier:7},months:{getter:"getMonth",setter:"setMonth",multiplier:1},years:{getter:"getFullYear",setter:"setFullYear",multiplier:1},decades:{getter:"getFullYear",setter:"setFullYear",multiplier:10},centuries:{getter:"getFullYear",setter:"setFullYear",multiplier:100}};function n(e,t,r){const s=new Date(e.getTime());if(t&&r){const e=i[r],{getter:n,setter:o,multiplier:a}=e;if("months"===r){const e=function(e,t){const r=new Date(e,t+1,1);return r.setDate(0),r.getDate()}(s.getFullYear(),s.getMonth()+t);s.getDate()>e&&s.setDate(e)}s[o](s[n]()+t*a)}return s}function o(e,t){switch(t){case"milliseconds":return new Date(e.getTime());case"seconds":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds());case"minutes":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes());case"hours":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours());case"days":return new Date(e.getFullYear(),e.getMonth(),e.getDate());case"weeks":return new Date(e.getFullYear(),e.getMonth(),e.getDate()-e.getDay());case"months":return new Date(e.getFullYear(),e.getMonth(),1);case"years":return new Date(e.getFullYear(),0,1);case"decades":return new Date(e.getFullYear()-e.getFullYear()%10,0,1);case"centuries":return new Date(e.getFullYear()-e.getFullYear()%100,0,1);default:return new Date}}function a(e,t,r){return 0===e?0:e*s[t]/s[r]}},66677:(e,t,r)=>{r.d(t,{B5:()=>p,DR:()=>h,G:()=>w,M8:()=>m,Nm:()=>f,Qc:()=>d,XG:()=>_,a7:()=>g,ld:()=>y,wH:()=>b});var s=r(70586),i=r(17452),n=r(25929);const o={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer"},a=Object.values(o),l=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),u=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),c=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function p(e){return!!l.test(e)}function d(e){if((0,s.Wi)(e))return null;const t=(0,i.mN)(e),r=t.path.match(l)||t.path.match(u);if(!r)return null;const[,n,a,c,p]=r,d=a.indexOf("/");return{title:y(-1!==d?a.slice(d+1):a),serverType:o[c.toLowerCase()],sublayer:null!=p&&""!==p?parseInt(p,10):null,url:{path:n}}}function h(e){const t=(0,i.mN)(e).path.match(c);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function y(e){return(e=e.replace(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function g(e,t){const r=[];if(e){const t=d(e);(0,s.pC)(t)&&t.title&&r.push(t.title)}if(t){const e=y(t);r.push(e)}if(2===r.length){if(r[0].toLowerCase().includes(r[1].toLowerCase()))return r[0];if(r[1].toLowerCase().includes(r[0].toLowerCase()))return r[1]}return r.join(" - ")}function m(e){if(!e)return!1;const t=(e=e.toLowerCase()).includes(".arcgis.com/"),r=e.includes("//services")||e.includes("//tiles")||e.includes("//features");return t&&r}function f(e,t){return e?(0,i.Qj)((0,i.Hu)(e,t)):e}function _(e){let{url:t}=e;if(!t)return{url:t};t=(0,i.Hu)(t,e.logger);const r=(0,i.mN)(t),n=d(r.path);let o;if((0,s.pC)(n))null!=n.sublayer&&null==e.layer.layerId&&(o=n.sublayer),t=n.url.path;else if(e.nonStandardUrlAllowed){const e=h(r.path);(0,s.pC)(e)&&(t=e.serviceUrl,o=e.sublayerId)}return{url:(0,i.Qj)(t),layerId:o}}function b(e,t,r,s,o){(0,n.w)(t,s,"url",o),s.url&&null!=e.layerId&&(s.url=(0,i.v_)(s.url,r,e.layerId.toString()))}function w(e){if(!e)return!1;const t=e.toLowerCase(),r=t.includes("/services/"),s=t.includes("/mapserver/wmsserver"),i=t.includes("/imageserver/wmsserver"),n=t.includes("/wmsserver");return r&&(s||i||n)}},10158:(e,t,r)=>{r.d(t,{n:()=>D});var s,i=r(43697),n=r(35454),o=r(96674),a=r(5600),l=(r(67676),r(80442),r(90578)),u=r(36030),c=r(71715),p=r(52011),d=r(75215),h=r(63213),y=r(1231),g=r(42843),m=(r(66577),r(82971)),f=r(86973);let _=s=class extends o.wq{constructor(e){super(e),this.type="query-table"}clone(){const{workspaceId:e,query:t,oidFields:r,spatialReference:i,geometryType:n}=this,o={workspaceId:e,query:t,oidFields:r,spatialReference:i?.clone()??void 0,geometryType:n};return new s(o)}};var b;(0,i._)([(0,u.J)({queryTable:"query-table"})],_.prototype,"type",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],_.prototype,"workspaceId",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],_.prototype,"query",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],_.prototype,"oidFields",void 0),(0,i._)([(0,a.Cb)({type:m.Z,json:{write:!0}})],_.prototype,"spatialReference",void 0),(0,i._)([(0,u.J)(f.Mk)],_.prototype,"geometryType",void 0),_=s=(0,i._)([(0,p.j)("esri.layers.support.source.QueryTableDataSource")],_);let w=b=class extends o.wq{constructor(e){super(e),this.type="raster"}clone(){const{workspaceId:e,dataSourceName:t}=this;return new b({workspaceId:e,dataSourceName:t})}};var S;(0,i._)([(0,u.J)({raster:"raster"})],w.prototype,"type",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],w.prototype,"dataSourceName",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],w.prototype,"workspaceId",void 0),w=b=(0,i._)([(0,p.j)("esri.layers.support.source.RasterDataSource")],w);let v=S=class extends o.wq{constructor(e){super(e),this.type="table"}clone(){const{workspaceId:e,gdbVersion:t,dataSourceName:r}=this;return new S({workspaceId:e,gdbVersion:t,dataSourceName:r})}};var C,T;(0,i._)([(0,u.J)({table:"table"})],v.prototype,"type",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],v.prototype,"workspaceId",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],v.prototype,"gdbVersion",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],v.prototype,"dataSourceName",void 0),v=S=(0,i._)([(0,p.j)("esri.layers.support.source.TableDataSource")],v);const k=(0,n.w)()({esriLeftInnerJoin:"left-inner-join",esriLeftOuterJoin:"left-outer-join"});let x=C=class extends o.wq{constructor(e){super(e),this.type="join-table"}readLeftTableSource(e,t,r){return F()(e,t,r)}castLeftTableSource(e){return(0,d.N7)(I(),e)}readRightTableSource(e,t,r){return F()(e,t,r)}castRightTableSource(e){return(0,d.N7)(I(),e)}clone(){const{leftTableKey:e,rightTableKey:t,leftTableSource:r,rightTableSource:s,joinType:i}=this,n={leftTableKey:e,rightTableKey:t,leftTableSource:r?.clone()??void 0,rightTableSource:s?.clone()??void 0,joinType:i};return new C(n)}};(0,i._)([(0,u.J)({joinTable:"join-table"})],x.prototype,"type",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],x.prototype,"leftTableKey",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],x.prototype,"rightTableKey",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],x.prototype,"leftTableSource",void 0),(0,i._)([(0,c.r)("leftTableSource")],x.prototype,"readLeftTableSource",null),(0,i._)([(0,l.p)("leftTableSource")],x.prototype,"castLeftTableSource",null),(0,i._)([(0,a.Cb)({json:{write:!0}})],x.prototype,"rightTableSource",void 0),(0,i._)([(0,c.r)("rightTableSource")],x.prototype,"readRightTableSource",null),(0,i._)([(0,l.p)("rightTableSource")],x.prototype,"castRightTableSource",null),(0,i._)([(0,u.J)(k)],x.prototype,"joinType",void 0),x=C=(0,i._)([(0,p.j)("esri.layers.support.source.JoinTableDataSource")],x);let R=null;function F(){return R||(R=(0,h.d)({types:I()})),R}let j=null;function I(){return j||(j={key:"type",base:null,typeMap:{"data-layer":D,"map-layer":g.R}}),j}const P={key:"type",base:null,typeMap:{"join-table":x,"query-table":_,raster:w,table:v}};let D=T=class extends o.wq{constructor(e){super(e),this.type="data-layer"}clone(){const{fields:e,dataSource:t}=this;return new T({fields:e,dataSource:t})}};(0,i._)([(0,u.J)({dataLayer:"data-layer"})],D.prototype,"type",void 0),(0,i._)([(0,a.Cb)({type:[y.Z],json:{write:!0}})],D.prototype,"fields",void 0),(0,i._)([(0,a.Cb)({types:P,json:{write:!0}})],D.prototype,"dataSource",void 0),D=T=(0,i._)([(0,p.j)("esri.layers.support.source.DataLayerSource")],D),D.from=(0,d.se)(D)},42843:(e,t,r)=>{r.d(t,{R:()=>c});var s,i=r(43697),n=r(96674),o=r(5600),a=(r(67676),r(80442),r(75215)),l=r(36030),u=r(52011);let c=s=class extends n.wq{constructor(e){super(e),this.type="map-layer"}clone(){const{mapLayerId:e,gdbVersion:t}=this;return new s({mapLayerId:e,gdbVersion:t})}};(0,i._)([(0,l.J)({mapLayer:"map-layer"})],c.prototype,"type",void 0),(0,i._)([(0,o.Cb)({type:a.z8,json:{write:!0}})],c.prototype,"mapLayerId",void 0),(0,i._)([(0,o.Cb)({type:String,json:{write:!0}})],c.prototype,"gdbVersion",void 0),c=s=(0,i._)([(0,u.j)("esri.layers.support.source.MapLayerSource")],c)},76497:(e,t,r)=>{function s(e){const t={};for(const r in e){if("declaredClass"===r)continue;const i=e[r];if(null!=i&&"function"!=typeof i)if(Array.isArray(i)){t[r]=[];for(let e=0;e<i.length;e++)t[r][e]=s(i[e])}else"object"==typeof i?i.toJSON&&(t[r]=JSON.stringify(i)):t[r]=i}return t}r.d(t,{A:()=>s})},77863:(e,t,r)=>{r.d(t,{G$:()=>T,K9:()=>j,O7:()=>p});var s=r(20102),i=r(70586),n=r(45091),o=r(5428),a=r(78760);const l=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML"],u=["sqlTypeBigInt","sqlTypeBinary","sqlTypeBit","sqlTypeChar","sqlTypeDate","sqlTypeDecimal","sqlTypeDouble","sqlTypeFloat","sqlTypeGeometry","sqlTypeGUID","sqlTypeInteger","sqlTypeLongNVarchar","sqlTypeLongVarbinary","sqlTypeLongVarchar","sqlTypeNChar","sqlTypeNVarchar","sqlTypeOther","sqlTypeReal","sqlTypeSmallInt","sqlTypeSqlXml","sqlTypeTime","sqlTypeTimestamp","sqlTypeTimestamp2","sqlTypeTinyInt","sqlTypeVarbinary","sqlTypeVarchar"],c=["upperLeft","lowerLeft"];function p(e){return e>=l.length?null:l[e]}function d(e){return e>=u.length?null:u[e]}function h(e){return e>=c.length?null:c[e]}function y(e,t){return t>=e.geometryTypes.length?null:e.geometryTypes[t]}function g(e,t,r){const s=t.createPointGeometry(r);for(;e.next();)switch(e.tag()){case 3:{const r=e.getUInt32(),i=e.pos()+r;let n=0;for(;e.pos()<i;)t.addCoordinatePoint(s,e.getSInt64(),n++);break}default:e.skip()}return s}function m(e,t,r){const s=t.createGeometry(r),i=2+(r.hasZ?1:0)+(r.hasM?1:0);for(;e.next();)switch(e.tag()){case 2:{const r=e.getUInt32(),i=e.pos()+r;let n=0;for(;e.pos()<i;)t.addLength(s,e.getUInt32(),n++);break}case 3:{const r=e.getUInt32(),n=e.pos()+r;let o=0;for(t.allocateCoordinates(s);e.pos()<n;)t.addCoordinate(s,e.getSInt64(),o),o++,o===i&&(o=0);break}default:e.skip()}return s}function f(e){const t=new o.Z;let r="esriGeometryPoint";for(;e.next();)switch(e.tag()){case 2:{const r=e.getUInt32(),s=e.pos()+r;for(;e.pos()<s;)t.lengths.push(e.getUInt32());break}case 3:{const r=e.getUInt32(),s=e.pos()+r;for(;e.pos()<s;)t.coords.push(e.getSInt64());break}case 1:r=a.A[e.getEnum()];break;default:e.skip()}return{queryGeometry:t,queryGeometryType:r}}function _(e){for(;e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getSInt32();case 5:return e.getUInt32();case 6:return e.getInt64();case 7:return e.getUInt64();case 8:return e.getSInt64();case 9:return e.getBool();default:return e.skip(),null}return null}function b(e){const t={type:p(0)};for(;e.next();)switch(e.tag()){case 1:t.name=e.getString();break;case 2:t.type=p(e.getEnum());break;case 3:t.alias=e.getString();break;case 4:t.sqlType=d(e.getEnum());break;case 5:default:e.skip();break;case 6:t.defaultValue=e.getString()}return t}function w(e){const t={};for(;e.next();)switch(e.tag()){case 1:t.name=e.getString();break;case 2:t.isSystemMaintained=e.getBool();break;default:e.skip()}return t}function S(e,t,r,s){const i=t.createFeature(r);let n=0;for(;e.next();)switch(e.tag()){case 1:{const t=s[n++].name;i.attributes[t]=e.processMessage(_);break}case 2:i.geometry=e.processMessageWithArgs(m,t,r);break;case 4:i.centroid=e.processMessageWithArgs(g,t,r);break;default:e.skip()}return i}function v(e){const t=[1,1,1,1];for(;e.next();)switch(e.tag()){case 1:t[0]=e.getDouble();break;case 2:t[1]=e.getDouble();break;case 4:t[2]=e.getDouble();break;case 3:t[3]=e.getDouble();break;default:e.skip()}return t}function C(e){const t=[0,0,0,0];for(;e.next();)switch(e.tag()){case 1:t[0]=e.getDouble();break;case 2:t[1]=e.getDouble();break;case 4:t[2]=e.getDouble();break;case 3:t[3]=e.getDouble();break;default:e.skip()}return t}function T(e){const t={originPosition:h(0)};for(;e.next();)switch(e.tag()){case 1:t.originPosition=h(e.getEnum());break;case 2:t.scale=e.processMessage(v);break;case 3:t.translate=e.processMessage(C);break;default:e.skip()}return t}function k(e){const t={};for(;e.next();)switch(e.tag()){case 1:t.shapeAreaFieldName=e.getString();break;case 2:t.shapeLengthFieldName=e.getString();break;case 3:t.units=e.getString();break;default:e.skip()}return t}function x(e,t){const r=t.createSpatialReference();for(;e.next();)switch(e.tag()){case 1:r.wkid=e.getUInt32();break;case 5:r.wkt=e.getString();break;case 2:r.latestWkid=e.getUInt32();break;case 3:r.vcsWkid=e.getUInt32();break;case 4:r.latestVcsWkid=e.getUInt32();break;default:e.skip()}return r}function R(e,t){const r=t.createFeatureResult();r.geometryType=y(t,0);let s=!1;for(;e.next();)switch(e.tag()){case 1:r.objectIdFieldName=e.getString();break;case 3:r.globalIdFieldName=e.getString();break;case 4:r.geohashFieldName=e.getString();break;case 5:r.geometryProperties=e.processMessage(k);break;case 7:r.geometryType=y(t,e.getEnum());break;case 8:r.spatialReference=e.processMessageWithArgs(x,t);break;case 10:r.hasZ=e.getBool();break;case 11:r.hasM=e.getBool();break;case 12:r.transform=e.processMessage(T);break;case 9:{const t=e.getBool();r.exceededTransferLimit=t;break}case 13:t.addField(r,e.processMessage(b));break;case 15:s||(t.prepareFeatures(r),s=!0),t.addFeature(r,e.processMessageWithArgs(S,t,r,r.fields));break;case 2:r.uniqueIdField=e.processMessage(w);break;default:e.skip()}return t.finishFeatureResult(r),r}function F(e,t){const r={};let s=null;for(;e.next();)switch(e.tag()){case 4:s=e.processMessageWithArgs(f);break;case 1:r.featureResult=e.processMessageWithArgs(R,t);break;default:e.skip()}return(0,i.pC)(s)&&r.featureResult&&t.addQueryGeometry(r,s),r}function j(e,t){try{const r=2,s=new n.Z(new Uint8Array(e),new DataView(e)),i={};for(;s.next();)s.tag()===r?i.queryResult=s.processMessageWithArgs(F,t):s.skip();return i}catch(e){throw new s.Z("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e})}}},78760:(e,t,r)=>{r.d(t,{A:()=>l,J:()=>u});var s=r(67900),i=r(8744),n=r(70272),o=r(44876),a=r(5428);const l=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"];class u{constructor(e){this._options=e,this.geometryTypes=l,this._coordinatePtr=0,this._vertexDimension=0}createFeatureResult(){return new o.Z}prepareFeatures(e){this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++}finishFeatureResult(e){if(!e||!e.features||!e.hasZ||!this._options.sourceSpatialReference||!e.spatialReference||(0,i.fS)(e.spatialReference,this._options.sourceSpatialReference)||e.spatialReference.vcsWkid)return;const t=(0,s._R)(this._options.sourceSpatialReference)/(0,s._R)(e.spatialReference);if(1!==t)for(const r of e.features){if(!(0,n.S6)(r))continue;const e=r.geometry.coords;for(let r=2;r<e.length;r+=3)e[r]*=t}}addFeature(e,t){e.features.push(t)}createFeature(){return new n.u_}createSpatialReference(){return{wkid:0}}createGeometry(){return new a.Z}addField(e,t){e.fields.push(t)}allocateCoordinates(e){e.coords.length=e.lengths.reduce(((e,t)=>e+t),0)*this._vertexDimension,this._coordinatePtr=0}addCoordinate(e,t){e.coords[this._coordinatePtr++]=t}addCoordinatePoint(e,t){e.coords.push(t)}addLength(e,t){e.lengths.push(t)}addQueryGeometry(e,t){e.queryGeometry=t.queryGeometry,e.queryGeometryType=t.queryGeometryType}createPointGeometry(){return new a.Z}}},45178:(e,t,r)=>{r.d(t,{C:()=>i});var s=r(77863);function i(e,t){const r=(0,s.K9)(e,t),i=r.queryResult.featureResult,n=r.queryResult.queryGeometry,o=r.queryResult.queryGeometryType;if(i&&i.features&&i.features.length&&i.objectIdFieldName){const e=i.objectIdFieldName;for(const t of i.features)t.attributes&&(t.objectId=t.attributes[e])}return i&&(i.queryGeometry=n,i.queryGeometryType=o),i}},34599:(e,t,r)=>{r.r(t),r.d(t,{encodeGeometry:()=>d,executeQuery:()=>y,executeQueryForCount:()=>_,executeQueryForExtent:()=>b,executeQueryForIds:()=>f,executeQueryPBF:()=>g,executeQueryPBFBuffer:()=>m,queryToQueryStringParameters:()=>h,runQuery:()=>w});var s=r(3172),i=r(70586),n=r(17452),o=r(33955),a=r(82526),l=r(76497),u=r(45178),c=r(28694);const p="Layer does not support extent calculation.";function d(e,t){if(t&&"extent"===e.type)return`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`;if(t&&"point"===e.type)return`${e.x},${e.y}`;const r=e.toJSON();return delete r.spatialReference,JSON.stringify(r)}function h(e,t){const r=e.geometry,s=e.toJSON();delete s.compactGeometryEnabled,delete s.defaultSpatialReferenceEnabled;const n=s;let a,l,u;if((0,i.pC)(r)&&(l=r.spatialReference,u=r.spatialReference.wkid||JSON.stringify(r.spatialReference),n.geometryType=(0,o.Ji)(r),n.geometry=d(r,e.compactGeometryEnabled),n.inSR=u),s.groupByFieldsForStatistics&&(n.groupByFieldsForStatistics=s.groupByFieldsForStatistics.join(",")),s.objectIds&&(n.objectIds=s.objectIds.join(",")),s.orderByFields&&(n.orderByFields=s.orderByFields.join(",")),!s.outFields||!s.returnDistinctValues&&(t?.returnCountOnly||t?.returnExtentOnly||t?.returnIdsOnly)?delete n.outFields:s.outFields.includes("*")?n.outFields="*":n.outFields=s.outFields.join(","),s.outSR?(n.outSR=s.outSR.wkid||JSON.stringify(s.outSR),a=e.outSpatialReference):r&&(s.returnGeometry||s.returnCentroid)&&(n.outSR=n.inSR,a=l),s.returnGeometry&&delete s.returnGeometry,s.outStatistics&&(n.outStatistics=JSON.stringify(s.outStatistics)),s.pixelSize&&(n.pixelSize=JSON.stringify(s.pixelSize)),s.quantizationParameters&&(e.defaultSpatialReferenceEnabled&&(0,i.pC)(l)&&(0,i.pC)(e.quantizationParameters)&&(0,i.pC)(e.quantizationParameters.extent)&&l.equals(e.quantizationParameters.extent.spatialReference)&&delete s.quantizationParameters.extent.spatialReference,n.quantizationParameters=JSON.stringify(s.quantizationParameters)),s.parameterValues&&(n.parameterValues=JSON.stringify(s.parameterValues)),s.rangeValues&&(n.rangeValues=JSON.stringify(s.rangeValues)),s.dynamicDataSource&&(n.layer=JSON.stringify({source:s.dynamicDataSource}),delete s.dynamicDataSource),s.timeExtent){const e=s.timeExtent,{start:t,end:r}=e;null==t&&null==r||(n.time=t===r?t:`${t??"null"},${r??"null"}`),delete s.timeExtent}return e.defaultSpatialReferenceEnabled&&(0,i.pC)(l)&&(0,i.pC)(a)&&l.equals(a)&&(n.defaultSR=n.inSR,delete n.inSR,delete n.outSR),n}async function y(e,t,r,s){const n=(0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty?{data:{features:[]}}:await w(e,t,"json",s);return(0,c.p)(t,r,n.data),n}async function g(e,t,r,s){if((0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty)return{data:r.createFeatureResult()};const n=await m(e,t,s),o=n;return o.data=(0,u.C)(n.data,r),o}function m(e,t,r){return w(e,t,"pbf",r)}function f(e,t,r){return(0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty?Promise.resolve({data:{objectIds:[]}}):w(e,t,"json",r,{returnIdsOnly:!0})}function _(e,t,r){return(0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):w(e,t,"json",r,{returnIdsOnly:!0,returnCountOnly:!0})}function b(e,t,r){return(0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty?Promise.resolve({data:{count:0,extent:null}}):w(e,t,"json",r,{returnExtentOnly:!0,returnCountOnly:!0}).then((e=>{const t=e.data;if(t.hasOwnProperty("extent"))return e;if(t.features)throw new Error(p);if(t.hasOwnProperty("count"))throw new Error(p);return e}))}function w(e,t,r,o={},u={}){const c="string"==typeof e?(0,n.mN)(e):e,p=t.geometry?[t.geometry]:[];return o.responseType="pbf"===r?"array-buffer":"json",(0,a.aX)(p,null,o).then((e=>{const a=e&&e[0];(0,i.pC)(a)&&((t=t.clone()).geometry=a);const p=(0,l.A)({...c.query,f:r,...u,...h(t,u)});return(0,s.default)((0,n.v_)(c.path,"query"),{...o,query:{...p,...o.query}})}))}},28694:(e,t,r)=>{r.d(t,{p:()=>n});var s=r(70586),i=r(69285);function n(e,t,r){if(!r||!r.features||!r.hasZ)return;const n=(0,i.k)(r.geometryType,t,e.outSpatialReference);if(!(0,s.Wi)(n))for(const e of r.features)n(e.geometry)}},6388:(e,t,r)=>{r.d(t,{Z:()=>h});var s,i=r(43697),n=(r(66577),r(35454)),o=r(96674),a=r(22974),l=r(5600),u=(r(75215),r(52011)),c=r(6570);const p=new n.X({upperLeft:"upper-left",lowerLeft:"lower-left"});let d=s=class extends o.wq{constructor(e){super(e),this.extent=null,this.mode="view",this.originPosition="upper-left",this.tolerance=1}clone(){return new s((0,a.d9)({extent:this.extent,mode:this.mode,originPosition:this.originPosition,tolerance:this.tolerance}))}};(0,i._)([(0,l.Cb)({type:c.Z,json:{write:{overridePolicy(){return{enabled:"view"===this.mode}}}}})],d.prototype,"extent",void 0),(0,i._)([(0,l.Cb)({type:["view","edit"],json:{write:!0}})],d.prototype,"mode",void 0),(0,i._)([(0,l.Cb)({type:String,json:{read:p.read,write:p.write}})],d.prototype,"originPosition",void 0),(0,i._)([(0,l.Cb)({type:Number,json:{write:{overridePolicy(){return{enabled:"view"===this.mode}}}}})],d.prototype,"tolerance",void 0),d=s=(0,i._)([(0,u.j)("esri.rest.support.QuantizationParameters")],d);const h=d},57444:(e,t,r)=>{r.d(t,{Z:()=>x});var s,i=r(43697),n=r(66577),o=r(92835),a=r(35454),l=r(96674),u=r(22974),c=r(70586),p=r(5600),d=r(90578),h=r(36030),y=r(52011),g=r(30556),m=r(75215),f=r(33955),_=r(10158),b=r(6388),w=r(58539),S=r(82971),v=r(13473);const C=new a.X({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),T=new a.X({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let k=s=class extends l.wq{constructor(e){super(e),this.aggregateIds=null,this.cacheHint=void 0,this.compactGeometryEnabled=!1,this.datumTransformation=null,this.defaultSpatialReferenceEnabled=!1,this.distance=void 0,this.dynamicDataSource=void 0,this.formatOf3DObjects=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=void 0,this.groupByFieldsForStatistics=null,this.having=null,this.historicMoment=null,this.maxAllowableOffset=void 0,this.maxRecordCountFactor=1,this.multipatchOption=null,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.outStatistics=null,this.parameterValues=null,this.pixelSize=null,this.quantizationParameters=null,this.rangeValues=null,this.relationParameter=null,this.resultType=null,this.returnCentroid=!1,this.returnDistinctValues=!1,this.returnExceededLimitFeatures=!0,this.returnGeometry=!1,this.returnQueryGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.sourceSpatialReference=null,this.spatialRelationship="intersects",this.start=void 0,this.sqlFormat=null,this.text=null,this.timeExtent=null,this.timeReferenceUnknownClient=!1,this.units=null,this.where=null}static from(e){return(0,m.TJ)(s,e)}castDatumTransformation(e){return"number"==typeof e||"object"==typeof e?e:null}writeHistoricMoment(e,t){t.historicMoment=e&&e.getTime()}writeParameterValues(e,t){if(e){const r={};for(const t in e){const s=e[t];Array.isArray(s)?r[t]=s.map((e=>e instanceof Date?e.getTime():e)):s instanceof Date?r[t]=s.getTime():r[t]=s}t.parameterValues=r}}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10,t.where="1=1"}writeWhere(e,t){t.where=e||"1=1"}clone(){return new s((0,u.d9)({aggregateIds:this.aggregateIds,cacheHint:this.cacheHint,compactGeometryEnabled:this.compactGeometryEnabled,datumTransformation:this.datumTransformation,defaultSpatialReferenceEnabled:this.defaultSpatialReferenceEnabled,distance:this.distance,gdbVersion:this.gdbVersion,geometry:this.geometry,geometryPrecision:this.geometryPrecision,groupByFieldsForStatistics:this.groupByFieldsForStatistics,having:this.having,historicMoment:(0,c.pC)(this.historicMoment)?new Date(this.historicMoment.getTime()):null,maxAllowableOffset:this.maxAllowableOffset,maxRecordCountFactor:this.maxRecordCountFactor,multipatchOption:this.multipatchOption,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,outStatistics:this.outStatistics,parameterValues:this.parameterValues,pixelSize:this.pixelSize,quantizationParameters:this.quantizationParameters,rangeValues:this.rangeValues,relationParameter:this.relationParameter,resultType:this.resultType,returnDistinctValues:this.returnDistinctValues,returnGeometry:this.returnGeometry,returnCentroid:this.returnCentroid,returnExceededLimitFeatures:this.returnExceededLimitFeatures,returnQueryGeometry:this.returnQueryGeometry,returnM:this.returnM,returnZ:this.returnZ,dynamicDataSource:this.dynamicDataSource,sourceSpatialReference:this.sourceSpatialReference,spatialRelationship:this.spatialRelationship,start:this.start,sqlFormat:this.sqlFormat,text:this.text,timeExtent:this.timeExtent,timeReferenceUnknownClient:this.timeReferenceUnknownClient,units:this.units,where:this.where}))}};k.MAX_MAX_RECORD_COUNT_FACTOR=5,(0,i._)([(0,p.Cb)({json:{write:!0}})],k.prototype,"aggregateIds",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{write:!0}})],k.prototype,"cacheHint",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{default:!1,write:!0}})],k.prototype,"compactGeometryEnabled",void 0),(0,i._)([(0,p.Cb)({json:{write:!0}})],k.prototype,"datumTransformation",void 0),(0,i._)([(0,d.p)("datumTransformation")],k.prototype,"castDatumTransformation",null),(0,i._)([(0,p.Cb)({type:Boolean,json:{default:!1,write:!0}})],k.prototype,"defaultSpatialReferenceEnabled",void 0),(0,i._)([(0,p.Cb)({type:Number,json:{write:{overridePolicy:e=>({enabled:e>0})}}})],k.prototype,"distance",void 0),(0,i._)([(0,p.Cb)({type:_.n,json:{write:!0}})],k.prototype,"dynamicDataSource",void 0),(0,i._)([(0,p.Cb)({type:String,json:{write:!0}})],k.prototype,"formatOf3DObjects",void 0),(0,i._)([(0,p.Cb)({type:String,json:{write:!0}})],k.prototype,"gdbVersion",void 0),(0,i._)([(0,p.Cb)({types:n.qM,json:{read:f.im,write:!0}})],k.prototype,"geometry",void 0),(0,i._)([(0,p.Cb)({type:Number,json:{write:!0}})],k.prototype,"geometryPrecision",void 0),(0,i._)([(0,p.Cb)({type:[String],json:{write:!0}})],k.prototype,"groupByFieldsForStatistics",void 0),(0,i._)([(0,p.Cb)({type:String,json:{write:!0}})],k.prototype,"having",void 0),(0,i._)([(0,p.Cb)({type:Date})],k.prototype,"historicMoment",void 0),(0,i._)([(0,g.c)("historicMoment")],k.prototype,"writeHistoricMoment",null),(0,i._)([(0,p.Cb)({type:Number,json:{write:!0}})],k.prototype,"maxAllowableOffset",void 0),(0,i._)([(0,p.Cb)({type:Number,cast:e=>e<1?1:e>s.MAX_MAX_RECORD_COUNT_FACTOR?s.MAX_MAX_RECORD_COUNT_FACTOR:e,json:{write:{overridePolicy:e=>({enabled:e>1})}}})],k.prototype,"maxRecordCountFactor",void 0),(0,i._)([(0,p.Cb)({type:["xyFootprint"],json:{write:!0}})],k.prototype,"multipatchOption",void 0),(0,i._)([(0,p.Cb)({type:Number,json:{read:{source:"resultRecordCount"}}})],k.prototype,"num",void 0),(0,i._)([(0,p.Cb)({json:{write:!0}})],k.prototype,"objectIds",void 0),(0,i._)([(0,p.Cb)({type:[String],json:{write:!0}})],k.prototype,"orderByFields",void 0),(0,i._)([(0,p.Cb)({type:[String],json:{write:!0}})],k.prototype,"outFields",void 0),(0,i._)([(0,p.Cb)({type:S.Z,json:{name:"outSR",write:!0}})],k.prototype,"outSpatialReference",void 0),(0,i._)([(0,p.Cb)({type:[w.Z],json:{write:{enabled:!0,overridePolicy(){return{enabled:(0,c.pC)(this.outStatistics)&&this.outStatistics.length>0}}}}})],k.prototype,"outStatistics",void 0),(0,i._)([(0,p.Cb)({json:{write:!0}})],k.prototype,"parameterValues",void 0),(0,i._)([(0,g.c)("parameterValues")],k.prototype,"writeParameterValues",null),(0,i._)([(0,p.Cb)({type:v.Z,json:{write:!0}})],k.prototype,"pixelSize",void 0),(0,i._)([(0,p.Cb)({type:b.Z,json:{write:!0}})],k.prototype,"quantizationParameters",void 0),(0,i._)([(0,p.Cb)({type:[Object],json:{write:!0}})],k.prototype,"rangeValues",void 0),(0,i._)([(0,p.Cb)({type:String,json:{read:{source:"relationParam"},write:{target:"relationParam",overridePolicy(){return{enabled:"relation"===this.spatialRelationship}}}}})],k.prototype,"relationParameter",void 0),(0,i._)([(0,p.Cb)({type:String,json:{write:!0}})],k.prototype,"resultType",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{default:!1,write:!0}})],k.prototype,"returnCentroid",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{default:!1,write:!0}})],k.prototype,"returnDistinctValues",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{default:!0,write:!0}})],k.prototype,"returnExceededLimitFeatures",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{write:!0}})],k.prototype,"returnGeometry",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{default:!1,write:!0}})],k.prototype,"returnQueryGeometry",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{default:!1,write:!0}})],k.prototype,"returnM",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],k.prototype,"returnZ",void 0),(0,i._)([(0,p.Cb)({type:S.Z,json:{write:!0}})],k.prototype,"sourceSpatialReference",void 0),(0,i._)([(0,h.J)(C,{ignoreUnknown:!1,name:"spatialRel"})],k.prototype,"spatialRelationship",void 0),(0,i._)([(0,p.Cb)({type:Number,json:{read:{source:"resultOffset"}}})],k.prototype,"start",void 0),(0,i._)([(0,g.c)("start"),(0,g.c)("num")],k.prototype,"writeStart",null),(0,i._)([(0,p.Cb)({type:String,json:{write:!0}})],k.prototype,"sqlFormat",void 0),(0,i._)([(0,p.Cb)({type:String,json:{write:!0}})],k.prototype,"text",void 0),(0,i._)([(0,p.Cb)({type:o.Z,json:{write:!0}})],k.prototype,"timeExtent",void 0),(0,i._)([(0,p.Cb)({type:Boolean,json:{default:!1,write:!0}})],k.prototype,"timeReferenceUnknownClient",void 0),(0,i._)([(0,h.J)(T,{ignoreUnknown:!1}),(0,p.Cb)({json:{write:{overridePolicy(e){return{enabled:e&&this.distance>0}}}}})],k.prototype,"units",void 0),(0,i._)([(0,p.Cb)({type:String,json:{write:{overridePolicy(e){return{enabled:null!=e||this.start>0}}}}})],k.prototype,"where",void 0),(0,i._)([(0,g.c)("where")],k.prototype,"writeWhere",null),k=s=(0,i._)([(0,y.j)("esri.rest.support.Query")],k);const x=k},58539:(e,t,r)=>{r.d(t,{Z:()=>h});var s,i=r(43697),n=r(35454),o=r(96674),a=r(22974),l=r(5600),u=(r(75215),r(52011)),c=r(30556);const p=new n.X({count:"count",sum:"sum",min:"min",max:"max",avg:"avg",stddev:"stddev",var:"var",exceedslimit:"exceedslimit",percentile_cont:"percentile-continuous",percentile_disc:"percentile-discrete",EnvelopeAggregate:"envelope-aggregate",CentroidAggregate:"centroid-aggregate",ConvexHullAggregate:"convex-hull-aggregate"});let d=s=class extends o.wq{constructor(e){super(e),this.maxPointCount=void 0,this.maxRecordCount=void 0,this.maxVertexCount=void 0,this.onStatisticField=null,this.outStatisticFieldName=null,this.statisticType=null,this.statisticParameters=null}writeStatisticParameters(e,t){"percentile-continuous"!==this.statisticType&&"percentile-discrete"!==this.statisticType||(t.statisticParameters=(0,a.d9)(e))}clone(){return new s({maxPointCount:this.maxPointCount,maxRecordCount:this.maxRecordCount,maxVertexCount:this.maxVertexCount,onStatisticField:this.onStatisticField,outStatisticFieldName:this.outStatisticFieldName,statisticType:this.statisticType,statisticParameters:(0,a.d9)(this.statisticParameters)})}};(0,i._)([(0,l.Cb)({type:Number,json:{write:!0}})],d.prototype,"maxPointCount",void 0),(0,i._)([(0,l.Cb)({type:Number,json:{write:!0}})],d.prototype,"maxRecordCount",void 0),(0,i._)([(0,l.Cb)({type:Number,json:{write:!0}})],d.prototype,"maxVertexCount",void 0),(0,i._)([(0,l.Cb)({type:String,json:{write:!0}})],d.prototype,"onStatisticField",void 0),(0,i._)([(0,l.Cb)({type:String,json:{write:!0}})],d.prototype,"outStatisticFieldName",void 0),(0,i._)([(0,l.Cb)({type:String,json:{read:{source:"statisticType",reader:p.read},write:{target:"statisticType",writer:p.write}}})],d.prototype,"statisticType",void 0),(0,i._)([(0,l.Cb)({type:Object})],d.prototype,"statisticParameters",void 0),(0,i._)([(0,c.c)("statisticParameters")],d.prototype,"writeStatisticParameters",null),d=s=(0,i._)([(0,u.j)("esri.rest.support.StatisticDefinition")],d);const h=d}}]);
@@ -1,5 +0,0 @@
1
- /*
2
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
- */
5
- const t=t=>{if(!Array.isArray(t))return!1;const[e]=t;return"number"==typeof e||"string"==typeof e};class e{constructor(t={}){this._options=t}toQueryParams(e){if(!e)return null;const o=e.toJSON(),n={};return Object.keys(o).forEach((e=>{const r=this._options[e];if(r){const s="boolean"!=typeof r&&r.name?r.name:e,i="boolean"!=typeof r&&r.getter?r.getter(o):o[e];null!=i&&(n[s]=t(i)?i.join(","):"object"==typeof i?JSON.stringify(i):i)}else n[e]=o[e]}),this),n}}function o(t){return new e(t)}export{o as createQueryParamsHelper};