@arcgis/core 4.34.0-next.93 → 4.34.0-next.94

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 (165) hide show
  1. package/analysis/ElevationProfile/ElevationProfileDisplayUnits.d.ts +4 -0
  2. package/analysis/ElevationProfile/{ElevationProfileUnits.js → ElevationProfileDisplayUnits.js} +1 -1
  3. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +1 -1
  4. package/analysis/ElevationProfile/ElevationProfileViewOptions.js +1 -1
  5. package/analysis/ElevationProfileAnalysis.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/{db5a985ccc6b7d0ad855.js → 176f56de787bf486be9f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{ad67e5eb4b8c0c14cea6.js → 1fc7df018c8f802565a6.js} +1 -1
  9. package/assets/esri/core/workers/chunks/20f4c6d8b310ecab97be.js +1 -0
  10. package/assets/esri/core/workers/chunks/25639559336109ff3df1.js +1 -0
  11. package/assets/esri/core/workers/chunks/26081b6486c623735657.js +1 -0
  12. package/assets/esri/core/workers/chunks/2698f656405876f4bd20.js +1 -0
  13. package/assets/esri/core/workers/chunks/{4660798b3b45dcb5cecb.js → 2b9c9a35a6e1f56920b5.js} +2 -2
  14. package/assets/esri/core/workers/chunks/98381404f2d99a1f9341.js +1 -0
  15. package/assets/esri/core/workers/chunks/{992b1389710d716d3450.js → a410dcf80d17a2383337.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{d9d86cf0500fa29d1d43.js → a98b284b147258629947.js} +1 -1
  17. package/assets/esri/core/workers/chunks/b1ccbc2fef7f7e5e04f7.js +1 -0
  18. package/assets/esri/core/workers/chunks/c4641c2c130c7b8bcdee.js +1 -0
  19. package/assets/esri/core/workers/chunks/c9159ebf930af3f336f3.js +1 -0
  20. package/assets/esri/core/workers/chunks/{8de9e50de0ac66ae1573.js → ce2fcaa21d6efcdf4da5.js} +1 -1
  21. package/assets/esri/core/workers/chunks/d2df6e685d6cffc5f486.js +1 -0
  22. package/assets/esri/core/workers/chunks/{c27783ce7ea51a5e49c5.js → e153b61560a7a869db63.js} +1 -1
  23. package/assets/esri/core/workers/chunks/e2c293331515f3bd0355.js +1 -0
  24. package/assets/esri/core/workers/chunks/ec7b156425f25d231078.js +1 -0
  25. package/assets/esri/core/workers/chunks/fb456e7425e09df17d8c.js +1 -0
  26. package/assets/esri/core/workers/chunks/{f6806780ca2aa591475a.js → fe1dcf9f81da4adbb1fe.js} +1 -1
  27. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  28. package/chunks/WaterSurface.glsl.js +0 -1
  29. package/chunks/bundle.js +1 -1
  30. package/colorUtils.js +1 -1
  31. package/config.js +1 -1
  32. package/interfaces.d.ts +229 -97
  33. package/kernel.js +1 -1
  34. package/layers/GaussianSplatLayer.js +1 -1
  35. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  36. package/layers/graphics/dehydratedFeatureComparison.js +1 -1
  37. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  38. package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
  39. package/networks/UtilityNetwork.js +1 -1
  40. package/networks/support/NetworkSystemLayers.js +1 -1
  41. package/package.json +2 -1
  42. package/popup/content/AttachmentsContent.js +1 -1
  43. package/portal/schemas/definitions.js +1 -1
  44. package/rest/knowledgeGraphService.js +1 -1
  45. package/support/revision.js +1 -1
  46. package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +1 -1
  47. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  48. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  49. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  50. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  51. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +1 -1
  52. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  53. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  54. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  55. package/views/3d/layers/FlowSubView3D.js +1 -1
  56. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  57. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  58. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  59. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  60. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  61. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  62. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  63. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  64. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  65. package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
  66. package/views/PopupView.js +1 -1
  67. package/views/View.js +1 -1
  68. package/views/View2D.js +1 -1
  69. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  70. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  71. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +1 -1
  72. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
  73. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
  74. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  75. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  76. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  77. package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +1 -1
  78. package/views/interactive/snapping/LineSnapper.js +1 -1
  79. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  80. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  81. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  82. package/views/interactive/snapping/snappingUtils.js +1 -1
  83. package/views/popupAdapter.js +5 -0
  84. package/views/webgl/ContextState.js +1 -1
  85. package/views/webgl/RenderingContext.js +1 -1
  86. package/views/webgl/enums.js +1 -1
  87. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  88. package/widgets/Attachments.js +1 -1
  89. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  90. package/widgets/Feature/FeatureMedia/chartCommon.js +1 -1
  91. package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
  92. package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
  93. package/widgets/Feature/FeatureViewModel.js +1 -1
  94. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  95. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  96. package/widgets/Features/FeaturesViewModel.js +1 -1
  97. package/widgets/Legend/LegendViewModel.js +1 -1
  98. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  99. package/widgets/Legend.js +1 -1
  100. package/widgets/Search/SearchResultRenderer.js +1 -1
  101. package/widgets/Search/SearchViewModel.js +1 -1
  102. package/widgets/Search.js +1 -1
  103. package/widgets/support/chartUtilsAm5.js +1 -1
  104. package/assets/esri/core/workers/chunks/0b24a6c06d1becbb6815.js +0 -1
  105. package/assets/esri/core/workers/chunks/19f1bfe815896d4983af.js +0 -1
  106. package/assets/esri/core/workers/chunks/22c3a21bc9f32c429c48.js +0 -1
  107. package/assets/esri/core/workers/chunks/3b2ef975831eb75b40fb.js +0 -1
  108. package/assets/esri/core/workers/chunks/5eb7f6f5121c8830c561.js +0 -1
  109. package/assets/esri/core/workers/chunks/6c3b585b9cb6bb640fb0.js +0 -1
  110. package/assets/esri/core/workers/chunks/8b9a50cfaa5a7df02dad.js +0 -1
  111. package/assets/esri/core/workers/chunks/8ff2daef892881ff2019.js +0 -1
  112. package/assets/esri/core/workers/chunks/a6a2d4602dfeb62e0ecc.js +0 -1
  113. package/assets/esri/core/workers/chunks/c95e6bef8c97cf647869.js +0 -1
  114. package/assets/esri/core/workers/chunks/ce175801937e80e3c487.js +0 -1
  115. package/assets/esri/core/workers/chunks/d71836cf70b9604832f1.js +0 -1
  116. package/chunks/Button.js +0 -5
  117. package/chunks/ColorSet.js +0 -5
  118. package/chunks/DefaultTheme.js +0 -5
  119. package/chunks/LineSeries.js +0 -5
  120. package/chunks/ResponsiveTheme.js +0 -5
  121. package/chunks/Theme.js +0 -5
  122. package/chunks/Tick.js +0 -5
  123. package/chunks/Tooltip.js +0 -5
  124. package/chunks/ar.js +0 -5
  125. package/chunks/bg_BG.js +0 -5
  126. package/chunks/bs_BA.js +0 -5
  127. package/chunks/ca_ES.js +0 -5
  128. package/chunks/chartUtilsAm5.js +0 -5
  129. package/chunks/cs_CZ.js +0 -5
  130. package/chunks/da_DK.js +0 -5
  131. package/chunks/de_CH.js +0 -5
  132. package/chunks/de_DE.js +0 -5
  133. package/chunks/el_GR.js +0 -5
  134. package/chunks/en_CA.js +0 -5
  135. package/chunks/en_US.js +0 -5
  136. package/chunks/es_ES.js +0 -5
  137. package/chunks/et_EE.js +0 -5
  138. package/chunks/fi_FI.js +0 -5
  139. package/chunks/fr_FR.js +0 -5
  140. package/chunks/he_IL.js +0 -5
  141. package/chunks/hr_HR.js +0 -5
  142. package/chunks/hu_HU.js +0 -5
  143. package/chunks/id_ID.js +0 -5
  144. package/chunks/it_IT.js +0 -5
  145. package/chunks/ja_JP.js +0 -5
  146. package/chunks/ko_KR.js +0 -5
  147. package/chunks/lt_LT.js +0 -5
  148. package/chunks/lv_LV.js +0 -5
  149. package/chunks/nb_NO.js +0 -5
  150. package/chunks/nl_NL.js +0 -5
  151. package/chunks/pl_PL.js +0 -5
  152. package/chunks/pt_BR.js +0 -5
  153. package/chunks/pt_PT.js +0 -5
  154. package/chunks/ro_RO.js +0 -5
  155. package/chunks/ru_RU.js +0 -5
  156. package/chunks/sk_SK.js +0 -5
  157. package/chunks/sl_SL.js +0 -5
  158. package/chunks/sr_RS.js +0 -5
  159. package/chunks/sv_SE.js +0 -5
  160. package/chunks/th_TH.js +0 -5
  161. package/chunks/tr_TR.js +0 -5
  162. package/chunks/uk_UA.js +0 -5
  163. package/chunks/vi_VN.js +0 -5
  164. package/chunks/zh_Hans.js +0 -5
  165. package/chunks/zh_Hant.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as o,sync as n,initial as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _}from"../../../chunks/vec32.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as p}from"../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as m}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as y}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import N from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as v}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as b,getIndexCrs as L,findIntersectingNodes as C}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{maxDownloadSlots as V}from"../../../views/3d/support/downloadSlots.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as M}from"../../../views/support/PromiseQueue.js";import{noBudget as F}from"../../../views/support/Scheduler.js";const S=100,P=2,O=1e4,q=1e-4,R=1.2,G=500,U=1.5;let H=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(2);return new v(e,this.layer.customParameters,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(3);return new v(e,this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return b(this.layer)}get crsIndex(){return L(this.layer)}get layer(){return this.layerView.i3slayer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new c,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new M,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new N(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),o(()=>r.quality,()=>this._setCameraDirty(),n),this._updatingHandles.add(()=>2===r.state.mode,t=>{const i=e.contentVisible;i&&this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),i&&this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),f(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e)),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.basemapTerrain:r.elevationProvider,m(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new y(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new x(m(r.viewingMode),t,s,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),()=>!this.indexStreamController.busy,t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=T(e,i),r=T(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();j(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=g();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=E.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(p(e,t,k,this.crsIndex),e=k);const s=this._elevationUpdateNodes;return s.clear(),C(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=q)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=O||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=q)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(O,Math.max(q,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?S:P)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=P)&&(this._downloadingCount<V&&!this.dataStreamController.busy)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=E.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataStreamController,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;Q.clear(),this.layerView.getLoadedNodeIndices(Q);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Q.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),Q.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Q,e,0),!(i&&this._lodDropFactor<1)&&(0===Q.length||(Q.clear(),!1))}markNodeToRemove(e){Q.push(e)}removeMarkedNodes(){this._removeNodes(Q,F,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=j(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&j(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=(t,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const o=this._requiredAttributes,n=await this.reschedule(()=>this._loadAttributes(e,o,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:o,attributeData:n},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,null!=this._index&&this._index.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],H.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],H.prototype,"isGraphics3D",null),e([h({readOnly:!0})],H.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],H.prototype,"indexStreamController",null),e([h({readOnly:!0})],H.prototype,"dataStreamController",null),e([h({readOnly:!0})],H.prototype,"crsVertex",null),e([h({readOnly:!0})],H.prototype,"crsIndex",null),e([h()],H.prototype,"featureTarget",void 0),e([h()],H.prototype,"fixedFeatureTarget",void 0),e([h()],H.prototype,"layerView",void 0),e([h()],H.prototype,"layer",null),e([h()],H.prototype,"_updatingHandles",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"running",void 0),e([h()],H.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],H.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],H.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],H.prototype,"rootNodeVisible",null),H=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],H);const Q=new r({deallocator:null});function j(e,t){return null!=e&&e.length===t.length&&e.every(e=>T(t,e.name)>=0)}function T(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const E={distancePenalty:10},k=g();export{H as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as o,sync as n,initial as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _}from"../../../chunks/vec32.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as p}from"../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as m}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as y}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import N from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as v}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as b,getIndexCrs as L,findIntersectingNodes as C}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{maxDownloadSlots as V}from"../../../views/3d/support/downloadSlots.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as M}from"../../../views/support/PromiseQueue.js";import{noBudget as F}from"../../../views/support/Scheduler.js";const S=100,P=2,O=1e4,q=1e-4,R=1.2,G=500,U=1.5;let H=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(2);return new v(e,this.layer.customParameters,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(3);return new v(e,this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return b(this.layer)}get crsIndex(){return L(this.layer)}get layer(){return this.layerView.i3slayer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new c,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new M,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new N(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),o(()=>r.quality,()=>this._setCameraDirty(),n),this._updatingHandles.add(()=>2===r.state.mode,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),f(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e)),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.basemapTerrain:r.elevationProvider,m(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new y(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new x(m(r.viewingMode),t,s,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),()=>!this.indexStreamController.busy,t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=T(e,i),r=T(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();j(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=g();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=E.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(p(e,t,k,this.crsIndex),e=k);const s=this._elevationUpdateNodes;return s.clear(),C(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=q)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=O||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=q)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(O,Math.max(q,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?S:P)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=P)&&(this._downloadingCount<V&&!this.dataStreamController.busy)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=E.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataStreamController,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;Q.clear(),this.layerView.getLoadedNodeIndices(Q);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Q.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),Q.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Q,e,0),!(i&&this._lodDropFactor<1)&&(0===Q.length||(Q.clear(),!1))}markNodeToRemove(e){Q.push(e)}removeMarkedNodes(){this._removeNodes(Q,F,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=j(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&j(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=(t,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const o=this._requiredAttributes,n=await this.reschedule(()=>this._loadAttributes(e,o,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:o,attributeData:n},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],H.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],H.prototype,"isGraphics3D",null),e([h({readOnly:!0})],H.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],H.prototype,"indexStreamController",null),e([h({readOnly:!0})],H.prototype,"dataStreamController",null),e([h({readOnly:!0})],H.prototype,"crsVertex",null),e([h({readOnly:!0})],H.prototype,"crsIndex",null),e([h()],H.prototype,"featureTarget",void 0),e([h()],H.prototype,"fixedFeatureTarget",void 0),e([h()],H.prototype,"layerView",void 0),e([h()],H.prototype,"layer",null),e([h()],H.prototype,"_updatingHandles",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"running",void 0),e([h()],H.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],H.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],H.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],H.prototype,"rootNodeVisible",null),H=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],H);const Q=new r({deallocator:null});function j(e,t){return null!=e&&e.length===t.length&&e.every(e=>T(t,e.name)>=0)}function T(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const E={distancePenalty:10},k=g();export{H as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{floatEqualAbsolute as e}from"../../core/mathUtils.js";import{equals as n}from"../../geometry/support/spatialReferenceUtils.js";function t(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++){const r=e[t],a=n[t];if(r.length!==a.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==a[e])return!1}return!0}function r(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],n[r]))return!1;return!0}function a(e,t){return e===t||null!=e&&null!=t&&n(e.spatialReference,t.spatialReference)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.m===t.m}function i(t,r,a){return t===r||null!=t&&null!=r&&n(t.spatialReference,r.spatialReference)&&e(t.x,r.x,a)&&e(t.y,r.y,a)&&e(t.z??0,r.z??0,a)&&e(t.m??0,r.m??0,a)}function u(e,t){return e.hasZ===t.hasZ&&e.hasM===t.hasM&&(!!n(e.spatialReference,t.spatialReference)&&r(e.paths,t.paths))}function l(e,t){return e.hasZ===t.hasZ&&e.hasM===t.hasM&&(!!n(e.spatialReference,t.spatialReference)&&r(e.rings,t.rings))}function s(e,r){return e.hasZ===r.hasZ&&e.hasM===r.hasM&&(!!n(e.spatialReference,r.spatialReference)&&t(e.points,r.points))}function f(e,t){return e.hasZ===t.hasZ&&e.hasM===t.hasM&&(!!n(e.spatialReference,t.spatialReference)&&(e.xmin===t.xmin&&e.ymin===t.ymin&&e.zmin===t.zmin&&e.xmax===t.xmax&&e.ymax===t.ymax&&e.zmax===t.zmax))}function c(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(e.type!==n.type)return!1;switch(e.type){case"point":return a(e,n);case"extent":return f(e,n);case"polyline":return u(e,n);case"polygon":return l(e,n);case"multipoint":return s(e,n);case"mesh":return!1;default:return}}function o(e,n){if(e===n)return!0;if(!e||!n)return!1;const t=Object.keys(e),r=Object.keys(n);if(t.length!==r.length)return!1;for(const a of t)if(e[a]!==n[a])return!1;return!0}function h(e,n){return e===n||null!=e&&null!=n&&e.objectId===n.objectId&&(!!c(e.geometry,n.geometry)&&!!o(e.attributes,n.attributes))}export{h as equals,a as pointEquals,i as pointNear};
