@arcgis/core 4.25.0-next.20221020 → 4.25.0-next.20221021

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/WebMap.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0b0f3e93f658a012d5f0.js +1 -0
  4. package/assets/esri/core/workers/chunks/2ebba71cbbfa62ddf46a.js +1 -0
  5. package/assets/esri/core/workers/chunks/6dfb2ddfd72009564a34.js +1 -0
  6. package/assets/esri/core/workers/chunks/883cfe319b15ebabf71e.js +1 -0
  7. package/assets/esri/core/workers/chunks/925f53f4ef097c5ce204.js +1 -0
  8. package/assets/esri/core/workers/chunks/9d410721f42259efe666.js +1 -0
  9. package/assets/esri/core/workers/chunks/b5e6a868256c5aae6d5e.js +1 -0
  10. package/assets/esri/core/workers/chunks/{a9b77bea0b8d7a2e5f65.js → c8c0f091aab41e4effa5.js} +1 -1
  11. package/assets/esri/core/workers/chunks/d573ec98401fbae26383.js +1 -0
  12. package/layers/MapNotesLayer.js +1 -1
  13. package/package.json +1 -1
  14. package/support/revision.js +1 -1
  15. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  16. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  17. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  18. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  19. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  20. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  21. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  22. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  23. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  24. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  25. package/views/3d/interactive/manipulatorUtils.js +1 -1
  26. package/views/3d/terrain/Tile.js +1 -1
  27. package/views/draw/DrawOperation.js +1 -1
  28. package/views/draw/drawSurfaces.js +1 -1
  29. package/views/interactive/dragEventPipeline.js +1 -1
  30. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  31. package/views/interactive/snapping/SnappingOperation.js +1 -1
  32. package/assets/esri/core/workers/chunks/09255015e57bdfa5337f.js +0 -1
  33. package/assets/esri/core/workers/chunks/24ffd7180bb947bc8aec.js +0 -1
  34. package/assets/esri/core/workers/chunks/5f1c474a0e2dd8da6f2f.js +0 -1
  35. package/assets/esri/core/workers/chunks/6a2358861b3d3007ad26.js +0 -1
  36. package/assets/esri/core/workers/chunks/bf248b08e18a50878f38.js +0 -1
  37. package/assets/esri/core/workers/chunks/c9399a106dc167368a39.js +0 -1
  38. package/assets/esri/core/workers/chunks/cdfa8b788bde5334672a.js +0 -1
  39. package/assets/esri/core/workers/chunks/dbf72099949febfae5a1.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../core/mathUtils.js";import{isSome as t,abortMaybe as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{c as r,s as a}from"../../../chunks/vec2.js";import{a as o}from"../../../chunks/vec2f64.js";import{b as l,p as h,e as u,g as d,a as c,l as f}from"../../../chunks/vec3.js";import{c as g,u as p}from"../../../chunks/vec3f64.js";import{g as m}from"../../../chunks/common.js";import{getReferenceEllipsoid as _}from"../../../geometry/projectionEllipsoid.js";import{create as y,equals as A}from"../../../geometry/support/aaBoundingRect.js";import{c as T}from"../../../chunks/sphere.js";import{VectorTile as E}from"../../2d/engine/vectorTiles/VectorTile.js";import{ImageWithType as v}from"../support/StreamDataLoader.js";import{ElevationBounds as M}from"./ElevationBounds.js";import{ElevationTileAgent as I}from"./ElevationTileAgent.js";import{TileFrustumVisibility as D,LODSnapping as L,TextureUpdate as x,NeighborIndex as S}from"./interfaces.js";import{LayerClasses as O,LayerClass as N}from"./LayerClass.js";import{MapTileAgent as b}from"./MapTileAgent.js";import{RasterTile as j}from"./RasterTile.js";import{MAX_PATCH_TESSELATION as U,getElevationDesiredResolutionLevel as C}from"./TerrainConst.js";import{weakAssert as P,getLayerWithExtentRange as B,isBlendableLayerView as R,isGroupLayer as V,oppositeCorner as G,neighborCornerIndices as w,neighborEdgeIndices as W,oppositeEdge as q,internalAssert as H,ENABLE_TERRAIN_INTERNAL_CHECKS as F,isNorth as k,isSouth as X,isWest as Y,isEast as z,ENABLE_WATERPROOFNESS_TESTS as J,isWestCorner as $,isNorthCorner as Q}from"./terrainUtils.js";import{TILE_AGENT_DONE as K}from"./TileAgent.js";import{TilePerLayerInfo as Z}from"./TilePerLayerInfo.js";import ee from"./TileTexture.js";import{TileUpdate as te}from"./TileUpdate.js";import{fallsWithinLayer as ie}from"./tileUtils.js";import{getGpuMemoryUsage as se}from"../../webgl/Util.js";const ne=g(),re=g(),ae=g(),oe=.1;class le{constructor(){this.fovX=0,this.fovY=0,this.relativeWidthLimit=0,this.relativeHeightLimit=0,this.maxLod=0,this.angledSplitBias=0,this.aboveGround=!0}}class he{constructor(){this.lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=y(),this._elevationBounds=o(),this.layerInfo=[[],[]],this.extentInRadians=y(),this.centerAtSeaLevel=g(),this._center=[g(),T(),g()],this.up=p(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=null,this._mapTileMemoryInternal=0,this._mapDataRefCount=0,this._screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.extentMidX=0,this.extentMidY=0}static prune(){ce.prune(0),fe.prune(0),Z.prune()}get _isCached(){return!this.shouldLoad&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBounds(){return this._elevationBounds}get level(){return this.lij[0]}get key(){return`${this.lij[0]}/${this.lij[1]}/${this.lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[pe.MIDDLE][3]}get screenDepth(){return this._screenDepth}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent?.frustumVisibility??D.INTERSECTS;this._frustumVisibility=e===D.INSIDE?D.INSIDE:e===D.OUTSIDE?D.OUTSIDE:this._calculateFrustumVisibilityStatus(this.surface.frustum);const t=this._frustumVisibility!==D.OUTSIDE&&this._intersectsClippingArea;t!==this._visible&&(this._visible=t,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}get shouldLoad(){if(this._surface.lodSnapping===L.ON){const e=this.level-this._surface.snapLevel;if(0===e)return!0;if(1===e)return!1}return this.isLeaf}init(e,t,i){this.lij[0]=e[0],this.lij[1]=e[1],this.lij[2]=e[2],this.ellipsoid=_(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e[0],e[1],e[2],this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[pe.MIDDLE][3]=0,this.vlevel=e?e[0]:0,t&&t.elevationBounds?r(this._elevationBounds,t.elevationBounds):a(this._elevationBounds,0,0),this._pendingUpdates=0,this.renderData=null,this._screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=t,this.unsetChildren(),this._surface=i,this.updateVisibility();for(const s of O){const e=i.numLayers(s),t=this.layerInfo[s];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=Z.acquire(this._surface.upsampleInfoPool),s===N.ELEVATION&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,U)}release(){P(!this.renderData,"tile.renderData was not unloaded"),this._surface.upsampleMapCache.pop(this.key);for(const e of O){for(const t of this.layerInfo[e])t.release();this.layerInfo[e].length=0}this._parent=null;for(let e=0;e<4;++e)this._children[e]=null;this._surface=null,this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){if(--this._mapDataRefCount,this._isCached){this.setMemoryDirty();const e=this._cachedMemory;e>0&&this._surface.upsampleMapCache.put(this.key,this,e)}}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this._ensureUsedMemory()+(this._isCached?0:this._mapTileMemoryInternal)}get _cachedMemory(){return this._isCached?this._mapTileMemory:0}get _mapTileMemory(){return this._ensureUsedMemory(),this.layerInfo[N.MAP].reduce(((e,t)=>e+(t instanceof E?t.memoryUsage:0)),this._mapTileMemoryInternal)}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(t(this._usedMemory))return this._usedMemory;this._usedMemory=0,this._mapTileMemoryInternal=0;let e=0;for(const{data:t}of this.layerInfo[N.MAP])t instanceof E?e+=this._getTerrainDataMemory(t):this._mapTileMemoryInternal+=this._getTerrainDataMemory(t);const i=this._cpuImageMemorySize;for(const t of this.layerInfo[N.ELEVATION])this._usedMemory+=t.data?i:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemoryInternal+=se(this.renderData.textureDescriptor)),this._isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this._mapTileMemoryInternal+e),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?e===N.MAP?this._isCached?0:this._getTerrainDataMemory(i.data):e===N.ELEVATION?this._cpuImageMemorySize:0:0}_getTerrainDataMemory(e){return e instanceof ee?se(e.texture):e instanceof HTMLImageElement||e instanceof v?this._cpuImageMemorySize:e instanceof E||e instanceof j?e.memoryUsage:0}updateScreenDepth(e){const t=this._center[pe.MIDDLE],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this._screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,i,s){if(!this.visible)return te.NONE;if(t(e.frustum)&&(!this._intersectsClippingArea||this._calculateFrustumVisibilityStatus(e.frustum)===D.OUTSIDE))return te.NONE;const n=this.level;l(ne,this._center[pe.MIDDLE],i);let r=h(ne),a=pe.MIDDLE;l(re,this._center[pe.TOP],i);const o=h(re);o<r&&(r=o,a=pe.TOP),l(re,this._center[pe.BOTTOM],i);const g=h(re);if(g<r&&(r=g,a=pe.BOTTOM),this._edgeLen2>r&&n<e.maxLod)return te.SPLIT;const p=Math.sqrt(r),m=e.fovX*p*2,_=this._edgeLen/m,y=()=>{const t=n+Math.ceil(-Math.log2(e.relativeWidthLimit/_));return t!==this.vlevel?(this.vlevel=t,te.VSPLITMERGE):te.NONE_HIT_MAXLOD};if(s===L.ON){if(1===this._surface.snapLevel-n)return n>=e.maxLod?y():te.SPLIT}const A=u(this.up,ne),T=this._elevationBounds[1]-this._elevationBounds[0],E=T/this.edgeLen;if(e.aboveGround&&A>0&&E<.001){if(A/p-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-E>0)return te.NONE}if(_<e.relativeWidthLimit)return this.vlevel!==this.level?(this.vlevel=this.level,te.VSPLITMERGE):te.NONE;if(n>=e.maxLod)return y();if(n>6){l(re,this._center[a],i),d(ae,this.up,A),l(ae,ae,re);const t=h(ae);if(t>this.radius*this.radius){d(ae,ae,this.radius/Math.sqrt(t)),c(ae,ae,this._center[a]),l(ae,i,ae);const s=Math.min(1,(Math.abs(u(ae,this.up))+.5*T+this._curvatureHeight)/f(ae)),n=oe/e.angledSplitBias,r=e.fovY*p*2;if(s*(this._edgeLen/r)<n*e.relativeHeightLimit)return te.NONE}}return te.SPLIT}setChildren(e,t,i,s){P(!!(e&&t&&i&&s),"Null child passed"),this._children[0]=e,this._children[1]=t,this._children[2]=i,this._children[3]=s}unsetChildren(){this._children[0]=null,this._children[1]=null,this._children[2]=null,this._children[3]=null}get isLoaded(){return this.renderData?.hasGeometry??!1}load(){this.refMapData();for(const e of O)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(e){e.unloadTile(this);for(const t of O){const e=this.layerInfo[t];for(const t of e)t.loadingAgent&&t.loadingAgent!==K&&(de(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0}this.resetPendingUpdate(te.GEOMETRY),this.resetPendingUpdate(te.TEXTURE_NOFADING),this.resetPendingUpdate(te.TEXTURE_FADING),this.unrefMapData()}unloadMapData(){const e=this.layerInfo[N.MAP];for(const t of e)t.loadingAgent&&t.loadingAgent!==K&&(de(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(A(e,this._clippingArea))return!1;const i=this._intersectsClippingArea,s=this._isWithinClippingArea;t(e)?(this._intersectsClippingArea=this.intersectsExtent(e),this._isWithinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._isWithinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const n=s&&this._isWithinClippingArea,r=!(s||i||this._isWithinClippingArea||this._intersectsClippingArea);return!this.renderData||n||r||this.setPendingUpdate(te.GEOMETRY),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i||!i.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of O){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==K&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(te.SPLIT)||e!==N.ELEVATION&&!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){this._pendingUpdates|=e,e===te.SPLIT||e===te.MERGE?this._surface.setTileTreeDirty():this._surface.requestUpdate()}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated)return console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),s.dataArrived(this),!0;if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get isLeaf(){return null==this._children[0]}hasLij(e){return this.lij[0]===e[0]&&this.lij[1]===e[1]&&this.lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;if(this.isLeaf)return null;const t=this._children[0].findByLij(e)||this._children[1].findByLij(e)||this._children[2].findByLij(e)||this._children[3].findByLij(e);return t||null}distanceToSquared(e){return h(l(ae,this._center[pe.MIDDLE],e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);P(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=this.layerInfo[t][e];s.data=i,s.dataInvalidated=!1,s.waitingAgents.forAll((e=>e.dataArrived(this))),s.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t,i){i.notInTilemap||console.error(`Tile ${this.lij.toString()} layer ${t}/${e} error ${i}`);const s=this.layerInfo[t][e];s.dataMissing=!0,s.waitingAgents.forAll((e=>e.dataMissing())),s.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t){switch(e){case N.MAP:return this._updateTexture(t);case N.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===x.FADING?te.TEXTURE_NOFADING:te.TEXTURE_FADING),this.setPendingUpdate(e===x.FADING?te.TEXTURE_FADING:te.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(te.GEOMETRY);for(const e of this.layerInfo[N.ELEVATION])e.pendingUpdates|=te.GEOMETRY}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBounds;a(e,1/0,-1/0);const i=this.layerInfo[N.ELEVATION];let s=!0;for(const n of i)t(n.elevationBounds)&&(e[0]=Math.min(e[0],n.elevationBounds.min),e[1]=Math.max(e[1],n.elevationBounds.max),n.elevationBounds.hasNoDataValues||(s=!1));s&&(e[0]=Math.min(e[0],0),e[1]=Math.max(e[1],0)),this.updateRadiusAndCenter(),this._surface.setTileTreeDirty()}_updateCenter(){const e=this._elevationBounds,t=.5*(e[0]+e[1]);d(ae,this.up,t),c(this._center[pe.MIDDLE],this.centerAtSeaLevel,ae),d(ae,this.up,e[0]),c(this._center[pe.TOP],this.centerAtSeaLevel,ae),d(ae,this.up,e[1]),c(this._center[pe.BOTTOM],this.centerAtSeaLevel,ae)}findElevationBoundsForLayer(e,i){const n=this.layerInfo[N.ELEVATION][e];if(t(n.elevationBounds)&&n.elevationBounds.level>=i)return;const r=this._surface.layerViewByIndex(e,N.ELEVATION),a=B(r);if(!ie(this,a,!1))return;const o=ge;let l=!1;if(n.data){const e=n.data;o.min=e.bounds[0],o.max=e.bounds[1],o.hasNoDataValues=e.hasNoDataValues,o.level=this.level,l=!0}else{let t,i,s=0;for(let n=this._parent;n&&(!i||s<C(this.level))&&(s=this.vlevel-n.level,t=i||t,i=n.layerInfo[N.ELEVATION][e].data,!(!i&&t&&s>=C(this.level)));n=n.parent);i=i||t,i&&(i.computeMinMaxValue(this.lij[0],this.lij[1],this.lij[2],o),o.min!==1/0&&(o.level=i.level,l=!0))}l&&(s(n.elevationBounds)&&(n.elevationBounds=new M),n.elevationBounds.copyFrom(o))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==K&&(de(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:Z.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,x.FADING))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===K&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of O){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==K&&(i.loadingAgent.setSuspension(t),i.loadingAgent===K&&this.updateRenderData(e,x.FADING))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==K&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=K,!i.data&&s(i.upsampleInfo)&&this._createOrUpdateAgents(e+1,t)}_createOrUpdateAgents(e,i){const s=this.layerInfo[i];if(0===s.length)return;const n=e=>"normal"!==e.blendMode||V(e.parent)&&n(e.parent),r=(()=>{for(let r=e;r<s.length;++r){const e=this._surface.layerViewByIndex(r,i);if(R(e)&&t(e.layer.blendMode)&&"normal"!==e.layer.blendMode||V(e.layer.parent)&&n(e.layer.parent))return!0}return!1})(),a=this._isSuspended(i);for(let t=e;t<s.length;++t){const e=s[t];let n=!1;const o=this._surface.layerViewByIndex(t,i),l=B(o);if(e.loadingAgent?ie(this,l,!1)?(e.loadingAgent!==K&&e.loadingAgent.setSuspension(a),e.loadingAgent!==K&&(n=e.loadingAgent.update())):e.dispose():ie(this,l,!1)&&(e.loadingAgent=ue(this,t,i,a),n=e.loadingAgent.startLoading(),n?e.loadingAgent===K&&this.setPendingUpdate(te.GEOMETRY):(de(e.loadingAgent),e.loadingAgent=K)),e.loadingAgent===K&&this.updateRenderData(i,x.FADING),!r&&n&&o.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationBasedVerticesPerSide(t){const i=this.vlevel-this.level,s=Math.max(this.level-t,C(this.level)-i);return e(1+(this.maxTesselation>>s),2,this.maxTesselation+1)}get test(){return{cachedMemory:this._cachedMemory}}_findLIJ(e,i){if(!e)return null;const s=this.surface.rootTiles;if(t(s))for(const t of s)if(me(t,e)){let s=t,n=e[0]-s.level-1;for(;n>=0&&!s.isLeaf&&!i(s);){const t=e[1]>>n&1,i=e[2]>>n&1;s=s.children[2*t+i],n--}return i(s)?s:null}return null}findNeighborTile(e,t){const i=this.lij,s=this.getNeighborLIJ(i,e);return s?_e(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=e===S.NORTH_EAST?1:e===S.NORTH_WEST?0:e===S.SOUTH_WEST?2:3;let s=this;for(;!(s.isLeaf||t&&t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,(e=>t(e)||e.level===this.level))?.findCorner(G(e),t)}forAllSubtreeOnSide(e,t){const i=e===S.NORTH?[0,1]:e===S.NORTH_EAST?[1]:e===S.EAST?[1,3]:e===S.SOUTH_EAST?[3]:e===S.SOUTH?[2,3]:e===S.SOUTH_WEST?[2]:e===S.WEST?[0,2]:[0],s=e=>{t(e)||e.isLeaf||i.forEach((t=>s(e.children[t])))};s(this)}forallNeighbors(e){w.forEach((t=>this.findNeighborCornerTileExact(t,e))),W.forEach((t=>this.findNeighborTile(t,(t=>t.level===this.level||e(t)))?.forAllSubtreeOnSide(q(t),e)))}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(H(!F||i>=0),0===i)return 0;const s=2**i,n=1==(1&e),r=n?0:1,a=t.lij[r+1]*s,o=this.lij[r+1],l=o-a,h=n?s-1-l:l;return F&&(H(a<=o&&o<a+s),H(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.isLoaded;W.forEach((t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(q(t),(i=>!!i.isLoaded&&(e(i,t),!0)))})),w.forEach((t=>{const s=this.findNeighborTile(t,i)?.findCorner(G(t),(e=>e.isLoaded));H(!s||Te(this,s,t)),s?.isLoaded&&e(s,t)}))}getNeighborLIJ(e,t){const i=k(t)?-1:X(t)?1:0,s=Y(t)?-1:z(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this.wrapLIJ(n):n[2]<0?null:n}wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this.lij[2]===this.surface.lijEastEnd(this.level)-1}get isWestEnd(){return 0===this.lij[2]}get isNorthEnd(){return 0===this.lij[1]}get isSouthEnd(){return this.extent[1]+m()>=this.surface.extent[1]}compareLIJs(e){const t=this.lij,i=t[0],s=e[0];if(i===s)return[t,e];const n=i-s;if(n<0){const i=2**-n;return[[s,t[1]*i,t[2]*i],e]}{const s=2**n;return[t,[i,e[1]*s,e[2]*s]]}}checkGeometryWaterproofness(){J&&(H(this.isLoaded),this.renderData.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,i=this.surface.rootTilesExtent,s=.25*(t[2]-t[0]);if(k(e)&&t[3]+s>=i[3])return!1;if(X(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&Y(e)&&t[0]-s<=i[0])&&!(!n&&z(e)&&t[2]+s>=i[2])}}function ue(e,t,i,s){const n=i===N.ELEVATION?fe.acquire():ce.acquire();return n.init(e,t,i,s),n}function de(e){e.dispose(),e instanceof I?fe.release(e):e instanceof b&&ce.release(e)}const ce=new n(b),fe=new n(I),ge=new M;var pe;function me(e,t){const i=e.level,s=t[0];if(i>s)return!1;const n=s-i,r=Math.floor(t[1]/2**n),a=Math.floor(t[2]/2**n);return r===e.lij[1]&&a===e.lij[2]}function _e(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ye(e,t,i){return Math.abs(e-t)<=i}function Ae(e,t,i){if(s(e)||s(t))return!1;if(0===e.level&&0===t.level){if(e.isEastEnd&&t.isWestEnd&&i===S.EAST)return!0;if(e.isWestEnd&&t.isEastEnd&&i===S.WEST)return!0}const n=Math.max(1e-6*(e.extent[2]-e.extent[0]),1);switch(i){case S.NORTH:return ye(e.extent[3],t.extent[1],n);case S.SOUTH:return ye(e.extent[1],t.extent[3],n);case S.EAST:return ye(e.extent[2],t.extent[0],n)||ye(e.extent[2],-t.extent[0],n);case S.WEST:return ye(e.extent[0],t.extent[2],n)||ye(e.extent[0],-t.extent[2],n)}}function Te(e,t,i){return!s(e)&&!s(t)&&t!==e&&(e.level>=t.level?Ee(e,t,i):Ee(t,e,G(i)))}function Ee(e,t,i){H(e.level>=t.level);const s=$(i),n=Q(i),r=e.extent,a=t.extent,o=[s?r[0]:r[2],n?r[3]:r[1]],l=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),u=ye(o[0],l[0],h)||e.surface.isGlobal&&ye(o[0],-l[0],h),d=ye(o[1],l[1],h);if(u&&d)return!0;if(e.level===t.level)return H(!1),!1;if(!u&&!d)return H(!1),!1;const c=u?ve(a[1],a[3],r[1],r[3],h):ve(a[0],a[2],r[0],r[2],h);return H(c),c}function ve(e,t,i,s,n=m()){return e-n<=i&&i<=s&&s<=t+n}!function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(pe||(pe={}));export{pe as CenterPosition,le as SplitLimits,he as Tile,ye as almostEquals,Te as isCornerNeighbor,Ae as isEdgeNeighbor};
