@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{id as e}from"../kernel.js";import t from"../request.js";import r from"../core/Error.js";import a from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import o from"../geometry/Geometry.js";import d from"../geometry/SpatialReference.js";import{submitJob as i}from"./geoprocessor/submitJob.js";import s from"./knowledgeGraph/GraphQueryResult.js";import p from"./knowledgeGraph/GraphQueryResultHeader.js";import c from"./knowledgeGraph/GraphQueryStreamingResult.js";import l from"./knowledgeGraph/KnowledgeGraph.js";import u from"./knowledgeGraph/ServiceDefinition.js";import{encodeClientDataAtKeysRequest as h}from"./knowledgeGraph/wasmInterface/clientDataToWasmEncodedFactories.js";import{getWasmInterface as w}from"./knowledgeGraph/wasmInterface/knowledgeWasmAccess.js";import{bindParamArrayToWasm as g,setInputQuantizationParametersOnEncoder as y,setOutputQuantizationParametersOnEncoder as f,setProvenanceBehaviorOnEncoder as m,geometryToWasm as _,bindParamObjectToWasm as k}from"./knowledgeGraph/wasmInterface/queryToWasmEncodedFactories.js";import{updateSearchPropertiesToWasm as G,fieldIndexToWasm as b,updateGraphPropertyToWasm as x,graphPropertyToWasm as T,updateEntityTypeToWasm as v,updateRelationshipTypeToWasm as A,entityTypeToWasm as P,relationshipTypeToWasm as S,inputQuantizationParametersToWasmFormat as D,namedObjectToWasm as R}from"./knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js";import{wasmClientDataAllKeysResponseToClientDataKeys as E,wasmClientDataFetchResponseToClientData as I}from"./knowledgeGraph/wasmInterface/wasmToClientDataFactories.js";import{decoderToAddNamedTypesResult as q,decoderToDeleteNamedTypeResult as C,decoderToUpdateNamedTypesResult as F,decoderToAddGraphPropertiesResult as M,decoderToDeleteGraphPropertiesResult as j,decoderToUpdateGraphPropertiesResult as U,decoderToGraphAddIndexResult as N,decoderToGraphDeleteIndexResult as K,decoderToGraphUpdateSearchIndexResult as Q}from"./knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js";import{wasmToDataModel as $}from"./knowledgeGraph/wasmInterface/wasmToDataModelFactories.js";import{wasmToGraphQueryResponseHeader as L,decodedWasmObjToQueryResponseObj as O}from"./knowledgeGraph/wasmInterface/wasmToQueryResponseObjFactories.js";import{decoderToApplyEditsResponse as W}from"./knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js";import{checkWasmError as H}from"./knowledgeGraph/wasmInterface/wasmUtils.js";const z=new Map,B=()=>new Map(z.entries()),J={fetchKnowledgeGraph:async e=>{const t=new l({url:e}),r=[];return r.push(he(t)),r.push(we(t)),await Promise.all(r),t},refreshDataModel:async e=>{e.dataModel=await Ye(e)},refreshServiceDefinition:async e=>{const r=(await t(e.url,{query:{f:"json"}})).data;return r.capabilities=r?.capabilities?.split(","),r.supportedQueryFormats=r?.supportedQueryFormats?.split(","),e.serviceDefinition=new u(r),e.serviceDefinition},executeFindPathsAsynchronous:async(e,t)=>{const a=e.inKnowledgeGraphUrl.split("/rest/services");if(a.length<2)throw new r("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /rest/services/");const n=a[0],o=(await Ge(`${n}/rest/info`,{query:{f:"json"}})).data.currentVersion,d=`/rest/services/${o&&o<12?"System":"Utilities"}/KnowledgeGraphServerToolsAsync/GPServer/ServerFilteredFindPaths`;return await ke(`${n}${d}`,{in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:e.config.toJSON(),result_type:"STRING"},{},t)},executeFindPaths:async(e,t)=>{const a=e.inKnowledgeGraphUrl.split("/rest/services");if(a.length<2)throw new r("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /rest/services/");const n=a[0],o=(await Ge(`${n}/rest/info`,{query:{f:"json"}})).data.currentVersion,d=`/rest/services/${o&&o<12?"System":"Utilities"}/KnowledgeGraphServerTools/GPServer/ServerFilteredFindPaths/execute`,i=await Ge(`${n}${d}`,{method:"post",query:{f:"pjson",in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:JSON.stringify(e.config),result_type:"STRING"},...t});if(i.data.results.length<1)throw new r("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results returned",i);let s;for(const r of i.data.results)if("out_results_string"===r.paramName){s=r.value;break}if(!s)throw new r("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results were returned on the expected paramater out_results_string",i);return s},fetchAsynchronousFindPathsResultData:async(e,t)=>(await e.fetchResultData("out_results_string",null,t)).value,executeQueryStreaming:async(e,t,a)=>{const n="include",o=`${e.url}/graph/query`;await be(e);const d=await Fe(o,a);if(!e.serviceDefinition?.supportsProvenance&&t.provenanceBehavior===n)throw new r("knowledge-graph:provenance-not-supported","The Knowledge Graph Service definition indicated that provenance is not supported");d.data.body=await qe(t,e);const i=await _e(d.data.url,d.data);if(e.dataModel){const t=await Ve(i,e.dataModel);return new c({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},executeApplyEdits:async(e,t,a)=>{if(e.serviceDefinition?.dataEditingNotSupported)throw new r("knowledge-graph:data-editing-not-supported","The Knowledge Graph Service definition indicated that data editing is not supported");const n=`${e.url}/graph/applyEdits`;await be(e);const o=await Fe(n,a);o.data.body=await Te(t,e);return je(await _e(o.data.url,o.data))},executeAddNamedTypes:async(e,t,a)=>{if(!t.newEntityTypes?.length&&!t.newRelationshipTypes?.length)throw new r("knowledge-graph:no-arguments","The operation to add types to the data model contained no values");const n=`${e.url}/dataModel/edit/namedTypes/add`;await be(e);const o=await Fe(n,a);o.data.body=await ve(t);const d=await _e(o.data.url,o.data),i=await Ue(d);return i.updatedKnowledgeGraph=await ue(e.url),i},executeDeleteNamedType:async(e,t,a)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to delete a named type from the data model contained no value");const n=`${e.url}/dataModel/edit/namedTypes/${t}/delete`;await be(e);const o=await Fe(n,a);o.data.body="";const d=await _e(o.data.url,o.data),i=await Ne(d);return i.updatedKnowledgeGraph=await ue(e.url),i},executeUpdateNamedType:async(e,t,a,n)=>{if(!t&&!Object.keys(a).length)throw new r("knowledge-graph:no-arguments","The operation to update types in the data model contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/update`;await be(e);const d=await Fe(o,n);d.data.body=await Ae(a,t,e.dataModel);const i=await _e(d.data.url,d.data),s=await Ke(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeAddGraphProperties:async(e,t,a,n)=>{if(!t&&!a.length)throw new r("knowledge-graph:no-arguments","The operation to add properties to the data model contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/fields/add`;await be(e);const d=await Fe(o,n);d.data.body=await Pe(a);const i=await _e(d.data.url,d.data),s=await Qe(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeDeleteGraphProperty:async(e,t,a,n)=>{if(!t&&!a)throw new r("knowledge-graph:no-arguments","The operation to delete property contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/fields/delete`;await be(e);const d=await Fe(o,n);d.data.body=await Se(a);const i=await _e(d.data.url,d.data),s=await $e(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeUpdateGraphProperty:async(e,t,a,n,o)=>{if(!t&&!a&&!Object.keys(n).length)throw new r("knowledge-graph:no-arguments","The operation to update properties in the data model contained missing or empty values");const d=`${e.url}/dataModel/edit/namedTypes/${t}/fields/update`;await be(e);const i=await Fe(d,o);i.data.body=await De(a,n);const s=await _e(i.data.url,i.data),p=await Le(s);return p.updatedKnowledgeGraph=await ue(e.url),p},executeAddGraphFieldIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!a?.length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty field index values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/indexes/add`;await be(e);const d=await Fe(o,n);d.data.body=await Re(a);const i=await _e(d.data.url,d.data),s=await Oe(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeDeleteGraphFieldIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!a?.length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty field index values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/indexes/delete`;await be(e);const d=await Fe(o,n);d.data.body=await Ee(a);const i=await _e(d.data.url,d.data),s=await We(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeUpdateSearchIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!Object.keys(a.addSearchProperties??{}).length&&!Object.keys(a.removeSearchProperties??{}).length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty properties values");const o=`${e.url}/dataModel/searchIndex/update`;await be(e);const d=await Fe(o,n);d.data.body=await Ie(t,a);const i=await _e(d.data.url,d.data),s=await He(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeQuery:async(e,a,n)=>{const o=`${e.url}/graph/query`,d=await t(o,{responseType:"array-buffer",query:{f:"pbf",openCypherQuery:a.openCypherQuery,...n?.query},signal:n?.signal,timeout:n?.timeout}),i=d.getHeader?.("content-type"),p=d.data;if(i?.includes("application/x-protobuf")){const t=new((await w()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=Je({wasmQueryDecoder:t,newArrayBufferToParse:p,dataModel:e.dataModel});return new s({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:i,data:d.data})},executeSearch:async(e,a,n)=>{const o=a.typeCategoryFilter,d=`${e.url}/graph/search`,i=await t(d,{responseType:"array-buffer",query:{f:"pbf",searchQuery:`"${a.searchQuery}"`,typeCategoryFilter:o,...n?.query},signal:n?.signal,timeout:n?.timeout}),p=i.getHeader?.("content-type"),c=i.data;if(p?.includes("application/x-protobuf")){const t=new((await w()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=Je({wasmQueryDecoder:t,newArrayBufferToParse:c,dataModel:e.dataModel});return new s({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:p,data:i.data})},executeSearchStreaming:async(e,t,a)=>{const n=`${e.url}/graph/search`;await be(e);const o=await Fe(n,a);o.data.body=await Ce(t);const d=await _e(o.data.url,o.data);if(e.dataModel){const t=await Ve(d,e.dataModel);return new c({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},fetchClientDataAtKeys:async(e,t,a={ignoreCache:!1})=>{if(!t.length)return new Map;let n=z.get(e.url||"");n||(n=new Map,z.set(e.url||"",n));const o=new Map(n.entries()),d=`${e.url}/clientData/fetch`;t=Array.from(new Set(t));const i=await w(),s=h(t,n,i,a.ignoreCache),p=await Fe(d,a.requestOptions);p.data.body=s;const c=await _e(p.data.url,p.data),l=c.headers.get("content-type");if(l?.includes("application/x-protobuf")){const e=new i.ClientDataFetchResponseDecoder;e.deleteLater();const t=await c.arrayBuffer();return e.decode(new Uint8Array(t)),e.has_error()&&H(e.error,"knowledge-graph:fetchClientDataAtKeys-decoding-error","An error occurred while decoding the client data keys response"),I(e,n,o,a.ignoreCache)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response when fetching client data",{responseType:l,data:c})},fetchAllClientDataKeys:async(e,a)=>{const n=`${e.url}/clientData`,o=await t(n,{responseType:"array-buffer",query:{f:"pbf"},signal:a?.signal,timeout:a?.timeout}),d=o.getHeader?.("content-type"),i=o.data;if(d?.includes("application/x-protobuf")){const e=new((await w()).ClientDataKeysResponseDecoder);return e.deleteLater(),e.decode(new Uint8Array(i)),e.has_error()&&H(e.error,"knowledge-graph:fetchAllClientDataKeys-decoding-error","An error occurred while decoding the client data keys response"),E(e)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:d,data:o.data})},clearClientDataCache:()=>z.clear(),_fetchWrapper:async(e,t)=>fetch(e,t),_submitJobWrapper:async(e,t,r,a)=>i(e,t,r,a),_esriRequestWrapper:async(e,r)=>t(e,r)};async function V(e,t,r){return J.executeApplyEdits(e,t,r)}async function Y(e,t,r){return J.executeAddNamedTypes(e,t,r)}async function X(e,t,r){return J.executeDeleteNamedType(e,t,r)}async function Z(e,t,r,a){return J.executeUpdateNamedType(e,t,r,a)}async function ee(e,t,r,a){return J.executeAddGraphProperties(e,t,r,a)}async function te(e,t,r,a){return J.executeDeleteGraphProperty(e,t,r,a)}async function re(e,t,r,a,n){return J.executeUpdateGraphProperty(e,t,r,a,n)}async function ae(e,t,r,a){return J.executeAddGraphFieldIndex(e,t,r,a)}async function ne(e,t,r,a){return J.executeDeleteGraphFieldIndex(e,t,r,a)}async function oe(e,t,r,a){return J.executeUpdateSearchIndex(e,t,r,a)}async function de(e,t,r){return J.executeQuery(e,t,r)}async function ie(e,t,r){return J.executeQueryStreaming(e,t,r)}async function se(e,t,r){return J.executeSearch(e,t,r)}async function pe(e,t,r){return J.executeSearchStreaming(e,t,r)}function ce(e,t){return J.fetchAllClientDataKeys(e,t)}function le(e,t,r){return J.fetchClientDataAtKeys(e,t,r)}async function ue(e){return J.fetchKnowledgeGraph(e)}async function he(e){return J.refreshDataModel(e)}async function we(e){return J.refreshServiceDefinition(e)}async function ge(e,t){return J.executeFindPathsAsynchronous(e,t)}async function ye(e,t){return J.executeFindPaths(e,t)}async function fe(e,t){return J.fetchAsynchronousFindPathsResultData(e,t)}function me(){return J.clearClientDataCache()}async function _e(e,t){return J._fetchWrapper(e,t)}async function ke(e,t,r,a){return J._submitJobWrapper(e,t,r,a)}async function Ge(e,t){return J._esriRequestWrapper(e,t)}async function be(t){const r=e?.findCredential(t.url);r||(t.dataModel?await Ye(t):await he(t))}function xe(e,t,r,a){null==t?r.set_param_key_value(e,""):"object"!=typeof t||t instanceof Date?r.set_param_key_value(e,t):t instanceof o?r.set_param_key_value(e,_(t,a)):Array.isArray(t)?r.set_param_key_value(e,g(t,a)):r.set_param_key_value(e,k(t,a))}async function Te(e,t){if(t.dataModel||await he(t),!t.dataModel)throw new r("knowledge-graph:data-model-undefined","Encoding could not proceed because a data model was not provided and it could not be determined from the service");const a=await w(),n=!!e.options?.cascadeDelete,o=!!e.options?.cascadeProvenanceDelete,d=new a.GraphApplyEditsEncoder(a.SpatialReferenceUtil.WGS84(),e.options?.inputQuantizationParameters?D(e.options?.inputQuantizationParameters):a.InputQuantizationUtil.WGS84_lossless());d.deleteLater(),d.cascade_delete=n,d.cascade_delete_provenance=o;try{let t;e.entityAdds?.forEach(e=>{t=d.add_entity(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),e.relationshipAdds?.forEach(e=>{if(!e.originId||!e.destinationId)throw new r("knowledge-graph:relationship-origin-destination-missing","When adding a new relationship, you must provide both an origin and destination id on the appropriate class property");t=d.add_relationship(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),e.entityUpdates?.forEach(e=>{if(!e.id)throw new r("knowledge-graph:entity-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=d.update_entity(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),e.relationshipUpdates?.forEach(e=>{if(!e.id)throw new r("knowledge-graph:relationship-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=d.update_relationship(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),e.entityDeletes?.forEach(e=>{if(!e.typeName)throw new r("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=d.make_delete_helper(e.typeName,!0);t.deleteLater(),e.ids?.forEach(e=>{t.delete_by_id(e)})}),e.relationshipDeletes?.forEach(e=>{if(!e.typeName)throw new r("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=d.make_delete_helper(e.typeName,!1);e.ids?.forEach(e=>{t.delete_by_id(e)})}),d.encode()}catch(s){throw new r("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:s})}const i=d.get_encoding_result();return H(i.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),structuredClone(i.get_byte_buffer())}async function ve(e){const t=await w(),a=new t.GraphNamedObjectTypeAddsRequestEncoder;a.deleteLater(),e.newEntityTypes?.forEach(e=>{a.add_entity_type(P(e,t))}),e.newRelationshipTypes?.forEach(e=>{a.add_relationship_type(S(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addNamedTypes-encoding-failed","Attempting to encode the addNamedTypes failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addNamedTypes-encoding-failed","Attempting to encode the addNamedTypes failed"),structuredClone(n.get_byte_buffer())}async function Ae(e,t,a){const n=await w(),o=new n.GraphNamedObjectTypeUpdateRequestEncoder;o.deleteLater();if(a.entityTypes.some(e=>e.name===t))o.update_entity_type(v(e,n));else{if(!a.relationshipTypes.some(e=>e.name===t))throw new r("knowledge-graph:updateNamedType-encoding-failed","The named type you are trying to update does not exist in the data model");o.update_relationship_type(A(e,n))}o.update_alias=e.hasOwnProperty("alias");try{o.encode()}catch(i){throw new r("knowledge-graph:updateNamedType-encoding-failed","Attempting to encode the updateNamedType failed",{error:i})}const d=o.get_encoding_result();return H(d.error,"knowledge-graph:updateNamedType-encoding-failed","Attempting to encode the updateNamedType failed"),structuredClone(d.get_byte_buffer())}async function Pe(e){const t=await w(),a=new t.GraphPropertyAddsRequestEncoder;a.deleteLater(),e.forEach(e=>{a.add_graph_property(T(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addGraphProperties-encoding-failed","Attempting to encode the addGraphProperties failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addGraphProperties-encoding-failed","Attempting to encode the addGraphProperties failed"),structuredClone(n.get_byte_buffer())}async function Se(e){const t=new((await w()).GraphPropertyDeleteRequestEncoder);t.deleteLater(),t.field_name=e;try{t.encode()}catch(n){throw new r("knowledge-graph:deleteGraphProperty-encoding-failed","Attempting to encode the deleteGraphProperty failed",{error:n})}const a=t.get_encoding_result();return H(a.error,"knowledge-graph:deleteGraphProperty-encoding-failed","Attempting to encode the deleteGraphProperty failed"),structuredClone(a.get_byte_buffer())}async function De(e,t){const a=await w(),n=new a.GraphPropertyUpdateRequestEncoder;n.deleteLater(),n.update_graph_property(x(t,a)),n.set_property_name(e),n.update_alias=t.hasOwnProperty("alias"),n.update_editable=t.hasOwnProperty("editable"),n.update_required=t.hasOwnProperty("required"),n.update_visible=t.hasOwnProperty("defaultVisibility"),n.update_default_value=t.hasOwnProperty("defaultValue");try{n.encode()}catch(d){throw new r("knowledge-graph:updateGraphProperty-encoding-failed","Attempting to encode the updateGraphProperty failed",{error:d})}const o=n.get_encoding_result();return H(o.error,"knowledge-graph:updateGraphProperty-encoding-failed","Attempting to encode the updateGraphProperty failed"),structuredClone(o.get_byte_buffer())}async function Re(e){const t=await w(),a=new t.GraphIndexAddsRequestEncoder;a.deleteLater(),e.forEach(e=>{a.add_field_index(b(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addGraphFieldIndex-encoding-failed","Attempting to encode the addGraphFieldIndex failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addGraphFieldIndex-encoding-failed","Attempting to encode the addGraphFieldIndex failed"),structuredClone(n.get_byte_buffer())}async function Ee(e){const t=new((await w()).GraphIndexDeleteRequestEncoder);t.deleteLater(),e.forEach(e=>{t.add_index_name(e)});try{t.encode()}catch(n){throw new r("knowledge-graph:deleteGraphFieldIndex-encoding-failed","Attempting to encode the deleteGraphFieldIndex failed",{error:n})}const a=t.get_encoding_result();return H(a.error,"knowledge-graph:deleteGraphFieldIndex-encoding-failed","Attempting to encode the deleteGraphFieldIndex failed"),structuredClone(a.get_byte_buffer())}async function Ie(e,t){const a=await w(),n=new a.GraphUpdateSearchIndexRequestEncoder;n.deleteLater(),t.hasOwnProperty("addSearchProperties")&&n.insert_add_search_property(e,G(t.addSearchProperties,a)),t.hasOwnProperty("removeSearchProperties")&&n.insert_delete_search_property(e,G(t.removeSearchProperties,a));try{n.encode()}catch(d){throw new r("knowledge-graph:updateSearchIndex-encoding-failed","Attempting to encode the updateSearchIndex failed",{error:d})}const o=n.get_encoding_result();return H(o.error,"knowledge-graph:updateSearchIndex-encoding-failed","Attempting to encode the updateSearchIndex failed"),structuredClone(o.get_byte_buffer())}async function qe(e,t){const a=await w(),n=new a.GraphQueryRequestEncoder;if(n.deleteLater(),e.outputSpatialReference?n.output_spatial_reference={wkid:e.outputSpatialReference.wkid,latestWkid:e.outputSpatialReference.latestWkid,vcsWkid:e.outputSpatialReference.vcsWkid,latestVcsWkid:e.outputSpatialReference.latestVcsWkid,wkt:e.outputSpatialReference.wkt??""}:n.output_spatial_reference=a.SpatialReferenceUtil.WGS84(),n.open_cypher_query=e.openCypherQuery,e.bindParameters)for(const[r,i]of Object.entries(e.bindParameters))xe(r,i,n,a);if(e.bindGeometryQuantizationParameters)y(e.bindGeometryQuantizationParameters,n);else{if(t.dataModel||await he(t),4326!==t.dataModel?.spatialReference?.wkid)throw new r("knowledge-graph:SR-quantization-mismatch","If the DataModel indicates a coordinate system other than WGS84, inputQuantizationParameters must be provided to the query encoder");n.input_quantization_parameters=a.InputQuantizationUtil.WGS84_lossless()}e.outputQuantizationParameters&&f(e.outputQuantizationParameters,n,a),e.provenanceBehavior&&m(e.provenanceBehavior,n);try{n.encode()}catch(d){throw new r("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{error:d})}const o=n.get_encoding_result();if(0!==o.error.error_code)throw new r("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{errorCode:o.error.error_code,errorMessage:o.error.error_message});return structuredClone(o.get_byte_buffer())}async function Ce(e){const t=await w(),a=new t.GraphSearchRequestEncoder;if(a.deleteLater(),a.search_query=e.searchQuery,a.type_category_filter=t.esriNamedTypeCategory[e.typeCategoryFilter],!0===e.returnSearchContext&&(a.return_search_context=e.returnSearchContext),null!=e.start&&e.start>0&&(a.start_index=e.start),null!=e.num&&(a.max_num_results=e.num),null!=e.idsFilter&&Array.isArray(e.idsFilter)&&e.idsFilter.length>0)try{a.set_ids_filter(g(e.idsFilter,t))}catch(o){throw new r("knowledge-graph:ids-format-error","Attempting to set ids filter failed. This is usually caused by an incorrectly formatted UUID string",{error:o})}e.namedTypesFilter?.forEach(e=>{a.add_named_type_filter(e)});try{a.encode()}catch(o){throw new r("knowledge-graph:search-encoding-failed","Attempting to encode the search failed",{error:o})}const n=a.get_encoding_result();if(0!==n.error.error_code)throw new r("knowledge-graph:search-encoding-failed","Attempting to get encoding result from the query failed",{errorCode:n.error.error_code,errorMessage:n.error.error_message});return structuredClone(n.get_byte_buffer())}async function Fe(e,r){return t(e,{responseType:"native-request-init",method:"post",query:{f:"pbf",...r?.query},body:"x",headers:{"Content-Type":"application/octet-stream"},signal:r?.signal,timeout:r?.timeout})}async function Me(e,t,a){const n=e.headers.get("content-type");if(n?.includes("application/x-protobuf")){const r=await e.arrayBuffer(),n=new t;try{return n.decode(new Uint8Array(r)),a(n)}finally{n.deleteLater()}}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:n,data:await e.text()})}async function je(e){return Me(e,(await w()).GraphApplyEditsDecoder,W)}async function Ue(e){return Me(e,(await w()).GraphNamedObjectTypeAddsResponseDecoder,q)}async function Ne(e){return Me(e,(await w()).GraphNamedObjectTypeDeleteResponseDecoder,C)}async function Ke(e){return Me(e,(await w()).GraphNamedObjectTypeUpdateResponseDecoder,F)}async function Qe(e){return Me(e,(await w()).GraphPropertyAddsResponseDecoder,M)}async function $e(e){return Me(e,(await w()).GraphPropertyDeleteResponseDecoder,j)}async function Le(e){return Me(e,(await w()).GraphPropertyUpdateResponseDecoder,U)}async function Oe(e){return Me(e,(await w()).GraphIndexAddsResponseDecoder,N)}async function We(e){return Me(e,(await w()).GraphIndexDeleteResponseDecoder,K)}async function He(e){return Me(e,(await w()).GraphUpdateSearchIndexResponseDecoder,Q)}let ze=50;function Be(e){ze=e}function Je({wasmQueryDecoder:e,newArrayBufferToParse:t,dataModel:a,decodedHeader:n,limitMaxProcessingTime:o=!1}){t&&e.push_buffer(new Uint8Array(t));const i=[];let s,p,c=0;const l=Date.now();let u=!0;for(;e.next_row();){s&&p||(s=n??L(e),p=s.outSpatialReference??new d({wkid:4326})),c||(c=e.get_header_keys().size());const t=new Array(c);for(let r=0;r<c;r++){const n=e.get_value(r);t[r]=O(n,a,p)}if(i.push(t),o&&Date.now()-l>ze){u=!1;break}}if(e.has_error())throw new r("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - inner row decoding",{errorCode:e.error.error_code,errorMessage:e.error.error_message});return{resultHeader:s,resultRows:i,parsedAllResultsFromBuffer:u}}async function Ve(e,t){const o=e.headers.get("content-type");if(e.headers.get("content-length")&&a.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").warnOnce("Found `Content-Length` header when expecting a streaming HTTP response! Please investigate whether all intermediate HTTP proxies and/or load balancers are configured such that they don't forcefully buffer the entire response before returning it to the client. A valid HTTP streaming response should use Chunked Transfer Encoding and not have a Content Length defined."),o?.includes("application/x-protobuf")){const o=e.body?.getReader(),d=new((await w()).GraphQueryDecoder);let i,s,c;d.deleteLater();const l=new Promise((e,t)=>{s=e,c=t});let u=!1,h=null;const g=new ReadableStream({pull:async function e(l){if(!o){const e=new r("knowledge-graph:stream-decoding-error","Error reading from stream - reader is undefined");throw c(e),e}const{done:w,value:g}=h?{done:!1,value:null}:await o.read().catch(e=>{throw c(e),o.releaseLock(),e});g&&(h=g);try{if(w){let e;if(d.has_error()?e=new r("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - query stream done",{errorCode:d.error.error_code,errorMessage:d.error.error_message}):u||s(new p),o.releaseLock(),e)throw l.error(e),c(e),e;return void l.close()}const{resultHeader:a,resultRows:n,parsedAllResultsFromBuffer:y}=Je({wasmQueryDecoder:d,newArrayBufferToParse:g,dataModel:t,decodedHeader:i,limitMaxProcessingTime:!0});return y&&(h=null),!i&&a&&(i=a,s(a),u=!0),n.length>0?void l.enqueue(n):await e(l)}catch(y){throw a.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").error(y),c(y),o.releaseLock(),n(y)?y:new r("knowledge-graph:unexpected-server-response","Error inside streaming data return parsing",{error:y})}}});return{readableStream:g,resultHeader:await l}}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:e.text()})}async function Ye(e){const a=`${e.url}/dataModel/queryDataModel`,n=await t(a,{responseType:"array-buffer",query:{f:"pbf"}}),o=n.getHeader?.("content-type"),d=n.data;if(o?.includes("application/x-protobuf")){const e=(await w()).decode_data_model_from_protocol_buffer(new Uint8Array(d));if(!e)throw new r("knowledge-graph:data-model-decode-failure","The server responded to the data model query, but the response failed to be decoded. This typically occurs when the Knowledge JS API (4.26 or later) is used with an unsupported backend (11.0 or earlier)");return $(e)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:n.data})}export{be as _checkAuthentication,Ge as _esriRequestWrapper,_e as _fetchWrapper,B as _getClientDataCacheCopy,Be as _setMaxQueryParsingDurationForTesting,ke as _submitJobWrapper,me as clearClientDataCache,z as clientDataCache,ae as executeAddGraphFieldIndex,ee as executeAddGraphProperties,Y as executeAddNamedTypes,V as executeApplyEdits,ne as executeDeleteGraphFieldIndex,te as executeDeleteGraphProperty,X as executeDeleteNamedType,ye as executeFindPaths,ge as executeFindPathsAsynchronous,de as executeQuery,ie as executeQueryStreaming,se as executeSearch,pe as executeSearchStreaming,re as executeUpdateGraphProperty,Z as executeUpdateNamedType,oe as executeUpdateSearchIndex,ce as fetchAllClientDataKeys,fe as fetchAsynchronousFindPathsResultData,le as fetchClientDataAtKeys,ue as fetchKnowledgeGraph,J as kgRestServices,he as refreshDataModel,we as refreshServiceDefinition};
5
+ import{id as e}from"../kernel.js";import t from"../request.js";import r from"../core/Error.js";import a from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import o from"../geometry/Geometry.js";import d from"../geometry/SpatialReference.js";import{submitJob as i}from"./geoprocessor/submitJob.js";import s from"./knowledgeGraph/GraphQueryResult.js";import p from"./knowledgeGraph/GraphQueryResultHeader.js";import c from"./knowledgeGraph/GraphQueryStreamingResult.js";import l from"./knowledgeGraph/KnowledgeGraph.js";import u from"./knowledgeGraph/ServiceDefinition.js";import{encodeClientDataAtKeysRequest as h}from"./knowledgeGraph/wasmInterface/clientDataToWasmEncodedFactories.js";import{getWasmInterface as w}from"./knowledgeGraph/wasmInterface/knowledgeWasmAccess.js";import{bindParamArrayToWasm as g,setInputQuantizationParametersOnEncoder as y,setOutputQuantizationParametersOnEncoder as f,setProvenanceBehaviorOnEncoder as m,geometryToWasm as _,bindParamObjectToWasm as k}from"./knowledgeGraph/wasmInterface/queryToWasmEncodedFactories.js";import{updateSearchPropertiesToWasm as G,fieldIndexToWasm as b,updateGraphPropertyToWasm as x,graphPropertyToWasm as v,updateEntityTypeToWasm as T,updateRelationshipTypeToWasm as A,entityTypeToWasm as P,relationshipTypeToWasm as S,inputQuantizationParametersToWasmFormat as D,namedObjectToWasm as R}from"./knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js";import{wasmClientDataAllKeysResponseToClientDataKeys as E,wasmClientDataFetchResponseToClientData as C}from"./knowledgeGraph/wasmInterface/wasmToClientDataFactories.js";import{decoderToAddNamedTypesResult as F,decoderToDeleteNamedTypeResult as I,decoderToUpdateNamedTypesResult as q,decoderToAddGraphPropertiesResult as M,decoderToDeleteGraphPropertiesResult as j,decoderToUpdateGraphPropertiesResult as U,decoderToGraphAddIndexResult as N,decoderToGraphDeleteIndexResult as K,decoderToGraphUpdateSearchIndexResult as Q}from"./knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js";import{wasmToDataModel as $}from"./knowledgeGraph/wasmInterface/wasmToDataModelFactories.js";import{wasmToGraphQueryResponseHeader as L,decodedWasmObjToQueryResponseObj as O}from"./knowledgeGraph/wasmInterface/wasmToQueryResponseObjFactories.js";import{decoderToApplyEditsResponse as W}from"./knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js";import{checkWasmError as H}from"./knowledgeGraph/wasmInterface/wasmUtils.js";const z=new Map,B=()=>new Map(z.entries()),J={fetchKnowledgeGraph:async e=>{const t=new l({url:e}),r=[];return r.push(he(t)),r.push(we(t)),await Promise.all(r),t},refreshDataModel:async e=>{e.dataModel=await Ye(e)},refreshServiceDefinition:async e=>{const r=(await t(e.url,{query:{f:"json"}})).data;return r.capabilities=r?.capabilities?.split(","),r.supportedQueryFormats=r?.supportedQueryFormats?.split(","),e.serviceDefinition=new u(r),e.serviceDefinition},executeFindPathsAsynchronous:async(e,t)=>{const a=e.inKnowledgeGraphUrl.split("/rest/services");if(a.length<2)throw new r("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /rest/services/");const n=a[0],o=(await Ge(`${n}/rest/info`,{query:{f:"json"}})).data.currentVersion,d=`/rest/services/${o&&o<12?"System":"Utilities"}/KnowledgeGraphServerToolsAsync/GPServer/ServerFilteredFindPaths`;return await ke(`${n}${d}`,{in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:e.config.toJSON(),result_type:"STRING"},{},t)},executeFindPaths:async(e,t)=>{const a=e.inKnowledgeGraphUrl.split("/rest/services");if(a.length<2)throw new r("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /rest/services/");const n=a[0],o=(await Ge(`${n}/rest/info`,{query:{f:"json"}})).data.currentVersion,d=`/rest/services/${o&&o<12?"System":"Utilities"}/KnowledgeGraphServerTools/GPServer/ServerFilteredFindPaths/execute`,i=await Ge(`${n}${d}`,{method:"post",query:{f:"pjson",in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:JSON.stringify(e.config),result_type:"STRING"},...t});if(i.data.results.length<1)throw new r("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results returned",i);let s;for(const r of i.data.results)if("out_results_string"===r.paramName){s=r.value;break}if(!s)throw new r("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results were returned on the expected paramater out_results_string",i);return s},fetchAsynchronousFindPathsResultData:async(e,t)=>(await e.fetchResultData("out_results_string",null,t)).value,executeQueryStreaming:async(e,t,a)=>{const n="include",o=`${e.url}/graph/query`;await be(e);const d=await qe(o,a);if(!e.serviceDefinition?.supportsProvenance&&t.provenanceBehavior===n)throw new r("knowledge-graph:provenance-not-supported","The Knowledge Graph Service definition indicated that provenance is not supported");d.data.body=await Fe(t,e);const i=await _e(d.data.url,d.data);if(e.dataModel){const t=await Ve(i,e.dataModel);return new c({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},executeApplyEdits:async(e,t,a)=>{if(e.serviceDefinition?.dataEditingNotSupported)throw new r("knowledge-graph:data-editing-not-supported","The Knowledge Graph Service definition indicated that data editing is not supported");const n=`${e.url}/graph/applyEdits`;await be(e);const o=await qe(n,a);o.data.body=await ve(t,e);return je(await _e(o.data.url,o.data))},executeAddNamedTypes:async(e,t,a)=>{if(!t.newEntityTypes?.length&&!t.newRelationshipTypes?.length)throw new r("knowledge-graph:no-arguments","The operation to add types to the data model contained no values");const n=`${e.url}/dataModel/edit/namedTypes/add`;await be(e);const o=await qe(n,a);o.data.body=await Te(t);const d=await _e(o.data.url,o.data),i=await Ue(d);return i.updatedKnowledgeGraph=await ue(e.url),i},executeDeleteNamedType:async(e,t,a)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to delete a named type from the data model contained no value");const n=`${e.url}/dataModel/edit/namedTypes/${t}/delete`;await be(e);const o=await qe(n,a);o.data.body="";const d=await _e(o.data.url,o.data),i=await Ne(d);return i.updatedKnowledgeGraph=await ue(e.url),i},executeUpdateNamedType:async(e,t,a,n)=>{if(!t&&!Object.keys(a).length)throw new r("knowledge-graph:no-arguments","The operation to update types in the data model contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/update`;await be(e);const d=await qe(o,n);d.data.body=await Ae(a,t,e.dataModel);const i=await _e(d.data.url,d.data),s=await Ke(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeAddGraphProperties:async(e,t,a,n)=>{if(!t&&!a.length)throw new r("knowledge-graph:no-arguments","The operation to add properties to the data model contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/fields/add`;await be(e);const d=await qe(o,n);d.data.body=await Pe(a);const i=await _e(d.data.url,d.data),s=await Qe(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeDeleteGraphProperty:async(e,t,a,n)=>{if(!t&&!a)throw new r("knowledge-graph:no-arguments","The operation to delete property contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/fields/delete`;await be(e);const d=await qe(o,n);d.data.body=await Se(a);const i=await _e(d.data.url,d.data),s=await $e(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeUpdateGraphProperty:async(e,t,a,n,o)=>{if(!t&&!a&&!Object.keys(n).length)throw new r("knowledge-graph:no-arguments","The operation to update properties in the data model contained missing or empty values");const d=`${e.url}/dataModel/edit/namedTypes/${t}/fields/update`;await be(e);const i=await qe(d,o);i.data.body=await De(a,n);const s=await _e(i.data.url,i.data),p=await Le(s);return p.updatedKnowledgeGraph=await ue(e.url),p},executeAddGraphFieldIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!a?.length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty field index values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/indexes/add`;await be(e);const d=await qe(o,n);d.data.body=await Re(a);const i=await _e(d.data.url,d.data),s=await Oe(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeDeleteGraphFieldIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!a?.length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty field index values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/indexes/delete`;await be(e);const d=await qe(o,n);d.data.body=await Ee(a);const i=await _e(d.data.url,d.data),s=await We(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeUpdateSearchIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!Object.keys(a.addSearchProperties??{}).length&&!Object.keys(a.removeSearchProperties??{}).length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty properties values");const o=`${e.url}/dataModel/searchIndex/update`;await be(e);const d=await qe(o,n);d.data.body=await Ce(t,a);const i=await _e(d.data.url,d.data),s=await He(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeQuery:async(e,a,n)=>{const o=`${e.url}/graph/query`,d=await t(o,{responseType:"array-buffer",query:{f:"pbf",openCypherQuery:a.openCypherQuery,...n?.query},signal:n?.signal,timeout:n?.timeout}),i=d.getHeader?.("content-type"),p=d.data;if(i?.includes("application/x-protobuf")){const t=new((await w()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=Je({wasmQueryDecoder:t,newArrayBufferToParse:p,dataModel:e.dataModel});return new s({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:i,data:d.data})},executeSearch:async(e,a,n)=>{const o="provenance"===a.typeCategoryFilter?"metaEntityProvenance":a.typeCategoryFilter,d=`${e.url}/graph/search`,i=await t(d,{responseType:"array-buffer",query:{f:"pbf",searchQuery:`"${a.searchQuery}"`,typeCategoryFilter:o,...n?.query},signal:n?.signal,timeout:n?.timeout}),p=i.getHeader?.("content-type"),c=i.data;if(p?.includes("application/x-protobuf")){const t=new((await w()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=Je({wasmQueryDecoder:t,newArrayBufferToParse:c,dataModel:e.dataModel});return new s({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:p,data:i.data})},executeSearchStreaming:async(e,t,a)=>{const n=`${e.url}/graph/search`;await be(e);const o=await qe(n,a);o.data.body=await Ie(t);const d=await _e(o.data.url,o.data);if(e.dataModel){const t=await Ve(d,e.dataModel);return new c({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},fetchClientDataAtKeys:async(e,t,a={ignoreCache:!1})=>{if(!t.length)return new Map;let n=z.get(e.url||"");n||(n=new Map,z.set(e.url||"",n));const o=new Map(n.entries()),d=`${e.url}/clientData/fetch`;t=Array.from(new Set(t));const i=await w(),s=h(t,n,i,a.ignoreCache),p=await qe(d,a.requestOptions);p.data.body=s;const c=await _e(p.data.url,p.data),l=c.headers.get("content-type");if(l?.includes("application/x-protobuf")){const e=new i.ClientDataFetchResponseDecoder;e.deleteLater();const t=await c.arrayBuffer();return e.decode(new Uint8Array(t)),e.has_error()&&H(e.error,"knowledge-graph:fetchClientDataAtKeys-decoding-error","An error occurred while decoding the client data keys response"),C(e,n,o,a.ignoreCache)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response when fetching client data",{responseType:l,data:c})},fetchAllClientDataKeys:async(e,a)=>{const n=`${e.url}/clientData`,o=await t(n,{responseType:"array-buffer",query:{f:"pbf"},signal:a?.signal,timeout:a?.timeout}),d=o.getHeader?.("content-type"),i=o.data;if(d?.includes("application/x-protobuf")){const e=new((await w()).ClientDataKeysResponseDecoder);return e.deleteLater(),e.decode(new Uint8Array(i)),e.has_error()&&H(e.error,"knowledge-graph:fetchAllClientDataKeys-decoding-error","An error occurred while decoding the client data keys response"),E(e)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:d,data:o.data})},clearClientDataCache:()=>z.clear(),_fetchWrapper:async(e,t)=>fetch(e,t),_submitJobWrapper:async(e,t,r,a)=>i(e,t,r,a),_esriRequestWrapper:async(e,r)=>t(e,r)};async function V(e,t,r){return J.executeApplyEdits(e,t,r)}async function Y(e,t,r){return J.executeAddNamedTypes(e,t,r)}async function X(e,t,r){return J.executeDeleteNamedType(e,t,r)}async function Z(e,t,r,a){return J.executeUpdateNamedType(e,t,r,a)}async function ee(e,t,r,a){return J.executeAddGraphProperties(e,t,r,a)}async function te(e,t,r,a){return J.executeDeleteGraphProperty(e,t,r,a)}async function re(e,t,r,a,n){return J.executeUpdateGraphProperty(e,t,r,a,n)}async function ae(e,t,r,a){return J.executeAddGraphFieldIndex(e,t,r,a)}async function ne(e,t,r,a){return J.executeDeleteGraphFieldIndex(e,t,r,a)}async function oe(e,t,r,a){return J.executeUpdateSearchIndex(e,t,r,a)}async function de(e,t,r){return J.executeQuery(e,t,r)}async function ie(e,t,r){return J.executeQueryStreaming(e,t,r)}async function se(e,t,r){return J.executeSearch(e,t,r)}async function pe(e,t,r){return J.executeSearchStreaming(e,t,r)}function ce(e,t){return J.fetchAllClientDataKeys(e,t)}function le(e,t,r){return J.fetchClientDataAtKeys(e,t,r)}async function ue(e){return J.fetchKnowledgeGraph(e)}async function he(e){return J.refreshDataModel(e)}async function we(e){return J.refreshServiceDefinition(e)}async function ge(e,t){return J.executeFindPathsAsynchronous(e,t)}async function ye(e,t){return J.executeFindPaths(e,t)}async function fe(e,t){return J.fetchAsynchronousFindPathsResultData(e,t)}function me(){return J.clearClientDataCache()}async function _e(e,t){return J._fetchWrapper(e,t)}async function ke(e,t,r,a){return J._submitJobWrapper(e,t,r,a)}async function Ge(e,t){return J._esriRequestWrapper(e,t)}async function be(t){const r=e?.findCredential(t.url);r||(t.dataModel?await Ye(t):await he(t))}function xe(e,t,r,a){null==t?r.set_param_key_value(e,""):"object"!=typeof t||t instanceof Date?r.set_param_key_value(e,t):t instanceof o?r.set_param_key_value(e,_(t,a)):Array.isArray(t)?r.set_param_key_value(e,g(t,a)):r.set_param_key_value(e,k(t,a))}async function ve(e,t){if(t.dataModel||await he(t),!t.dataModel)throw new r("knowledge-graph:data-model-undefined","Encoding could not proceed because a data model was not provided and it could not be determined from the service");const a=await w(),n=!!e.options?.cascadeDelete,o=!!e.options?.cascadeProvenanceDelete,d=new a.GraphApplyEditsEncoder(a.SpatialReferenceUtil.WGS84(),e.options?.inputQuantizationParameters?D(e.options?.inputQuantizationParameters):a.InputQuantizationUtil.WGS84_lossless());d.deleteLater(),d.cascade_delete=n,d.cascade_delete_provenance=o;try{let t;e.entityAdds?.forEach(e=>{t=d.add_entity(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),e.relationshipAdds?.forEach(e=>{if(!e.originId||!e.destinationId)throw new r("knowledge-graph:relationship-origin-destination-missing","When adding a new relationship, you must provide both an origin and destination id on the appropriate class property");t=d.add_relationship(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),e.entityUpdates?.forEach(e=>{if(!e.id)throw new r("knowledge-graph:entity-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=d.update_entity(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),e.relationshipUpdates?.forEach(e=>{if(!e.id)throw new r("knowledge-graph:relationship-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=d.update_relationship(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),e.entityDeletes?.forEach(e=>{if(!e.typeName)throw new r("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=d.make_delete_helper(e.typeName,!0);t.deleteLater(),e.ids?.forEach(e=>{t.delete_by_id(e)})}),e.relationshipDeletes?.forEach(e=>{if(!e.typeName)throw new r("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=d.make_delete_helper(e.typeName,!1);e.ids?.forEach(e=>{t.delete_by_id(e)})}),d.encode()}catch(s){throw new r("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:s})}const i=d.get_encoding_result();return H(i.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),structuredClone(i.get_byte_buffer())}async function Te(e){const t=await w(),a=new t.GraphNamedObjectTypeAddsRequestEncoder;a.deleteLater(),e.newEntityTypes?.forEach(e=>{a.add_entity_type(P(e,t))}),e.newRelationshipTypes?.forEach(e=>{a.add_relationship_type(S(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addNamedTypes-encoding-failed","Attempting to encode the addNamedTypes failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addNamedTypes-encoding-failed","Attempting to encode the addNamedTypes failed"),structuredClone(n.get_byte_buffer())}async function Ae(e,t,a){const n=await w(),o=new n.GraphNamedObjectTypeUpdateRequestEncoder;o.deleteLater();if(a.entityTypes.some(e=>e.name===t))o.update_entity_type(T(e,n));else{if(!a.relationshipTypes.some(e=>e.name===t))throw new r("knowledge-graph:updateNamedType-encoding-failed","The named type you are trying to update does not exist in the data model");o.update_relationship_type(A(e,n))}o.update_alias=e.hasOwnProperty("alias");try{o.encode()}catch(i){throw new r("knowledge-graph:updateNamedType-encoding-failed","Attempting to encode the updateNamedType failed",{error:i})}const d=o.get_encoding_result();return H(d.error,"knowledge-graph:updateNamedType-encoding-failed","Attempting to encode the updateNamedType failed"),structuredClone(d.get_byte_buffer())}async function Pe(e){const t=await w(),a=new t.GraphPropertyAddsRequestEncoder;a.deleteLater(),e.forEach(e=>{a.add_graph_property(v(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addGraphProperties-encoding-failed","Attempting to encode the addGraphProperties failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addGraphProperties-encoding-failed","Attempting to encode the addGraphProperties failed"),structuredClone(n.get_byte_buffer())}async function Se(e){const t=new((await w()).GraphPropertyDeleteRequestEncoder);t.deleteLater(),t.field_name=e;try{t.encode()}catch(n){throw new r("knowledge-graph:deleteGraphProperty-encoding-failed","Attempting to encode the deleteGraphProperty failed",{error:n})}const a=t.get_encoding_result();return H(a.error,"knowledge-graph:deleteGraphProperty-encoding-failed","Attempting to encode the deleteGraphProperty failed"),structuredClone(a.get_byte_buffer())}async function De(e,t){const a=await w(),n=new a.GraphPropertyUpdateRequestEncoder;n.deleteLater(),n.update_graph_property(x(t,a)),n.set_property_name(e),n.update_alias=t.hasOwnProperty("alias"),n.update_editable=t.hasOwnProperty("editable"),n.update_required=t.hasOwnProperty("required"),n.update_visible=t.hasOwnProperty("defaultVisibility"),n.update_default_value=t.hasOwnProperty("defaultValue");try{n.encode()}catch(d){throw new r("knowledge-graph:updateGraphProperty-encoding-failed","Attempting to encode the updateGraphProperty failed",{error:d})}const o=n.get_encoding_result();return H(o.error,"knowledge-graph:updateGraphProperty-encoding-failed","Attempting to encode the updateGraphProperty failed"),structuredClone(o.get_byte_buffer())}async function Re(e){const t=await w(),a=new t.GraphIndexAddsRequestEncoder;a.deleteLater(),e.forEach(e=>{a.add_field_index(b(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addGraphFieldIndex-encoding-failed","Attempting to encode the addGraphFieldIndex failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addGraphFieldIndex-encoding-failed","Attempting to encode the addGraphFieldIndex failed"),structuredClone(n.get_byte_buffer())}async function Ee(e){const t=new((await w()).GraphIndexDeleteRequestEncoder);t.deleteLater(),e.forEach(e=>{t.add_index_name(e)});try{t.encode()}catch(n){throw new r("knowledge-graph:deleteGraphFieldIndex-encoding-failed","Attempting to encode the deleteGraphFieldIndex failed",{error:n})}const a=t.get_encoding_result();return H(a.error,"knowledge-graph:deleteGraphFieldIndex-encoding-failed","Attempting to encode the deleteGraphFieldIndex failed"),structuredClone(a.get_byte_buffer())}async function Ce(e,t){const a=await w(),n=new a.GraphUpdateSearchIndexRequestEncoder;n.deleteLater(),t.hasOwnProperty("addSearchProperties")&&n.insert_add_search_property(e,G(t.addSearchProperties,a)),t.hasOwnProperty("removeSearchProperties")&&n.insert_delete_search_property(e,G(t.removeSearchProperties,a));try{n.encode()}catch(d){throw new r("knowledge-graph:updateSearchIndex-encoding-failed","Attempting to encode the updateSearchIndex failed",{error:d})}const o=n.get_encoding_result();return H(o.error,"knowledge-graph:updateSearchIndex-encoding-failed","Attempting to encode the updateSearchIndex failed"),structuredClone(o.get_byte_buffer())}async function Fe(e,t){const a=await w(),n=new a.GraphQueryRequestEncoder;if(n.deleteLater(),e.outputSpatialReference?n.output_spatial_reference={wkid:e.outputSpatialReference.wkid,latestWkid:e.outputSpatialReference.latestWkid,vcsWkid:e.outputSpatialReference.vcsWkid,latestVcsWkid:e.outputSpatialReference.latestVcsWkid,wkt:e.outputSpatialReference.wkt??""}:n.output_spatial_reference=a.SpatialReferenceUtil.WGS84(),n.open_cypher_query=e.openCypherQuery,e.bindParameters)for(const[r,i]of Object.entries(e.bindParameters))xe(r,i,n,a);if(e.bindGeometryQuantizationParameters)y(e.bindGeometryQuantizationParameters,n);else{if(t.dataModel||await he(t),4326!==t.dataModel?.spatialReference?.wkid)throw new r("knowledge-graph:SR-quantization-mismatch","If the DataModel indicates a coordinate system other than WGS84, inputQuantizationParameters must be provided to the query encoder");n.input_quantization_parameters=a.InputQuantizationUtil.WGS84_lossless()}e.outputQuantizationParameters&&f(e.outputQuantizationParameters,n,a),e.provenanceBehavior&&m(e.provenanceBehavior,n);try{n.encode()}catch(d){throw new r("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{error:d})}const o=n.get_encoding_result();if(0!==o.error.error_code)throw new r("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{errorCode:o.error.error_code,errorMessage:o.error.error_message});return structuredClone(o.get_byte_buffer())}async function Ie(e){const t=await w(),a=new t.GraphSearchRequestEncoder;a.deleteLater(),a.search_query=e.searchQuery;const n="provenance"===e.typeCategoryFilter?"meta_entity_provenance":e.typeCategoryFilter;if(a.type_category_filter=t.esriNamedTypeCategory[n],!0===e.returnSearchContext&&(a.return_search_context=e.returnSearchContext),null!=e.start&&e.start>0&&(a.start_index=e.start),null!=e.num&&(a.max_num_results=e.num),null!=e.idsFilter&&Array.isArray(e.idsFilter)&&e.idsFilter.length>0)try{a.set_ids_filter(g(e.idsFilter,t))}catch(d){throw new r("knowledge-graph:ids-format-error","Attempting to set ids filter failed. This is usually caused by an incorrectly formatted UUID string",{error:d})}e.namedTypesFilter?.forEach(e=>{a.add_named_type_filter(e)});try{a.encode()}catch(d){throw new r("knowledge-graph:search-encoding-failed","Attempting to encode the search failed",{error:d})}const o=a.get_encoding_result();if(0!==o.error.error_code)throw new r("knowledge-graph:search-encoding-failed","Attempting to get encoding result from the query failed",{errorCode:o.error.error_code,errorMessage:o.error.error_message});return structuredClone(o.get_byte_buffer())}async function qe(e,r){return t(e,{responseType:"native-request-init",method:"post",query:{f:"pbf",...r?.query},body:"x",headers:{"Content-Type":"application/octet-stream"},signal:r?.signal,timeout:r?.timeout})}async function Me(e,t,a){const n=e.headers.get("content-type");if(n?.includes("application/x-protobuf")){const r=await e.arrayBuffer(),n=new t;try{return n.decode(new Uint8Array(r)),a(n)}finally{n.deleteLater()}}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:n,data:await e.text()})}async function je(e){return Me(e,(await w()).GraphApplyEditsDecoder,W)}async function Ue(e){return Me(e,(await w()).GraphNamedObjectTypeAddsResponseDecoder,F)}async function Ne(e){return Me(e,(await w()).GraphNamedObjectTypeDeleteResponseDecoder,I)}async function Ke(e){return Me(e,(await w()).GraphNamedObjectTypeUpdateResponseDecoder,q)}async function Qe(e){return Me(e,(await w()).GraphPropertyAddsResponseDecoder,M)}async function $e(e){return Me(e,(await w()).GraphPropertyDeleteResponseDecoder,j)}async function Le(e){return Me(e,(await w()).GraphPropertyUpdateResponseDecoder,U)}async function Oe(e){return Me(e,(await w()).GraphIndexAddsResponseDecoder,N)}async function We(e){return Me(e,(await w()).GraphIndexDeleteResponseDecoder,K)}async function He(e){return Me(e,(await w()).GraphUpdateSearchIndexResponseDecoder,Q)}let ze=50;function Be(e){ze=e}function Je({wasmQueryDecoder:e,newArrayBufferToParse:t,dataModel:a,decodedHeader:n,limitMaxProcessingTime:o=!1}){t&&e.push_buffer(new Uint8Array(t));const i=[];let s,p,c=0;const l=Date.now();let u=!0;for(;e.next_row();){s&&p||(s=n??L(e),p=s.outSpatialReference??new d({wkid:4326})),c||(c=e.get_header_keys().size());const t=new Array(c);for(let r=0;r<c;r++){const n=e.get_value(r);t[r]=O(n,a,p)}if(i.push(t),o&&Date.now()-l>ze){u=!1;break}}if(e.has_error())throw new r("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - inner row decoding",{errorCode:e.error.error_code,errorMessage:e.error.error_message});return{resultHeader:s,resultRows:i,parsedAllResultsFromBuffer:u}}async function Ve(e,t){const o=e.headers.get("content-type");if(e.headers.get("content-length")&&a.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").warnOnce("Found `Content-Length` header when expecting a streaming HTTP response! Please investigate whether all intermediate HTTP proxies and/or load balancers are configured such that they don't forcefully buffer the entire response before returning it to the client. A valid HTTP streaming response should use Chunked Transfer Encoding and not have a Content Length defined."),o?.includes("application/x-protobuf")){const o=e.body?.getReader(),d=new((await w()).GraphQueryDecoder);let i,s,c;d.deleteLater();const l=new Promise((e,t)=>{s=e,c=t});let u=!1,h=null;const g=new ReadableStream({pull:async function e(l){if(!o){const e=new r("knowledge-graph:stream-decoding-error","Error reading from stream - reader is undefined");throw c(e),e}const{done:w,value:g}=h?{done:!1,value:null}:await o.read().catch(e=>{throw c(e),o.releaseLock(),e});g&&(h=g);try{if(w){let e;if(d.has_error()?e=new r("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - query stream done",{errorCode:d.error.error_code,errorMessage:d.error.error_message}):u||s(new p),o.releaseLock(),e)throw l.error(e),c(e),e;return void l.close()}const{resultHeader:a,resultRows:n,parsedAllResultsFromBuffer:y}=Je({wasmQueryDecoder:d,newArrayBufferToParse:g,dataModel:t,decodedHeader:i,limitMaxProcessingTime:!0});return y&&(h=null),!i&&a&&(i=a,s(a),u=!0),n.length>0?void l.enqueue(n):await e(l)}catch(y){throw a.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").error(y),c(y),o.releaseLock(),n(y)?y:new r("knowledge-graph:unexpected-server-response","Error inside streaming data return parsing",{error:y})}}});return{readableStream:g,resultHeader:await l}}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:e.text()})}async function Ye(e){const a=`${e.url}/dataModel/queryDataModel`,n=await t(a,{responseType:"array-buffer",query:{f:"pbf"}}),o=n.getHeader?.("content-type"),d=n.data;if(o?.includes("application/x-protobuf")){const e=(await w()).decode_data_model_from_protocol_buffer(new Uint8Array(d));if(!e)throw new r("knowledge-graph:data-model-decode-failure","The server responded to the data model query, but the response failed to be decoded. This typically occurs when the Knowledge JS API (4.26 or later) is used with an unsupported backend (11.0 or earlier)");return $(e)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:n.data})}export{be as _checkAuthentication,Ge as _esriRequestWrapper,_e as _fetchWrapper,B as _getClientDataCacheCopy,Be as _setMaxQueryParsingDurationForTesting,ke as _submitJobWrapper,me as clearClientDataCache,z as clientDataCache,ae as executeAddGraphFieldIndex,ee as executeAddGraphProperties,Y as executeAddNamedTypes,V as executeApplyEdits,ne as executeDeleteGraphFieldIndex,te as executeDeleteGraphProperty,X as executeDeleteNamedType,ye as executeFindPaths,ge as executeFindPathsAsynchronous,de as executeQuery,ie as executeQueryStreaming,se as executeSearch,pe as executeSearchStreaming,re as executeUpdateGraphProperty,Z as executeUpdateNamedType,oe as executeUpdateSearchIndex,ce as fetchAllClientDataKeys,fe as fetchAsynchronousFindPathsResultData,le as fetchClientDataAtKeys,ue as fetchKnowledgeGraph,J as kgRestServices,he as refreshDataModel,we as refreshServiceDefinition};
@@ -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
- const a="20250923",c="66a47c90ad7d9124786e45c94913cbeafeda84b9";export{a as buildDate,c as commitHash};
5
+ const b="20250924",c="5444265061bca9f545838b0e264c49b54217dbc2";export{b as buildDate,c as commitHash};
@@ -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 i}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as s}from"../../../../core/asyncUtils.js";import{abortMaybe as o,removeMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{connectVisualization as l}from"../../../analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js";import{highlightsSupported as n}from"../../../support/layerViewUtils.js";let p=class extends t{constructor(i){super(i),this._highlightTask=null,this._highlightHandle=null}initialize(){this.addHandles(l({analysisViewData:this.analysisViewData,onRemove:()=>this._remove(),onShowSketchedGraphic:()=>this._remove(),onHighlight:(i,t)=>this._highlight(i,t)}))}destroy(){this._remove()}get updating(){return null!=this._highlightTask&&!this._highlightTask.finished}_remove(){this._highlightTask=o(this._highlightTask),this._highlightHandle=e(this._highlightHandle)}_highlight(i,t){this._remove(),t&&"building-component"!==t.type&&"subtype-sublayer"!==t.type&&(this._highlightTask=s(async s=>{const o=await this.view.whenLayerView(t);r(s),n(o)&&(this._highlightHandle=o.highlight(i))}))}};i([h({constructOnly:!0})],p.prototype,"view",void 0),i([h({constructOnly:!0})],p.prototype,"analysisViewData",void 0),i([h()],p.prototype,"updating",null),p=i([a("esri.views.2d.analysis.ElevationProfile.ElevationProfileInputVisualization2D")],p);export{p as ElevationProfileInputVisualization2D};
5
+ import{__decorate as o}from"tslib";import t from"../../../../core/Accessor.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 i}from"../../../../core/accessorSupport/decorators/subclass.js";import{connectVisualization as s}from"../../../analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js";let e=class extends t{constructor(o){super(o)}initialize(){this.addHandles(s({analysisViewData:this.analysisViewData,onRemove:()=>{},onShowSketchedGraphic:()=>{}}))}get updating(){return!1}};o([r({constructOnly:!0})],e.prototype,"view",void 0),o([r({constructOnly:!0})],e.prototype,"analysisViewData",void 0),o([r()],e.prototype,"updating",null),e=o([i("esri.views.2d.analysis.ElevationProfile.ElevationProfileInputVisualization2D")],e);export{e as ElevationProfileInputVisualization2D};
@@ -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 r from"../../../../core/Accessor.js";import{getContrast as o}from"../../../../core/colorUtils.js";import{watch as s,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../layers/GraphicsLayer.js";import c from"../../../../symbols/CIMSymbol.js";import{getConfig as m}from"../../../analysis/ElevationProfile/constants.js";import{getInputGeometry as y}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{createLineGeometry as d}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let h=class extends r{constructor(e){super(e),this._graphic=new t,this._layer=new n({listMode:"hide",internal:!0}),this._updateGeometryThrottled=a(e=>{if(!e)return void(this._layer.visible=!1);const t=this.view.map?.layers;t&&!t.includes(this._layer)&&t.add(this._layer),this._layer.visible=!0,this._graphic.geometry=d(e.samples,e.spatialReference)},m().profileLinesUpdateThrottleMillis)}initialize(){this._layer.add(this._graphic),this.addHandles([s(()=>y(this.analysisViewData.analysis.input),()=>{this._layer.visible=!1},i),s(()=>this._colorUpdateParameters,e=>this._updateColor(e),i),s(()=>this._geometryUpdateParameters,e=>this._updateGeometryThrottled(e),i),this._updateGeometryThrottled])}destroy(){this.view.map?.remove(this._layer),this._layer.destroy(),this._graphic.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _result(){const{results:e,visible:t}=this.analysisViewData;return t?e.find(e=>e.available&&e.computation.profile.viewOptions.lineVisible):null}get _geometryUpdateParameters(){const e=this._result;return 1!==e?.progress?null:{samples:e.samples,spatialReference:this.view.spatialReference}}get _colorUpdateParameters(){const e=this._result?.computation.profile.color;return e?{color:e.toArray(),contrastColor:o(e).toArray()}:null}_updateColor(e){e&&(this._graphic.symbol=new c({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,10],lineDashEnding:"HalfPattern",controlPointEnding:"HalfPattern"}],capStyle:"Butt",width:1.5,color:e.color},{type:"CIMSolidStroke",capStyle:"Butt",width:2,color:e.contrastColor}]}}}))}};e([l({constructOnly:!0})],h.prototype,"view",void 0),e([l({constructOnly:!0})],h.prototype,"analysisViewData",void 0),e([l()],h.prototype,"updating",null),e([l()],h.prototype,"_result",null),e([l()],h.prototype,"_geometryUpdateParameters",null),e([l()],h.prototype,"_colorUpdateParameters",null),h=e([p("esri.views.2d.analysis.ElevationProfile.ElevationProfileLineVisualization2D")],h);export{h as ElevationProfileLineVisualization2D};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import{getContrast as o}from"../../../../core/colorUtils.js";import{watch as s,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../layers/GraphicsLayer.js";import c from"../../../../symbols/CIMSymbol.js";import{getConfig as m}from"../../../analysis/ElevationProfile/constants.js";import{createLineGeometry as y}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let d=class extends r{constructor(e){super(e),this._graphic=new t,this._layer=new n({listMode:"hide",internal:!0}),this._updateGeometryThrottled=a(e=>{if(!e)return void(this._layer.visible=!1);const t=this.view.map?.layers;t&&!t.includes(this._layer)&&t.add(this._layer),this._layer.visible=!0,this._graphic.geometry=y(e.samples,e.spatialReference)},m().profileLinesUpdateThrottleMillis)}initialize(){this._layer.add(this._graphic),this.addHandles([s(()=>this.analysisViewData.analysis.geometry,()=>{this._layer.visible=!1},i),s(()=>this._colorUpdateParameters,e=>this._updateColor(e),i),s(()=>this._geometryUpdateParameters,e=>this._updateGeometryThrottled(e),i),this._updateGeometryThrottled])}destroy(){this.view.map?.remove(this._layer),this._layer.destroy(),this._graphic.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _result(){const{results:e,visible:t}=this.analysisViewData;return t?e.find(e=>e.available&&e.computation.profile.viewOptions.lineVisible):null}get _geometryUpdateParameters(){const e=this._result;return 1!==e?.progress?null:{samples:e.samples,spatialReference:this.view.spatialReference}}get _colorUpdateParameters(){const e=this._result?.computation.profile.color;return e?{color:e.toArray(),contrastColor:o(e).toArray()}:null}_updateColor(e){e&&(this._graphic.symbol=new c({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,10],lineDashEnding:"HalfPattern",controlPointEnding:"HalfPattern"}],capStyle:"Butt",width:1.5,color:e.color},{type:"CIMSolidStroke",capStyle:"Butt",width:2,color:e.contrastColor}]}}}))}};e([l({constructOnly:!0})],d.prototype,"view",void 0),e([l({constructOnly:!0})],d.prototype,"analysisViewData",void 0),e([l()],d.prototype,"updating",null),e([l()],d.prototype,"_result",null),e([l()],d.prototype,"_geometryUpdateParameters",null),e([l()],d.prototype,"_colorUpdateParameters",null),d=e([p("esri.views.2d.analysis.ElevationProfile.ElevationProfileLineVisualization2D")],d);export{d as ElevationProfileLineVisualization2D};
@@ -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{property as o}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{AnalysisView2D as i}from"./AnalysisView2D.js";import{ElevationProfileVisualization2D as s}from"./ElevationProfile/ElevationProfileVisualization2D.js";import{ElevationProfileController as l}from"../../analysis/ElevationProfile/ElevationProfileController.js";import{ElevationProfileLineGroundComputation as n}from"../../analysis/ElevationProfile/ElevationProfileLineGroundComputation.js";import{ElevationProfileLineInputComputation as a}from"../../analysis/ElevationProfile/ElevationProfileLineInputComputation.js";import{ElevationProfileLineQueryComputation as p}from"../../analysis/ElevationProfile/ElevationProfileLineQueryComputation.js";import{ElevationProfileTool as c}from"../../analysis/ElevationProfile/ElevationProfileTool.js";let u=class extends i{constructor(t){super(t),this.type="elevation-profile-view-2d",this.analysis=null,this.hoveredPosition=null}initialize(){const{analysis:t,view:o}=this;this._controller=new l({analysis:t,analysisViewData:this,view:o,computationFactory:{create:t=>{switch(t.profile.type){case"ground":return new n(t);case"input":return new a(t);case"query":return new p(t);case"scene":throw new e("elevation-profile-analysis-view-2d:unsupported","The scene profile line type is not supported in 2D views.")}}}}),this._visualization=new s({view:o,analysisViewData:this}),this._sketchTool=new c({view:o,analysisViewData:this})}destroy(){this._controller?.destroy(),this._visualization?.destroy(),this._sketchTool?.destroy()}get effectiveUnits(){return this._controller?.effectiveUnits??{distance:"meters",elevation:"meters"}}get error(){return this._controller?.error}get hoveredPoints(){return this._controller?.hoveredPoints??[]}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get progress(){return this._controller?.progress??0}get results(){return this._controller?.results??[]}get statistics(){return this._controller?.statistics}get updating(){return!0===this._controller?.updating||!0===this._visualization?.updating||!0===this._sketchTool?.updating}get visible(){return super.visible}set visible(t){super.visible=t}get sketchGraphic(){return this._sketchTool?.sketchGraphic}get toolState(){return this._sketchTool?.state??"idle"}place(t){return this._sketchTool.place(t)}pickGraphic(t){return this._sketchTool.pickGraphic(t)}};t([o({readOnly:!0})],u.prototype,"type",void 0),t([o({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",void 0),t([o({readOnly:!0})],u.prototype,"effectiveUnits",null),t([o({readOnly:!0})],u.prototype,"error",null),t([o()],u.prototype,"hoveredPosition",void 0),t([o()],u.prototype,"hoveredPoints",null),t([o({readOnly:!0})],u.prototype,"progress",null),t([o({readOnly:!0})],u.prototype,"results",null),t([o({readOnly:!0})],u.prototype,"statistics",null),t([o({readOnly:!0})],u.prototype,"updating",null),t([o()],u.prototype,"sketchGraphic",null),t([o()],u.prototype,"toolState",null),t([o()],u.prototype,"_controller",void 0),t([o()],u.prototype,"_visualization",void 0),t([o()],u.prototype,"_sketchTool",void 0),u=t([r("esri.views.2d.analysis.ElevationProfileAnalysisView2D")],u);const h=u;export{h as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{property as o}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{AnalysisView2D as i}from"./AnalysisView2D.js";import{ElevationProfileVisualization2D as s}from"./ElevationProfile/ElevationProfileVisualization2D.js";import{ElevationProfileController as l}from"../../analysis/ElevationProfile/ElevationProfileController.js";import{ElevationProfileLineGroundComputation as n}from"../../analysis/ElevationProfile/ElevationProfileLineGroundComputation.js";import{ElevationProfileLineInputComputation as a}from"../../analysis/ElevationProfile/ElevationProfileLineInputComputation.js";import{ElevationProfileLineQueryComputation as p}from"../../analysis/ElevationProfile/ElevationProfileLineQueryComputation.js";import{ElevationProfileTool as c}from"../../analysis/ElevationProfile/ElevationProfileTool.js";let u=class extends i{constructor(t){super(t),this.type="elevation-profile-view-2d",this.analysis=null,this.hoveredPosition=null}initialize(){const{analysis:t,view:o}=this;this._controller=new l({analysis:t,analysisViewData:this,view:o,computationFactory:{create:t=>{switch(t.profile.type){case"ground":return new n(t);case"input":return new a(t);case"query":return new p(t);case"scene":throw new e("elevation-profile-analysis-view-2d:unsupported","The scene profile line type is not supported in 2D views.")}}}}),this._visualization=new s({view:o,analysisViewData:this}),this._sketchTool=new c({view:o,analysisViewData:this})}destroy(){this._controller?.destroy(),this._visualization?.destroy(),this._sketchTool?.destroy()}get effectiveDisplayUnits(){return this._controller?.effectiveDisplayUnits??{distance:"meters",elevation:"meters"}}get error(){return this._controller?.error}get hoveredPoints(){return this._controller?.hoveredPoints??[]}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get progress(){return this._controller?.progress??0}get results(){return this._controller?.results??[]}get statistics(){return this._controller?.statistics}get updating(){return!0===this._controller?.updating||!0===this._visualization?.updating||!0===this._sketchTool?.updating}get visible(){return super.visible}set visible(t){super.visible=t}get sketchGraphic(){return this._sketchTool?.sketchGraphic}get toolState(){return this._sketchTool?.state??"idle"}place(t){return this._sketchTool.place(t)}pickGraphic(t){return this._sketchTool.pickGraphic(t)}};t([o({readOnly:!0})],u.prototype,"type",void 0),t([o({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",void 0),t([o({readOnly:!0})],u.prototype,"effectiveDisplayUnits",null),t([o({readOnly:!0})],u.prototype,"error",null),t([o()],u.prototype,"hoveredPosition",void 0),t([o()],u.prototype,"hoveredPoints",null),t([o({readOnly:!0})],u.prototype,"progress",null),t([o({readOnly:!0})],u.prototype,"results",null),t([o({readOnly:!0})],u.prototype,"statistics",null),t([o({readOnly:!0})],u.prototype,"updating",null),t([o()],u.prototype,"sketchGraphic",null),t([o()],u.prototype,"toolState",null),t([o()],u.prototype,"_controller",void 0),t([o()],u.prototype,"_visualization",void 0),t([o()],u.prototype,"_sketchTool",void 0),u=t([r("esri.views.2d.analysis.ElevationProfileAnalysisView2D")],u);const y=u;export{y 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"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{assertIsSome as s}from"../../../../core/maybe.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import h from"../../../../geometry/Extent.js";import c from"../../../../geometry/Point.js";import u from"../../../../layers/support/PixelBlock.js";import p from"../../../../layers/support/TileInfo.js";import{update as d,unregister as y,getRasterId as m,register as g}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{getWorldWidth as _,computeProjectedScales as f}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import b from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import w from"../../tiling/TileQueue.js";import I from"../../tiling/TileStrategy.js";import{tileSize as P}from"../../engine/webgl/definitions.js";import{TaskPriority as S}from"../../../support/Scheduler.js";import{getWebGLCapabilities as R}from"../../../webgl/capabilities.js";const C=[0,0];let U=class extends t{constructor(){super(...arguments),this._updatingHandles=new n,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=r(async(e={})=>{const t=this._rasterFunctionState,i=e.reprocess||"gpu"===t&&!this.canUseWebGLForProcessing||"cpu"===t&&this.canUseWebGLForProcessing;if(i&&(await this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;const s=this._rasterFunctionState,{type:r}=this;return e.refetch||"raster"!==r&&!!i||"cpu"===s||"cpu"===t?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(e.signal))})}destroy(){this._updatingHandles.destroy()}get canUseWebGLForProcessing(){return!1}get canUseLocalSymbolizerParams(){return(this.canUseWebGLForProcessing||"rasterVF"===this.type)&&!this.layerView.hasTilingEffects}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s="toJSON"in t?t:h.fromJSON(t);d(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null!=this._symbolizerParams&&this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.layerView.hasTilingEffects&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()}));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){const e=R();this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new b(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile(e,t),priority:S.MAPVIEW_FETCH_QUEUE,scheduler:this.scheduler});const i=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:i,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,y(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._updatingHandles.addPromise(this._enqueueTileFetch(t)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",()=>{e.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,s]=e,r=new u({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):"rasterFunction"in t?i:e}updateRasterFunctionParameters(){}_fetchTile(e,t){const i=this._getFetchOptions(e.level,t.signal);return this.fetchTile(e,i)}_getFetchOptions(e,t){const{canUseWebGLForProcessing:i}=this,{layerView:s}=this,{tileInfo:r}=s,a=!r.isWrappable&&null!=_(s.view.spatialReference),o=i&&this.layer.raster.hasUniqueSourceStorageInfo,{layer:l}=this.layerView,n=l.serviceRasterInfo?.storageInfo.isBsqTile?l.getRawDisplayBandIds():void 0;return{allowPartialFill:!0,datumTransformation:s.datumTransformation,interpolation:i?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:t,srcResolution:this._srcResolutions[e],timeExtent:s.timeExtent,tileInfo:r,bandIds:n,disableWrapAround:a}}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map(({scale:e})=>e),a=p.create({spatialReference:t,size:P,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map(({resolution:e})=>({x:e,y:e})))}const{scales:i,srcResolutions:r,isCustomTilingScheme:a}=f(this.layer.serviceRasterInfo,t,{tileSize:P,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),o=p.create({spatialReference:t,size:P,scales:i}),l=0===o.origin.x;s(e.fullExtent);const{xmin:n,ymax:h}=e.fullExtent;(l||a&&o.origin.x>n)&&(o.origin=new c({x:n,y:h,spatialReference:t})),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every(({scale:e},t)=>Math.abs(e-i[t].scale)<.001)}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.serviceRasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key),r=this._getBandIds();let o=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){o=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){a(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}this.canUseLocalSymbolizerParams&&null==this._symbolizerParams&&this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(C,e.key),n=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:o,bandIds:r,coords:l,resolution:n}),e.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(e)}catch(s){a(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map(async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams}));await Promise.allSettled(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t=this._getFetchOptions(this.previousLOD.level,e),i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,{...t,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1});if(!i?.pixelBlock)return;const{resolution:s}=this.previousLOD,{isBsqTile:r}=this.layer.raster.rasterInfo.storageInfo,a=r?null:this._getBandIds(),o=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(a),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:a});!this.canUseWebGLForProcessing&&o&&"stretch"===o.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(o.factor=o.factor.map(e=>255*e),o.minOutput=Math.round(255*o.minOutput),o.maxOutput=Math.round(255*o.maxOutput)),this._globalSymbolizerParams=o}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{raster:s}=t,{multidimensionalDefinition:r}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),a=s.rasterInfo.multidimensionalInfo?s.getSliceIndex(r):null,o=s.rasterInfo.storageInfo.isBsqTile?t.getRawDisplayBandIds():null,l=m(s.rasterId,a,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&y(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=g(l,s.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),r=this._srcResolutions[t.level];d(l,this._blockCacheRegistryId,e.extent,e.resolution,r,s.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;await this.layer.updateRenderer(),this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,this._tileStrategy.refresh(t=>e.push(this._enqueueTileFetch(t))),await this._updatingHandles.addPromise(Promise.allSettled(e))}};e([o()],U.prototype,"_globalUpdateRequested",void 0),e([o()],U.prototype,"attached",void 0),e([o()],U.prototype,"canUseWebGLForProcessing",null),e([o()],U.prototype,"canUseLocalSymbolizerParams",null),e([o()],U.prototype,"container",void 0),e([o()],U.prototype,"layer",void 0),e([o()],U.prototype,"layerView",void 0),e([o()],U.prototype,"scheduler",void 0),e([o()],U.prototype,"type",void 0),e([o()],U.prototype,"useWebGLForProcessing",null),e([o()],U.prototype,"useProgressiveUpdate",null),e([o()],U.prototype,"timeExtent",void 0),e([o()],U.prototype,"updating",null),U=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],U);export{U as BaseImageryTileSubView2D};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{assertIsSome as s}from"../../../../core/maybe.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import h from"../../../../geometry/Extent.js";import c from"../../../../geometry/Point.js";import u from"../../../../layers/support/PixelBlock.js";import d from"../../../../layers/support/TileInfo.js";import{update as p,unregister as m,getRasterId as y,register as g}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{getWorldWidth as _,computeProjectedScales as f}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import b from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import w from"../../tiling/TileQueue.js";import P from"../../tiling/TileStrategy.js";import{tileSize as I}from"../../engine/webgl/definitions.js";import{TaskPriority as R}from"../../../support/Scheduler.js";import{getWebGLCapabilities as U}from"../../../webgl/capabilities.js";const C=[0,0];let S=class extends t{constructor(){super(...arguments),this._updatingHandles=new n,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=r(async(e={})=>{const t=this._rasterFunctionState,i=e.reprocess||"gpu"===t&&!this.canUseWebGLForProcessing||"cpu"===t&&this.canUseWebGLForProcessing;if(i&&(await this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;const s=this._rasterFunctionState,{type:r}=this;return e.refetch||"raster"!==r&&!!i||"cpu"===s||"cpu"===t?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(e.signal))})}destroy(){this._updatingHandles.destroy()}get canUseWebGLForProcessing(){return!1}get canUseLocalSymbolizerParams(){return(this.canUseWebGLForProcessing||"rasterVF"===this.type)&&!this.layerView.hasTilingEffects}get isCPUBasedDRA(){const{renderer:e}=this.layer;return"raster-stretch"===e?.type&&e.dynamicRangeAdjustment&&(!this.canUseWebGLForProcessing||!("min-max"===e.stretchType||"standard-deviation"===e.stretchType))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s="toJSON"in t?t:h.fromJSON(t);p(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null!=this._symbolizerParams&&this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.isCPUBasedDRA&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()}));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){const e=U();this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new b(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile(e,t),priority:R.MAPVIEW_FETCH_QUEUE,scheduler:this.scheduler});const i=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:i,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,m(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._updatingHandles.addPromise(this._enqueueTileFetch(t)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.isCPUBasedDRA||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",()=>{e.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,s]=e,r=new u({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):"rasterFunction"in t?i:e}updateRasterFunctionParameters(){}_fetchTile(e,t){const i=this._getFetchOptions(e.level,t.signal);return this.fetchTile(e,i)}_getFetchOptions(e,t){const{canUseWebGLForProcessing:i}=this,{layerView:s}=this,{tileInfo:r}=s,a=!r.isWrappable&&null!=_(s.view.spatialReference),o=i&&this.layer.raster.hasUniqueSourceStorageInfo,{layer:l}=this.layerView,n=l.serviceRasterInfo?.storageInfo.isBsqTile?l.getRawDisplayBandIds():void 0;return{allowPartialFill:!0,datumTransformation:s.datumTransformation,interpolation:i?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:t,srcResolution:this._srcResolutions[e],timeExtent:s.timeExtent,tileInfo:r,bandIds:n,disableWrapAround:a}}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map(({scale:e})=>e),a=d.create({spatialReference:t,size:I,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map(({resolution:e})=>({x:e,y:e})))}const{scales:i,srcResolutions:r,isCustomTilingScheme:a}=f(this.layer.serviceRasterInfo,t,{tileSize:I,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),o=d.create({spatialReference:t,size:I,scales:i}),l=0===o.origin.x;s(e.fullExtent);const{xmin:n,ymax:h}=e.fullExtent;(l||a&&o.origin.x>n)&&(o.origin=new c({x:n,y:h,spatialReference:t})),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every(({scale:e},t)=>Math.abs(e-i[t].scale)<.001)}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.serviceRasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key),r=this._getBandIds();let o=!this.useProgressiveUpdate||this.isCPUBasedDRA&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){o=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){a(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}this.canUseLocalSymbolizerParams&&null==this._symbolizerParams&&this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(C,e.key),n=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:o,bandIds:r,coords:l,resolution:n}),e.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(e)}catch(s){a(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.layer.updateRenderer(),this.isCPUBasedDRA?await this._updateGlobalSymbolizerParams(e):(this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map(async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams}));await Promise.allSettled(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t=this._getFetchOptions(this.previousLOD.level,e),i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,{...t,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1});if(!i?.pixelBlock)return;const{resolution:s}=this.previousLOD,{isBsqTile:r}=this.layer.raster.rasterInfo.storageInfo,a=r?null:this._getBandIds(),o=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(a),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:a});!this.canUseWebGLForProcessing&&o&&"stretch"===o.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(o.factor=o.factor.map(e=>255*e),o.minOutput=Math.round(255*o.minOutput),o.maxOutput=Math.round(255*o.maxOutput)),this._globalSymbolizerParams=o}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{raster:s}=t,{multidimensionalDefinition:r}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),a=s.rasterInfo.multidimensionalInfo?s.getSliceIndex(r):null,o=s.rasterInfo.storageInfo.isBsqTile?t.getRawDisplayBandIds():null,l=y(s.rasterId,a,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&m(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=g(l,s.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),r=this._srcResolutions[t.level];p(l,this._blockCacheRegistryId,e.extent,e.resolution,r,s.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;await this.layer.updateRenderer(),this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.isCPUBasedDRA||!this.useProgressiveUpdate,this._tileStrategy.refresh(t=>e.push(this._enqueueTileFetch(t))),await this._updatingHandles.addPromise(Promise.allSettled(e))}};e([o()],S.prototype,"_globalUpdateRequested",void 0),e([o()],S.prototype,"attached",void 0),e([o()],S.prototype,"canUseWebGLForProcessing",null),e([o()],S.prototype,"canUseLocalSymbolizerParams",null),e([o()],S.prototype,"isCPUBasedDRA",null),e([o()],S.prototype,"container",void 0),e([o()],S.prototype,"layer",void 0),e([o()],S.prototype,"layerView",void 0),e([o()],S.prototype,"scheduler",void 0),e([o()],S.prototype,"type",void 0),e([o()],S.prototype,"useWebGLForProcessing",null),e([o()],S.prototype,"useProgressiveUpdate",null),e([o()],S.prototype,"timeExtent",void 0),e([o()],S.prototype,"updating",null),S=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],S);export{S as BaseImageryTileSubView2D};
@@ -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"../../../../Color.js";import has from"../../../../core/has.js";import{numberMaxFloat32 as r}from"../../../../core/mathUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{isFunctionRaster as o}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{getBytesPerPixel as n}from"../../../../layers/support/rasterFormats/pixelRangeUtils.js";import{convertGeometryToMask as a}from"../../../../layers/support/rasterFunctions/clipUtils.js";import{maxMapSizeGpu as l}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{RasterTileContainer as c}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as p}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as u}from"../support/util.js";import{defaultColor as h}from"../../../support/HighlightDefaults.js";import{getHighlightName as d}from"../../../support/highlightOptionsUtils.js";let m=class extends p{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t)return!1;const r=t.lookup.colormapLut?.indexedColormap,s=r&&r.length>this._maxIndexedColormapSize,i=n(this.layer.serviceRasterInfo);return!(has("ios")&&i>4)&&this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&u(this.layer))}attach(){super.attach(),this.container=new c(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{raster:e,type:t}=this.layer,{container:r}=this;if("Function"!==e.datasetFormat||"wcs"===t)return r.rasterFunctionChain=null,r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))}),void(this._rasterFunctionState="na");const s=this._rasterFunctionState,{rasterFunction:i,primaryRasters:o}=e,n=i.supportsGPU&&(!o||o.rasters.length<=1),a=n?i.flatWebGLFunctionChain:null,{renderer:l}=this.layer,c=!n||!a?.functions.length||"raster-stretch"===l?.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;r.rasterFunctionChain=c?null:this._addProjection(a);const p=null==i?"na":r.rasterFunctionChain?"gpu":"cpu",u=s===p||"na"===s&&"cpu"===p&&0===a?.functions?.length;r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!u,t.processed=!1,t.processedTexture=null)}),this._rasterFunctionState=p}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:i}=this,{source:n,globalSymbolizerParams:l,suspended:c,coords:p,resolution:u}=t,h=this.layerView.hasTilingEffects?l:t.symbolizerParams,{bitmap:d}=e;if([d.x,d.y]=p,d.resolution=u,null!=n?.pixelBlock){const e={extent:n.extent,pixelBlock:n.pixelBlock,srcPixelSize:n.srcTilePixelSize};if(d.rawPixelData=e,i)d.source=n.pixelBlock,d.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===l?.type?l:void 0);d.source=t,d.isRendereredSource=!0}d.symbolizerParameters=i?h:null,d.transformGrid=i?n.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=i?h:null,d.transformGrid=null}const{isBsqTile:m}=this.layer.raster.rasterInfo.storageInfo;d.bandIds=i&&!m?r:null,d.width=this._tileInfoView.tileInfo.size[0],d.height=this._tileInfoView.tileInfo.size[1],d.interpolation=s,d.suspended=c;const{raster:f}=this.layer;if(o(f)){const t=f.getClippingGeometry(this.layerView.view.spatialReference);if(t){const r=f.getTileExtentFromTileInfo(e.key.level,e.key.row,e.key.col,this._tileInfoView.tileInfo);d.mask=a({srcExtent:r,geometry:t,size:[d.width,d.height]})}}d.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:r,global:s}=t,i=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===s?.type?s:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?s:r:null;const{isBsqTile:c}=this.layer.raster.rasterInfo.storageInfo;a.bandIds=n&&!c?i:null,a.interpolation=o,a.suspended=!1}updateHighlightOptions(e){if(!e.length)return void(this.container.pixelHighlights=void 0);const s=[],{highlights:i}=this.layerView.view;e.sort((e,t)=>i.findIndex(({name:e})=>e===d(t.options))-i.findIndex(({name:t})=>t===d(e.options)));for(const{target:o,options:n}of e){const{pixelRanges:e}=o,a=Array.from({length:2*l},()=>0);for(let t=0;t<e.length;t++)a[2*t]=e[t][0],a[2*t+1]=e[t][1];for(let t=e.length;t<l;t++)a[2*t]=r,a[2*t+1]=-r;const c=o.bandId??0,p=d(n),u=i.find(e=>e.name===p)?.color??h,m=t.toUnitRGBA(u);s.push({ranges:a,bandId:c,color:m})}this.container.pixelHighlights=s}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.tileInfo.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([s()],m.prototype,"canUseWebGLForProcessing",null),e([s()],m.prototype,"container",void 0),e([s()],m.prototype,"layer",void 0),e([s()],m.prototype,"type",void 0),m=e([i("esri.views.2d.layers.imagery.ImageryTileView2D")],m);export{m as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import has from"../../../../core/has.js";import{numberMaxFloat32 as r}from"../../../../core/mathUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{isFunctionRaster as o}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{getBytesPerPixel as n}from"../../../../layers/support/rasterFormats/pixelRangeUtils.js";import{convertGeometryToMask as a}from"../../../../layers/support/rasterFunctions/clipUtils.js";import{maxMapSizeGpu as l}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{RasterTileContainer as c}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as p}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as u}from"../support/util.js";import{defaultColor as h}from"../../../support/HighlightDefaults.js";import{getHighlightName as d}from"../../../support/highlightOptionsUtils.js";let m=class extends p{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t)return!1;const r=t.lookup.colormapLut?.indexedColormap,s=r&&r.length>this._maxIndexedColormapSize,i=n(this.layer.serviceRasterInfo);return!(has("ios")&&i>4)&&this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&u(this.layer))}attach(){super.attach(),this.container=new c(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{raster:e,type:t}=this.layer,{container:r}=this;if("Function"!==e.datasetFormat||"wcs"===t)return r.rasterFunctionChain=null,r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))}),void(this._rasterFunctionState="na");const s=this._rasterFunctionState,{rasterFunction:i,primaryRasters:o}=e,n=i.supportsGPU&&(!o||o.rasters.length<=1),a=n?i.flatWebGLFunctionChain:null,{renderer:l}=this.layer,c=!n||!a?.functions.length||"raster-stretch"===l?.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;r.rasterFunctionChain=c?null:this._addProjection(a);const p=null==i?"na":r.rasterFunctionChain?"gpu":"cpu",u=s===p||"na"===s&&"cpu"===p&&0===a?.functions?.length;r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!u,t.processed=!1,t.processedTexture=null)}),this._rasterFunctionState=p}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:i}=this,{source:n,globalSymbolizerParams:l,suspended:c,coords:p,resolution:u}=t,h=this.isCPUBasedDRA?l:t.symbolizerParams,{bitmap:d}=e;if([d.x,d.y]=p,d.resolution=u,null!=n?.pixelBlock){const e={extent:n.extent,pixelBlock:n.pixelBlock,srcPixelSize:n.srcTilePixelSize};if(d.rawPixelData=e,i)d.source=n.pixelBlock,d.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===l?.type?l:void 0);d.source=t,d.isRendereredSource=!0}d.symbolizerParameters=i?h:null,d.transformGrid=i?n.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=i?h:null,d.transformGrid=null}const{isBsqTile:m}=this.layer.raster.rasterInfo.storageInfo;d.bandIds=i&&!m?r:null,d.width=this._tileInfoView.tileInfo.size[0],d.height=this._tileInfoView.tileInfo.size[1],d.interpolation=s,d.suspended=c;const{raster:f}=this.layer;if(o(f)){const t=f.getClippingGeometry(this.layerView.view.spatialReference);if(t){const r=f.getTileExtentFromTileInfo(e.key.level,e.key.row,e.key.col,this._tileInfoView.tileInfo);d.mask=a({srcExtent:r,geometry:t,size:[d.width,d.height]})}}d.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:r,global:s}=t,i=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===s?.type?s:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?s:r:null;const{isBsqTile:c}=this.layer.raster.rasterInfo.storageInfo;a.bandIds=n&&!c?i:null,a.interpolation=o,a.suspended=!1}updateHighlightOptions(e){if(!e.length)return void(this.container.pixelHighlights=void 0);const s=[],{highlights:i}=this.layerView.view;e.sort((e,t)=>i.findIndex(({name:e})=>e===d(t.options))-i.findIndex(({name:t})=>t===d(e.options)));for(const{target:o,options:n}of e){const{pixelRanges:e}=o,a=Array.from({length:2*l},()=>0);for(let t=0;t<e.length;t++)a[2*t]=e[t][0],a[2*t+1]=e[t][1];for(let t=e.length;t<l;t++)a[2*t]=r,a[2*t+1]=-r;const c=o.bandId??0,p=d(n),u=i.find(e=>e.name===p)?.color??h,m=t.toUnitRGBA(u);s.push({ranges:a,bandId:c,color:m})}this.container.pixelHighlights=s}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.tileInfo.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([s()],m.prototype,"canUseWebGLForProcessing",null),e([s()],m.prototype,"container",void 0),e([s()],m.prototype,"layer",void 0),e([s()],m.prototype,"type",void 0),m=e([i("esri.views.2d.layers.imagery.ImageryTileView2D")],m);export{m 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 i}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as e}from"../../../../core/asyncUtils.js";import{destroyHandle as s,handlesGroup as o}from"../../../../core/handleUtils.js";import{abortMaybe as r,removeMaybe as l}from"../../../../core/maybe.js";import{throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{getGraphicEffectiveElevationInfo as m}from"../../../../support/elevationInfoUtils.js";import{Settings as p}from"../../interactive/editingTools/settings.js";import{OutlineVisualElement as g}from"../../interactive/visualElements/OutlineVisualElement.js";import{GraphicState as u}from"../../layers/graphics/GraphicState.js";import{getInputGeometry as d,isValidInputPath as v}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{connectVisualization as f}from"../../../analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js";import{highlightsSupported as y}from"../../../support/layerViewUtils.js";let _=class extends t{constructor(i){super(i),this._highlightTask=null,this._highlightHandle=null,this._visualElementHandle=null}initialize(){this._settings=new p({getTheme:()=>this.view.effectiveTheme}),this.addHandles(f({analysisViewData:this.analysisViewData,onRemove:()=>this._remove(),onShowSketchedGraphic:i=>this._showSketchedGraphic(i),onHighlight:(i,t)=>this._highlight(i,t)}))}destroy(){this._remove()}get updating(){return null!=this._highlightTask&&!this._highlightTask.finished}_remove(){this._highlightTask=r(this._highlightTask),this._highlightHandle=l(this._highlightHandle),this._visualElementHandle=l(this._visualElementHandle)}_highlight(i,t){this._remove(),t&&"building-component"!==t.type&&"subtype-sublayer"!==t.type&&(this._highlightTask=e(async e=>{const s=await this.view.whenLayerView(t);a(e),y(s)&&(this._highlightHandle=s.highlight(i))}))}_showSketchedGraphic(i){this._remove();const{view:t}=this,e=new g({view:t,geometry:j(i),attached:!1,elevationInfo:m(i),renderOccluded:8,isDecoration:!0}),r=new u({graphic:i}),l=[h(()=>r.isDraped,i=>{e.isDraped=i}),r.on("changed",()=>e.geometry=j(i)),t.trackGraphicState(r),t.maskOccludee(i),s(e)];this._settings.visualElements.lineObjects.outline.apply(e),e.attached=!0,this._visualElementHandle=o(l)}};function j(i){const t=d(i);return v(t)?t:null}i([n({constructOnly:!0})],_.prototype,"view",void 0),i([n({constructOnly:!0})],_.prototype,"analysisViewData",void 0),i([n()],_.prototype,"updating",null),_=i([c("esri.views.3d.analysis.ElevationProfile.ElevationProfileInputVisualization3D")],_);export{_ as ElevationProfileInputVisualization3D};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as i,handlesGroup as o}from"../../../../core/handleUtils.js";import{removeMaybe as s}from"../../../../core/maybe.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{getGraphicEffectiveElevationInfo as l}from"../../../../support/elevationInfoUtils.js";import{Settings as c}from"../../interactive/editingTools/settings.js";import{OutlineVisualElement as m}from"../../interactive/visualElements/OutlineVisualElement.js";import{GraphicState as p}from"../../layers/graphics/GraphicState.js";import{isValidInputPath as h}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{connectVisualization as d}from"../../../analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js";let u=class extends t{constructor(e){super(e),this._visualElementHandle=null}initialize(){this._settings=new c({getTheme:()=>this.view.effectiveTheme}),this.addHandles(d({analysisViewData:this.analysisViewData,onRemove:()=>this._remove(),onShowSketchedGraphic:e=>this._showSketchedGraphic(e)}))}destroy(){this._remove()}get updating(){return!1}_remove(){this._visualElementHandle=s(this._visualElementHandle)}_showSketchedGraphic(e){this._remove();const{view:t}=this,s=new m({view:t,geometry:v(e),attached:!1,elevationInfo:l(e),renderOccluded:8,isDecoration:!0}),a=new p({graphic:e}),n=[r(()=>a.isDraped,e=>{s.isDraped=e}),a.on("changed",()=>s.geometry=v(e)),t.trackGraphicState(a),t.maskOccludee(e),i(s)];this._settings.visualElements.lineObjects.outline.apply(s),s.attached=!0,this._visualElementHandle=o(n)}};function v({geometry:e}){return h(e)?e:null}e([a({constructOnly:!0})],u.prototype,"view",void 0),e([a({constructOnly:!0})],u.prototype,"analysisViewData",void 0),e([a()],u.prototype,"updating",null),u=e([n("esri.views.3d.analysis.ElevationProfile.ElevationProfileInputVisualization3D")],u);export{u as ElevationProfileInputVisualization3D};
@@ -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{isIterable as t}from"../../../../core/iteratorUtils.js";import{memoize as r}from"../../../../core/memoize.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as o}from"../../../../core/unitUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as l}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../../geometry/ellipsoidUtils.js";import{create as p,fromPoints as u}from"../../../../geometry/support/ray.js";import{GeometryDescriptor as m}from"../../../../layers/support/GeometryDescriptor.js";import{externalToInternalIntersectOptions as d}from"../../support/hitTest.js";import{Intersector as y}from"../../webgl-engine/lib/Intersector.js";import{toGraphic as f}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{getInputGraphic as h}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{ElevationProfileLineComputation as v}from"../../../analysis/ElevationProfile/ElevationProfileLineComputation.js";const _=2e5;let w=class extends v{constructor(){super(...arguments),this.type="scene",this.numSamplesForPreview=50,this.numSamplesPerChunk=25,this._getQueryElevationDependenciesMemoized=r((e,t,r,i,o,n,s)=>({inputGraphicUid:j(e),visibleLayers:t,maxIntersectionDistance:r,intersectOptions:i,view:o,stationary:n,spatialReference:s})),this._vecA=a(),this._vecB=a(),this._ray=p()}get minDemResolution(){const e=this._view;if(!e)return null;const t=e.pointsOfInterest?.focus?.worldUnitsPerContentPixel;return null==t?null:t*o(e.spatialReference)}initialize(){const e=()=>this.onInvalidate(this);return this.addHandles([i(()=>this._queryElevationDependencies,e),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:r}){const i=this._queryElevationDependencies;if(null==i)throw new Error(`${this.declaredClass}: no dependencies`);const o=this._intersector;if(null==o)throw new Error(`${this.declaredClass}: no view`);const{intersectOptions:n,view:s,spatialReference:a}=i,c=s.renderCoordsHelper,p=s.sceneIntersectionHelper,d=this._vecA,y=this._vecA,f=this._vecB,h=this._ray;if(!a)return{geometry:e,noDataValue:t};const v=await m.fromGeometry(e).project(a,r);if(!v)return{geometry:e,noDataValue:t};const w=v.coordinates,j=w.length;for(let m=0;m<j;++m){const e=w[m];l(f,e.x,e.y,e.z??0),c.toRenderCoords(f,a,f),c.setAltitude(d,_,f);const r=u(d,f,h);p.computeIntersection(r,o,!0,n);const s=g(i,o.results.all);s?(s.getIntersectionPoint(y),c.fromRenderCoords(y,y,a),e.z=y[2]):e.z=t}return{geometry:v.export(),noDataValue:t}}get _queryElevationDependencies(){const e=this._view;return e?this._getQueryElevationDependenciesMemoized(this.controller?.analysis.input,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,e,e.stationary,e.spatialReference):null}get _visibleLayers(){return this._view?.map?.allLayers?.filter(e=>e.visible).toArray()??[]}get _intersectOptions(){const e=this._view;if(!e||e.destroyed)return{};const{include:r,exclude:i}=this.profile;return d(e,{include:r,exclude:[...this._pointCloudLayers,...t(i)?i:i?[i]:[]]})}get _pointCloudLayers(){const e=this._view;return e?e.allLayerViews.toArray().filter(e=>"point-cloud"===e.layer?.type).map(e=>e.layer):[]}get _view(){const e=this.controller.view;return"3d"===e.type?e:null}get _maxIntersectionDistance(){const e=this._view;return e?.renderCoordsHelper?c(e.spatialReference).radius/e.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY}get _intersector(){const e=this._view;if(!e)return null;const t=new y(e.state.viewingMode),r=t.options;return r.hud=!1,r.invisibleTerrain=!1,r.backfacesTerrain=!1,r.selectionMode=!1,r.store=2,t}};function g({view:e,inputGraphicUid:t,maxIntersectionDistance:r},i){for(const o of i){if(!o.withinDistance(r))continue;const i=f(o,e);if(null==i||j(i)!==t)return o}return null}function j(e){const t=h(e);if(!t)return null;if(t.layer&&"objectIdField"in t.layer){const e=t.attributes[t.layer.objectIdField];if(e)return`o-${t.layer.id}-${e}`}return`u-${t.uid}`}e([n({readOnly:!0})],w.prototype,"minDemResolution",null),e([n()],w.prototype,"_queryElevationDependencies",null),e([n()],w.prototype,"_visibleLayers",null),e([n()],w.prototype,"_intersectOptions",null),e([n()],w.prototype,"_pointCloudLayers",null),e([n()],w.prototype,"_view",null),e([n()],w.prototype,"_maxIntersectionDistance",null),e([n()],w.prototype,"_intersector",null),w=e([s("esri.views.3d.analysis.ElevationProfile.ElevationProfileLineSceneComputation")],w);export{w as ElevationProfileLineSceneComputation};
5
+ import{__decorate as e}from"tslib";import{isIterable as t}from"../../../../core/iteratorUtils.js";import{memoize as r}from"../../../../core/memoize.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as l}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../../geometry/ellipsoidUtils.js";import{create as p,fromPoints as u}from"../../../../geometry/support/ray.js";import{GeometryDescriptor as m}from"../../../../layers/support/GeometryDescriptor.js";import{externalToInternalIntersectOptions as y}from"../../support/hitTest.js";import{Intersector as d}from"../../webgl-engine/lib/Intersector.js";import{ElevationProfileLineComputation as f}from"../../../analysis/ElevationProfile/ElevationProfileLineComputation.js";const h=2e5;let v=class extends f{constructor(){super(...arguments),this.type="scene",this.numSamplesForPreview=50,this.numSamplesPerChunk=25,this._getQueryElevationDependenciesMemoized=r((e,t,r,o,i,s,n)=>({geometry:e,visibleLayers:t,maxIntersectionDistance:r,intersectOptions:o,view:i,stationary:s,spatialReference:n})),this._vecA=a(),this._vecB=a(),this._ray=p()}get minDemResolution(){const e=this._view;if(!e)return null;const t=e.pointsOfInterest?.focus?.worldUnitsPerContentPixel;return null==t?null:t*i(e.spatialReference)}initialize(){const e=()=>this.onInvalidate(this);return this.addHandles([o(()=>this._queryElevationDependencies,e),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:r}){const o=this._queryElevationDependencies;if(null==o)throw new Error(`${this.declaredClass}: no dependencies`);const i=this._intersector;if(null==i)throw new Error(`${this.declaredClass}: no view`);const{intersectOptions:s,view:n,spatialReference:a}=o,c=n.renderCoordsHelper,p=n.sceneIntersectionHelper,y=this._vecA,d=this._vecA,f=this._vecB,v=this._ray;if(!a)return{geometry:e,noDataValue:t};const g=await m.fromGeometry(e).project(a,r);if(!g)return{geometry:e,noDataValue:t};const w=g.coordinates,D=w.length;for(let m=0;m<D;++m){const e=w[m];l(f,e.x,e.y,e.z??0),c.toRenderCoords(f,a,f),c.setAltitude(y,h,f);const r=u(y,f,v);p.computeIntersection(r,i,!0,s);const n=_(o,i.results.all);n?(n.getIntersectionPoint(d),c.fromRenderCoords(d,d,a),e.z=d[2]):e.z=t}return{geometry:g.export(),noDataValue:t}}get _queryElevationDependencies(){const e=this._view;return e?this._getQueryElevationDependenciesMemoized(this.controller?.analysis.geometry,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,e,e.stationary,e.spatialReference):null}get _visibleLayers(){return this._view?.map?.allLayers?.filter(e=>e.visible).toArray()??[]}get _intersectOptions(){const e=this._view;if(!e||e.destroyed)return{};const{include:r,exclude:o}=this.profile;return y(e,{include:r,exclude:[...this._pointCloudLayers,...t(o)?o:o?[o]:[]]})}get _pointCloudLayers(){const e=this._view;return e?e.allLayerViews.toArray().filter(e=>"point-cloud"===e.layer?.type).map(e=>e.layer):[]}get _view(){const e=this.controller.view;return"3d"===e.type?e:null}get _maxIntersectionDistance(){const e=this._view;return e?.renderCoordsHelper?c(e.spatialReference).radius/e.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY}get _intersector(){const e=this._view;if(!e)return null;const t=new d(e.state.viewingMode),r=t.options;return r.hud=!1,r.invisibleTerrain=!1,r.backfacesTerrain=!1,r.selectionMode=!1,r.store=2,t}};function _({maxIntersectionDistance:e},t){for(const r of t)if(r.withinDistance(e))return r;return null}e([s({readOnly:!0})],v.prototype,"minDemResolution",null),e([s()],v.prototype,"_queryElevationDependencies",null),e([s()],v.prototype,"_visibleLayers",null),e([s()],v.prototype,"_intersectOptions",null),e([s()],v.prototype,"_pointCloudLayers",null),e([s()],v.prototype,"_view",null),e([s()],v.prototype,"_maxIntersectionDistance",null),e([s()],v.prototype,"_intersector",null),v=e([n("esri.views.3d.analysis.ElevationProfile.ElevationProfileLineSceneComputation")],v);export{v as ElevationProfileLineSceneComputation};
@@ -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"../../../../Color.js";import i from"../../../../core/Accessor.js";import{watch as s,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{throttle as r}from"../../../../core/throttle.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as n,fromArray as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{OutlineVisualElement as m}from"../../interactive/visualElements/OutlineVisualElement.js";import{getConfig as u}from"../../../analysis/ElevationProfile/constants.js";import{getInputGeometry as c}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{createLineGeometry as f}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let v=class extends i{constructor(e){super(e),this._updateGeometryThrottled=r(e=>{e&&(this._visualElement.visible=!0,this._visualElement.geometry=f(e.samples,e.spatialReference))},u().profileLinesUpdateThrottleMillis)}initialize(){this._visualElement=new m({view:this.view,elevationInfo:{mode:"absolute-height",offset:0},innerWidth:0,innerColor:n(0,0,0,0),width:3,falloff:0,renderOccluded:16,isDecoration:!0}),this.addHandles([s(()=>({color:this.getResult()?.computation.profile.color,visible:this._effectiveVisible}),({color:e,visible:i})=>{e&&(this._visualElement.color=p(t.toUnitRGBA(e))),this._visualElement.visible=i,i||(this._visualElement.geometry=null)},o),s(()=>c(this.analysisViewData.analysis.input),()=>{this._visualElement.visible=!1,this._visualElement.geometry=null},o),s(()=>this._geometryUpdateParameters,e=>this._updateGeometryThrottled(e),o),this._updateGeometryThrottled])}destroy(){this._visualElement.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _result(){return this.getResult()}get _effectiveVisible(){const{analysisViewData:e,_result:t}=this;return e.visible&&null!=t&&t.available&&t.computation.profile.viewOptions.lineVisible}get _geometryUpdateParameters(){if(!this._effectiveVisible)return null;const e=this._result;return 1!==e?.progress?null:{samples:e.samples,spatialReference:this.view.spatialReference}}};e([l()],v.prototype,"view",void 0),e([l()],v.prototype,"analysisViewData",void 0),e([l()],v.prototype,"getResult",void 0),e([l()],v.prototype,"updating",null),e([l()],v.prototype,"_result",null),e([l()],v.prototype,"_effectiveVisible",null),e([l()],v.prototype,"_geometryUpdateParameters",null),v=e([a("esri.views.3d.analysis.ElevationProfile.ElevationProfileLineVisualization3D")],v);export{v as ElevationProfileLineVisualization3D};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{watch as s,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{throttle as r}from"../../../../core/throttle.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as n,fromArray as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{OutlineVisualElement as m}from"../../interactive/visualElements/OutlineVisualElement.js";import{getConfig as u}from"../../../analysis/ElevationProfile/constants.js";import{createLineGeometry as c}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let f=class extends i{constructor(e){super(e),this._updateGeometryThrottled=r(e=>{e&&(this._visualElement.visible=!0,this._visualElement.geometry=c(e.samples,e.spatialReference))},u().profileLinesUpdateThrottleMillis)}initialize(){this._visualElement=new m({view:this.view,elevationInfo:{mode:"absolute-height",offset:0},innerWidth:0,innerColor:n(0,0,0,0),width:3,falloff:0,renderOccluded:16,isDecoration:!0}),this.addHandles([s(()=>({color:this.getResult()?.computation.profile.color,visible:this._effectiveVisible}),({color:e,visible:i})=>{e&&(this._visualElement.color=p(t.toUnitRGBA(e))),this._visualElement.visible=i,i||(this._visualElement.geometry=null)},o),s(()=>this.analysisViewData.analysis.geometry,()=>{this._visualElement.visible=!1,this._visualElement.geometry=null},o),s(()=>this._geometryUpdateParameters,e=>this._updateGeometryThrottled(e),o),this._updateGeometryThrottled])}destroy(){this._visualElement.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _result(){return this.getResult()}get _effectiveVisible(){const{analysisViewData:e,_result:t}=this;return e.visible&&null!=t&&t.available&&t.computation.profile.viewOptions.lineVisible}get _geometryUpdateParameters(){if(!this._effectiveVisible)return null;const e=this._result;return 1!==e?.progress?null:{samples:e.samples,spatialReference:this.view.spatialReference}}};e([l()],f.prototype,"view",void 0),e([l()],f.prototype,"analysisViewData",void 0),e([l()],f.prototype,"getResult",void 0),e([l()],f.prototype,"updating",null),e([l()],f.prototype,"_result",null),e([l()],f.prototype,"_effectiveVisible",null),e([l()],f.prototype,"_geometryUpdateParameters",null),f=e([a("esri.views.3d.analysis.ElevationProfile.ElevationProfileLineVisualization3D")],f);export{f as ElevationProfileLineVisualization3D};
@@ -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{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as r}from"./AnalysisView3D.js";import{ElevationProfileLineSceneComputation as i}from"./ElevationProfile/ElevationProfileLineSceneComputation.js";import{ElevationProfileVisualization3D as s}from"./ElevationProfile/ElevationProfileVisualization3D.js";import{ElevationProfileController as l}from"../../analysis/ElevationProfile/ElevationProfileController.js";import{ElevationProfileLineGroundComputation as n}from"../../analysis/ElevationProfile/ElevationProfileLineGroundComputation.js";import{ElevationProfileLineInputComputation as a}from"../../analysis/ElevationProfile/ElevationProfileLineInputComputation.js";import{ElevationProfileLineQueryComputation as p}from"../../analysis/ElevationProfile/ElevationProfileLineQueryComputation.js";import{ElevationProfileTool as c}from"../../analysis/ElevationProfile/ElevationProfileTool.js";let u=class extends r{constructor(t){super(t),this.type="elevation-profile-view-3d",this.analysis=null,this.hoveredPosition=null}initialize(){const{analysis:t,view:e}=this;this._controller=new l({analysis:t,analysisViewData:this,view:e,computationFactory:{create:t=>{switch(t.profile.type){case"ground":return new n(t);case"input":return new a(t);case"query":return new p(t);case"scene":return new i(t)}}}}),this._visualization=new s({view:e,analysisViewData:this}),this._sketchTool=new c({view:e,analysisViewData:this})}destroy(){this._controller?.destroy(),this._visualization?.destroy(),this._sketchTool?.destroy()}get effectiveUnits(){return this._controller?.effectiveUnits??{distance:"meters",elevation:"meters"}}get error(){return this._controller?.error}get hoveredPoints(){return this._controller?.hoveredPoints??[]}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get progress(){return this._controller?.progress??0}get results(){return this._controller?.results??[]}get statistics(){return this._controller?.statistics}get updating(){return!0===this._controller?.updating||!0===this._visualization?.updating||!0===this._sketchTool?.updating}get visible(){return super.visible}set visible(t){super.visible=t}get sketchGraphic(){return this._sketchTool?.sketchGraphic}get toolState(){return this._sketchTool?.state??"idle"}place(t){return this._sketchTool.place(t)}pickGraphic(t){return this._sketchTool.pickGraphic(t)}};t([e({readOnly:!0})],u.prototype,"type",void 0),t([e({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",void 0),t([e({readOnly:!0})],u.prototype,"effectiveUnits",null),t([e({readOnly:!0})],u.prototype,"error",null),t([e()],u.prototype,"hoveredPosition",void 0),t([e()],u.prototype,"hoveredPoints",null),t([e({readOnly:!0})],u.prototype,"progress",null),t([e({readOnly:!0})],u.prototype,"results",null),t([e({readOnly:!0})],u.prototype,"statistics",null),t([e({readOnly:!0})],u.prototype,"updating",null),t([e()],u.prototype,"sketchGraphic",null),t([e()],u.prototype,"toolState",null),t([e()],u.prototype,"_controller",void 0),t([e()],u.prototype,"_visualization",void 0),t([e()],u.prototype,"_sketchTool",void 0),u=t([o("esri.views.3d.analysis.ElevationProfileAnalysisView3D")],u);const h=u;export{h as default};
5
+ import{__decorate as t}from"tslib";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 o}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as i}from"./AnalysisView3D.js";import{ElevationProfileLineSceneComputation as r}from"./ElevationProfile/ElevationProfileLineSceneComputation.js";import{ElevationProfileVisualization3D as s}from"./ElevationProfile/ElevationProfileVisualization3D.js";import{ElevationProfileController as l}from"../../analysis/ElevationProfile/ElevationProfileController.js";import{ElevationProfileLineGroundComputation as n}from"../../analysis/ElevationProfile/ElevationProfileLineGroundComputation.js";import{ElevationProfileLineInputComputation as a}from"../../analysis/ElevationProfile/ElevationProfileLineInputComputation.js";import{ElevationProfileLineQueryComputation as p}from"../../analysis/ElevationProfile/ElevationProfileLineQueryComputation.js";import{ElevationProfileTool as c}from"../../analysis/ElevationProfile/ElevationProfileTool.js";let u=class extends i{constructor(t){super(t),this.type="elevation-profile-view-3d",this.analysis=null,this.hoveredPosition=null}initialize(){const{analysis:t,view:e}=this;this._controller=new l({analysis:t,analysisViewData:this,view:e,computationFactory:{create:t=>{switch(t.profile.type){case"ground":return new n(t);case"input":return new a(t);case"query":return new p(t);case"scene":return new r(t)}}}}),this._visualization=new s({view:e,analysisViewData:this}),this._sketchTool=new c({view:e,analysisViewData:this})}destroy(){this._controller?.destroy(),this._visualization?.destroy(),this._sketchTool?.destroy()}get effectiveDisplayUnits(){return this._controller?.effectiveDisplayUnits??{distance:"meters",elevation:"meters"}}get error(){return this._controller?.error}get hoveredPoints(){return this._controller?.hoveredPoints??[]}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get progress(){return this._controller?.progress??0}get results(){return this._controller?.results??[]}get statistics(){return this._controller?.statistics}get updating(){return!0===this._controller?.updating||!0===this._visualization?.updating||!0===this._sketchTool?.updating}get visible(){return super.visible}set visible(t){super.visible=t}get sketchGraphic(){return this._sketchTool?.sketchGraphic}get toolState(){return this._sketchTool?.state??"idle"}place(t){return this._sketchTool.place(t)}pickGraphic(t){return this._sketchTool.pickGraphic(t)}};t([e({readOnly:!0})],u.prototype,"type",void 0),t([e({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",void 0),t([e({readOnly:!0})],u.prototype,"effectiveDisplayUnits",null),t([e({readOnly:!0})],u.prototype,"error",null),t([e()],u.prototype,"hoveredPosition",void 0),t([e()],u.prototype,"hoveredPoints",null),t([e({readOnly:!0})],u.prototype,"progress",null),t([e({readOnly:!0})],u.prototype,"results",null),t([e({readOnly:!0})],u.prototype,"statistics",null),t([e({readOnly:!0})],u.prototype,"updating",null),t([e()],u.prototype,"sketchGraphic",null),t([e()],u.prototype,"toolState",null),t([e()],u.prototype,"_controller",void 0),t([e()],u.prototype,"_visualization",void 0),t([e()],u.prototype,"_sketchTool",void 0),u=t([o("esri.views.3d.analysis.ElevationProfileAnalysisView3D")],u);const y=u;export{y 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{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as n}from"../../../core/promiseUtils.js";import{watch as l,when as a,sync as u,whenOnce as p}from"../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as w,intersection as v,toExtent as T,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as R}from"../../../geometry/support/spatialReferenceUtils.js";import S from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as j,getPositions as L,getFlowSimulationSettings as A}from"../../2d/engine/flow/utils.js";import U from"./SubView3D.js";import{makeScheduleFunction as P}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as x,fadeOutTime as E,fadeInTime as I,defaultTransitionDuration as k,transitionDurationFactor as M,averageLoadingTimeSmoothingFactor as V}from"../support/flow/constants.js";import{isFullExtent as C,FlowQuery3D as q,wrappedWidth as z}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as F}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as D,createStreamlineGeometry as B}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as W}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as G}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as H}from"../support/flow/StreamlineResources3DShape.js";import{tilesAreRelated as O}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as N}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as Q}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as J,hasLayerBasedScaleVisibility as K}from"../../support/layerViewUtils.js";import{TaskPriority as X}from"../../support/Scheduler.js";let Y=class extends U{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this._averageLoadingTime=h(0),this._abortController=null,this._frameTask=null,this._tilesUpdateIsWaiting=!1,this._transitionEnabled=!0,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(r),this.renderedTiles=i}),this._transitionEnabled=!0}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new F(P(i)),this._frameTask=i.scheduler.registerTask(X.FLOW_GENERATOR),this._updateTask=d({update:this._update.bind(this)}),this.addHandles([l(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&j(e,t)}),l(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),l(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),l(()=>[this._dataBounds,this._featureTilesBounds,this._loadAllTiles],()=>this._triggerTilesUpdate()),l(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),a(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return g(this.view.spatialReference).radius}get _loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=x}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:w(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...D(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:I,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&N(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _transitionDuration(){const{_averageLoadingTime:e}=this;return h(0===e?k:this._averageLoadingTime*M)}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??Z}startPositions(e){if(!this._transitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:L(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return R(this.surface.spatialReference)}get layer(){return this.layerView.layer}get updating(){return this.updatingHandles.updating||this.requireLoad}get visibleAtCurrentScale(){return!K()||J(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=A(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}getSimulationSettings(e){const{_simulationSettings:t,spatialReferenceInfo:i}=this;if(null==t)return null;const r="global"===this.view.viewingMode&&null!=i&&C(e.extent.xmin,e.extent.xmax,i);return{...t,wrapAround:r}}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null}_update(e){if(!this.requireLoad||this.updatingHandles.updating)return;const t=c(e.time);if(this._transitionEnabled&&!this._lastResourceIsTransitioned(t))return;const{renderedTiles:i}=this;if(null==i||0===i.size)return;const r=async()=>{const e=performance.now();await this._load(i,t,this._transitionDuration);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=V;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t,i){const{view:r}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const s=this._computeExtent(e);if(null==s)return;const o=this._transitionEnabled&&null!=this._resources?h(t+i):t,l=new q(s,this.layerView.timeExtent,this._viewSizeWithEqualRatio(s),r.state.contentPixelRatio,o);null==this._abortController&&(this._abortController=new AbortController);const a=this._abortController,u=await this._loadStreamlines(l,a.signal);if(n(a.signal),this._visible&&null!=u){u.attach(),this._lastResources?.detach(),this._transitionEnabled?this._lastResources=this._resources:this._resources?.detach(),this._resources=u;const e=performance.now()/1e3,t=this._transitionEnabled&&e>o?e:o;null!=this._lastResources&&(this._lastResources.endTime=t),this._resources.startTime=t}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i||0===i.length)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new G(e,i,s,r,this.view.overlayManager):new H(e,i,s,r,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new Q(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:n}=this;function*l(l){for(let a=0;a<t.length;++a)r.push(B(n,e,t[a],s,i,o)),l.madeProgress(),l.done&&(l=yield)}return await this._frameTask.scheduleGenerator(l),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=W(e,this.spatialReferenceInfo);return null==i?null:(v(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await p(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this._loadAllTiles)return t=>t.leaf&&$(e,t.extent);const s=t=>t.rendered&&t.visible&&$(e,t.extent),{featureTiles:o}=i;if(!o)return s;const n=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&$(r,e.extent)&&n.some(({lij:i})=>t(i,e.lij)||O(i,e.lij))}_viewSizeWithEqualRatio(e){const t=z(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_lastResourceIsTransitioned(e){const{_lastResources:t,_resources:i,_flowRenderer:r}=this;if(null==t||null==i||null==r)return!0;return i.startTime+E<e}get test(){}};e([f()],Y.prototype,"type",void 0),e([f()],Y.prototype,"renderedTiles",void 0),e([f()],Y.prototype,"_resources",void 0),e([f()],Y.prototype,"_lastResources",void 0),e([f()],Y.prototype,"requireLoad",void 0),e([f()],Y.prototype,"_averageLoadingTime",void 0),e([f()],Y.prototype,"emissiveStrength",void 0),e([f()],Y.prototype,"_clippingArea",null),e([f()],Y.prototype,"_dataBounds",null),e([f()],Y.prototype,"_draped",null),e([f()],Y.prototype,"_ellipsoidRadius",null),e([f()],Y.prototype,"_loadAllTiles",null),e([f()],Y.prototype,"_featureTilesBounds",null),e([f()],Y.prototype,"_flowRenderer",null),e([f()],Y.prototype,"_materialParameters",null),e([f()],Y.prototype,"_opacity",null),e([f()],Y.prototype,"_transitionDuration",null),e([f()],Y.prototype,"_visible",null),e([f()],Y.prototype,"elevationInfo",null),e([f()],Y.prototype,"needsMagnitude",null),e([f()],Y.prototype,"spatialReferenceInfo",null),e([f()],Y.prototype,"layer",null),e([f()],Y.prototype,"updating",null),e([f()],Y.prototype,"visibleAtCurrentScale",null),e([f()],Y.prototype,"_overrideMaterialParameters",void 0),e([f()],Y.prototype,"_overrideSimulationSettings",void 0),e([f()],Y.prototype,"_simulationSettings",null),e([f()],Y.prototype,"surface",null),Y=e([_("esri.views.3d.layers.FlowSubView3D")],Y);const Z=new S({mode:"on-the-ground"});function $(e,t){return null==e||null==t||b(e,t)}export{Y as default};
5
+ import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as n}from"../../../core/promiseUtils.js";import{watch as l,when as a,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as w,intersection as v,toExtent as T,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as R}from"../../../geometry/support/spatialReferenceUtils.js";import S from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as j,getPositions as L,getFlowSimulationSettings as A}from"../../2d/engine/flow/utils.js";import U from"./SubView3D.js";import{makeScheduleFunction as P}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as x,fadeOutTime as E,fadeInTime as I,defaultTransitionDuration as k,transitionDurationFactor as M,averageLoadingTimeSmoothingFactor as V}from"../support/flow/constants.js";import{isFullExtent as C,FlowQuery3D as q,wrappedWidth as z}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as F}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as D,createStreamlineGeometry as B}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as W}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as G}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as H}from"../support/flow/StreamlineResources3DShape.js";import{tilesAreRelated as O}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as N}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as Q}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as J,hasLayerBasedScaleVisibility as K}from"../../support/layerViewUtils.js";import{TaskPriority as X}from"../../support/Scheduler.js";let Y=class extends U{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this._averageLoadingTime=h(0),this._abortController=null,this._frameTask=null,this._tilesUpdateIsWaiting=!1,this._transitionEnabled=!0,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(r),this.renderedTiles=i}),this._transitionEnabled=!0}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new F(P(i)),this._frameTask=i.scheduler.registerTask(X.FLOW_GENERATOR),this._updateTask=p({update:this._update.bind(this)}),this.addHandles([l(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&j(e,t)}),l(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),l(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),l(()=>[this._dataBounds,this._featureTilesBounds,this._loadAllTiles],()=>this._triggerTilesUpdate()),l(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),a(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return g(this.view.spatialReference).radius}get _loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=x}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:w(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...D(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:I,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&N(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _transitionDuration(){const{_averageLoadingTime:e}=this;return h(0===e?k:this._averageLoadingTime*M)}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??Z}startPositions(e){if(!this._transitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:L(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return R(this.surface.spatialReference)}get layer(){return this.layerView.layer}get readyToLoad(){return null!=this.renderedTiles&&this.renderedTiles.size>0}get updating(){return this.updatingHandles.updating||this.requireLoad}get visibleAtCurrentScale(){return!K()||J(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=A(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}getSimulationSettings(e){const{_simulationSettings:t,spatialReferenceInfo:i}=this;if(null==t)return null;const r="global"===this.view.viewingMode&&null!=i&&C(e.extent.xmin,e.extent.xmax,i);return{...t,wrapAround:r}}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null}_update(e){if(!this.requireLoad||this.updatingHandles.updating)return;const t=c(e.time);if(this._transitionEnabled&&!this._lastResourceIsTransitioned(t))return;if(!this.readyToLoad)return;const i=async()=>{const e=performance.now();await this._load(this.renderedTiles,t,this._transitionDuration);const i=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(i)};this.updatingHandles.addPromise(o(i())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=V;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t,i){const{view:r}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const s=this._computeExtent(e);if(null==s)return;const o=this._transitionEnabled&&null!=this._resources?h(t+i):t,l=new q(s,this.layerView.timeExtent,this._viewSizeWithEqualRatio(s),r.state.contentPixelRatio,o);null==this._abortController&&(this._abortController=new AbortController);const a=this._abortController,u=await this._loadStreamlines(l,a.signal);if(n(a.signal),this._visible&&null!=u){u.attach(),this._lastResources?.detach(),this._transitionEnabled?this._lastResources=this._resources:this._resources?.detach(),this._resources=u;const e=performance.now()/1e3,t=this._transitionEnabled&&e>o?e:o;null!=this._lastResources&&(this._lastResources.endTime=t),this._resources.startTime=t}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i||0===i.length)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new G(e,i,s,r,this.view.overlayManager):new H(e,i,s,r,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new Q(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:n}=this;function*l(l){for(let a=0;a<t.length;++a)r.push(B(n,e,t[a],s,i,o)),l.madeProgress(),l.done&&(l=yield)}return await this._frameTask.scheduleGenerator(l),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=W(e,this.spatialReferenceInfo);return null==i?null:(v(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this._loadAllTiles)return t=>t.leaf&&$(e,t.extent);const s=t=>t.rendered&&t.visible&&$(e,t.extent),{featureTiles:o}=i;if(!o)return s;const n=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&$(r,e.extent)&&n.some(({lij:i})=>t(i,e.lij)||O(i,e.lij))}_viewSizeWithEqualRatio(e){const t=z(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_lastResourceIsTransitioned(e){const{_lastResources:t,_resources:i,_flowRenderer:r}=this;if(null==t||null==i||null==r)return!0;return i.startTime+E<e}get test(){}};e([f()],Y.prototype,"type",void 0),e([f()],Y.prototype,"renderedTiles",void 0),e([f()],Y.prototype,"_resources",void 0),e([f()],Y.prototype,"_lastResources",void 0),e([f()],Y.prototype,"requireLoad",void 0),e([f()],Y.prototype,"_averageLoadingTime",void 0),e([f()],Y.prototype,"emissiveStrength",void 0),e([f()],Y.prototype,"_clippingArea",null),e([f()],Y.prototype,"_dataBounds",null),e([f()],Y.prototype,"_draped",null),e([f()],Y.prototype,"_ellipsoidRadius",null),e([f()],Y.prototype,"_loadAllTiles",null),e([f()],Y.prototype,"_featureTilesBounds",null),e([f()],Y.prototype,"_flowRenderer",null),e([f()],Y.prototype,"_materialParameters",null),e([f()],Y.prototype,"_opacity",null),e([f()],Y.prototype,"_transitionDuration",null),e([f()],Y.prototype,"_visible",null),e([f()],Y.prototype,"elevationInfo",null),e([f()],Y.prototype,"needsMagnitude",null),e([f()],Y.prototype,"spatialReferenceInfo",null),e([f()],Y.prototype,"layer",null),e([f()],Y.prototype,"updating",null),e([f()],Y.prototype,"visibleAtCurrentScale",null),e([f()],Y.prototype,"_overrideMaterialParameters",void 0),e([f()],Y.prototype,"_overrideSimulationSettings",void 0),e([f()],Y.prototype,"_simulationSettings",null),e([f()],Y.prototype,"surface",null),Y=e([_("esri.views.3d.layers.FlowSubView3D")],Y);const Z=new S({mode:"on-the-ground"});function $(e,t){return null==e||null==t||b(e,t)}export{Y as default};