5
+ import"../../core/has.js";import{floatEqualAbsolute as e}from"../../core/mathUtils.js";import{equals as n}from"../../geometry/support/spatialReferenceUtils.js";function t(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++){const r=e[t],a=n[t];if(r.length!==a.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==a[e])return!1}return!0}function r(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],n[r]))return!1;return!0}function a(e,t){return e===t||null!=e&&null!=t&&n(e.spatialReference,t.spatialReference)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.m===t.m}function i(t,r,a){return t===r||null!=t&&null!=r&&n(t.spatialReference,r.spatialReference)&&e(t.x,r.x,a)&&e(t.y,r.y,a)&&e(t.z??0,r.z??0,a)&&e(t.m??0,r.m??0,a)}function u(e,t){return e.hasZ===t.hasZ&&e.hasM===t.hasM&&(!!n(e.spatialReference,t.spatialReference)&&r(e.paths,t.paths))}function l(e,t){return e.hasZ===t.hasZ&&e.hasM===t.hasM&&(!!n(e.spatialReference,t.spatialReference)&&r(e.rings,t.rings))}function s(e,r){return e.hasZ===r.hasZ&&e.hasM===r.hasM&&(!!n(e.spatialReference,r.spatialReference)&&t(e.points,r.points))}function f(e,t){return e.hasZ===t.hasZ&&e.hasM===t.hasM&&(!!n(e.spatialReference,t.spatialReference)&&(e.xmin===t.xmin&&e.ymin===t.ymin&&e.zmin===t.zmin&&e.xmax===t.xmax&&e.ymax===t.ymax&&e.zmax===t.zmax))}function c(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(e.type!==n.type)return!1;switch(e.type){case"point":return a(e,n);case"extent":return f(e,n);case"polyline":return u(e,n);case"polygon":return l(e,n);case"multipoint":return s(e,n);case"mesh":return!1;default:return}}function o(e,n){if(e===n)return!0;if(!e||!n)return!1;const t=Object.keys(e),r=Object.keys(n);if(t.length!==r.length)return!1;for(const a of t)if(e[a]!==n[a])return!1;return!0}function h(e,n){return e===n||null!=e&&null!=n&&e.objectId===n.objectId&&(!!c(e.geometry,n.geometry)&&!!o(e.attributes,n.attributes))}export{h as equals,c as geometryEquals,a as pointEquals,i as pointNear};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as r}from"../../../core/mathUtils.js";import{clone as a,zeros as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as i}from"../../../chunks/vec32.js";import o from"../../../geometry/Point.js";import{isElevationSource as n}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPointPanoramic as c,rectifyMapPoint as s}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as f,hasAngles as l,convertPixelToHeadingPitch as m,isElevationSampler as p,reducerFn as y,validatePixelsToTransform as u,validateRotationMatrix as h,computeFarplaneVertices as d,computeHFOVAndVFOV as g,vecToPoint as w,or as v,isUpdateElevationWithElevationSource as x,scaleWithFactor as M,scaleAndAddWithFactor as A,computeNewReferenceCoordinates as P,projectiveTransform as j}from"./utils.js";import{worldToImage as R}from"./worldToImage.js";import{viewingLimit as V}from"../../../widgets/OrientedImageryViewer/constants.js";async function F(e,r,a){const{verticalFieldOfView:t,imageBoundaries:i,scalingFactor:o,farPlaneVertices:n,cameraLocation:c,pixelsToTransform:s,vecToPoint:f}=q(e,r),l=new Array;return await T(s,n,i,f,r,l,c,o,t,a),Array.isArray(e)?l:l[0]}async function T(e,r,a,t,i,o,n,c,f,l){let m=i.averageElevation;for(const y of e){const e=L(r,a,y,t,i);if(l&&v(p(l.elevationSample),x(l))){m=(await s(t(e),{x:y[0],y:y[1]},{...i,...l,farPlaneVertices:r.map(t)}))[2]}o.push(t(O(e,n,c,m,i.cameraPitch,f)))}}function O(e,r,o,n,c,s){let f=a(e);const l=Math.sqrt((e[2]-r[2])**2+(Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)/o)**2)*o,m=M(i(t(),e,r),1/l,1/o);if(b(e[2],n,c,s)){const e=Math.abs((r[2]-n)/-m[2])*o;f=A(r,m,e,o)}else f[2]=n;return f}function b(e,r,a,t){return e<r||a+t/2<V}function L(e,r,a,t,i){let o=null;const n=9;let c,s=0,f=e,l=r;for(;s<=n;){const e=S(a,l,f,i);if(c=e.error,o=e.transformedPoint,v(c<=1,s===n))break;f=P(f,c,a,r),l=E(f,t,i),s++}return o}function E(e,r,a){return R(e.map(r),a).map(({x:e,y:r})=>[e,r,1])}function S(e,r,a,t){const{cameraLocation:i}=t,n=j(e,r,a),{x:c,y:s}=R(new o(n,i.spatialReference),t);return{transformedPoint:n,error:k(e,[c,s,1])}}function k(e,r){return Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])}function q(r,a){const t=e(r)||"items"in r?r:[r],{cameraLocation:i,rotationMatrix:n}=a;if(u(t,i),h(n),9!==n?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=f(i.y,i.spatialReference),s=d({...a,scalingFactor:c}),l=R(s.map(e=>new o(e,i.spatialReference)),a),{vfov:m}=g(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:i.toArray(),imageBoundaries:l.map(({x:e,y:r})=>[e,r,1]),verticalFieldOfView:m,farPlaneVertices:s,scalingFactor:c,pixelsToTransform:t.map(e=>[e.x,e.y,1]),vecToPoint:w(i.spatialReference)}}async function B(e,a,t){const{cameraHeading:i,cameraLocation:s,farDistance:u,imageHeight:h,imageWidth:d,verticalFieldOfView:g}=a,w=f(s.y,s.spatialReference),v=u*w,x=new Array,[M,A,P]=s.toArray(),j=Array.isArray(e)?e:[e];for(const f of j){let e,j;if(l(f))e=f.heading,j=f.pitch;else{const r=m({x:f.x,y:f.y},d,h);e=r.heading,j=r.pitch}e=(e+i)%360;const R=[M+Math.sin(r(e))*Math.sin(r(j))*v,A+Math.cos(r(e))*Math.sin(r(j))*v,P+-Math.cos(r(j))*u];let V=a.averageElevation;if(t&&(n(t)||p(t.elevationSample))){V=(await c(new o(R,s.spatialReference),{heading:e,pitch:j},{...a,...t,farPlaneVertices:y(u,u).map(([e,r])=>new o([s.x+e,s.y+r],s.spatialReference))}))[2]}x.push(new o(O(R,s.toArray(),w,V,j,g),s.spatialReference))}return Array.isArray(e)?x:x[0]}export{F as imageToWorld,B as imageToWorldPanoramic};
5
+ import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as a,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{isElevationSource as n}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPointPanoramic as o,rectifyMapPoint as c}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as f,convertPixelToHeadingPitch as l,isElevationSampler as m,reducerFn as p,validatePixelsToTransform as h,validateRotationMatrix as u,computeFarplaneVertices as y,computeHFOVAndVFOV as d,vecToPoint as w,or as g,isUpdateElevationWithElevationSource as v,scaleAndAddWithFactor as x,computeNewReferenceCoordinates as M,projectiveTransform as R}from"./utils.js";import{worldToImage as A}from"./worldToImage.js";import{viewingLimit as P}from"../../../widgets/OrientedImageryViewer/constants.js";async function V(e,t,a){const{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:n,farPlaneVertices:o,cameraLocation:c,pixelsToTransform:s,vecToPoint:f,pixelDepths:l}=S(e,t),m=new Array;return await j(s,o,i,f,t,m,c,n,r,a,l),Array.isArray(e)?m:m[0]}async function j(e,t,a,r,n,o,s,f,l,p,h){let u=n.averageElevation,y=0;for(const d of e){const e=L(t,a,d,r,n),w=h?.at(y);if("number"==typeof w){const t=F(e,s,f),a=w*f,r=[s[0]+t[0]*a,s[1]+t[1]*a,s[2]+t[2]*w];o.push(new i(r,n.cameraLocation.spatialReference));continue}if(y+=1,p&&g(m(p.elevationSample),v(p))){u=(await c(r(e),{x:d[0],y:d[1]},{...n,...p,farPlaneVertices:t.map(r)}))[2]}o.push(r(b(e,s,f,u,n.cameraPitch,l)))}}function F(e,t,a){const i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2],c=Math.hypot(i,n)/a,s=Math.hypot(o,c)*a,f=r();return f[0]=i/s,f[1]=n/s,f[2]=o/s,f[2]=f[2]*a,f}function b(e,t,r,i,n,o){let c=a(e);const s=F(e,t,r);if(T(e[2],i,n,o)){const e=Math.abs((t[2]-i)/-s[2])*r;c=x(t,s,e,r)}else c[2]=i;return c}function T(e,t,a,r){return e<t||a+r/2<P}function L(e,t,a,r,i){let n=null;const o=9;let c,s=0,f=e,l=t;for(;s<=o;){const e=D(a,l,f,i);if(c=e.error,n=e.transformedPoint,g(c<=1,s===o))break;f=M(f,c,a,t),l=O(f,r,i),s++}return n}function O(e,t,a){return A(e.map(t),a).map(({x:e,y:t})=>[e,t,1])}function D(e,t,a,r){const{cameraLocation:n}=r,o=R(e,t,a),{x:c,y:s}=A(new i(o,n.spatialReference),r);return{transformedPoint:o,error:E(e,[c,s,1])}}function E(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function S(t,a){const r=e(t)||"items"in t?t:[t],{cameraLocation:n,rotationMatrix:o}=a;if(h(r,n),u(o),9!==o?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=s(n.y,n.spatialReference),f=y({...a,scalingFactor:c}),l=A(f.map(e=>new i(e,n.spatialReference)),a),{vfov:m}=d(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:n.toArray(),imageBoundaries:l.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:m,farPlaneVertices:f,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:w(n.spatialReference),pixelDepths:r.map(e=>B(e)?e.depth:void 0)}}function B(e){return"depth"in e&&"number"==typeof e.depth}async function H(e,a,r){const{cameraHeading:c,cameraLocation:h,farDistance:u,imageHeight:y,imageWidth:d,verticalFieldOfView:w}=a,g=s(h.y,h.spatialReference),v=u*g,x=new Array,[M,R,A]=h.toArray(),P=Array.isArray(e)?e:[e];for(const s of P){let e,P;const V=B(s),j=V?s.depth*g:v;if(f(s))e=s.heading,P=s.pitch;else{const t=l({x:s.x,y:s.y},d,y);e=t.heading,P=t.pitch}e=(e+c)%360;const F=[M+Math.sin(t(e))*Math.sin(t(P))*j,R+Math.cos(t(e))*Math.sin(t(P))*j,A+-Math.cos(t(P))*(V?s.depth:u)];if(V){x.push(new i(F,h.spatialReference));continue}let T=a.averageElevation;if(r&&(n(r)||m(r.elevationSample))){T=(await o(new i(F,h.spatialReference),{heading:e,pitch:P},{...a,...r,farPlaneVertices:p(u,u).map(([e,t])=>new i([h.x+e,h.y+t],h.spatialReference))}))[2]}x.push(new i(b(F,h.toArray(),g,T,P,w),h.spatialReference))}return Array.isArray(e)?x:x[0]}export{V as imageToWorld,H as imageToWorldPanoramic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{eachAlways as s}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../geometry/Extent.js";import a from"../../../geometry/SpatialReference.js";import l from"../DimensionalDefinition.js";import n from"../RasterInfo.js";import m from"./BaseRaster.js";import{getSliceIndex as c}from"./multidimensionalUtils.js";import{clipTile as p,split as u}from"../rasterFunctions/pixelUtils.js";import{estimateStatisticsHistograms as h,computeStatisticsHistograms as d}from"../rasterFunctions/stretchUtils.js";let f=class extends m{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.source=null}get url(){return""}fetchRawTile(t,e,s,i={}){if(!this._pixelBlockTiles){const{rasterInfo:r}=this,[o,a]=r.storageInfo.tileInfo.size,{sliceId:l}=i,{pixelBlocks:n}=this.source,m={pixelBlock:null==l?n[0]:n[l],useBilinear:"thematic"!==r.dataType,tileSize:{width:o,height:a},level:t,row:e,col:s},c=this.rasterJobHandler?this.rasterJobHandler.clipTile(m,i):p(m);return Promise.resolve(c)}const r=this._pixelBlockTiles.get(`${t}/${e}/${s}`);return Promise.resolve(r)}async _open(t){const e=this.source,{pixelBlocks:s,attributeTable:i,statistics:r,histograms:l,name:m,nativeExtent:c,transform:p}=e,u=s[0],{width:h,height:d,pixelType:f}=u,g=e.extent??new o({xmin:-.5,ymin:.5,xmax:h-.5,ymax:d-.5,spatialReference:new a({wkid:3857})}),x=e.isPseudoSpatialReference??!e.extent,y={x:g.width/h,y:g.height/d},b={...e.keyProperties};i&&(b.DataType="Thematic");const v=new n({width:h,height:d,pixelType:f,extent:g,nativeExtent:c,attributeTable:i,transform:p,pixelSize:y,spatialReference:g.spatialReference,bandCount:u.pixels.length,keyProperties:b,multidimensionalInfo:e.multidimensionalInfo,statistics:r,isPseudoSpatialReference:x,histograms:l});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(v),this.createRemoteDatasetStorageInfo(v,512,512),this._set("rasterInfo",v),this.updateTileInfo(),v.multidimensionalInfo?await this._buildMDimStats(e.pixelBlocks,v.multidimensionalInfo):await this._buildInMemoryRaster(u,{width:512,height:512},t),v.multidimensionalInfo||(this.source=null),this.datasetName=m}async _buildInMemoryRaster(t,i,r){const{rasterInfo:o}=this,a=o.storageInfo.maximumPyramidLevel??0,l="thematic"!==o.dataType,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:t,tileSize:i,maximumPyramidLevel:a,useBilinear:l},r):Promise.resolve(u(t,i,a,l)),m=null!=o.statistics,c=null!=o.histograms,p=this.ioConfig.skipStatistics||m?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:t},r):Promise.resolve(h(t)),d=await s([n,p]);if(!d[0].value&&d[1].value)throw new e("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=d[0].value,m||(o.statistics=d[1].value?.statistics),c||(o.histograms=d[1].value?.histograms)}async _buildMDimStats(t,e,s){for(let i=0;i<e.variables.length;i++){const r=e.variables[i];if(r.statistics)continue;const o=r.dimensions.map(t=>new l({variableName:r.name,dimensionName:t.name,values:[t.values?.[0]??t.extent?.[0]],isSlice:!0})),a=c(o,e),n=null==a?null:t[a];if(null==n)continue;const m=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:n},s):d(n);r.statistics=m.statistics,r.histograms||(r.histograms=m.histograms)}}};t([i({type:String,json:{write:!0}})],f.prototype,"datasetFormat",void 0),t([i()],f.prototype,"source",void 0),t([i()],f.prototype,"url",null),f=t([r("esri.layers.support.rasterDatasets.InMemoryRaster")],f);const g=f;export{g as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{eachAlways as s}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../geometry/Extent.js";import a from"../../../geometry/SpatialReference.js";import l from"../DimensionalDefinition.js";import n from"../RasterInfo.js";import m from"./BaseRaster.js";import{getSliceIndex as p}from"./multidimensionalUtils.js";import{clipTile as c,split as u}from"../rasterFunctions/pixelUtils.js";import{estimateStatisticsHistograms as h,computeStatisticsHistograms as d}from"../rasterFunctions/stretchUtils.js";let f=class extends m{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.source=null}get url(){return""}fetchRawTile(t,e,s,i={}){if(!this._pixelBlockTiles){const{rasterInfo:r}=this,[o,a]=r.storageInfo.tileInfo.size,{sliceId:l}=i,{pixelBlocks:n}=this.source,m={pixelBlock:null==l?n[0]:n[l],useBilinear:"thematic"!==r.dataType,tileSize:{width:o,height:a},level:t,row:e,col:s},p=this.rasterJobHandler?this.rasterJobHandler.clipTile(m,i):c(m);return Promise.resolve(p)}const r=this._pixelBlockTiles.get(`${t}/${e}/${s}`);return Promise.resolve(r)}async _open(t){const e=this.source,{pixelBlocks:s,attributeTable:i,statistics:r,histograms:l,name:m,nativeExtent:p,transform:c,colormap:u}=e,h=s[0],{width:d,height:f,pixelType:g}=h,x=e.extent??new o({xmin:-.5,ymin:.5,xmax:d-.5,ymax:f-.5,spatialReference:new a({wkid:3857})}),y=e.isPseudoSpatialReference??!e.extent,b={x:x.width/d,y:x.height/f},I={...e.keyProperties};e.dataType&&(I.DataType=e.dataType),e.bandInfos&&(I.BandProperties=e.bandInfos.map(t=>t.toJSON())),i&&(I.DataType="Thematic");const v=new n({width:d,height:f,pixelType:g,extent:x,nativeExtent:p,attributeTable:i,colormap:u,transform:c,pixelSize:b,spatialReference:x.spatialReference,bandCount:h.pixels.length,keyProperties:I,multidimensionalInfo:e.multidimensionalInfo,statistics:r,isPseudoSpatialReference:y,histograms:l});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(v),this.createRemoteDatasetStorageInfo(v,512,512),this._set("rasterInfo",v),this.updateTileInfo(),v.multidimensionalInfo?await this._buildMDimStats(e.pixelBlocks,v.multidimensionalInfo):await this._buildInMemoryRaster(h,{width:512,height:512},t),v.multidimensionalInfo||(this.source=null),this.datasetName=m}async _buildInMemoryRaster(t,i,r){const{rasterInfo:o}=this,a=o.storageInfo.maximumPyramidLevel??0,l="thematic"!==o.dataType,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:t,tileSize:i,maximumPyramidLevel:a,useBilinear:l},r):Promise.resolve(u(t,i,a,l)),m=null!=o.statistics,p=null!=o.histograms,c=this.ioConfig.skipStatistics||m?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:t},r):Promise.resolve(h(t)),d=await s([n,c]);if(!d[0].value&&d[1].value)throw new e("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=d[0].value,m||(o.statistics=d[1].value?.statistics),p||(o.histograms=d[1].value?.histograms)}async _buildMDimStats(t,e,s){for(let i=0;i<e.variables.length;i++){const r=e.variables[i];if(r.statistics)continue;const o=r.dimensions.map(t=>new l({variableName:r.name,dimensionName:t.name,values:[t.values?.[0]??t.extent?.[0]],isSlice:!0})),a=p(o,e),n=null==a?null:t[a];if(null==n)continue;const m=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:n},s):d(n);r.statistics=m.statistics,r.histograms||(r.histograms=m.histograms)}}};t([i({type:String,json:{write:!0}})],f.prototype,"datasetFormat",void 0),t([i()],f.prototype,"source",void 0),t([i()],f.prototype,"url",null),f=t([r("esri.layers.support.rasterDatasets.InMemoryRaster")],f);const g=f;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Graphic.js";import{unique as r}from"../core/arrayUtils.js";import s from"../core/Error.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{watch as i}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import l from"../layers/FeatureLayer.js";import{queryAllJSON as u}from"../layers/support/featureQueryAll.js";import d from"./Network.js";import m from"./RulesTable.js";import c from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as y}from"./support/networkFieldUtils.js";import h from"./support/NetworkSystemLayers.js";import p from"./support/TerminalConfiguration.js";import f from"./support/TraceJobInfo.js";import{AssociationTypeEnum as I,associationTypeKebabDict as w,nullGuid as g}from"./support/typeUtils.js";import{doesRuleAllowAssociation as b}from"./support/utils.js";import T from"../rest/networks/support/TelecomNetworkElement.js";import k from"../rest/support/Query.js";let S=class extends d{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._circuitManagerMap=new Map,this._terminalById=new Map,this._unitIdentifierManager=null}initialize(){this.addHandles(i(()=>[this.gdbVersion,this.historicMoment],()=>{this.networkSystemLayers.associationsTable&&(this.networkSystemLayers.associationsTable.gdbVersion!==this.gdbVersion&&(this.networkSystemLayers.associationsTable.gdbVersion=this.gdbVersion),this.networkSystemLayers.associationsTable.historicMoment!==this.historicMoment&&(this.networkSystemLayers.associationsTable.historicMoment=this.historicMoment))}))}get _rulesLayer(){const{gdbVersion:e,historicMoment:t}=this,r=this.networkSystemLayers.rulesTableUrl;return new l({url:r,gdbVersion:e,historicMoment:t})}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map(t=>{t?.edgeSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}),t?.junctionSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})}),e}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new h({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map(e=>p.fromJSON(e))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map(e=>e.domainNetworkName)||[]}get hasTelecomNetwork(){return this.dataElement?.domainNetworks.some(e=>e.isTelecomNetwork)??!1}get associationsTable(){return this.networkSystemLayers.associationsTable}async load(e){return this.addResolvingPromise(this._load(e)),this}async _load(e){await super._load(e),await Promise.all([this._loadNamedTraceConfigurationsFromNetwork(e),this.networkSystemLayers.loadAssociationsTable(e)])}getTerminalConfiguration(e){let t=null,r=null;const s=e.sourceLayer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const i=e.attributes;if(null==i)return null;for(const l of Object.keys(i))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let a=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find(e=>e.layerId===o);if(e){const s=e.assetGroups?.find(e=>e.assetGroupCode===t);if(s){const e=s.assetTypes?.find(e=>e.assetTypeCode===r);if(e?.isTerminalConfigurationSupported){a=e.terminalConfigurationId;break}}}}if(null!=a){const e=this.dataElement.terminalConfigurations,t=e?.find(e=>e.terminalConfigurationId===a);return t?p.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e);return t?.tiers?.map(e=>e.name)||[]}async getRulesTable(){const e=this._rulesLayer;e.loaded||await e.load();const t=this.dataElement?.domainNetworks;if(!t)return null;const r=t.flatMap(e=>[...e.edgeSources||[],...e.junctionSources||[]]),s=(await this._queryRulesTable(e)).map(t=>this._hydrateRuleInfo(e,r,t));return new m({rulesLayer:e,rules:s})}async getCircuitManager(e){if(!this.hasTelecomNetwork)return null;const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e&&t.isTelecomNetwork);if(!t)return null;const{default:r}=await import("./CircuitManager.js");return o(this._circuitManagerMap,e,()=>new r({utilityNetwork:this,telecomDomainNetwork:t}))}async getUnitIdentifierManager(){if(!this.hasTelecomNetwork)return null;if(this._unitIdentifierManager)return this._unitIdentifierManager;const{default:e}=await import("./UnitIdentifierManager.js");return this._unitIdentifierManager=new e({utilityNetwork:this}),this._unitIdentifierManager}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach(e=>{e.terminals.forEach(e=>{this._terminalById.set(e.id,e)})}),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?null!=e.layerId&&this._utilityLayerList.has(e.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new f({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;const{fromNetworkElement:r,toNetworkElement:s}=e;if(!r||!s)return!1;await t.load();let o=null;switch(e.associationType){case"containment":o=t.rulesCategorized.containment;break;case"attachment":o=t.rulesCategorized.attachment;break;default:o=t.rulesCategorized.connectivity}return o.some(e=>b(e,r,s))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:o,fromTerminalId:i,fromFirstUnit:a,fromNumUnits:n,toNetworkSourceId:l,toGlobalId:u,toTerminalId:d,toFirstUnit:m,toNumUnits:c,associationType:h,isContentVisible:p,percentAlong:f,globalId:w}=y(r);return{addFeatures:e.map(e=>{const r=new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[o]:e.fromNetworkElement?.globalId,[i]:e.fromNetworkElement?.terminalId,[l]:e.toNetworkElement?.networkSourceId,[u]:e.toNetworkElement?.globalId,[d]:e.toNetworkElement?.terminalId,[h]:I[e.associationType],[p]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[f]:e.percentAlong,[w]:e.globalId}});return e.fromNetworkElement instanceof T&&(r.attributes[a]=e.fromNetworkElement?.firstUnit,r.attributes[n]=e.fromNetworkElement?.numUnits),e.toNetworkElement instanceof T&&(r.attributes[m]=e.toNetworkElement?.firstUnit,r.attributes[c]=e.toNetworkElement?.numUnits),r}),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:r?.globalIdField??"globalid",objectIdField:r?.objectIdField??"objectid"}}}generateDeleteAssociations(e){const{associationsTable:t,associationsTableId:r}=this.networkSystemLayers,s={id:r,identifierFields:{globalIdField:t?.globalIdField??"globalid",objectIdField:t?.objectIdField??"objectid"}};if(-8===this.dataElement?.schemaGeneration){const t=this._generateDeleteTelecomAssociationPayload(e);return{...s,deleteAssociations:t}}const o=e.map(e=>({globalId:e.globalId}));return{...s,deleteFeatures:o}}generateCombineNetworkElements(e){return{id:this._ensureSingleSourceIdAsValidLayerId(e),combineGroupedObjects:[{globalIds:e.map(e=>e.globalId)}]}}generateDivideNetworkElements(e,t){return{id:this._ensureSingleSourceIdAsValidLayerId([e]),divideGroupedObjects:[{globalId:e.globalId,numUnits:t}]}}async loadAssociationsTable(){return this.networkSystemLayers.loadAssociationsTable()}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map(e=>e.globalId),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find(e=>e.globalId===s.globalId);if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),i=s.get("CREATIONDATE"),a=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),h=s.get("VIANETWORKSOURCEID"),p=s.get("VIAASSETGROUP"),f=s.get("VIAASSETTYPE"),I=s.get("VIATERMINALID"),w=r.attributes[o.name],g=new Date(r.attributes[i.name]),b=[{networkSourceId:r.attributes[a.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[h.name],assetGroupId:r.attributes[p.name],assetTypeId:r.attributes[f.name],terminalId:r.attributes[I.name]}],T={ruleType:w,creationDate:g};for(const k of[0,1,2]){if(5!==w&&2===k)continue;const e=b[k],r=t.find(t=>t.sourceId===e.networkSourceId),s=r?.assetGroups.find(t=>t.assetGroupCode===e.assetGroupId),o=s?.assetTypes.find(t=>t.assetTypeCode===e.assetTypeId),i=this._getTerminal(o,e);let a="";switch(k){case 0:a="from";break;case 1:a="to";break;case 2:a="via"}T[`${a}NetworkSource`]=r,T[`${a}AssetGroup`]=s,T[`${a}AssetType`]=o,T[`${a}Terminal`]=i?.toJSON()}return T}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find(e=>e.id===r);return s?.terminals?.find(e=>e.id===t.terminalId)??null}async _queryRulesTable(e){const{gdbVersion:t,historicMoment:r}=this,s=new k({where:"1=1",outFields:["*"],gdbVersion:t,historicMoment:r});return(await u(e,s)).features}_generateDeleteTelecomAssociationPayload(e){return e.map(e=>({globalId:e.globalId??g,associationType:w.toJSON(e.associationType),fromSourceId:e.fromNetworkElement.networkSourceId,fromGlobalId:e.fromNetworkElement.globalId,fromTerminalId:e.fromNetworkElement.terminalId,toSourceId:e.toNetworkElement.networkSourceId,toGlobalId:e.toNetworkElement.globalId,toTerminalId:e.toNetworkElement.terminalId}))}_ensureSingleSourceIdAsValidLayerId(e){const t=r(e.map(e=>e.networkSourceId));if(t.length>1)throw new s("utility-network:invalid-source-id","'networkSourceId' is not valid. Ensure that all network elements have the same 'networkSourceId' and that it corresponds to a valid layer in the utility network.");const o=t[0],i=this.getLayerIdBySourceId(o);if(null==i)throw new s("utility-network:invalid-source-id","'networkSourceId' is not valid. Ensure that all network elements have the same 'networkSourceId' and that it corresponds to a valid layer in the utility network.");return i}};e([a({readOnly:!0})],S.prototype,"_rulesLayer",null),e([a({type:[c],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],S.prototype,"sharedNamedTraceConfigurations",void 0),e([a({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],S.prototype,"type",void 0),e([a({readOnly:!0})],S.prototype,"serviceTerritoryFeatureLayerId",null),e([a({readOnly:!0})],S.prototype,"networkSystemLayers",null),e([a({readOnly:!0})],S.prototype,"terminalConfigurations",null),e([a({readOnly:!0})],S.prototype,"domainNetworkNames",null),e([a({readOnly:!0})],S.prototype,"hasTelecomNetwork",null),e([a({readOnly:!0,json:{read:!1}})],S.prototype,"associationsTable",null),S=e([n("esri.networks.UtilityNetwork")],S);const N=S;export{N as default};
5
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import{unique as r}from"../core/arrayUtils.js";import s from"../core/Error.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{watch as i}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import l from"../layers/FeatureLayer.js";import{queryAllJSON as u}from"../layers/support/featureQueryAll.js";import d from"./Network.js";import m from"./RulesTable.js";import c from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as y}from"./support/networkFieldUtils.js";import h from"./support/NetworkSystemLayers.js";import p from"./support/TerminalConfiguration.js";import f from"./support/TraceJobInfo.js";import{AssociationTypeEnum as w,associationTypeKebabDict as I,nullGuid as b}from"./support/typeUtils.js";import{doesRuleAllowAssociation as g}from"./support/utils.js";import k from"../rest/networks/support/TelecomNetworkElement.js";import T from"../rest/support/Query.js";let S=class extends d{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._circuitManagerMap=new Map,this._terminalById=new Map,this._unitIdentifierManager=null}initialize(){this.addHandles(i(()=>[this.gdbVersion,this.historicMoment],()=>{this.networkSystemLayers.associationsTable&&(this.networkSystemLayers.associationsTable.gdbVersion!==this.gdbVersion&&(this.networkSystemLayers.associationsTable.gdbVersion=this.gdbVersion),this.networkSystemLayers.associationsTable.historicMoment!==this.historicMoment&&(this.networkSystemLayers.associationsTable.historicMoment=this.historicMoment))}))}get _rulesLayer(){const{gdbVersion:e,historicMoment:t}=this,r=this.networkSystemLayers.rulesTableUrl;return new l({url:r,gdbVersion:e,historicMoment:t})}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map(t=>{t?.edgeSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}),t?.junctionSources?.map(({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})}),e}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new h({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map(e=>p.fromJSON(e))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map(e=>e.domainNetworkName)||[]}get hasTelecomNetwork(){return this.dataElement?.domainNetworks.some(e=>e.isTelecomNetwork)??!1}get associationsTable(){return this.networkSystemLayers.associationsTable}async load(e){return this.addResolvingPromise(this._load(e)),this}async _load(e){await super._load(e),await Promise.all([this._loadNamedTraceConfigurationsFromNetwork(e),this.networkSystemLayers.loadAssociationsTable(e)])}getTerminalConfiguration(e){let t=null,r=null;const s=e.sourceLayer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const i=e.attributes;if(null==i)return null;for(const l of Object.keys(i))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let a=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find(e=>e.layerId===o);if(e){const s=e.assetGroups?.find(e=>e.assetGroupCode===t);if(s){const e=s.assetTypes?.find(e=>e.assetTypeCode===r);if(e?.isTerminalConfigurationSupported){a=e.terminalConfigurationId;break}}}}if(null!=a){const e=this.dataElement.terminalConfigurations,t=e?.find(e=>e.terminalConfigurationId===a);return t?p.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e);return t?.tiers?.map(e=>e.name)||[]}async getRulesTable(){const e=this._rulesLayer;e.loaded||await e.load();const t=this.dataElement?.domainNetworks;if(!t)return null;const r=t.flatMap(e=>[...e.edgeSources||[],...e.junctionSources||[]]),s=(await this._queryRulesTable(e)).map(t=>this._hydrateRuleInfo(e,r,t));return new m({rulesLayer:e,rules:s})}async getCircuitManager(e){if(!this.hasTelecomNetwork)return null;const t=this.dataElement?.domainNetworks.find(t=>t.domainNetworkName===e&&t.isTelecomNetwork);if(!t)return null;const{default:r}=await import("./CircuitManager.js");return o(this._circuitManagerMap,e,()=>new r({utilityNetwork:this,telecomDomainNetwork:t}))}async getUnitIdentifierManager(){if(!this.hasTelecomNetwork)return null;if(this._unitIdentifierManager)return this._unitIdentifierManager;const{default:e}=await import("./UnitIdentifierManager.js");return this._unitIdentifierManager=new e({utilityNetwork:this}),this._unitIdentifierManager}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach(e=>{e.terminals.forEach(e=>{this._terminalById.set(e.id,e)})}),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?null!=e.layerId&&this._utilityLayerList.has(e.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new f({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;const{fromNetworkElement:r,toNetworkElement:s}=e;if(!r||!s)return!1;await t.load();let o=null;switch(e.associationType){case"containment":o=t.rulesCategorized.containment;break;case"attachment":o=t.rulesCategorized.attachment;break;default:o=t.rulesCategorized.connectivity}return o.some(e=>g(e,r,s))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:o,fromTerminalId:i,fromFirstUnit:a,fromNumUnits:n,toNetworkSourceId:l,toGlobalId:u,toTerminalId:d,toFirstUnit:m,toNumUnits:c,associationType:h,isContentVisible:p,percentAlong:f,globalId:I}=y(r);return{addFeatures:e.map(e=>{const r=new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[o]:e.fromNetworkElement?.globalId,[i]:e.fromNetworkElement?.terminalId,[l]:e.toNetworkElement?.networkSourceId,[u]:e.toNetworkElement?.globalId,[d]:e.toNetworkElement?.terminalId,[h]:w[e.associationType],[p]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[f]:e.percentAlong,[I]:e.globalId}});return e.fromNetworkElement instanceof k&&(r.attributes[a]=e.fromNetworkElement?.firstUnit,r.attributes[n]=e.fromNetworkElement?.numUnits),e.toNetworkElement instanceof k&&(r.attributes[m]=e.toNetworkElement?.firstUnit,r.attributes[c]=e.toNetworkElement?.numUnits),r}),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:r?.globalIdField??"globalid",objectIdField:r?.objectIdField??"objectid"}}}generateDeleteAssociations(e){const{associationsTable:t,associationsTableId:r}=this.networkSystemLayers,s={id:r,identifierFields:{globalIdField:t?.globalIdField??"globalid",objectIdField:t?.objectIdField??"objectid"}};if(-8===this.dataElement?.schemaGeneration){const t=this._generateDeleteTelecomAssociationPayload(e);return{...s,deleteAssociations:t}}const o=e.map(e=>({globalId:e.globalId}));return{...s,deleteFeatures:o}}generateCombineNetworkElements(e){return{id:this._ensureSingleSourceIdAsValidLayerId(e),combineGroupedObjects:[{globalIds:e.map(e=>e.globalId)}]}}generateDivideNetworkElements(e,t){return{id:this._ensureSingleSourceIdAsValidLayerId([e]),divideGroupedObjects:[{globalId:e.globalId,numUnits:t}]}}async loadAssociationsTable(){return this.networkSystemLayers.loadAssociationsTable()}async loadSubnetworksTable(){return this.networkSystemLayers.loadSubnetworksTable()}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map(e=>e.globalId),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find(e=>e.globalId===s.globalId);if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),i=s.get("CREATIONDATE"),a=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),h=s.get("VIANETWORKSOURCEID"),p=s.get("VIAASSETGROUP"),f=s.get("VIAASSETTYPE"),w=s.get("VIATERMINALID"),I=r.attributes[o.name],b=new Date(r.attributes[i.name]),g=[{networkSourceId:r.attributes[a.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[h.name],assetGroupId:r.attributes[p.name],assetTypeId:r.attributes[f.name],terminalId:r.attributes[w.name]}],k={ruleType:I,creationDate:b};for(const T of[0,1,2]){if(5!==I&&2===T)continue;const e=g[T],r=t.find(t=>t.sourceId===e.networkSourceId),s=r?.assetGroups.find(t=>t.assetGroupCode===e.assetGroupId),o=s?.assetTypes.find(t=>t.assetTypeCode===e.assetTypeId),i=this._getTerminal(o,e);let a="";switch(T){case 0:a="from";break;case 1:a="to";break;case 2:a="via"}k[`${a}NetworkSource`]=r,k[`${a}AssetGroup`]=s,k[`${a}AssetType`]=o,k[`${a}Terminal`]=i?.toJSON()}return k}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find(e=>e.id===r);return s?.terminals?.find(e=>e.id===t.terminalId)??null}async _queryRulesTable(e){const{gdbVersion:t,historicMoment:r}=this,s=new T({where:"1=1",outFields:["*"],gdbVersion:t,historicMoment:r});return(await u(e,s)).features}_generateDeleteTelecomAssociationPayload(e){return e.map(e=>({globalId:e.globalId??b,associationType:I.toJSON(e.associationType),fromSourceId:e.fromNetworkElement.networkSourceId,fromGlobalId:e.fromNetworkElement.globalId,fromTerminalId:e.fromNetworkElement.terminalId,toSourceId:e.toNetworkElement.networkSourceId,toGlobalId:e.toNetworkElement.globalId,toTerminalId:e.toNetworkElement.terminalId}))}_ensureSingleSourceIdAsValidLayerId(e){const t=r(e.map(e=>e.networkSourceId));if(t.length>1)throw new s("utility-network:invalid-source-id","'networkSourceId' is not valid. Ensure that all network elements have the same 'networkSourceId' and that it corresponds to a valid layer in the utility network.");const o=t[0],i=this.getLayerIdBySourceId(o);if(null==i)throw new s("utility-network:invalid-source-id","'networkSourceId' is not valid. Ensure that all network elements have the same 'networkSourceId' and that it corresponds to a valid layer in the utility network.");return i}};e([a({readOnly:!0})],S.prototype,"_rulesLayer",null),e([a({type:[c],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],S.prototype,"sharedNamedTraceConfigurations",void 0),e([a({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],S.prototype,"type",void 0),e([a({readOnly:!0})],S.prototype,"serviceTerritoryFeatureLayerId",null),e([a({readOnly:!0})],S.prototype,"networkSystemLayers",null),e([a({readOnly:!0})],S.prototype,"terminalConfigurations",null),e([a({readOnly:!0})],S.prototype,"domainNetworkNames",null),e([a({readOnly:!0})],S.prototype,"hasTelecomNetwork",null),e([a({readOnly:!0,json:{read:!1}})],S.prototype,"associationsTable",null),S=e([n("esri.networks.UtilityNetwork")],S);const N=S;export{N as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as s}from"tslib";import o from"../../core/Accessor.js";import t from"../../core/Error.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import a from"../../layers/FeatureLayer.js";let i=class extends o{constructor(s){super(s),this.rulesTableId=null,this.rulesTableUrl=null,this.subnetworksTableId=null,this.subnetworksTableUrl=null,this.dirtyAreasLayerId=null,this.dirtyAreasLayerUrl=null,this.associationsTable=null,this.associationsTableId=null,this.associationsTableUrl=null}destroy(){this.associationsTable?.destroy()}async loadAssociationsTable(s){if(!this.associationsTable){const{associationsTableUrl:s}=this;if(!s)throw new t("utility-network-system-layers:missing-associations-table-url","Unable to load the associations table, as the `associationsTableUrl` is not set.");this.associationsTable=new a({url:s})}return await this.associationsTable.load(s),this.associationsTable}};s([r({constructOnly:!0})],i.prototype,"rulesTableId",void 0),s([r({constructOnly:!0})],i.prototype,"rulesTableUrl",void 0),s([r({constructOnly:!0})],i.prototype,"subnetworksTableId",void 0),s([r({constructOnly:!0})],i.prototype,"subnetworksTableUrl",void 0),s([r({constructOnly:!0})],i.prototype,"dirtyAreasLayerId",void 0),s([r({constructOnly:!0})],i.prototype,"dirtyAreasLayerUrl",void 0),s([r()],i.prototype,"associationsTable",void 0),s([r({constructOnly:!0})],i.prototype,"associationsTableId",void 0),s([r({constructOnly:!0})],i.prototype,"associationsTableUrl",void 0),i=s([e("esri.networks.support.NetworkSystemLayers")],i);export{i as default};
5
+ import{__decorate as s}from"tslib";import t from"../../core/Accessor.js";import o from"../../core/Error.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import a from"../../layers/FeatureLayer.js";let l=class extends t{constructor(s){super(s),this.rulesTableId=null,this.rulesTableUrl=null,this.subnetworksTable=null,this.subnetworksTableId=null,this.subnetworksTableUrl=null,this.dirtyAreasLayerId=null,this.dirtyAreasLayerUrl=null,this.associationsTable=null,this.associationsTableId=null,this.associationsTableUrl=null}destroy(){this.associationsTable?.destroy()}async loadAssociationsTable(s){if(!this.associationsTable){const{associationsTableUrl:s}=this;if(!s)throw new o("utility-network-system-layers:missing-associations-table-url","Unable to load the associations table, as the `associationsTableUrl` is not set.");this.associationsTable=new a({url:s})}return await this.associationsTable.load(s),this.associationsTable}async loadSubnetworksTable(s){if(!this.subnetworksTable){const{subnetworksTableUrl:s}=this;if(!s)throw new o("utility-network-system-layers:missing-subnetworks-table-url","Unable to load the subnetworks table, as the `subnetworksTableUrl` is not set.");this.subnetworksTable=new a({url:s})}return await this.subnetworksTable.load(s),this.subnetworksTable}};s([r({constructOnly:!0})],l.prototype,"rulesTableId",void 0),s([r({constructOnly:!0})],l.prototype,"rulesTableUrl",void 0),s([r()],l.prototype,"subnetworksTable",void 0),s([r({constructOnly:!0})],l.prototype,"subnetworksTableId",void 0),s([r({constructOnly:!0})],l.prototype,"subnetworksTableUrl",void 0),s([r({constructOnly:!0})],l.prototype,"dirtyAreasLayerId",void 0),s([r({constructOnly:!0})],l.prototype,"dirtyAreasLayerUrl",void 0),s([r()],l.prototype,"associationsTable",void 0),s([r({constructOnly:!0})],l.prototype,"associationsTableId",void 0),s([r({constructOnly:!0})],l.prototype,"associationsTableUrl",void 0),l=s([e("esri.networks.support.NetworkSystemLayers")],l);export{l as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.93",
3
+ "version": "4.34.0-next.94",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -18,6 +18,7 @@
18
18
  ],
19
19
  "license": "SEE LICENSE IN copyright.txt",
20
20
  "dependencies": {
21
+ "@amcharts/amcharts5": "~5.13.6",
21
22
  "@arcgis/toolkit": "^4.34.0-next.142",
22
23
  "@esri/arcgis-html-sanitizer": "~4.1.0",
23
24
  "@esri/calcite-components": "^3.3.0",
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{ClonableMixin as o}from"../../core/Clonable.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import s from"./Content.js";import p from"../support/AttachmentsOrderByInfo.js";let i=class extends(o(s)){constructor(t){super(t),this.description=null,this.displayType="auto",this.orderByFields=null,this.title=null,this.type="attachments"}};t([r({type:String,json:{write:!0}})],i.prototype,"description",void 0),t([r({type:["auto","preview","list"],json:{write:!0}})],i.prototype,"displayType",void 0),t([r({type:[p],json:{write:!0}})],i.prototype,"orderByFields",void 0),t([r({type:String,json:{write:!0}})],i.prototype,"title",void 0),t([r({type:["attachments"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],i.prototype,"type",void 0),i=t([e("esri.popup.content.AttachmentsContent")],i);const n=i;export{n as default};
5
+ import{__decorate as t}from"tslib";import{ClonableMixin as o}from"../../core/Clonable.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import s from"./Content.js";import p from"../support/AttachmentsOrderByInfo.js";let i=class extends(o(s)){constructor(t){super(t),this.attachmentKeywords=null,this.attachmentTypes=null,this.description=null,this.displayType="auto",this.orderByFields=null,this.title=null,this.type="attachments"}};t([e({type:[String],json:{write:!0}})],i.prototype,"attachmentKeywords",void 0),t([e({type:[["application","audio","image","model","text","video"]],json:{write:!0}})],i.prototype,"attachmentTypes",void 0),t([e({type:String,json:{write:!0}})],i.prototype,"description",void 0),t([e({type:["auto","preview","list"],json:{write:!0}})],i.prototype,"displayType",void 0),t([e({type:[p],json:{write:!0}})],i.prototype,"orderByFields",void 0),t([e({type:String,json:{write:!0}})],i.prototype,"title",void 0),t([e({type:["attachments"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],i.prototype,"type",void 0),i=t([r("esri.popup.content.AttachmentsContent")],i);const n=i;export{n as default};