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

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 (210) hide show
  1. package/Color.js +1 -1
  2. package/Ground.js +1 -1
  3. package/WebScene.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/004b13c1db79c9e668b1.js +1 -0
  6. package/assets/esri/core/workers/chunks/{700b5a536f97233bc4af.js → 03b455e9405a8b6fec68.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{a244afea77127e54dd3a.js → 08b0fc6bfe9640ee2525.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0a981061df08da19372c.js +1 -0
  9. package/assets/esri/core/workers/chunks/20003728a679479b14dc.js +1 -0
  10. package/assets/esri/core/workers/chunks/352511dbc67166face40.js +1 -0
  11. package/assets/esri/core/workers/chunks/3acd79a6a0572926a799.js +1 -0
  12. package/assets/esri/core/workers/chunks/3d7923d25734d03a4d27.js +1 -0
  13. package/assets/esri/core/workers/chunks/48133effac2eacc2196e.js +1 -0
  14. package/assets/esri/core/workers/chunks/4dfcd03082be83600f3a.js +1 -0
  15. package/assets/esri/core/workers/chunks/503c81dda242e6077317.js +1 -0
  16. package/assets/esri/core/workers/chunks/{06aed0a5464965be8d52.js → 56b3bb68b61b77138186.js} +1 -1
  17. package/assets/esri/core/workers/chunks/5746c4861af83c1d57a8.js +1 -0
  18. package/assets/esri/core/workers/chunks/5aacd1c6b171c99b41f5.js +1 -0
  19. package/assets/esri/core/workers/chunks/5eb7f6f5121c8830c561.js +1 -0
  20. package/assets/esri/core/workers/chunks/6810ecdeccf4b7eae5e2.js +1 -0
  21. package/assets/esri/core/workers/chunks/6b208f5d423da64c8559.js +1 -0
  22. package/assets/esri/core/workers/chunks/{8bdbd94a59269e216fba.js → 6c3b585b9cb6bb640fb0.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{7a240ab31d9ff2d2c5af.js → 73db6c070b049fe05147.js} +1 -1
  24. package/assets/esri/core/workers/chunks/801451fb572bc5f1f270.js +1 -0
  25. package/assets/esri/core/workers/chunks/82e0d22619dc26920ca9.js +1 -0
  26. package/assets/esri/core/workers/chunks/{6aa349e1adf844df4b5b.js → 8b9a50cfaa5a7df02dad.js} +1 -1
  27. package/assets/esri/core/workers/chunks/8de9e50de0ac66ae1573.js +1 -0
  28. package/assets/esri/core/workers/chunks/8f426cb210a4250517d5.js +1 -0
  29. package/assets/esri/core/workers/chunks/94ddf029698991d853b9.js +1 -0
  30. package/assets/esri/core/workers/chunks/97eb2cfc1f036feea9a9.js +1 -0
  31. package/assets/esri/core/workers/chunks/{a85acb948cc7d22be592.js → 992b1389710d716d3450.js} +1 -1
  32. package/assets/esri/core/workers/chunks/9adecee0ed2f1df3b0d2.js +1 -0
  33. package/assets/esri/core/workers/chunks/a0fab8cd791c33d3895d.js +1 -0
  34. package/assets/esri/core/workers/chunks/{e99fc64b67bb0c71dc34.js → ad67e5eb4b8c0c14cea6.js} +1 -1
  35. package/assets/esri/core/workers/chunks/b5c829e904bc9cb5347d.js +1 -0
  36. package/assets/esri/core/workers/chunks/bec9ddd38c9ab9f2561b.js +1 -0
  37. package/assets/esri/core/workers/chunks/bf9031749d10e7d457b6.js +1 -0
  38. package/assets/esri/core/workers/chunks/bf9d09493fd849ea69fd.js +1 -0
  39. package/assets/esri/core/workers/chunks/{58e2652810143f509fe1.js → c473b15d4d52f0a63d20.js} +1 -1
  40. package/assets/esri/core/workers/chunks/c8e4fe0e3b109eb80e8e.js +1 -0
  41. package/assets/esri/core/workers/chunks/cd0c222a36caa7f80860.js +1 -0
  42. package/assets/esri/core/workers/chunks/ce175801937e80e3c487.js +1 -0
  43. package/assets/esri/core/workers/chunks/{100a0041ee42b0b2fa32.js → e5d974593043d5e2b502.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{1194c2432c31def87db1.js → f71b76c9506178124fa3.js} +1 -1
  45. package/assets/esri/themes/base/_core.scss +0 -2
  46. package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +10 -7
  47. package/assets/esri/themes/dark/main.css +1 -1
  48. package/assets/esri/themes/light/main.css +1 -1
  49. package/assets/esri/themes/light/view.css +1 -1
  50. package/chunks/CutFillComposition.glsl.js +15 -3
  51. package/chunks/CutFillMask.glsl.js +1 -1
  52. package/chunks/languageUtils.js +1 -1
  53. package/config.js +1 -1
  54. package/core/CollectionFlattener.js +1 -1
  55. package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +1 -1
  56. package/geometry/operators/json/graphicBufferOperator.js +1 -1
  57. package/geometry/support/aaBoundingRect.js +1 -1
  58. package/geometry/support/geometryUtils.js +1 -1
  59. package/geometry/support/meshUtils/elevationSampler.js +1 -1
  60. package/geometry/support/meshUtils.js +1 -1
  61. package/geometry/support/triangle.js +1 -1
  62. package/interfaces.d.ts +33 -242
  63. package/kernel.js +1 -1
  64. package/layers/BaseElevationLayer.js +1 -1
  65. package/layers/BaseTileLayer.js +1 -1
  66. package/layers/ElevationLayer.js +1 -1
  67. package/layers/FeatureLayer.js +1 -1
  68. package/layers/GaussianSplatLayer.js +1 -1
  69. package/layers/ImageryTileLayer.js +1 -1
  70. package/layers/ParquetLayer.js +1 -1
  71. package/layers/graphics/sources/ParquetSource.js +1 -1
  72. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  73. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  74. package/layers/support/ElevationQuery.js +1 -1
  75. package/layers/support/ElevationQueryContext.js +5 -0
  76. package/layers/support/ElevationSampler.js +1 -1
  77. package/layers/support/ElevationTile.js +1 -1
  78. package/layers/support/GeometryDescriptor.js +1 -1
  79. package/layers/support/ParquetEncodingLocation.js +1 -1
  80. package/layers/support/ParquetEncodingWkb.js +1 -1
  81. package/layers/support/RasterBandInfo.js +1 -1
  82. package/layers/support/TileElevationSampler.js +5 -0
  83. package/layers/support/TileInfo.js +1 -1
  84. package/layers/support/TileKey.js +1 -1
  85. package/layers/support/TilemapCache.js +1 -1
  86. package/layers/support/layerUtils.js +1 -1
  87. package/layers/support/parquetEncodingUtils.js +5 -0
  88. package/layers/support/parquetUtils.js +1 -1
  89. package/networks/UtilityNetwork.js +1 -1
  90. package/networks/support/typeUtils.js +1 -1
  91. package/package.json +2 -2
  92. package/popup/FieldInfo.js +1 -1
  93. package/rest/networks/support/Association.js +1 -1
  94. package/rest/print.js +1 -1
  95. package/support/revision.js +1 -1
  96. package/symbols/cim/CIMSymbolHelper.js +1 -1
  97. package/symbols/cim/cimAnalyzer.js +1 -1
  98. package/symbols/cim/effects/EffectOffset.js +1 -1
  99. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  100. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  101. package/views/2d/engine/Stage.js +1 -1
  102. package/views/2d/engine/flow/BrushFlow.js +1 -1
  103. package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
  104. package/views/2d/engine/webgl/Overlay.js +1 -1
  105. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  106. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  107. package/views/2d/engine/webgl/TextureManager.js +1 -1
  108. package/views/2d/engine/webgl/animatedFormats/AnimatableTextureResource.js +1 -1
  109. package/views/2d/engine/webgl/animatedFormats/utils.js +1 -1
  110. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  111. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  112. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
  113. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
  114. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
  115. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
  116. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
  117. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  118. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  119. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
  120. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
  121. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
  122. package/views/2d/engine/webgl/shaderGraph/utils.js +1 -1
  123. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  124. package/views/2d/layers/VideoLayerView2D.js +1 -1
  125. package/views/2d/navigation/actions/Pan.js +1 -1
  126. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  127. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  128. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
  129. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  130. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  131. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  132. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  133. package/views/3d/support/hitTest.js +1 -1
  134. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  135. package/views/3d/support/popupHitTest.js +1 -1
  136. package/views/3d/terrain/ExtentHelper.js +1 -1
  137. package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
  138. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  139. package/views/SceneView.js +1 -1
  140. package/views/View2D.js +1 -1
  141. package/views/Viewport2DMixin.js +1 -1
  142. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  143. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
  144. package/views/analysis/ElevationProfile/ElevationProfileLineQueryComputation.js +1 -1
  145. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  146. package/views/analysis/ExclusiveOperationManager.js +5 -0
  147. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  148. package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
  149. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  150. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  151. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  152. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  153. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
  154. package/views/interactive/snapping/featureSources/featureServiceSource/PendingFeatureTile.js +1 -1
  155. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  156. package/views/navigation/Navigation.js +1 -1
  157. package/views/support/GroundViewElevationSampler.js +1 -1
  158. package/views/video/VideoOperationalDataView.js +1 -1
  159. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  160. package/widgets/Feature/FeatureExpression.js +1 -1
  161. package/widgets/Feature/FeatureMedia.js +1 -1
  162. package/widgets/Feature/FeatureViewModel.js +1 -1
  163. package/widgets/Feature.js +1 -1
  164. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  165. package/widgets/FeatureTable.js +1 -1
  166. package/widgets/Legend/LegendViewModel.js +1 -1
  167. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  168. package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
  169. package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
  170. package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +1 -1
  171. package/widgets/OrientedImageryViewer/services/DepthImageService.js +5 -0
  172. package/widgets/PanoramicViewer.js +1 -1
  173. package/widgets/Sketch/SketchViewModel.js +1 -1
  174. package/assets/esri/core/workers/chunks/08374e5805fcedc1cb57.js +0 -1
  175. package/assets/esri/core/workers/chunks/14114be3afd6d292f89c.js +0 -1
  176. package/assets/esri/core/workers/chunks/2605062e44f2d4e73f14.js +0 -1
  177. package/assets/esri/core/workers/chunks/282c4f3484c605ce7d5e.js +0 -1
  178. package/assets/esri/core/workers/chunks/2e1cc11462846febb3b2.js +0 -1
  179. package/assets/esri/core/workers/chunks/37b5007660535f1c91c6.js +0 -1
  180. package/assets/esri/core/workers/chunks/393274af1804e5b6046a.js +0 -1
  181. package/assets/esri/core/workers/chunks/3ff3e1507220d3869c76.js +0 -1
  182. package/assets/esri/core/workers/chunks/4133ab8720e7e4afa9a6.js +0 -1
  183. package/assets/esri/core/workers/chunks/4d807bfe75108438db83.js +0 -1
  184. package/assets/esri/core/workers/chunks/5ad1985a9e66fb2232ae.js +0 -1
  185. package/assets/esri/core/workers/chunks/5b7a2ee44883b1fb2a5f.js +0 -1
  186. package/assets/esri/core/workers/chunks/614a00a3179f8fe23f45.js +0 -1
  187. package/assets/esri/core/workers/chunks/83065bef261314f9b2c5.js +0 -1
  188. package/assets/esri/core/workers/chunks/8cae725e631d922853c8.js +0 -1
  189. package/assets/esri/core/workers/chunks/8f4cfef97716c3502b0f.js +0 -1
  190. package/assets/esri/core/workers/chunks/9bb6984f24cd5461a754.js +0 -1
  191. package/assets/esri/core/workers/chunks/9f2a3f37fe9b19ef1209.js +0 -1
  192. package/assets/esri/core/workers/chunks/a1196637268b89281780.js +0 -1
  193. package/assets/esri/core/workers/chunks/b240298b8b643a323d34.js +0 -1
  194. package/assets/esri/core/workers/chunks/b47f26d6aa9a2848a677.js +0 -1
  195. package/assets/esri/core/workers/chunks/b661ea374fe38c8e29ca.js +0 -1
  196. package/assets/esri/core/workers/chunks/b8997ae5893afa0298d1.js +0 -1
  197. package/assets/esri/core/workers/chunks/baa48614d9567d5f240d.js +0 -1
  198. package/assets/esri/core/workers/chunks/c20862fe15295a294bbd.js +0 -1
  199. package/assets/esri/core/workers/chunks/c3020747f9001ca6a6e7.js +0 -1
  200. package/assets/esri/core/workers/chunks/c7c76a8a1c47eb62bef1.js +0 -1
  201. package/assets/esri/core/workers/chunks/eea9d49d55c2d1355497.js +0 -1
  202. package/assets/esri/core/workers/chunks/fb6ebb780bb59e252887.js +0 -1
  203. package/assets/esri/core/workers/chunks/ff6d189ba78980d40bb5.js +0 -1
  204. package/assets/esri/themes/base/widgets/_ButtonMenu.scss +0 -87
  205. package/widgets/FeatureTable/Grid/support/ButtonMenu.d.ts +0 -4
  206. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +0 -5
  207. package/widgets/FeatureTable/Grid/support/ButtonMenuItem.d.ts +0 -4
  208. package/widgets/FeatureTable/Grid/support/ButtonMenuItem.js +0 -5
  209. package/widgets/FeatureTable/Grid/support/ButtonMenuViewModel.d.ts +0 -4
  210. package/widgets/FeatureTable/Grid/support/ButtonMenuViewModel.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import u from"../graphic/ImageryTileGraphicOrigin.js";import h from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as g}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as S}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{legendEnabled as I,screenSizePerspectiveEnabled as O}from"./support/commonProperties.js";import b from"./support/Field.js";import{getServicePixelValueField as P,getRawServicePixelValueField as x,getRasterAttributeTableFields as T,getMagnitudeField as N,getDirectionField as L,getMultidimensionalFields as J,commonRasterFieldNames as C,setDefaultRasterFieldFormats as M}from"./support/rasterFieldUtils.js";import E from"./support/RasterFunction.js";import{isFunctionRaster as U,getPrimaryRasters as $}from"./support/rasterDatasets/datasetUtils.js";import D from"./support/rasterDatasets/FunctionRaster.js";import z from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as B,create as A}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as W,elevationModeUnsupportedMessage as G,featureExpressionUnsupportedMessage as k}from"../support/elevationInfoUtils.js";import{createPopupTemplate as V}from"../support/popupUtils.js";import H from"../symbols/support/ElevationInfo.js";let Y=class extends(y(F(v(w(S(f(g(R(_(d(j(o(r(h)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new u(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a(async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return s(this,t);case 1:return i(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[P("Pixel Value"),x("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=T(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=N(t),s=L();e.push(r,s)}if(i){const t=J(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==C.rawServicePixelValue)),s=V({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&M(s.fieldInfos,i),s}async generateRasterInfo(e,t){if(e=c(E,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=U(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=$(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&B(t.toJSON(),i);const o=await Promise.all(i.map(e=>z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=o.findIndex(e=>null==e);if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await z.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=A(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new D({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){W(i.getLogger(this),G("ImageryTile layers","relative-to-scene",e)),W(i.getLogger(this),k("ImageryTile layers",e))}};e([l({clonable:!1})],Y.prototype,"_primaryRasters",void 0),e([l({type:H,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Y.prototype,"elevationInfo",null),e([l({readOnly:!0,clonable:!1})],Y.prototype,"graphicOrigin",void 0),e([l(I)],Y.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Y.prototype,"isReference",void 0),e([l({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],Y.prototype,"blendMode",void 0),e([l({type:E,json:{name:"renderingRule",write:!0}})],Y.prototype,"rasterFunction",void 0),e([l()],Y.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],Y.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],Y.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],Y.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],Y.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([l(O)],Y.prototype,"screenSizePerspectiveEnabled",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"fields",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"rasterFields",null),e([l({constructOnly:!0})],Y.prototype,"source",void 0),Y=e([m("esri.layers.ImageryTileLayer")],Y);const q=Y;export{q as default};
5
+ import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import u from"../graphic/ImageryTileGraphicOrigin.js";import h from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as g}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as S}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{legendEnabled as I,screenSizePerspectiveEnabled as O}from"./support/commonProperties.js";import b from"./support/Field.js";import{getServicePixelValueField as P,getRawServicePixelValueField as x,getRasterAttributeTableFields as T,getMagnitudeField as N,getDirectionField as L,getMultidimensionalFields as J,commonRasterFieldNames as C,setDefaultRasterFieldFormats as M}from"./support/rasterFieldUtils.js";import E from"./support/RasterFunction.js";import{isFunctionRaster as U,getPrimaryRasters as $}from"./support/rasterDatasets/datasetUtils.js";import D from"./support/rasterDatasets/FunctionRaster.js";import W from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as z,create as B}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as A,elevationModeUnsupportedMessage as G,featureExpressionUnsupportedMessage as k}from"../support/elevationInfoUtils.js";import{createPopupTemplate as V}from"../support/popupUtils.js";import H from"../symbols/support/ElevationInfo.js";let Y=class extends(y(F(v(w(S(f(g(R(_(d(j(o(r(h)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new u(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a(async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return s(this,t);case 1:return i(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[P("Pixel Value"),x("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=T(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=N(t),s=L();e.push(r,s)}if(i){const t=J(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==C.rawServicePixelValue)),s=V({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&M(s.fieldInfos,i),s}async generateRasterInfo(e,t){if(e=c(E,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsWrite(){const e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){if(this.supportsWrite())return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=U(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=$(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&z(t.toJSON(),i);const o=await Promise.all(i.map(e=>W.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=o.findIndex(e=>null==e);if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await W.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await W.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=B(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new D({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){A(i.getLogger(this),G("ImageryTile layers","relative-to-scene",e)),A(i.getLogger(this),k("ImageryTile layers",e))}};e([l({clonable:!1})],Y.prototype,"_primaryRasters",void 0),e([l({type:H,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Y.prototype,"elevationInfo",null),e([l({readOnly:!0,clonable:!1})],Y.prototype,"graphicOrigin",void 0),e([l(I)],Y.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Y.prototype,"isReference",void 0),e([l({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],Y.prototype,"blendMode",void 0),e([l({type:E,json:{name:"renderingRule",write:!0}})],Y.prototype,"rasterFunction",void 0),e([l()],Y.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],Y.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],Y.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],Y.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],Y.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([l(O)],Y.prototype,"screenSizePerspectiveEnabled",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"fields",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"rasterFields",null),e([l({constructOnly:!0})],Y.prototype,"source",void 0),Y=e([m("esri.layers.ImageryTileLayer")],Y);const q=Y;export{q 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"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Collection.js";import o from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{watch as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import l from"../geometry/SpatialReference.js";import d from"../graphic/ParquetGraphicOrigin.js";import m from"./Layer.js";import{ParquetSource as c}from"./graphics/sources/ParquetSource.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as h}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as g}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as j}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{OrderedLayer as x}from"./mixins/OrderedLayer.js";import{PortalLayer as F}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as b}from"./mixins/TemporalLayer.js";import{labelsVisible as I}from"./support/commonProperties.js";import O from"./support/FeatureTemplate.js";import R from"./support/Field.js";import{defineFieldProperties as q}from"./support/fieldProperties.js";import{fixRendererFields as P,fixTimeInfoFields as T}from"./support/fieldUtils.js";import w from"./support/LabelClass.js";import{reader as C}from"./support/labelingInfo.js";import{ParquetEncodingBase as Q}from"./support/ParquetEncodingBase.js";import D from"./support/ParquetEncodingLocation.js";import z from"./support/ParquetEncodingWkb.js";import{completeParquetLayerInfo as B,parquetGeometryTypeKebabDict as E}from"./support/parquetUtils.js";import{rendererTypes as A}from"../renderers/support/typeUtils.js";import L from"../rest/support/Query.js";import{createPopupTemplate as G}from"../support/popupUtils.js";const U=q(),M="__OBJECTID",W={types:{key:"type",base:Q,typeMap:{wkb:z,location:D}}};let _=class extends(h(j(g(y(x(b(S(v(F(p(f(r(m))))))))))))){constructor(e){super(e),this.capabilities=k(),this.copyright=null,this.displayOptimization=null,this.fields=null,this.fieldsIndex=null,this.encoding=null,this.geometryType=null,this.graphicOrigin=new d(this),this.labelsVisible=!0,this.labelingInfo=null,this.objectIdField=M,this.outFields=null,this.popupTemplate=null,this.source=null,this.spatialReference=l.WGS84,this.templates=null,this.title="Parquet",this.type="parquet",this.urls=new s}async load(e){return this.addResolvingPromise(this._load(e)),this.addHandles([a(()=>this.urls,e=>this.source?.updateFiles(e.items)),a(()=>this.customParameters,e=>this.source?.setCustomParameters(e))]),this}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return null==this.geometryType}set renderer(e){P(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return G(this,e)}createQuery(){const e=new L;return e.returnGeometry=!0,e.outFields=["*"],e}async createSource(e){const t=await B({urls:this.urls,fields:this.fields,encoding:this.encoding,geometryType:this.geometryType,spatialReference:this.spatialReference,file:this.file},{customParameters:this.customParameters});let{fields:r,geometryType:s,encoding:p,spatialReference:a,urls:n,file:u,displayOptimization:d}=t;if(null==r)throw new o("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",t);if(a){if(!a.isGeographic&&!a.isWebMercator)throw new o("parquet-layer:unsupported","Unable to create parquet source: currently only geographic and Web Mercator supported",t);a.isGeographic&&!a.isWGS84&&(i.getLogger("parquet-layer").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:t.spatialReference}),a=l.WGS84)}r.push(new R({name:M,type:"oid",alias:M}));const m=new c({urls:n.items,fields:r,objectIdField:M,spatialReference:a,encoding:p,geometryType:s,file:u,customParameters:this.customParameters??void 0,displayOptimization:d});return await m.load(e),m}getFieldDomain(e,t){return null}getField(e){return this.fieldsIndex.get(e)}async queryFeatures(e,t){await this.load();const r=await this.source.queryFeatures(this._normalizeQuery(e),t),s=this.graphicOrigin;if(r?.features)for(const o of r.features)o.layer=o.sourceLayer=this,o.origin=s;return r}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(this._normalizeQuery(e),t)}async queryFeatureCount(e,t){return await this.load(),this.source.queryFeatureCount(this._normalizeQuery(e),t)}async queryExtent(e,t){return await this.load(),this.source.queryExtent(this._normalizeQuery(e),t)}_normalizeQuery(e){return L.from(e)??this.createQuery()}async _load(e){const t=await this.createSource(e);this._set("source",t),this.fields=t.fields,this.objectIdField=t.objectIdField,this.encoding=t.encoding,this.file=t.file,this.geometryType=t.geometryType,t.spatialReference&&(this.spatialReference=t.spatialReference),this.displayOptimization=t.displayOptimization,t.fullExtent&&(this.fullExtent=t.fullExtent),P(this.renderer,this.fieldsIndex),T(this.timeInfo,this.fieldsIndex)}};e([n({readOnly:!0,json:{read:!1,write:!1}})],_.prototype,"capabilities",void 0),e([n({type:String})],_.prototype,"copyright",void 0),e([n({readOnly:!0})],_.prototype,"defaultPopupTemplate",null),e([n()],_.prototype,"displayOptimization",void 0),e([n({type:[R],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],_.prototype,"fields",void 0),e([n(U.fieldsIndex)],_.prototype,"fieldsIndex",void 0),e([n(W)],_.prototype,"encoding",void 0),e([n({json:{read:{reader:E.read}}})],_.prototype,"geometryType",void 0),e([n({readOnly:!0,clonable:!1})],_.prototype,"graphicOrigin",void 0),e([n(I)],_.prototype,"labelsVisible",void 0),e([n({type:[w],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:C},write:!0}})],_.prototype,"labelingInfo",void 0),e([n()],_.prototype,"file",void 0),e([n({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],_.prototype,"objectIdField",void 0),e([n(U.outFields)],_.prototype,"outFields",void 0),e([n({type:t,json:{name:"popupInfo",write:!0}})],_.prototype,"popupTemplate",void 0),e([n({types:A,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"}}}})],_.prototype,"renderer",null),e([n({json:{read:!1},cast:null,type:c,readOnly:!0})],_.prototype,"source",void 0),e([n({type:l})],_.prototype,"spatialReference",void 0),e([n({type:[O]})],_.prototype,"templates",void 0),e([n()],_.prototype,"title",void 0),e([n({json:{read:!1},readOnly:!0})],_.prototype,"type",void 0),e([n({type:s.ofType(String)})],_.prototype,"urls",void 0),_=e([u("esri.layers.ParquetLayer")],_);const H=_;function k(){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryBins:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:8e3,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,standardMaxRecordCount:void 0,supportsCacheHint:!1,supportsCentroid:!1,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,supportsTrueCurve:!1,tileMaxRecordCount:void 0},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}export{H as default};
5
+ import{__decorate as e}from"tslib";import r from"../PopupTemplate.js";import{ClonableMixin as t}from"../core/Clonable.js";import i from"../core/Collection.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{watch as s}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import a from"../geometry/Extent.js";import l from"../geometry/SpatialReference.js";import u from"../graphic/ParquetGraphicOrigin.js";import m from"./Layer.js";import{ParquetSource as d}from"./graphics/sources/ParquetSource.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as c}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as f}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as h}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as j}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{OrderedLayer as v}from"./mixins/OrderedLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as b}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as w}from"./mixins/TemporalLayer.js";import{labelsVisible as I}from"./support/commonProperties.js";import O from"./support/FeatureTemplate.js";import P from"./support/Field.js";import{defineFieldProperties as q}from"./support/fieldProperties.js";import{fixRendererFields as F,fixTimeInfoFields as L}from"./support/fieldUtils.js";import S from"./support/LabelClass.js";import{reader as T}from"./support/labelingInfo.js";import{ParquetEncodingBase as _}from"./support/ParquetEncodingBase.js";import E from"./support/ParquetEncodingLocation.js";import R from"./support/ParquetEncodingWkb.js";import{parquetGeometryTypeKebabDict as C}from"./support/parquetUtils.js";import{rendererTypes as Q}from"../renderers/support/typeUtils.js";import z from"../rest/support/Query.js";import{createPopupTemplate as D}from"../support/popupUtils.js";const U=q(),k="__OBJECTID",B={types:{key:"type",base:_,typeMap:{wkb:R,location:E}}};let G=class extends(f(j(h(y(v(w(b(g(x(o(c(t(m))))))))))))){constructor(e){super(e),this.copyright=null,this.displayOptimization=null,this.fields=null,this.fieldsIndex=null,this.encoding=null,this.fullExtent=null,this.geometryType=null,this.graphicOrigin=new u(this),this.labelsVisible=!0,this.labelingInfo=null,this.objectIdField=k,this.outFields=null,this.popupTemplate=null,this.source=null,this.spatialReference=null,this.templates=null,this.title="Parquet",this.type="parquet",this.urls=new i}async load(e){return this.addResolvingPromise(this._load(e)),this.addHandles([s(()=>this.urls,e=>this.source?.updateFiles(e.items)),s(()=>this.customParameters,e=>this.source?.setCustomParameters(e))]),this}get capabilities(){return this.source?.capabilities}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return null==this.encoding}set renderer(e){F(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return D(this,e)}createQuery(){const e=new z;return e.returnGeometry=!0,e.outFields=["*"],e}async createSource(e){const r=new d({layer:this});return await r.load(e),r}getFieldDomain(e,r){return null}getField(e){return this.fieldsIndex.get(e)}async queryFeatures(e,r){await this.load();const t=await this.source.queryFeatures(this._normalizeQuery(e),r),i=this.graphicOrigin;if(t?.features)for(const o of t.features)o.layer=o.sourceLayer=this,o.origin=i;return t}async queryObjectIds(e,r){return await this.load(),this.source.queryObjectIds(this._normalizeQuery(e),r)}async queryFeatureCount(e,r){return await this.load(),this.source.queryFeatureCount(this._normalizeQuery(e),r)}async queryExtent(e,r){return await this.load(),this.source.queryExtent(this._normalizeQuery(e),r)}_normalizeQuery(e){return z.from(e)??this.createQuery()}async _load(e){const r=await this.createSource(e);this._set("source",r),this.read(r.sourceJSON,{origin:"service"}),this.revert(["fields","timeInfo"],"service"),F(this.renderer,this.fieldsIndex),L(this.timeInfo,this.fieldsIndex),null==this.spatialReference&&(this.spatialReference=l.WGS84)}};e([p({readOnly:!0,json:{read:!1,write:!1}})],G.prototype,"capabilities",null),e([p({type:String})],G.prototype,"copyright",void 0),e([p({readOnly:!0})],G.prototype,"defaultPopupTemplate",null),e([p()],G.prototype,"displayOptimization",void 0),e([p({type:[P],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],G.prototype,"fields",void 0),e([p(U.fieldsIndex)],G.prototype,"fieldsIndex",void 0),e([p(B)],G.prototype,"encoding",void 0),e([p({type:a,json:{name:"extent"}})],G.prototype,"fullExtent",void 0),e([p({json:{read:{reader:C.read}}})],G.prototype,"geometryType",void 0),e([p({readOnly:!0,clonable:!1})],G.prototype,"graphicOrigin",void 0),e([p(I)],G.prototype,"labelsVisible",void 0),e([p({type:[S],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:T},write:!0}})],G.prototype,"labelingInfo",void 0),e([p()],G.prototype,"file",void 0),e([p({type:String,readOnly:!0})],G.prototype,"objectIdField",void 0),e([p(U.outFields)],G.prototype,"outFields",void 0),e([p({type:r,json:{name:"popupInfo",write:!0}})],G.prototype,"popupTemplate",void 0),e([p({types:Q,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{write:!1}}}})],G.prototype,"renderer",null),e([p({json:{read:!1},cast:null,type:d,readOnly:!0})],G.prototype,"source",void 0),e([p({json:{read:{source:"extent.spatialReference"}}})],G.prototype,"spatialReference",void 0),e([p({type:[O]})],G.prototype,"templates",void 0),e([p()],G.prototype,"title",void 0),e([p({json:{read:!1},readOnly:!0})],G.prototype,"type",void 0),e([p({type:i.ofType(String)})],G.prototype,"urls",void 0),G=e([n("esri.layers.ParquetLayer")],G);const J=G;export{J as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{Loadable as r}from"../../../core/Loadable.js";import o from"../../../core/Logger.js";import{open as s}from"../../../core/workers/workers.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Extent.js";import l from"../../support/FieldsIndex.js";import{toParquetJSONGeometryType as u}from"../../support/parquetUtils.js";import p from"../../../rest/support/FeatureSet.js";let c=class extends r{constructor(e){super(e),this.type="parquet",this.urls=null,this.fields=null,this.objectIdField=null,this.spatialReference=null}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this._initialize(t)),Promise.resolve(this)}destroy(){this._connection.destroy()}setCustomParameters(e){this.customParameters=e,this._proxy.setCustomParameters(this.customParameters).catch(()=>{o.getLogger(this).warn("Failed to update customParameters")})}async updateFiles(e){this.urls=e,await this._proxy.updateFiles(e)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._proxy.queryFeatures(e.toJSON(),{signal:t?.signal})}async queryFeatures(e,t={}){const r=await this.queryFeaturesJSON(e,{signal:t?.signal});return p.fromJSON(r)}async queryObjectIds(e,t){return await this._proxy.queryObjectIds(e.toJSON(),{signal:t?.signal})}async queryFeatureCount(e,t){return this._proxy.queryFeatureCount(e.toJSON(),{signal:t?.signal})}async queryExtent(e,t){if(null==this.encoding)return o.getLogger(this).warn("Tried to queryExtent, but source does not have a geometry. Returning null extent."),{count:0,extent:null};const r=await this._proxy.queryExtent(e.toJSON(),{signal:t?.signal});return{count:r.count,extent:a.fromJSON(r.extent)}}async _initialize(e){let r;if(this._connection=await s("ParquetSourceWorker",{strategy:"dedicated"}),this._proxy=this._connection.createInvokeProxy(),this.geometryType&&this.encoding){if(!this.spatialReference)throw new t("parquet:unsupported","SpatialReference must be defined");r={geometryType:u(this.geometryType),spatialReference:this.spatialReference.toJSON(),encoding:this.encoding.toJSON(),displayOptimization:this.displayOptimization}}const o=new l(this.fields).toJSON(),{extent:i}=await this._proxy.load({urls:this.urls,metadata:{fieldsIndex:o,geometryType:r?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:r?.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null},geometryInfo:r,customParameters:this.customParameters});this.fullExtent=i?a.fromJSON(i):null}};e([i()],c.prototype,"type",void 0),e([i()],c.prototype,"urls",void 0),e([i()],c.prototype,"fields",void 0),e([i()],c.prototype,"encoding",void 0),e([i()],c.prototype,"geometryType",void 0),e([i()],c.prototype,"objectIdField",void 0),e([i()],c.prototype,"spatialReference",void 0),e([i()],c.prototype,"file",void 0),e([i()],c.prototype,"customParameters",void 0),e([i()],c.prototype,"displayOptimization",void 0),e([i()],c.prototype,"fullExtent",void 0),c=e([n("esri.layers.graphics.sources.ParquetSource")],c);export{c as ParquetSource};
5
+ import{__decorate as t}from"tslib";import{Loadable as s}from"../../../core/Loadable.js";import e from"../../../core/Logger.js";import{open as r}from"../../../core/workers/workers.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Extent.js";import{toParquetJSONGeometryType as i}from"../../support/parquetUtils.js";import u from"../../../rest/support/FeatureSet.js";let n=class extends s{constructor(t){super(t),this.type="parquet"}load(t){const s=null!=t?t.signal:null;return this.addResolvingPromise(this._initialize(s)),Promise.resolve(this)}destroy(){this._connection.destroy()}setCustomParameters(t){this._proxy.setCustomParameters(t).catch(()=>{e.getLogger(this).warn("Failed to update customParameters")})}async updateFiles(t){await this._proxy.updateFiles(t)}async queryFeaturesJSON(t,s={}){return await this.load(s),this._proxy.queryFeatures(t.toJSON(),{signal:s?.signal})}async queryFeatures(t,s={}){const e=await this.queryFeaturesJSON(t,{signal:s?.signal});return u.fromJSON(e)}async queryObjectIds(t,s){return await this._proxy.queryObjectIds(t.toJSON(),{signal:s?.signal})}async queryFeatureCount(t,s){return this._proxy.queryFeatureCount(t.toJSON(),{signal:s?.signal})}async queryExtent(t,s){if(null==this.layer.encoding)return e.getLogger(this).warn("Tried to queryExtent, but source does not have a geometry. Returning null extent."),{count:0,extent:null};const r=await this._proxy.queryExtent(t.toJSON(),{signal:s?.signal});return{count:r.count,extent:a.fromJSON(r.extent)}}async _initialize(t){this._connection=await r("ParquetSourceWorker",{strategy:"dedicated"}),this._proxy=this._connection.createInvokeProxy();const{layerDefinition:s}=await this._proxy.load({urls:this.layer.urls.items,fields:this.layer.fields?.map(t=>t.toJSON()),geometryType:this.layer.geometryType?i(this.layer.geometryType):null,spatialReference:this.layer.spatialReference?.toJSON(),encoding:this.layer.encoding?.toJSON(),displayOptimization:this.layer.displayOptimization,customParameters:this.layer.customParameters});this.sourceJSON=s,this.capabilities=l()}};function l(){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryBins:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:8e3,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,standardMaxRecordCount:void 0,supportsCacheHint:!1,supportsCentroid:!1,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,supportsTrueCurve:!1,tileMaxRecordCount:void 0},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}t([o()],n.prototype,"type",void 0),t([o({constructOnly:!0})],n.prototype,"layer",void 0),t([o()],n.prototype,"sourceJSON",void 0),t([o()],n.prototype,"capabilities",void 0),n=t([p("esri.layers.graphics.sources.ParquetSource")],n);export{n as ParquetSource};
@@ -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{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import{assertIsSome as o}from"../../../../core/maybe.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import a from"../../../../geometry/SpatialReference.js";import{set as i,create as u,expandWithRect as l,expandWithAABB as f,negativeInfinity as c,fromRect as d}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as m,QueryEngine as h}from"../../data/QueryEngine.js";import{QueryEngineResult as y}from"../../data/QueryEngineResult.js";import p from"../../../support/FieldsIndex.js";import{collectSQLFieldNames as _}from"../../../support/fieldUtils.js";import{createParquetFile as g,readGeoMetadata as I}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as w}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as x}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as R}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as F}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as C}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const q=new w,j=8e3;class b{constructor(){this._fileInfos=new Map,this._queue=new n({concurrency:1,process:(e,t)=>this._executeQuery(e,t)})}async load(r){this.setCustomParameters(r.customParameters),this._geometryInfo=r.geometryInfo;for(const e of r.urls){const t=await g(e,{geometryInfo:r.geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters});this._fileInfos.set(e,{index:this._fileInfos.size,file:t})}this._metadata=F.createFeature(r.metadata),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:r.geometryInfo?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.fromJSON(r.geometryInfo?.spatialReference),aggregateAdapter:null,timeInfo:null,definitionExpression:null};const s=this._fileInfos.values().next().value;if(!s)return{extent:null};const{fields:o,timeZoneByFieldName:n}=r.metadata.fieldsIndex,f=o.map(e=>({...e,column:s.file.columnForFieldName(e.name)})),d=p.fromJSON({fields:f,timeZoneByFieldName:n});if(this._fieldsIndex=d,r.metadata.spatialReference&&(this._fullExtent=E(this._fileInfos.values(),r.metadata.spatialReference)),null==this._fullExtent&&"location"===r.geometryInfo?.encoding.type){const{latitudeFieldName:s,longitudeFieldName:o}=r.geometryInfo.encoding,n=this._fieldsIndex.get(s)?.column,a=this._fieldsIndex.get(o)?.column,f=i(u(),c);for(const r of this._fileInfos.values())for(const s of r.file.rowGroups()){const r={stack:[],error:void 0,hasError:!1};try{const t=e(r,s.columnDescriptorForAttribute(n),!1),o=e(r,s.columnDescriptorForAttribute(a),!1),i=[o.minValue(),t.minValue(),o.maxValue(),t.maxValue()];l(f,i),s.free()}catch(m){r.error=m,r.hasError=!0}finally{t(r)}}this._fullExtent={xmin:f[0],ymin:f[1],xmax:f[3],ymax:f[4],spatialReference:r.metadata.spatialReference}}return{extent:this._fullExtent}}destroy(){for(const e of this._fileInfos.values())e.file.free();this._fileInfos.clear(),this._queue.destroy()}setCustomParameters(e){this._customParameters=e}async updateFiles(e){const t=new Set(e);for(const[r,s]of this._fileInfos.entries())t.has(r)?t.delete(r):(s.file.free(),this._fileInfos.delete(r));for(const r of t){const e=await g(r,{geometryInfo:this._geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters});this._fileInfos.set(r,{index:this._fileInfos.size,file:e})}}async queryFeatures(e,t){if(this._validateQuery(e),e.objectIds?.length){return(await this._enqueueQuery(e,t)).createQueryResponse()}e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0;return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){if(this._validateQuery(e),!Q(e))return this._getFeatureCount();e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.resultOffset=e.resultOffset??0,delete e.outFields,delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponseForCount()}async queryObjectIds(e,t){if(this._validateQuery(e),!Q(e))return Array.from({length:this._getFeatureCount()},(e,t)=>t);e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0,delete e.returnGeometry,delete e.outFields;return(await this._enqueueQuery(e,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){if(this._validateQuery(e),this._fullExtent&&!Q(e))return{count:this._getFeatureCount(),extent:this._fullExtent};const s=r(this._metadata.spatialReference);e.resultOffset=e.resultOffset??0,e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.returnGeometry=!0,delete e.outFields;const o=i(u(),c),n=u(),a=await this._enqueueQuery(e,t);let l=0;for(const r of a.items)r.getBounds(n)&&(f(o,n),l+=1);return{count:l,extent:m(o,s,e.outSR?r(e.outSR):s,s,!1)}}_getFeatureCount(){return Array.from(this._fileInfos.values()).reduce((e,t)=>e+t.file.numRows(),0)}_validateQuery(e){if(e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e})}async*_fetchChunks(e,t){for(const r of this._fileInfos.values()){const s=r.file.numRows(),o=Math.ceil(s/j);for(let n=0;n<o;n++){const s=n*j,o=await r.file.readChunk(s,j,e.fields,e.returnGeometry,t);for(const e of o){const t=new C(this._metadata,this._fieldsIndex,e,0,r.index),s=new x(t,null,0,!1),o=S(this._metadata,[s],this._queryEngineParams);yield o}}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const r=await this._getReadParams(e);if(e.objectIds?.length)for(const o of this._fileInfos.values()){const s=[],n=(await o.file.readChunksByRowId(new Uint32Array(e.objectIds),r.fields,r.returnGeometry,t)).map((e,t)=>new C(this._metadata,this._fieldsIndex,e,t,o.index)).map((e,t)=>new x(e,null,t,!1)),a=S(this._metadata,n,this._queryEngineParams),i=await a.executeQueryForOpaqueFeatures(e,t);for(const e of i)s.push(e);return new y(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}let s=e.resultRecordCount,n=e.resultOffset;o(s),o(n),delete e.resultRecordCount,delete e.resultOffset;const a=[];for await(const o of this._fetchChunks(r,t)){const r=await o.executeQueryForOpaqueFeatures(e,t);if(r.length>n){const t=r.slice(n,Math.min(n+s,r.length));for(const e of t)a.push(e);if(n=0,s-=t.length,0===s)return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}else n-=r.length}return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}async _getReadParams(e){const t=new Set;if(e.where&&await _(t,this._fieldsIndex,e.where),e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:this._getAttributeIds(Array.from(t)),returnGeometry:!!e.returnGeometry||!!e.geometry}}_getAttributeIds(e){if(null==e)return new Uint32Array;if(e.includes("*"))return new Uint32Array(this._fieldsIndex.fields.map(e=>e.column).filter(e=>null!=e));const t=[];for(const r of e){const e=this._fieldsIndex.get(r);if(null==e)throw new s("unknown-field",`Field ${r} does not exist`);null==e.column||t.push(e.column)}return new Uint32Array(t)}}function Q(e){return Object.keys(e).some(e=>v(e))}function v(e){switch(e){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"where":case"objectIds":case"historicMoment":return!0;default:return!1}}function S(e,t,r){const s=new R(()=>e);for(const o of t)s.insert(o);return new h({...r,featureStore:s})}function O(e){switch(e.length){case 4:return d(u(),e);case 6:return e;default:throw new s("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function E(e,t){const r=i(u(),c);for(const s of e){const e=I(s.file);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const o=O(t.bbox);f(r,o)}return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t}}export{b as default};
5
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../../../core/Collection.js";import{toConst as s}from"../../../../core/compilerUtils.js";import o from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{QueueProcessor as a}from"../../../../core/QueueProcessor.js";import u from"../../../../geometry/SpatialReference.js";import{set as l,create as f,expandWithRect as c,expandWithAABB as d,negativeInfinity as m,fromRect as p}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as h,QueryEngine as y}from"../../data/QueryEngine.js";import{QueryEngineResult as g}from"../../data/QueryEngineResult.js";import{createDrawingInfo as _}from"./clientSideDefaults.js";import w from"../../../support/Field.js";import I from"../../../support/FieldsIndex.js";import{collectSQLFieldNames as R}from"../../../support/fieldUtils.js";import{fromParquetEncodingJSON as x}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as F,fromParquetJSONGeometryType as S,toParquetJSONGeometryType as j}from"../../../support/parquetUtils.js";import{createParquetFile as b,readGeoMetadata as q}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as C}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as O}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as v}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as Q}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as E}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const G=new C,T=8e3,P="__OBJECTID";class N{constructor(){this._fileInfos=new Map,this._queue=new a({concurrency:1,process:(e,t)=>this._executeQuery(e,t)})}async load(s){const i=s.spatialReference?u.fromJSON(s.spatialReference):void 0;if(i&&!i.isWGS84&&!i.isWebMercator)throw new o("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");const a=await F({urls:new r(s.urls),fields:s.fields?.map(e=>w.fromJSON(e)),encoding:s.encoding?x(s.encoding):s.encoding,geometryType:s.geometryType?S(s.geometryType):null,spatialReference:i},{customParameters:s.customParameters});let d;if(a.geometryType&&a.encoding){if(!a.spatialReference)throw new o("parquet:unsupported","SpatialReference must be defined");if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new o("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(n.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:a.spatialReference}),a.spatialReference=u.WGS84),d={geometryType:j(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.encoding.toJSON(),displayOptimization:a.displayOptimization}}this.setCustomParameters(s.customParameters),this._geometryInfo=d;for(const e of s.urls){const t=await b(e,{geometryInfo:d,outSpatialReference:null,getCustomParameters:()=>this._customParameters});this._fileInfos.set(e,{index:this._fileInfos.size,file:t})}const p=this._fileInfos.values().next().value?.file;if(!p)return{layerDefinition:{}};const{fields:h}=a;if(null==h)throw new o("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",h);h.push(new w({name:P,type:"oid",alias:P}));const y={fields:h.map(e=>({...e.toJSON(),column:p.columnForFieldName(e.name)})),timeZoneByFieldName:null},g=I.fromJSON(y);this._fieldsIndex=g;const R=j(a.geometryType??"point");if(this._metadata=Q.createFeature({fieldsIndex:y,geometryType:R,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:u.fromJSON(d?.spatialReference),aggregateAdapter:null,timeInfo:null,definitionExpression:null},a.spatialReference&&(this._fullExtent=W(this._fileInfos.values(),a.spatialReference.toJSON())),null==this._fullExtent&&"location"===a.encoding?.type){const{latitudeFieldName:r,longitudeFieldName:s}=a.encoding,o=this._fieldsIndex.get(r)?.column,n=this._fieldsIndex.get(s)?.column,i=l(f(),m);for(const a of this._fileInfos.values())for(const r of a.file.rowGroups()){const s={stack:[],error:void 0,hasError:!1};try{const t=e(s,r.columnDescriptorForAttribute(o),!1),a=e(s,r.columnDescriptorForAttribute(n),!1),u=[a.minValue(),t.minValue(),a.maxValue(),t.maxValue()];c(i,u),r.free()}catch(q){s.error=q,s.hasError=!0}finally{t(s)}}this._fullExtent={xmin:i[0],ymin:i[1],xmax:i[3],ymax:i[4],spatialReference:a.spatialReference?.toJSON()}}return{layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:_(R),extent:this._fullExtent??void 0,geometryType:R,encoding:a.encoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){for(const e of this._fileInfos.values())e.file.free();this._fileInfos.clear(),this._queue.destroy()}setCustomParameters(e){this._customParameters=e}async updateFiles(e){const t=new Set(e);for(const[r,s]of this._fileInfos.entries())t.has(r)?t.delete(r):(s.file.free(),this._fileInfos.delete(r));for(const r of t){const e=await b(r,{geometryInfo:this._geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters});this._fileInfos.set(r,{index:this._fileInfos.size,file:e})}}async queryFeatures(e,t){if(this._validateQuery(e),e.objectIds?.length){return(await this._enqueueQuery(e,t)).createQueryResponse()}e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0;return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){if(this._validateQuery(e),!A(e))return this._getFeatureCount();e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.resultOffset=e.resultOffset??0,delete e.outFields,delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponseForCount()}async queryObjectIds(e,t){if(this._validateQuery(e),!A(e))return Array.from({length:this._getFeatureCount()},(e,t)=>t);e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0,delete e.returnGeometry,delete e.outFields;return(await this._enqueueQuery(e,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){if(this._validateQuery(e),this._fullExtent&&!A(e))return{count:this._getFeatureCount(),extent:this._fullExtent};const r=s(this._metadata.spatialReference);e.resultOffset=e.resultOffset??0,e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.returnGeometry=!0,delete e.outFields;const o=l(f(),m),n=f(),i=await this._enqueueQuery(e,t);let a=0;for(const s of i.items)s.getBounds(n)&&(d(o,n),a+=1);return{count:a,extent:h(o,r,e.outSR?s(e.outSR):r,r,!1)}}_getFeatureCount(){return Array.from(this._fileInfos.values()).reduce((e,t)=>e+t.file.numRows(),0)}_validateQuery(e){if(e.outStatistics)throw new o("parquet:unsupported","Statistics queries are not supported",{query:e});if(e.orderByFields?.length)throw new o("parquet:unsupported","Queries using orderBy are not supported",{query:e})}async*_fetchChunks(e,t){for(const r of this._fileInfos.values()){const s=r.file.numRows(),o=Math.ceil(s/T);for(let n=0;n<o;n++){const s=n*T,o=await r.file.readChunk(s,T,e.fields,e.returnGeometry,t);for(const e of o){const t=new E(this._metadata,this._fieldsIndex,e,0,r.index),s=new O(t,null,0,!1),o=k(this._metadata,[s],this._queryEngineParams);yield o}}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const r=await this._getReadParams(e);if(e.objectIds?.length)for(const i of this._fileInfos.values()){const s=[],o=(await i.file.readChunksByRowId(new Uint32Array(e.objectIds),r.fields,r.returnGeometry,t)).map((e,t)=>new E(this._metadata,this._fieldsIndex,e,t,i.index)).map((e,t)=>new O(e,null,t,!1)),n=k(this._metadata,o,this._queryEngineParams),a=await n.executeQueryForOpaqueFeatures(e,t);for(const e of a)s.push(e);return new g(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:G})}let s=e.resultRecordCount,o=e.resultOffset;i(s),i(o),delete e.resultRecordCount,delete e.resultOffset;const n=[];for await(const i of this._fetchChunks(r,t)){const r=await i.executeQueryForOpaqueFeatures(e,t);if(r.length>o){const t=r.slice(o,Math.min(o+s,r.length));for(const e of t)n.push(e);if(o=0,s-=t.length,0===s)return new g(n,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:G})}else o-=r.length}return new g(n,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:G})}async _getReadParams(e){const t=new Set;if(e.where&&await R(t,this._fieldsIndex,e.where),e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:this._getAttributeIds(Array.from(t)),returnGeometry:!!e.returnGeometry||!!e.geometry}}_getAttributeIds(e){if(null==e)return new Uint32Array;if(e.includes("*"))return new Uint32Array(this._fieldsIndex.fields.map(e=>e.column).filter(e=>null!=e));const t=[];for(const r of e){const e=this._fieldsIndex.get(r);if(null==e)throw new o("unknown-field",`Field ${r} does not exist`);null==e.column||t.push(e.column)}return new Uint32Array(t)}}function A(e){return Object.keys(e).some(e=>M(e))}function M(e){switch(e){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"where":case"objectIds":case"historicMoment":return!0;default:return!1}}function k(e,t,r){const s=new v(()=>e);for(const o of t)s.insert(o);return new y({...r,featureStore:s})}function J(e){switch(e.length){case 4:return p(f(),e);case 6:return e;default:throw new o("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function W(e,t){const r=l(f(),m);for(const s of e){const e=q(s.file);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const o=J(t.bbox);d(r,o)}return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t}}export{N as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as r,waitTick as a}from"../../../core/promiseUtils.js";import o from"../../../geometry/Extent.js";import{projectWithZConversion as n}from"../../../geometry/projectionUtils.js";import{load as i,execute as s}from"../../../geometry/operators/projectOperator.js";import{fromExtent as l}from"../../../geometry/support/aaBoundingRect.js";import c from"../../ElevationLayer.js";import p from"../../ImageryLayer.js";import{getMetersPerUnitOfSR as m}from"../core/utils.js";import{defaultOptions as u}from"../../support/ElevationQuery.js";import{TileElevationSampler as f}from"../../support/ElevationSampler.js";import{ElevationTile as y}from"../../support/ElevationTile.js";import{ElevationTileData as w}from"../../support/ElevationTileData.js";import g from"../../support/RasterFunction.js";import d from"../../support/TileInfo.js";import{TileKey as v}from"../../support/TileKey.js";import{fetchArcGISServiceJSON as j}from"../../../support/requestPresets.js";import{logAndThrow as R}from"../../../widgets/OrientedImageryViewer/utils.js";async function h(t,r,a){if(!r.extent||!r.url)throw R("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await E(r);if(!o)throw R("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return x(t,o,a)}async function x(e,t,r){await a(r);const o=z(t,r),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}async function E(e,a){let o;const{extent:n,rasterFunction:i,url:s,lod:l}=e;try{o=await q(s)}catch(c){if(r(c))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",c)}switch(o){case 0:return await L(s,n,i,a);case 1:return await I(s,n,l,a);default:return}}async function I(e,a,o,n){const i=new c(e);let s;try{const{tileInfo:e}=await i.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";s=await i.createElevationSampler(a,{...n,demResolution:t})}catch(l){if(r(l))return;t.getLogger(i).error(l)}finally{i.destroy()}return s}async function L(e,t,r,a){const n=r?new g({functionName:r}):void 0,c=new p({url:e,rasterFunction:n,format:"lerc"});await c.load(a);const m=512,j=t.center,R=Math.max(t.width,t.height);let h=new o({xmin:j.x-R/2,ymin:j.y-R/2,xmax:j.x+R/2,ymax:j.y+R/2,spatialReference:t.spatialReference});c.spatialReference.equals(h.spatialReference)||(await i(),h=s(h,c.spatialReference));const x=await c.fetchPixels(h,m,m,a),E=d.create({scales:[R/m],size:m,spatialReference:h.spatialReference}),I=new v(null,0,0,0,l(h)),L=new w(x.pixelBlock.pixels[0],m,m,0),q=new y(I,L);return new f(q,E,u.noDataValue)}async function q(t,r){await a(r);const o=await j(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?2:1:0}function z(e,t){return async r=>{let a=r.clone();const o=r.spatialReference.equals(e.spatialReference)?a:await n(r,e.spatialReference,t),i=e.queryElevation(o);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await n(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function P(e,t,r){return await a(r),e.map(e=>(e.z=t,e))}function U(e,t){const{averageGroundElevation:r,spatialReference:a}=t,o=m(a);return e.map(e=>{const t=e.clone();return t.z=r*o/e.spatialReference.metersPerUnit,t})}export{E as getElevationSampler,L as getElevationSamplerFromDynamicImageService,U as updateUsingAverageGroundElevation,P as updateUsingConstant,x as updateUsingElevationSampler,h as updateUsingElevationSource,q as validateElevationSourceURL};
5
+ import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as r,waitTick as a}from"../../../core/promiseUtils.js";import o from"../../../geometry/Extent.js";import{projectWithZConversion as n}from"../../../geometry/projectionUtils.js";import{load as i,execute as s}from"../../../geometry/operators/projectOperator.js";import{fromExtent as l}from"../../../geometry/support/aaBoundingRect.js";import c from"../../ElevationLayer.js";import p from"../../ImageryLayer.js";import{getMetersPerUnitOfSR as m}from"../core/utils.js";import{defaultOptions as u}from"../../support/ElevationQuery.js";import{ElevationTile as f}from"../../support/ElevationTile.js";import{ElevationTileData as y}from"../../support/ElevationTileData.js";import w from"../../support/RasterFunction.js";import{TileElevationSampler as g}from"../../support/TileElevationSampler.js";import d from"../../support/TileInfo.js";import{TileKey as v}from"../../support/TileKey.js";import{fetchArcGISServiceJSON as j}from"../../../support/requestPresets.js";import{logAndThrow as R}from"../../../widgets/OrientedImageryViewer/utils.js";async function h(t,r,a){if(!r.extent||!r.url)throw R("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await E(r);if(!o)throw R("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return x(t,o,a)}async function x(e,t,r){await a(r);const o=z(t,r),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}async function E(e,a){let o;const{extent:n,rasterFunction:i,url:s,lod:l}=e;try{o=await q(s)}catch(c){if(r(c))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",c)}switch(o){case 0:return await L(s,n,i,a);case 1:return await I(s,n,l,a);default:return}}async function I(e,a,o,n){const i=new c(e);let s;try{const{tileInfo:e}=await i.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";s=await i.createElevationSampler(a,{...n,demResolution:t})}catch(l){if(r(l))return;t.getLogger(i).error(l)}finally{i.destroy()}return s}async function L(e,t,r,a){const n=r?new w({functionName:r}):void 0,c=new p({url:e,rasterFunction:n,format:"lerc"});await c.load(a);const m=512,j=t.center,R=Math.max(t.width,t.height);let h=new o({xmin:j.x-R/2,ymin:j.y-R/2,xmax:j.x+R/2,ymax:j.y+R/2,spatialReference:t.spatialReference});c.spatialReference.equals(h.spatialReference)||(await i(),h=s(h,c.spatialReference));const x=await c.fetchPixels(h,m,m,a),E=d.create({scales:[R/m],size:m,spatialReference:h.spatialReference}),I=new v(0,0,0,l(h)),L=new y(x.pixelBlock.pixels[0],m,m,0),q=[new f(I,L)],z=u.noDataValue;return new g({tiles:q,tileInfo:E,noDataValue:z})}async function q(t,r){await a(r);const o=await j(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?2:1:0}function z(e,t){return async r=>{let a=r.clone();const o=r.spatialReference.equals(e.spatialReference)?a:await n(r,e.spatialReference,t),i=e.queryElevation(o);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await n(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function P(e,t,r){return await a(r),e.map(e=>(e.z=t,e))}function T(e,t){const{averageGroundElevation:r,spatialReference:a}=t,o=m(a);return e.map(e=>{const t=e.clone();return t.z=r*o/e.spatialReference.metersPerUnit,t})}export{E as getElevationSampler,L as getElevationSamplerFromDynamicImageService,T as updateUsingAverageGroundElevation,P as updateUsingConstant,x as updateUsingElevationSampler,h as updateUsingElevationSource,q as validateElevationSourceURL};
@@ -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{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{assertIsSome as i}from"../../core/maybe.js";import{whenOrAbort as l,throwIfAbortError as n}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as o}from"../../core/unitUtils.js";import{initializeProjection as a,project as s}from"../../geometry/projectionUtils.js";import{fromExtent as r,create as c,contains as u}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as m}from"./ElevationSampler.js";import{ElevationTile as f}from"./ElevationTile.js";import{GeometryDescriptor as h}from"./GeometryDescriptor.js";import{TileKey as p}from"./TileKey.js";class d{async queryAll(e,i,l){if(!(e=l?.ignoreInvisibleLayers?e.filter(e=>e.visible):e.slice()).length)throw new t(L,"Elevation queries require at least one elevation layer to fetch tiles from");const n=h.fromGeometry(i);let o=!1;l?.returnSampleInfo||(o=!0);const a={...w,...l,returnSampleInfo:!0},s=await this.query(e[e.length-1],n,a),r=await this._queryAllContinue(e,s,a);return r.geometry=r.geometry.export(),o&&delete r.sampleInfo,r}async query(e,i,l){if(!e)throw new t(L,"Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof h)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const n={...w,...l},o=new T(e,i.spatialReference,n),a=n.signal;return await e.load({signal:a}),await x(o,i,a),await this._selectTiles(o,a),await C(o,a),D(o),S(o,a)}async createSampler(e,i,l){if(!e)throw new t(L,"Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const n={...w,...l};return this._createSampler(e,i,n)}async createSamplerAll(e,i,l){if(!(e=l?.ignoreInvisibleLayers?e.filter(e=>e.visible):e.slice()).length)throw new t(L,"Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const n={...w,...l,returnSampleInfo:!0},o=await this._createSampler(e[e.length-1],i,n);return this._createSamplerAllContinue(e,i,o,n)}async _createSampler(e,t,i,l){const n=i.signal;await e.load({signal:n});const o=t.spatialReference,r=e.tileInfo.spatialReference;o.equals(r)||(await a([{source:o,dest:r}],{signal:n}),t=s(t,r));const c=new v(e,t,i,l);return await this._selectTiles(c,n),await C(c,n),new m(c.elevationTiles,c.layer.tileInfo,c.parameters.noDataValue)}async _createSamplerAllContinue(e,t,i,l){if(e.pop(),!e.length)return i;const n=i.samplers.filter(e=>!e.tile.hasNoDataValues).map(e=>r(e.extent)),o=await this._createSampler(e[e.length-1],t,l,n);if(0===o.samplers.length)return i;const a=i.samplers.concat(o.samplers),s=new m(a,l.noDataValue);return this._createSamplerAllContinue(e,t,s,l)}async _queryAllContinue(e,t,l){const n=e.pop(),o=t.geometry.coordinates,a=t.sampleInfo;i(a);const s=[],r=[];for(let i=0;i<o.length;i++){const t=a[i];t.demResolution>=0?t.source||(t.source=n):e.length&&(s.push(o[i]),r.push(i))}if(!e.length||0===s.length)return t;const c=t.geometry.clone(s),u=await this.query(e[e.length-1],c,l),m=u.sampleInfo;if(!m)throw new Error("no sampleInfo");return r.forEach((e,t)=>{o[e].z=u.geometry.coordinates[t].z,a[e].demResolution=m[t].demResolution}),this._queryAllContinue(e,t,l)}async _selectTiles(e,i){"geometry"===e.type&&_(e);const l=e.parameters.demResolution;if("number"==typeof l)I(e,l);else if("finest-contiguous"===l)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==l)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${l}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}async _selectTilesFinestContiguous(e,t){const{tileInfo:i,tilemapCache:l}=e.layer,n=g(i,l,e.parameters.minDemResolution);await this._selectTilesFinestContiguousAt(e,n,t)}async _selectTilesFinestContiguousAt(e,i,o){const a=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const s=a.tilemapCache,r=e.getTilesToFetch();try{if(s&&!j(s))await l(Promise.all(r.map(e=>s.fetchAvailability(e.level,e.row,e.col,{signal:o}))),o);else if(await C(e,o),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles","Some elevation tiles are unavailable")}catch(c){n(c),await this._selectTilesFinestContiguousAt(e,i-1,o)}}async _selectTilesAuto(t,i){A(t),R(t);const o=t.layer.tilemapCache;if(!o||j(o))return this._selectTilesAutoPrefetchUpsample(t,i);const a=t.getTilesToFetch(),s={},r=a.map(async t=>{const l=new p(null,0,0,0,c()),a=await e(o.fetchAvailabilityUpsample(t.level,t.row,t.col,l,{signal:i}));!1!==a.ok?null!=t.id&&(s[t.id]=l):n(a.error)});await l(Promise.all(r),i),t.remapTiles(s)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await C(e,t);let l=!1;e.forEachTileToFetch((e,t)=>{i.upsampleTile(e)?l=!0:t()}),l&&await this._selectTilesAutoPrefetchUpsample(e,t)}}class y{constructor(e,t){this.layer=e,this.parameters=t}}class T extends y{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach(e=>e.tile=null);else{const{tileInfo:t,tilemapCache:i}=this.layer,l=q(t,i)[e].level;this.geometry.coordinates.forEach(e=>e.tile=t.tileAt(l,e.x,e.y))}}allElevationTilesFetched(){return!this.geometry.coordinates.some(e=>!e.elevationTile)}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile?.id&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates){const i=t.tile?.id;t.tile=i?e[i]:null}}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const l=i.tile;if(!l)continue;const n=i.tile?.id;i.elevationTile||!n||e[n]||(e[n]=l,t.push(l))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,()=>t.tile=null)}}class v extends y{constructor(e,t,i,l){super(e,i),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=t.clone().intersection(e.fullExtent),this.maskExtents=l}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),l=Math.min(i,e);l<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(l)}_maximumLodForRequests(e){const{tileInfo:t,tilemapCache:i}=this.layer,l=q(t,i);if(!e)return l.length-1;const n=this.extent;if(null==n)return-1;for(let o=l.length-1;o>=0;o--){const i=l[o],a=i.resolution*t.size[0],s=i.resolution*t.size[1];if(Math.ceil(n.width/a)*Math.ceil(n.height/s)<=e)return o}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this._candidateTiles){const i=t.id&&e[t.id];i&&(this._fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this._candidateTiles=F(this._candidateTiles.map(t=>e[t.id]))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,t){const i=this._candidateTiles;this._candidateTiles=[],i.forEach(i=>{if(this._fetchedCandidates.has(i))return void t?.(i);let l=!1;e(i,()=>l=!0),l?t?.(i):this._candidateTiles.push(i)}),this._candidateTiles=F(this._candidateTiles,t)}_selectCandidateTilesCoveringExtentAt(e){this._candidateTiles.length=0;const t=this.extent;if(null==t)return;const{tileInfo:i,tilemapCache:l}=this.layer,n=q(i,l)[e],o=i.tileAt(n.level,t.xmin,t.ymin),a=o.extent;if(null==a)return;const s=n.resolution*i.size[0],r=n.resolution*i.size[1],c=Math.ceil((t.xmax-a[0])/s),u=Math.ceil((t.ymax-a[1])/r);for(let m=0;m<u;m++)for(let e=0;e<c;e++){const t=new p(null,o.level,o.row-m,o.col+e);i.updateTileInfo(t),this._tileIsMasked(t)||this._candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some(t=>e.extent&&u(t,e.extent))}}function g(e,t,i=0){const l=q(e,t);let n=l.length-1;if(i>0){const t=i/o(e.spatialReference),a=l.findIndex(e=>e.resolution<t);0===a?n=0:a>0&&(n=a-1)}return n}const w={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0,signal:null};async function x(e,i,l){let n;const o=e.layer.tileInfo.spatialReference;if(i instanceof h?n=await i.project(o,l):(await a([{source:i.spatialReference,dest:o}],{signal:l}),n=s(i,o)),!n)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${o.wkid}'`);e.geometry=h.fromGeometry(n)}function _(e){if(null==e.layer.fullExtent)return;const t=new f(null);t.sample=()=>e.parameters.noDataValue,e.outsideExtentTile=t;const i=e.layer.fullExtent;e.geometry.coordinates.forEach(e=>{const l=e.x,n=e.y;(l<i.xmin||l>i.xmax||n<i.ymin||n>i.ymax)&&(e.elevationTile=t)})}function E(e,t){const{tileInfo:i,tilemapCache:l}=e.layer,n=t/o(i.spatialReference),a=q(i,l);let s=a[0],r=0;for(let o=1;o<a.length;o++){const e=a[o];Math.abs(e.resolution-n)<Math.abs(s.resolution-n)&&(s=e,r=o)}return r}function I(e,t){const i=E(e,t);e.selectTilesAtLOD(i)}function A(e){const{tileInfo:t,tilemapCache:i}=e.layer,l=g(t,i,e.parameters.minDemResolution);e.selectTilesAtLOD(l,e.parameters.maximumAutoTileRequests)}function q(e,t){const i=e.lods;if(j(t)){const{effectiveMinLOD:e,effectiveMaxLOD:l}=t;return i.filter(t=>t.level>=e&&t.level<=l)}return i}async function C(e,t){const i=e.getTilesToFetch(),n={},o=e.parameters.cache,a=e.parameters.noDataValue,s=i.map(async i=>{if(null==i.id)return;const l=`${e.layer.uid}:${i.id}:${a}`,s=null!=o?o.get(l):null,r=null!=s?s:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:a,signal:t});null!=o&&o.put(l,r),n[i.id]=new f(i,r)});await l(Promise.allSettled(s),t),e.populateElevationTiles(n)}function R(e){const t=e.layer.tileInfo;let i=0;const l={},n=e=>{null!=e.id&&(e.id in l?l[e.id]++:(l[e.id]=1,i++))},o=e=>{if(null==e.id)return;const t=l[e.id];1===t?(delete l[e.id],i--):l[e.id]=t-1};e.forEachTileToFetch(n,o);let a=!0;for(;a&&(a=!1,e.forEachTileToFetch(l=>{i<=e.parameters.maximumAutoTileRequests||(o(l),t.upsampleTile(l)&&(a=!0),n(l))},o),a););}function D(e){e.geometry.coordinates.forEach(t=>{const i=t.elevationTile;let l=e.parameters.noDataValue;if(i){const e=i.sample(t.x,t.y);null!=e?l=e:t.elevationTile=null}t.z=l})}function F(e,t){const i={},l=[];for(const o of e){const e=o.id;e&&!i[e]?(i[e]=o,l.push(o)):t?.(o)}const n=l.sort((e,t)=>e.level-t.level);return n.filter((e,i)=>{for(let l=0;l<i;l++){const i=n[l].extent;if(i&&e.extent&&u(i,e.extent))return t?.(e),!1}return!0})}async function S(e,t){const l=await e.geometry.project(e.outSpatialReference,t);i(l);const n={geometry:l.export(),noDataValue:e.parameters.noDataValue};return e.parameters.returnSampleInfo&&(n.sampleInfo=b(e)),e.geometry.coordinates.forEach(e=>{e.tile=null,e.elevationTile=null}),n}function b(e){const t=e.layer.tileInfo,i=o(t.spatialReference);return e.geometry.coordinates.map(l=>{let n=-1;if(l.elevationTile&&l.elevationTile!==e.outsideExtentTile){n=t.lodAt(l.elevationTile.tile.level).resolution*i}return{demResolution:n}})}function j(e){return null!=e?.tileInfo}const L="elevation-query:invalid-layer";export{d as ElevationQuery,L as InvalidLayerError,w as defaultOptions,g as getFinestLodIndex};
5
+ import{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{assertIsSome as n}from"../../core/maybe.js";import{whenOrAbort as a,throwIfAbortError as o}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as i}from"../../core/unitUtils.js";import{initializeProjection as l,project as r}from"../../geometry/projectionUtils.js";import{fromExtent as s}from"../../geometry/support/aaBoundingRect.js";import{GeometryQueryContext as c,ExtentQueryContext as u,isTileInfoTilemapCache as m,getLods as f}from"./ElevationQueryContext.js";import{ElevationTile as p}from"./ElevationTile.js";import{GeometryDescriptor as y}from"./GeometryDescriptor.js";import{TileElevationSampler as w}from"./TileElevationSampler.js";import{TileKey as d}from"./TileKey.js";async function h(e,n,a){if(e=a?.ignoreInvisibleLayers?e.filter(e=>e.visible):e.slice(),!e.length)throw new t(G,"Elevation queries require at least one elevation layer to fetch tiles from");const o=y.fromGeometry(n),i={...A,...a,returnSampleInfo:!0},l=e.pop(),r=await v(l,o,i),s=await x(e,r,i);return s.geometry=s.geometry.export(),a?.returnSampleInfo||delete s.sampleInfo,s}async function v(e,n,a){if(!e)throw new t(G,"Elevation queries require an elevation layer to fetch tiles from");if(!n||!(n instanceof y)&&"point"!==n.type&&"multipoint"!==n.type&&"polyline"!==n.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const o={...A,...a},i=new c(e,n.spatialReference,o),l=o.signal;return await e.load({signal:l}),await V(i,n,l),await R(i,l),await L(i,l),k(i),O(i,l)}async function g(e,n,a){if(e=Array.isArray(e)?e:[e],0===(e=a?.ignoreInvisibleLayers?e.filter(e=>e.visible):e.slice()).length)throw new t(G,"Elevation queries require at least one elevation layer to fetch tiles from");if(!n||"extent"!==n.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...A,...a,returnSampleInfo:!0},i=T(e[e.length-1],n,o);if(1===e.length)return i;return I(e,n,await i,o)}async function T(e,t,n,a){const o=n.signal;await e.load({signal:o});const i=t.spatialReference,s=e.tileInfo.spatialReference;i.equals(s)||(await l([{source:i,dest:s}],{signal:o}),t=r(t,s));const c=new u(e,t,n,a);await R(c,o),await L(c,o);const m=c.elevationTiles,f=c.layer.tileInfo,p=c.parameters.noDataValue;return new w({noDataValue:p,tiles:m,tileInfo:f})}async function I(e,t,n,a){if(e.pop(),!e.length)return n;const o=n.samplers.filter(e=>!e.tile.hasNoDataValues).map(e=>s(e.extent)),i=await T(e[e.length-1],t,a,o);if(0===i.samplers.length)return n;const l=n.samplers.concat(i.samplers),r=a.noDataValue;return I(e,t,new w({samplers:l,noDataValue:r}),a)}async function x(e,t,a){const o=t.geometry.coordinates,i=t.sampleInfo;n(i);const l=new Array,r=new Array;for(let n=0;n<o.length;n++){i[n].demResolution<0&&e.length&&(l.push(o[n]),r.push(n))}const s=e.pop();if(null==s||0===l.length)return t;const c=t.geometry.clone(l),u=await v(s,c,a),m=u.sampleInfo;if(!m)throw new Error("no sampleInfo");return r.forEach((e,t)=>{o[e].z=u.geometry.coordinates[t].z,i[e].demResolution=m[t].demResolution,i[e].source=m[t].source}),x(e,t,a)}async function R(e,n){"geometry"===e.type&&S(e);const a=e.parameters.demResolution;if("number"==typeof a)F(e,a);else if("finest-contiguous"===a)await E(e,n);else{if("auto"!==a)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${a}', expected a number, "finest-contiguous" or "auto"`);await q(e,n)}}async function E(e,t){const{tileInfo:n,tilemapCache:a}=e.layer,o=b(n,a,e.parameters.minDemResolution);await D(e,o,t)}async function D(e,n,i){const l=e.layer;if(e.selectTilesAtLOD(n),n<0)return;const r=l.tilemapCache,s=e.getTilesToFetch();try{if(r&&!m(r))await a(Promise.all(s.map(e=>r.fetchAvailability(e.level,e.row,e.col,{signal:i}))),i);else if(await L(e,i),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles","Some elevation tiles are unavailable")}catch(c){o(c),await D(e,n-1,i)}}async function q(t,n){$(t),U(t);const i=t.layer.tilemapCache;if(!i||m(i))return j(t,n);const l=t.getTilesToFetch(),r={},s=l.map(async t=>{const a=new d(0,0,0),l=await e(i.fetchAvailabilityUpsample(t.level,t.row,t.col,a,{signal:n}));!1!==l.ok?null!=t.id&&(r[t.id]=a):o(l.error)});await a(Promise.all(s),n),t.remapTiles(r)}async function j(e,t){const n=e.layer.tileInfo;await L(e,t);let a=!1;e.forEachTileToFetch((e,t)=>{n.upsampleTile(e)?a=!0:t()}),a&&await j(e,t)}function b(e,t,n=0){const a=f(e,t);let o=a.length-1;if(n>0){const t=n/i(e.spatialReference),l=a.findIndex(e=>e.resolution<t);0===l?o=0:l>0&&(o=l-1)}return o}const A={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0,signal:null};async function V(e,n,a){let o;const i=e.layer.tileInfo.spatialReference;if(n instanceof y?o=await n.project(i,a):(await l([{source:n.spatialReference,dest:i}],{signal:a}),o=r(n,i)),!o)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${n.spatialReference.wkid}' on an elevation service in '${i.wkid}'`);e.geometry=y.fromGeometry(o)}function S(e){if(null==e.layer.fullExtent)return;const t=new p(new d(-1,-1,-1));t.sample=()=>e.parameters.noDataValue,e.outsideExtentTile=t;const n=e.layer.fullExtent;e.geometry.coordinates.forEach(e=>{const a=e.x,o=e.y;(a<n.xmin||a>n.xmax||o<n.ymin||o>n.ymax)&&(e.elevationTile=t)})}function C(e,t){const{tileInfo:n,tilemapCache:a}=e.layer,o=t/i(n.spatialReference),l=f(n,a);let r=l[0],s=0;for(let i=1;i<l.length;i++){const e=l[i];Math.abs(e.resolution-o)<Math.abs(r.resolution-o)&&(r=e,s=i)}return s}function F(e,t){const n=C(e,t);e.selectTilesAtLOD(n)}function $(e){const{tileInfo:t,tilemapCache:n}=e.layer,a=b(t,n,e.parameters.minDemResolution);e.selectTilesAtLOD(a,e.parameters.maximumAutoTileRequests)}async function L(e,t){const n=e.getTilesToFetch(),o={},i=e.parameters.cache,l=e.parameters.noDataValue,r={noDataValue:l,signal:t},s=n.map(async t=>{if(null==t.id)return;const n=`${e.layer.uid}:${t.id}:${l}`,a=i?.get(n),s=a??await e.layer.fetchTile(t.level,t.row,t.col,r);i?.put(n,s),o[t.id]=new p(t,s)});await a(Promise.allSettled(s),t),e.populateElevationTiles(o)}function U(e){const t=e.layer.tileInfo;let n=0;const a={},o=e=>{null!=e.id&&(e.id in a?a[e.id]++:(a[e.id]=1,n++))},i=e=>{if(null==e.id)return;const t=a[e.id];1===t?(delete a[e.id],n--):a[e.id]=t-1};e.forEachTileToFetch(o,i);let l=!0;for(;l&&(l=!1,e.forEachTileToFetch(a=>{n<=e.parameters.maximumAutoTileRequests||(i(a),t.upsampleTile(a)&&(l=!0),o(a))},i),l););}function k(e){e.geometry.coordinates.forEach(t=>{const n=t.elevationTile;let a=e.parameters.noDataValue;if(n){const e=n.sample(t.x,t.y);null==e?t.elevationTile=null:a=e}t.z=a})}async function O(e,t){const a=await e.geometry.project(e.outSpatialReference,t);n(a);const o={geometry:a.export(),noDataValue:e.parameters.noDataValue};return e.parameters.returnSampleInfo&&(o.sampleInfo=z(e)),e.geometry.coordinates.forEach(e=>{e.tile=null,e.elevationTile=null}),o}function z(e){const t=e.layer.tileInfo,n=i(t.spatialReference);return e.geometry.coordinates.map(a=>{let o=-1;if(a.elevationTile&&a.elevationTile!==e.outsideExtentTile){o=t.lodAt(a.elevationTile.key.level).resolution*n}return{demResolution:o,source:-1===o?void 0:e.layer}})}const G="elevation-query:invalid-layer";export{G as InvalidLayerError,g as createSampler,A as defaultOptions,b as getFinestLodIndex,v as query,h as queryAll};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{unique as e}from"../../core/arrayUtils.js";import{contains as t}from"../../geometry/support/aaBoundingRect.js";import{TileKey as i}from"./TileKey.js";class s{constructor(e,t){this.layer=e,this.parameters=t}}class l extends s{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach(e=>e.tile=null);else{const{tileInfo:t,tilemapCache:i}=this.layer,s=a(t,i)[e].level;this.geometry.coordinates.forEach(e=>e.tile=t.tileAt(s,e.x,e.y))}}allElevationTilesFetched(){return!this.geometry.coordinates.some(e=>!e.elevationTile)}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile?.id&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates){const i=t.tile?.id;t.tile=i?e[i]:null}}getTilesToFetch(){return e(this.geometry.coordinates.filter(({tile:e,elevationTile:t})=>e?.id&&!t),(e,t)=>e.tile?.id===t.tile?.id).map(({tile:e})=>e)}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,()=>t.tile=null)}}class n extends s{constructor(e,t,i,s){super(e,i),this.maskExtents=s,this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=t.clone().intersection(e.fullExtent)}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),s=Math.min(i,e);s<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(s)}_maximumLodForRequests(e){const{tileInfo:t,tilemapCache:i}=this.layer,s=a(t,i);if(!e)return s.length-1;const l=this.extent;if(null==l)return-1;for(let n=s.length-1;n>=0;n--){const i=s[n],o=i.resolution*t.size[0],a=i.resolution*t.size[1];if(Math.ceil(l.width/o)*Math.ceil(l.height/a)<=e)return n}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this._candidateTiles){const i=t.id&&e[t.id];i&&(this._fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this._candidateTiles=r(this._candidateTiles.map(t=>e[t.id]))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,t){const i=this._candidateTiles;this._candidateTiles=[],i.forEach(i=>{if(this._fetchedCandidates.has(i))return void t?.(i);let s=!1;e(i,()=>s=!0),s?t?.(i):this._candidateTiles.push(i)}),this._candidateTiles=r(this._candidateTiles,t)}_selectCandidateTilesCoveringExtentAt(e){this._candidateTiles.length=0;const t=this.extent;if(null==t)return;const{tileInfo:s,tilemapCache:l}=this.layer,n=a(s,l)[e],o=s.tileAt(n.level,t.xmin,t.ymin),r=o.extent,c=n.resolution*s.size[0],h=n.resolution*s.size[1],d=Math.ceil((t.xmax-r[0])/c),f=Math.ceil((t.ymax-r[1])/h);for(let a=0;a<f;a++)for(let e=0;e<d;e++){const t=new i(o.level,o.row-a,o.col+e);s.updateTileInfo(t),this._tileIsMasked(t)||this._candidateTiles.push(t)}}_tileIsMasked(e){return this.maskExtents?.some(i=>t(i,e.extent))??!1}}function o(e){return null!=e?.tileInfo}function a(e,t){const i=e.lods;if(o(t)){const{effectiveMinLOD:e,effectiveMaxLOD:s}=t;return i.filter(t=>t.level>=e&&t.level<=s)}return i}function r(e,i){const s={},l=[];for(const t of e){const e=t.id;e&&!s[e]?(s[e]=t,l.push(t)):i?.(t)}const n=l.sort((e,t)=>e.level-t.level);return n.filter((e,s)=>{for(let l=0;l<s;l++){const s=n[l].extent;if(s&&t(s,e.extent))return i?.(e),!1}return!0})}export{n as ExtentQueryContext,l as GeometryQueryContext,a as getLods,o as isTileInfoTilemapCache};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{Evented as e}from"../../core/Evented.js";import t from"../../core/Logger.js";import{getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import s from"../../geometry/Point.js";import i from"../../geometry/SpatialReference.js";import{toExtent as o,create as a,containsXY as r}from"../../geometry/support/aaBoundingRect.js";import{project as l}from"../../geometry/support/webMercatorUtils.js";const m=()=>t.getLogger("esri.layers.support.ElevationSampler");class u extends e{queryElevation(e){return h(e.clone(),this)}}class c extends u{get spatialReference(){return this.extent.spatialReference}constructor(e,t,s){super(),this.tile=e,this.noDataValue=s;const i=e.tile.extent;this.extent=o(i,t.spatialReference),this.extent.zmin=e.zmin,this.extent.zmax=e.zmax,this._aaExtent=i;const a=n(t.spatialReference),r=t.lodAt(e.tile.level).resolution*a;this.demResolution={min:r,max:r}}contains(e){const t=f(e,this.spatialReference);return null!=t&&this.containsAt(t.x,t.y)}containsAt(e,t){return r(this._aaExtent,e,t)}elevationAt(e,t){if(!this.containsAt(e,t)){const n=this.extent,s=`${n.xmin}, ${n.ymin}, ${n.xmax}, ${n.ymax}`;return m().warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler extent (${s})`),this.noDataValue}return this.tile.sample(e,t)??this.noDataValue}}class p extends u{get spatialReference(){return this.extent.spatialReference}constructor(e,t,n){let s;super(),"number"==typeof t?(this.noDataValue=t,this.samplers=e):(s=t,this.noDataValue=n,this.samplers=e.map(e=>new c(e,s,this.noDataValue)));const r=this.samplers[0];if(r){this.extent=r.extent.clone();const{min:e,max:t}=r.demResolution;this.demResolution={min:e,max:t};for(let n=1;n<this.samplers.length;n++){const e=this.samplers[n];this.extent.union(e.extent),this.demResolution.min=Math.min(this.demResolution.min,e.demResolution.min),this.demResolution.max=Math.max(this.demResolution.max,e.demResolution.max)}}else this.extent=o(a(),s?.spatialReference??i.WGS84),this.demResolution={min:0,max:0}}elevationAt(e,t){let n;for(const s of this.samplers)if(s.containsAt(e,t)&&(n=s.elevationAt(e,t),n!==s.noDataValue))return n;return null!=n?n:(m().warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler`),this.noDataValue)}}function h(e,t){const n=f(e,t.spatialReference);if(!n)return null;switch(e.type){case"point":return x(e,n,t);case"polyline":return R(e,n,t);case"multipoint":return d(e,n,t);default:return null}}function f(e,t){if(null==e)return null;const n=e.spatialReference;if(n.equals(t))return e;const s=l(e,t);return s||m().error(`Cannot project geometry spatial reference (wkid:${n.wkid}) to elevation sampler spatial reference (wkid:${t.wkid})`),s}function x(e,t,n){return e.hasZ=!0,e.z=n.elevationAt(t.x,t.y),e}function R(e,t,n){y.spatialReference=t.spatialReference;const s=e.hasM&&!e.hasZ;for(let i=0;i<e.paths.length;i++){const o=e.paths[i],a=t.paths[i];for(let e=0;e<o.length;e++){const t=o[e],i=a[e];y.x=i[0],y.y=i[1],s&&(t[3]=t[2]),t[2]=n.elevationAt(y.x,y.y)}}return e.hasZ=!0,e}function d(e,t,n){y.spatialReference=t.spatialReference;const s=e.hasM&&!e.hasZ;for(let i=0;i<e.points.length;i++){const o=e.points[i],a=t.points[i];y.x=a[0],y.y=a[1],s&&(o[3]=o[2]),o[2]=n.elevationAt(y.x,y.y)}return e.hasZ=!0,e}const y=new s;export{u as ElevationSamplerBase,p as MultiTileElevationSampler,c as TileElevationSampler,h as updateGeometryElevation};
5
+ import{__decorate as e}from"tslib";import"../../core/has.js";import{EventedAccessor as t}from"../../core/Evented.js";import r from"../../core/Logger.js";import"../../core/RandomLCG.js";import"../../core/Error.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../geometry/Point.js";import{project as n}from"../../geometry/support/webMercatorUtils.js";let i=class extends t{queryElevation(e){const t=this.projectIfRequired(e,this.spatialReference);if(!t)return null;switch(e.type){case"point":return a(e,t,this);case"polyline":return l(e,t,this);case"multipoint":return c(e,t,this);default:return null}}projectIfRequired(e,t){if(null==e)return null;const o=e.spatialReference;if(o.equals(t))return e;const s=n(e,t);return s||r.getLogger(this).error(`Cannot project geometry spatial reference (wkid:${o.wkid}) to elevation sampler spatial reference (wkid:${t.wkid})`),s}};function a(e,t,r){return e.hasZ=!0,e.z=r.elevationAt(t.x,t.y),e}function l(e,t,r){p.spatialReference=t.spatialReference;const o=e.hasM&&!e.hasZ;for(let s=0;s<e.paths.length;s++){const n=e.paths[s],i=t.paths[s];for(let e=0;e<n.length;e++){const t=n[e],s=i[e];p.x=s[0],p.y=s[1],o&&(t[3]=t[2]),t[2]=r.elevationAt(p.x,p.y)}}return e.hasZ=!0,e}function c(e,t,r){p.spatialReference=t.spatialReference;const o=e.hasM&&!e.hasZ;for(let s=0;s<e.points.length;s++){const n=e.points[s],i=t.points[s];p.x=i[0],p.y=i[1],o&&(n[3]=n[2]),n[2]=r.elevationAt(p.x,p.y)}return e.hasZ=!0,e}i=e([o("esri.layers.support.ElevationSampler")],i);const p=new s;export{i 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{ElevationSamplerData as a}from"./ElevationSamplerData.js";class t{constructor(t,l=null){if(this.tile=t,null!=l&&null!=t){const e=t.extent;this._samplerData=new a(l,e)}}get zmin(){return null!=this._samplerData?this._samplerData.data.minValue:0}get zmax(){return null!=this._samplerData?this._samplerData.data.maxValue:0}get hasNoDataValues(){return!!this._samplerData?.data.hasNoDataValues}sample(a,t){if(null==this._samplerData)return;const{safeWidth:e,data:s,dx:r,dy:n,y1:i,x0:u}=this._samplerData,{width:o,values:m,noDataValue:h}=s,p=l(n*(i-t),0,e),D=l(r*(a-u),0,e),d=Math.floor(p),f=Math.floor(D),_=d*o+f,c=_+o,x=m[_],V=m[c],g=m[_+1],v=m[c+1];if(x!==h&&V!==h&&g!==h&&v!==h){const a=D-f,t=x+(g-x)*a;return t+(V+(v-V)*a-t)*(p-d)}}}function l(a,t,l){return a<t?t:a>l?l:a}export{t as ElevationTile};
5
+ import{ElevationSamplerData as a}from"./ElevationSamplerData.js";class t{constructor(t,e=null){if(this.key=t,null!=e){const s=t.extent;this._samplerData=new a(e,s)}}get zmin(){return null!=this._samplerData?this._samplerData.data.minValue:0}get zmax(){return null!=this._samplerData?this._samplerData.data.maxValue:0}get hasNoDataValues(){return!!this._samplerData?.data.hasNoDataValues}sample(a,t){if(null==this._samplerData)return;const{safeWidth:s,data:l,dx:r,dy:n,y1:i,x0:u}=this._samplerData,{width:o,values:m,noDataValue:h}=l,p=e(n*(i-t),0,s),D=e(r*(a-u),0,s),d=Math.floor(p),f=Math.floor(D),_=d*o+f,c=_+o,x=m[_],V=m[c],g=m[_+1],y=m[c+1];if(x!==h&&V!==h&&g!==h&&y!==h){const a=D-f,t=x+(g-x)*a;return t+(V+(y-V)*a-t)*(p-d)}}}function e(a,t,e){return a<t?t:a>e?e:a}export{t as ElevationTile};
@@ -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 e from"../../geometry/Multipoint.js";import t from"../../geometry/Point.js";import s from"../../geometry/Polyline.js";import{initializeProjection as n,project as o}from"../../geometry/projectionUtils.js";class r{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new r;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map(e=>e.clone()),t._exporter=this._exporter,t}async project(t,s){if(this.spatialReference.equals(t))return this.clone();await n([{source:this.spatialReference,dest:t}],{signal:s});const r=new e({spatialReference:this.spatialReference,points:this.coordinates.map(e=>[e.x,e.y])}),i=o(r,t);if(!i)return null;const a=this.coordinates.map((e,t)=>{const s=e.clone(),n=i.points[t];return s.x=n[0],s.y=n[1],s}),c=this.clone(a);return c.spatialReference=t,c}static fromGeometry(n){const o=new r;if(o.geometry=n,o.spatialReference=n.spatialReference,n instanceof r)o.coordinates=n.coordinates.map(e=>e.clone()),o._exporter=(e,t)=>{const s=n.clone(e);return s.spatialReference=t,s};else switch(n.type){case"point":{const e=n,{hasZ:s,hasM:r}=e;o.coordinates=s&&r?[new i(e.x,e.y,e.z,e.m)]:s?[new i(e.x,e.y,e.z)]:r?[new i(e.x,e.y,null,e.m)]:[new i(e.x,e.y)],o._exporter=(e,s)=>n.hasM?new t(e[0].x,e[0].y,e[0].z,e[0].m,s):new t(e[0].x,e[0].y,e[0].z,s);break}case"multipoint":{const t=n,{hasZ:s,hasM:r}=t;o.coordinates=s&&r?t.points.map(e=>new i(e[0],e[1],e[2],e[3])):s?t.points.map(e=>new i(e[0],e[1],e[2])):r?t.points.map(e=>new i(e[0],e[1],null,e[2])):t.points.map(e=>new i(e[0],e[1])),o._exporter=(t,s)=>n.hasM?new e({points:t.map(e=>[e.x,e.y,e.z??0,e.m??0]),hasZ:!0,hasM:!0,spatialReference:s}):new e({points:t.map(e=>[e.x,e.y,e.z??0]),spatialReference:s});break}case"polyline":{const e=n,t=[],r=[],{hasZ:a,hasM:c}=n;let p=0;for(const s of e.paths)if(r.push([p,p+s.length]),p+=s.length,a&&c)for(const e of s)t.push(new i(e[0],e[1],e[2],e[3]));else if(a)for(const e of s)t.push(new i(e[0],e[1],e[2]));else if(c)for(const e of s)t.push(new i(e[0],e[1],null,e[2]));else for(const e of s)t.push(new i(e[0],e[1]));o.coordinates=t,o._exporter=(e,t)=>{const o=n.hasM?e.map(e=>[e.x,e.y,e.z??0,e.m??0]):e.map(e=>[e.x,e.y,e.z??0]),i=r.map(e=>o.slice(e[0],e[1]));return new s({paths:i,hasM:n.hasM,hasZ:!0,spatialReference:t})};break}}return o}}class i{constructor(e,t,s=null,n=null,o=null,r=null){this.x=e,this.y=t,this.z=s,this.m=n,this.tile=o,this.elevationTile=r}clone(){return new i(this.x,this.y,this.z,this.m)}}export{i as Coordinate,r as GeometryDescriptor};
5
+ import e from"../../geometry/Multipoint.js";import t from"../../geometry/Point.js";import s from"../../geometry/Polyline.js";import{initializeProjection as n,project as o}from"../../geometry/projectionUtils.js";class r{constructor(e){this.geometry=e,this.spatialReference=e.spatialReference}export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new r(this.geometry);return t.spatialReference=this.spatialReference,t.coordinates=e??this.coordinates.map(e=>e.clone()),t._exporter=this._exporter,t}async project(t,s){if(this.spatialReference.equals(t))return this.clone();await n([{source:this.spatialReference,dest:t}],{signal:s});const r=new e({spatialReference:this.spatialReference,points:this.coordinates.map(e=>[e.x,e.y])}),i=o(r,t);if(!i)return null;const a=this.coordinates.map((e,t)=>{const s=e.clone(),n=i.points[t];return s.x=n[0],s.y=n[1],s}),c=this.clone(a);return c.spatialReference=t,c}static fromGeometry(n){const o=new r(n);if(n instanceof r)return o.coordinates=n.coordinates.map(e=>e.clone()),o._exporter=(e,t)=>{const s=n.clone(e);return s.spatialReference=t,s},o;switch(n.type){case"point":{const e=n,{hasZ:s,hasM:r}=e;return o.coordinates=s&&r?[new i(e.x,e.y,e.z,e.m)]:s?[new i(e.x,e.y,e.z)]:r?[new i(e.x,e.y,null,e.m)]:[new i(e.x,e.y)],o._exporter=(e,s)=>n.hasM?new t(e[0].x,e[0].y,e[0].z,e[0].m,s):new t(e[0].x,e[0].y,e[0].z,s),o}case"multipoint":{const t=n,{hasZ:s,hasM:r}=t;return o.coordinates=s&&r?t.points.map(e=>new i(e[0],e[1],e[2],e[3])):s?t.points.map(e=>new i(e[0],e[1],e[2])):r?t.points.map(e=>new i(e[0],e[1],null,e[2])):t.points.map(e=>new i(e[0],e[1])),o._exporter=(t,s)=>n.hasM?new e({points:t.map(e=>[e.x,e.y,e.z??0,e.m??0]),hasZ:!0,hasM:!0,spatialReference:s}):new e({points:t.map(e=>[e.x,e.y,e.z??0]),spatialReference:s}),o}case"polyline":{const e=n,t=[],r=[],{hasZ:a,hasM:c}=n;let p=0;for(const s of e.paths)if(r.push([p,p+s.length]),p+=s.length,a&&c)for(const e of s)t.push(new i(e[0],e[1],e[2],e[3]));else if(a)for(const e of s)t.push(new i(e[0],e[1],e[2]));else if(c)for(const e of s)t.push(new i(e[0],e[1],null,e[2]));else for(const e of s)t.push(new i(e[0],e[1]));return o.coordinates=t,o._exporter=(e,t)=>{const o=n.hasM?e.map(e=>[e.x,e.y,e.z??0,e.m??0]):e.map(e=>[e.x,e.y,e.z??0]),i=r.map(e=>o.slice(e[0],e[1]));return new s({paths:i,hasM:n.hasM,hasZ:!0,spatialReference:t})},o}}}}class i{constructor(e,t,s=null,n=null,o=null,r=null){this.x=e,this.y=t,this.z=s,this.m=n,this.tile=o,this.elevationTile=r}clone(){return new i(this.x,this.y,this.z,this.m)}}export{i as Coordinate,r as GeometryDescriptor};
@@ -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 o}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends t{constructor(o){super(o),this.type="location",this.latitudeFieldName=null,this.longitudeFieldName=null}};o([r({type:["location"],readOnly:!0,json:{write:!0}})],s.prototype,"type",void 0),o([r({json:{write:!0}})],s.prototype,"latitudeFieldName",void 0),o([r({json:{write:!0}})],s.prototype,"longitudeFieldName",void 0),s=o([e("esri.layers.support.ParquetEncodingLocation")],s);const i=s;export{i as default};
5
+ import{__decorate as o}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends t{constructor(o){super(o),this.type="location",this.latitudeFieldName=null,this.longitudeFieldName=null}};o([r({type:["location"],readOnly:!0,json:{write:!0}})],s.prototype,"type",void 0),o([r({json:{write:!0}})],s.prototype,"latitudeFieldName",void 0),o([r({json:{write:!0}})],s.prototype,"longitudeFieldName",void 0),s=o([e("esri.layers.support.ParquetEncodingLocation")],s);export{s 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 o}from"tslib";import{JSONSupport as r}from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(o){super(o),this.type="wkb",this.primaryFieldName=null}};o([t({type:["wkb"],readOnly:!0,json:{write:!0}})],s.prototype,"type",void 0),o([t({json:{write:!0}})],s.prototype,"orientation",void 0),o([t({json:{write:!0}})],s.prototype,"primaryFieldName",void 0),s=o([e("esri.layers.support.ParquetEncodingWkb")],s);const p=s;export{p as default};
5
+ import{__decorate as r}from"tslib";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(r){super(r),this.type="wkb",this.primaryFieldName=null}};r([t({type:["wkb"],readOnly:!0,json:{write:!0}})],s.prototype,"type",void 0),r([t({json:{write:!0}})],s.prototype,"orientation",void 0),r([t({json:{write:!0}})],s.prototype,"primaryFieldName",void 0),s=r([e("esri.layers.support.ParquetEncodingWkb")],s);export{s 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{JSONSupport as a}from"../../core/JSONSupport.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";var t;function n(e){return e=Number(e),isNaN(e)?void 0:e}let o=t=class extends a{constructor(){super(...arguments),this.name=null,this.minWavelength=void 0,this.maxWavelength=void 0,this.radianceBias=void 0,this.radianceGain=void 0,this.reflectanceBias=void 0,this.reflectanceGain=void 0,this.solarIrradiance=void 0}clone(){return new t({name:this.name,minWavelength:this.minWavelength,maxWavelength:this.maxWavelength,radianceBias:this.radianceBias,radianceGain:this.radianceGain,reflectanceBias:this.reflectanceBias,reflectanceGain:this.reflectanceGain,solarIrradiance:this.solarIrradiance})}};e([r({json:{name:"BandName",write:!0}})],o.prototype,"name",void 0),e([r({json:{name:"WavelengthMin",read:{reader:n},write:!0}})],o.prototype,"minWavelength",void 0),e([r({json:{name:"WavelengthMax",read:{reader:n},write:!0}})],o.prototype,"maxWavelength",void 0),e([r({json:{name:"RadianceBias",read:{reader:n},write:!0}})],o.prototype,"radianceBias",void 0),e([r({json:{name:"RadianceGain",read:{reader:n},write:!0}})],o.prototype,"radianceGain",void 0),e([r({json:{name:"ReflectanceBias",read:{reader:n},write:!0}})],o.prototype,"reflectanceBias",void 0),e([r({json:{name:"ReflectanceGain",read:{reader:n},write:!0}})],o.prototype,"reflectanceGain",void 0),e([r({json:{name:"SolarIrradiance",read:{reader:n},write:!0}})],o.prototype,"solarIrradiance",void 0),o=t=e([i("esri.layers.support.RasterBandInfo")],o);export{o as default};
5
+ import{__decorate as e}from"tslib";import{JSONSupport as a}from"../../core/JSONSupport.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";var t;function n(e){return e=Number(e),isNaN(e)?void 0:e}let o=class extends a{constructor(){super(...arguments),this.name=null,this.minWavelength=void 0,this.maxWavelength=void 0,this.radianceBias=void 0,this.radianceGain=void 0,this.reflectanceBias=void 0,this.reflectanceGain=void 0,this.solarIrradiance=void 0}static{t=this}clone(){return new t({name:this.name,minWavelength:this.minWavelength,maxWavelength:this.maxWavelength,radianceBias:this.radianceBias,radianceGain:this.radianceGain,reflectanceBias:this.reflectanceBias,reflectanceGain:this.reflectanceGain,solarIrradiance:this.solarIrradiance})}};e([r({json:{name:"BandName",write:!0}})],o.prototype,"name",void 0),e([r({json:{read:{source:["WavelengthMin","Wavelength"],reader:(e,a)=>n(a.WavelengthMin??a.Wavelength)},write:{target:"WavelengthMin"}}})],o.prototype,"minWavelength",void 0),e([r({json:{name:"WavelengthMax",read:{reader:n},write:!0}})],o.prototype,"maxWavelength",void 0),e([r({json:{name:"RadianceBias",read:{reader:n},write:!0}})],o.prototype,"radianceBias",void 0),e([r({json:{name:"RadianceGain",read:{reader:n},write:!0}})],o.prototype,"radianceGain",void 0),e([r({json:{name:"ReflectanceBias",read:{reader:n},write:!0}})],o.prototype,"reflectanceBias",void 0),e([r({json:{name:"ReflectanceGain",read:{reader:n},write:!0}})],o.prototype,"reflectanceGain",void 0),e([r({json:{name:"SolarIrradiance",read:{reader:n},write:!0}})],o.prototype,"solarIrradiance",void 0),o=t=e([i("esri.layers.support.RasterBandInfo")],o);export{o as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as t}from"tslib";import e from"../../core/Logger.js";import{getMetersPerUnitForSR as o}from"../../core/unitUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../geometry/SpatialReference.js";import{toExtent as r,create as l,containsXY as a}from"../../geometry/support/aaBoundingRect.js";import m from"./ElevationSampler.js";let p=class extends m{get spatialReference(){return this.extent.spatialReference}constructor(t){const e=t.noDataValue,o="tiles"in t?t.tiles.map(o=>new c({tile:o,tileInfo:t.tileInfo,noDataValue:e})):t.samplers;super({noDataValue:e,samplers:o});const n=o[0];if(n){this.extent=n.extent.clone();const{min:t,max:e}=n.demResolution;this.demResolution={min:t,max:e};for(let n=1;n<o.length;n++){const t=o[n];this.extent.union(t.extent),this.demResolution.min=Math.min(this.demResolution.min,t.demResolution.min),this.demResolution.max=Math.max(this.demResolution.max,t.demResolution.max)}}else{const e="tileInfo"in t?t.tileInfo:null;this.extent=r(l(),e?.spatialReference??s.WGS84),this.demResolution={min:0,max:0}}}elevationAt(t,o){let n;for(const e of this.samplers)if(e.containsAt(t,o)&&(n=e.elevationAt(t,o),n!==e.noDataValue))return n;return null!=n?n:(e.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${t}, ${o}) is outside of the sampler`),this.noDataValue)}};t([n({constructOnly:!0})],p.prototype,"noDataValue",void 0),t([n({constructOnly:!0})],p.prototype,"samplers",void 0),p=t([i("esri.layers.support.TileElevationSampler")],p);let c=class extends m{get spatialReference(){return this.extent.spatialReference}constructor(t){super(t);const e=t.tile.key.extent;this.extent=r(e,t.tileInfo.spatialReference),this.extent.zmin=t.tile.zmin,this.extent.zmax=t.tile.zmax;const n=o(t.tileInfo.spatialReference),i=t.tileInfo.lodAt(t.tile.key.level).resolution*n;this.demResolution={min:i,max:i}}contains(t){const e=this.projectIfRequired(t,this.spatialReference);return null!=e&&this.containsAt(e.x,e.y)}containsAt(t,e){return a(this.tile.key.extent,t,e)}elevationAt(t,e){return this.containsAt(t,e)?this.tile.sample(t,e)??this.noDataValue:this.noDataValue}};t([n({constructOnly:!0})],c.prototype,"tile",void 0),t([n({constructOnly:!0})],c.prototype,"noDataValue",void 0),t([n({constructOnly:!0})],c.prototype,"tileInfo",void 0),c=t([i("esri.layers.support.TileElevationSampler.SingleTileElevationSampler")],c);export{p as TileElevationSampler};
@@ -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{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{getMetersPerUnitForSR as s}from"../../core/unitUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{Integer as i}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{create as u}from"../../geometry/support/aaBoundingRect.js";import{isValid as f,getInfo as h,isGeographic as m,equals as d}from"../../geometry/support/spatialReferenceUtils.js";import{project as g}from"../../geometry/support/webMercatorUtils.js";import y from"./LOD.js";import{TileKey as v}from"./TileKey.js";var w;const z=new t({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let j=class extends o{static{w=this}static create(e={}){const{resolutionFactor:t=1,scales:o,size:r=256,spatialReference:i=c.WebMercator,numLODs:l=24}=e;if(!f(i)){const e=[];if(o)for(let t=0;t<o.length;t++){const s=o[t];e.push(new y({level:t,scale:s,resolution:s}))}else{let t=5e-4;for(let o=l-1;o>=0;o--)e.unshift(new y({level:o,scale:t,resolution:t})),t*=2}return new w({dpi:96,lods:e,origin:new a(0,0,i),size:[r,r],spatialReference:i})}const n=h(i),p=e.origin?new a({x:e.origin.x,y:e.origin.y,spatialReference:i}):new a(n?{x:n.origin[0],y:n.origin[1],spatialReference:i}:{x:0,y:0,spatialReference:i}),u=96,d=1/(s(i)*39.37*u),g=[];if(o)for(let s=0;s<o.length;s++){const e=o[s],t=e*d;g.push(new y({level:s,scale:e,resolution:t}))}else{let e=m(i)?512/r*591657527.5917094:256/r*591657527.591555;const o=Math.ceil(l/t);g.push(new y({level:0,scale:e,resolution:e*d}));for(let s=1;s<o;s++){const o=e/2**t,r=o*d;g.push(new y({level:s,scale:o,resolution:r})),e=o}}return new w({dpi:u,lods:g,origin:p,size:[r,r],spatialReference:i})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const o=h(e);return e.isWrappable&&!!o&&Math.abs(o.origin[0]-t.x)<=o.dx}return!1}readOrigin(e,t){return a.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,o=0;const s=[],r=this._levelToLOD={};e&&(t=-1/0,o=1/0,e.forEach(e=>{s.push(e.scale),t=e.scale>t?e.scale:t,o=e.scale<o?e.scale:o,r[e.level]=e})),this._set("scales",s),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const o=Math.floor(e),s=o+1;return t[o]/(t[o]/t[s])**(e-o)}scaleToZoom(e){const t=this.scales,o=t.length-1;let s=0;for(;s<o;s++){const o=t[s],r=t[s+1];if(o<=e)return s;if(r===e)return s+1;if(o>e&&r<e)return s+Math.log(o/e)/Math.log(o/r)}return s}tileAt(e,t,o,s){const r=this.lodAt(e);if(!r)return null;let i,l;if("number"==typeof t)i=t,l=o;else if(d(t.spatialReference,this.spatialReference))i=t.x,l=t.y,s=o;else{const e=g(t,this.spatialReference);if(null==e)return null;i=e.x,l=e.y,s=o}const n=r.resolution*this.size[0],p=r.resolution*this.size[1];return s||(s=new v(null,0,0,0,u())),s.level=e,s.row=Math.floor((this.origin.y-l)/p+.001),s.col=Math.floor((i-this.origin.x)/n+.001),this.updateTileInfo(s),s}updateTileInfo(e,t=0){let o=this.lodAt(e.level);if(!o&&1===t){const t=this.lods[this.lods.length-1];t.level<e.level&&(o=t)}if(!o)return;const s=e.level-o.level,r=o.resolution*this.size[0]/2**s,i=o.resolution*this.size[1]/2**s;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=u()),e.extent[0]=this.origin.x+e.col*r,e.extent[1]=this.origin.y-(e.row+1)*i,e.extent[2]=e.extent[0]+r,e.extent[3]=e.extent[1]+i}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel)&&(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),!0)}getTileBounds(e,t){const o=this.lodAt(t.level);if(null==o)return null;const{resolution:s}=o,r=s*this.size[0],i=s*this.size[1];return e[0]=this.origin.x+t.col*r,e[1]=this.origin.y-(t.row+1)*i,e[2]=e[0]+r,e[3]=e[1]+i,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return w.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===e)return null;const t=(512===this.size[0]&&256===e?-1:0)+(this.spatialReference.isGeographic?1:0);if(this.size[0]===e&&0===t)return this;const o=[],s=this.lods.length-t;for(let r=0;r<s;r++){const e=r+t,{scale:s,resolution:i}=e>=0?this.lods[e]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};o.push(new y({level:r,scale:s,resolution:i}))}return new w({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:o})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let o=0;o<e.length;o++){const s=e[o];this._upsampleLevels[s.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/s.resolution:0},t=s}}};e([r({type:Number,json:{write:!0}})],j.prototype,"compressionQuality",void 0),e([r({type:Number,json:{write:!0}})],j.prototype,"dpi",void 0),e([r({type:String,json:{read:z.read,write:z.write,origins:{"web-scene":{read:!1,write:!1}}}})],j.prototype,"format",void 0),e([r({readOnly:!0})],j.prototype,"isWrappable",null),e([r({type:a,json:{write:!0}})],j.prototype,"origin",void 0),e([l("origin")],j.prototype,"readOrigin",null),e([r({type:[y],value:null,json:{write:!0}})],j.prototype,"lods",null),e([r({readOnly:!0})],j.prototype,"scales",void 0),e([r({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],j.prototype,"size",void 0),e([l("size",["rows","cols"])],j.prototype,"readSize",null),e([p("size",{cols:{type:i},rows:{type:i}})],j.prototype,"writeSize",null),e([r({type:c,json:{write:!0}})],j.prototype,"spatialReference",void 0),j=w=e([n("esri.layers.support.TileInfo")],j);export{j as default};
5
+ import{__decorate as e}from"tslib";import{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{getMetersPerUnitForSR as o}from"../../core/unitUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{Integer as i}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{isValid as u,getInfo as f,isGeographic as h,equals as m}from"../../geometry/support/spatialReferenceUtils.js";import{project as d}from"../../geometry/support/webMercatorUtils.js";import g from"./LOD.js";import{TileKey as y}from"./TileKey.js";var v;const w=new t({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let z=class extends s{static{v=this}static create(e={}){const{resolutionFactor:t=1,scales:s,size:r=256,spatialReference:i=c.WebMercator,numLODs:l=24}=e;if(!u(i)){const e=[];if(s)for(let t=0;t<s.length;t++){const o=s[t];e.push(new g({level:t,scale:o,resolution:o}))}else{let t=5e-4;for(let s=l-1;s>=0;s--)e.unshift(new g({level:s,scale:t,resolution:t})),t*=2}return new v({dpi:96,lods:e,origin:new a(0,0,i),size:[r,r],spatialReference:i})}const n=f(i),p=e.origin?new a({x:e.origin.x,y:e.origin.y,spatialReference:i}):new a(n?{x:n.origin[0],y:n.origin[1],spatialReference:i}:{x:0,y:0,spatialReference:i}),m=96,d=1/(o(i)*39.37*m),y=[];if(s)for(let o=0;o<s.length;o++){const e=s[o],t=e*d;y.push(new g({level:o,scale:e,resolution:t}))}else{let e=h(i)?512/r*591657527.5917094:256/r*591657527.591555;const s=Math.ceil(l/t);y.push(new g({level:0,scale:e,resolution:e*d}));for(let o=1;o<s;o++){const s=e/2**t,r=s*d;y.push(new g({level:o,scale:s,resolution:r})),e=s}}return new v({dpi:m,lods:y,origin:p,size:[r,r],spatialReference:i})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const s=f(e);return e.isWrappable&&!!s&&Math.abs(s.origin[0]-t.x)<=s.dx}return!1}readOrigin(e,t){return a.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,s=0;const o=[],r=this._levelToLOD={};e&&(t=-1/0,s=1/0,e.forEach(e=>{o.push(e.scale),t=e.scale>t?e.scale:t,s=e.scale<s?e.scale:s,r[e.level]=e})),this._set("scales",o),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const s=Math.floor(e),o=s+1;return t[s]/(t[s]/t[o])**(e-s)}scaleToZoom(e){const t=this.scales,s=t.length-1;let o=0;for(;o<s;o++){const s=t[o],r=t[o+1];if(s<=e)return o;if(r===e)return o+1;if(s>e&&r<e)return o+Math.log(s/e)/Math.log(s/r)}return o}tileAt(e,t,s,o){const r=this.lodAt(e);if(!r)return null;let i,l;if("number"==typeof t)i=t,l=s;else if(m(t.spatialReference,this.spatialReference))i=t.x,l=t.y,o=s;else{const e=d(t,this.spatialReference);if(null==e)return null;i=e.x,l=e.y,o=s}const n=r.resolution*this.size[0],p=r.resolution*this.size[1];return o??=new y(0,0,0),o.level=e,o.row=Math.floor((this.origin.y-l)/p+.001),o.col=Math.floor((i-this.origin.x)/n+.001),this.updateTileInfo(o),o}updateTileInfo(e,t=0){if(!("extent"in e))return!1;let s=this.lodAt(e.level);if(!s&&1===t){const t=this.lods[this.lods.length-1];t.level<e.level&&(s=t)}if(!s)return!1;const o=e.level-s.level,r=s.resolution*this.size[0]/2**o,i=s.resolution*this.size[1]/2**o;return e.extent[0]=this.origin.x+e.col*r,e.extent[1]=this.origin.y-(e.row+1)*i,e.extent[2]=e.extent[0]+r,e.extent[3]=e.extent[1]+i,!0}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel)&&(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),!0)}getTileBounds(e,t){const s=this.lodAt(t.level);if(null==s)return null;const{resolution:o}=s,r=o*this.size[0],i=o*this.size[1];return e[0]=this.origin.x+t.col*r,e[1]=this.origin.y-(t.row+1)*i,e[2]=e[0]+r,e[3]=e[1]+i,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return v.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===e)return null;const t=(512===this.size[0]&&256===e?-1:0)+(this.spatialReference.isGeographic?1:0);if(this.size[0]===e&&0===t)return this;const s=[],o=this.lods.length-t;for(let r=0;r<o;r++){const e=r+t,{scale:o,resolution:i}=e>=0?this.lods[e]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};s.push(new g({level:r,scale:o,resolution:i}))}return new v({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:s})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let s=0;s<e.length;s++){const o=e[s];this._upsampleLevels[o.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/o.resolution:0},t=o}}};e([r({type:Number,json:{write:!0}})],z.prototype,"compressionQuality",void 0),e([r({type:Number,json:{write:!0}})],z.prototype,"dpi",void 0),e([r({type:String,json:{read:w.read,write:w.write,origins:{"web-scene":{read:!1,write:!1}}}})],z.prototype,"format",void 0),e([r({readOnly:!0})],z.prototype,"isWrappable",null),e([r({type:a,json:{write:!0}})],z.prototype,"origin",void 0),e([l("origin")],z.prototype,"readOrigin",null),e([r({type:[g],value:null,json:{write:!0}})],z.prototype,"lods",null),e([r({readOnly:!0})],z.prototype,"scales",void 0),e([r({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],z.prototype,"size",void 0),e([l("size",["rows","cols"])],z.prototype,"readSize",null),e([p("size",{cols:{type:i},rows:{type:i}})],z.prototype,"writeSize",null),e([r({type:c,json:{write:!0}})],z.prototype,"spatialReference",void 0),z=v=e([n("esri.layers.support.TileInfo")],z);export{z 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
- class t{constructor(t,s,i,o,e=void 0){this.id=t,this.level=s,this.row=i,this.col=o,this.extent=e}}export{t as TileKey};
5
+ import{create as t}from"../../geometry/support/aaBoundingRect.js";class e{constructor(e,l,i,s=t()){this._level=e,this._row=l,this._col=i,this.extent=s}get id(){return this._id??=`${this.level}/${this.row}/${this.col}`,this._id}get level(){return this._level}set level(t){this._level=t,this._id=null}get row(){return this._row}set row(t){this._row=t,this._id=null}get col(){return this._col}set col(t){this._col=t,this._id=null}toJSON(){return{level:this._level,row:this._row,col:this._col,extent:this.extent}}static fromJSON(t){return new e(t.level,t.row,t.col,t.extent)}}export{e as TileKey};
@@ -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"../../request.js";import i from"../../core/Accessor.js";import r from"../../core/Error.js";import{makeHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import{LRUCache as l}from"../../core/LRUCache.js";import o from"../../core/PooledArray.js";import{isAbortError as a,isAborted as n,onAbort as c,createAbortError as h}from"../../core/promiseUtils.js";import{watch as p,initial as m}from"../../core/reactiveUtils.js";import{waitTicks as f}from"../../core/scheduling.js";import{objectToQuery as u}from"../../core/urlUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{TileKey as d}from"./TileKey.js";import{Tilemap as _,tilemapDefinitionId as b}from"./Tilemap.js";var g;function w(e,t,i){return new r("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let j=class extends i{static{g=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=t,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new l(2097152),this.addHandles(p(()=>{const{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),m))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";const r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(w(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof _){const s=r.getAvailability(t,i);if("unavailable"===s)throw w(e,t,i);return s}if(a(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,s){r.level=e,r.row=t,r.col=i;const l=this.layer.tileInfo;l.updateTileInfo(r);const o=this.fetchAvailability(e,t,i,s).catch(e=>{if(a(e))throw e;if(l.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,s);throw e});return this._fetchAvailabilityUpsamplePrefetch(r.id,e,t,i,s,o),o}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,l,o){if(!this._prefetchingEnabled||null==e)return;const a=`prefetch-${e}`;if(this.hasHandles(a))return;const c=new AbortController;o.then(()=>c.abort(),()=>c.abort());let h=!1;const p=s(()=>{h||(h=!0,c.abort())});if(this.addHandles(p,a),await f(10,c.signal).catch(()=>{}),h||(h=!0,this.removeHandles(a)),n(c))return;const m=new d(e,t,i,r),u={...l,signal:c.signal},v=this.layer.tileInfo;for(let s=0;g._prefetches.length<g._maxPrefetch&&v.upsampleTile(m);++s){const e=this.fetchAvailability(m.level,m.row,m.col,u);g._prefetches.push(e);const t=()=>{g._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new o({initialSize:g._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,s){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new r("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const l=this._tmpTilemapDefinition,o=this._tilemapFromCache(e,t,i,l);if(o)return Promise.resolve(o);const a=s?.signal;return s={...s,signal:null},new Promise((e,t)=>{c(a,()=>t(h()));const i=b(l);let r=this._pendingTilemapRequests[i];if(!r){r=_.fromDefinition(l,s).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));const e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=r,r.then(e,e)}r.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;const{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:u({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;const s=b(r);return this._tilemapCache.get(s)}get test(){}};e([v({constructOnly:!0})],j.prototype,"layer",void 0),e([v({constructOnly:!0})],j.prototype,"minLOD",void 0),e([v({constructOnly:!0})],j.prototype,"maxLOD",void 0),e([v({constructOnly:!0})],j.prototype,"request",void 0),e([v({constructOnly:!0})],j.prototype,"size",void 0),j=g=e([y("esri.layers.support.TilemapCache")],j);export{j as TilemapCache};
5
+ import{__decorate as e}from"tslib";import t from"../../request.js";import i from"../../core/Accessor.js";import r from"../../core/Error.js";import{makeHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import{LRUCache as l}from"../../core/LRUCache.js";import o from"../../core/PooledArray.js";import{isAbortError as a,isAborted as n,onAbort as c,createAbortError as h}from"../../core/promiseUtils.js";import{watch as p,initial as m}from"../../core/reactiveUtils.js";import{waitTicks as f}from"../../core/scheduling.js";import{objectToQuery as u}from"../../core/urlUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{TileKey as d}from"./TileKey.js";import{Tilemap as _,tilemapDefinitionId as b}from"./Tilemap.js";var g;function w(e,t,i){return new r("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let j=class extends i{static{g=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=t,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new l(2097152),this.addHandles(p(()=>{const{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),m))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";const r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(w(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof _){const s=r.getAvailability(t,i);if("unavailable"===s)throw w(e,t,i);return s}if(a(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,s){r.level=e,r.row=t,r.col=i;const l=this.layer.tileInfo;l.updateTileInfo(r);const o=this.fetchAvailability(e,t,i,s).catch(e=>{if(a(e))throw e;if(l.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,s);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,s,o),o}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,l){if(!this._prefetchingEnabled)return;const o=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(o))return;const a=new AbortController;l.then(()=>a.abort(),()=>a.abort());let c=!1;const h=s(()=>{c||(c=!0,a.abort())});if(this.addHandles(h,o),await f(10,a.signal).catch(()=>{}),c||(c=!0,this.removeHandles(o)),n(a))return;const p=new d(e,t,i),m={...r,signal:a.signal},u=this.layer.tileInfo;for(let s=0;g._prefetches.length<g._maxPrefetch&&u.upsampleTile(p);++s){const e=this.fetchAvailability(p.level,p.row,p.col,m);g._prefetches.push(e);const t=()=>{g._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new o({initialSize:g._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,s){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new r("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const l=this._tmpTilemapDefinition,o=this._tilemapFromCache(e,t,i,l);if(o)return Promise.resolve(o);const a=s?.signal;return s={...s,signal:null},new Promise((e,t)=>{c(a,()=>t(h()));const i=b(l);let r=this._pendingTilemapRequests[i];if(!r){r=_.fromDefinition(l,s).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));const e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=r,r.then(e,e)}r.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;const{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:u({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;const s=b(r);return this._tilemapCache.get(s)}get test(){}};e([v({constructOnly:!0})],j.prototype,"layer",void 0),e([v({constructOnly:!0})],j.prototype,"minLOD",void 0),e([v({constructOnly:!0})],j.prototype,"maxLOD",void 0),e([v({constructOnly:!0})],j.prototype,"request",void 0),e([v({constructOnly:!0})],j.prototype,"size",void 0),j=g=e([y("esri.layers.support.TilemapCache")],j);export{j as TilemapCache};
@@ -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 n from"../../core/Collection.js";import"../../core/urlUtils.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";import{isBasemap as i}from"../../support/userTypeGuards/isBasemap.js";function u(e){return d(e)||y(e)}function o(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function l(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function f(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph-sublayer"===e.type}function p(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function y(e){return"scene"===e?.type}function g(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function b(e){return"subtype-sublayer"===e?.type}function d(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function m(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function h(e){return null!=e&&"type"in e&&"group"===e.type}const j={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function v(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function w(e){return"IntegratedMeshLayer"===e||"IntegratedMesh3DTilesLayer"===e}function L(e){return"integrated-mesh"===e||"integrated-mesh-3dtiles"===e}function S(e){return"integrated-mesh-3dtiles"===e}function E(e){return"voxel"===e?.type}function C(e){return"imagery-tile"===e?.type}function M(e,t){return i(e?.parent)&&e.parent[t].includes(e)}function T(e){return M(e,"baseLayers")}function k(e){return M(e,"referenceLayers")}function x(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function I(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function U(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function O(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)}),n.length>0)){let e;if(r){const t={};n.forEach(e=>{t[e[0]]=e[1]}),e=JSON.stringify(t)}else{const t=[];n.forEach(e=>{t.push(e[0]+":"+e[1])}),e=t.join(";")}return e}return null}function B(e){if(!e)return;const t=[];return e.forEach((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))}),t.length?"{"+t.join(",")+"}":void 0}function P(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function q(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const o=`${n.slice(0,u)}/rest/info`,s=null!=r?r.signal:null,{data:c}=await t(o,{query:{f:"json"},responseType:"json",signal:s});return c?.owningSystemUrl||null}function D(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function J(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function N(e){return D(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function F(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function G(e){return!!F(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function V(e){if(!e)return[];return("subtypes"in e?e.subtypes:g(e.parent)?e.parent.subtypes:[])??[]}function $(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function z(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))"csv"===n.type||r(n)||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}function A(e,t){return null}function H(e){return null}function K(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function Q(e,t){if(!t||!K(e))return;const n=A(e.url);n&&(e.url=n)}export{Q as applyPreferredHostToPortalItem,G as getEffectiveEditingEnabled,N as getEffectiveLayerCapabilities,z as getLayersWithChartSupport,q as getOwningPortalUrl,H as getPreferredHost,A as getPreferredUrl,V as getSubtypesFromLayer,P as getTileMaxtrixSetFromActiveLayer,T as isBaseLayer,u as isBasemap3DSupportedLayer,d as isBasemapSupportedTiledLayer,x as isFeatureCollectionLayer,o as isFeatureLayer,U as isFeatureServiceLayer,s as isGraphicsLayer,h as isGroupLayer,C as isImageryTileLayer,S as isIntegratedMesh3DTilesLayer,L as isIntegratedMeshLayer,w as isIntegratedMeshOperationalLayer,l as isKnowledgeGraphLayer,f as isKnowledgeGraphSublayer,D as isLayerWithFeatureCapabilities,I as isLayerWithFeatureLayerSource,$ as isLayerWithFlowRenderer,p as isLinkChartLayer,c as isMapImageLayer,a as isMapNotesLayer,K as isPreferredUrlApplicable,k as isReferenceLayer,y as isSceneLayer,v as isSceneServiceLayer,g as isSubtypeGroupLayer,b as isSubtypeSublayer,J as isTable,m as isTiledLayer,E as isVoxelLayer,j as sceneServiceLayerTypeToClassName,O as serializeLayerDefinitions,B as serializeTimeOptions};
5
+ import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import"../../core/urlUtils.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";import{isBasemap as i}from"../../support/userTypeGuards/isBasemap.js";function u(e){return h(e)||y(e)}function o(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function l(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function p(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph-sublayer"===e.type}function f(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function y(e){return"scene"===e?.type}function g(e){return b(e)||S(e)}function b(e){return"elevation"===e.type||"base-elevation"===e.type}function d(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function m(e){return"subtype-sublayer"===e?.type}function h(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function j(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function v(e){return null!=e&&"type"in e&&"group"===e.type}const w={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function L(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function S(e){return"integrated-mesh"===e.type||"integrated-mesh-3dtiles"===e.type}function E(e){return"integrated-mesh-3dtiles"===e.type}function C(e){return"voxel"===e?.type}function k(e){return"imagery-tile"===e?.type}function x(e,t){return i(e?.parent)&&e.parent[t].includes(e)}function T(e){return x(e,"baseLayers")}function U(e){return x(e,"referenceLayers")}function M(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function O(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function B(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function I(e){return o(e)&&B(e)}function P(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)}),n.length>0)){let e;if(r){const t={};n.forEach(e=>{t[e[0]]=e[1]}),e=JSON.stringify(t)}else{const t=[];n.forEach(e=>{t.push(e[0]+":"+e[1])}),e=t.join(";")}return e}return null}function q(e){if(!e)return;const t=[];return e.forEach((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))}),t.length?"{"+t.join(",")+"}":void 0}function J(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function N(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const o=`${n.slice(0,u)}/rest/info`,s=null!=r?r.signal:null,{data:c}=await t(o,{query:{f:"json"},responseType:"json",signal:s});return c?.owningSystemUrl||null}function D(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function F(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function G(e){return D(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function V(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function $(e){return!!V(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function z(e){if(!e)return[];return("subtypes"in e?e.subtypes:d(e.parent)?e.parent.subtypes:[])??[]}function A(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function H(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))"csv"===n.type||r(n)||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}function K(e,t){return null}function Q(e){return null}function R(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function W(e,t){if(!t||!R(e))return;const n=K(e.url);n&&(e.url=n)}export{W as applyPreferredHostToPortalItem,$ as getEffectiveEditingEnabled,G as getEffectiveLayerCapabilities,H as getLayersWithChartSupport,N as getOwningPortalUrl,Q as getPreferredHost,K as getPreferredUrl,z as getSubtypesFromLayer,J as getTileMaxtrixSetFromActiveLayer,T as isBaseLayer,u as isBasemap3DSupportedLayer,h as isBasemapSupportedTiledLayer,b as isElevationLayer,M as isFeatureCollectionLayer,o as isFeatureLayer,B as isFeatureServiceLayer,s as isGraphicsLayer,g as isGroundElevationLayer,v as isGroupLayer,k as isImageryTileLayer,E as isIntegratedMesh3DTilesLayer,S as isIntegratedMeshLayer,l as isKnowledgeGraphLayer,p as isKnowledgeGraphSublayer,D as isLayerWithFeatureCapabilities,O as isLayerWithFeatureLayerSource,A as isLayerWithFlowRenderer,f as isLinkChartLayer,c as isMapImageLayer,a as isMapNotesLayer,R as isPreferredUrlApplicable,U as isReferenceLayer,y as isSceneLayer,L as isSceneServiceLayer,d as isSubtypeGroupLayer,m as isSubtypeSublayer,F as isTable,j as isTiledLayer,C as isVoxelLayer,w as sceneServiceLayerTypeToClassName,P as serializeLayerDefinitions,q as serializeTimeOptions,I as supportsFieldConfiguration};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import o from"./ParquetEncodingLocation.js";import r from"./ParquetEncodingWkb.js";function t(t){switch(t.type){case"wkb":return r.fromJSON(t);case"location":return o.fromJSON(t)}}export{t as fromParquetEncodingJSON};
@@ -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 e from"../../core/Collection.js";import t from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import i from"../../geometry/SpatialReference.js";import n from"./Field.js";import{inferLocationInfo as r}from"./locationUtils.js";import l from"./ParquetEncodingLocation.js";import s from"./ParquetEncodingWkb.js";import{createParquetFile as a,readGeoMetadata as m,readEsriMetadata as u}from"../../libs/parquet/parquet.js";const c=new o({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"});function p(e){return c.toJSON(e)}function f(t,o={}){return d({urls:new e(t)},o)}async function d(e,o={}){if(e.geometryType&&e.spatialReference&&e.encoding&&e.fields)return e;if(e.urls.length<1)throw new t("parquet:bad-input","At least one url must be specified",e);const r=await a(e.urls.getItemAt(0),{getCustomParameters:()=>o.customParameters}),l=m(r),s={...e,file:r};null==s.fields&&(s.fields=r.fields().map(e=>n.fromJSON({name:e.name,type:e.type}))),null==s.encoding&&(s.encoding=y(l,s.fields));const c=u(r);if(c)switch(c.mode){case"z":s.displayOptimization={mode:"z"};break;case"xz":{const e=c.multiscale;if(!e)throw new t("bad-format","XZ display optimization requires multiscale geometries");s.displayOptimization={mode:"xz",multiscale:e};break}}if(!s.encoding)return s;switch(s.encoding.type){case"location":null==s.spatialReference&&(s.spatialReference=i.WGS84),null==s.geometryType&&(s.geometryType="point");break;case"wkb":{if(!l)return s;const e=l.primary_column,t=l.columns[e];if(s.geometryType||(s.geometryType=w(t)),s.spatialReference||(s.spatialReference=P(t)),s.fields)for(const o of Object.keys(l.columns))s.fields=s.fields.filter(e=>e.name!==o)}}return s}function y(e,t){if(null!=e){const t=e.primary_column,o=e.columns[t];return new s({primaryFieldName:t,orientation:o.orientation??null})}const o=r(t.map(e=>e.name));return o.latitudeFieldName&&o.latitudeFieldName?new l({latitudeFieldName:o.latitudeFieldName,longitudeFieldName:o.longitudeFieldName}):null}function g(e){switch(e){case"Point":return"point";case"Polygon":case"MultiPolygon":return"polygon";case"LineString":return"polyline";case"MultiPoint":return"multipoint";default:return null}}function w(e){const{geometry_types:o}=e,i=new Set;for(const t of o){const e=g(t);e&&i.add(e)}if(i.size>1)throw new t("unsupported","Parquet mixed geometry types are not support",{geometryTypes:i});return 1===i.size?i.values().next().value:void 0}function P(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?new i({wkid:t}):void 0}export{d as completeParquetLayerInfo,f as getParquetLayerInfo,c as parquetGeometryTypeKebabDict,p as toParquetJSONGeometryType};
5
+ import e from"../../core/Collection.js";import t from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import n from"../../geometry/SpatialReference.js";import i from"./Field.js";import{inferLocationInfo as r}from"./locationUtils.js";import l from"./ParquetEncodingLocation.js";import s from"./ParquetEncodingWkb.js";import{createParquetFile as a,readGeoMetadata as m,readEsriMetadata as u}from"../../libs/parquet/parquet.js";const c=new o({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"});function p(e){return c.toJSON(e)}function f(e){return c.fromJSON(e)}function d(t,o={}){return y({urls:new e(t)},o)}async function y(e,o={}){if(e.geometryType&&e.spatialReference&&e.encoding&&e.fields)return e;if(e.urls.length<1)throw new t("parquet:bad-input","At least one url must be specified",e);const r=await a(e.urls.getItemAt(0),{getCustomParameters:()=>o.customParameters}),l=m(r),s={...e,file:r};null==s.fields&&(s.fields=r.fields().map(e=>i.fromJSON({name:e.name,type:e.type}))),null==s.encoding&&(s.encoding=g(l,s.fields));const c=u(r);if(c)switch(c.mode){case"z":s.displayOptimization={mode:"z"};break;case"xz":{const e=c.multiscale;if(!e)throw new t("bad-format","XZ display optimization requires multiscale geometries");s.displayOptimization={mode:"xz",multiscale:e};break}}if(!s.encoding)return s;switch(s.encoding.type){case"location":null==s.spatialReference&&(s.spatialReference=n.WGS84),null==s.geometryType&&(s.geometryType="point");break;case"wkb":{if(!l)return s;const e=l.primary_column,t=l.columns[e];if(s.geometryType||(s.geometryType=P(t)),s.spatialReference||(s.spatialReference=b(t)),s.fields)for(const o of Object.keys(l.columns))s.fields=s.fields.filter(e=>e.name!==o)}}return s}function g(e,t){if(null!=e){const t=e.primary_column,o=e.columns[t];return new s({primaryFieldName:t,orientation:o.orientation??null})}const o=r(t.map(e=>e.name));return o.latitudeFieldName&&o.latitudeFieldName?new l({latitudeFieldName:o.latitudeFieldName,longitudeFieldName:o.longitudeFieldName}):null}function w(e){switch(e){case"Point":return"point";case"Polygon":case"MultiPolygon":return"polygon";case"LineString":return"polyline";case"MultiPoint":return"multipoint";default:return null}}function P(e){const{geometry_types:o}=e,n=new Set;for(const t of o){const e=w(t);e&&n.add(e)}if(n.size>1)throw new t("unsupported","Parquet mixed geometry types are not support",{geometryTypes:n});return 1===n.size?n.values().next().value:void 0}function b(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?new n({wkid:t}):void 0}export{y as completeParquetLayerInfo,f as fromParquetJSONGeometryType,d as getParquetLayerInfo,c as parquetGeometryTypeKebabDict,p as toParquetJSONGeometryType};