5
+ import{clamp as e}from"../../../core/mathUtils.js";import{isSome as t,abortMaybe as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{c as r,s as a}from"../../../chunks/vec2.js";import{a as o}from"../../../chunks/vec2f64.js";import{b as l,p as h,e as d,g as u,a as c,l as f}from"../../../chunks/vec3.js";import{c as g,u as p}from"../../../chunks/vec3f64.js";import{g as m}from"../../../chunks/common.js";import{getReferenceEllipsoid as _}from"../../../geometry/projectionEllipsoid.js";import{create as y,equals as A}from"../../../geometry/support/aaBoundingRect.js";import{c as T}from"../../../chunks/sphere.js";import{VectorTile as E}from"../../2d/engine/vectorTiles/VectorTile.js";import{ImageWithType as v}from"../support/StreamDataLoader.js";import{ElevationBounds as M}from"./ElevationBounds.js";import{ElevationTileAgent as I}from"./ElevationTileAgent.js";import{TileFrustumVisibility as D,LODSnapping as L,TextureUpdate as x,NeighborIndex as S}from"./interfaces.js";import{LayerClasses as O,LayerClass as b}from"./LayerClass.js";import{MapTileAgent as N}from"./MapTileAgent.js";import{RasterTile as j}from"./RasterTile.js";import{MAX_PATCH_TESSELATION as U,getElevationDesiredResolutionLevel as C}from"./TerrainConst.js";import{weakAssert as B,getLayerWithExtentRange as P,isGroupLayer as R,isBlendableLayerView as V,oppositeCorner as G,neighborCornerIndices as w,neighborEdgeIndices as W,oppositeEdge as q,internalAssert as H,ENABLE_TERRAIN_INTERNAL_CHECKS as F,isNorth as k,isSouth as X,isWest as Y,isEast as z,ENABLE_WATERPROOFNESS_TESTS as J,isWestCorner as $,isNorthCorner as Q}from"./terrainUtils.js";import{TILE_AGENT_DONE as K}from"./TileAgent.js";import{TilePerLayerInfo as Z}from"./TilePerLayerInfo.js";import ee from"./TileTexture.js";import{TileUpdate as te}from"./TileUpdate.js";import{fallsWithinLayer as ie}from"./tileUtils.js";import{getGpuMemoryUsage as se}from"../../webgl/Util.js";const ne=g(),re=g(),ae=g(),oe=.1;class le{constructor(){this.fovX=0,this.fovY=0,this.relativeWidthLimit=0,this.relativeHeightLimit=0,this.maxLod=0,this.angledSplitBias=0,this.aboveGround=!0}}class he{constructor(){this.lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=y(),this._elevationBounds=o(),this.layerInfo=[[],[]],this.extentInRadians=y(),this.centerAtSeaLevel=g(),this._center=[g(),T(),g()],this.up=p(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=null,this._mapTileMemoryInternal=0,this._mapDataRefCount=0,this._screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.extentMidX=0,this.extentMidY=0}static prune(){ce.prune(0),fe.prune(0),Z.prune()}get _isCached(){return!this.shouldLoad&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBounds(){return this._elevationBounds}get level(){return this.lij[0]}get key(){return`${this.lij[0]}/${this.lij[1]}/${this.lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[pe.MIDDLE][3]}get screenDepth(){return this._screenDepth}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent?.frustumVisibility??D.INTERSECTS;this._frustumVisibility=e===D.INSIDE?D.INSIDE:e===D.OUTSIDE?D.OUTSIDE:this._calculateFrustumVisibilityStatus(this.surface.frustum);const t=this._frustumVisibility!==D.OUTSIDE&&this._intersectsClippingArea;t!==this._visible&&(this._visible=t,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}get shouldLoad(){if(this._surface.lodSnapping===L.ON){const e=this.level-this._surface.snapLevel;if(0===e)return!0;if(1===e)return!1}return this.isLeaf}init(e,t,i){this.lij[0]=e[0],this.lij[1]=e[1],this.lij[2]=e[2],this.ellipsoid=_(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e[0],e[1],e[2],this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[pe.MIDDLE][3]=0,this.vlevel=e?e[0]:0,t&&t.elevationBounds?r(this._elevationBounds,t.elevationBounds):a(this._elevationBounds,0,0),this._pendingUpdates=0,this.renderData=null,this._screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=t,this.unsetChildren(),this._surface=i,this.updateVisibility();for(const s of O){const e=i.numLayers(s),t=this.layerInfo[s];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=Z.acquire(this._surface.upsampleInfoPool),s===b.ELEVATION&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,U)}release(){B(!this.renderData,"tile.renderData was not unloaded"),this._surface.upsampleMapCache.pop(this.key);for(const e of O){for(const t of this.layerInfo[e])t.release();this.layerInfo[e].length=0}this._parent=null;for(let e=0;e<4;++e)this._children[e]=null;this._surface=null,this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){if(--this._mapDataRefCount,this._isCached){this.setMemoryDirty();const e=this._cachedMemory;e>0&&this._surface.upsampleMapCache.put(this.key,this,e)}}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this._ensureUsedMemory()+(this._isCached?0:this._mapTileMemoryInternal)}get _cachedMemory(){return this._isCached?this._mapTileMemory:0}get _mapTileMemory(){return this._ensureUsedMemory(),this.layerInfo[b.MAP].reduce(((e,t)=>e+(t instanceof E?t.memoryUsage:0)),this._mapTileMemoryInternal)}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(t(this._usedMemory))return this._usedMemory;this._usedMemory=0,this._mapTileMemoryInternal=0;let e=0;for(const{data:t}of this.layerInfo[b.MAP])t instanceof E?e+=this._getTerrainDataMemory(t):this._mapTileMemoryInternal+=this._getTerrainDataMemory(t);const i=this._cpuImageMemorySize;for(const t of this.layerInfo[b.ELEVATION])this._usedMemory+=t.data?i:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemoryInternal+=se(this.renderData.textureDescriptor)),this._isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this._mapTileMemoryInternal+e),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?e===b.MAP?this._isCached?0:this._getTerrainDataMemory(i.data):e===b.ELEVATION?this._cpuImageMemorySize:0:0}_getTerrainDataMemory(e){return e instanceof ee?se(e.texture):e instanceof HTMLImageElement||e instanceof v?this._cpuImageMemorySize:e instanceof E||e instanceof j?e.memoryUsage:0}updateScreenDepth(e){const t=this._center[pe.MIDDLE],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this._screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,i,s){if(!this.visible)return te.NONE;if(t(e.frustum)&&(!this._intersectsClippingArea||this._calculateFrustumVisibilityStatus(e.frustum)===D.OUTSIDE))return te.NONE;const n=this.level;l(ne,this._center[pe.MIDDLE],i);let r=h(ne),a=pe.MIDDLE;l(re,this._center[pe.TOP],i);const o=h(re);o<r&&(r=o,a=pe.TOP),l(re,this._center[pe.BOTTOM],i);const g=h(re);if(g<r&&(r=g,a=pe.BOTTOM),this._edgeLen2>r&&n<e.maxLod)return te.SPLIT;const p=Math.sqrt(r),m=e.fovX*p*2,_=this._edgeLen/m,y=()=>{const t=n+Math.ceil(-Math.log2(e.relativeWidthLimit/_));return t!==this.vlevel?(this.vlevel=t,te.VSPLITMERGE):te.NONE_HIT_MAXLOD};if(s===L.ON){if(1===this._surface.snapLevel-n)return n>=e.maxLod?y():te.SPLIT}const A=d(this.up,ne),T=this._elevationBounds[1]-this._elevationBounds[0],E=T/this.edgeLen;if(e.aboveGround&&A>0&&E<.001){if(A/p-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-E>0)return te.NONE}if(_<e.relativeWidthLimit)return this.vlevel!==this.level?(this.vlevel=this.level,te.VSPLITMERGE):te.NONE;if(n>=e.maxLod)return y();if(n>6){l(re,this._center[a],i),u(ae,this.up,A),l(ae,ae,re);const t=h(ae);if(t>this.radius*this.radius){u(ae,ae,this.radius/Math.sqrt(t)),c(ae,ae,this._center[a]),l(ae,i,ae);const s=Math.min(1,(Math.abs(d(ae,this.up))+.5*T+this._curvatureHeight)/f(ae)),n=oe/e.angledSplitBias,r=e.fovY*p*2;if(s*(this._edgeLen/r)<n*e.relativeHeightLimit)return te.NONE}}return te.SPLIT}setChildren(e,t,i,s){B(!!(e&&t&&i&&s),"Null child passed"),this._children[0]=e,this._children[1]=t,this._children[2]=i,this._children[3]=s}unsetChildren(){this._children[0]=null,this._children[1]=null,this._children[2]=null,this._children[3]=null}get isLoaded(){return this.renderData?.hasGeometry??!1}load(){this.refMapData();for(const e of O)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(e){e.unloadTile(this);for(const t of O){const e=this.layerInfo[t];for(const t of e)t.loadingAgent&&t.loadingAgent!==K&&(ue(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0}this.resetPendingUpdate(te.GEOMETRY),this.resetPendingUpdate(te.TEXTURE_NOFADING),this.resetPendingUpdate(te.TEXTURE_FADING),this.unrefMapData()}unloadMapData(){const e=this.layerInfo[b.MAP];for(const t of e)t.loadingAgent&&t.loadingAgent!==K&&(ue(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(A(e,this._clippingArea))return!1;const i=this._intersectsClippingArea,s=this._isWithinClippingArea;t(e)?(this._intersectsClippingArea=this.intersectsExtent(e),this._isWithinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._isWithinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const n=s&&this._isWithinClippingArea,r=!(s||i||this._isWithinClippingArea||this._intersectsClippingArea);return!this.renderData||n||r||this.setPendingUpdate(te.GEOMETRY),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i||!i.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of O){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==K&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(te.SPLIT)||e!==b.ELEVATION&&!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){this._pendingUpdates|=e,e===te.SPLIT||e===te.MERGE?this._surface.setTileTreeDirty():this._surface.requestUpdate()}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated)return console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),s.dataArrived(this),!0;if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get isLeaf(){return null==this._children[0]}hasLij(e){return this.lij[0]===e[0]&&this.lij[1]===e[1]&&this.lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;if(this.isLeaf)return null;const t=this._children[0].findByLij(e)||this._children[1].findByLij(e)||this._children[2].findByLij(e)||this._children[3].findByLij(e);return t||null}distanceToSquared(e){return h(l(ae,this._center[pe.MIDDLE],e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);B(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=this.layerInfo[t][e];s.data=i,s.dataInvalidated=!1,s.waitingAgents.forAll((e=>e.dataArrived(this))),s.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t,i){i.notInTilemap||console.error(`Tile ${this.lij.toString()} layer ${t}/${e} error ${i}`);const s=this.layerInfo[t][e];s.dataMissing=!0,s.waitingAgents.forAll((e=>e.dataMissing())),s.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t){switch(e){case b.MAP:return this._updateTexture(t);case b.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===x.FADING?te.TEXTURE_NOFADING:te.TEXTURE_FADING),this.setPendingUpdate(e===x.FADING?te.TEXTURE_FADING:te.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(te.GEOMETRY);for(const e of this.layerInfo[b.ELEVATION])e.pendingUpdates|=te.GEOMETRY}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBounds;a(e,1/0,-1/0);const i=this.layerInfo[b.ELEVATION];let s=!0;for(const n of i)t(n.elevationBounds)&&(e[0]=Math.min(e[0],n.elevationBounds.min),e[1]=Math.max(e[1],n.elevationBounds.max),n.elevationBounds.hasNoDataValues||(s=!1));s&&(e[0]=Math.min(e[0],0),e[1]=Math.max(e[1],0)),this.updateRadiusAndCenter(),this._surface.setTileTreeDirty()}_updateCenter(){const e=this._elevationBounds,t=.5*(e[0]+e[1]);u(ae,this.up,t),c(this._center[pe.MIDDLE],this.centerAtSeaLevel,ae),u(ae,this.up,e[0]),c(this._center[pe.TOP],this.centerAtSeaLevel,ae),u(ae,this.up,e[1]),c(this._center[pe.BOTTOM],this.centerAtSeaLevel,ae)}findElevationBoundsForLayer(e,i){const n=this.layerInfo[b.ELEVATION][e];if(t(n.elevationBounds)&&n.elevationBounds.level>=i)return;const r=this._surface.layerViewByIndex(e,b.ELEVATION),a=P(r);if(!ie(this,a,!1))return;const o=ge;let l=!1;if(n.data){const e=n.data;o.min=e.bounds[0],o.max=e.bounds[1],o.hasNoDataValues=e.hasNoDataValues,o.level=this.level,l=!0}else{let t,i,s=0;for(let n=this._parent;n&&(!i||s<C(this.level))&&(s=this.vlevel-n.level,t=i||t,i=n.layerInfo[b.ELEVATION][e].data,!(!i&&t&&s>=C(this.level)));n=n.parent);i=i||t,i&&(i.computeMinMaxValue(this.lij[0],this.lij[1],this.lij[2],o),o.min!==1/0&&(o.level=i.level,l=!0))}l&&(s(n.elevationBounds)&&(n.elevationBounds=new M),n.elevationBounds.copyFrom(o))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==K&&(ue(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:Z.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,x.FADING))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===K&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of O){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==K&&(i.loadingAgent.setSuspension(t),i.loadingAgent===K&&this.updateRenderData(e,x.FADING))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==K&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=K,!i.data&&s(i.upsampleInfo)&&this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||R(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(V(e)&&"normal"!==e?.layer?.blendMode||R(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);for(let n=e;n<i.length;++n){const r=i[n];let a=!1;const o=this._surface.layerViewByIndex(n,t),l=P(o);if(r.loadingAgent?ie(this,l,!1)?(r.loadingAgent!==K&&r.loadingAgent.setSuspension(s),r.loadingAgent!==K&&(a=r.loadingAgent.update())):r.dispose():ie(this,l,!1)&&(r.loadingAgent=de(this,n,t,s),a=r.loadingAgent.startLoading(),a?r.loadingAgent===K&&this.setPendingUpdate(te.GEOMETRY):(ue(r.loadingAgent),r.loadingAgent=K)),r.loadingAgent===K&&this.updateRenderData(t,x.FADING),!this._hasBlendModes(e,i.length,t)&&a&&o.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationBasedVerticesPerSide(t){const i=this.vlevel-this.level,s=Math.max(this.level-t,C(this.level)-i);return e(1+(this.maxTesselation>>s),2,this.maxTesselation+1)}get test(){return{cachedMemory:this._cachedMemory}}_findLIJ(e,i){if(!e)return null;const s=this.surface.rootTiles;if(t(s))for(const t of s)if(me(t,e)){let s=t,n=e[0]-s.level-1;for(;n>=0&&!s.isLeaf&&!i(s);){const t=e[1]>>n&1,i=e[2]>>n&1;s=s.children[2*t+i],n--}return i(s)?s:null}return null}findNeighborTile(e,t){const i=this.lij,s=this.getNeighborLIJ(i,e);return s?_e(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=e===S.NORTH_EAST?1:e===S.NORTH_WEST?0:e===S.SOUTH_WEST?2:3;let s=this;for(;!(s.isLeaf||t&&t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,(e=>t(e)||e.level===this.level))?.findCorner(G(e),t)}forAllSubtreeOnSide(e,t){const i=e===S.NORTH?[0,1]:e===S.NORTH_EAST?[1]:e===S.EAST?[1,3]:e===S.SOUTH_EAST?[3]:e===S.SOUTH?[2,3]:e===S.SOUTH_WEST?[2]:e===S.WEST?[0,2]:[0],s=e=>{t(e)||e.isLeaf||i.forEach((t=>s(e.children[t])))};s(this)}forallNeighbors(e){w.forEach((t=>this.findNeighborCornerTileExact(t,e))),W.forEach((t=>this.findNeighborTile(t,(t=>t.level===this.level||e(t)))?.forAllSubtreeOnSide(q(t),e)))}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(H(!F||i>=0),0===i)return 0;const s=2**i,n=1==(1&e),r=n?0:1,a=t.lij[r+1]*s,o=this.lij[r+1],l=o-a,h=n?s-1-l:l;return F&&(H(a<=o&&o<a+s),H(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.isLoaded;W.forEach((t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(q(t),(i=>!!i.isLoaded&&(e(i,t),!0)))})),w.forEach((t=>{const s=this.findNeighborTile(t,i)?.findCorner(G(t),(e=>e.isLoaded));H(!s||Te(this,s,t)),s?.isLoaded&&e(s,t)}))}getNeighborLIJ(e,t){const i=k(t)?-1:X(t)?1:0,s=Y(t)?-1:z(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this.wrapLIJ(n):n[2]<0?null:n}wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this.lij[2]===this.surface.lijEastEnd(this.level)-1}get isWestEnd(){return 0===this.lij[2]}get isNorthEnd(){return 0===this.lij[1]}get isSouthEnd(){return this.extent[1]+m()>=this.surface.extent[1]}compareLIJs(e){const t=this.lij,i=t[0],s=e[0];if(i===s)return[t,e];const n=i-s;if(n<0){const i=2**-n;return[[s,t[1]*i,t[2]*i],e]}{const s=2**n;return[t,[i,e[1]*s,e[2]*s]]}}checkGeometryWaterproofness(){J&&(H(this.isLoaded),this.renderData.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,i=this.surface.rootTilesExtent,s=.25*(t[2]-t[0]);if(k(e)&&t[3]+s>=i[3])return!1;if(X(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&Y(e)&&t[0]-s<=i[0])&&!(!n&&z(e)&&t[2]+s>=i[2])}}function de(e,t,i,s){const n=i===b.ELEVATION?fe.acquire():ce.acquire();return n.init(e,t,i,s),n}function ue(e){e.dispose(),e instanceof I?fe.release(e):e instanceof N&&ce.release(e)}const ce=new n(N),fe=new n(I),ge=new M;var pe;function me(e,t){const i=e.level,s=t[0];if(i>s)return!1;const n=s-i,r=Math.floor(t[1]/2**n),a=Math.floor(t[2]/2**n);return r===e.lij[1]&&a===e.lij[2]}function _e(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ye(e,t,i){return Math.abs(e-t)<=i}function Ae(e,t,i){if(s(e)||s(t))return!1;if(0===e.level&&0===t.level){if(e.isEastEnd&&t.isWestEnd&&i===S.EAST)return!0;if(e.isWestEnd&&t.isEastEnd&&i===S.WEST)return!0}const n=Math.max(1e-6*(e.extent[2]-e.extent[0]),1);switch(i){case S.NORTH:return ye(e.extent[3],t.extent[1],n);case S.SOUTH:return ye(e.extent[1],t.extent[3],n);case S.EAST:return ye(e.extent[2],t.extent[0],n)||ye(e.extent[2],-t.extent[0],n);case S.WEST:return ye(e.extent[0],t.extent[2],n)||ye(e.extent[0],-t.extent[2],n)}}function Te(e,t,i){return!s(e)&&!s(t)&&t!==e&&(e.level>=t.level?Ee(e,t,i):Ee(t,e,G(i)))}function Ee(e,t,i){H(e.level>=t.level);const s=$(i),n=Q(i),r=e.extent,a=t.extent,o=[s?r[0]:r[2],n?r[3]:r[1]],l=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),d=ye(o[0],l[0],h)||e.surface.isGlobal&&ye(o[0],-l[0],h),u=ye(o[1],l[1],h);if(d&&u)return!0;if(e.level===t.level)return H(!1),!1;if(!d&&!u)return H(!1),!1;const c=d?ve(a[1],a[3],r[1],r[3],h):ve(a[0],a[2],r[0],r[2],h);return H(c),c}function ve(e,t,i,s,n=m()){return e-n<=i&&i<=s&&s<=t+n}!function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(pe||(pe={}));export{pe as CenterPosition,le as SplitLimits,he as Tile,ye as almostEquals,Te as isCornerNeighbor,Ae as isEdgeNeighbor};
@@ -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"../../core/Evented.js";import{HandleOwner as i}from"../../core/HandleOwner.js";import{clone as n}from"../../core/lang.js";import{isNone as r,isSome as o,destroyMaybe as s,unwrap as a,equalsMaybe as p}from"../../core/maybe.js";import{ignoreAbortErrors as c}from"../../core/promiseUtils.js";import{watch as h,syncAndInitial as d}from"../../core/reactiveUtils.js";import{createScreenPoint as l}from"../../core/screenUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{pointEquals as u}from"../../layers/graphics/dehydratedFeatureComparison.js";import{ViewingMode as y}from"../ViewingMode.js";import{defaultDrawingMode as v}from"./DrawingMode.js";import{DrawManipulator as _}from"./DrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f}from"../interactive/dragEventPipeline.js";import{EditGeometry as S,Component as V}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as w}from"../interactive/editGeometry/EditGeometryOperations.js";import O from"../interactive/sketch/SketchLabelOptions.js";import T from"../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as b}from"../interactive/snapping/SnappingContext.js";import{SnappingPipeline as M}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as D}from"../interactive/snapping/SnappingOperation.js";let P=class extends(t.EventedMixin(i)){constructor(e){super(e),this._createOperationCompleted=!1,this._pointerDownStates=new Set,this._snappingPipeline=new M,this.isDraped=!0,this.labelOptions=new O,this.tooltipOptions=new T,this.snapToSceneEnabled=null,this.lastVertex=null,r(e.elevationInfo)&&(this.elevationInfo={mode:e.hasZ?"absolute-height":"on-the-ground",offset:0})}initialize(){const{geometryType:e,view:t}=this,{spatialReference:i}=t,n="viewingMode"in t.state?t.state.viewingMode:y.Local,s="segment"===e||"multipoint"===e?"polyline":e;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new w(new S(s,this.coordinateHelper)),this._snappingOperation=new D({view:t}),this.handles.add(h((()=>this.stagedVertex),(e=>{r(e)||this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(e)}],operation:"apply",type:"vertex-update"})}),{sync:!0,equals:(e,t)=>p(e,t,u)})),this._activeComponent=new V(i,n),this._editGeometryOperations.data.components.push(this._activeComponent);const a=this.segmentLabels;o(a)&&(a.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.handles.add([h((()=>this.labelOptions.enabled),(e=>{a.visible=e}),d),this.on("cursor-update",(()=>{const e=this.stagedVertex;a.stagedVertex=o(e)?this.coordinateHelper.pointToVector(e):null}))])),this.handles.add(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],(e=>{const t=e.vertices.map((e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)}))),i=t.map((e=>e.coordinates));switch(e.type){case"vertex-add":this.emit(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this.emit(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this.emit(e.type,{...e,removed:i,vertices:t})}const n=this._activeComponent.getLastVertex(),s=o(n)?this.coordinateHelper.vectorToDehydratedPoint(n.pos):null;(r(s)||r(this.lastVertex)||!u(this.lastVertex,s))&&(this.lastVertex=s)}))),this._manipulator=new _({grabbableForEvent:e=>"click"!==this.drawingMode||"touch"===e.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size}),this.manipulators.add(this._manipulator),this._manipulator.grabbable="point"!==e,this.handles.add([this._createManipulatorDragPipeline(this._manipulator),this._manipulator.events.on("immediate-click",(e=>this._onImmediateClick(e))),this._manipulator.events.on("immediate-double-click",(e=>this._onImmediateDoubleClick(e)))])}destroy(){s(this.segmentLabels),s(this._snappingOperation),this._editGeometryOperations=s(this._editGeometryOperations)}get _snappingEnabled(){return o(this.snappingManager)&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const e=this._getEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map((e=>this.coordinateHelper.vectorToArray(e.pos)))}set drawingMode(e){this._set("drawingMode",e??v)}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return o(this.stagedVertex)?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get stagedVertex(){const{stagedPoint:e}=this._snappingOperation;if("2d"===this.view.type||r(e))return e;return this._getEffectiveDrawSurface().constrainZ(e)}set stagedVertex(e){this._snappingOperation.stagedPoint=n(e)}get updating(){return this.updatingHandles.updating}get vertices(){const e=this.committedVertices;return o(this.stagedVertex)&&e.push(this.coordinateHelper.pointToArray(this.stagedVertex)),e}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingOperation.abort(),o(this.stagedVertex)){const{stagedVertex:e}=this;this.stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e))}}complete(e){const t=e&&e.aborted||!1;this._snappingOperation.abort(),o(this.snappingManager)&&this.snappingManager.doneSnapping(),"segment"===this.geometryType||"point"===this.geometryType?this.commitStagedVertex():this.stagedVertex=null;const i="multipoint"===this.geometryType&&0===this.numVertices||"polyline"===this.geometryType&&this.numVertices<2||"polygon"===this.geometryType&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||t)&&this.emit("complete",{vertices:this.vertices.map(((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e}))),aborted:t,type:"complete"})}onInputEvent(e){switch(e.type){case"pointer-down":this._pointerDownStates.add(e.pointerId);break;case"pointer-up":this._pointerDownStates.delete(e.pointerId)}switch(e.type){case"pointer-move":return this._onPointerMove(e);case"hold":return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){o(this.snappingManager)&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(e){const t=this._activeComponent;if("polygon"===this.geometryType&&t.vertices.length>2){if(this._vertexWithinPointerDistance(t.vertices[0].pos,e))return 0;if(this._vertexWithinPointerDistance(t.vertices[t.vertices.length-1].pos,e))return t.vertices.length-1}return null}_createManipulatorDragPipeline(e){switch(a(this.drawingMode)){case"click":return this._createManipulatorDragPipelineClick(e);case"freehand":return this._createManipulatorDragPipelineFreehand(e);case"hybrid":return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return f(e,((e,t,i,n)=>{const r="touch"===n&&this._snappingEnabled;!this.isCompleted&&r&&(t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(this.stagedVertex=e.mapStart,("segment"===this.geometryType||r&&0===this.numVertices)&&this.commitStagedVertex()),e))).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>r,cancel:i,snappingManager:this.snappingManager,snappingContext:new b({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:n,visualizer:this.snappingVisualizer}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next((e=>(r&&(this.stagedVertex=e.mapEnd,"end"===e.action&&this.commitStagedVertex()),e))).next((e=>("end"===e.action&&("segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),e))),i.next((()=>{r&&o(this.snappingManager)&&this.snappingManager.doneSnapping()})))}))}_createManipulatorDragPipelineFreehand(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(r(this.stagedVertex)&&(this.stagedVertex=e.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return e}))}))}_createManipulatorDragPipelineHybrid(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(r(this.stagedVertex)&&(this.stagedVertex=e.mapStart),this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return e}))}))}_getEffectiveDrawSurface(){if(r(this.elevationDrawSurface))return this.drawSurface;if(!this.coordinateHelper.hasZ())return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let e=this.defaultZ,t=!1;o(this.elevationInfo)&&"absolute-height"===this.elevationInfo.mode&&(t=!0),o(this.snapToSceneEnabled)&&(t=this.snapToSceneEnabled),o(this.elevationInfo)&&"on-the-ground"===this.elevationInfo.mode&&(t=!1);const i=this._activeComponent.vertices.length;return("segment"===this.geometryType||"polygon"===this.geometryType)&&i>0&&(e=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),t=!1),t?this.drawSurface:(this.elevationDrawSurface.defaultZ=e,this.elevationDrawSurface)}_mapToScreen(e){return this._getEffectiveDrawSurface().mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===e.pointerType&&this._snappingEnabled&&(this.stagedVertex=e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if("mouse"===e.pointerType&&2===e.button||this._manipulator.dragging)return;const t=this._activeComponent,i=this._closeOnClickVertexIndex(e.screenPoint);if(o(i))return e.stopPropagation(),void this.complete();const n=this._screenToMap(e.screenPoint);if(o(n))switch(this.drawingMode){case"freehand":"point"===this.geometryType&&(o(this.stagedVertex)?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(n)),this.complete());break;case"click":case"hybrid":this._snappingOperation.abort(),o(this.stagedVertex)?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(n)),("point"===this.geometryType||"segment"===this.geometryType&&2===t.vertices.length||"segment"===this.geometryType&&"hybrid"===this.drawingMode&&1===t.vertices.length)&&this.complete()}e.stopPropagation()}_onImmediateDoubleClick(e){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),e.stopPropagation())}_onPointerMove(e){const t=l(e.x,e.y),i=this._snappingOperation;if(this._manipulator.dragging||this._pointerDownStates.has(e.pointerId)||this._manipulator.grabbing||!this._manipulator.interactive)return void i.abort();e.stopPropagation();const n=this._closeOnClickVertexIndex(t);if(o(n))return this._closeOnVertex(n),void i.abort();const s=this._screenToMap(t),a=this._requiresScenePoint?this.drawSurface.screenToMap(t):null;if(this._manipulator.cursor=o(s)?"crosshair":null,r(s))return void i.abort();const p=this.snappingManager;if(r(p))return this.stagedVertex=s,void i.abort();const h=new b({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e.pointerType,visualizer:this.snappingVisualizer});this.updatingHandles.addPromise(c(i.snap({point:s,scenePoint:a},p,h)))}_closeOnVertex(e){this.stagedVertex=null;const t={componentIndex:0,vertexIndex:e,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[e].pos)};this.emit("cursor-update",{updated:null,vertices:[t],operation:"apply",type:"vertex-update"})}_screenToMap(e){return this._getEffectiveDrawSurface().screenToMap(e)}_screenToMapDragEventStep(){let e=null,t=null;return i=>{if("start"===i.action&&(e=this._screenToMap(i.screenStart),t=this._requiresScenePoint?this.drawSurface.screenToMap(i.screenStart):null),r(e))return null;const n=this._screenToMap(i.screenEnd),s=this._requiresScenePoint?this.drawSurface.screenToMap(i.screenEnd):null,a=o(t)&&o(s)?{sceneStart:t,sceneEnd:s}:null;return o(n)?{...i,mapStart:e,mapEnd:n,scenePoints:a}:null}}_vertexWithinPointerDistance(e,t){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return!!o(n)&&C(n,t,i)}};function C(e,t,i){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=i}e([m()],P.prototype,"_snappingEnabled",null),e([m()],P.prototype,"defaultZ",void 0),e([m()],P.prototype,"isDraped",void 0),e([m({value:v})],P.prototype,"drawingMode",null),e([m({constructOnly:!0})],P.prototype,"elevationDrawSurface",void 0),e([m({constructOnly:!0})],P.prototype,"elevationInfo",void 0),e([m({constructOnly:!0,type:O})],P.prototype,"labelOptions",void 0),e([m({constructOnly:!0,type:T})],P.prototype,"tooltipOptions",void 0),e([m({constructOnly:!0})],P.prototype,"geometryType",void 0),e([m({constructOnly:!0})],P.prototype,"hasM",void 0),e([m({constructOnly:!0})],P.prototype,"hasZ",void 0),e([m({constructOnly:!0})],P.prototype,"manipulators",void 0),e([m({constructOnly:!0})],P.prototype,"drawSurface",void 0),e([m({constructOnly:!0})],P.prototype,"segmentLabels",void 0),e([m({constructOnly:!0})],P.prototype,"snappingManager",void 0),e([m({constructOnly:!0})],P.prototype,"snappingVisualizer",void 0),e([m()],P.prototype,"snapToSceneEnabled",void 0),e([m()],P.prototype,"_snappingOperation",void 0),e([m()],P.prototype,"stagedVertex",null),e([m()],P.prototype,"lastVertex",void 0),e([m()],P.prototype,"updating",null),e([m({constructOnly:!0})],P.prototype,"view",void 0),P=e([g("esri.views.draw.DrawOperation")],P);export{P as DrawOperation};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{HandleOwner as i}from"../../core/HandleOwner.js";import{clone as n}from"../../core/lang.js";import{isNone as r,isSome as o,destroyMaybe as s,unwrap as a,equalsMaybe as p}from"../../core/maybe.js";import{ignoreAbortErrors as c}from"../../core/promiseUtils.js";import{watch as h,syncAndInitial as d}from"../../core/reactiveUtils.js";import{createScreenPoint as l}from"../../core/screenUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{pointEquals as u}from"../../layers/graphics/dehydratedFeatureComparison.js";import{ViewingMode as y}from"../ViewingMode.js";import{defaultDrawingMode as v}from"./DrawingMode.js";import{DrawManipulator as _}from"./DrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f,sceneSnappingAtLocation as V}from"../interactive/dragEventPipeline.js";import{EditGeometry as S,Component as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as O}from"../interactive/editGeometry/EditGeometryOperations.js";import b from"../interactive/sketch/SketchLabelOptions.js";import T from"../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{SnappingPipeline as D}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as P}from"../interactive/snapping/SnappingOperation.js";let C=class extends(t.EventedMixin(i)){constructor(e){super(e),this._createOperationCompleted=!1,this._pointerDownStates=new Set,this._snappingPipeline=new D,this.isDraped=!0,this.labelOptions=new b,this.tooltipOptions=new T,this.snapToSceneEnabled=null,this.lastVertex=null,r(e.elevationInfo)&&(this.elevationInfo={mode:e.hasZ?"absolute-height":"on-the-ground",offset:0})}initialize(){const{geometryType:e,view:t}=this,{spatialReference:i}=t,n="viewingMode"in t.state?t.state.viewingMode:y.Local,s="segment"===e||"multipoint"===e?"polyline":e;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new O(new S(s,this.coordinateHelper)),this._snappingOperation=new P({view:t,constrainResult:e=>r(e)?e:this._getEffectiveDrawSurface().constrainZ(e)}),this.handles.add(h((()=>this.stagedVertex),(e=>{r(e)||this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(e)}],operation:"apply",type:"vertex-update"})}),{sync:!0,equals:(e,t)=>p(e,t,u)})),this._activeComponent=new w(i,n),this._editGeometryOperations.data.components.push(this._activeComponent);const a=this.segmentLabels;o(a)&&(a.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.handles.add([h((()=>this.labelOptions.enabled),(e=>{a.visible=e}),d),this.on("cursor-update",(()=>{const e=this.stagedVertex;a.stagedVertex=o(e)?this.coordinateHelper.pointToVector(e):null}))])),this.handles.add(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],(e=>{const t=e.vertices.map((e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)}))),i=t.map((e=>e.coordinates));switch(e.type){case"vertex-add":this.emit(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this.emit(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this.emit(e.type,{...e,removed:i,vertices:t})}const n=this._activeComponent.getLastVertex(),s=o(n)?this.coordinateHelper.vectorToDehydratedPoint(n.pos):null;(r(s)||r(this.lastVertex)||!u(this.lastVertex,s))&&(this.lastVertex=s)}))),this._manipulator=new _({grabbableForEvent:e=>"click"!==this.drawingMode||"touch"===e.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size}),this.manipulators.add(this._manipulator),this._manipulator.grabbable="point"!==e,this.handles.add([this._createManipulatorDragPipeline(this._manipulator),this._manipulator.events.on("immediate-click",(e=>this._onImmediateClick(e))),this._manipulator.events.on("immediate-double-click",(e=>this._onImmediateDoubleClick(e)))])}destroy(){s(this.segmentLabels),s(this._snappingOperation),this._editGeometryOperations=s(this._editGeometryOperations)}get _snappingEnabled(){return o(this.snappingManager)&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const e=this._getEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map((e=>this.coordinateHelper.vectorToArray(e.pos)))}set drawingMode(e){this._set("drawingMode",e??v)}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return o(this.stagedVertex)?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get stagedVertex(){return this._snappingOperation.stagedPoint}set stagedVertex(e){this._snappingOperation.stagedPoint=n(e)}get updating(){return this.updatingHandles.updating}get vertices(){const e=this.committedVertices;return o(this.stagedVertex)&&e.push(this.coordinateHelper.pointToArray(this.stagedVertex)),e}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingOperation.abort(),o(this.stagedVertex)){const{stagedVertex:e}=this;this.stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e))}}complete(e){const t=e&&e.aborted||!1;this._snappingOperation.abort(),o(this.snappingManager)&&this.snappingManager.doneSnapping(),"segment"===this.geometryType||"point"===this.geometryType?this.commitStagedVertex():this.stagedVertex=null;const i="multipoint"===this.geometryType&&0===this.numVertices||"polyline"===this.geometryType&&this.numVertices<2||"polygon"===this.geometryType&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||t)&&this.emit("complete",{vertices:this.vertices.map(((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e}))),aborted:t,type:"complete"})}onInputEvent(e){switch(e.type){case"pointer-down":this._pointerDownStates.add(e.pointerId);break;case"pointer-up":this._pointerDownStates.delete(e.pointerId)}switch(e.type){case"pointer-move":return this._onPointerMove(e);case"hold":return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){o(this.snappingManager)&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(e){const t=this._activeComponent;if("polygon"===this.geometryType&&t.vertices.length>2){if(this._vertexWithinPointerDistance(t.vertices[0].pos,e))return 0;if(this._vertexWithinPointerDistance(t.vertices[t.vertices.length-1].pos,e))return t.vertices.length-1}return null}_createManipulatorDragPipeline(e){switch(a(this.drawingMode)){case"click":return this._createManipulatorDragPipelineClick(e);case"freehand":return this._createManipulatorDragPipelineFreehand(e);case"hybrid":return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return f(e,((e,t,i,n)=>{const r="touch"===n&&this._snappingEnabled;!this.isCompleted&&r&&(t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(this.stagedVertex=e.mapStart,("segment"===this.geometryType||r&&0===this.numVertices)&&this.commitStagedVertex()),e))).next(V(this.view,this.elevationInfo)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>r,cancel:i,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:n,visualizer:this.snappingVisualizer}),updatingHandles:this.updatingHandles,useZ:!this._requiresScenePoint}),this._snappingPipeline.next).next((e=>(r&&(this.stagedVertex=e.mapEnd,"end"===e.action&&this.commitStagedVertex()),e))).next((e=>("end"===e.action&&("segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),e))),i.next((()=>{r&&o(this.snappingManager)&&this.snappingManager.doneSnapping()})))}))}_createManipulatorDragPipelineFreehand(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(r(this.stagedVertex)&&(this.stagedVertex=e.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return e}))}))}_createManipulatorDragPipelineHybrid(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(r(this.stagedVertex)&&(this.stagedVertex=e.mapStart),this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return e}))}))}_getEffectiveDrawSurface(){if(r(this.elevationDrawSurface))return this.drawSurface;if(!this.coordinateHelper.hasZ())return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let e=this.defaultZ,t=!1;o(this.elevationInfo)&&"absolute-height"===this.elevationInfo.mode&&(t=!0),o(this.snapToSceneEnabled)&&(t=this.snapToSceneEnabled),o(this.elevationInfo)&&"on-the-ground"===this.elevationInfo.mode&&(t=!1);const i=this._activeComponent.vertices.length;return("segment"===this.geometryType||"polygon"===this.geometryType)&&i>0&&(e=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),t=!1),t?this.drawSurface:(this.elevationDrawSurface.defaultZ=e,this.elevationDrawSurface)}_mapToScreen(e){return this._getEffectiveDrawSurface().mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===e.pointerType&&this._snappingEnabled&&(this.stagedVertex=e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if("mouse"===e.pointerType&&2===e.button||this._manipulator.dragging)return;const t=this._activeComponent,i=this._closeOnClickVertexIndex(e.screenPoint);if(o(i))return e.stopPropagation(),void this.complete();const n=this._screenToMap(e.screenPoint);if(o(n))switch(this.drawingMode){case"freehand":"point"===this.geometryType&&(o(this.stagedVertex)?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(n)),this.complete());break;case"click":case"hybrid":this._snappingOperation.abort(),o(this.stagedVertex)?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(n)),("point"===this.geometryType||"segment"===this.geometryType&&2===t.vertices.length||"segment"===this.geometryType&&"hybrid"===this.drawingMode&&1===t.vertices.length)&&this.complete()}e.stopPropagation()}_onImmediateDoubleClick(e){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),e.stopPropagation())}_onPointerMove(e){const t=l(e.x,e.y),i=this._snappingOperation;if(this._manipulator.dragging||this._pointerDownStates.has(e.pointerId)||this._manipulator.grabbing||!this._manipulator.interactive)return void i.abort();e.stopPropagation();const n=this._closeOnClickVertexIndex(t);if(o(n))return this._closeOnVertex(n),void i.abort();const s=this._screenToMap(t),a=this._requiresScenePoint?this.drawSurface.screenToMap(t):null;if(this._manipulator.cursor=o(s)?"crosshair":null,r(s))return void i.abort();const p=this.snappingManager;if(r(p))return this.stagedVertex=s,void i.abort();const h=new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e.pointerType,visualizer:this.snappingVisualizer});this.updatingHandles.addPromise(c(i.snap({point:s,scenePoint:a},p,h)))}_closeOnVertex(e){this.stagedVertex=null;const t={componentIndex:0,vertexIndex:e,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[e].pos)};this.emit("cursor-update",{updated:null,vertices:[t],operation:"apply",type:"vertex-update"})}_screenToMap(e){return this._getEffectiveDrawSurface().screenToMap(e)}_screenToMapDragEventStep(){let e=null;return t=>{if("start"===t.action&&(e=this._screenToMap(t.screenStart)),r(e))return null;const i=this._screenToMap(t.screenEnd);return o(i)?{...t,mapStart:e,mapEnd:i}:null}}_vertexWithinPointerDistance(e,t){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return!!o(n)&&I(n,t,i)}};function I(e,t,i){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=i}e([m()],C.prototype,"_snappingEnabled",null),e([m()],C.prototype,"defaultZ",void 0),e([m()],C.prototype,"isDraped",void 0),e([m({value:v})],C.prototype,"drawingMode",null),e([m({constructOnly:!0})],C.prototype,"elevationDrawSurface",void 0),e([m({constructOnly:!0})],C.prototype,"elevationInfo",void 0),e([m({constructOnly:!0,type:b})],C.prototype,"labelOptions",void 0),e([m({constructOnly:!0,type:T})],C.prototype,"tooltipOptions",void 0),e([m({constructOnly:!0})],C.prototype,"geometryType",void 0),e([m({constructOnly:!0})],C.prototype,"hasM",void 0),e([m({constructOnly:!0})],C.prototype,"hasZ",void 0),e([m({constructOnly:!0})],C.prototype,"manipulators",void 0),e([m({constructOnly:!0})],C.prototype,"drawSurface",void 0),e([m({constructOnly:!0})],C.prototype,"segmentLabels",void 0),e([m({constructOnly:!0})],C.prototype,"snappingManager",void 0),e([m({constructOnly:!0})],C.prototype,"snappingVisualizer",void 0),e([m()],C.prototype,"snapToSceneEnabled",void 0),e([m()],C.prototype,"_snappingOperation",void 0),e([m()],C.prototype,"stagedVertex",null),e([m()],C.prototype,"lastVertex",void 0),e([m()],C.prototype,"updating",null),e([m({constructOnly:!0})],C.prototype,"view",void 0),C=e([g("esri.views.draw.DrawOperation")],C);export{C as DrawOperation};
@@ -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{clone as e}from"../../core/lang.js";import{isSome as t}from"../../core/maybe.js";import{createScreenPointArray as i}from"../../core/screenUtils.js";import{makeDehydratedPoint as s}from"../../layers/graphics/dehydratedFeatures.js";import{getConvertedElevation as r,getZForElevationMode as n}from"../../support/elevationInfoUtils.js";class o{constructor(e,t,i,s=null){this._elevationInfo=e,this.defaultZ=t,this._view=i,this._excludeGraphics=s}screenToMap(e){if(t(this.defaultZ))return this._view.sceneIntersectionHelper.intersectElevationFromScreen(i(e.x,e.y),this._elevationInfo,this.defaultZ,this._excludeGraphics);const s=this._view.sceneIntersectionHelper.intersectElevationFromScreen(i(e.x,e.y),this._elevationInfo,0,this._excludeGraphics);return t(s)&&(s.z=void 0),s}mapToScreen(e){const t=s(e.x,e.y,r(this._view,e,this._elevationInfo),e.spatialReference);return this._view.toScreen(t)}constrainZ(i){const{defaultZ:s}=this;return t(s)&&((i=e(i)).z=s),i}}class c{constructor(e,t,i=[]){this.view=e,this.elevationInfo=t,this.exclude=i}screenToMap(e){const i=this.view.toMap(e,{exclude:this.exclude});return t(i)&&(i.z=n(i,this.view,this.elevationInfo)),i}mapToScreen(e){let i=e;return t(this.elevationInfo)&&(i=s(e.x,e.y,r(this.view,e,this.elevationInfo),e.spatialReference)),this.view.toScreen(i)}constrainZ(e){return e}}class a{constructor(e,t=!1,i=0){this.view=e,this.hasZ=t,this.defaultZ=i,this.mapToScreen=t=>e.toScreen(t),this.screenToMap=t?t=>{const s=e.toMap(t);return s.z=i,s}:t=>e.toMap(t)}constrainZ(e){return e.z=this.defaultZ,e}}export{o as ElevationDrawSurface,a as MapDrawSurface,c as SceneDrawSurface};
5
+ import{isSome as e}from"../../core/maybe.js";import{createScreenPointArray as t}from"../../core/screenUtils.js";import{makeDehydratedPoint as s}from"../../layers/graphics/dehydratedFeatures.js";import{clonePoint as i}from"../../layers/graphics/hydratedFeatures.js";import{getConvertedElevation as r,getZForElevationMode as n}from"../../support/elevationInfoUtils.js";class o{constructor(e,t,s,i=null){this._elevationInfo=e,this.defaultZ=t,this._view=s,this._excludeGraphics=i}screenToMap(s){if(e(this.defaultZ))return this._view.sceneIntersectionHelper.intersectElevationFromScreen(t(s.x,s.y),this._elevationInfo,this.defaultZ,this._excludeGraphics);const i=this._view.sceneIntersectionHelper.intersectElevationFromScreen(t(s.x,s.y),this._elevationInfo,0,this._excludeGraphics);return e(i)&&(i.z=void 0),i}mapToScreen(e){const t=s(e.x,e.y,r(this._view,e,this._elevationInfo),e.spatialReference);return this._view.toScreen(t)}constrainZ(t){const{defaultZ:s}=this;return e(s)&&t.z!==s&&((t=i(t)).z=s),t}}class c{constructor(e,t,s=[]){this.view=e,this.elevationInfo=t,this.exclude=s}screenToMap(t){const s=this.view.toMap(t,{exclude:this.exclude});return e(s)&&(s.z=n(s,this.view,this.elevationInfo)),s}mapToScreen(t){let i=t;return e(this.elevationInfo)&&(i=s(t.x,t.y,r(this.view,t,this.elevationInfo),t.spatialReference)),this.view.toScreen(i)}constrainZ(e){return e}}class a{constructor(e,t=!1,s=0){this.view=e,this.hasZ=t,this.defaultZ=s,this.mapToScreen=t=>e.toScreen(t),this.screenToMap=t?t=>{const i=e.toMap(t);return i.z=s,i}:t=>e.toMap(t)}constrainZ(e){const{defaultZ:t}=this;return this.hasZ&&e.z!==t&&((e=i(e)).z=t),e}}export{o as ElevationDrawSurface,a as MapDrawSurface,c as SceneDrawSurface};
@@ -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"../../geometry.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{isSome as r,isNone as o,unwrap as a}from"../../core/maybe.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{f as c}from"../../chunks/vec3f64.js";import{project as i}from"../../geometry/projection.js";import{hydratedSpatialReference as l}from"../../layers/graphics/hydratedFeatures.js";import{ViewingMode as u}from"../ViewingMode.js";import{move as m}from"../draw/support/drawUtils.js";import f from"../../geometry/Point.js";function p(t,n){let e=null,a=null;return s=>{if("cancel"===s.action)return void(r(a)&&(a.execute({action:"cancel"}),e=null,a=null));const c={action:s.action,screenStart:s.start,screenEnd:s.screenPoint};"start"===s.action&&o(e)&&(e=new P,a=new P,n(t,e,a,s.pointerType,c)),r(e)&&e.execute(c),"end"===s.action&&r(e)&&(e=null,a=null)}}function y(t,n){return t.events.on("drag",p(t,n))}function d(n,e){const r=[];for(const t of n)r.push(y(t,e));return t(r)}function x(t,n){const e=[t.x,t.y,t.z],r=n,o=[Math.cos(r),Math.sin(r)],a=Math.sqrt(o[0]*o[0]+o[1]*o[1]);if(0===a)return null;o[0]/=a,o[1]/=a;const s=t=>{const n=(t.x-e[0])*o[0]+(t.y-e[1])*o[1];t.x=e[0]+n*o[0],t.y=e[1]+n*o[1]};return t=>(s(t.mapStart),s(t.mapEnd),{...t,axis:o})}function g(t,n){let e=null;return r=>{if("start"===r.action&&(e=E(t,r.mapStart.spatialReference,n)),o(e))return null;const a=r.mapEnd.x-r.mapStart.x,s=r.mapEnd.y-r.mapStart.y,c=r.mapEnd.z-r.mapStart.z;return e.move(a,s,c),{...r,translationX:a,translationY:s,translationZ:c}}}function h(t,n){return o(t)?null:t.spatialReference.equals(n)?t.clone():i(t,n)}function E(t,n,e){const r=t.geometry,a=l(n);if(o(r))return null;if("mesh"===r.type)return S(t,r,a,e);const s=h(r,a),c=r.spatialReference;return o(s)?null:{move:(n,e,r)=>{const o=m(s.clone(),n,e,r);o.spatialReference.equals(c)?t.geometry=o:t.geometry=i(o,c)}}}function S(t,n,e,o){if(r(n.transform))return j(t,n,n.transform,e);if(!n.spatialReference.equals(e))return null;let a=0,s=0,c=0;return{move:(e,r,i)=>{const l=e-a,m=r-s,p=i-c;if(l||m||p){const y=new f(n.origin.x+l,n.origin.y+m,n.origin.z+p,n.origin.spatialReference);n.centerAt(y,{geographic:o===u.Global}),t.notifyGeometryChanged(),a=e,s=r,c=i}}}}function j(t,n,e,a){const s=h(e.getOriginPoint(n.spatialReference),a),l=n.spatialReference;return o(s)?null:{move:(n,o,a)=>{const u=m(s.clone(),n,o,a);if(u.spatialReference.equals(l))e.origin=c(u.x,u.y,u.z);else{const t=i(u,l);r(t)&&(e.origin=c(t.x,t.y,t.z))}t.notifyMeshTransformChanged(),t.notifyGeometryChanged()}}}function R(t,n=null,e){let a=null;const s=r(n)&&!t.spatialReference.equals(n)?t=>r(t)?i(t,n):t:t=>t,c={exclude:[],...e};return n=>{if("start"===n.action&&(a=s(t.toMap(n.screenStart,c))),o(a))return null;const e=s(t.toMap(n.screenEnd,c));return r(e)?{...n,mapStart:a,mapEnd:e}:null}}function z(t,n){const e=t.map((t=>a(g(t,n)))).filter((t=>r(t)));return t=>{const n=t.mapEnd.x-t.mapStart.x,r=t.mapEnd.y-t.mapStart.y,o=t.mapEnd.z-t.mapStart.z;return e.forEach((n=>n(t))),{...t,translationX:n,translationY:r,translationZ:o}}}function w(t,e){const r=new Map;for(const o of e)r.set(o,n(t[o]));return n=>(r.forEach(((n,e)=>{t[e]=n})),n)}function v(t){return r(t.geometry)&&"mesh"===t.geometry.type?M(t,t.geometry):w(t,["geometry"])}function M(t,n){const e=r(n.transform)?n.transform.clone():null,o=n.vertexAttributes.clonePositional();return r=>(n.transform=e,n.vertexAttributes=o,t.notifyGeometryChanged(),r)}function q(t){const n=t.map((t=>a(v(t)))).filter((t=>r(t)));return t=>(n.forEach((n=>n(t))),t)}function D(t){return w(t,["symbol"])}function b(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z);const o=r.mapEnd.x-t,a=r.mapEnd.y-n,s=r.mapEnd.z-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:o,mapDeltaY:a,mapDeltaZ:s,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function C(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,o=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:o}}}function G(t,n){let r=null,o=0,a=0;return c=>{if("start"===c.action&&(r=t.toScreen(n),r.x<0||r.x>t.width||r.y<0||r.y>t.height?r=null:(o=c.screenStart.x-r.x,a=c.screenStart.y-r.y)),null==r)return null;const i=e(c.screenEnd.x-o,0,t.width),l=e(c.screenEnd.y-a,0,t.height),u=s(i,l);return c.screenStart=r,c.screenEnd=u,c}}class P{constructor(){this.execute=()=>{}}next(t,n=new P){return r(t)&&(this.execute=e=>{const o=t(e);r(o)&&n.execute(o)}),n}}export{P as EventPipeline,b as addMapDelta,C as addScreenDelta,x as constrainToMapAxis,p as createDragEventPipelineCallback,y as createManipulatorDragEventPipeline,d as createManipulatorDragEventPipelineMany,G as dragAtLocation,g as dragGraphic,z as dragGraphicMany,v as resetGraphic,q as resetGraphicMany,w as resetProperties,D as resetSymbol,R as screenToMap};
5
+ import"../../geometry.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{isSome as r,isNone as o,unwrap as a}from"../../core/maybe.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{f as c}from"../../chunks/vec3f64.js";import{project as i}from"../../geometry/projection.js";import{hydratedSpatialReference as l}from"../../layers/graphics/hydratedFeatures.js";import{getZForElevationMode as u}from"../../support/elevationInfoUtils.js";import{ViewingMode as m}from"../ViewingMode.js";import{move as f}from"../draw/support/drawUtils.js";import p from"../../geometry/Point.js";function y(t,n){let e=null,a=null;return s=>{if("cancel"===s.action)return void(r(a)&&(a.execute({action:"cancel"}),e=null,a=null));const c={action:s.action,screenStart:s.start,screenEnd:s.screenPoint};"start"===s.action&&o(e)&&(e=new G,a=new G,n(t,e,a,s.pointerType,c)),r(e)&&e.execute(c),"end"===s.action&&r(e)&&(e=null,a=null)}}function d(t,n){return t.events.on("drag",y(t,n))}function x(n,e){const r=[];for(const t of n)r.push(d(t,e));return t(r)}function g(t,n){const e=[t.x,t.y,t.z],r=n,o=[Math.cos(r),Math.sin(r)],a=Math.sqrt(o[0]*o[0]+o[1]*o[1]);if(0===a)return null;o[0]/=a,o[1]/=a;const s=t=>{const n=(t.x-e[0])*o[0]+(t.y-e[1])*o[1];t.x=e[0]+n*o[0],t.y=e[1]+n*o[1]};return t=>(s(t.mapStart),s(t.mapEnd),{...t,axis:o})}function h(t,n){let e=null;return r=>{if("start"===r.action&&(e=S(t,r.mapStart.spatialReference,n)),o(e))return null;const a=r.mapEnd.x-r.mapStart.x,s=r.mapEnd.y-r.mapStart.y,c=r.mapEnd.z-r.mapStart.z;return e.move(a,s,c),{...r,translationX:a,translationY:s,translationZ:c}}}function E(t,n){return o(t)?null:t.spatialReference.equals(n)?t.clone():i(t,n)}function S(t,n,e){const r=t.geometry,a=l(n);if(o(r))return null;if("mesh"===r.type)return j(t,r,a,e);const s=E(r,a),c=r.spatialReference;return o(s)?null:{move:(n,e,r)=>{const o=f(s.clone(),n,e,r);o.spatialReference.equals(c)?t.geometry=o:t.geometry=i(o,c)}}}function j(t,n,e,o){if(r(n.transform))return z(t,n,n.transform,e);if(!n.spatialReference.equals(e))return null;let a=0,s=0,c=0;return{move:(e,r,i)=>{const l=e-a,u=r-s,f=i-c;if(l||u||f){const y=new p(n.origin.x+l,n.origin.y+u,n.origin.z+f,n.origin.spatialReference);n.centerAt(y,{geographic:o===m.Global}),t.notifyGeometryChanged(),a=e,s=r,c=i}}}}function z(t,n,e,a){const s=E(e.getOriginPoint(n.spatialReference),a),l=n.spatialReference;return o(s)?null:{move:(n,o,a)=>{const u=f(s.clone(),n,o,a);if(u.spatialReference.equals(l))e.origin=c(u.x,u.y,u.z);else{const t=i(u,l);r(t)&&(e.origin=c(t.x,t.y,t.z))}t.notifyMeshTransformChanged(),t.notifyGeometryChanged()}}}function R(t,n=null,e){let a=null;const s=r(n)&&!t.spatialReference.equals(n)?t=>r(t)?i(t,n):t:t=>t,c={exclude:[],...e};return n=>{if("start"===n.action&&(a=s(t.toMap(n.screenStart,c))),o(a))return null;const e=s(t.toMap(n.screenEnd,c));return r(e)?{...n,mapStart:a,mapEnd:e}:null}}function v(t,n){const e=t.map((t=>a(h(t,n)))).filter((t=>r(t)));return t=>{const n=t.mapEnd.x-t.mapStart.x,r=t.mapEnd.y-t.mapStart.y,o=t.mapEnd.z-t.mapStart.z;return e.forEach((n=>n(t))),{...t,translationX:n,translationY:r,translationZ:o}}}function w(t,e){const r=new Map;for(const o of e)r.set(o,n(t[o]));return n=>(r.forEach(((n,e)=>{t[e]=n})),n)}function M(t){return r(t.geometry)&&"mesh"===t.geometry.type?q(t,t.geometry):w(t,["geometry"])}function q(t,n){const e=r(n.transform)?n.transform.clone():null,o=n.vertexAttributes.clonePositional();return r=>(n.transform=e,n.vertexAttributes=o,t.notifyGeometryChanged(),r)}function D(t){const n=t.map((t=>a(M(t)))).filter((t=>r(t)));return t=>(n.forEach((n=>n(t))),t)}function b(t){return w(t,["symbol"])}function P(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z);const o=r.mapEnd.x-t,a=r.mapEnd.y-n,s=r.mapEnd.z-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:o,mapDeltaY:a,mapDeltaZ:s,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function U(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,o=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:o}}}function C(t,n){let r=null,o=0,a=0;return c=>{if("start"===c.action&&(r=t.toScreen(n),r.x<0||r.x>t.width||r.y<0||r.y>t.height?r=null:(o=c.screenStart.x-r.x,a=c.screenStart.y-r.y)),null==r)return null;const i=e(c.screenEnd.x-o,0,t.width),l=e(c.screenEnd.y-a,0,t.height),u=s(i,l);return c.screenStart=r,c.screenEnd=u,c}}class G{constructor(){this.execute=()=>{}}next(t,n=new G){return r(t)&&(this.execute=e=>{const o=t(e);r(o)&&n.execute(o)}),n}}function X(t,n){if("2d"===t.type)return t=>t;let e=null;return o=>{"start"===o.action&&(e=t.toMap(o.screenStart,{exclude:[]}),r(e)&&(e.z=u(e,t,n)));const a=t.toMap(o.screenEnd,{exclude:[]});r(a)&&(a.z=u(a,t,n));const s=r(e)&&r(a)?{sceneStart:e,sceneEnd:a}:null;return{...o,scenePoints:s}}}export{G as EventPipeline,P as addMapDelta,U as addScreenDelta,g as constrainToMapAxis,y as createDragEventPipelineCallback,d as createManipulatorDragEventPipeline,x as createManipulatorDragEventPipelineMany,C as dragAtLocation,h as dragGraphic,v as dragGraphicMany,M as resetGraphic,D as resetGraphicMany,w as resetProperties,b as resetSymbol,X as sceneSnappingAtLocation,R as screenToMap};
@@ -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{isNone as e,isSome as n,abortMaybe as t}from"../../../core/maybe.js";import{ignoreAbortErrors as o,debounce as r}from"../../../core/promiseUtils.js";import{pointEquals as i}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{EventPipeline as a}from"../dragEventPipeline.js";import{SnappingContext as s}from"./SnappingContext.js";import{TaskPriority as c,ImmediateTask as l}from"../../support/Scheduler.js";class p{constructor(){this.next=new a}createSnapDragEventPipelineStep({predicate:p=(()=>!0),cancel:d,snappingManager:x,snappingContext:u,updatingHandles:m,useZ:y=!0}){if(e(x))return e=>e;let f=null,P=null;const g=()=>{f=t(f),x.doneSnapping(),n(P)&&P.frameTask.remove(),P=null};d.next((e=>(g(),e))),this.next=new a;const z=r((async({frameTask:e,point:t,scenePoint:o,context:r,event:a,dx:s,dy:c,dz:l},p)=>{const d=await e.schedule((()=>x.snap({point:t,scenePoint:o,context:r,signal:p})),p);if(d.valid){let o=await e.schedule((()=>d.apply()),p);t!==v&&n(v)&&(o=x.update({point:v,scenePoint:h,context:r})),i(o,S)||(a.mapEnd.x=o.x+s,a.mapEnd.y=o.y+c,y&&(a.mapEnd.z=o.z+l),this.next.execute(a))}}));let v=null,h=null,S=null;return e=>{if(!p(e))return e;if("start"===e.action){const t="3d"===x.view.type?x.view.resourceController.scheduler.registerTask(c.SNAPPING):l;P={context:new s({editGeometryOperations:u.editGeometryOperations,elevationInfo:u.elevationInfo,pointer:u.pointer,vertexHandle:n(e.info)?e.info.handle:null,excludeFeature:u.excludeFeature,visualizer:u.visualizer}),originalPos:n(e.snapOrigin)?u.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:n(e.scenePoints)?e.scenePoints.sceneStart:null,frameTask:t}}if(n(P)){const{context:t,originalScenePos:r,originalPos:i}=P,{mapEnd:a,mapStart:s,action:c,scenePoints:l}=e,{coordinateHelper:p}=t,d=p.vectorToDehydratedPoint(p.arrayToVector([i.x,i.y,i.z]));d.x+=a.x-s.x,d.y+=a.y-s.y,d.z+=a.z-s.z;const u=s.x-i.x,g=s.y-i.y,T=s.z-i.z,w={...e,action:"update"},E=P.context;let j=null;if(n(r)&&n(l)){j=p.vectorToDehydratedPoint(p.arrayToVector([r.x,r.y,r.z]));const{sceneStart:e,sceneEnd:n}=l;j.x+=n.x-e.x,j.y+=n.y-e.y,j.z+=n.z-e.z}const k=x.update({point:d,scenePoint:j,context:t});if(S=k,a.x=k.x+u,a.y=k.y+g,y&&(a.z=k.z+T),v=d,h=j,"end"!==c){const e=P.frameTask;n(f)||(f=new AbortController),m.addPromise(o(z({frameTask:e,event:w,context:E,point:d,scenePoint:j,dx:u,dy:g,dz:T},f.signal)))}}return"end"===e.action&&g(),e}}}export{p as SnappingPipeline};
5
+ import{isNone as e,isSome as t,abortMaybe as n}from"../../../core/maybe.js";import{ignoreAbortErrors as a,debounce as o}from"../../../core/promiseUtils.js";import{pointEquals as i}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{clonePoint as s}from"../../../layers/graphics/hydratedFeatures.js";import{EventPipeline as r}from"../dragEventPipeline.js";import{SnappingContext as p}from"./SnappingContext.js";import{TaskPriority as c,ImmediateTask as l}from"../../support/Scheduler.js";class u{constructor(){this.next=new r}createSnapDragEventPipelineStep({predicate:o=(()=>!0),cancel:i,snappingManager:s,snappingContext:p,updatingHandles:c,useZ:l=!0}){if(e(s))return e=>e;let u=null,d=null;const m=()=>{u=n(u),s.doneSnapping(),t(d)&&d.frameTask.remove(),d=null};i.next((e=>(m(),e))),this.next=new r;const h=this._createSnapFunction(s,l);let P=null,f=null,x=null;return n=>{if(!o(n))return n;if("start"===n.action){const e=this._createFrameTask(s.view);d=this._createSnappingInfo(p,n,e)}if(t(d)){const{context:t,originalScenePos:o,originalPos:i}=d,{mapEnd:r,mapStart:p,action:m,scenePoints:S}=n,g=this._updatePosition(i,this._computeMapDelta(r,p)),y=this._computeMapDelta(p,i),_={...n,action:"update"},v=d.context,T=this._updateScenePosition(o,S),k=s.update({point:g,scenePoint:T,context:t});if(x=k,this._applySnappedUpdate(r,k,y,l),P=g,f=T,"end"!==m){const{frameTask:t}=d;e(u)&&(u=new AbortController),c.addPromise(a(h({frameTask:t,event:_,context:v,point:g,scenePoint:T,delta:y,lastPos:P,lastScenePos:f,lastUpdate:x},u.signal)))}}return"end"===n.action&&m(),n}}_createSnapFunction(e,n){return o((async({frameTask:a,point:o,scenePoint:s,context:r,event:p,delta:c,lastPos:l,lastScenePos:u,lastUpdate:d},m)=>{const h=await a.schedule((()=>e.snap({point:o,scenePoint:s,context:r,signal:m})),m);if(h.valid){let s=await a.schedule((()=>h.apply()),m);o!==l&&t(l)&&(s=e.update({point:l,scenePoint:u,context:r})),i(s,d)||(this._applySnappedUpdate(p.mapEnd,s,c,n),this.next.execute(p))}}))}_createFrameTask(e){return"3d"===e.type?e.resourceController.scheduler.registerTask(c.SNAPPING):l}_createSnappingInfo(e,n,a){return{context:new p({editGeometryOperations:e.editGeometryOperations,elevationInfo:e.elevationInfo,pointer:e.pointer,vertexHandle:t(n.info)?n.info.handle:null,excludeFeature:e.excludeFeature,visualizer:e.visualizer}),originalPos:t(n.snapOrigin)?e.coordinateHelper.vectorToDehydratedPoint(n.snapOrigin):n.mapStart,originalScenePos:t(n.scenePoints)?n.scenePoints.sceneStart:null,frameTask:a}}_updatePosition(e,[t,n,a]){const o=s(e);return o.x+=t,o.y+=n,o.hasZ&&(o.z+=a),o}_updateScenePosition(t,n){return e(t)||e(n)?null:this._updatePosition(t,this._computeMapDelta(n.sceneEnd,n.sceneStart))}_computeMapDelta(e,t){const n=e.hasZ&&t.hasZ?e.z-t.z:0;return[e.x-t.x,e.y-t.y,n]}_applySnappedUpdate(e,t,[n,a,o],i){e.x=t.x+n,e.y=t.y+a,i&&e.hasZ&&t.hasZ&&(e.z=t.z+o)}}export{u as SnappingPipeline};
@@ -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 t}from"../../../chunks/tslib.es6.js";import o from"../../../core/Accessor.js";import{isSome as s,abortMaybe as r,removeMaybe as e,isNone as i}from"../../../core/maybe.js";import{debounce as n}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{TaskPriority as c,ImmediateTask as l}from"../../support/Scheduler.js";let h=class extends o{constructor(t){super(t),this.stagedPoint=null,this._snapPoints=null,this._abortController=null,this._snap=n((async(t,o,r,e)=>{const{point:i,scenePoint:n}=t,a=await this._frameTask.schedule((()=>o.snap({point:i,scenePoint:n,context:r,signal:e})),e);a.valid&&await this._frameTask.schedule((()=>{if(this.stagedPoint=a.apply(),t!==this._snapPoints&&s(this._snapPoints)){const{point:s,scenePoint:e}=t;this.stagedPoint=o.update({point:s,scenePoint:e,context:r})}}),e)}))}initialize(){const t="3d"===this.view.type?this.view?.resourceController?.scheduler:null;this._frameTask=s(t)?t.registerTask(c.SNAPPING):l}destroy(){this._abortController=r(this._abortController),this._frameTask=e(this._frameTask)}async snap(t,o,s){const{point:r,scenePoint:e}=t;return this.stagedPoint=o.update({point:r,scenePoint:e,context:s}),this._snapPoints=t,i(this._abortController)&&(this._abortController=new AbortController),this._snap(t,o,s,this._abortController.signal)}abort(){this._abortController=r(this._abortController)}};t([a({constructOnly:!0})],h.prototype,"view",void 0),t([a()],h.prototype,"stagedPoint",void 0),h=t([p("esri.views.interactive.snapping.SnappingOperation")],h);export{h as SnappingOperation};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import s from"../../../core/Accessor.js";import{isSome as o,abortMaybe as e,removeMaybe as r,isNone as i}from"../../../core/maybe.js";import{debounce as n}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{TaskPriority as l,ImmediateTask as c}from"../../support/Scheduler.js";let h=class extends s{constructor(t){super(t),this.constrainResult=t=>t,this._snapPoints=null,this._abortController=null,this._stagedPoint=null,this._snap=n((async(t,s,e,r)=>{const{point:i,scenePoint:n}=t,a=await this._frameTask.schedule((()=>s.snap({point:i,scenePoint:n,context:e,signal:r})),r);a.valid&&await this._frameTask.schedule((()=>{if(this.stagedPoint=a.apply(),t!==this._snapPoints&&o(this._snapPoints)){const{point:o,scenePoint:r}=t;this.stagedPoint=s.update({point:o,scenePoint:r,context:e})}}),r)}))}get stagedPoint(){return this._stagedPoint}set stagedPoint(t){this._stagedPoint=this.constrainResult(t)}initialize(){const t="3d"===this.view.type?this.view?.resourceController?.scheduler:null;this._frameTask=o(t)?t.registerTask(l.SNAPPING):c}destroy(){this._abortController=e(this._abortController),this._frameTask=r(this._frameTask)}async snap(t,s,o){const{point:e,scenePoint:r}=t;return this.stagedPoint=s.update({point:e,scenePoint:r,context:o}),this._snapPoints=t,i(this._abortController)&&(this._abortController=new AbortController),this._snap(t,s,o,this._abortController.signal)}abort(){this._abortController=e(this._abortController)}};t([a({constructOnly:!0})],h.prototype,"view",void 0),t([a()],h.prototype,"stagedPoint",null),t([a()],h.prototype,"constrainResult",void 0),t([a()],h.prototype,"_stagedPoint",void 0),h=t([p("esri.views.interactive.snapping.SnappingOperation")],h);export{h as SnappingOperation};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[802],{36030:(e,t,r)=>{r.d(t,{J:()=>s});var n=r(35454),i=r(5600);function s(e,t={}){const r=e instanceof n.X?e:new n.X(e,t),s={type:t?.ignoreUnknown??1?r.apiValues:String,json:{type:r.jsonValues,read:!t?.readOnly&&{reader:r.read},write:{writer:r.write}}};return void 0!==t?.readOnly&&(s.readOnly=!!t.readOnly),void 0!==t?.default&&(s.json.default=t.default),void 0!==t?.name&&(s.json.name=t.name),(0,i.Cb)(s)}},43090:(e,t,r)=>{function n(e){return 32+e.length}function i(e){if(!e)return 0;let t=l;for(const r in e)if(e.hasOwnProperty(r)){const i=e[r];switch(typeof i){case"string":t+=n(i);break;case"number":t+=16;break;case"boolean":t+=4}}return t}function s(e){if(!e)return 0;if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return 32+8*t;let r=u;for(let n=0;n<t;n++)r+=o(e[n]);return r}(e);let t=l;for(const r in e)e.hasOwnProperty(r)&&(t+=o(e[r]));return t}function o(e){switch(typeof e){case"object":return s(e);case"string":return n(e);case"number":return 16;case"boolean":return 4;default:return 8}}function a(e,t){return u+e.length*t}r.d(t,{Ul:()=>s,Y8:()=>c,do:()=>a,f2:()=>i});const l=32,u=32;var c;!function(e){e[e.KILOBYTES=1024]="KILOBYTES",e[e.MEGABYTES=1048576]="MEGABYTES",e[e.GIGABYTES=1073741824]="GIGABYTES"}(c||(c={}))},74085:(e,t,r)=>{function n(e){}r.d(t,{Bg:()=>n}),r(80442)},45091:(e,t,r)=>{r.d(t,{Z:()=>c});var n,i,s=r(80442),o=r(71143);(i=n||(n={}))[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,s.Z)("safari")||(0,s.Z)("ios")?6:(0,s.Z)("ff")?12:32;class c{constructor(e,t,r=0,i=(e?e.byteLength:0)){this._tag=0,this._dataType=n.unknown,this._init(e,t,r,i)}_init(e,t,r,n){this._data=e,this._dataView=t,this._pos=r,this._end=n}asUnsafe(){return this}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,n){const i=this.getMessage(),s=e(i,t,r,n);return i.release(),s}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 n.varint:this._decodeVarint();break;case n.fixed64:this._skip(8);break;case n.delimited:this._skip(this._getLength());break;case n.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,n=0;if(this._end-t>=10)do{if(n=e[t++],r|=127&n,0==(128&n))break;if(n=e[t++],r|=(127&n)<<7,0==(128&n))break;if(n=e[t++],r|=(127&n)<<14,0==(128&n))break;if(n=e[t++],r|=(127&n)<<21,0==(128&n))break;if(n=e[t++],r+=268435456*(127&n),0==(128&n))break;if(n=e[t++],r+=34359738368*(127&n),0==(128&n))break;if(n=e[t++],r+=4398046511104*(127&n),0==(128&n))break;if(n=e[t++],r+=562949953421312*(127&n),0==(128&n))break;if(n=e[t++],r+=72057594037927940*(127&n),0==(128&n))break;if(n=e[t++],r+=0x8000000000000000*(127&n),0==(128&n))break;throw new Error("Varint too long!")}while(0);else{let i=1;for(;t!==this._end&&(n=e[t],0!=(128&n));)++t,r+=(127&n)*i,i*=128;if(t===this._end)throw new Error("Varint overrun!");++t,r+=n*i}return this._pos=t,r}_decodeSVarint(){const e=this._data;let t=this._pos,r=0,n=0;const i=1&e[t];if(this._end-t>=10)do{if(n=e[t++],r|=127&n,0==(128&n))break;if(n=e[t++],r|=(127&n)<<7,0==(128&n))break;if(n=e[t++],r|=(127&n)<<14,0==(128&n))break;if(n=e[t++],r|=(127&n)<<21,0==(128&n))break;if(n=e[t++],r+=268435456*(127&n),0==(128&n))break;if(n=e[t++],r+=34359738368*(127&n),0==(128&n))break;if(n=e[t++],r+=4398046511104*(127&n),0==(128&n))break;if(n=e[t++],r+=562949953421312*(127&n),0==(128&n))break;if(n=e[t++],r+=72057594037927940*(127&n),0==(128&n))break;if(n=e[t++],r+=0x8000000000000000*(127&n),0==(128&n))break;throw new Error("Varint too long!")}while(0);else{let i=1;for(;t!==this._end&&(n=e[t],0!=(128&n));)++t,r+=(127&n)*i,i*=128;if(t===this._end)throw new Error("Varint overrun!");++t,r+=n*i}return this._pos=t,i?-(r+1)/2:r/2}_getLength(){if(this._dataType!==n.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 n=e.subarray(t,r);return l.decode(n)}let n="",i="";for(let s=t;s<r;++s){const t=e[s];128&t?i+="%"+t.toString(16):(n+=decodeURIComponent(i)+String.fromCharCode(t),i="")}return i.length&&(n+=decodeURIComponent(i)),n}_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}))},60437:(e,t,r)=>{r.d(t,{Gv:()=>_,HH:()=>a,JR:()=>y,TC:()=>l,Tn:()=>h,Ue:()=>s,al:()=>o,cS:()=>f,dp:()=>c,fS:()=>m,op:()=>d,pp:()=>u,t8:()=>p});var n=r(70586),i=r(6570);function s(e=b){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function o(e,t,r,n,i,o,a=s()){return a[0]=e,a[1]=t,a[2]=r,a[3]=n,a[4]=i,a[5]=o,a}function a(e,t){const r=isFinite(e[2])||isFinite(e[5]);return new i.Z(r?{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],zmin:e[2],zmax:e[5],spatialReference:t}:{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],spatialReference:t})}function l(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[3]),e[4]=Math.max(e[4],t[4]),e[5]=Math.max(e[5],t[5])}function u(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[0]),e[4]=Math.max(e[4],t[1]),e[5]=Math.max(e[5],t[2])}function c(e,t=[0,0,0]){return t[0]=function(e){return e[0]>=e[3]?0:e[3]-e[0]}(e),t[1]=function(e){return e[1]>=e[4]?0:e[4]-e[1]}(e),t[2]=function(e){return e[2]>=e[5]?0:e[5]-e[2]}(e),t}function d(e,t,r=e){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r!==e&&(r[3]=e[3],r[4]=e[4],r[5]=e[5]),r}function h(e,t,r=e){return r[3]=t[0],r[4]=t[1],r[5]=t[2],r!==e&&(r[0]=e[0],r[1]=e[1],r[2]=e[2]),e}function p(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function f(e){return e?p(e,_):s(_)}function y(e,t){return e[0]=t[0],e[1]=t[1],e[2]=Number.NEGATIVE_INFINITY,e[3]=t[2],e[4]=t[3],e[5]=Number.POSITIVE_INFINITY,e}function g(e){return 6===e.length}function m(e,t,r){if((0,n.Wi)(e)||(0,n.Wi)(t))return e===t;if(!g(e)||!g(t))return!1;if(r){for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1}else for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}r(24470);const _=[1/0,1/0,1/0,-1/0,-1/0,-1/0],b=[0,0,0,0,0,0];s()},24470:(e,t,r)=>{r.d(t,{HH:()=>l,SO:()=>u,Ue:()=>s,al:()=>o,cS:()=>p,jE:()=>c,kK:()=>d,oJ:()=>a,r3:()=>h}),r(80442),r(22021);var n=r(70586),i=r(6570);function s(e=y){return[e[0],e[1],e[2],e[3]]}function o(e,t,r,n,i=s()){return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i}function a(e,t=s()){return t[0]=e.xmin,t[1]=e.ymin,t[2]=e.xmax,t[3]=e.ymax,t}function l(e,t){return new i.Z({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:t})}function u(e){return function(e){return(0,n.Wi)(e)||e[0]>=e[2]?0:e[2]-e[0]}(e)*function(e){return e[1]>=e[3]?0:e[3]-e[1]}(e)}function c(e,t,r){return t>=e[0]&&r>=e[1]&&t<=e[2]&&r<=e[3]}function d(e,t){return Math.max(t[0],e[0])<=Math.min(t[2],e[2])&&Math.max(t[1],e[1])<=Math.min(t[3],e[3])}function h(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}function p(e){return e?function(e,t){return e!==t&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]),e}(e,f):s(f)}const f=[1/0,1/0,-1/0,-1/0],y=[0,0,0,0]},33955:(e,t,r)=>{r.d(t,{Ji:()=>g,YX:()=>c,aW:()=>d,im:()=>y,l9:()=>p,oU:()=>f,q9:()=>_,wp:()=>h});var n=r(70586),i=r(6570),s=r(9361),o=r(65091),a=r(94139),l=r(38913),u=r(58901);function c(e){return void 0!==e.xmin&&void 0!==e.ymin&&void 0!==e.xmax&&void 0!==e.ymax}function d(e){return void 0!==e.points}function h(e){return void 0!==e.x&&void 0!==e.y}function p(e){return void 0!==e.paths}function f(e){return void 0!==e.rings}function y(e){return(0,n.Wi)(e)?null:e instanceof s.Z?e:h(e)?a.Z.fromJSON(e):p(e)?u.Z.fromJSON(e):f(e)?l.Z.fromJSON(e):d(e)?o.Z.fromJSON(e):c(e)?i.Z.fromJSON(e):null}function g(e){return e?h(e)?"esriGeometryPoint":p(e)?"esriGeometryPolyline":f(e)?"esriGeometryPolygon":c(e)?"esriGeometryEnvelope":d(e)?"esriGeometryMultipoint":null:null}const m={esriGeometryPoint:a.Z,esriGeometryPolyline:u.Z,esriGeometryPolygon:l.Z,esriGeometryEnvelope:i.Z,esriGeometryMultipoint:o.Z};function _(e){return e&&m[e]||null}},82397:(e,t,r)=>{r.d(t,{G6:()=>g,Ie:()=>y,J9:()=>p,RF:()=>h,U1:()=>f,vY:()=>a});var n=r(70586);r(33955);const i=(e,t,r)=>[t,r],s=(e,t,r)=>[t,r,e[2]],o=(e,t,r)=>[t,r,e[2],e[3]];function a(e){return e?{originPosition:"upper-left"===e.originPosition?"upperLeft":"lower-left"===e.originPosition?"lowerLeft":e.originPosition,scale:e.tolerance?[e.tolerance,e.tolerance]:[1,1],translate:(0,n.pC)(e.extent)?[e.extent.xmin,e.extent.ymax]:[0,0]}:null}function l({scale:e,translate:t},r){return r*e[0]+t[0]}function u({scale:e,translate:t},r){return t[1]-r*e[1]}function c(e,t,r){const n=new Array(r.length);if(!r.length)return n;const[i,s]=e.scale;let o=l(e,r[0][0]),a=u(e,r[0][1]);n[0]=t(r[0],o,a);for(let e=1;e<r.length;e++){const l=r[e];o+=l[0]*i,a-=l[1]*s,n[e]=t(l,o,a)}return n}function d(e,t,r){const n=new Array(r.length);for(let i=0;i<r.length;i++)n[i]=c(e,t,r[i]);return n}function h(e,t,r,n,i){return t.x=function({scale:e,translate:t},r){return Math.round((r-t[0])/e[0])}(e,r.x),t.y=function({scale:e,translate:t},r){return Math.round((t[1]-r)/e[1])}(e,r.y),t!==r&&(n&&(t.z=r.z),i&&(t.m=r.m)),t}function p(e,t,r,a,l){return(0,n.pC)(r)&&(t.points=function(e,t,r,n){return c(e,r?n?o:s:n?s:i,t)}(e,r.points,a,l)),t}function f(e,t,r,i,s){return(0,n.Wi)(r)||(t.x=l(e,r.x),t.y=u(e,r.y),t!==r&&(i&&(t.z=r.z),s&&(t.m=r.m))),t}function y(e,t,r,a,l){return(0,n.pC)(r)&&(t.rings=function(e,t,r,n){return d(e,r?n?o:s:n?s:i,t)}(e,r.rings,a,l)),t}function g(e,t,r,a,l){return(0,n.pC)(r)&&(t.paths=function(e,t,r,n){return d(e,r?n?o:s:n?s:i,t)}(e,r.paths,a,l)),t}},86973:(e,t,r)=>{r.d(t,{Mk:()=>i,P$:()=>s});var n=r(35454);const i=(0,n.w)()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon"}),s=(0,n.w)()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh"})},69285:(e,t,r)=>{r.d(t,{k:()=>o});var n=r(70586),i=r(67900),s=r(8744);function o(e,t,r){if((0,n.Wi)(t)||(0,n.Wi)(r)||r.vcsWkid||(0,s.fS)(t,r))return null;const o=(0,i._R)(t)/(0,i._R)(r);if(1===o)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){e&&null!=e.z&&(e.z*=t)}(e,o);case"polyline":case"esriGeometryPolyline":return e=>function(e,t){if(e)for(const r of e.paths)for(const e of r)e.length>2&&(e[2]*=t)}(e,o);case"polygon":case"esriGeometryPolygon":return e=>function(e,t){if(e)for(const r of e.rings)for(const e of r)e.length>2&&(e[2]*=t)}(e,o);case"multipoint":case"esriGeometryMultipoint":return e=>function(e,t){if(e)for(const r of e.points)r.length>2&&(r[2]*=t)}(e,o);case"extent":case"esriGeometryExtent":return e=>function(e,t){e&&null!=e.zmin&&null!=e.zmax&&(e.zmin*=t,e.zmax*=t)}(e,o);default:return null}}},24335:(e,t,r)=>{r.d(t,{Wh:()=>s,Pj:()=>o}),r(43090),r(80442),r(82971);var n=r(60437),i=r(24470);r(82397),r(86973),r(1231),r(8744);class s{constructor(e,t,r){this.uid=e,this.geometry=t,this.attributes=r,this.visible=!0,this.objectId=null,this.centroid=null}}class o{constructor(){this.exceededTransferLimit=!1,this.features=[],this.fields=[],this.hasM=!1,this.hasZ=!1,this.geometryType=null,this.objectIdFieldName=null,this.globalIdFieldName=null,this.geometryProperties=null,this.geohashFieldName=null,this.spatialReference=null,this.transform=null}}(0,n.Ue)(),(0,i.Ue)()},1231:(e,t,r)=>{r.d(t,{Z:()=>g});var n,i=r(43697),s=r(35454),o=r(96674),a=r(5600),l=(r(67676),r(75215)),u=r(36030),c=r(71715),d=r(52011),h=r(72729),p=r(86719);const f=new s.X({binary:"binary",coordinate:"coordinate",countOrAmount:"count-or-amount",dateAndTime:"date-and-time",description:"description",locationOrPlaceName:"location-or-place-name",measurement:"measurement",nameOrTitle:"name-or-title",none:"none",orderedOrRanked:"ordered-or-ranked",percentageOrRatio:"percentage-or-ratio",typeOrCategory:"type-or-category",uniqueIdentifier:"unique-identifier"});let y=n=class extends o.wq{constructor(e){super(e),this.alias=null,this.defaultValue=void 0,this.description=null,this.domain=null,this.editable=!0,this.length=-1,this.name=null,this.nullable=!0,this.type=null,this.valueType=null,this.visible=!0}readDescription(e,{description:t}){let r=null;try{r=t?JSON.parse(t):null}catch(e){}return r?.value??null}readValueType(e,{description:t}){let r=null;try{r=t?JSON.parse(t):null}catch(e){}return r?f.fromJSON(r.fieldValueType):null}clone(){return new n({alias:this.alias,defaultValue:this.defaultValue,description:this.description,domain:this.domain&&this.domain.clone()||null,editable:this.editable,length:this.length,name:this.name,nullable:this.nullable,type:this.type,valueType:this.valueType,visible:this.visible})}};(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],y.prototype,"alias",void 0),(0,i._)([(0,a.Cb)({type:[String,Number],json:{write:{allowNull:!0}}})],y.prototype,"defaultValue",void 0),(0,i._)([(0,a.Cb)()],y.prototype,"description",void 0),(0,i._)([(0,c.r)("description")],y.prototype,"readDescription",null),(0,i._)([(0,a.Cb)({types:h.V5,json:{read:{reader:h.im},write:!0}})],y.prototype,"domain",void 0),(0,i._)([(0,a.Cb)({type:Boolean,json:{write:!0}})],y.prototype,"editable",void 0),(0,i._)([(0,a.Cb)({type:l.z8,json:{write:!0}})],y.prototype,"length",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],y.prototype,"name",void 0),(0,i._)([(0,a.Cb)({type:Boolean,json:{write:!0}})],y.prototype,"nullable",void 0),(0,i._)([(0,u.J)(p.v)],y.prototype,"type",void 0),(0,i._)([(0,a.Cb)()],y.prototype,"valueType",void 0),(0,i._)([(0,c.r)("valueType",["description"])],y.prototype,"readValueType",null),(0,i._)([(0,a.Cb)({type:Boolean,json:{read:!1}})],y.prototype,"visible",void 0),y=n=(0,i._)([(0,d.j)("esri.layers.support.Field")],y);const g=y},72729:(e,t,r)=>{r.d(t,{im:()=>x,V5:()=>v}),r(80442);var n,i=r(43697),s=r(22974),o=r(5600),a=(r(75215),r(36030)),l=r(52011),u=r(96674);r(67676);let c=n=class extends u.wq{constructor(e){super(e),this.name=null,this.code=null}clone(){return new n({name:this.name,code:this.code})}};(0,i._)([(0,o.Cb)({type:String,json:{write:!0}})],c.prototype,"name",void 0),(0,i._)([(0,o.Cb)({type:[String,Number],json:{write:!0}})],c.prototype,"code",void 0),c=n=(0,i._)([(0,l.j)("esri.layers.support.CodedValue")],c);const d=new(r(35454).X)({inherited:"inherited",codedValue:"coded-value",range:"range"});let h=class extends u.wq{constructor(e){super(e),this.name=null,this.type=null}};(0,i._)([(0,o.Cb)({type:String,json:{write:!0}})],h.prototype,"name",void 0),(0,i._)([(0,a.J)(d)],h.prototype,"type",void 0),h=(0,i._)([(0,l.j)("esri.layers.support.Domain")],h);const p=h;var f;let y=f=class extends p{constructor(e){super(e),this.codedValues=null,this.type="coded-value"}getName(e){let t=null;if(this.codedValues){const r=String(e);this.codedValues.some((e=>(String(e.code)===r&&(t=e.name),!!t)))}return t}clone(){return new f({codedValues:(0,s.d9)(this.codedValues),name:this.name})}};(0,i._)([(0,o.Cb)({type:[c],json:{write:!0}})],y.prototype,"codedValues",void 0),(0,i._)([(0,a.J)({codedValue:"coded-value"})],y.prototype,"type",void 0),y=f=(0,i._)([(0,l.j)("esri.layers.support.CodedValueDomain")],y);const g=y;var m;r(92604),r(20102);let _=m=class extends p{constructor(e){super(e),this.type="inherited"}clone(){return new m}};(0,i._)([(0,a.J)({inherited:"inherited"})],_.prototype,"type",void 0),_=m=(0,i._)([(0,l.j)("esri.layers.support.InheritedDomain")],_);const b=_;var k;let w=k=class extends p{constructor(e){super(e),this.maxValue=null,this.minValue=null,this.type="range"}clone(){return new k({maxValue:this.maxValue,minValue:this.minValue,name:this.name})}};(0,i._)([(0,o.Cb)({type:Number,json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range&&t.range[1]},write:{enabled:!1,overridePolicy(){return{enabled:null!=this.maxValue&&null==this.minValue}},target:"range",writer(e,t,r){t[r]=[this.minValue||0,e]}}}})],w.prototype,"maxValue",void 0),(0,i._)([(0,o.Cb)({type:Number,json:{type:[Number],read:{source:"range",reader:(e,t)=>t.range&&t.range[0]},write:{target:"range",writer(e,t,r){t[r]=[e,this.maxValue||0]}}}})],w.prototype,"minValue",void 0),(0,i._)([(0,a.J)({range:"range"})],w.prototype,"type",void 0),w=k=(0,i._)([(0,l.j)("esri.layers.support.RangeDomain")],w);const T=w,v={key:"type",base:p,typeMap:{range:w,"coded-value":g,inherited:b}};function x(e){if(!e||!e.type)return null;switch(e.type){case"range":return T.fromJSON(e);case"codedValue":return g.fromJSON(e);case"inherited":return b.fromJSON(e)}return null}},86719:(e,t,r)=>{r.d(t,{v:()=>n});const n=new(r(35454).X)({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"oid",esriFieldTypeGeometry:"geometry",esriFieldTypeBlob:"blob",esriFieldTypeRaster:"raster",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"global-id",esriFieldTypeXML:"xml"})},77863:(e,t,r)=>{r.d(t,{G$:()=>x,K9:()=>C,O7:()=>d});var n=r(20102),i=r(70586),s=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 d(e){return e>=l.length?null:l[e]}function h(e){return e>=u.length?null:u[e]}function p(e){return e>=c.length?null:c[e]}function f(e,t){return t>=e.geometryTypes.length?null:e.geometryTypes[t]}function y(e,t,r){const n=e.asUnsafe(),i=t.createPointGeometry(r);for(;n.next();)switch(n.tag()){case 3:{const e=n.getUInt32(),r=n.pos()+e;let s=0;for(;n.pos()<r;)t.addCoordinatePoint(i,n.getSInt64(),s++);break}default:n.skip()}return i}function g(e,t,r){const n=e.asUnsafe(),i=t.createGeometry(r),s=2+(r.hasZ?1:0)+(r.hasM?1:0);for(;n.next();)switch(n.tag()){case 2:{const e=n.getUInt32(),r=n.pos()+e;let s=0;for(;n.pos()<r;)t.addLength(i,n.getUInt32(),s++);break}case 3:{const e=n.getUInt32(),r=n.pos()+e;let o=0;for(t.allocateCoordinates(i);n.pos()<r;)t.addCoordinate(i,n.getSInt64(),o),o++,o===s&&(o=0);break}default:n.skip()}return i}function m(e){const t=e.asUnsafe(),r=new o.Z;let n="esriGeometryPoint";for(;t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),n=t.pos()+e;for(;t.pos()<n;)r.lengths.push(t.getUInt32());break}case 3:{const e=t.getUInt32(),n=t.pos()+e;for(;t.pos()<n;)r.coords.push(t.getSInt64());break}case 1:n=a.A[t.getEnum()];break;default:t.skip()}return{queryGeometry:r,queryGeometryType:n}}function _(e){const t=e.asUnsafe();for(;t.next();)switch(t.tag()){case 1:return t.getString();case 2:return t.getFloat();case 3:return t.getDouble();case 4:return t.getSInt32();case 5:return t.getUInt32();case 6:return t.getInt64();case 7:return t.getUInt64();case 8:return t.getSInt64();case 9:return t.getBool();default:return t.skip(),null}return null}function b(e){const t=e.asUnsafe(),r={type:d(0)};for(;t.next();)switch(t.tag()){case 1:r.name=t.getString();break;case 2:r.type=d(t.getEnum());break;case 3:r.alias=t.getString();break;case 4:r.sqlType=h(t.getEnum());break;case 5:default:t.skip();break;case 6:r.defaultValue=t.getString()}return r}function k(e){const t={},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.name=r.getString();break;case 2:t.isSystemMaintained=r.getBool();break;default:r.skip()}return t}function w(e,t,r,n){const i=t.createFeature(r);let s=0;for(;e.next();)switch(e.tag()){case 1:{const t=n[s++].name;i.attributes[t]=e.processMessage(_);break}case 2:i.geometry=e.processMessageWithArgs(g,t,r);break;case 4:i.centroid=e.processMessageWithArgs(y,t,r);break;default:e.skip()}return i}function T(e){const t=[1,1,1,1],r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t[0]=r.getDouble();break;case 2:t[1]=r.getDouble();break;case 4:t[2]=r.getDouble();break;case 3:t[3]=r.getDouble();break;default:r.skip()}return t}function v(e){const t=[0,0,0,0],r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t[0]=r.getDouble();break;case 2:t[1]=r.getDouble();break;case 4:t[2]=r.getDouble();break;case 3:t[3]=r.getDouble();break;default:r.skip()}return t}function x(e){const t={originPosition:p(0)},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.originPosition=p(r.getEnum());break;case 2:t.scale=r.processMessage(T);break;case 3:t.translate=r.processMessage(v);break;default:r.skip()}return t}function S(e){const t={},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.shapeAreaFieldName=r.getString();break;case 2:t.shapeLengthFieldName=r.getString();break;case 3:t.units=r.getString();break;default:r.skip()}return t}function G(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 I(e,t){const r=t.createFeatureResult(),n=e.asUnsafe();r.geometryType=f(t,0);let i=!1;for(;n.next();)switch(n.tag()){case 1:r.objectIdFieldName=n.getString();break;case 3:r.globalIdFieldName=n.getString();break;case 4:r.geohashFieldName=n.getString();break;case 5:r.geometryProperties=n.processMessage(S);break;case 7:r.geometryType=f(t,n.getEnum());break;case 8:r.spatialReference=n.processMessageWithArgs(G,t);break;case 10:r.hasZ=n.getBool();break;case 11:r.hasM=n.getBool();break;case 12:r.transform=n.processMessage(x);break;case 9:{const e=n.getBool();r.exceededTransferLimit=e;break}case 13:t.addField(r,n.processMessage(b));break;case 15:i||(t.prepareFeatures(r),i=!0),t.addFeature(r,n.processMessageWithArgs(w,t,r,r.fields));break;case 2:r.uniqueIdField=n.processMessage(k);break;default:n.skip()}return t.finishFeatureResult(r),r}function F(e,t){const r={};let n=null;for(;e.next();)switch(e.tag()){case 4:n=e.processMessageWithArgs(m);break;case 1:r.featureResult=e.processMessageWithArgs(I,t);break;default:e.skip()}return(0,i.pC)(n)&&r.featureResult&&t.addQueryGeometry(r,n),r}function C(e,t){try{const r=2,n=new s.Z(new Uint8Array(e),new DataView(e)),i={};for(;n.next();)n.tag()===r?i.queryResult=n.processMessageWithArgs(F,t):n.skip();return i}catch(e){throw new n.Z("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e})}}},78760:(e,t,r)=>{r.d(t,{A:()=>l,J:()=>u});var n=r(67900),i=r(8744),s=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,n._R)(this._options.sourceSpatialReference)/(0,n._R)(e.spatialReference);if(1!==t)for(const r of e.features){if(!(0,s.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 s.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 n=r(77863);function i(e,t){const r=(0,n.K9)(e,t),i=r.queryResult.featureResult,s=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=s,i.queryGeometryType=o),i}},10802:(e,t,r)=>{r.r(t),r.d(t,{default:()=>k});var n=r(74085),i=r(70586),s=r(99001),o=r(82971),a=r(69285),l=r(24335),u=r(98732),c=r(1231);function d(e,t){return t}function h(e,t,r,n){switch(r){case 0:return g(e,t+n,0);case 1:return"lowerLeft"===e.originPosition?g(e,t+n,1):function({translate:e,scale:t},r,n){return e[n]-r*t[n]}(e,t+n,1)}}function p(e,t,r,n){return 2===r?g(e,t,2):h(e,t,r,n)}function f(e,t,r,n){return 2===r?g(e,t,3):h(e,t,r,n)}function y(e,t,r,n){return 3===r?g(e,t,3):p(e,t,r,n)}function g({translate:e,scale:t},r,n){return e[n]+r*t[n]}class m{constructor(e){this._options=e,this.geometryTypes=["point","multipoint","polyline","polygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=d,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return new l.Pj}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const t=(0,a.k)(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(!(0,i.Wi)(t))for(const r of e.features)t(r.geometry)}createSpatialReference(){return new o.Z}addField(e,t){e.fields.push(c.Z.fromJSON(t));const r=e.fields.map((e=>e.name));this._attributesConstructor=function(){for(const e of r)this[e]=null}}addFeature(e,t){const r=this._options.maxStringAttributeLength?this._options.maxStringAttributeLength:0;if(r>0)for(const e in t.attributes){const n=t.attributes[e];"string"==typeof n&&n.length>r&&(t.attributes[e]="")}e.features.push(t)}addQueryGeometry(e,t){const{queryGeometry:r,queryGeometryType:n}=t,i=(0,u.$g)(r.clone(),r,!1,!1,this._transform),s=(0,u.di)(i,n,!1,!1);let o=null;switch(n){case"esriGeometryPoint":o="point";break;case"esriGeometryPolygon":o="polygon";break;case"esriGeometryPolyline":o="polyline";break;case"esriGeometryMultipoint":o="multipoint"}s.type=o,e.queryGeometryType=n,e.queryGeometry=s}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++,e.geometryType){case"point":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"polygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"polyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"multipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e);break;case"mesh":case"extent":break;default:(0,n.Bg)(e.geometryType)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,new l.Wh((0,s.D)(),null,new this._attributesConstructor)}allocateCoordinates(){const e=this._lengths.reduce(((e,t)=>e+t),0);this._coordinateBuffer=new Float64Array(e*this._vertexDimension),this._coordinateBufferPtr=0}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}createPointGeometry(e){const t={type:"point",x:0,y:0,spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM};return t.hasZ&&(t.z=0),t.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){switch(t=this._applyTransform(this._transform,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:e.hasZ?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;return t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e),this._applyTransform(this._transform,e,t,r)}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){0===r&&e.points.push([]);const n=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(n)}_createPolygonGeometry(e){return{type:"polygon",rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{type:"polyline",paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{type:"multipoint",points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){0===r&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const n=this._transformPathLikeValue(t,r),i=e[e.length-1];0===r&&i.push(new Float64Array(this._coordinateBuffer.buffer,this._coordinateBufferPtr*Float64Array.BYTES_PER_ELEMENT,this._vertexDimension)),this._coordinateBuffer[this._coordinateBufferPtr++]=n}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?y:t?p:r?f:h}}var _=r(45178);class b{_parseFeatureQuery(e){const t=(0,_.C)(e.buffer,new m(e.options)),r={...t,spatialReference:t.spatialReference.toJSON(),fields:t.fields?t.fields.map((e=>e.toJSON())):void 0};return Promise.resolve(r)}}function k(){return new b}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8882,9880],{99880:(e,t,r)=>{r.d(t,{V:()=>l});var n=r(68773),s=(r(3172),r(20102)),i=r(92604),o=r(17452);const a=i.Z.getLogger("esri.assets");function l(e){if(!n.Z.assetsPath)throw a.errorOnce("The API assets location needs to be set using config.assetsPath. More information: https://arcg.is/1OzLe50"),new s.Z("assets:path-not-set","config.assetsPath is not set");return(0,o.v_)(n.Z.assetsPath,e)}},25929:(e,t,r)=>{r.d(t,{M:()=>m,a:()=>v,e:()=>d,f:()=>i,i:()=>h,p:()=>p,r:()=>a,t:()=>o,w:()=>l});var n=r(70586),s=r(17452);function i(e,t){const r=t&&t.url&&t.url.path;if(e&&r&&(e=(0,s.hF)(e,r,{preserveProtocolRelative:!0}),t.portalItem&&t.readResourcePaths)){const r=(0,s.PF)(e,t.portalItem.itemUrl);null!=r&&c.test(r)&&t.readResourcePaths.push(t.portalItem.resourceFromPath(r).path)}return f(e,t&&t.portal)}function o(e,t,r=m.YES){if(null==e)return e;!(0,s.YP)(e)&&t&&t.blockedRelativeUrls&&t.blockedRelativeUrls.push(e);let n=(0,s.hF)(e);if(t){const r=t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.rootPath||t.url&&t.url.path;if(r){const i=f(r,t.portal);n=(0,s.PF)(f(n,t.portal),i,i),null!=n&&n!==e&&t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.writtenUrls.push(n)}}return n=d(n,t?.portal),(0,s.YP)(n)&&(n=(0,s.Fv)(n)),t?.resources&&t?.portalItem&&!(0,s.YP)(n)&&!(0,s.HK)(n)&&r===m.YES&&t.resources.toKeep.push({resource:t.portalItem.resourceFromPath(n),compress:!1}),n}function a(e,t,r){return i(e,r)}function l(e,t,r,n){const s=o(e,n);void 0!==s&&(t[r]=s)}const u=/\/items\/([^\/]+)\/resources\/(.*)/,c=/^\.\/resources\//;function h(e){return(e?.match(u)??null)?.[1]??null}function p(e){const t=e?.match(u)??null;if(null==t)return null;const r=t[2],i=r.lastIndexOf("/");if(-1===i){const{path:e,extension:t}=(0,s.fZ)(r);return{prefix:null,filename:e,extension:(0,n.Wg)(t)}}const{path:o,extension:a}=(0,s.fZ)(r.slice(i+1));return{prefix:r.slice(0,i),filename:o,extension:(0,n.Wg)(a)}}function d(e,t){return t&&!t.isPortal&&t.urlKey&&t.customBaseUrl?(0,s.Ie)(e,`${t.urlKey}.${t.customBaseUrl}`,t.portalHostname):e}function f(e,t){if(!t||t.isPortal||!t.urlKey||!t.customBaseUrl)return e;const r=`${t.urlKey}.${t.customBaseUrl}`,n=(0,s.TI)();return(0,s.D6)(n,`${n.scheme}://${r}`)?(0,s.Ie)(e,t.portalHostname,r):(0,s.Ie)(e,r,t.portalHostname)}var m,y;(y=m||(m={}))[y.YES=0]="YES",y[y.NO=1]="NO";const v=Object.freeze(Object.defineProperty({__proto__:null,fromJSON:i,toJSON:o,read:a,write:l,itemIdFromResourceUrl:h,prefixAndFilenameFromResourceUrl:p,ensureMainOnlineDomain:d,get MarkKeep(){return m}},Symbol.toStringTag,{value:"Module"}))},32448:(e,t,r)=>{r.d(t,{Z:()=>l});var n=r(43697),s=r(15923),i=r(50758),o=r(52011);class a{constructor(){this._emitter=new a.EventEmitter(this)}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}}!function(e){class t{constructor(e=null){this._target=e,this._listenersMap=null}clear(){this._listenersMap&&this._listenersMap.clear(),this._listenersMap=null}emit(e,t){const r=this._listenersMap&&this._listenersMap.get(e);if(!r)return!1;const n=this._target||this;return[...r].forEach((e=>{e.call(n,t)})),r.length>0}on(e,t){if(Array.isArray(e)){const r=e.map((e=>this.on(e,t)));return(0,i.AL)(r)}if(e.includes(","))throw new TypeError("Evented.on() with a comma delimited string of event types is not supported");this._listenersMap||(this._listenersMap=new Map);const r=this._listenersMap.get(e)||[];return r.push(t),this._listenersMap.set(e,r),{remove:()=>{const r=this._listenersMap&&this._listenersMap.get(e)||[],n=r.indexOf(t);n>=0&&r.splice(n,1)}}}once(e,t){const r=this.on(e,(e=>{r.remove(),t.call(null,e)}));return r}hasEventListener(e){const t=this._listenersMap&&this._listenersMap.get(e);return null!=t&&t.length>0}}e.EventEmitter=t,e.EventedMixin=e=>{let r=class extends e{constructor(){super(...arguments),this._emitter=new t}destroy(){this._emitter.clear()}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}};return r=(0,n._)([(0,o.j)("esri.core.Evented")],r),r};let r=class extends s.Z{constructor(){super(...arguments),this._emitter=new a.EventEmitter(this)}destroy(){this._emitter.clear()}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}};r=(0,n._)([(0,o.j)("esri.core.Evented")],r),e.EventedAccessor=r}(a||(a={}));const l=a},10699:(e,t,r)=>{r.d(t,{IG:()=>o});var n=r(43697),s=r(52011);let i=0;const o=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+i++})}};return t=(0,n._)([(0,s.j)("esri.core.Identifiable")],t),t};let a=class extends(o(class{})){};a=(0,n._)([(0,s.j)("esri.core.Identifiable")],a)},66643:(e,t,r)=>{r.d(t,{Ed:()=>u,UI:()=>c,mt:()=>f,q6:()=>d,vr:()=>m});var n=r(43697),s=r(15923),i=r(70586),o=r(95330),a=r(5600),l=(r(67676),r(75215),r(52011));function u(e,t,r){return(0,o.as)(e.map(((e,n)=>t.apply(r,[e,n]))))}async function c(e,t,r){return(await(0,o.as)(e.map(((e,n)=>t.apply(r,[e,n]))))).map((e=>e.value))}function h(e){return{ok:!0,value:e}}function p(e){return{ok:!1,error:e}}async function d(e){if((0,i.Wi)(e))return{ok:!1,error:new Error("no promise provided")};try{return h(await e)}catch(e){return p(e)}}async function f(e){try{return h(await e)}catch(e){return(0,o.r9)(e),p(e)}}function m(e,t){return new y(e,t)}let y=class extends s.Z{constructor(e,t){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,i.IM)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:r}=this._abortController;this.promise=e(r),this.promise.then((e=>{this._result=h(e),this._cleanup()}),(e=>{this._result=p(e),this._cleanup()})),this._abortHandle=(0,o.fu)(t,this.abort)}get value(){return e=this._result,(0,i.pC)(e)&&!0===e.ok?e.value:null;var e}get error(){return e=this._result,(0,i.pC)(e)&&!1===e.ok?e.error:null;var e}get finished(){return(0,i.pC)(this._result)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,i.hw)(this._abortHandle),this._abortController=null}};(0,n._)([(0,a.Cb)()],y.prototype,"value",null),(0,n._)([(0,a.Cb)()],y.prototype,"error",null),(0,n._)([(0,a.Cb)()],y.prototype,"finished",null),(0,n._)([(0,a.Cb)()],y.prototype,"promise",void 0),(0,n._)([(0,a.Cb)()],y.prototype,"_result",void 0),y=(0,n._)([(0,l.j)("esri.core.asyncUtils.ReactiveTask")],y)},24470:(e,t,r)=>{r.d(t,{HH:()=>l,SO:()=>u,Ue:()=>i,al:()=>o,cS:()=>d,jE:()=>c,kK:()=>h,oJ:()=>a,r3:()=>p}),r(80442),r(22021);var n=r(70586),s=r(6570);function i(e=m){return[e[0],e[1],e[2],e[3]]}function o(e,t,r,n,s=i()){return s[0]=e,s[1]=t,s[2]=r,s[3]=n,s}function a(e,t=i()){return t[0]=e.xmin,t[1]=e.ymin,t[2]=e.xmax,t[3]=e.ymax,t}function l(e,t){return new s.Z({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:t})}function u(e){return function(e){return(0,n.Wi)(e)||e[0]>=e[2]?0:e[2]-e[0]}(e)*function(e){return e[1]>=e[3]?0:e[3]-e[1]}(e)}function c(e,t,r){return t>=e[0]&&r>=e[1]&&t<=e[2]&&r<=e[3]}function h(e,t){return Math.max(t[0],e[0])<=Math.min(t[2],e[2])&&Math.max(t[1],e[1])<=Math.min(t[3],e[3])}function p(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}function d(e){return e?function(e,t){return e!==t&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]),e}(e,f):i(f)}const f=[1/0,1/0,-1/0,-1/0],m=[0,0,0,0]},94443:(e,t,r)=>{r.d(t,{ME:()=>d,Su:()=>f,tz:()=>p});var n=r(20102),s=r(95330),i=r(70171);const o=/^([a-z]{2})(?:[-_]([A-Za-z]{2}))?$/,a={ar:!0,bg:!0,bs:!0,ca:!0,cs:!0,da:!0,de:!0,el:!0,en:!0,es:!0,et:!0,fi:!0,fr:!0,he:!0,hr:!0,hu:!0,id:!0,it:!0,ja:!0,ko:!0,lt:!0,lv:!0,nb:!0,nl:!0,pl:!0,"pt-BR":!0,"pt-PT":!0,ro:!0,ru:!0,sk:!0,sl:!0,sr:!0,sv:!0,th:!0,tr:!0,uk:!0,vi:!0,"zh-CN":!0,"zh-HK":!0,"zh-TW":!0};function l(e){return a[e]??!1}const u=[],c=new Map;function h(e){for(const t of c.keys())m(e.pattern,t)&&c.delete(t)}function p(e){return u.includes(e)||(h(e),u.unshift(e)),{remove(){const t=u.indexOf(e);t>-1&&(u.splice(t,1),h(e))}}}async function d(e){const t=(0,i.Kd)();c.has(e)||c.set(e,async function(e,t){const r=[];for(const n of u)if(m(n.pattern,e))try{return await n.fetchMessageBundle(e,t)}catch(e){r.push(e)}if(r.length)throw new n.Z("intl:message-bundle-error",`Errors occurred while loading "${e}"`,{errors:r});throw new n.Z("intl:no-message-bundle-loader",`No loader found for message bundle "${e}"`)}(e,t));const r=c.get(e);return r&&await y.add(r),r}function f(e){if(!o.test(e))return null;const t=o.exec(e);if(null===t)return null;const[,r,n]=t,s=r+(n?"-"+n.toUpperCase():"");return l(s)?s:l(r)?r:null}function m(e,t){return"string"==typeof e?t.startsWith(e):e.test(t)}(0,i.Ze)((()=>{c.clear()}));const y=new class{constructor(){this._numLoading=0,this._dfd=null}async waitForAll(){this._dfd&&await this._dfd.promise}add(e){return this._increase(),e.then((()=>this._decrease()),(()=>this._decrease())),this.waitForAll()}_increase(){this._numLoading++,this._dfd||(this._dfd=(0,s.dD)())}_decrease(){this._numLoading=Math.max(this._numLoading-1,0),this._dfd&&0===this._numLoading&&(this._dfd.resolve(),this._dfd=null)}}},87085:(e,t,r)=>{r.d(t,{Z:()=>b});var n=r(43697),s=(r(66577),r(3172)),i=r(20102),o=r(32448),a=r(10699),l=r(83379),u=r(92604),c=r(95330),h=r(17452),p=r(5600),d=(r(67676),r(75215),r(52011)),f=r(68773),m=r(6570),y=r(82971);let v=0,_=class extends(o.Z.EventedMixin((0,a.IG)(l.Z))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new m.Z(-180,-90,180,90,y.Z.WGS84),this.id=Date.now().toString(16)+"-layer-"+v++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=y.Z.WGS84,this.title=null,this.type=null,this.url=null,this.visible=!0}static async fromArcGISServerUrl(e){const t="string"==typeof e?{url:e}:e;return(await r.e(3529).then(r.bind(r,63529))).fromUrl(t)}static fromPortalItem(e){return async function(e){const t="portalItem"in e?e:{portalItem:e},n=await Promise.all([r.e(4547),r.e(9300),r.e(6636)]).then(r.bind(r,28008));try{return await n.fromItem(t)}catch(e){const r=t&&t.portalItem,n=r&&r.id||"unset",s=r&&r.portal&&r.portal.url||f.Z.portalUrl;throw u.Z.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+s+"', id: '"+n+"')",e),e}}(e)}initialize(){this.when().catch((e=>{(0,c.D_)(e)||u.Z.getLogger(this.declaredClass).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}destroy(){if(this.parent){const e=this,t=this.parent;"layers"in t&&t.layers.includes(e)?t.layers.remove(e):"tables"in t&&t.tables.includes(e)?t.tables.remove(e):"baseLayers"in t&&t.baseLayers.includes(e)?t.baseLayers.remove(e):"baseLayers"in t&&t.referenceLayers.includes(e)&&t.referenceLayers.remove(e)}}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return(0,h.mN)(this.url)}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e)return(await(0,s.default)(e,{query:{f:"json"},responseType:"json"})).data;throw new i.Z("layer:no-attribution-data","Layer does not have attribution data")}};(0,n._)([(0,p.Cb)({type:String})],_.prototype,"attributionDataUrl",void 0),(0,n._)([(0,p.Cb)({type:m.Z})],_.prototype,"fullExtent",void 0),(0,n._)([(0,p.Cb)({readOnly:!0})],_.prototype,"hasAttributionData",null),(0,n._)([(0,p.Cb)({type:String,clonable:!1})],_.prototype,"id",void 0),(0,n._)([(0,p.Cb)({type:Boolean,nonNullable:!0})],_.prototype,"legendEnabled",void 0),(0,n._)([(0,p.Cb)({type:["show","hide","hide-children"]})],_.prototype,"listMode",void 0),(0,n._)([(0,p.Cb)({type:Number,range:{min:0,max:1},nonNullable:!0})],_.prototype,"opacity",void 0),(0,n._)([(0,p.Cb)({clonable:!1})],_.prototype,"parent",void 0),(0,n._)([(0,p.Cb)({readOnly:!0})],_.prototype,"parsedUrl",null),(0,n._)([(0,p.Cb)({type:Boolean})],_.prototype,"popupEnabled",void 0),(0,n._)([(0,p.Cb)({type:Boolean})],_.prototype,"attributionVisible",void 0),(0,n._)([(0,p.Cb)({type:y.Z})],_.prototype,"spatialReference",void 0),(0,n._)([(0,p.Cb)({type:String})],_.prototype,"title",void 0),(0,n._)([(0,p.Cb)({readOnly:!0,json:{read:!1}})],_.prototype,"type",void 0),(0,n._)([(0,p.Cb)()],_.prototype,"url",void 0),(0,n._)([(0,p.Cb)({type:Boolean,nonNullable:!0})],_.prototype,"visible",void 0),_=(0,n._)([(0,d.j)("esri.layers.Layer")],_);const b=_},66677:(e,t,r)=>{r.d(t,{B5:()=>h,DR:()=>d,G:()=>g,M8:()=>y,Nm:()=>v,Qc:()=>p,XG:()=>_,a7:()=>m,ld:()=>f,wH:()=>b});var n=r(70586),s=r(17452),i=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 h(e){return!!l.test(e)}function p(e){if((0,n.Wi)(e))return null;const t=(0,s.mN)(e),r=t.path.match(l)||t.path.match(u);if(!r)return null;const[,i,a,c,h]=r,p=a.indexOf("/");return{title:f(-1!==p?a.slice(p+1):a),serverType:o[c.toLowerCase()],sublayer:null!=h&&""!==h?parseInt(h,10):null,url:{path:i}}}function d(e){const t=(0,s.mN)(e).path.match(c);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function f(e){return(e=e.replace(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function m(e,t){const r=[];if(e){const t=p(e);(0,n.pC)(t)&&t.title&&r.push(t.title)}if(t){const e=f(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 y(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 v(e,t){return e?(0,s.Qj)((0,s.Hu)(e,t)):e}function _(e){let{url:t}=e;if(!t)return{url:t};t=(0,s.Hu)(t,e.logger);const r=(0,s.mN)(t),i=p(r.path);let o;if((0,n.pC)(i))null!=i.sublayer&&null==e.layer.layerId&&(o=i.sublayer),t=i.url.path;else if(e.nonStandardUrlAllowed){const e=d(r.path);(0,n.pC)(e)&&(t=e.serviceUrl,o=e.sublayerId)}return{url:(0,s.Qj)(t),layerId:o}}function b(e,t,r,n,o){(0,i.w)(t,n,"url",o),n.url&&null!=e.layerId&&(n.url=(0,s.v_)(n.url,r,e.layerId.toString()))}function g(e){if(!e)return!1;const t=e.toLowerCase(),r=t.includes("/services/"),n=t.includes("/mapserver/wmsserver"),s=t.includes("/imageserver/wmsserver"),i=t.includes("/wmsserver");return r&&(n||s||i)}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9777,3172,9880],{99880:(e,t,s)=>{s.d(t,{V:()=>l});var i=s(68773),r=(s(3172),s(20102)),n=s(92604),a=s(17452);const o=n.Z.getLogger("esri.assets");function l(e){if(!i.Z.assetsPath)throw o.errorOnce("The API assets location needs to be set using config.assetsPath. More information: https://arcg.is/1OzLe50"),new r.Z("assets:path-not-set","config.assetsPath is not set");return(0,a.v_)(i.Z.assetsPath,e)}},74669:(e,t,s)=>{s.d(t,{Z:()=>r});var i=s(69801);class r{constructor(e,t){this._storage=new i.WJ,this._storage.maxSize=e,t&&this._storage.registerRemoveFunc("",t)}put(e,t){this._storage.put(e,t,1,1)}pop(e){return this._storage.pop(e)}get(e){return this._storage.get(e)}clear(){this._storage.clearAll()}destroy(){this._storage.destroy()}}},37455:(e,t,s)=>{s.d(t,{N:()=>i});const i={convertToGEGeometry:function(e,t){return null==t?null:e.convertJSONToGeometry(t)},exportPoint:function(e,t,s){const i=new r(e.getPointX(t),e.getPointY(t),s),n=e.hasZ(t),a=e.hasM(t);return n&&(i.z=e.getPointZ(t)),a&&(i.m=e.getPointM(t)),i},exportPolygon:function(e,t,s){return new n(e.exportPaths(t),s,e.hasZ(t),e.hasM(t))},exportPolyline:function(e,t,s){return new a(e.exportPaths(t),s,e.hasZ(t),e.hasM(t))},exportMultipoint:function(e,t,s){return new o(e.exportPoints(t),s,e.hasZ(t),e.hasM(t))},exportExtent:function(e,t,s){const i=e.hasZ(t),r=e.hasM(t),n=new l(e.getXMin(t),e.getYMin(t),e.getXMax(t),e.getYMax(t),s);if(i){const s=e.getZExtent(t);n.zmin=s.vmin,n.zmax=s.vmax}if(r){const s=e.getMExtent(t);n.mmin=s.vmin,n.mmax=s.vmax}return n}};class r{constructor(e,t,s){this.x=e,this.y=t,this.spatialReference=s,this.z=void 0,this.m=void 0}}class n{constructor(e,t,s,i){this.rings=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,s&&(this.hasZ=s),i&&(this.hasM=i)}}class a{constructor(e,t,s,i){this.paths=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,s&&(this.hasZ=s),i&&(this.hasM=i)}}class o{constructor(e,t,s,i){this.points=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,s&&(this.hasZ=s),i&&(this.hasM=i)}}class l{constructor(e,t,s,i,r){this.xmin=e,this.ymin=t,this.xmax=s,this.ymax=i,this.spatialReference=r,this.zmin=void 0,this.zmax=void 0,this.mmin=void 0,this.mmax=void 0}}},24470:(e,t,s)=>{s.d(t,{HH:()=>l,SO:()=>u,Ue:()=>n,al:()=>a,cS:()=>f,jE:()=>c,kK:()=>d,oJ:()=>o,r3:()=>h}),s(80442),s(22021);var i=s(70586),r=s(6570);function n(e=p){return[e[0],e[1],e[2],e[3]]}function a(e,t,s,i,r=n()){return r[0]=e,r[1]=t,r[2]=s,r[3]=i,r}function o(e,t=n()){return t[0]=e.xmin,t[1]=e.ymin,t[2]=e.xmax,t[3]=e.ymax,t}function l(e,t){return new r.Z({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:t})}function u(e){return function(e){return(0,i.Wi)(e)||e[0]>=e[2]?0:e[2]-e[0]}(e)*function(e){return e[1]>=e[3]?0:e[3]-e[1]}(e)}function c(e,t,s){return t>=e[0]&&s>=e[1]&&t<=e[2]&&s<=e[3]}function d(e,t){return Math.max(t[0],e[0])<=Math.min(t[2],e[2])&&Math.max(t[1],e[1])<=Math.min(t[3],e[3])}function h(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}function f(e){return e?function(e,t){return e!==t&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]),e}(e,m):n(m)}const m=[1/0,1/0,-1/0,-1/0],p=[0,0,0,0]},69285:(e,t,s)=>{s.d(t,{k:()=>a});var i=s(70586),r=s(67900),n=s(8744);function a(e,t,s){if((0,i.Wi)(t)||(0,i.Wi)(s)||s.vcsWkid||(0,n.fS)(t,s))return null;const a=(0,r._R)(t)/(0,r._R)(s);if(1===a)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){e&&null!=e.z&&(e.z*=t)}(e,a);case"polyline":case"esriGeometryPolyline":return e=>function(e,t){if(e)for(const s of e.paths)for(const e of s)e.length>2&&(e[2]*=t)}(e,a);case"polygon":case"esriGeometryPolygon":return e=>function(e,t){if(e)for(const s of e.rings)for(const e of s)e.length>2&&(e[2]*=t)}(e,a);case"multipoint":case"esriGeometryMultipoint":return e=>function(e,t){if(e)for(const s of e.points)s.length>2&&(s[2]*=t)}(e,a);case"extent":case"esriGeometryExtent":return e=>function(e,t){e&&null!=e.zmin&&null!=e.zmax&&(e.zmin*=t,e.zmax*=t)}(e,a);default:return null}}},26993:(e,t,s)=>{s.d(t,{y:()=>w,r:()=>m});var i=s(70586),r=s(35308),n=s(49600),a=s(82397),o=s(8744),l=s(62432),u=s(24452);class c{constructor(e,t,s){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=e.returnDistinctValues??!1,this.fieldsIndex=s,this.featureAdapter=t;const i=e.outFields;if(i&&!i.includes("*")){this.outFields=i;let e=0;for(const t of i){const i=(0,l.hr)(t),r=this.fieldsIndex.get(i),n=r?null:(0,l.Jc)(i,s),a=r?r.name:(0,l.nu)(t)||"FIELD_EXP_"+e++;this._fieldDataCache.set(t,{alias:a,clause:n})}}}countDistinctValues(e){return this.returnDistinctValues?(e.forEach((e=>this.getAttributes(e))),this._returnDistinctMap.size):e.length}getAttributes(e){const t=this._processAttributesForOutFields(e);return this._processAttributesForDistinctValues(t)}getFieldValue(e,t,s){const i=s?s.name:t;let r=null;return this._fieldDataCache.has(i)?r=this._fieldDataCache.get(i).clause:s||(r=(0,l.Jc)(t,this.fieldsIndex),this._fieldDataCache.set(i,{alias:i,clause:r})),s?this.featureAdapter.getAttribute(e,i):r.calculateValue(e,this.featureAdapter)}getDataValue(e,t){const s=t.normalizationType,i=t.normalizationTotal;let r=this.getFieldValue(e,t.field,this.fieldsIndex.get(t.field));if(t.field2&&(r=`${(0,u.wk)(r)}${t.fieldDelimiter}${(0,u.wk)(this.getFieldValue(e,t.field2,this.fieldsIndex.get(t.field2)))}`,t.field3&&(r=`${r}${t.fieldDelimiter}${(0,u.wk)(this.getFieldValue(e,t.field3,this.fieldsIndex.get(t.field3)))}`)),s&&Number.isFinite(r)){const n=this.getFieldValue(e,t.normalizationField,this.fieldsIndex.get(t.normalizationField));r=(0,u.fk)(r,s,n,i)}return r}getExpressionValue(e,t,s,i){const r={attributes:this.featureAdapter.getAttributes(e),layer:{fields:this.fieldsIndex.fields}},n=i.createExecContext(r,s);return i.executeFunction(t,n)}getExpressionValues(e,t,s,i){const r={fields:this.fieldsIndex.fields};return e.map((e=>{const n={attributes:this.featureAdapter.getAttributes(e),layer:r},a=i.createExecContext(n,s);return i.executeFunction(t,a)}))}validateItem(e,t){return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:(0,l.Jc)(t,this.fieldsIndex)}),this._fieldDataCache.get(t).clause.testFeature(e,this.featureAdapter)}validateItems(e,t){return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:(0,l.Jc)(t,this.fieldsIndex)}),this._fieldDataCache.get(t).clause.testSet(e,this.featureAdapter)}_processAttributesForOutFields(e){const t=this.outFields;if(!t||!t.length)return this.featureAdapter.getAttributes(e);const s={};for(const i of t){const{alias:t,clause:r}=this._fieldDataCache.get(i);s[t]=r?r.calculateValue(e,this.featureAdapter):this.featureAdapter.getAttribute(e,t)}return s}_processAttributesForDistinctValues(e){if((0,i.Wi)(e)||!this.returnDistinctValues)return e;const t=this.outFields,s=[];if(t)for(const i of t){const{alias:t}=this._fieldDataCache.get(i);s.push(e[t])}else for(const t in e)s.push(e[t]);const r=`${(t||["*"]).join(",")}=${s.join(",")}`;let n=this._returnDistinctMap.get(r)||0;return this._returnDistinctMap.set(r,++n),n>1?null:e}}var d=s(37427);function h(e,t,s){return{objectId:e,target:t,distance:s,type:"vertex"}}function f(e,t,s,i,r,n=!1){return{objectId:e,target:t,distance:s,type:"edge",start:i,end:r,draped:n}}var m,p,g=s(11490),y=s(35671),x=s(59266);class w{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasM=s.hasM,this.hasZ=s.hasZ,this.fieldsIndex=s.fieldsIndex,this.objectIdField=s.objectIdField,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new c(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,r=t?.length;if(!r)return 1;const n=new Map,a=new Map,o=new Set;for(const r of i){const{statisticType:i}=r,l="exceedslimit"!==i?r.onStatisticField:void 0;if(!a.has(l)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,n);s.push(t)}a.set(l,this._calculateUniqueValues(s,e.returnDistinctValues))}const u=a.get(l);for(const t in u){const{data:i,items:r}=u[t],n=i.join(",");s&&!e.validateItems(r,s)||o.add(n)}}return o.size}async createQueryResponse(){let e;return e=this.query.outStatistics?this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse(this.query):await this._createStatisticsQueryResponse(this.query):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry&&((0,o.JY)(this.query.outSR)&&!(0,o.fS)(this.query.geometry.spatialReference,this.query.outSR)?e.queryGeometry=(0,g.S2)({spatialReference:this.query.outSR,...(0,d.iV)(this.query.geometry,this.query.geometry.spatialReference,this.query.outSR)}):e.queryGeometry=(0,g.S2)({spatialReference:this.query.outSR,...this.query.geometry})),e}createSnappingResponse(e,t){const s=this.featureAdapter,r=function(e,t){return e?t?4:3:t?3:2}(this.hasZ,this.hasM),{point:n}=e,a="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y,l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,c=null!=n.z,d=null!=n.m,p=this._getPointCreator(n,c,d,this.spatialReference,t),g=new b(null,0),y=new b(null,0),x={x:0,y:0,z:0};for(const t of this.items){const c=s.getGeometry(t);if((0,i.Wi)(c))continue;const{coords:d,lengths:w}=c;if(g.coords=d,y.coords=d,e.types&m.EDGE){let e=0;for(let i=0;i<w.length;i++){const u=w[i];for(let i=0;i<u;i++,e+=r){const c=g;if(c.coordsIndex=e,i!==u-1){const i=y;i.coordsIndex=e+r;const u=x;v(x,n,c,i);const d=(n.x-u.x)/a,h=(n.y-u.y)/o,m=d*d+h*h;m<=1&&l.candidates.push(f(s.getObjectId(t),p(u),Math.sqrt(m),p(c),p(i)))}}}}if(e.types&m.VERTEX){const e=u?d.length-r:d.length;for(let i=0;i<e;i+=r){const e=g;e.coordsIndex=i;const r=(n.x-e.x)/a,u=(n.y-e.y)/o,c=r*r+u*u;c<=1&&l.candidates.push(h(s.getObjectId(t),p(e),Math.sqrt(c)))}}}return l.candidates.sort(((e,t)=>e.distance-t.distance)),l}_getPointCreator(e,t,s,r,n){const a=(0,i.pC)(n)&&!(0,o.fS)(r,n)?e=>(0,d.iV)(e,r,n):e=>e,{hasZ:l}=this,u=e.m;return t&&s?l?({x:e,y:t,z:s})=>a({x:e,y:t,z:s,m:u}):({x:e,y:t})=>a({x:e,y:t,z:0,m:u}):t?l?({x:e,y:t,z:s})=>a({x:e,y:t,z:s}):({x:e,y:t})=>a({x:e,y:t,z:0}):s?({x:e,y:t})=>a({x:e,y:t,m:u}):({x:e,y:t})=>a({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,minValue:a,maxValue:o,scale:l}=e,c=this.fieldsIndex.isDateField(t),d=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,scale:l}),h=(0,u.S5)({normalizationType:r,normalizationField:i,minValue:a,maxValue:o}),f=this.fieldsIndex.get(t),m={value:.5,fieldType:f?.type},p=(0,y.qN)(f)?(0,u.H0)({values:d,supportsNullCount:h,percentileParams:m}):(0,u.i5)({values:d,minValue:a,maxValue:o,useSampleStdDev:!r,supportsNullCount:h,percentileParams:m});return(0,u.F_)(p,c)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:r,scale:n}=e,a=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:n}),o=(0,u.eT)(a);return(0,u.Qm)(o,i,r,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:c,numClasses:d,scale:h}=e,f=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,scale:h}),m=(0,u.G2)(f,{field:t,normalizationField:i,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:c,numClasses:d});return(0,u.DL)(m,a)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:c,numBins:d,scale:h}=e,f=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,scale:h});return(0,u.oF)(f,{field:t,normalizationField:i,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:c,numBins:d})}_sortFeatures(e,t,s){if(e.length>1&&t&&t.length)for(const i of t.reverse()){const t=i.split(" "),r=t[0],n=this.fieldsIndex.get(r),a=t[1]&&"desc"===t[1].toLowerCase(),o=(0,u.Lq)(n?.type,a);e.sort(((e,t)=>{const i=s(e,r,n),a=s(t,r,n);return o(i,a)}))}}_createFeatureQueryResponse(e){const t=this.items,{geometryType:s,hasM:i,hasZ:r,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:d,resultOffset:h,returnZ:f,returnM:m}=e,p=null!=d&&t.length>(h||0)+d,y=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:p,features:this._createFeatures(e,t),fields:y,geometryType:s,hasM:i&&m,hasZ:r&&f,objectIdFieldName:n,spatialReference:(0,g.S2)(u||o),transform:c&&(0,a.vY)(c)||null}}_createFeatures(e,t){const s=new c(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:r}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:l,returnCentroid:u,maxAllowableOffset:d,resultOffset:h,resultRecordCount:f,returnZ:m=!1,returnM:p=!1}=e,y=r&&m,x=i&&p;let w=[],v=0;const b=[...t];if(this._sortFeatures(b,n,((e,t,i)=>s.getFieldValue(e,t,i))),l||u){const e=(0,a.vY)(o);if(l&&!u)for(const t of b)w[v++]={attributes:s.getAttributes(t),geometry:(0,g.Op)(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),d,e,y,x)};else if(!l&&u)for(const t of b)w[v++]={attributes:s.getAttributes(t),centroid:(0,g.EG)(this,this.featureAdapter.getCentroid(t,this),e)};else for(const t of b)w[v++]={attributes:s.getAttributes(t),centroid:(0,g.EG)(this,this.featureAdapter.getCentroid(t,this),e),geometry:(0,g.Op)(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),d,e,y,x)}}else for(const e of b){const t=s.getAttributes(e);t&&(w[v++]={attributes:t})}const S=h||0;if(null!=f){const e=S+f;w=w.slice(S,Math.min(w.length,e))}return w}_createExceedsLimitQueryResponse(e){let t=!1,s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;for(const t of e.outStatistics)if("exceedslimit"===t.statisticType){s=null!=t.maxPointCount?t.maxPointCount:Number.POSITIVE_INFINITY,r=null!=t.maxRecordCount?t.maxRecordCount:Number.POSITIVE_INFINITY,n=null!=t.maxVertexCount?t.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)t=this.items.length>s;else if(this.items.length>r)t=!0;else{const e=this.hasZ?this.hasM?4:3:this.hasM?3:2,s=this.featureAdapter;t=this.items.reduce(((e,t)=>{const r=s.getGeometry(t);return e+((0,i.pC)(r)&&r.coords.length||0)}),0)/e>n}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(t)}}]}}async _createStatisticsQueryResponse(e){const t={attributes:{}},s=[],i=new Map,r=new Map,n=new Map,a=new Map,o=new c(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:h}=e,f=u&&u.length,m=!!f,p=m&&u[0],g=m&&!this.fieldsIndex.get(p);for(const e of l){const{outStatisticFieldName:l,statisticType:c}=e,h=e,y="exceedslimit"!==c?e.onStatisticField:void 0,x="percentile_disc"===c||"percentile_cont"===c,w="EnvelopeAggregate"===c||"CentroidAggregate"===c||"ConvexHullAggregate"===c,v=m&&1===f&&(y===p||g)&&"count"===c;if(m){if(!n.has(y)){const e=[];for(const t of u){const s=this._getAttributeValues(o,t,i);e.push(s)}n.set(y,this._calculateUniqueValues(e,o.returnDistinctValues))}const e=n.get(y);for(const t in e){const{count:s,data:r,items:n,itemPositions:c}=e[t],f=r.join(",");if(!d||o.validateItems(n,d)){const e=a.get(f)||{attributes:{}};if(w){e.aggregateGeometries||(e.aggregateGeometries={});const{aggregateGeometries:t,outStatisticFieldName:s}=await this._getAggregateGeometry(h,n);e.aggregateGeometries[s]=t}else{let t=null;if(v)t=s;else{const e=this._getAttributeValues(o,y,i),s=c.map((t=>e[t]));t=x&&"statisticParameters"in h?this._getPercentileValue(h,s):this._getStatisticValue(h,s,null,o.returnDistinctValues)}e.attributes[l]=t}u.forEach(((t,s)=>e.attributes[this.fieldsIndex.get(t)?t:`EXPR_${s+1}`]=r[s])),a.set(f,e)}}}else if(w){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(h,this.items);t.aggregateGeometries[s]=e}else{const e=this._getAttributeValues(o,y,i);t.attributes[l]=x&&"statisticParameters"in h?this._getPercentileValue(h,e):this._getStatisticValue(h,e,r,o.returnDistinctValues)}s.push({name:l,alias:l,type:"esriFieldTypeDouble"})}const y=m?Array.from(a.values()):[t];return this._sortFeatures(y,h,((e,t)=>e.attributes[t])),{fields:s,features:y}}async _getAggregateGeometry(e,t){const i=await Promise.all([s.e(5837),s.e(247)]).then(s.bind(s,30247)),{statisticType:a,outStatisticFieldName:o}=e,{featureAdapter:l,spatialReference:u,geometryType:c,hasZ:d,hasM:h}=this,f=t.map((e=>(0,g.Op)(c,d,h,l.getGeometry(e)))),m=i.convexHull(u,f,!0)[0],p={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===a){const e=m?(0,n._w)(m):(0,n.aO)(i.union(u,f));p.aggregateGeometries={...e,spatialReference:u},p.outStatisticFieldName=o||"extent"}else if("CentroidAggregate"===a){const e=m?(0,r.tO)(m):(0,r.$G)((0,n.aO)(i.union(u,f)));p.aggregateGeometries={x:e[0],y:e[1],spatialReference:u},p.outStatisticFieldName=o||"centroid"}else"ConvexHullAggregate"===a&&(p.aggregateGeometries=m,p.outStatisticFieldName=o||"convexHull");return p}_getStatisticValue(e,t,s,i){const{onStatisticField:r,statisticType:n}=e;let a=null;return a=s?.has(r)?s.get(r):(0,y.qN)(this.fieldsIndex.get(r))?(0,u.H0)({values:t,returnDistinct:i}):(0,u.i5)({values:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(r,a),a["var"===n?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:r}=e,{value:n,orderBy:a}=i,o=this.fieldsIndex.get(s);return(0,u.XL)(t,{value:n,orderBy:a,fieldType:o?.type,isDiscrete:"percentile_disc"===r})}_getAttributeValues(e,t,s){if(s.has(t))return s.get(t);const i=this.fieldsIndex.get(t),r=this.items.map((s=>e.getFieldValue(s,t,i)));return s.set(t,r),r}_getAttributeDataValues(e,t){return this.items.map((s=>e.getDataValue(s,{field:t.field,field2:t.field2,field3:t.field3,fieldDelimiter:t.fieldDelimiter,normalizationField:t.normalizationField,normalizationType:t.normalizationType,normalizationTotal:t.normalizationTotal})))}async _getAttributeExpressionValues(e,t,s){const{arcadeUtils:i}=await(0,x.LC)(),r=i.createFunction(t),n=s&&i.getViewInfo(s);return e.getExpressionValues(this.items,r,n,i)}_calculateUniqueValues(e,t){const s={},i=this.items,r=i.length;for(let n=0;n<r;n++){const r=i[n],a=[];for(const t of e)a.push(t[n]);const o=a.join(",");t?null==s[o]&&(s[o]={count:1,data:a,items:[r],itemPositions:[n]}):null==s[o]?s[o]={count:1,data:a,items:[r],itemPositions:[n]}:(s[o].count++,s[o].items.push(r),s[o].itemPositions.push(n))}return s}async _getDataValues(e){const t=new c(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:s,field:i,normalizationField:r,normalizationType:n,normalizationTotal:a,scale:o}=e,l=s?{viewingMode:"map",scale:o,spatialReference:this.query.outSR||this.spatialReference}:null;return s?this._getAttributeExpressionValues(t,s,l):this._getAttributeDataValues(t,{field:i,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,normalizationField:r,normalizationType:n,normalizationTotal:a})}}function v(e,t,s,i){const r=i.x-s.x,n=i.y-s.y,a=r*r+n*n,o=(t.x-s.x)*r+(t.y-s.y)*n,l=Math.min(1,Math.max(0,o/a));e.x=s.x+r*l,e.y=s.y+n*l}(p=m||(m={}))[p.NONE=0]="NONE",p[p.EDGE=1]="EDGE",p[p.VERTEX=2]="VERTEX";class b{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}},62432:(e,t,s)=>{s.d(t,{nu:()=>p,hr:()=>m,Jc:()=>h,G3:()=>g,Of:()=>f,z4:()=>d,hO:()=>c});var i=s(20102),r=s(74669),n=s(41534);const a=new class{constructor(e,t){this._cache=new r.Z(e),this._invalidCache=new r.Z(t)}get(e,t){const s=`${t.uid}:${e}`,i=this._cache.get(s);if(i)return i;if(void 0!==this._invalidCache.get(s))return null;try{const i=n.WhereClause.create(e,t);return this._cache.put(s,i),i}catch{return this._invalidCache.put(s,null),null}}}(50,500),o="feature-store:unsupported-query",l=" as ",u=new Set(["esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeDate"]);function c(e,t){if(!t)return!0;const s=a.get(t,e);if(!s)throw new i.Z(o,"invalid SQL expression",{where:t});if(!s.isStandardized)throw new i.Z(o,"where clause is not standard",{where:t});return f(e,s.fieldNames,"where clause contains missing fields"),!0}function d(e,t,s){if(!t)return!0;const r=a.get(t,e);if(!r)throw new i.Z(o,"invalid SQL expression",{having:t});if(!r.isAggregate)throw new i.Z(o,"having does not contain a valid aggregate function",{having:t});const n=r.fieldNames;if(f(e,n,"having contains missing fields"),!r.getExpressions().every((t=>{const{aggregateType:i,field:r}=t,n=e.has(r)&&e.get(r).name;return s.some((t=>{const{onStatisticField:s,statisticType:r}=t;return(e.has(s)&&e.get(s).name)===n&&r.toLowerCase().trim()===i}))})))throw new i.Z(o,"expressions in having should also exist in outStatistics",{having:t});return!0}function h(e,t){return e?a.get(e,t):null}function f(e,t,s,r=!0){const n=[];for(const s of t)if("*"!==s&&!e.has(s))if(r){const t=m(s);try{const s=h(t,e);if(!s)throw new i.Z(o,"invalid SQL expression",{where:t});if(!s.isStandardized)throw new i.Z(o,"expression is not standard",{clause:s});f(e,s.fieldNames,"expression contains missing fields")}catch(e){const t=e&&e.details;if(t&&(t.clause||t.where))throw e;t&&t.missingFields?n.push(...t.missingFields):n.push(s)}}else n.push(s);if(n.length)throw new i.Z(o,s,{missingFields:n})}function m(e){return e.split(l)[0]}function p(e){return e.split(l)[1]}function g(e,t){const s=t.get(e);return!!s&&!u.has(s.type)}},37427:(e,t,s)=>{s.d(t,{_W:()=>h,iV:()=>p,oj:()=>y});var i=s(70586),r=s(44547),n=s(37455),a=s(8744),o=s(40488);const l=[0,0];function u(e,t){if(!t)return null;if("x"in t){const s={x:0,y:0};return[s.x,s.y]=e(t.x,t.y,l),null!=t.z&&(s.z=t.z),null!=t.m&&(s.m=t.m),s}if("xmin"in t){const s={xmin:0,ymin:0,xmax:0,ymax:0};return[s.xmin,s.ymin]=e(t.xmin,t.ymin,l),[s.xmax,s.ymax]=e(t.xmax,t.ymax,l),t.hasZ&&(s.zmin=t.zmin,s.zmax=t.zmax,s.hasZ=!0),t.hasM&&(s.mmin=t.mmin,s.mmax=t.mmax,s.hasM=!0),s}return"rings"in t?{rings:c(t.rings,e),hasM:t.hasM,hasZ:t.hasZ}:"paths"in t?{paths:c(t.paths,e),hasM:t.hasM,hasZ:t.hasZ}:"points"in t?{points:d(t.points,e),hasM:t.hasM,hasZ:t.hasZ}:null}function c(e,t){const s=[];for(const i of e)s.push(d(i,t));return s}function d(e,t){const s=[];for(const i of e){const e=t(i[0],i[1],[0,0]);s.push(e),i.length>2&&e.push(i[2]),i.length>3&&e.push(i[3])}return s}async function h(e,t){if(!e||!t)return;const s=Array.isArray(e)?e.map((e=>(0,i.pC)(e.geometry)?e.geometry.spatialReference:null)).filter(i.pC):[e];await(0,r.iQ)(s.map((e=>({source:e,dest:t}))))}const f=u.bind(null,o.hG),m=u.bind(null,o.R6);function p(e,t,s,i){if(!e)return e;if(s||(s=t,t=e.spatialReference),!(0,a.JY)(t)||!(0,a.JY)(s)||(0,a.fS)(t,s))return e;if((0,o.Q8)(t,s)){const t=(0,a.sS)(s)?f(e):m(e);return t.spatialReference=s,t}return(0,r.oj)(n.N,[e],t,s,null,i)[0]}const g=new class{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(e,t,s){if(!e||!e.length||!t||!s||(0,a.fS)(t,s))return e;const i={geometries:e,inSpatialReference:t,outSpatialReference:s,resolve:null};return this._jobs.push(i),new Promise((e=>{i.resolve=e,null===this._timer&&(this._timer=setTimeout(this._process,10))}))}_process(){this._timer=null;const e=this._jobs.shift();if(!e)return;const{geometries:t,inSpatialReference:s,outSpatialReference:i,resolve:l}=e;(0,o.Q8)(s,i)?(0,a.sS)(i)?l(t.map(f)):l(t.map(m)):l((0,r.oj)(n.N,t,s,i,null,null)),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}};function y(e,t,s){return g.push(e,t,s)}},11490:(e,t,s)=>{s.d(t,{EG:()=>v,Op:()=>b,S2:()=>F,Up:()=>S,j6:()=>T,vF:()=>p});var i=s(35454),r=s(70586),n=s(67900),a=s(44547),o=s(49600),l=s(33955),u=s(82526),c=s(8744),d=s(98732),h=s(5428),f=s(37427);const m=new i.X({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),p=Object.freeze({}),g=new h.Z,y=new h.Z,x=new h.Z,w={esriGeometryPoint:d.fQ,esriGeometryPolyline:d.J6,esriGeometryPolygon:d.eG,esriGeometryMultipoint:d.Iv};function v(e,t,s,i=e.hasZ,n=e.hasM){if((0,r.Wi)(t))return null;const a=e.hasZ&&i,o=e.hasM&&n;if(s){const r=(0,d.Nh)(x,t,e.hasZ,e.hasM,"esriGeometryPoint",s,i,n);return(0,d.fQ)(r,a,o)}return(0,d.fQ)(t,a,o)}function b(e,t,s,i,n,a,o=t,l=s){const u=t&&o,c=s&&l,h=(0,r.pC)(i)?"coords"in i?i:i.geometry:null;if((0,r.Wi)(h))return null;if(n){let i=(0,d.zj)(y,h,t,s,e,n,o,l);return a&&(i=(0,d.Nh)(x,i,u,c,e,a)),w[e]?.(i,u,c)??null}if(a){const i=(0,d.Nh)(x,h,t,s,e,a,o,l);return w[e]?.(i,u,c)??null}return(0,d.hY)(g,h,t,s,o,l),w[e]?.(g,u,c)??null}async function S(e,t,s){const{outFields:i,orderByFields:r,groupByFieldsForStatistics:n,outStatistics:a}=e;if(i)for(let e=0;e<i.length;e++)i[e]=i[e].trim();if(r)for(let e=0;e<r.length;e++)r[e]=r[e].trim();if(n)for(let e=0;e<n.length;e++)n[e]=n[e].trim();if(a)for(let e=0;e<a.length;e++)a[e].onStatisticField&&(a[e].onStatisticField=a[e].onStatisticField.trim());return e.geometry&&!e.outSR&&(e.outSR=e.geometry.spatialReference),T(e,t,s)}async function T(e,t,i){if(!e)return null;let{where:a}=e;if(e.where=a=a&&a.trim(),(!a||/^1 *= *1$/.test(a)||t&&t===a)&&(e.where=null),!e.geometry)return e;let d=await async function(e){const{distance:t,units:i}=e,r=e.geometry;if(null==t||"vertexAttributes"in r)return r;const a=r.spatialReference,o=i?m.fromJSON(i):(0,n.qE)(a),l=a&&((0,c.sT)(a)||(0,c.sS)(a))?r:await(0,f._W)(a,c.Zn).then((()=>(0,f.iV)(r,c.Zn)));return(await async function(){return(await Promise.all([s.e(5837),s.e(247)]).then(s.bind(s,30247))).geodesicBuffer}())(l.spatialReference,l,t,o)}(e);if(e.distance=0,e.units=null,"esriSpatialRelEnvelopeIntersects"===e.spatialRel){const{spatialReference:t}=e.geometry;d=(0,o.aO)(d),d.spatialReference=t}if(d){await(0,f._W)(d.spatialReference,i),d=function(e,t){const s=e.spatialReference;return _(e,t)&&(0,l.YX)(e)?{spatialReference:s,rings:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}:e}(d,i);const t=(await(0,u.aX)((0,l.im)(d)))[0];if((0,r.Wi)(t))throw p;const s="quantizationParameters"in e&&e.quantizationParameters?.tolerance||"maxAllowableOffset"in e&&e.maxAllowableOffset||0,n=s&&_(d,i)?{densificationStep:8*s}:void 0,a=t.toJSON(),o=await(0,f.iV)(a,a.spatialReference,i,n);if(!o)throw p;o.spatialReference=i,e.geometry=o}return e}function _(e,t){if(!e)return!1;const s=e.spatialReference;return((0,l.YX)(e)||(0,l.oU)(e)||(0,l.l9)(e))&&!(0,c.fS)(s,t)&&!(0,a.Up)(s,t)}function F(e){return e&&I in e?JSON.parse(JSON.stringify(e,C)):e}const I="_geVersion",C=(e,t)=>e!==I?t:void 0},3172:(e,t,s)=>{s.r(t),s.d(t,{default:()=>f});var i=s(68773),r=s(40330),n=s(20102),a=s(80442),o=s(22974),l=s(70586),u=s(95330),c=s(17452),d=s(71058),h=s(85958);async function f(e,t){const o=(0,c.HK)(e),y=(0,c.jc)(e);y||o||(e=(0,c.Fv)(e));const x={url:e,requestOptions:{...(0,l.Wg)(t)}};let w=(0,c.oh)(e);if(w){const e=await async function(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let s,i;try{i=await e.before(t)}catch(e){s=T("request:interceptor",e,t)}if((i instanceof Error||i instanceof n.Z)&&(s=T("request:interceptor",i,t)),s)throw e.error&&e.error(s),s;return i}}(w,x);if(null!=e)return{data:e,getHeader:v,requestOptions:x.requestOptions,url:x.url};w.after||w.error||(w=null)}if(e=x.url,"image"===(t=x.requestOptions).responseType){if((0,a.Z)("host-webworker")||(0,a.Z)("host-node"))throw T("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),x)}else if(o)throw T("request:invalid-parameters",new Error("Data URLs are not supported for responseType = "+t.responseType),x);if("head"===t.method){if(t.body)throw T("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),x);if(o||y)throw T("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),x)}if(await async function(){(0,a.Z)("host-webworker")?m||(m=await s.e(9884).then(s.bind(s,29884))):f._abortableFetch||(f._abortableFetch=globalThis.fetch.bind(globalThis))}(),m)return m.execute(e,t);const b=new AbortController;(0,u.fu)(t,(()=>b.abort()));const S={controller:b,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:w,params:x,redoRequest:!1,useIdentity:p.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},C=await async function(e){let t,s;await async function(e){const t=e.params.url,s=e.params.requestOptions,n=e.controller.signal,a=s.body;let o=null,l=null;if(g&&"HTMLFormElement"in globalThis&&(a instanceof FormData?o=a:a instanceof HTMLFormElement&&(o=new FormData(a))),"string"==typeof a&&(l=a),e.fetchOptions={cache:s.cacheBust&&!f._abortableFetch.polyfill?"no-cache":"default",credentials:"same-origin",headers:s.headers||{},method:"head"===s.method?"HEAD":"GET",mode:"cors",priority:p.priority,redirect:"follow",signal:n},(o||l)&&(e.fetchOptions.body=o||l),"anonymous"===s.authMode&&(e.useIdentity=!1),e.hasToken=!!(/token=/i.test(t)||s.query?.token||o?.get("token")),!e.hasToken&&i.Z.apiKey&&(0,d.r)(t)&&(s.query||(s.query={}),s.query.token=i.Z.apiKey,e.hasToken=!0),e.useIdentity&&!e.hasToken&&!e.credentialToken&&!F(t)&&!(0,u.Hc)(n)){let i;"immediate"===s.authMode?(await _(),i=await r.id.getCredential(t,{signal:n}),e.credential=i):"no-prompt"===s.authMode?(await _(),i=await r.id.getCredential(t,{prompt:!1,signal:n}).catch((()=>{})),e.credential=i):r.id&&(i=r.id.findCredential(t)),i&&(e.credentialToken=i.token,e.useSSL=!!i.ssl)}}(e);try{do{[t,s]=await I(e)}while(!await q(e,t,s))}catch(s){const i=T("request:server",s,e.params,t);throw i.details.ssl=e.useSSL,e.interceptor&&e.interceptor.error&&e.interceptor.error(i),i}const n=e.params.url;if(s&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(n)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!(0,c.kl)(n)){const e=(0,c.P$)(n,!0);e&&p.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&(0,h.Hu)(s.authorizedCrossOriginNoCorsDomains)}const a=e.credential;if(a&&r.id){const e=r.id.findServerInfo(a.server);let t=e&&e.owningSystemUrl;if(t){t=t.replace(/\/?$/,"/sharing");const e=r.id.findCredential(t,a.userId);e&&-1===r.id._getIdenticalSvcIdx(t,e)&&e.resources.unshift(t)}}return{data:s,getHeader:t?e=>t?.headers.get(e):v,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}(S);return w?.after?.(C),C}let m;const p=i.Z.request,g="FormData"in globalThis,y=[499,498,403,401],x=["COM_0056","COM_0057","SB_0008"],w=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],v=()=>null,b=Symbol();function S(e){const t=(0,c.P$)(e);return!t||t.endsWith(".arcgis.com")||f._corsServers.includes(t)||(0,c.kl)(t)}function T(e,t,s,i){let r="Error";const a={url:s.url,requestOptions:s.requestOptions,getHeader:v,ssl:!1};if(t instanceof n.Z)return t.details?(t.details=(0,o.d9)(t.details),t.details.url=s.url,t.details.requestOptions=s.requestOptions):t.details=a,t;if(t){const e=i&&(e=>i.headers.get(e)),s=i&&i.status,n=t.message;n&&(r=n),e&&(a.getHeader=e),a.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||s||0,a.subCode=t.subcode,a.messageCode=t.messageCode,"string"==typeof t.details?a.messages=[t.details]:a.messages=t.details,a.raw=b in t?t[b]:t}return(0,u.D_)(t)?(0,u.zE)():new n.Z(e,r,a)}async function _(){r.id||await Promise.all([s.e(6261),s.e(1400),s.e(1761)]).then(s.bind(s,55142))}function F(e){return w.some((t=>t.test(e)))}async function I(e){let t=e.params.url;const s=e.params.requestOptions,i=e.fetchOptions??{},n=(0,c.jc)(t)||(0,c.HK)(t),o=s.responseType||"json",l=n?0:null!=s.timeout?s.timeout:p.timeout;let d=!1;if(!n){e.useSSL&&(t=(0,c.hO)(t)),s.cacheBust&&"default"===i.cache&&(t=(0,c.ZN)(t,"request.preventCache",Date.now()));let n={...s.query};e.credentialToken&&(n.token=e.credentialToken);let o=(0,c.B7)(n);(0,a.Z)("esri-url-encodes-apostrophe")&&(o=o.replace(/'/g,"%27"));const l=t.length+1+o.length;let u;d="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||l>p.maxUrlLength;const f=s.useProxy||!!(0,c.ed)(t);if(f){const e=(0,c.b7)(t);u=e.path,!d&&u.length+1+l>p.maxUrlLength&&(d=!0),e.query&&(n={...e.query,...n})}if("HEAD"===i.method&&(d||f)){if(d){if(l>p.maxUrlLength)throw T("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw T("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(f)throw T("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(d?(i.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?t=(0,c.fl)(t,n):(i.body=(0,c.B7)(n),i.headers||(i.headers={}),i.headers["Content-Type"]="application/x-www-form-urlencoded")):t=(0,c.fl)(t,n),f&&(e.useProxy=!0,t=`${u}?${t}`),n.token&&g&&i.body instanceof FormData&&!/\/(sharing|usrsvcs)\/(appservices|servers)\//i.test(t)&&i.body.set("token",n.token),s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!(0,c.D6)(t,(0,c.TI)()))if((0,c.kl)(t))e.withCredentials=!0;else if(r.id){const s=r.id.findServerInfo(t);s&&s.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(i.credentials="include",(0,h.jH)(t)&&await(0,h.jz)(d?(0,c.fl)(t,n):t))}let m,y,x=0,w=!1;l>0&&(x=setTimeout((()=>{w=!0,e.controller.abort()}),l));try{if("native-request-init"===s.responseType)y=i,y.url=t;else if("image"!==s.responseType||"default"!==i.cache||"GET"!==i.method||d||function(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}(s.headers)||!n&&!e.useProxy&&p.proxyUrl&&!S(t)){if(m=await f._abortableFetch(t,i),e.useProxy||function(e){const t=(0,c.P$)(e);t&&!f._corsServers.includes(t)&&f._corsServers.push(t)}(t),"native"===s.responseType)y=m;else if("HEAD"!==i.method)if(m.ok){switch(o){case"array-buffer":y=await m.arrayBuffer();break;case"blob":case"image":y=await m.blob();break;default:y=await m.text()}if(x&&(clearTimeout(x),x=0),"json"===o||"xml"===o||"document"===o)if(y)switch(o){case"json":y=JSON.parse(y);break;case"xml":y=C(y,"application/xml");break;case"document":y=C(y,"text/html")}else y=null;if(y){if("array-buffer"===o||"blob"===o){const e=m.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&y["blob"===o?"size":"byteLength"]<=750)try{const e=await new Response(y).json();e.error&&(y=e)}catch{}}"image"===o&&y instanceof Blob&&(y=await E(URL.createObjectURL(y),e,!0))}}else y=await m.text()}else y=await E(t,e)}catch(i){if("AbortError"===i.name){if(w)throw new Error("Timeout exceeded");throw(0,u.zE)("Request canceled")}if(!(!m&&i instanceof TypeError&&p.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||S(t))throw i;e.redoRequest=!0,(0,c.tD)({proxyUrl:p.proxyUrl,urlPrefix:(0,c.P$)(t)??""})}finally{x&&clearTimeout(x)}return[m,y]}function C(e,t){let s;try{s=(new DOMParser).parseFromString(e,t)}catch{}if(!s||s.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return s}async function q(e,t,s){if(e.redoRequest)return e.redoRequest=!1,!1;const i=e.params.requestOptions;if(!t||"native"===i.responseType||"native-request-init"===i.responseType)return!0;let n,a;if(!t.ok)throw n=new Error(`Unable to load ${t.url} status: ${t.status}`),n[b]=s,n;s&&(s.error?n=s.error:"error"===s.status&&Array.isArray(s.messages)&&(n={...s},n[b]=s,n.details=s.messages));let o,l=null;n&&(a=Number(n.code),l=n.hasOwnProperty("subcode")?Number(n.subcode):null,o=n.messageCode,o=o&&o.toUpperCase());const u=i.authMode;if(403===a&&(4===l||n.message&&n.message.toLowerCase().includes("ssl")&&!n.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===a)&&void 0!==a&&y.includes(a)&&!F(e.params.url)&&(403!==a||o&&!x.includes(o)&&(null==l||2===l&&e.credentialToken))){await _();try{const t=await r.id.getCredential(e.params.url,{error:T("request:server",n,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=t,e.credentialToken=t.token,e.useSSL=e.useSSL||t.ssl,!1}catch(t){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;n=t}}if(n)throw n;return!0}function E(e,t,s=!1){const i=t.controller.signal,r=new Image;return t.withCredentials?r.crossOrigin="use-credentials":r.crossOrigin="anonymous",r.alt="",r.fetchPriority=p.priority,r.src=e,(0,h.fY)(r,e,s,i)}f._abortableFetch=null,f._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"]},71058:(e,t,s)=>{s.d(t,{r:()=>n});var i=s(17452);const r=["elevation3d.arcgis.com","js.arcgis.com","jsdev.arcgis.com","jsqa.arcgis.com","static.arcgis.com"];function n(e){const t=(0,i.P$)(e,!0);return!!t&&t.endsWith(".arcgis.com")&&!r.includes(t)&&!e.endsWith("/sharing/rest/generateToken")}},85958:(e,t,s)=>{s.d(t,{Hu:()=>c,fY:()=>l,jH:()=>d,jz:()=>h});var i=s(68773),r=s(80442),n=s(70586),a=s(95330),o=s(17452);function l(e,t,s=!1,i){return new Promise(((o,l)=>{if((0,a.Hc)(i))return void l(u());let c=()=>{f(),l(new Error(`Unable to load ${t}`))},d=()=>{const t=e;f(),o(t)},h=()=>{if(!e)return;const t=e;f(),t.src="",l(u())};const f=()=>{(0,r.Z)("esri-image-decode")||(e.removeEventListener("error",c),e.removeEventListener("load",d)),c=null,d=null,e=null,(0,n.pC)(i)&&i.removeEventListener("abort",h),h=null,s&&URL.revokeObjectURL(t)};(0,n.pC)(i)&&i.addEventListener("abort",h),(0,r.Z)("esri-image-decode")?e.decode().then(d,c):(e.addEventListener("error",c),e.addEventListener("load",d))}))}function u(){try{return new DOMException("Aborted","AbortError")}catch{const e=new Error;return e.name="AbortError",e}}function c(e){i.Z.request.crossOriginNoCorsDomains||(i.Z.request.crossOriginNoCorsDomains={});const t=i.Z.request.crossOriginNoCorsDomains;for(let s of e)s=s.toLowerCase(),/^https?:\/\//.test(s)?t[(0,o.P$)(s)??""]=0:(t[(0,o.P$)("http://"+s)??""]=0,t[(0,o.P$)("https://"+s)??""]=0)}function d(e){const t=i.Z.request.crossOriginNoCorsDomains;if(t){let s=(0,o.P$)(e);if(s)return s=s.toLowerCase(),!(0,o.D6)(s,(0,o.TI)())&&t[s]<Date.now()-36e5}return!1}async function h(e){const t=i.Z.request.crossOriginNoCorsDomains,s=(0,o.P$)(e);t&&s&&(t[s.toLowerCase()]=Date.now());const r=(0,o.mN)(e);e=r.path,"json"===r.query?.f&&(e+="?f=json");try{await fetch(e,{mode:"no-cors",credentials:"include"})}catch{}}}}]);