@arcgis/core 5.2.0-next.154 → 5.2.0-next.156

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 (240) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  3. package/assets/esri/core/workers/chunks/0590857215c547e63b51.js +1 -0
  4. package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
  5. package/assets/esri/core/workers/chunks/0cb50bc2b2125c5fedf2.js +1 -0
  6. package/assets/esri/core/workers/chunks/1201b8c5852830836eac.js +1 -0
  7. package/assets/esri/core/workers/chunks/129e04d24ced77c9bb6d.js +1 -0
  8. package/assets/esri/core/workers/chunks/15e1117a706a98b17ad5.js +1 -0
  9. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  10. package/assets/esri/core/workers/chunks/168a523bdc3653081f8a.js +1 -0
  11. package/assets/esri/core/workers/chunks/{6f4e6022a52de0c54aab.js → 172cfeb5f415e4662432.js} +1 -1
  12. package/assets/esri/core/workers/chunks/1aa4f5394a596e544aeb.js +1 -0
  13. package/assets/esri/core/workers/chunks/22b01fe31bbf0bdc48db.js +1 -0
  14. package/assets/esri/core/workers/chunks/27c2da2e779def2ee08b.js +1 -0
  15. package/assets/esri/core/workers/chunks/28b74bc77f7c13080074.js +1 -0
  16. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  17. package/assets/esri/core/workers/chunks/3914d96147642a9d4b01.js +1 -0
  18. package/assets/esri/core/workers/chunks/{731018c0deffc41ffc97.js → 3e3e076fa5e8d5d5f33f.js} +1 -1
  19. package/assets/esri/core/workers/chunks/43cf862577bf37344ff4.js +1 -0
  20. package/assets/esri/core/workers/chunks/4932773663469919d10a.js +1 -0
  21. package/assets/esri/core/workers/chunks/4996869b9cbd8c8ddcfa.js +1 -0
  22. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  23. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  24. package/assets/esri/core/workers/chunks/{eb815148ae65388dd733.js → 544070198d2ca556103a.js} +1 -1
  25. package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
  26. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  27. package/assets/esri/core/workers/chunks/5f4feca26102088ea565.js +1 -0
  28. package/assets/esri/core/workers/chunks/{407f1e8176f3b0af73b4.js → 66867e523cc82f8fe35b.js} +1 -1
  29. package/assets/esri/core/workers/chunks/6f73e41e14817acfaead.js +1 -0
  30. package/assets/esri/core/workers/chunks/{320e5942a098dd104366.js → 74137ffec5265628c33b.js} +1 -1
  31. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  32. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  33. package/assets/esri/core/workers/chunks/7711ae5612f685078fc8.js +1 -0
  34. package/assets/esri/core/workers/chunks/{5116b569a8dbda4910c8.js → 784a2fba3e18286958d1.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{693873b3eb99fba58fa9.js → 78c4e43cfa1eda06b4d9.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{f6e62d2d279a328cbed7.js → 7bcedf479b07a4b4a234.js} +1 -1
  37. package/assets/esri/core/workers/chunks/81cad8d2f62a5f671c55.js +1 -0
  38. package/assets/esri/core/workers/chunks/{588e677f33df86a595bf.js → 820c8aaf3632edb0150c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/842893e75696428d536f.js +1 -0
  40. package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
  41. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  42. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{a4162a8660bf763d542d.js → 967b4992b400517ee712.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{adf25e5ed99615b83c68.js → a62c12925303ff802c3d.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  46. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  47. package/assets/esri/core/workers/chunks/acdfd275dbf8533a67f3.js +1 -0
  48. package/assets/esri/core/workers/chunks/ace2e0a9d9013edd8624.js +1 -0
  49. package/assets/esri/core/workers/chunks/b1d5d236d5268fcbc74b.js +1 -0
  50. package/assets/esri/core/workers/chunks/b3007aedbf731dacaff1.js +1 -0
  51. package/assets/esri/core/workers/chunks/{53e2f2b922116a45fe8f.js → b573df59391ca41ee5a7.js} +1 -1
  52. package/assets/esri/core/workers/chunks/bac8c32665e982896ecc.js +1 -0
  53. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  54. package/assets/esri/core/workers/chunks/c19f238b55ff2893f7c2.js +1 -0
  55. package/assets/esri/core/workers/chunks/c5ed67fdf261cbb1624b.js +1 -0
  56. package/assets/esri/core/workers/chunks/c72a904e01dc8c17d992.js +1 -0
  57. package/assets/esri/core/workers/chunks/d9b1aed88b205689cec6.js +1 -0
  58. package/assets/esri/core/workers/chunks/de6081df29183bf80787.js +1 -0
  59. package/assets/esri/core/workers/chunks/{c598b22f78ccc57f9d6d.js → dfd2dc5cdc97ffba8926.js} +1 -1
  60. package/assets/esri/core/workers/chunks/e1b7806ab3e1967b15f0.js +1 -0
  61. package/assets/esri/core/workers/chunks/e653c81ffb3d818645dd.js +1 -0
  62. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  63. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  64. package/assets/esri/core/workers/chunks/{c62738f84c914671b143.js → f4a7aa3cdbc0c429c359.js} +1 -1
  65. package/assets/esri/core/workers/chunks/fda83bcb8e40e8044c24.js +1 -0
  66. package/assets/esri/libs/pdfjs/wasm/openjpeg_nowasm_fallback.js +1 -0
  67. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +4 -0
  68. package/assets/esri/themes/dark/main.css +1 -1
  69. package/assets/esri/themes/light/main.css +1 -1
  70. package/assets/esri/themes/light/view.css +1 -1
  71. package/assets/esri/widgets/support/uriUtils/t9n/messages.fr.json +1 -1
  72. package/config.d.ts +2 -0
  73. package/config.js +1 -1
  74. package/core/ObjectPool.js +1 -1
  75. package/core/PooledArray.js +1 -1
  76. package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
  77. package/geometry/support/buffer/BufferPool.js +1 -1
  78. package/geometry/support/coordsUtils.js +1 -1
  79. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  80. package/geometry/support/curves/mathUtils.js +1 -1
  81. package/interfaces.d.ts +18 -9
  82. package/kernel.js +1 -1
  83. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  84. package/layers/AnnotationFeatureLayer.js +1 -1
  85. package/layers/CatalogLayer.d.ts +2 -2
  86. package/layers/CatalogLayer.js +1 -1
  87. package/layers/DimensionFeatureLayer.d.ts +2 -2
  88. package/layers/DimensionFeatureLayer.js +1 -1
  89. package/layers/FeatureLayer.d.ts +2 -2
  90. package/layers/FeatureLayer.js +1 -1
  91. package/layers/SubtypeGroupLayer.d.ts +2 -2
  92. package/layers/SubtypeGroupLayer.js +1 -1
  93. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  94. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  95. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  96. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  97. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  98. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  99. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  100. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  101. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  102. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  103. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  104. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  105. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  106. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  107. package/layers/mixins/ReloadableLayer.js +2 -0
  108. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  109. package/layers/raster/datasets/BaseRaster.js +1 -1
  110. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  111. package/layers/raster/datasets/ImageAuxRaster.js +1 -1
  112. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  113. package/layers/raster/datasets/MRFRaster.js +1 -1
  114. package/layers/raster/datasets/TIFFRaster.js +1 -1
  115. package/layers/raster/datasets/WCSRaster.js +1 -1
  116. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  117. package/layers/raster/formats/RasterCodec.js +1 -1
  118. package/layers/raster/formats/TiffDecoder.js +1 -1
  119. package/layers/raster/formats/Zlib.js +1 -1
  120. package/layers/support/RasterWorker.js +1 -1
  121. package/layers/support/fieldUtils.js +1 -1
  122. package/layers/support/vectorTileLayerLoader.js +1 -1
  123. package/package.json +2 -2
  124. package/popup/FeatureModel.js +1 -1
  125. package/popup/FeaturesModel.js +1 -1
  126. package/portal/schemas/definitions.js +1 -1
  127. package/request/process.js +1 -1
  128. package/request/types.d.ts +7 -0
  129. package/symbols/cim/cimAnalyzer.js +1 -1
  130. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  131. package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSource.js +1 -1
  132. package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSourceWorker.js +1 -1
  133. package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +2 -0
  134. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  136. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  137. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  138. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  139. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  140. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  141. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  142. package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
  143. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  144. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  145. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  146. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  147. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  148. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  149. package/views/3d/support/MemoryController.js +1 -1
  150. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  151. package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
  152. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  153. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  154. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  155. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  156. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  157. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  158. package/views/draw/DrawTool.js +1 -1
  159. package/views/draw/support/PluginContext.js +1 -1
  160. package/views/draw/support/managers/TooltipManager.js +1 -1
  161. package/views/draw/support/types.d.ts +5 -2
  162. package/webdoc/applicationProperties/SearchLayerField.d.ts +7 -1
  163. package/webdoc/applicationProperties/SearchLayerField.js +1 -1
  164. package/webdoc/applicationProperties/SearchTableField.d.ts +7 -1
  165. package/webdoc/applicationProperties/SearchTableField.js +1 -1
  166. package/webdoc/applicationProperties/searchMode.js +2 -0
  167. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  168. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  169. package/widgets/BatchAttributeForm.js +1 -1
  170. package/widgets/Editor/EditorViewModel.d.ts +10 -1
  171. package/widgets/Editor.d.ts +10 -1
  172. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  173. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  174. package/widgets/HistogramRangeSlider.d.ts +2 -2
  175. package/widgets/HistogramRangeSlider.js +1 -1
  176. package/widgets/Legend.d.ts +1 -0
  177. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  178. package/widgets/OrientedImageryViewer.js +2 -2
  179. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  180. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
  181. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  182. package/widgets/ScaleRangeSlider.js +1 -1
  183. package/widgets/Search/LayerSearchSource.d.ts +23 -1
  184. package/widgets/Search/LayerSearchSource.js +1 -1
  185. package/widgets/Search/support/layerSearchUtils.js +1 -1
  186. package/widgets/Search/types.d.ts +7 -0
  187. package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
  188. package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
  189. package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
  190. package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
  191. package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
  192. package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
  193. package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
  194. package/widgets/ValuePicker/types.d.ts +2 -0
  195. package/widgets/support/forms/formUtils.js +1 -1
  196. package/widgets/support/forms/types.d.ts +1 -1
  197. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  198. package/assets/esri/core/workers/chunks/03afeefb9d16b6f1d844.js +0 -1
  199. package/assets/esri/core/workers/chunks/09b9a886363bc1197785.js +0 -1
  200. package/assets/esri/core/workers/chunks/0ad0484ffcbe4ad21bd3.js +0 -1
  201. package/assets/esri/core/workers/chunks/19743dedaa40446259ec.js +0 -1
  202. package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
  203. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  204. package/assets/esri/core/workers/chunks/251921cd10ecfbc89451.js +0 -1
  205. package/assets/esri/core/workers/chunks/3252b1fae363bb0129a0.js +0 -1
  206. package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
  207. package/assets/esri/core/workers/chunks/4fc337240e7cddd0e988.js +0 -1
  208. package/assets/esri/core/workers/chunks/50036a323c2e7f155311.js +0 -1
  209. package/assets/esri/core/workers/chunks/55dcbf296d8d0092e473.js +0 -1
  210. package/assets/esri/core/workers/chunks/5732fdf6d8b87739aeea.js +0 -1
  211. package/assets/esri/core/workers/chunks/5924ec3167a2941ebb1f.js +0 -1
  212. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  213. package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
  214. package/assets/esri/core/workers/chunks/5fa1ec357c3ad1f91bc7.js +0 -1
  215. package/assets/esri/core/workers/chunks/60d3056a31d982c9cad0.js +0 -1
  216. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  217. package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
  218. package/assets/esri/core/workers/chunks/6b43bb78f9839ed43135.js +0 -1
  219. package/assets/esri/core/workers/chunks/6c83398cf586ecea0eb1.js +0 -1
  220. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  221. package/assets/esri/core/workers/chunks/7d1fd2df579a4b535e0e.js +0 -1
  222. package/assets/esri/core/workers/chunks/7e0cf70c0eb5a2ddfcec.js +0 -1
  223. package/assets/esri/core/workers/chunks/879b2de825c1dfc8849d.js +0 -1
  224. package/assets/esri/core/workers/chunks/912080c90b5cc2e817cf.js +0 -1
  225. package/assets/esri/core/workers/chunks/917f53833b853898facc.js +0 -1
  226. package/assets/esri/core/workers/chunks/937824bc7948f7bc7845.js +0 -1
  227. package/assets/esri/core/workers/chunks/a97d85774f9a417202df.js +0 -1
  228. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  229. package/assets/esri/core/workers/chunks/b132ffa7e8bb461b6786.js +0 -1
  230. package/assets/esri/core/workers/chunks/b1b4066e8d1c0c9656e5.js +0 -1
  231. package/assets/esri/core/workers/chunks/b6ba66a05030d3815dfd.js +0 -1
  232. package/assets/esri/core/workers/chunks/bbec9d2e3b75a5c59681.js +0 -1
  233. package/assets/esri/core/workers/chunks/bf69024804ac51c8f733.js +0 -1
  234. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  235. package/assets/esri/core/workers/chunks/db1ab9b9c8bf5c7635d3.js +0 -1
  236. package/assets/esri/core/workers/chunks/e01aeac34474540f61ee.js +0 -1
  237. package/assets/esri/core/workers/chunks/e15ba90af0faf873b42d.js +0 -1
  238. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  239. package/layers/mixins/FeatureLayerReload.js +0 -2
  240. /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{Loadable as n}from"../../core/Loadable.js";import{open as r}from"../../core/workers.js";import{subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./GeospatialPDFFrame.js";import{parse as o}from"./geospatialPDFParserUtils.js";let s=class extends n{constructor(){super(...arguments),this._connection=null,this._workerHandler=null}load(e){let t=r(`GeospatialPDFLayerWorker`,{...e,strategy:`dedicated`,registryTarget:this}).then(e=>{this._connection=e,this._workerHandler=this._connection.createInvokeProxy()});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null,this._workerHandler=null,super.destroy()}async loadPDF(e,n={}){await this.load(n);let{geospatialMetadata:r}=await this._workerHandler.loadPDF(e,n),i=o(r,0),s=i.lgiDictFrame??i.vpFrame;if(!s)throw new t(`geospatial-pdf-layer:load`,`pdf does not contain supported LGIDict or VP/Measure.`);let c=new a(s);return{frame:c,sourceSpatialReference:c.spatialReference.toJSON(),fullExtent:c.toExtent()}}async render(e,t,n,r,i,a){let o={sourceExtentAsJSON:e.toJSON(),width:t,height:n,ctm:r,currentRing:i};return this._workerHandler.renderPDF(o,a)}};s=e([i(`esri.layers.geospatialPDF.GeospatialPDFWorkerClient`)],s);export{s as GeospatialPDFWorkerClient};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{Loadable as n}from"../../core/Loadable.js";import{open as r}from"../../core/workers.js";import{subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./GeospatialPDFFrame.js";import{parse as o}from"./geospatialPDFParserUtils.js";let s=class extends n{constructor(){super(...arguments),this._connection=null,this._workerHandler=null}load(e){let t=r(`GeospatialPDFLayerWorker`,{...e,strategy:`dedicated`,registryTarget:this}).then(e=>{this._connection=e,this._workerHandler=this._connection.createInvokeProxy()});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null,this._workerHandler=null,super.destroy()}async loadPDF(e,n={}){await this.load(n);let{geospatialMetadata:r}=await this._workerHandler.loadPDF(e,n),i=o(r,0),s=i.lgiDictFrame??i.vpFrame;if(!s)throw new t(`geospatial-pdf-layer:load`,`pdf does not contain supported LGIDict or VP/Measure.`);let c=new a(s);return{frame:c,sourceSpatialReference:c.spatialReference.toJSON(),neatlineExtent:c.toExtent()}}async render(e,t,n,r,i,a){let o={sourceExtentAsJSON:e.toJSON(),width:t,height:n,ctm:r,currentRing:i};return this._workerHandler.renderPDF(o,a)}};s=e([i(`esri.layers.geospatialPDF.GeospatialPDFWorkerClient`)],s);export{s as GeospatialPDFWorkerClient};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{fromValues as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{expandMediaBox as r,createGeoreferencer as i,validateTransform as a,affineTransformationFromGeoreference as o}from"./sharedUtils.js";class s{constructor(e){let t=this.inputValidation(e);this._registration=t.registration,this._projection=t.projection,this._neatline=t.neatline,this.pairedNeatline=this._pairNeatline(),this.outerExtentMediaBox=r(t.mediaBox),this.geoControlPoints=this._getRegistrationPoints(`geo`),this.ctm=t.ctm??this._buildCTMFromRegistration(),this.outputValidation()}inputValidation(n){let{ctm:r,registration:i,projection:a,display:o,neatline:s,mediaBox:c}=n;if(r&&r.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict has invalid CTM.`);if(!r&&(!i||i.length<3))throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing CTM and minimum registration points`);if(!c||c.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid MediaBox.`);if(!s||s.length<4||s.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid amount of neatline points`);return{ctm:r?t(r[0],r[1],r[2],r[3],r[4],r[5]):void 0,registration:i??[],projection:a,display:o,neatline:s,mediaBox:c}}outputValidation(){if(this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid CTM`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points.`);if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outerextent from mediaBox.`);if(!this.ctm&&this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints if defaulting.`)}toSpatialReference(){return this._projection}_buildCTMFromRegistration(){let e=[],t=[];for(let r of this._registration)r.length<4||(e.push(n(r[0],r[1])),t.push(n(r[2],r[3])));let r=this._getSourceRect(),s=i(e,t,this.toSpatialReference(),r),c=a(s);return o(c)}_extentFromArray(t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e=0;e<t.length;e++){let o=t[e];n=Math.min(n,o[0]),r=Math.min(r,o[1]),i=Math.max(i,o[0]),a=Math.max(a,o[1])}if(!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))throw new e(`geospatial-pdf-layer: invalid-frame`,`Failed to compute extent from registration.`);return{xmin:n,ymin:r,xmax:i,ymax:a}}_getSourceRect(){if(this.outerExtentMediaBox?.length===4)return this._extentFromArray(this.outerExtentMediaBox);if(this._neatline.length>=6)return this._extentFromArray(this.pairedNeatline);let t=this._getRegistrationPoints(`page`);if(t.length>=2)return this._extentFromArray(t);throw new e(`geospatial-pdf-layer: invalid-frame`,`Cannot build source rectangle from Neatline or Registration points.`)}_getRegistrationPoints(e){let[t,n]=e===`page`?[0,1]:[2,3];return this._registration.filter(e=>e.length>n).map(e=>[e[t],e[n]])}_pairNeatline(){let e=[];for(let t=0;t<this._neatline.length;t+=2){let n=this._neatline[t],r=this._neatline[t+1];Number.isFinite(n)&&Number.isFinite(r)&&e.push([n,r])}return e.length===2&&(e.splice(1,0,[e[1][0],e[0][1]]),e.push([e[0][0],e[2][1]])),e}}export{s as LGIDictMapFrame};
2
+ import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{fromValues as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{expandMediaBox as r,createGeoreferencer as i,validateTransform as a,affineTransformationFromGeoreference as o}from"./sharedUtils.js";class s{constructor(e){let t=this._inputValidation(e);this._registration=t.registration,this._projection=t.projection,this._neatline=t.neatline,this.spatialReference=this._projection,this.pairedNeatline=f(this._neatline),this.outerExtentMediaBox=r(t.mediaBox),this.geoControlPoints=u(`geo`,this._registration),this.ctm=t.ctm??c(this.outerExtentMediaBox,this.pairedNeatline,this._registration,this.spatialReference),this._outputValidation()}_inputValidation(n){let{ctm:r,registration:i,projection:a,display:o,neatline:s,mediaBox:c}=n;if(r&&r.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict has invalid CTM.`);if(!r&&(!i||i.length<3))throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing CTM and minimum registration points`);if(!c||c.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid MediaBox.`);if(!s||s.length<4||s.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid amount of neatline points`);return{ctm:r?t(r[0],r[1],r[2],r[3],r[4],r[5]):void 0,registration:i??[],projection:a,display:o,neatline:s,mediaBox:c}}_outputValidation(){if(this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid CTM`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points.`);if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outerextent from mediaBox.`);if(!this.ctm&&this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints if defaulting.`)}}function c(e,t,r,s){let c=[],l=[];for(let e of r)e.length<4||(c.push(n(e[0],e[1])),l.push(n(e[2],e[3])));let u=d(e,t,r),f=i(c,l,s,u),p=a(f);return o(p)}function l(t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e=0;e<t.length;e++){let o=t[e];n=Math.min(n,o[0]),r=Math.min(r,o[1]),i=Math.max(i,o[0]),a=Math.max(a,o[1])}if(!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))throw new e(`geospatial-pdf-layer: invalid-frame`,`Failed to compute extent from registration.`);return{xmin:n,ymin:r,xmax:i,ymax:a}}function u(e,t){let[n,r]=e===`page`?[0,1]:[2,3];return t.filter(e=>e.length>r).map(e=>[e[n],e[r]])}function d(t,n,r){if(t.length===4)return l(t);if(n.length>=6)return l(n);let i=u(`page`,r);if(i.length>=2)return l(i);throw new e(`geospatial-pdf-layer: invalid-frame`,`Cannot build source rectangle from Neatline or Registration points.`)}function f(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];Number.isFinite(r)&&Number.isFinite(i)&&t.push([r,i])}return t.length===2&&(t.splice(1,0,[t[1][0],t[0][1]]),t.push([t[0][0],t[2][1]])),t}export{s as LGIDictMapFrame,l as extentFromArray,f as pairNeatline};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import n from"../../geometry/Point.js";import r from"../../geometry/SpatialReference.js";import{projectExecute as i}from"../../geometry/operators/projectOperator.js";import{expandMediaBox as a,validateTransform as o,affineTransformationFromGeoreference as s,createGeoreferencer as c}from"./sharedUtils.js";class l{constructor(e){let{bbox:t,bounds:n,gpts:r,lpts:i,gcs:c,mediaBox:l}=this.inputValidation(e);this._bbox=t,this._bounds=n,this._gpts=r,this._lpts=i,this._gcs=c,this.outerExtentMediaBox=a(l),this.geoControlPoints=this._getProjectedGeoControlPoints().map(e=>[e[0],e[1]]);let u=this._getBoundsPolygonPage()??this._getPageControlPoints();this.pairedNeatline=u.map(e=>[e[0],e[1]]),this.neatLine=this.pairedNeatline.flat(),this._georeference=this._createControlPointsGeoreference();let d=o(this._georeference);this.ctm=s(d),this.outputValidation()}toSpatialReference(){let t=this._gcs;if(t?.WKT)return new r({wkt:t.WKT});if(t?.EPSG!=null)return new r({wkid:t.EPSG});throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame missing WKT or EPSG.`)}inputValidation(t){let{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}=t;if(!n||n.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid BBox.`);if(!s||s.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid MediaBox.`);if(!i||i.length<6||i.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid GPTS.`);if(!a||a.length<6||a.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid LPTS.`);if(a.length!==i.length)throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame LPTS and GPTS must be same length`);if(!o?.WKT&&!o?.EPSG)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing a WKT or EPSG code.`);return{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}}outputValidation(){if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outer extent from mediaBox.`);if(this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints.`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points.`);if(!this.ctm||this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`Missing or invalid Map Frame CTM`)}_createControlPointsGeoreference(){let e=this._getPageControlPoints(),t=this._getProjectedGeoControlPoints(),n=this._getViewportRect();return c(e,t,this.toSpatialReference(),n)}_getBoundsPolygonLocal(){if(!this._bounds||this._bounds.length<8||this._bounds.length%2!=0)return null;let e=[];for(let t=0;t<this._bounds.length;t+=2)e.push({u:this._bounds[t],v:this._bounds[t+1]});return e}_getBoundsPolygonPage(){return this._getBoundsPolygonLocal()?.map(e=>this._localToPage(e.u,e.v))??null}_getPageControlPoints(){let e=[];for(let t=0;t<this._lpts.length;t+=2){let n=this._lpts[t],r=this._lpts[t+1];e.push(this._localToPage(n,r))}return e}_getProjectedGeoControlPoints(){let e=this.toSpatialReference(),r=[];for(let a=0;a<this._gpts.length;a+=2){let o=this._gpts[a],s=this._gpts[a+1],c=new n({x:s,y:o}),l=i(c,e);r.push(t(l.x,l.y))}return r}_getViewportRect(){let[e,t,n,r]=this._bbox;return{xmin:Math.min(e,n),ymin:Math.min(t,r),xmax:Math.max(e,n),ymax:Math.max(t,r)}}_localToPage(e,n){let[r,i,a,o]=this._bbox;return t(r+e*(a-r),i+n*(o-i))}}export{l as ViewportMeasureFrame};
2
+ import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import n from"../../geometry/Point.js";import r from"../../geometry/SpatialReference.js";import{projectExecute as i}from"../../geometry/operators/projectOperator.js";import{expandMediaBox as a,validateTransform as o,affineTransformationFromGeoreference as s,createGeoreferencer as c}from"./sharedUtils.js";class l{constructor(e){let{bbox:t,bounds:n,gpts:r,lpts:i,gcs:c,mediaBox:l}=this._inputValidation(e);this._bbox=t,this._bounds=n,this._gpts=r,this._lpts=i,this._gcs=c,this.spatialReference=_(this._gcs),this.outerExtentMediaBox=a(l),this.geoControlPoints=f(this._gpts,this.spatialReference).map(e=>[e[0],e[1]]);let p=u(this._bbox,this._bounds)??d(this._lpts,this._bbox);this.pairedNeatline=p.map(e=>[e[0],e[1]]),this.neatLine=this.pairedNeatline.flat(),this._georeference=m(this._bbox,this._lpts,this._gpts,this.spatialReference);let h=o(this._georeference);this.ctm=s(h),this._outputValidation()}_inputValidation(t){let{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}=t;if(!n||n.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid BBox`);if(!s||s.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid MediaBox`);if(!i||i.length<6||i.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid GPTS`);if(!a||a.length<6||a.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid LPTS`);if(a.length!==i.length)throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame LPTS and GPTS must be same length`);if(!o?.WKT&&!o?.EPSG)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing a WKT or EPSG code`);return{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}}_outputValidation(){if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outer extent from mediaBox`);if(this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points`);if(!this.ctm||this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`Missing or invalid Map Frame CTM`)}}function u(e,t){return h(t)?.map(t=>p(e,t.u,t.v))??null}function d(e,t){let n=[];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];n.push(p(t,i,a))}return n}function f(e,r){let a=[];for(let o=0;o<e.length;o+=2){let s=e[o],c=e[o+1],l=new n({x:c,y:s}),u=i(l,r);a.push(t(u.x,u.y))}return a}function p(e,n,r){let[i,a,o,s]=e;return t(i+n*(o-i),a+r*(s-a))}function m(e,t,n,r){let i=d(t,e),a=f(n,r),o=g(e);return c(i,a,r,o)}function h(e){if(!e||e.length<8||e.length%2!=0)return null;let t=[];for(let n=0;n<e.length;n+=2)t.push({u:e[n],v:e[n+1]});return t}function g(e){let[t,n,r,i]=e;return{xmin:Math.min(t,r),ymin:Math.min(n,i),xmax:Math.max(t,r),ymax:Math.max(n,i)}}function _(t){if(t?.WKT)return new r({wkt:t.WKT});if(t?.EPSG)return new r({wkid:t.EPSG});throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame missing WKT or EPSG.`)}export{l as ViewportMeasureFrame};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../core/Error.js";import"../../core/has.js";import{LGIDictMapFrame as t}from"./LGIDictMapFrame.js";import{projectionToSpatialReference as n}from"./projectionToWKTUtils.js";import{ViewportMeasureFrame as r}from"./ViewportMeasureFrame.js";function i(i,s=0){let c={mediaBox:_(i.MediaBox),rotate:x(i.Rotate),hasLGIDict:i.LGIDict!=null,hasVP:i.VP!=null};if(c.hasVP){let t=o(i.VP,s);if(!t)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse VP frame at index ${s}`);return{result:c,vpFrame:new r({bbox:t.BBox,bounds:t.Measure?.Bounds,gpts:t.Measure?.GPTS,lpts:t.Measure?.LPTS,gcs:t.Measure?.GCS,mediaBox:_(i.MediaBox)})}}if(c.hasLGIDict){let r=a(i.LGIDict,s);if(!r)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse LGI Dict frame at index ${s}`);if(!r.Projection)throw new e(`geospatial-pdf-layer:parse`,`LGIDict map frame missing Projection.`);let o=n(r.Projection),l;try{l=r.Display?n(r.Display):void 0}catch{l=o}return{result:c,lgiDictFrame:new t({ctm:r.CTM,registration:r.Registration,projection:o,display:l,neatline:r.Neatline,mediaBox:_(i.MediaBox)})}}return{result:c}}function a(e,t){return s(e)[t]}function o(e,t){return c(e)[t]}function s(e){return e==null?[]:Array.isArray(e)?e.map(e=>l(e)):[l(e)]}function c(e){return e==null?[]:Array.isArray(e)?e.map(e=>u(e)):[u(e)]}function l(e){let t=C(e,`LGIDict map frame must be an object.`);return{CTM:_(t.CTM),Registration:v(t.Registration),Neatline:_(t.Neatline),Projection:p(t.Projection),Display:p(t.Display)}}function u(e){let t=C(e,`Viewport frame must be an object.`),n=d(t.Measure);return{BBox:_(t.BBox),Measure_Raw:t.Measure,Measure:n,Raw:t}}function d(e){if(S(e))return{Bounds:_(e.Bounds),GPTS:_(e.GPTS),LPTS:_(e.LPTS),GCS:f(e.GCS)}}function f(e){if(S(e))return{WKT:y(e.WKT),EPSG:x(e.EPSG)}}function p(e){if(S(e))return{Type:b(e.Type),Units:b(e.Units),Datum:m(e.Datum),Projection_Type:b(e.ProjectionType),Central_Meridian:x(e.CentralMeridian),False_Easting:x(e.FalseEasting),False_Northing:x(e.FalseNorthing),Height:x(e.Height),Hemisphere:b(e.Hemisphere),Latitude_One:x(e.LatitudeOne),Latitude_Two:x(e.LatitudeTwo),Latitude_Of_True_Scale:x(e.LatitudeOfTrueScale),Longitude_One:x(e.LongitudeOne),Longitude_Two:x(e.LongitudeTwo),Longitude_Down_From_Pole:x(e.LongitudeDownFromPole),Orientation:b(e.Orientation),Origin_Height:x(e.OriginHeight),Origin_Latitude:x(e.OriginLatitude),Origin_Longitude:x(e.OriginLongitude),Scale_Factor:x(e.ScaleFactor),Standard_Parallel:x(e.StandardParallel),Standard_Parallel_One:x(e.StandardParallelOne),Standard_Parallel_Two:x(e.StandardParallelTwo),Zone:x(e.Zone),Description:b(e.Description),raw:e}}function m(e){return e==null?null:typeof e==`string`?{kind:`name`,name:b(e),ellipsoid:null,to_WGS84:null,raw:e}:S(e)?{kind:`definition`,name:b(e.Description),ellipsoid:h(e.Ellipsoid),to_WGS84:g(e.ToWGS84),raw:e}:{kind:`unknown`,name:b(e),ellipsoid:null,to_WGS84:null,raw:e}}function h(e){if(S(e))return{semi_Major_Axis:x(e.SemiMajorAxis),inverse_Flattening:x(e.InvFlattening),semi_Minor_Axis:x(e.SemiMinorAxis),description:b(e.Description)}}function g(e){if(S(e))return{dx:x(e.dx)??0,dy:x(e.dy)??0,dz:x(e.dz)??0,rx:x(e.rx)??0,ry:x(e.ry)??0,rz:x(e.rz)??0,sf:x(e.sf)??0}}function _(e){if(!Array.isArray(e))return;let t=[];for(let n of e){let e=x(n);if(e===void 0)return;t.push(e)}return t}function v(e){if(Array.isArray(e))return e.filter(e=>Array.isArray(e)).map(e=>e.map(e=>x(e)).filter(e=>e!==void 0))}function y(e){if(e!=null)return typeof e==`string`?e:String(e)}function b(e){let t=y(e);if(t!==void 0)return t.trim()}function x(e){if(e==null)return;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`)return;let t=e.trim();if(t===``)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function C(t,n){if(!S(t))throw new e(`geospatial-pdf-layer:parse`,n);return t}export{i as parse};
2
+ import e from"../../core/Error.js";import"../../core/has.js";import{LGIDictMapFrame as t,pairNeatline as n,extentFromArray as r}from"./LGIDictMapFrame.js";import{projectionToSpatialReference as i}from"./projectionToWKTUtils.js";import{ViewportMeasureFrame as a}from"./ViewportMeasureFrame.js";function o(n,r=0){let o={mediaBox:y(n.MediaBox),rotate:C(n.Rotate),hasLGIDict:n.LGIDict!=null,hasVP:n.VP!=null};if(o.hasVP){let t=c(n.VP,r);if(!t)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse VP frame at index ${r}`);return{result:o,vpFrame:new a({bbox:t.BBox,bounds:t.Measure?.Bounds,gpts:t.Measure?.GPTS,lpts:t.Measure?.LPTS,gcs:t.Measure?.GCS,mediaBox:y(n.MediaBox)})}}if(o.hasLGIDict){let a=s(n.LGIDict,r);if(!a)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse LGI Dict frame at index ${r}`);if(!a.Projection)throw new e(`geospatial-pdf-layer:parse`,`LGIDict map frame missing Projection.`);let c=i(a.Projection),l;try{l=a.Display?i(a.Display):void 0}catch{l=c}return{result:o,lgiDictFrame:new t({ctm:a.CTM,registration:a.Registration,projection:c,display:l,neatline:a.Neatline,mediaBox:y(n.MediaBox)})}}return{result:o}}function s(e,t){let n=l(e);try{let e=n[0],t=E(e);for(let r of n){let n=E(r);n>t&&(t=n,e=r)}return e}catch{return n[t]}}function c(e,t){return u(e)[t]}function l(e){return e==null?[]:Array.isArray(e)?e.map(e=>d(e)):[d(e)]}function u(e){return e==null?[]:Array.isArray(e)?e.map(e=>f(e)):[f(e)]}function d(e){let t=T(e,`LGIDict map frame must be an object.`);return{CTM:y(t.CTM),Registration:b(t.Registration),Neatline:y(t.Neatline),Projection:h(t.Projection),Display:h(t.Display)}}function f(e){let t=T(e,`Viewport frame must be an object.`),n=p(t.Measure);return{BBox:y(t.BBox),Measure_Raw:t.Measure,Measure:n,Raw:t}}function p(e){if(w(e))return{Bounds:y(e.Bounds),GPTS:y(e.GPTS),LPTS:y(e.LPTS),GCS:m(e.GCS)}}function m(e){if(w(e))return{WKT:x(e.WKT),EPSG:C(e.EPSG)}}function h(e){if(w(e))return{Type:S(e.Type),Units:S(e.Units),Datum:g(e.Datum),Projection_Type:S(e.ProjectionType),Central_Meridian:C(e.CentralMeridian),False_Easting:C(e.FalseEasting),False_Northing:C(e.FalseNorthing),Height:C(e.Height),Hemisphere:S(e.Hemisphere),Latitude_One:C(e.LatitudeOne),Latitude_Two:C(e.LatitudeTwo),Latitude_Of_True_Scale:C(e.LatitudeOfTrueScale),Longitude_One:C(e.LongitudeOne),Longitude_Two:C(e.LongitudeTwo),Longitude_Down_From_Pole:C(e.LongitudeDownFromPole),Orientation:S(e.Orientation),Origin_Height:C(e.OriginHeight),Origin_Latitude:C(e.OriginLatitude),Origin_Longitude:C(e.OriginLongitude),Scale_Factor:C(e.ScaleFactor),Standard_Parallel:C(e.StandardParallel),Standard_Parallel_One:C(e.StandardParallelOne),Standard_Parallel_Two:C(e.StandardParallelTwo),Zone:C(e.Zone),Description:S(e.Description),raw:e}}function g(e){return e==null?null:typeof e==`string`?{kind:`name`,name:S(e),ellipsoid:null,to_WGS84:null,raw:e}:w(e)?{kind:`definition`,name:S(e.Description),ellipsoid:_(e.Ellipsoid),to_WGS84:v(e.ToWGS84),raw:e}:{kind:`unknown`,name:S(e),ellipsoid:null,to_WGS84:null,raw:e}}function _(e){if(w(e))return{semi_Major_Axis:C(e.SemiMajorAxis),inverse_Flattening:C(e.InvFlattening),semi_Minor_Axis:C(e.SemiMinorAxis),description:S(e.Description)}}function v(e){if(w(e))return{dx:C(e.dx)??0,dy:C(e.dy)??0,dz:C(e.dz)??0,rx:C(e.rx)??0,ry:C(e.ry)??0,rz:C(e.rz)??0,sf:C(e.sf)??0}}function y(e){if(!Array.isArray(e))return;let t=[];for(let n of e){let e=C(n);if(e===void 0)return;t.push(e)}return t}function b(e){if(Array.isArray(e))return e.filter(e=>Array.isArray(e)).map(e=>e.map(e=>C(e)).filter(e=>e!==void 0))}function x(e){if(e!=null)return typeof e==`string`?e:String(e)}function S(e){let t=x(e);if(t!==void 0)return t.trim()}function C(e){if(e==null)return;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`)return;let t=e.trim();if(t===``)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(t,n){if(!w(t))throw new e(`geospatial-pdf-layer:parse`,n);return t}function E(e){let t=e.Neatline;if(!t)return 0;let i=n(t),a=r(i);return(a.xmax-a.xmin)*(a.ymax-a.ymin)}export{o as parse};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{result as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{destroyMaybe as s,removeMaybe as c,abortMaybe as l}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as d,isAbortError as f}from"../../../core/promiseUtils.js";import{initial as p,watch as m,syncAndInitial as h,sync as g}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{projectAsync as x}from"../../../geometry/projectionUtils.js";import{isHostedAgolService as S}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as C}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as w}from"../../support/layerUtils.js";import T from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as E,virtualSnapshotTileId as D,virtualDisplayFilterHighlightTileId as O}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as k}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as A}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as j}from"../../../views/3d/support/debugFlags.js";let M=class extends u(t){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(e!=null&&!e.spatialReference.equals(this.layerView.view.spatialReference)){o.getLogger(this).error(`#extent=`,`extent needs to be in the same spatial reference as the view`);return}let t=this._get(`extent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`extent`,n)}get updating(){return!!(this._tileFetcher?.updating||this._fetchDataInfoPromise!=null||this.mode===`tiles`&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.expectedFeatureDiff:0}get usedMemory(){return this._tileFetcher?.usedMemory??0}get usedMemoryPerFeature(){return this._tileFetcher?.usedMemoryPerFeature??0}get maximumNumberOfFeaturesExceeded(){return!!(this._tileFetcher!=null&&this._tileFetcher.maximumNumberOfFeaturesExceeded)}get snappingComplexityExceeded(){return this._tileFetcher?.snappingComplexityExceeded??!0}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome(`maximumNumberOfFeatures`,e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden(`maximumNumberOfFeatures`)}get hasAllFeatures(){return this.serviceDataCount===I.noServiceDataCount&&this.mode===`snapshot`&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){let e=this.context.effectiveDisplayFilter?.where||null,t=e!=null&&e!==`1=1`;return this.mode===`tiles`&&t?!1:this._tileFetcher?.showsAllFeatures??!1}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){let e=this.layerView.layer;if(e.type===`feature`&&e.infoFor3D!=null)return`snapshot`;if(e.type===`catalog-footprint`||this._forceTilesMode)return`tiles`;let t=this.layerView.view;if(t.qualitySettings?.graphics3D?.snapshotAvailable===!1||this.serviceDataCount===I.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return`tiles`;let n=(t&&t.featureTiles)?.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&n){let t=this._approximateExtentSizeAtScale(e.minScale,n);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>I.maxSnapshotMinScaleFactor)return`tiles`}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?`snapshot`:`tiles`}get maxTotalSnapshotVertices(){let e=this._get(`maxTotalSnapshotVertices`)||0,t=this.mode===`snapshot`&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){let n=this.layerView.view,r=Math.ceil((n.width/t.pixelSize+n.height/t.pixelSize)/2),i=t.levels[0];return r*((i.tileSize[0]/(i.scale/e)+i.tileSize[1]/(i.scale/e))/2)}get tileDescriptors(){if(this.mode===`snapshot`){let e=new E(0,0,0,null,D);return new r([e])}let e=this.layerView.view.featureTiles;if(!e)return new r;let t=e.tiles;if(this.layerView.displayFilterEnabled&&this.layerView.effectiveDisplayFilterClause!=null&&this.layerView.effectiveDisplayFilterClause!==`1=1`&&this.layerView.highlightIds?.length>0){let e=new E(0,0,0,this.layerView.view.featureTiles?.tilingScheme,O);return new r([...t,e])}return t}get test(){}constructor(e){super(e),this.type=`feature-tile-3d`,this._updatingHandles=new b,this.serviceDataExtent=null,this.serviceDataCount=I.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),p),this._updatingHandles.add(()=>this.mode,(e,t)=>{e===`tiles`&&t===`snapshot`&&(this._forceTilesMode=!0)},p),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){let e=this.layerView.layer;if(e.type!==`ogc-feature`&&!w(e)?.operations.supportsQuery)throw new i(`graphicscontroller:query-capability-required`,`Service requires query capabilities to be used as a feature layer`,{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=s(this._tileFetcher),this._tilesHandle=c(this._tilesHandle),this._lifeCycleAbortController=l(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set(`_updatingHandles`,null)}suspend(){this._suspended||(this._suspended=!0,this._tileFetcher!=null&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,this._tileFetcher!=null&&this._tileFetcher.resume())}restart(){let e=()=>{this._tileFetcher!=null&&this._tileFetcher.restart()};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){let t=()=>{this._tileFetcher!=null&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){let e=this.layerView.view;if(!e)return;let{layerView:t,tileDescriptors:n}=this,r=t.layer,i=new k({context:this.context,filterExtent:this.extent,tileDescriptors:n,features:this.graphics});this._tileFetcher=i,this._suspended?i.suspend():i.resume(),e&&this.addHandles(m(()=>e.quality,e=>i.memoryFactor=e,h));let a=this.context.geometryType===`polygon`?`polygonLodFactor`:this.context.geometryType===`polyline`?`polylineLodFactor`:null;a&&this.addHandles(m(()=>this.layerView.view?.qualitySettings?.graphics3D?.[a],e=>i.lodFactor=e||1,p)),r.type!==`ogc-feature`&&this._updatingHandles.add(()=>r.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>this.layerView.effectiveDisplayFilter,()=>this._effectiveDisplayFilterChanged()),this._updatingHandles.add(()=>this.layerView.highlightIds,()=>this._displayFilterHighlightIdsChanged()),this._updatingHandles.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this._updatingHandles.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),`customParameters`in r&&this._updatingHandles.add(()=>r.customParameters,()=>this.restart()),this.addHandles([r.on(`apply-edits`,e=>this._applyEdits(e)),m(()=>this.extent,e=>i.filterExtent=e,g),m(()=>this.tileDescriptors,e=>i.tileDescriptors=e,g),m(()=>this.maximumNumberOfFeatures,e=>{i.maximumNumberOfFeatures=e,i.useTileCount=this.serviceDataCount>e},h),m(()=>this.serviceDataCount,e=>{i.useTileCount=e>this.maximumNumberOfFeatures},h),m(()=>({featureTiles:e.featureTiles,show:j.FEATURE_TILE_FETCH_SHOW_TILES}),({show:t,featureTiles:n})=>{t&&i&&n?i.debugger??=new A(i,n.tilingScheme.toTileInfo(),e):i.debugger=s(i.debugger)},p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}_modeChanged(){switch(this.mode){case`tiles`:this._tilesHandle||=this.layerView.view.enableFeatureTiles();break;default:o.getLogger(this).warn(`Unhandled feature layer mode `+this.mode);case`snapshot`:this._tilesHandle!=null&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set(`maxTotalSnapshotVertices`,0),this.notifyChange(`maxTotalSnapshotVertices`),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){this.mode!==`snapshot`&&this._refetch({resetForceTilesMode:!1})}_displayFilterHighlightIdsChanged(){this.mode!==`snapshot`&&this._tileFetcher!=null&&this._tileFetcher.refetchDisplayFilterHighlightTile()}_applyEdits(e){let t=this.layerView.layer;this._tileFetcher!=null&&this._tileFetcher.applyEdits(e).then(e=>{if(e){if(!this._lifeCycleAbortController)throw d();e.exceededTransferLimit&&`refresh`in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.consumePromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(e=>{if(!f(e))throw e})}_availableFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){let t=this.layerView.layer,n=t.createQuery();return n.returnGeometry=!1,n.outStatistics=[new T({statisticType:`exceedslimit`,maxVertexCount:e,outStatisticFieldName:`exceedslimit`,maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),n}_createDataInfoQuery(){let e=this.layerView.layer,t=this.layerView,n=e.createQuery();return n.returnGeometry=!1,n.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),t.effectiveDisplayFilter&&(n.where=_(n.where,t.effectiveDisplayFilter.where)),n}_fullExtentIsAccurate(){let e=this.layerView.layer;if(`definitionExpression`in e&&e.definitionExpression)return!1;switch(e.type){case`feature`:case`catalog-footprint`:case`oriented-imagery`:return S(e.url);case`csv`:case`geojson`:case`ogc-feature`:case`wfs`:return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(e){f(e)||this._set(`serviceDataExtent`,a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){let t=this.layerView,n=t.layer,r=n.capabilities?.query.supportsExtent??!1,i=a(t.fullExtentInLocalViewSpatialReference),o=n.fullExtent,s=this._fullExtentIsAccurate(),c=this.serviceDataCount;if(r&&c<=I.maxFeatureCountForExtent&&(!i||!s)&&`queryExtent`in n){let t=this._createDataInfoQuery(),r=await n.queryExtent(t,{timeout:I.queryExtentTimeout,signal:e});this._set(`serviceDataExtent`,r.extent)}else if(i)this._set(`serviceDataExtent`,i);else if(o!=null){let e=o.spatialReference?await x(o,t.view.spatialReference):null;this._set(`serviceDataExtent`,e??null)}else this._set(`serviceDataExtent`,null)}async _updateServiceDataCount(e){let t=this.layerView.layer;if(!(`queryFeatureCount`in t)||!has(`featurelayer-snapshot-enabled`)){this._set(`serviceDataCount`,I.noServiceDataCount);return}let r=await n(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:I.queryStatisticsTimeout,signal:e}));if(r.ok===!0)this._set(`serviceDataCount`,r.value);else{if(f(r.error))throw r.error;this._set(`serviceDataCount`,I.noServiceDataCount)}}get _supportsExceedsLimitQuery(){let e=this.layerView.layer;return e.capabilities!=null&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case`point`:return 1;case`multipoint`:return 1;case`polygon`:return 4;case`polyline`:return 2;case`multipatch`:case`mesh`:return 3;case null:case void 0:return 0;default:return 0}}async _updateSnapshotLimit(e,t,r){if(e?.averageSymbolComplexity==null){this._snapshotLimitExceeded=!1;return}let{maximumTotalNumberOfVertices:i,averageSymbolComplexity:a}=e,{verticesPerFeature:o,verticesPerCoordinate:s}=a,c=o<=0,l=this._minimumNumberOfVerticesForGeometry>1;if(!c&&!l){this._snapshotLimitExceeded=!1;return}o!==0&&t!=null&&await t;let u=Math.min(i,N),d=this.serviceDataCount,p=d!==I.noServiceDataCount,m=Math.ceil(p?(u-d*o)/(s||1):u/(s||1));if(l&&(m=Math.min(m,P)),p&&this._minimumNumberOfVerticesForGeometry*d>m){this._snapshotLimitExceeded=!0;return}if(!this._supportsExceedsLimitQuery||!has(`featurelayer-snapshot-enabled`)){this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m;return}let h=await n(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:I.queryStatisticsTimeout,signal:r}));if(h.ok===!1){if(f(h.error))throw h.error;this._snapshotLimitExceeded=!1;return}let g=h.value.features[0];this._snapshotLimitExceeded=g?.attributes?!!g.attributes.exceedslimit:!1}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await C(this.layerView.layer);let e=new AbortController,t=e.signal,n=this._updateServiceDataCount(t),r=Promise.allSettled([n,this._updateSnapshotLimit(this.displayFeatureLimit,n,t)]),i=r.then(()=>this._updateServiceDataExtent(t)).catch(e=>{f(e)||o.getLogger(this).error(`#fetchServiceDataInfo()`,e)}).then(()=>{i===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=i),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){let e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([v({readOnly:!0})],M.prototype,`type`,void 0),e([v({constructOnly:!0})],M.prototype,`graphics`,void 0),e([v({constructOnly:!0})],M.prototype,`layerView`,void 0),e([v({constructOnly:!0})],M.prototype,`context`,void 0),e([v({readOnly:!0})],M.prototype,`dataUpdating`,null),e([v()],M.prototype,`extent`,null),e([v()],M.prototype,`updating`,null),e([v({readOnly:!0})],M.prototype,`_updatingHandles`,void 0),e([v()],M.prototype,`updatingTotal`,null),e([v()],M.prototype,`updatingRemaining`,null),e([v()],M.prototype,`expectedFeatureDiff`,null),e([v()],M.prototype,`usedMemory`,null),e([v()],M.prototype,`usedMemoryPerFeature`,null),e([v()],M.prototype,`maximumNumberOfFeaturesExceeded`,null),e([v()],M.prototype,`snappingComplexityExceeded`,null),e([v({readOnly:!0})],M.prototype,`serviceDataExtent`,void 0),e([v({readOnly:!0})],M.prototype,`serviceDataCount`,void 0),e([v()],M.prototype,`_snapshotLimitExceeded`,void 0),e([v()],M.prototype,`displayFeatureLimit`,void 0),e([v({type:Number})],M.prototype,`maximumNumberOfFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeaturesInView`,null),e([v({readOnly:!0})],M.prototype,`hasFullGeometries`,null),e([v()],M.prototype,`_forceTilesMode`,void 0),e([v({readOnly:!0})],M.prototype,`mode`,null),e([v({readOnly:!0})],M.prototype,`maxTotalSnapshotVertices`,null),e([v({readOnly:!0})],M.prototype,`tileDescriptors`,null),e([v()],M.prototype,`_tileFetcher`,void 0),e([v()],M.prototype,`_fetchDataInfoPromise`,void 0),M=e([y(`esri.layers.graphics.controllers.FeatureTileController3D`)],M);const N=1e6,P=5e6;function F(e,t){if(!t)return!1;for(let n of t)if(!e.has(n))return!0;return!1}class I{static{this.noServiceDataCount=1/0}static{this.maxSnapshotMinScaleFactor=5}static reset(){I.maxFeatureCountForExtent=1e4,I.queryStatisticsTimeout=12e3,I.queryExtentTimeout=1e4}}I.reset();export{M as FeatureTileController3D,I as FeatureTileController3DConstants};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{result as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{destroyMaybe as s,removeMaybe as c,abortMaybe as l}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as d,isAbortError as f}from"../../../core/promiseUtils.js";import{initial as p,watch as m,syncAndInitial as h,sync as g}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{projectAsync as x}from"../../../geometry/projectionUtils.js";import{isHostedAgolService as S}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as C}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as w}from"../../support/layerUtils.js";import T from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as E,virtualSnapshotTileId as D,virtualDisplayFilterHighlightTileId as O}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as k}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as A}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as j}from"../../../views/3d/support/debugFlags.js";let M=class extends u(t){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(e!=null&&!e.spatialReference.equals(this.layerView.view.spatialReference)){o.getLogger(this).error(`#extent=`,`extent needs to be in the same spatial reference as the view`);return}let t=this._get(`extent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`extent`,n)}get updating(){return!!(this._tileFetcher?.updating||this._fetchDataInfoPromise!=null||this.mode===`tiles`&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.expectedFeatureDiff:0}get usedMemory(){return this._tileFetcher?.usedMemory??0}get usedMemoryPerFeature(){return this._tileFetcher?.usedMemoryPerFeature??0}get maximumNumberOfFeaturesExceeded(){return!!(this._tileFetcher!=null&&this._tileFetcher.maximumNumberOfFeaturesExceeded)}get snappingComplexityExceeded(){return this._tileFetcher?.snappingComplexityExceeded??!0}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome(`maximumNumberOfFeatures`,e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden(`maximumNumberOfFeatures`)}get hasAllFeatures(){return this.serviceDataCount===I.noServiceDataCount&&this.mode===`snapshot`&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){let e=this.context.effectiveDisplayFilter?.where||null,t=e!=null&&e!==`1=1`;return this.mode===`tiles`&&t?!1:this._tileFetcher?.showsAllFeatures??!1}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){let e=this.layerView.layer;if(e.type===`feature`&&e.infoFor3D!=null)return`snapshot`;if(e.type===`catalog-footprint`||this._forceTilesMode)return`tiles`;let t=this.layerView.view;if(t.qualitySettings?.graphics3D?.snapshotAvailable===!1||this.serviceDataCount===I.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return`tiles`;let n=(t&&t.featureTiles)?.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&n){let t=this._approximateExtentSizeAtScale(e.minScale,n);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>I.maxSnapshotMinScaleFactor)return`tiles`}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?`snapshot`:`tiles`}get maxTotalSnapshotVertices(){let e=this._get(`maxTotalSnapshotVertices`)||0,t=this.mode===`snapshot`&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){let n=this.layerView.view,r=Math.ceil((n.width/t.pixelSize+n.height/t.pixelSize)/2),i=t.levels[0];return r*((i.tileSize[0]/(i.scale/e)+i.tileSize[1]/(i.scale/e))/2)}get tileDescriptors(){if(this.mode===`snapshot`){let e=new E(0,0,0,null,D);return new r([e])}let e=this.layerView.view.featureTiles;if(!e)return new r;let t=e.tiles;if(this.layerView.displayFilterEnabled&&this.layerView.effectiveDisplayFilterClause!=null&&this.layerView.effectiveDisplayFilterClause!==`1=1`&&this.layerView.highlightIds?.length>0){let e=new E(0,0,0,this.layerView.view.featureTiles?.tilingScheme,O);return new r([...t,e])}return t}get test(){}constructor(e){super(e),this.type=`feature-tile-3d`,this._updatingHandles=new b,this.serviceDataExtent=null,this.serviceDataCount=I.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),p),this._updatingHandles.add(()=>this.mode,(e,t)=>{e===`tiles`&&t===`snapshot`&&(this._forceTilesMode=!0)},p),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){let e=this.layerView.layer;if(e.type!==`ogc-feature`&&!w(e)?.operations.supportsQuery)throw new i(`graphicscontroller:query-capability-required`,`Service requires query capabilities to be used as a feature layer`,{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=s(this._tileFetcher),this._tilesHandle=c(this._tilesHandle),this._lifeCycleAbortController=l(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set(`_updatingHandles`,null)}suspend(){this._suspended||(this._suspended=!0,this._tileFetcher!=null&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,this._tileFetcher!=null&&this._tileFetcher.resume())}restart(){let e=()=>{this._tileFetcher!=null&&this._tileFetcher.restart()};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){let t=()=>{this._tileFetcher!=null&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){let e=this.layerView.view;if(!e)return;let{layerView:t,tileDescriptors:n}=this,r=t.layer,i=new k({context:this.context,filterExtent:this.extent,tileDescriptors:n,features:this.graphics});this._tileFetcher=i,this._suspended?i.suspend():i.resume(),e&&this.addHandles(m(()=>e.quality,e=>i.memoryFactor=e,h));let a=this.context.geometryType===`polygon`?`polygonLodFactor`:this.context.geometryType===`polyline`?`polylineLodFactor`:null;a&&this.addHandles(m(()=>this.layerView.view?.qualitySettings?.graphics3D?.[a],e=>i.lodFactor=e||1,p)),r.type!==`ogc-feature`&&this._updatingHandles.add(()=>r.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>this.layerView.effectiveDisplayFilter,()=>this._effectiveDisplayFilterChanged()),this._updatingHandles.add(()=>this.layerView.highlightIds,()=>this._displayFilterHighlightIdsChanged()),this._updatingHandles.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this._updatingHandles.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),`customParameters`in r&&this._updatingHandles.add(()=>r.customParameters,()=>this.restart()),this.addHandles([r.on(`apply-edits`,e=>this._applyEdits(e)),m(()=>this.extent,e=>i.filterExtent=e,g),m(()=>this.tileDescriptors,e=>i.tileDescriptors=e,g),m(()=>this.maximumNumberOfFeatures,e=>{i.maximumNumberOfFeatures=e,i.useTileCount=this.serviceDataCount>e},h),m(()=>this.serviceDataCount,e=>{i.useTileCount=e>this.maximumNumberOfFeatures},h),m(()=>({featureTiles:e.featureTiles,show:j.FEATURE_TILE_FETCH_SHOW_TILES}),({show:t,featureTiles:n})=>{t&&i&&n?i.debugger??=new A(i,n.tilingScheme.toTileInfo(),e):i.debugger=s(i.debugger)},p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}_modeChanged(){switch(this.mode){case`tiles`:this._tilesHandle||=this.layerView.view.enableFeatureTiles();break;default:o.getLogger(this).warn(`Unhandled feature layer mode `+this.mode);case`snapshot`:this._tilesHandle!=null&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set(`maxTotalSnapshotVertices`,0),this.notifyChange(`maxTotalSnapshotVertices`),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){this.mode!==`snapshot`&&this._refetch({resetForceTilesMode:!1})}_displayFilterHighlightIdsChanged(){this.mode!==`snapshot`&&this._tileFetcher!=null&&this._tileFetcher.refetchDisplayFilterHighlightTile()}_applyEdits(e){let t=this.layerView.layer;this._tileFetcher!=null&&this._tileFetcher.applyEdits(e).then(e=>{if(e){if(!this._lifeCycleAbortController)throw d();e.exceededTransferLimit&&`refresh`in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.consumePromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(e=>{if(!f(e))throw e})}_availableFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){let t=this.layerView.layer,n=t.createQuery();return n.returnGeometry=!1,n.outStatistics=[new T({statisticType:`exceedslimit`,maxVertexCount:e,outStatisticFieldName:`exceedslimit`,maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),n}_createDataInfoQuery(){let e=this.layerView.layer,t=this.layerView,n=e.createQuery();return n.returnGeometry=!1,n.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),t.effectiveDisplayFilter&&(n.where=_(n.where,t.effectiveDisplayFilter.where)),n}_fullExtentIsAccurate(){let e=this.layerView.layer;if(`definitionExpression`in e&&e.definitionExpression)return!1;switch(e.type){case`feature`:case`catalog-footprint`:case`oriented-imagery`:return S(e.url);case`csv`:case`geojson`:case`ogc-feature`:case`wfs`:return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(e){f(e)||this._set(`serviceDataExtent`,a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){let t=this.layerView,n=t.layer,r=n.capabilities?.query.supportsExtent??!1,i=a(t.fullExtentInLocalViewSpatialReference),o=n.fullExtent,s=this._fullExtentIsAccurate(),c=this.serviceDataCount;if(r&&c<=I.maxFeatureCountForExtent&&(!i||!s)&&`queryExtent`in n){let t=this._createDataInfoQuery(),r=await n.queryExtent(t,{timeout:I.queryExtentTimeout,signal:e});this._set(`serviceDataExtent`,r.extent)}else if(i)this._set(`serviceDataExtent`,i);else if(o!=null){let e=o.spatialReference?await x(o,t.view.spatialReference):null;this._set(`serviceDataExtent`,e??null)}else this._set(`serviceDataExtent`,null)}async _updateServiceDataCount(e){let t=this.layerView.layer;if(!(`queryFeatureCount`in t)||!has(`featurelayer-snapshot-enabled`)){this._set(`serviceDataCount`,I.noServiceDataCount);return}let r=await n(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:I.queryStatisticsTimeout,signal:e}));if(r.ok===!0)this._set(`serviceDataCount`,r.value);else{if(f(r.error))throw r.error;this._set(`serviceDataCount`,I.noServiceDataCount)}}get _supportsExceedsLimitQuery(){let e=this.layerView.layer;return e.capabilities!=null&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case`point`:return 1;case`multipoint`:return 1;case`polygon`:return 4;case`polyline`:return 2;case`multipatch`:case`mesh`:return 3;case null:case void 0:return 0;default:return 0}}async _updateSnapshotLimit(e,t,r){if(e?.averageSymbolComplexity==null){this._snapshotLimitExceeded=!1;return}let{maximumTotalNumberOfVertices:i,averageSymbolComplexity:a}=e,{verticesPerFeature:o,verticesPerCoordinate:s}=a,c=o<=0,l=this._minimumNumberOfVerticesForGeometry>1;if(!c&&!l){this._snapshotLimitExceeded=!1;return}o!==0&&t!=null&&await t;let u=Math.min(i,N),d=this.serviceDataCount,p=d!==I.noServiceDataCount,m=Math.ceil(p?(u-d*o)/(s||1):u/(s||1));if(l&&(m=Math.min(m,P)),p&&this._minimumNumberOfVerticesForGeometry*d>m){this._snapshotLimitExceeded=!0;return}if(!this._supportsExceedsLimitQuery||!has(`featurelayer-snapshot-enabled`)){this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m;return}let h=await n(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:I.queryStatisticsTimeout,signal:r}));if(h.ok===!1){if(f(h.error))throw h.error;this._snapshotLimitExceeded=!1;return}let g=h.value.features[0];this._snapshotLimitExceeded=g?.attributes?!!g.attributes.exceedslimit:!1}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await C(this.layerView.layer);let e=new AbortController,t=e.signal,n=this._updateServiceDataCount(t),r=Promise.allSettled([n,this._updateSnapshotLimit(this.displayFeatureLimit,n,t)]),i=r.then(()=>this._updateServiceDataExtent(t)).catch(e=>{f(e)||o.getLogger(this).error(`#fetchServiceDataInfo()`,e)}).then(()=>{i===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=i),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){let e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([v({readOnly:!0})],M.prototype,`type`,void 0),e([v({constructOnly:!0})],M.prototype,`graphics`,void 0),e([v({constructOnly:!0})],M.prototype,`layerView`,void 0),e([v({constructOnly:!0})],M.prototype,`context`,void 0),e([v({readOnly:!0})],M.prototype,`dataUpdating`,null),e([v()],M.prototype,`extent`,null),e([v()],M.prototype,`updating`,null),e([v({readOnly:!0})],M.prototype,`_updatingHandles`,void 0),e([v()],M.prototype,`updatingTotal`,null),e([v()],M.prototype,`updatingRemaining`,null),e([v()],M.prototype,`expectedFeatureDiff`,null),e([v()],M.prototype,`usedMemory`,null),e([v()],M.prototype,`usedMemoryPerFeature`,null),e([v()],M.prototype,`maximumNumberOfFeaturesExceeded`,null),e([v()],M.prototype,`snappingComplexityExceeded`,null),e([v({readOnly:!0})],M.prototype,`serviceDataExtent`,void 0),e([v({readOnly:!0})],M.prototype,`serviceDataCount`,void 0),e([v()],M.prototype,`_snapshotLimitExceeded`,void 0),e([v()],M.prototype,`displayFeatureLimit`,void 0),e([v({type:Number})],M.prototype,`maximumNumberOfFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeaturesInView`,null),e([v({readOnly:!0})],M.prototype,`hasFullGeometries`,null),e([v()],M.prototype,`_forceTilesMode`,void 0),e([v({readOnly:!0})],M.prototype,`mode`,null),e([v({readOnly:!0})],M.prototype,`maxTotalSnapshotVertices`,null),e([v({readOnly:!0})],M.prototype,`tileDescriptors`,null),e([v()],M.prototype,`_tileFetcher`,void 0),e([v()],M.prototype,`_fetchDataInfoPromise`,void 0),M=e([y(`esri.layers.graphics.controllers.FeatureTileController3D`)],M);const N=has(`esri-tests-maximum-vertices-for-snapshot`)??1e6,P=5e6;function F(e,t){if(!t)return!1;for(let n of t)if(!e.has(n))return!0;return!1}class I{static{this.noServiceDataCount=1/0}static{this.maxSnapshotMinScaleFactor=5}static reset(){I.maxFeatureCountForExtent=1e4,I.queryStatisticsTimeout=12e3,I.queryExtentTimeout=1e4}}I.reset();export{M as FeatureTileController3D,I as FeatureTileController3DConstants};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{Loadable as n}from"../../../core/Loadable.js";import r from"../../../core/Logger.js";import{debounce as i}from"../../../core/promiseUtils.js";import{open as a}from"../../../core/workers.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import c from"../../../geometry/Extent.js";import l from"../../../geometry/Polygon.js";import{featureGeometryTypeKebabDictionary as u}from"../../../geometry/support/typeUtils.js";import{createCapabilities as d}from"./support/clientSideDefaults.js";import f from"../../../rest/support/FeatureSet.js";let p=class extends n{constructor(){super(...arguments),this.type=`geojson`,this.refresh=i(async e=>{await this.load();let{extent:t,timeExtent:n}=await this._connection.invoke(`refresh`,e);return this.sourceJSON.extent=t,n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t)).then(e=>f.fromJSON(e))}queryFeaturesJSON(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t))}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatureCount`,e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryObjectIds`,e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryExtent`,e?e.toJSON():null,t)).then(e=>({count:e.count,extent:c.fromJSON(e.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke(`querySnapping`,e,t))}async queryAttributeBins(e,t={}){return await this.load(),this._connection.invoke(`queryAttributeBins`,e?.toJSON(),t)}_applyEdits(e){if(!this._connection)throw new t(`geojson-layer-source:edit-failure`,`Memory source not loaded`);let n=this.layer.objectIdField,r=[],i=[],a=[];if(e.addFeatures)for(let t of e.addFeatures)r.push(this._serializeFeature(t));if(e.deleteFeatures)for(let t of e.deleteFeatures)`objectId`in t&&t.objectId!=null?i.push(t.objectId):`attributes`in t&&t.attributes[n]!=null&&i.push(t.attributes[n]);if(e.updateFeatures)for(let t of e.updateFeatures)a.push(this._serializeFeature(t));return this._connection.invoke(`applyEdits`,{adds:r,updates:a,deletes:i}).then(({extent:e,timeExtent:t,featureEditResults:n})=>(this.sourceJSON.extent=e,t&&(this.sourceJSON.timeInfo.timeExtent=[t.start,t.end]),this._createEditsResult(n)))}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){let n=e.success===!0?null:e.error||{code:void 0,description:``};return{objectId:e.objectId,globalId:e.globalId,error:n?new t(`geojson-layer-source:edit-failure`,n.description,{code:n.code}):null}}_serializeFeature(e){let{attributes:t}=e,n=this._geometryForSerialization(e);return n?{geometry:n.toJSON(),attributes:t}:{attributes:t}}_geometryForSerialization(e){let{geometry:t}=e;return t==null?null:t.type===`mesh`||t.type===`extent`?l.fromExtent(t.extent):t}async _startWorker(e){this._connection=await a(`GeoJSONSourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{fields:t,spatialReference:n,hasZ:i,geometryType:o,objectIdField:s,url:c,timeInfo:l,customParameters:f}=this.layer,p=this.layer.originOf(`spatialReference`)===`defaults`,m={url:c,customParameters:f,fields:t&&t.map(e=>e.toJSON()),geometryType:u.toJSON(o),hasZ:i,objectIdField:s,timeInfo:l?l.toJSON():null,spatialReference:p?null:n&&n.toJSON()},h=await this._connection.invoke(`load`,m,{signal:e});for(let e of h.warnings)r.getLogger(this.layer).warn(`#load()`,`${e.message} (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{warning:e});h.featureErrors.length&&r.getLogger(this.layer).warn(`#load()`,`Encountered ${h.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{errors:h.featureErrors}),this.sourceJSON=h.layerDefinition,this.capabilities=d(this.sourceJSON.hasZ,!0)}};e([o()],p.prototype,`capabilities`,void 0),e([o()],p.prototype,`type`,void 0),e([o({constructOnly:!0})],p.prototype,`layer`,void 0),e([o()],p.prototype,`sourceJSON`,void 0),p=e([s(`esri.layers.graphics.sources.GeoJSONSource`)],p);export{p as GeoJSONSource};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{Loadable as n}from"../../../core/Loadable.js";import r from"../../../core/Logger.js";import{debounce as i}from"../../../core/promiseUtils.js";import{open as a}from"../../../core/workers.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import c from"../../../geometry/Extent.js";import l from"../../../geometry/Polygon.js";import{featureGeometryTypeKebabDictionary as u}from"../../../geometry/support/typeUtils.js";import{createCapabilities as d}from"./support/clientSideDefaults.js";import f from"../../../rest/support/FeatureSet.js";let p=class extends n{constructor(){super(...arguments),this.type=`geojson`,this.refresh=i(async e=>{await this.load();let{extent:t,timeExtent:n}=await this._connection.invoke(`refresh`,e);return this.sourceJSON.extent=t,n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t)).then(e=>f.fromJSON(e))}queryFeaturesJSON(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t))}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatureCount`,e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryObjectIds`,e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryExtent`,e?e.toJSON():null,t)).then(e=>({count:e.count,extent:c.fromJSON(e.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke(`querySnapping`,e,t))}async queryAttributeBins(e,t={}){return await this.load(),this._connection.invoke(`queryAttributeBins`,e?.toJSON(),t)}_applyEdits(e){if(!this._connection)throw new t(`geojson-layer-source:edit-failure`,`Memory source not loaded`);let n=this.layer.objectIdField,r=[],i=[],a=[];if(e.addFeatures)for(let t of e.addFeatures)r.push(this._serializeFeature(t));if(e.deleteFeatures)for(let t of e.deleteFeatures)`objectId`in t&&t.objectId!=null?i.push(t.objectId):`attributes`in t&&t.attributes[n]!=null&&i.push(t.attributes[n]);if(e.updateFeatures)for(let t of e.updateFeatures)a.push(this._serializeFeature(t));return this._connection.invoke(`applyEdits`,{adds:r,updates:a,deletes:i}).then(({extent:e,timeExtent:t,featureEditResults:n})=>(this.sourceJSON.extent=e,t&&(this.sourceJSON.timeInfo.timeExtent=[t.start,t.end]),this._createEditsResult(n)))}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){let n=e.success===!0?null:e.error||{code:void 0,description:``};return{objectId:e.objectId,globalId:e.globalId,error:n?new t(`geojson-layer-source:edit-failure`,n.description,{code:n.code}):null}}_serializeFeature(e){let{attributes:t}=e,n=this._geometryForSerialization(e);return n?{geometry:n.toJSON(),attributes:t}:{attributes:t}}_geometryForSerialization(e){let{geometry:t}=e;return t==null?null:t.type===`mesh`||t.type===`extent`?l.fromExtent(t.extent):t}async _startWorker(e){this._connection=await a(`GeoJSONSourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{fields:t,spatialReference:n,hasZ:i,geometryType:o,objectIdField:s,url:c,timeInfo:l,customParameters:f}=this.layer,p=this.layer.originOf(`spatialReference`)===`defaults`,m={url:c,customParameters:f,fields:t&&t.map(e=>e.toJSON()),geometryType:u.toJSON(o),hasZ:i,objectIdField:s,timeInfo:l?l.toJSON():null,spatialReference:p?null:n&&n.toJSON()},h=await this._connection.invoke(`load`,m,{signal:e});for(let e of h.warnings)r.getLogger(this.layer).warn(`#load()`,`${e.message} (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{warning:e});h.featureErrors.length&&r.getLogger(this.layer).warn(`#load()`,`Encountered ${h.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{errors:h.featureErrors}),this.sourceJSON=h.layerDefinition,this.capabilities=d(this.sourceJSON.hasZ,!0,!this.sourceJSON.geometryType)}};e([o()],p.prototype,`capabilities`,void 0),e([o()],p.prototype,`type`,void 0),e([o({constructOnly:!0})],p.prototype,`layer`,void 0),e([o()],p.prototype,`sourceJSON`,void 0),p=e([s(`esri.layers.graphics.sources.GeoJSONSource`)],p);export{p as GeoJSONSource};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../request.js";import{createTask as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{getJsonType as a}from"../../../../geometry/support/jsonTypeUtils.js";import{wgs84 as o,equals as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as c,convertToGeometry as l,convertFromFeatures as u,convertToFeature as d,convertFromFeature as f}from"../../featureConversionUtils.js";import p from"../../data/FeatureStore.js";import{checkProjectionSupport as m,project as h}from"../../data/projectionSupport.js";import{QueryEngine as g}from"../../data/QueryEngine.js";import{inferLayerProperties as _,createOptimizedFeatures as v,validateGeoJSON as y}from"./geojson.js";import{createDefaultTemplate as b,createDefaultAttributesFunction as x,createDrawingInfo as S}from"../support/clientSideDefaults.js";import{queryBinsCapabilities as C,loadGeometryEngineForSimplify as w,mixAttributes as T,createFeatureEditSuccessResult as E,createFeatureEditErrorResult as D,simplify as O}from"../support/sourceUtils.js";import k from"../../../support/FieldsIndex.js";import{kebabDict as A}from"../../../support/fieldType.js";import{getFieldDefaultValue as j,getFieldDefaultLength as M}from"../../../support/fieldUtils.js";import{utc as N}from"../../../../time/constants.js";const P={hasAttachments:!1,capabilities:`query, editing, create, delete, update`,useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsQueryAttachmentsCountOnly:!1,supportsQueryAttachmentOrderByFields:!1,supportsQueryAttachmentWithTypeWildcard:!1,supportsQueryBins:!0,supportsQueryPivot:!1,supportsQueryWithCacheHint:!0,supportsQueryWithDistance:!0,supportsOutDistance:!1,supportsQueryWithResultType:!0,supportsSpatialAggregationStatistics:!0,supportedSpatialAggregationStatistics:[`EnvelopeAggregate`,`CentroidAggregate`,`ConvexHullAggregate`],supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0},queryBinsCapabilities:C};class F{constructor(){this._featureIdInfo=null,this._queryEngine=null,this._snapshotFeatures=async e=>{let t=await this._fetch(e);return this._createFeatures(t)}}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e,t={}){this._loadOptions={url:e.url,customParameters:e.customParameters};let r=[],[i]=await Promise.all([e.url?this._fetch(t?.signal):null,this._checkProjection(e.spatialReference)]),a=_(i,{geometryType:e.geometryType}),s=e.fields||a.fields||[],c=e.hasZ==null?a.hasZ:e.hasZ,l=a.geometryType,u=e.objectIdField||a.objectIdFieldName||`__OBJECTID`,d=e.spatialReference||o,f=e.timeInfo;s===a.fields&&a.unknownFields.length>0&&r.push({name:`geojson-layer:unknown-field-types`,message:`Some fields types couldn't be inferred from the features and were dropped`,details:{unknownFields:a.unknownFields}});let m=new k(s),h=m.dateFields.length>0,v=m.get(u);v?(v.type!==`esriFieldTypeString`&&(v.type=`esriFieldTypeOID`),v.editable=!1,v.nullable=!1,u=v.name):(v={alias:u,name:u,type:a.objectIdFieldType===`string`?`esriFieldTypeString`:`esriFieldTypeOID`,editable:!1,nullable:!1},s.unshift(v));let y={};for(let e of s){if(e.name??=e.alias,e.alias??=e.name,!e.name)throw new n(`geojson-layer:invalid-field-name`,`field name is missing`,{field:e});if(!A.jsonValues.includes(e.type))throw new n(`geojson-layer:invalid-field-type`,`invalid type for field "${e.name}"`,{field:e});if(e.name!==v.name){let t=j(e);t!==void 0&&(y[e.name]=t)}e.length??=M(e)}if(f){if(f.startTimeField){let e=m.get(f.startTimeField);e?(f.startTimeField=e.name,e.type=`esriFieldTypeDate`,h=!0):f.startTimeField=null}if(f.endTimeField){let e=m.get(f.endTimeField);e?(f.endTimeField=e.name,e.type=`esriFieldTypeDate`,h=!0):f.endTimeField=null}if(f.trackIdField){let e=m.get(f.trackIdField);e?f.trackIdField=e.name:(f.trackIdField=null,r.push({name:`geojson-layer:invalid-timeInfo-trackIdField`,message:`trackIdField is missing`,details:{timeInfo:f}}))}!f.startTimeField&&!f.endTimeField&&(r.push({name:`geojson-layer:invalid-timeInfo`,message:`startTimeField and endTimeField are missing`,details:{timeInfo:f}}),f=null)}let C=l?S(l):void 0,w=h?{timeZoneIANA:N}:null,T={warnings:r,featureErrors:[],layerDefinition:{...P,drawingInfo:C??void 0,templates:b(y),extent:void 0,geometryType:l,objectIdField:u,fields:s,hasZ:!!c,timeInfo:f,dateFieldsTimeReference:w}};this._featureIdInfo={type:`object-id`,fieldName:u},this._queryEngine=new g({fieldsIndex:k.fromLayerJSON({fields:s,timeInfo:f,dateFieldsTimeReference:w}),geometryType:l,hasM:!1,hasZ:c,featureIdInfo:this._featureIdInfo,spatialReference:d,timeInfo:f,featureStore:new p({geometryType:l,hasM:!1,hasZ:c})});let E=this._queryEngine.fieldsIndex.requiredFields.indexOf(v);E>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(E,1),this._createDefaultAttributes=x(y,u);let D=this._createFeatures(i);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,D);let O=this._normalizeFeatures(D,T.featureErrors);this._queryEngine.featureStore.addMany(O);let{fullExtent:F,timeExtent:I}=await this._queryEngine.fetchRecomputedExtents();if(T.layerDefinition.extent=F,I){let{start:e,end:t}=I;T.layerDefinition.timeInfo.timeExtent=[e,t]}return T}async applyEdits(e){let{spatialReference:t,geometryType:n}=this._queryEngine;return await Promise.all([w(t,n),m(e.adds,t),m(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),await this._queryEngine.executeQueryForSnapping(e,t.signal)}async queryAttributeBins(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeAttributeBinsQuery(e,t.signal)}async refresh(e){this._loadOptions.customParameters=e,this._snapshotTask?.abort(),this._snapshotTask=t(this._snapshotFeatures),this._snapshotTask.promise.then(e=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,e);let t=this._normalizeFeatures(e);t&&this._queryEngine.featureStore.addMany(t)},e=>{this._queryEngine.featureStore.clear(),i(e)||r.getLogger(`esri.layers.GeoJSONLayer`).error(new n(`geojson-layer:refresh`,`An error occurred during refresh`,{error:e}))}),await this._waitSnapshotComplete();let{fullExtent:a,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:a,timeExtent:o}}_createFeatures(e){if(e==null)return[];let{geometryType:t,hasZ:n}=this._queryEngine,r=this._featureIdInfo.fieldName,i=v(e,{geometryType:t,hasZ:n,objectIdField:r});if(!s(this._queryEngine.spatialReference,o))for(let e of i)e.geometry!=null&&(e.geometry=c(h(l(e.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),o,this._queryEngine.spatialReference)));return i}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(t){let{url:n,customParameters:r}=this._loadOptions,i=(await e(n??``,{responseType:`json`,query:{...r},signal:t})).data;return y(i),i}_normalizeFeatures(e,t){let{fieldsIndex:n}=this._queryEngine,r=[],i=this._featureIdInfo.fieldName;for(let a of e){let e=this._createDefaultAttributes(),o=T(n,e,a.attributes,!0);o?t?.push(o):(this._assignObjectId(e,a.attributes,!0),a.attributes=e,a.objectId=e[i],r.push(a))}return r}async _applyEdits(e){let{adds:t,updates:n,deletes:r}=e,i={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(i,t),n?.length&&this._applyUpdateEdits(i,n),r?.length){for(let e of r)i.deleteResults.push(E(e));this._queryEngine.featureStore.removeManyById(r)}let{fullExtent:a,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:a,timeExtent:o,featureEditResults:i}}_applyAddEdits(e,t){let{addResults:n}=e,{geometryType:r,hasM:i,hasZ:o,spatialReference:s,featureStore:c,fieldsIndex:l}=this._queryEngine,d=this._featureIdInfo.fieldName,f=[];for(let i of t){if(i.geometry&&r!==a(i.geometry)){n.push(D(`Incorrect geometry type.`));continue}let t=this._createDefaultAttributes(),o=T(l,t,i.attributes);if(o){n.push(o);continue}if(this._assignObjectId(t,i.attributes),i.attributes=t,i.uid!=null){let t=i.attributes[d];e.uidToObjectId[i.uid]=t}if(i.geometry!=null){let e=i.geometry.spatialReference??s;i.geometry=h(O(i.geometry,e),e,s)}f.push(i),n.push(E(i.attributes[d]))}c.addMany(u([],f,r,o,i,this._featureIdInfo))}_applyUpdateEdits({updateResults:e},t){let{geometryType:n,hasM:r,hasZ:i,spatialReference:o,featureStore:s,fieldsIndex:c}=this._queryEngine,l=this._featureIdInfo.fieldName;for(let u of t){let{attributes:t,geometry:p}=u,m=t?.[l];if(m==null){e.push(D(`Identifier field ${l} missing`));continue}if(!s.has(m)){e.push(D(`Feature with object id ${m} missing`));continue}let g=d(s.getFeature(m),n,i,r);if(p!=null){if(n!==a(p)){e.push(D(`Incorrect geometry type.`));continue}let t=p.spatialReference??o;g.geometry=h(O(p,t),t,o)}if(t){let n=T(c,g.attributes,t);if(n){e.push(n);continue}}s.add(f(g,n,i,r,this._featureIdInfo)),e.push(E(m))}}_createObjectIdGenerator(e,t){let n=this._featureIdInfo.fieldName,r=e.fieldsIndex.get(n);if(r.type===`esriFieldTypeString`)return()=>r.name+`-`+Date.now().toString(16);let i=-1/0;for(let e of t)e.objectId&&(i=Math.max(i,e.objectId));return i=Math.max(0,i)+1,()=>i++}_assignObjectId(e,t,n=!1){let r=this._featureIdInfo.fieldName;e[r]=!n||!(r in t)?this._objectIdGenerator():t[r]}async _checkProjection(e){try{await m(o,e)}catch{throw new n(`geojson-layer`,`Projection not supported`)}}}export{F as default};
2
+ import e from"../../../../request.js";import{createTask as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{getJsonType as a}from"../../../../geometry/support/jsonTypeUtils.js";import{wgs84 as o,equals as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as c,convertToGeometry as l,convertFromFeatures as u,convertToFeature as d,convertFromFeature as f}from"../../featureConversionUtils.js";import p from"../../data/FeatureStore.js";import{checkProjectionSupport as m,project as h}from"../../data/projectionSupport.js";import{QueryEngine as g}from"../../data/QueryEngine.js";import{inferLayerProperties as _,createOptimizedFeatures as v,validateGeoJSON as y}from"./geojson.js";import{createDefaultTemplate as b,createDefaultAttributesFunction as x,createDrawingInfo as S}from"../support/clientSideDefaults.js";import{tableCapabilities as C,layerCapabilities as w,loadGeometryEngineForSimplify as T,mixAttributes as E,createFeatureEditSuccessResult as D,createFeatureEditErrorResult as O,simplify as k}from"../support/sourceUtils.js";import A from"../../../support/FieldsIndex.js";import{kebabDict as j}from"../../../support/fieldType.js";import{getFieldDefaultValue as M,getFieldDefaultLength as N}from"../../../support/fieldUtils.js";import{utc as P}from"../../../../time/constants.js";class F{constructor(){this._featureIdInfo=null,this._queryEngine=null,this._snapshotFeatures=async e=>{let t=await this._fetch(e);return this._createFeatures(t)}}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e,t={}){this._loadOptions={url:e.url,customParameters:e.customParameters};let r=[],[i]=await Promise.all([e.url?this._fetch(t?.signal):null,this._checkProjection(e.spatialReference)]),a=_(i,{geometryType:e.geometryType}),s=e.fields||a.fields||[],c=e.hasZ==null?a.hasZ:e.hasZ,l=a.geometryType,u=!l,d=e.objectIdField||a.objectIdFieldName||`__OBJECTID`,f=e.spatialReference||o,m=e.timeInfo;s===a.fields&&a.unknownFields.length>0&&r.push({name:`geojson-layer:unknown-field-types`,message:`Some fields types couldn't be inferred from the features and were dropped`,details:{unknownFields:a.unknownFields}});let h=new A(s),v=h.dateFields.length>0,y=h.get(d);y?(y.type!==`esriFieldTypeString`&&(y.type=`esriFieldTypeOID`),y.editable=!1,y.nullable=!1,d=y.name):(y={alias:d,name:d,type:a.objectIdFieldType===`string`?`esriFieldTypeString`:`esriFieldTypeOID`,editable:!1,nullable:!1},s.unshift(y));let T={};for(let e of s){if(e.name??=e.alias,e.alias??=e.name,!e.name)throw new n(`geojson-layer:invalid-field-name`,`field name is missing`,{field:e});if(!j.jsonValues.includes(e.type))throw new n(`geojson-layer:invalid-field-type`,`invalid type for field "${e.name}"`,{field:e});if(e.name!==y.name){let t=M(e);t!==void 0&&(T[e.name]=t)}e.length??=N(e)}if(m){if(m.startTimeField){let e=h.get(m.startTimeField);e?(m.startTimeField=e.name,e.type=`esriFieldTypeDate`,v=!0):m.startTimeField=null}if(m.endTimeField){let e=h.get(m.endTimeField);e?(m.endTimeField=e.name,e.type=`esriFieldTypeDate`,v=!0):m.endTimeField=null}if(m.trackIdField){let e=h.get(m.trackIdField);e?m.trackIdField=e.name:(m.trackIdField=null,r.push({name:`geojson-layer:invalid-timeInfo-trackIdField`,message:`trackIdField is missing`,details:{timeInfo:m}}))}!m.startTimeField&&!m.endTimeField&&(r.push({name:`geojson-layer:invalid-timeInfo`,message:`startTimeField and endTimeField are missing`,details:{timeInfo:m}}),m=null)}let E=l?S(l):void 0,D=v?{timeZoneIANA:P}:null,O={warnings:r,featureErrors:[],layerDefinition:{...u?C:w,drawingInfo:E??void 0,templates:b(T),extent:void 0,geometryType:l,objectIdField:d,fields:s,hasZ:!!c,timeInfo:m,dateFieldsTimeReference:D}};this._featureIdInfo={type:`object-id`,fieldName:d},this._queryEngine=new g({fieldsIndex:A.fromLayerJSON({fields:s,timeInfo:m,dateFieldsTimeReference:D}),geometryType:l,hasM:!1,hasZ:c,featureIdInfo:this._featureIdInfo,spatialReference:f,timeInfo:m,featureStore:new p({geometryType:l,hasM:!1,hasZ:c})});let k=this._queryEngine.fieldsIndex.requiredFields.indexOf(y);k>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(k,1),this._createDefaultAttributes=x(T,d);let F=this._createFeatures(i);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,F);let I=this._normalizeFeatures(F,O.featureErrors);this._queryEngine.featureStore.addMany(I);let{fullExtent:L,timeExtent:R}=await this._queryEngine.fetchRecomputedExtents();if(O.layerDefinition.extent=L,R){let{start:e,end:t}=R;O.layerDefinition.timeInfo.timeExtent=[e,t]}return O}async applyEdits(e){let{spatialReference:t,geometryType:n}=this._queryEngine;return await Promise.all([T(t,n),m(e.adds,t),m(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),await this._queryEngine.executeQueryForSnapping(e,t.signal)}async queryAttributeBins(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeAttributeBinsQuery(e,t.signal)}async refresh(e){this._loadOptions.customParameters=e,this._snapshotTask?.abort(),this._snapshotTask=t(this._snapshotFeatures),this._snapshotTask.promise.then(e=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,e);let t=this._normalizeFeatures(e);t&&this._queryEngine.featureStore.addMany(t)},e=>{this._queryEngine.featureStore.clear(),i(e)||r.getLogger(`esri.layers.GeoJSONLayer`).error(new n(`geojson-layer:refresh`,`An error occurred during refresh`,{error:e}))}),await this._waitSnapshotComplete();let{fullExtent:a,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:a,timeExtent:o}}_createFeatures(e){if(e==null)return[];let{geometryType:t,hasZ:n}=this._queryEngine,r=this._featureIdInfo.fieldName,i=v(e,{geometryType:t,hasZ:n,objectIdField:r});if(!s(this._queryEngine.spatialReference,o))for(let e of i)e.geometry!=null&&(e.geometry=c(h(l(e.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),o,this._queryEngine.spatialReference)));return i}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(t){let{url:n,customParameters:r}=this._loadOptions,i=(await e(n??``,{responseType:`json`,query:{...r},signal:t})).data;return y(i),i}_normalizeFeatures(e,t){let{fieldsIndex:n}=this._queryEngine,r=[],i=this._featureIdInfo.fieldName;for(let a of e){let e=this._createDefaultAttributes(),o=E(n,e,a.attributes,!0);o?t?.push(o):(this._assignObjectId(e,a.attributes,!0),a.attributes=e,a.objectId=e[i],r.push(a))}return r}async _applyEdits(e){let{adds:t,updates:n,deletes:r}=e,i={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(i,t),n?.length&&this._applyUpdateEdits(i,n),r?.length){for(let e of r)i.deleteResults.push(D(e));this._queryEngine.featureStore.removeManyById(r)}let{fullExtent:a,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:a,timeExtent:o,featureEditResults:i}}_applyAddEdits(e,t){let{addResults:n}=e,{geometryType:r,hasM:i,hasZ:o,spatialReference:s,featureStore:c,fieldsIndex:l}=this._queryEngine,d=this._featureIdInfo.fieldName,f=[];for(let i of t){if(i.geometry&&r!==a(i.geometry)){n.push(O(`Incorrect geometry type.`));continue}let t=this._createDefaultAttributes(),o=E(l,t,i.attributes);if(o){n.push(o);continue}if(this._assignObjectId(t,i.attributes),i.attributes=t,i.uid!=null){let t=i.attributes[d];e.uidToObjectId[i.uid]=t}if(i.geometry!=null){let e=i.geometry.spatialReference??s;i.geometry=h(k(i.geometry,e),e,s)}f.push(i),n.push(D(i.attributes[d]))}c.addMany(u([],f,r,o,i,this._featureIdInfo))}_applyUpdateEdits({updateResults:e},t){let{geometryType:n,hasM:r,hasZ:i,spatialReference:o,featureStore:s,fieldsIndex:c}=this._queryEngine,l=this._featureIdInfo.fieldName;for(let u of t){let{attributes:t,geometry:p}=u,m=t?.[l];if(m==null){e.push(O(`Identifier field ${l} missing`));continue}if(!s.has(m)){e.push(O(`Feature with object id ${m} missing`));continue}let g=d(s.getFeature(m),n,i,r);if(p!=null){if(n!==a(p)){e.push(O(`Incorrect geometry type.`));continue}let t=p.spatialReference??o;g.geometry=h(k(p,t),t,o)}if(t){let n=E(c,g.attributes,t);if(n){e.push(n);continue}}s.add(f(g,n,i,r,this._featureIdInfo)),e.push(D(m))}}_createObjectIdGenerator(e,t){let n=this._featureIdInfo.fieldName,r=e.fieldsIndex.get(n);if(r.type===`esriFieldTypeString`)return()=>r.name+`-`+Date.now().toString(16);let i=-1/0;for(let e of t)e.objectId&&(i=Math.max(i,e.objectId));return i=Math.max(0,i)+1,()=>i++}_assignObjectId(e,t,n=!1){let r=this._featureIdInfo.fieldName;e[r]=!n||!(r in t)?this._objectIdGenerator():t[r]}async _checkProjection(e){try{await m(o,e)}catch{throw new n(`geojson-layer`,`Projection not supported`)}}}export{F as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../request.js";import r from"../../../../core/Error.js";import{EventEmitter as i}from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{QueueProcessor as a}from"../../../../core/QueueProcessor.js";import{isBlobProtocol as o}from"../../../../core/urlUtils.js";import{createParquetFile as s,readMetadata as c}from"../../../parquet.js";import{ParquetFileInfo as l}from"./ParquetFileInfo.js";import{parseFileStatisticsMap as u}from"./ParquetFileStatistics.js";const d=`_spatial.json`,f=new a({concurrency:12,process:async e=>{let{data:t}=await n(e.url,e.options);return t}});let p=1;class m{constructor(e,t=()=>{}){this._geometryInfo=e,this._getCustomParameters=t,this.events=new i}async destroy(){await this.clear()}async clear(){if(this._infos){let e=await this._infos;for(let t of e.values())t.destroy();e.clear(),this._infos=null}}async getMetadata(){let n={stack:[],error:void 0,hasError:!1};try{let t=(await this._getParquetFileNames()).at(0);if(!t)return null;let r=e(n,await s(t,{provider:this}),!1);return c(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){let e=await this._getInfoMap();return Array.from(e.values())}async updateGeometryInfo(e){if(this._geometryInfo)throw Error(`GeometryInfo already set`);await this.clear(),this._geometryInfo=e}async fetchLength(e){let{byteLength:t,cacheTag:n}=await this._fetchLengthAndTag(e);if(!has(`parquetlayer-cache-enabled`))return t;try{await this._createOrResetCache(e,n)}catch{}return t}async fetchRange(e,t,n,r){let i={fileId:e,requestId:p++,range:{start:t,end:n+1}};this.events.emit(`rangeRead`,{...i,phase:`start`});try{let a=await this._fetchRangeWithCache(e,t,n,r);return this.events.emit(`rangeRead`,{...i,phase:`complete`}),a}catch(e){throw this.events.emit(`rangeRead`,{...i,phase:`error`}),e}}_getCacheFileName(e){return e}async _requestStatistics(e){let{data:t}=await n(e,{responseType:`json`,query:this._getCustomParameters()});return t}async _fetchRange(e,t,n,i){let a={url:e,options:{responseType:`array-buffer`,query:this._getCustomParameters()??{},cacheMode:`no-store`,useQueue:!0,headers:{range:`bytes=${t}-${n}`}}},o=await f.push(a),s=n-t+1;if(o.byteLength!==s)throw new r(`InvalidRangeRequest`,`request returned ${o.byteLength} bytes for range ${t}-${n}, expected ${s}.`);return o}async _fetchLengthAndTag(e){if(o(e)){let{data:t}=await n(e,{responseType:`blob`});return{byteLength:t.size,cacheTag:null}}let t=await this._requestHead(e),r=t.headers.get(`Content-Length`);if(r==null)throw Error(`Unable to parse content length`);let i=t.headers.get(`etag`)??t.headers.get(`Last-Modified`);return{byteLength:parseInt(r,10),cacheTag:i}}async _getInfoMap(){return this._infos||=this._fetchParquetFiles(),this._infos}async _updateParquetFileInfos(e){let t=await this._getInfoMap(),n=new Set(e);for(let e of n)if(!t.get(e)){let n=t.size,r=await l.create(this.getGeometryInfo(),this,e,n,null);t.set(e,r)}for(let e of t.keys())if(!n.has(e))throw Error(`Deletion not supported`)}async _getFileStatistics(e){this._statistics||=this._fetchStatistics();let t=await this._statistics,n=g(e);return t.get(n)}async _fetchParquetFiles(){let e=(await this._getParquetFileNames()).map(async(e,t)=>{let n=t,r=await this._getFileStatistics(e);return l.create(this.getGeometryInfo(),this,e,n,r)}),t=await Promise.all(e),n=new Map;for(let e of t)n.set(e.url,e);return n}async _fetchStatistics(){let e=await this._getStatisticsFileName();if(e==null)return new Map;let t=await this._resolveFileUrl(e),n=await this._requestStatistics(t);return u(n)}async _requestHead(e){let{data:t}=await n(e,{responseType:`native`,method:`head`,query:this._getCustomParameters()});return t}async _openCache(e){return caches.open(this._getCacheName(e))}async _fetchRangeWithCache(e,t,n,r){if(!has(`parquetlayer-cache-enabled`))return this._fetchRange(e,t,n,r);let i=new URL(this._getCacheFileName(e));i.searchParams.append(`range`,`${t}-${n}`);try{let a=await this._openCache(e),o=await a.match(i);if(o)return await o.arrayBuffer();let s=await this._fetchRange(e,t,n,r);return await a.put(i,new Response(s,{headers:{"Content-Type":`application/octet-stream`,"Content-Length":s.byteLength.toString()}})),s}catch{return this._fetchRange(e,t,n,r)}}_getCacheName(e){return`parquet.v1:${this._getCacheFileName(e)}`}async _createOrResetCache(e,t){let n=this._getCacheName(e),r=new URL(this._getCacheFileName(e));if(r.searchParams.append(`metadata`,`true`),t==null){await caches.delete(n);return}let i=await caches.open(n);(await(await i.match(r))?.json())?.tag!==t&&(await caches.delete(n),i=await caches.open(n));let a=JSON.stringify({tag:t});await i.put(r,new Response(a,{headers:{"Content-Type":`application/json`,"Content-Length":a.length.toString()}}))}}function h(e){let t=e.split(/[?#]/)[0];return t===d||t.endsWith(d)}function g(e){return e.split(/[?#]/)[0].split(`/`).at(-1)??e}export{m as FileProvider,h as isStatisticsFileName,d as spatialFileName};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../request.js";import r from"../../../../core/Error.js";import{EventEmitter as i}from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{QueueProcessor as a}from"../../../../core/QueueProcessor.js";import{isBlobProtocol as o}from"../../../../core/urlUtils.js";import{createParquetFile as s,readMetadata as c}from"../../../parquet.js";import{ParquetFileInfo as l}from"./ParquetFileInfo.js";import{parseFileStatisticsMap as u}from"./ParquetFileStatistics.js";const d=`_spatial.json`,f=new a({concurrency:12,process:async e=>{let{data:t}=await n(e.url,e.options);return t}});let p=1;class m{constructor(e,t=()=>{}){this._geometryInfo=e,this._getCustomParameters=t,this.events=new i}async destroy(){await this.clear()}async clear(){if(this._infos){let e=await this._infos;for(let t of e.values())t.destroy();e.clear(),this._infos=null}}async getMetadata(){let n={stack:[],error:void 0,hasError:!1};try{let t=(await this._getParquetFileNames()).at(0);if(!t)return null;let r=e(n,await s(t,{provider:this}),!1);return c(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){let e=await this._getInfoMap();return Array.from(e.values())}async updateGeometryInfo(e){if(this._geometryInfo)throw Error(`GeometryInfo already set`);await this.clear(),this._geometryInfo=e}async fetchLength(e){let{byteLength:t,cacheTag:n}=await this._fetchLengthAndTag(e);if(!has(`parquetlayer-cache-enabled`))return t;try{await this._createOrResetCache(e,n)}catch{}return t}async fetchRange(e,t,n,r){let i={fileId:e,requestId:p++,range:{start:t,end:n+1}};this.events.emit(`rangeRead`,{...i,phase:`start`});try{let a=await this._fetchRangeWithCache(e,t,n,r);return this.events.emit(`rangeRead`,{...i,phase:`complete`}),a}catch(e){throw this.events.emit(`rangeRead`,{...i,phase:`error`}),e}}_getCacheFileName(e){return e}async _requestStatistics(e){let{data:t}=await n(e,{responseType:`json`,maxUrlLength:0,query:this._getCustomParameters()});return t}async _fetchRange(e,t,n,i){let a={url:e,options:{responseType:`array-buffer`,query:this._getCustomParameters()??{},cacheMode:`no-store`,maxUrlLength:0,useQueue:!0,headers:{range:`bytes=${t}-${n}`}}},o=await f.push(a),s=n-t+1;if(o.byteLength!==s)throw new r(`InvalidRangeRequest`,`request returned ${o.byteLength} bytes for range ${t}-${n}, expected ${s}.`);return o}async _fetchLengthAndTag(e){if(o(e)){let{data:t}=await n(e,{responseType:`blob`});return{byteLength:t.size,cacheTag:null}}let t=await this._requestHead(e),r=t.headers.get(`Content-Length`);if(r==null)throw Error(`Unable to parse content length`);let i=t.headers.get(`etag`)??t.headers.get(`Last-Modified`);return{byteLength:parseInt(r,10),cacheTag:i}}async _getInfoMap(){return this._infos||=this._fetchParquetFiles(),this._infos}async _updateParquetFileInfos(e){let t=await this._getInfoMap(),n=new Set(e);for(let e of n)if(!t.get(e)){let n=t.size,r=await l.create(this.getGeometryInfo(),this,e,n,null);t.set(e,r)}for(let e of t.keys())if(!n.has(e))throw Error(`Deletion not supported`)}async _getFileStatistics(e){this._statistics||=this._fetchStatistics();let t=await this._statistics,n=g(e);return t.get(n)}async _fetchParquetFiles(){let e=(await this._getParquetFileNames()).map(async(e,t)=>{let n=t,r=await this._getFileStatistics(e);return l.create(this.getGeometryInfo(),this,e,n,r)}),t=await Promise.all(e),n=new Map;for(let e of t)n.set(e.url,e);return n}async _fetchStatistics(){let e=await this._getStatisticsFileName();if(e==null)return new Map;let t=await this._resolveFileUrl(e),n=await this._requestStatistics(t);return u(n)}async _requestHead(e){let{data:t}=await n(e,{responseType:`native`,method:`head`,maxUrlLength:0,query:this._getCustomParameters()});return t}async _openCache(e){return caches.open(this._getCacheName(e))}async _fetchRangeWithCache(e,t,n,r){if(!has(`parquetlayer-cache-enabled`))return this._fetchRange(e,t,n,r);let i=new URL(this._getCacheFileName(e));i.searchParams.append(`range`,`${t}-${n}`);try{let a=await this._openCache(e),o=await a.match(i);if(o)return await o.arrayBuffer();let s=await this._fetchRange(e,t,n,r);return await a.put(i,new Response(s,{headers:{"Content-Type":`application/octet-stream`,"Content-Length":s.byteLength.toString()}})),s}catch{return this._fetchRange(e,t,n,r)}}_getCacheName(e){return`parquet.v1:${this._getCacheFileName(e)}`}async _createOrResetCache(e,t){let n=this._getCacheName(e),r=new URL(this._getCacheFileName(e));if(r.searchParams.append(`metadata`,`true`),t==null){await caches.delete(n);return}let i=await caches.open(n);(await(await i.match(r))?.json())?.tag!==t&&(await caches.delete(n),i=await caches.open(n));let a=JSON.stringify({tag:t});await i.put(r,new Response(a,{headers:{"Content-Type":`application/json`,"Content-Length":a.length.toString()}}))}}function h(e){let t=e.split(/[?#]/)[0];return t===d||t.endsWith(d)}function g(e){return e.split(/[?#]/)[0].split(`/`).at(-1)??e}export{m as FileProvider,h as isStatisticsFileName,d as spatialFileName};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{remove as e}from"../../../../core/arrayUtils.js";import t from"../../../../core/Error.js";import{getJsonType as n,isPoint as r}from"../../../../geometry/support/jsonTypeUtils.js";import{wgs84 as i}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatures as a,convertToFeature as o,convertFromFeature as s}from"../../featureConversionUtils.js";import{initialObjectId as c,findLastObjectIdFromFeatures as l}from"../../objectIdUtils.js";import u from"../../data/FeatureStore.js";import{checkProjectionSupport as d,project as f}from"../../data/projectionSupport.js";import{QueryEngine as p}from"../../data/QueryEngine.js";import{createDefaultAttributesFunction as m,createDefaultTemplate as h,createDrawingInfo as g}from"./clientSideDefaults.js";import{queryBinsCapabilities as _,loadGeometryEngineForSimplify as v,createFeatureEditErrorResult as y,mixAttributes as b,createFeatureEditSuccessResult as x,simplify as S}from"./sourceUtils.js";import C from"../../../support/FieldsIndex.js";import{kebabDict as w}from"../../../support/fieldType.js";import{getFieldDefaultLength as T,getFieldDefaultValue as E}from"../../../support/fieldUtils.js";import{utc as D}from"../../../../time/constants.js";const O=i,k={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:i},A={hasAttachments:!1,capabilities:`query, editing, create, delete, update`,useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsQueryAttachmentsCountOnly:!1,supportsQueryAttachmentOrderByFields:!1,supportsQueryAttachmentWithTypeWildcard:!1,supportsQueryBins:!0,supportsQueryPivot:!1,supportsSpatialAggregationStatistics:!0,supportedSpatialAggregationStatistics:[`EnvelopeAggregate`,`CentroidAggregate`,`ConvexHullAggregate`],supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsOutDistance:!1,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0,supportsQueryWithCacheHint:!0},queryBinsCapabilities:_};function j(e){return r(e)?e.z!=null:!!e.hasZ}function M(e){return r(e)?e.m!=null:!!e.hasM}function N(e,t){let n,r=[];if(t.type===`unique-id-composite`){let i=[];for(let n of t.fieldNames)e.attributes[n]?i.push(e.attributes[n]):r.push(n);n=r.length===0?JSON.stringify(i):null}else n=e.attributes[t.fieldName],n||r.push(t.fieldName);return{objectId:n,missingFields:r}}class P{constructor(){this._uniqueIdInfo=null,this._queryEngine=null,this._nextObjectId=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e){let n=[],{features:r}=e,i=this._inferLayerProperties(r,e.fields),a=e.fields||[],o=e.hasM==null?!!i.hasM:e.hasM,s=e.hasZ==null?!!i.hasZ:e.hasZ,f=!e.spatialReference&&!i.spatialReference,_=f?O:e.spatialReference||i.spatialReference,v=f?k:null,y=e.geometryType||i.geometryType,b=!y,x=e.uniqueIdInfo,S=e.objectIdField??i.objectIdField,j=e.timeInfo,M=new C(a);if(!b&&(f&&n.push({name:`feature-layer:spatial-reference-not-found`,message:`Spatial reference not provided or found in features. Defaults to WGS84`}),!y))throw new t(`feature-layer:missing-property`,`geometryType not set and couldn't be inferred from the provided features`);if(x){let e=new Set(a.map(({name:e})=>e));if(!x.fields.every(t=>e.has(t))){let n=x.fields.filter(t=>!e.has(t));throw new t(`feature-layer:missing-property`,`UniqueIdFields not set and couldn't be found in the provided fields. Fields: `+n+` are mssing.`)}S=null}else if(!S)throw new t(`feature-layer:missing-property`,`objectIdField not set and uniqueIdInfo not provided.`);if(i.objectIdField&&S!==i.objectIdField&&(n.push({name:`feature-layer:duplicated-oid-field`,message:`Provided objectIdField "${S}" doesn't match the field name "${i.objectIdField}", found in the provided fields`}),S=i.objectIdField),S&&!i.objectIdField){let e=M.get(S);e?(S=e.name,e.type=`esriFieldTypeOID`,e.editable=!1,e.nullable=!1):a.unshift({alias:S,name:S,type:`esriFieldTypeOID`,editable:!1,nullable:!1})}for(let e of a){if(e.name??=e.alias,e.alias??=e.name,!e.name)throw new t(`feature-layer:invalid-field-name`,`field name is missing`,{field:e});if(e.name===S&&(e.type=`esriFieldTypeOID`),!w.jsonValues.includes(e.type))throw new t(`feature-layer:invalid-field-type`,`invalid type for field "${e.name}"`,{field:e});e.length??=T(e)}let N={};for(let e of a)if(e.type!==`esriFieldTypeOID`&&e.type!==`esriFieldTypeGlobalID`){let t=E(e);t!==void 0&&(N[e.name]=t)}if(j){if(j.startTimeField){let e=M.get(j.startTimeField);e?(j.startTimeField=e.name,e.type=`esriFieldTypeDate`):j.startTimeField=null}if(j.endTimeField){let e=M.get(j.endTimeField);e?(j.endTimeField=e.name,e.type=`esriFieldTypeDate`):j.endTimeField=null}if(j.trackIdField){let e=M.get(j.trackIdField);e?j.trackIdField=e.name:(j.trackIdField=null,n.push({name:`feature-layer:invalid-timeInfo-trackIdField`,message:`trackIdField is missing`,details:{timeInfo:j}}))}!j.startTimeField&&!j.endTimeField&&(n.push({name:`feature-layer:invalid-timeInfo`,message:`startTimeField and endTimeField are missing or invalid`,details:{timeInfo:j}}),j=null)}let P=M.dateFields.length?{timeZoneIANA:e.dateFieldsTimeZone??D}:null;this._createDefaultAttributes=m(N,S),this._uniqueIdInfo=e.uniqueIdInfo??void 0;let F={warnings:n,featureErrors:[],layerDefinition:{...A,drawingInfo:g(y),templates:h(N),extent:v,geometryType:y,objectIdField:S,fields:a,hasZ:s,hasM:o,timeInfo:j,dateFieldsTimeReference:P,uniqueIdInfo:this._uniqueIdInfo??void 0},assignedObjectIds:{}},I=this._uniqueIdInfo?.OIDFieldContainsHashValue?this._uniqueIdInfo.type===`simple`?{type:`unique-id-simple`,fieldName:this._uniqueIdInfo.fields[0]}:{type:`unique-id-composite`,fieldNames:this._uniqueIdInfo.fields}:{type:`object-id`,fieldName:S};if(this._queryEngine=new p({fieldsIndex:C.fromLayerJSON({fields:a,timeInfo:j,dateFieldsTimeReference:P}),geometryType:y,hasM:o,hasZ:s,featureIdInfo:I,spatialReference:_,featureStore:new u({geometryType:y,hasM:o,hasZ:s}),timeInfo:j}),!r?.length)return this._nextObjectId=c,F;if(S){let e=l(S,r);this._nextObjectId=e+1}return await d(r,_),this._loadInitialFeatures(F,r)}async applyEdits(e){let{spatialReference:t,geometryType:n}=this._queryEngine;return await Promise.all([v(t,n),d(e.adds,t),d(e.updates,t)]),this._applyEdits(e)}queryFeatures(e,t={}){return this._queryEngine.executeQuery(e,t.signal)}queryFeatureCount(e,t={}){return this._queryEngine.executeQueryForCount(e,t.signal)}queryObjectIds(e,t={}){return this._queryEngine.executeQueryForIds(e,t.signal)}queryExtent(e,t={}){return this._queryEngine.executeQueryForExtent(e,t.signal)}querySnapping(e,t={}){return this._queryEngine.executeQueryForSnapping(e,t.signal)}queryAttributeBins(e,t={}){return this._queryEngine.executeAttributeBinsQuery(e,t.signal)}_inferLayerProperties(e,t){let r,i,a=null,o=null,s=null;for(let t of e){let e=t.geometry;if(e!=null&&(a||=n(e),o||=e.spatialReference,r??=j(e),i??=M(e),a&&o&&r!=null&&i!=null))break}if(t&&t.length){let e=null;t.some(t=>{let n=t.type===`esriFieldTypeOID`,r=!t.type&&t.name&&t.name.toLowerCase()===`objectid`;return e=t,n||r})&&(s=e.name)}return{geometryType:a,spatialReference:o,objectIdField:s,hasM:i,hasZ:r}}async _loadInitialFeatures(e,t){let{geometryType:r,hasM:i,hasZ:o,spatialReference:s,featureStore:c,fieldsIndex:l,featureIdInfo:u}=this._queryEngine,d=[];for(let i of t){if(i.uid!=null&&(e.assignedObjectIds[i.uid]=-1),i.geometry&&r!==n(i.geometry)){e.featureErrors.push(y(`Incorrect geometry type.`));continue}let t=this._createDefaultAttributes(),a=b(l,t,i.attributes,!0);if(a){e.featureErrors.push(a);continue}this._assignObjectId(t,i.attributes,!0),i.attributes=t,i.uid&&(e.assignedObjectIds[i.uid]=N(i,u).objectId),i.geometry!=null&&(i.geometry=f(i.geometry,i.geometry.spatialReference,s)),d.push(i)}c.addMany(a([],d,r,o,i,u));let{fullExtent:p,timeExtent:m}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=p,m){let{start:t,end:n}=m;e.layerDefinition.timeInfo.timeExtent=[t,n]}return e}async _applyEdits(e){let{adds:t,updates:n,deletes:r}=e,i={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(i,t),n?.length&&this._applyUpdateEdits(i,n),r?.length){for(let e of r)i.deleteResults.push(x(e));this._queryEngine.featureStore.removeManyById(r)}let{fullExtent:a,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:a,timeExtent:o,featureEditResults:i}}_applyAddEdits(t,r){let{addResults:i,updateResults:o}=t,{geometryType:s,hasM:c,hasZ:l,spatialReference:u,featureStore:d,featureIdInfo:p,fieldsIndex:m}=this._queryEngine,h=[],g=new Map;for(let a of r){if(a.geometry&&s!==n(a.geometry)){i.push(y(`Incorrect geometry type.`));continue}let r=this._createDefaultAttributes(),c=b(m,r,a.attributes);if(c){i.push(c);continue}this._assignObjectId(r,a.attributes),a.attributes=r;let{objectId:l,missingFields:_}=N(a,p);if(l){if(a.uid!=null&&(t.uidToObjectId[a.uid]=l),a.geometry!=null){let e=a.geometry.spatialReference??u;a.geometry=f(S(a.geometry,e),e,u)}h.push(a);let n=x(l);g.has(l)?e(h,g.get(l)):d.has(l)?o.push(n):i.push(n),g.set(l,a)}else{i.push(y(`Missing unique id field value for fields: ${_.join()}`));continue}}d.addMany(a([],h,s,l,c,p))}_applyUpdateEdits({updateResults:e},t){let{geometryType:r,hasM:i,hasZ:a,spatialReference:c,featureStore:l,fieldsIndex:u,featureIdInfo:d}=this._queryEngine;for(let p of t){let{attributes:t,geometry:m}=p,{objectId:h,missingFields:g}=N(p,d);if(h==null){let t=d.type===`unique-id-composite`?g:d.fieldName;e.push(y(`Identifier fields: ${t} missing`));continue}if(!l.has(h)){e.push(y(`Feature with object id ${h} missing`));continue}let _=o(l.getFeature(h),r,a,i);if(m!=null){if(r!==n(m)){e.push(y(`Incorrect geometry type.`));continue}let t=m.spatialReference??c;_.geometry=f(S(m,t),t,c)}if(t){let n=b(u,_.attributes,t);if(n){e.push(n);continue}}l.add(s(_,r,a,i,d)),e.push(x(h))}}_assignObjectId(e,t,n=!1){if(this._queryEngine.featureIdInfo.type===`object-id`){let r=this._queryEngine.featureIdInfo.fieldName;e[r]=n&&t&&isFinite(t[r])?t[r]:this._nextObjectId++}}}export{P as default};
2
+ import{remove as e}from"../../../../core/arrayUtils.js";import t from"../../../../core/Error.js";import{getJsonType as n,isPoint as r}from"../../../../geometry/support/jsonTypeUtils.js";import{wgs84 as i}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatures as a,convertToFeature as o,convertFromFeature as s}from"../../featureConversionUtils.js";import{initialObjectId as c,findLastObjectIdFromFeatures as l}from"../../objectIdUtils.js";import u from"../../data/FeatureStore.js";import{checkProjectionSupport as d,project as f}from"../../data/projectionSupport.js";import{QueryEngine as p}from"../../data/QueryEngine.js";import{createDefaultAttributesFunction as m,createDefaultTemplate as h,createDrawingInfo as g}from"./clientSideDefaults.js";import{tableCapabilities as _,layerCapabilities as v,loadGeometryEngineForSimplify as y,createFeatureEditErrorResult as b,mixAttributes as x,createFeatureEditSuccessResult as S,simplify as C}from"./sourceUtils.js";import w from"../../../support/FieldsIndex.js";import{kebabDict as T}from"../../../support/fieldType.js";import{getFieldDefaultLength as E,getFieldDefaultValue as D}from"../../../support/fieldUtils.js";import{utc as O}from"../../../../time/constants.js";const k=i,A={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:i};function j(e){return r(e)?e.z!=null:!!e.hasZ}function M(e){return r(e)?e.m!=null:!!e.hasM}function N(e,t){let n,r=[];if(t.type===`unique-id-composite`){let i=[];for(let n of t.fieldNames)e.attributes[n]?i.push(e.attributes[n]):r.push(n);n=r.length===0?JSON.stringify(i):null}else n=e.attributes[t.fieldName],n||r.push(t.fieldName);return{objectId:n,missingFields:r}}class P{constructor(){this._uniqueIdInfo=null,this._queryEngine=null,this._nextObjectId=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e){let n=[],{features:r}=e,i=this._inferLayerProperties(r,e.fields),a=e.fields||[],o=e.hasM==null?!!i.hasM:e.hasM,s=e.hasZ==null?!!i.hasZ:e.hasZ,f=!e.spatialReference&&!i.spatialReference,y=f?k:e.spatialReference||i.spatialReference,b=f?A:null,x=e.geometryType||i.geometryType,S=!x,C=e.uniqueIdInfo,j=e.objectIdField??i.objectIdField,M=e.timeInfo,N=new w(a);if(!S&&(f&&n.push({name:`feature-layer:spatial-reference-not-found`,message:`Spatial reference not provided or found in features. Defaults to WGS84`}),!x))throw new t(`feature-layer:missing-property`,`geometryType not set and couldn't be inferred from the provided features`);if(C){let e=new Set(a.map(({name:e})=>e));if(!C.fields.every(t=>e.has(t))){let n=C.fields.filter(t=>!e.has(t));throw new t(`feature-layer:missing-property`,`UniqueIdFields not set and couldn't be found in the provided fields. Fields: `+n+` are mssing.`)}j=null}else if(!j)throw new t(`feature-layer:missing-property`,`objectIdField not set and uniqueIdInfo not provided.`);if(i.objectIdField&&j!==i.objectIdField&&(n.push({name:`feature-layer:duplicated-oid-field`,message:`Provided objectIdField "${j}" doesn't match the field name "${i.objectIdField}", found in the provided fields`}),j=i.objectIdField),j&&!i.objectIdField){let e=N.get(j);e?(j=e.name,e.type=`esriFieldTypeOID`,e.editable=!1,e.nullable=!1):a.unshift({alias:j,name:j,type:`esriFieldTypeOID`,editable:!1,nullable:!1})}for(let e of a){if(e.name??=e.alias,e.alias??=e.name,!e.name)throw new t(`feature-layer:invalid-field-name`,`field name is missing`,{field:e});if(e.name===j&&(e.type=`esriFieldTypeOID`),!T.jsonValues.includes(e.type))throw new t(`feature-layer:invalid-field-type`,`invalid type for field "${e.name}"`,{field:e});e.length??=E(e)}let P={};for(let e of a)if(e.type!==`esriFieldTypeOID`&&e.type!==`esriFieldTypeGlobalID`){let t=D(e);t!==void 0&&(P[e.name]=t)}if(M){if(M.startTimeField){let e=N.get(M.startTimeField);e?(M.startTimeField=e.name,e.type=`esriFieldTypeDate`):M.startTimeField=null}if(M.endTimeField){let e=N.get(M.endTimeField);e?(M.endTimeField=e.name,e.type=`esriFieldTypeDate`):M.endTimeField=null}if(M.trackIdField){let e=N.get(M.trackIdField);e?M.trackIdField=e.name:(M.trackIdField=null,n.push({name:`feature-layer:invalid-timeInfo-trackIdField`,message:`trackIdField is missing`,details:{timeInfo:M}}))}!M.startTimeField&&!M.endTimeField&&(n.push({name:`feature-layer:invalid-timeInfo`,message:`startTimeField and endTimeField are missing or invalid`,details:{timeInfo:M}}),M=null)}let F=N.dateFields.length?{timeZoneIANA:e.dateFieldsTimeZone??O}:null;this._createDefaultAttributes=m(P,j),this._uniqueIdInfo=e.uniqueIdInfo??void 0;let I={warnings:n,featureErrors:[],layerDefinition:{...S?_:v,drawingInfo:g(x),templates:h(P),extent:b,geometryType:x,objectIdField:j,fields:a,hasZ:s,hasM:o,timeInfo:M,dateFieldsTimeReference:F,uniqueIdInfo:this._uniqueIdInfo??void 0},assignedObjectIds:{}},L=this._uniqueIdInfo?.OIDFieldContainsHashValue?this._uniqueIdInfo.type===`simple`?{type:`unique-id-simple`,fieldName:this._uniqueIdInfo.fields[0]}:{type:`unique-id-composite`,fieldNames:this._uniqueIdInfo.fields}:{type:`object-id`,fieldName:j};if(this._queryEngine=new p({fieldsIndex:w.fromLayerJSON({fields:a,timeInfo:M,dateFieldsTimeReference:F}),geometryType:x,hasM:o,hasZ:s,featureIdInfo:L,spatialReference:y,featureStore:new u({geometryType:x,hasM:o,hasZ:s}),timeInfo:M}),!r?.length)return this._nextObjectId=c,I;if(j){let e=l(j,r);this._nextObjectId=e+1}return await d(r,y),this._loadInitialFeatures(I,r)}async applyEdits(e){let{spatialReference:t,geometryType:n}=this._queryEngine;return await Promise.all([y(t,n),d(e.adds,t),d(e.updates,t)]),this._applyEdits(e)}queryFeatures(e,t={}){return this._queryEngine.executeQuery(e,t.signal)}queryFeatureCount(e,t={}){return this._queryEngine.executeQueryForCount(e,t.signal)}queryObjectIds(e,t={}){return this._queryEngine.executeQueryForIds(e,t.signal)}queryExtent(e,t={}){return this._queryEngine.executeQueryForExtent(e,t.signal)}querySnapping(e,t={}){return this._queryEngine.executeQueryForSnapping(e,t.signal)}queryAttributeBins(e,t={}){return this._queryEngine.executeAttributeBinsQuery(e,t.signal)}_inferLayerProperties(e,t){let r,i,a=null,o=null,s=null;for(let t of e){let e=t.geometry;if(e!=null&&(a||=n(e),o||=e.spatialReference,r??=j(e),i??=M(e),a&&o&&r!=null&&i!=null))break}if(t&&t.length){let e=null;t.some(t=>{let n=t.type===`esriFieldTypeOID`,r=!t.type&&t.name&&t.name.toLowerCase()===`objectid`;return e=t,n||r})&&(s=e.name)}return{geometryType:a,spatialReference:o,objectIdField:s,hasM:i,hasZ:r}}async _loadInitialFeatures(e,t){let{geometryType:r,hasM:i,hasZ:o,spatialReference:s,featureStore:c,fieldsIndex:l,featureIdInfo:u}=this._queryEngine,d=[];for(let i of t){if(i.uid!=null&&(e.assignedObjectIds[i.uid]=-1),i.geometry&&r!==n(i.geometry)){e.featureErrors.push(b(`Incorrect geometry type.`));continue}let t=this._createDefaultAttributes(),a=x(l,t,i.attributes,!0);if(a){e.featureErrors.push(a);continue}this._assignObjectId(t,i.attributes,!0),i.attributes=t,i.uid&&(e.assignedObjectIds[i.uid]=N(i,u).objectId),i.geometry!=null&&(i.geometry=f(i.geometry,i.geometry.spatialReference,s)),d.push(i)}c.addMany(a([],d,r,o,i,u));let{fullExtent:p,timeExtent:m}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=p,m){let{start:t,end:n}=m;e.layerDefinition.timeInfo.timeExtent=[t,n]}return e}async _applyEdits(e){let{adds:t,updates:n,deletes:r}=e,i={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(i,t),n?.length&&this._applyUpdateEdits(i,n),r?.length){for(let e of r)i.deleteResults.push(S(e));this._queryEngine.featureStore.removeManyById(r)}let{fullExtent:a,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:a,timeExtent:o,featureEditResults:i}}_applyAddEdits(t,r){let{addResults:i,updateResults:o}=t,{geometryType:s,hasM:c,hasZ:l,spatialReference:u,featureStore:d,featureIdInfo:p,fieldsIndex:m}=this._queryEngine,h=[],g=new Map;for(let a of r){if(a.geometry&&s!==n(a.geometry)){i.push(b(`Incorrect geometry type.`));continue}let r=this._createDefaultAttributes(),c=x(m,r,a.attributes);if(c){i.push(c);continue}this._assignObjectId(r,a.attributes),a.attributes=r;let{objectId:l,missingFields:_}=N(a,p);if(l){if(a.uid!=null&&(t.uidToObjectId[a.uid]=l),a.geometry!=null){let e=a.geometry.spatialReference??u;a.geometry=f(C(a.geometry,e),e,u)}h.push(a);let n=S(l);g.has(l)?e(h,g.get(l)):d.has(l)?o.push(n):i.push(n),g.set(l,a)}else{i.push(b(`Missing unique id field value for fields: ${_.join()}`));continue}}d.addMany(a([],h,s,l,c,p))}_applyUpdateEdits({updateResults:e},t){let{geometryType:r,hasM:i,hasZ:a,spatialReference:c,featureStore:l,fieldsIndex:u,featureIdInfo:d}=this._queryEngine;for(let p of t){let{attributes:t,geometry:m}=p,{objectId:h,missingFields:g}=N(p,d);if(h==null){let t=d.type===`unique-id-composite`?g:d.fieldName;e.push(b(`Identifier fields: ${t} missing`));continue}if(!l.has(h)){e.push(b(`Feature with object id ${h} missing`));continue}let _=o(l.getFeature(h),r,a,i);if(m!=null){if(r!==n(m)){e.push(b(`Incorrect geometry type.`));continue}let t=m.spatialReference??c;_.geometry=f(C(m,t),t,c)}if(t){let n=x(u,_.attributes,t);if(n){e.push(n);continue}}l.add(s(_,r,a,i,d)),e.push(S(h))}}_assignObjectId(e,t,n=!1){if(this._queryEngine.featureIdInfo.type===`object-id`){let r=this._queryEngine.featureIdInfo.fieldName;e[r]=n&&t&&isFinite(t[r])?t[r]:this._nextObjectId++}}}export{P as default};
@@ -5,4 +5,4 @@ import has from"../../../../core/has.js";import{clone as e}from"../../../../core
5
5
  ${n};
6
6
  }
7
7
  }
8
- `)();return()=>new r}catch{return()=>t?{[t]:null,...e}:{...e}}}function u(e){return s.test(e)?`.${e}`:`[${JSON.stringify(e)}]`}function d(t={}){return[{name:`New Feature`,description:``,prototype:{attributes:e(t)}}]}function f(e,r){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:r,supportsDelete:r,supportsEditing:r,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!0,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:r,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:n,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:t,editing:{supportsGeometryUpdate:r,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:r,supportsTrueCurveUpdateByTrueCurveClientsOnly:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}export{f as createCapabilities,l as createDefaultAttributesFunction,d as createDefaultTemplate,o as createDrawingInfo};
8
+ `)();return()=>new r}catch{return()=>t?{[t]:null,...e}:{...e}}}function u(e){return s.test(e)?`.${e}`:`[${JSON.stringify(e)}]`}function d(t={}){return[{name:`New Feature`,description:``,prototype:{attributes:e(t)}}]}const f={...n,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!1,supportsDistance:!1,supportsExtent:!1,supportsQuantization:!1,supportsQueryGeometry:!1,supportsDisjointSpatialRelationship:!1},p={...t,supportedStatistics:{...t.supportedStatistics,envelope:!1,centroid:!1,convexHull:!1}};function m(e,r,i=!1){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:r,supportsDelete:r,supportsEditing:r,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!0,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:r,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:i?f:n,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:i?p:t,editing:{supportsGeometryUpdate:r,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:r,supportsTrueCurveUpdateByTrueCurveClientsOnly:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}export{m as createCapabilities,l as createDefaultAttributesFunction,d as createDefaultTemplate,o as createDrawingInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{parseDate as e}from"../../../../core/date.js";import{importLazily as t}from"../../../../core/importUtils.js";import{isPolygon as n,isPolyline as r}from"../../../../geometry/support/jsonTypeUtils.js";import{isValid as i}from"../../../../geometry/support/spatialReferenceUtils.js";import{validateFieldValue as a,validationErrorToString as o,isNumericField as s,sanitizedParseFloat as c,isStringField as l,isDateField as u,sanitizeNullFieldValue as d}from"../../../support/fieldUtils.js";class f{constructor(e){this.description=e,this.code=null}}class p{constructor(e){this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error=new f(e)}}function m(e){return new p(e)}class h{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function g(e){return new h(e)}const _=new Set;function v(e,t,n,r=!1){_.clear();for(let i in n){let s=e.get(i);if(!s)continue;let c=n[i],l=y(s,c);if(_.add(s.name),s&&(r||s.editable)){let e=a(s,l);if(!e)t[s.name]=l;else return m(o(e,s,l))}}for(let t of e.requiredFields??[])if(!_.has(t.name))return m(`missing required field "${t.name}"`);return null}function y(t,n){let r=n;return s(t)&&typeof n==`string`?r=c(n):l(t)&&n!=null&&typeof n!=`string`?r=String(n):u(t)&&typeof n==`string`&&(r=e(n)),d(r)}const b=t(()=>import(`../../../../geometry/operators/json/simplifyOperator.js`));function x(e,t){if(!n(e)&&!r(e)||!i(t))return e;let a=b.module;if(a==null)throw TypeError(`simplify operator not loaded`);return a.simplifyExecute({...e,spatialReference:t})??e}async function S(e,t){i(e)&&(t===`esriGeometryPolygon`||t===`esriGeometryPolyline`)&&await b.getImportPromise()}const C={supportsAutoIntervalBin:!0,supportsFixedIntervalBin:!0,supportsFixedBoundariesBin:!0,supportsDateBin:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsNormalization:!0,supportedStatisticTypes:[`COUNT`,`SUM`,`AVG`,`VAR`,`STDDEV`,`MIN`,`MAX`,`PERCENTILE_CONT`,`PERCENTILE_DISC`,`CentroidAggregate`,`EnvelopeAggregate`,`ConvexHullAggregate`],supportedNormalizationTypes:[`field`,`log`,`naturalLog`,`percentOfTotal`,`squareRoot`]};export{m as createFeatureEditErrorResult,g as createFeatureEditSuccessResult,S as loadGeometryEngineForSimplify,v as mixAttributes,C as queryBinsCapabilities,x as simplify};
2
+ import{parseDate as e}from"../../../../core/date.js";import{importLazily as t}from"../../../../core/importUtils.js";import{isPolygon as n,isPolyline as r}from"../../../../geometry/support/jsonTypeUtils.js";import{isValid as i}from"../../../../geometry/support/spatialReferenceUtils.js";import{validateFieldValue as a,validationErrorToString as o,isNumericField as s,sanitizedParseFloat as c,isStringField as l,isDateField as u,sanitizeNullFieldValue as d}from"../../../support/fieldUtils.js";class f{constructor(e){this.description=e,this.code=null}}class p{constructor(e){this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error=new f(e)}}function m(e){return new p(e)}class h{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function g(e){return new h(e)}const _=new Set;function v(e,t,n,r=!1){_.clear();for(let i in n){let s=e.get(i);if(!s)continue;let c=n[i],l=y(s,c);if(_.add(s.name),s&&(r||s.editable)){let e=a(s,l);if(!e)t[s.name]=l;else return m(o(e,s,l))}}for(let t of e.requiredFields??[])if(!_.has(t.name))return m(`missing required field "${t.name}"`);return null}function y(t,n){let r=n;return s(t)&&typeof n==`string`?r=c(n):l(t)&&n!=null&&typeof n!=`string`?r=String(n):u(t)&&typeof n==`string`&&(r=e(n)),d(r)}const b=t(()=>import(`../../../../geometry/operators/json/simplifyOperator.js`));function x(e,t){if(!n(e)&&!r(e)||!i(t))return e;let a=b.module;if(a==null)throw TypeError(`simplify operator not loaded`);return a.simplifyExecute({...e,spatialReference:t})??e}async function S(e,t){i(e)&&(t===`esriGeometryPolygon`||t===`esriGeometryPolyline`)&&await b.getImportPromise()}const C={supportsAutoIntervalBin:!0,supportsFixedIntervalBin:!0,supportsFixedBoundariesBin:!0,supportsDateBin:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsNormalization:!0,supportedStatisticTypes:[`COUNT`,`SUM`,`AVG`,`VAR`,`STDDEV`,`MIN`,`MAX`,`PERCENTILE_CONT`,`PERCENTILE_DISC`,`CentroidAggregate`,`EnvelopeAggregate`,`ConvexHullAggregate`],supportedNormalizationTypes:[`field`,`log`,`naturalLog`,`percentOfTotal`,`squareRoot`]},w={hasAttachments:!1,capabilities:`query, editing, create, delete, update`,useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsQueryAttachmentsCountOnly:!1,supportsQueryAttachmentOrderByFields:!1,supportsQueryAttachmentWithTypeWildcard:!1,supportsQueryBins:!0,supportsQueryPivot:!1,supportsSpatialAggregationStatistics:!0,supportedSpatialAggregationStatistics:[`EnvelopeAggregate`,`CentroidAggregate`,`ConvexHullAggregate`],supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsOutDistance:!1,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0,supportsQueryWithCacheHint:!0},queryBinsCapabilities:C},T={...w,supportsCoordinatesQuantization:!1,supportsReturningQueryGeometry:!1,advancedQueryCapabilities:{...w.advancedQueryCapabilities,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:[],supportsReturningGeometryCentroid:!1,supportsQueryWithDistance:!1,supportsReturningQueryExtent:!1,supportsDisjointSpatialRel:!1},queryBinsCapabilities:{...C,supportedStatisticTypes:C.supportedStatisticTypes.filter(e=>e!==`EnvelopeAggregate`&&e!==`CentroidAggregate`&&e!==`ConvexHullAggregate`)}};export{m as createFeatureEditErrorResult,g as createFeatureEditSuccessResult,w as layerCapabilities,S as loadGeometryEngineForSimplify,v as mixAttributes,C as queryBinsCapabilities,x as simplify,T as tableCapabilities};
@@ -1,14 +1,15 @@
1
1
  /**
2
- * FeatureLayerReload is a mixin that adds support for reloading layer's schema and properties.
2
+ * ReloadableLayer is a mixin that adds support for reloading layer's schema and properties.
3
3
  *
4
4
  * @since 5.2
5
5
  */
6
- export abstract class FeatureLayerReload {
6
+ export abstract class ReloadableLayer {
7
7
  constructor(...args: any[]);
8
8
  /**
9
- * Indicates if the layer is in the process of reloading its properties and schema after a call to `reload()`.
9
+ * Indicates if the layer is in the process of reloading its properties and schema after a call to [reload()](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/ReloadableLayer/#reload).
10
10
  *
11
11
  * @since 5.2
12
+ * @see [reload()](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/ReloadableLayer/#reload)
12
13
  */
13
14
  get reloading(): boolean;
14
15
  /**
@@ -21,6 +22,7 @@ export abstract class FeatureLayerReload {
21
22
  * @returns `true` when the layer is successfully updated with data from the portal item or service;
22
23
  * `false` when the layer is not updated, not loaded, or does not reference a service.
23
24
  * @since 5.2
25
+ * @see [reloading](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/ReloadableLayer/#reloading)
24
26
  */
25
27
  reload(): Promise<boolean>;
26
28
  }
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{abortHandle as t}from"../../core/handleUtils.js";import{debounce as n,throwIfAbortError as r}from"../../core/promiseUtils.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{getOwningPortalUrl as o}from"../support/layerUtils.js";import s from"../../portal/Portal.js";import c from"../../portal/PortalItem.js";const l=`reload`,u=u=>{let d=u,f=class extends d{constructor(...e){super(...e),this._loadTimestamp=0,this._pendingReloadCount=0,this._serviceItemModified=null,this._debounceReload=n(async()=>{if(this.destroyed||!this.loaded||!this.canReload())return!1;let e=new AbortController;this.addHandles(t(e),l);try{let t=null,n;if(this.portalItem?.id&&this.portalItem.id===this.serviceItemId)n=await this.reloadFromPortal({supportedTypes:this.supportedPortalItemTypes},{signal:e.signal});else{let r=await this._shouldReloadFromServiceItem(e.signal);n=r.updated,t=r.modified}return n&&await this.reloadFromService(e.signal),e.signal.throwIfAborted(),t!=null&&(this._serviceItemModified=t),n}finally{this.removeHandles(l)}}),this.when().then(()=>{this._loadTimestamp=Date.now()},()=>{})}get reloading(){return this._pendingReloadCount>0}reload(){return this.destroyed||!this.loaded||!this.canReload()?Promise.resolve(!1):(this._pendingReloadCount++,this._debounceReload().finally(()=>{this._pendingReloadCount--}))}canReload(){return this.url!=null}async _shouldReloadFromServiceItem(e){let{serviceItemId:t,url:n}=this;if(!t||!n)return{modified:null,updated:!0};try{let r=await o(n,{signal:e});if(!r)return{modified:null,updated:!0};let i=new s({url:r}),a=new c({apiKey:this.apiKey,id:t,portal:i});await a.load({signal:e});let l=a.modified?.getTime();if(l==null)return{modified:null,updated:!0};let u=this._serviceItemModified;return{modified:l,updated:u==null?l>this._loadTimestamp:u<l}}catch(e){return r(e),{modified:null,updated:!0}}}};return e([i({clonable:!1})],f.prototype,`_pendingReloadCount`,void 0),e([i({readOnly:!0})],f.prototype,`reloading`,null),f=e([a(`esri.layers.mixins.ReloadableLayer`)],f),f};export{u as ReloadableLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{deg2rad as e}from"../../../core/mathUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as i}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{sub as a,add as o,length as s,dot as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import l from"../../../geometry/Circle.js";import u from"../../../geometry/Mesh.js";import d from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectAsync as p}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as h}from"../../../geometry/support/centroid.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import _ from"../../../geometry/support/MeshComponent.js";import{createSphere as v}from"../../../geometry/support/meshUtils.js";import y from"../../../geometry/support/MeshVertexAttributes.js";import{create as b,fromArray as x,intersectRay as S}from"../../../geometry/support/plane.js";import{isWebMercator as C}from"../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnitOfSR as w}from"./utils.js";import{convertToSRUnits as T,getWebMercatorScalingFactor as E,createRotationMatrixFromHPR as D,transformMat3 as O,scaleAndAddWithFactor as k,scaleWithFactor as A,computeHFOVAndVFOV as j,projectiveTransform as M}from"../transformations/utils.js";const N=Math.PI/180;function P(e,t,n){let r=T(e,t.spatialReference);return r.cameraHeight=(t.z??r.cameraHeight)-n,e.isSpherical?z(r,t):F(r,t)}function F(e,t){let{horizontalFieldOfView:n,verticalFieldOfView:r,cameraHeading:i}=e,a=E(t.y,t.spatialReference),o=e.cameraPitch,s=e.cameraRoll??0,c=150;n>150&&(o=90,s=0,c=5);let l=Math.ceil(n/c),u=I(l,i,n),d=K(e)*a,p=new f({spatialReference:t?.spatialReference});p.imageID=e.objectId;let m=null;for(let i of u)m=L(i,o,e.cameraHeight,t,d,a,r,n,l,p,s,e.nearDistance);return m.imageID=e.objectId,{polygon:p,frustum:m}}function I(e,t,n){let r=[];if(e%2==0)for(let i=0;i<e/2;i++)r.push(t-n/e*(i+.5),t+n/e*(i+.5));else{r.push(t);for(let i=1;i<e/2;i++)r.push(t-n/e*i,t+n/e*i)}return r.sort(),r}function L(e,t,s,c,l,u,d,f,p,m,h=0,g=0){let _=i(n(),D([e,t,h??0])),v=U({cameraHeight:s,cameraPitch:t,farDistance:l,location:c,horizontalFieldOfView:f,nearDistance:g,verticalFieldOfView:d},_),y=O([0,0,-1],_),{x:b,y:x}=c,S=k([b,x,c.z??s],y,l,u),C=2*Math.tan(d*N/2)*l,w=2*Math.tan(f/p*N/2)*l,T=O([0,1,0],_),E=O([1,0,0],_),j=A(T,C/2,u),M=A(E,w/2,u),P=a(r(),j,M),F=o(r(),j,M),I=R([o(r(),S,P),o(r(),S,F),a(r(),S,P),a(r(),S,F)],s,c,u);return I.push(I[0]),m.addRing(I),v}function R(e,t,n,r){return e.map(e=>W(e,t,n,r))}function z(e,t){let{farDistance:n,objectId:r,nearDistance:i,cameraHeight:a}=e,o=E(t.y,t.spatialReference),s=new l({center:t.clone(),radius:n*o});if(s.imageID=r,i){let e=new l({center:t.clone(),radius:i*o});s.addRing(e.rings[0])}let c=t.clone();c.z=(t.z??a)-n*o;let u=v(c,{size:2*n*o});return u.imageID=r,{polygon:s,frustum:u}}function B(e,t){return e.contains(t)}function V(e,t){let r=T(e,e.location.spatialReference);if(t.z==null)return!1;let{horizontalFieldOfView:a,location:o,nearDistance:l=0,verticalFieldOfView:u}=r,d=K(r);if(a==null||u==null||d<=0)return!1;let f=E(o.y,o.spatialReference),p=o.z??0,m=[(t.x-o.x)/f,(t.y-o.y)/f,t.z-p];if(r.isSpherical){let e=s(m);return l<=e&&e<=d}let h=i(n(),D([r.cameraHeading,r.cameraPitch,r.cameraRoll??0])),g=O([0,0,-1],h),_=c(m,g);return _>0&&_>=l&&_<=d}function H(e,t){return Math.sign(e)!==Math.sign(t)}function U(e,t,n){let{cameraHeight:i,cameraPitch:s,farDistance:c,location:l,horizontalFieldOfView:d,nearDistance:f,verticalFieldOfView:p}=e,m=l.z??i,h=m-i,g=q(l),_=!(s+p/2>=90),v=2*Math.tan(p*N/2)*f,b=2*Math.tan(d*N/2)*f,x=2*Math.tan(p*N/2)*c,S=2*Math.tan(d*N/2)*c,C,w=[0,0,-1];w=O(w,t),C=k([l.x,l.y,m],w,c,g),_&&(C[2]=h);let T=k([l.x,l.y,m],w,f,g),E=[0,1,0];E=O(E,t);let D=[1,0,0];D=O(D,t);let j=[],M=[];f?(M=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],j=j.concat(o(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(o(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g))))):(j=[l.x,l.y,m],M=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),j=j.concat(o(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(o(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g))));let P=new y({position:Float64Array.from(j)});return new u({vertexAttributes:P,components:M,spatialReference:l.spatialReference})}function W(e,t,n,i){{let o=n.z??t,s=o-t,c=Math.sqrt((e[2]-o)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/i)**2)*i,l=A(a(r(),[e[0],e[1],e[2]],[n.x,n.y,o]),1/c,1/i),u=t/(o-e[2]),d={x:(1-u)*n.x+u*e[0],y:(1-u)*n.y+u*e[1],z:(1-u)*o+u*e[2]},f=Math.sqrt((d.z-o)**2+(Math.sqrt((d.x-n.x)**2+(d.y-n.y)**2)/i)**2)*i,p=A(a(r(),[d.x,d.y,d.z],[n.x,n.y,o]),1/f,1/i);return H(l[0],p[0])&&H(l[1],p[1])&&H(l[2],p[2])||e[2]>=s?[e[0],e[1],s]:[d.x,d.y,d.z]}}function G(e){let{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:i,cameraPitch:a,farDistance:o,nearDistance:s}=e,c=q(e.geometry),l=new f({spatialReference:t}),u=Math.abs(1.44*o*c),d=Math.abs(1.44*s*c);(a<20||i==null)&&(d=u);let p=[];return p[0]={x:n+u*Math.sin((i-45)*N),y:r+u*Math.cos((i-45)*N)},p[1]={x:n+u*Math.sin((i+45)*N),y:r+u*Math.cos((i+45)*N)},p[2]={x:n+d*Math.sin((i+135)*N),y:r+d*Math.cos((i+135)*N)},p[3]={x:n+d*Math.sin((i+225)*N),y:r+d*Math.cos((i+225)*N)},l.addRing([[p[0].x,p[0].y,0],[p[1].x,p[1].y,0],[p[2].x,p[2].y,0],[p[3].x,p[3].y,0],[p[0].x,p[0].y,0]]),l}function K(t){let{cameraHeight:n,cameraPitch:r,farDistance:i,location:a,verticalFieldOfView:o}=t;return i??(r+o/2>=90?20/w(a.spatialReference):n/Math.cos(e(r)))}function q(e){return e&&C(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/g.radius))):1}function ee(e,t){let n=1+t/100;if(e.declaredClass===`esri.geometry.Circle`){let{radius:t,center:r}=e,i=t*n,a=new l({radius:i,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if(e.declaredClass===`esri.geometry.Polygon`){let t=new f({spatialReference:e.spatialReference}),i=h(e);if(i){let o=[];for(let t=0;t<e.rings[0].length;t++){let s=Math.sqrt((i.x-e.rings[0][t][0])**2+(i.y-e.rings[0][t][1])**2),c=A(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[i.x,i.y,0]),1/s,1),l=k([i.x,i.y,0],c,s*n,1);o.push({x:l[0],y:l[1]})}t.addRing([[o[0].x,o[0].y,0],[o[1].x,o[1].y,0],[o[2].x,o[2].y,0],[o[3].x,o[3].y,0],[o[0].x,o[0].y,0]])}return t}return e}async function te(e,t,n){let{cameraHeight:r,cameraLocation:i,cameraPitch:a,frustumVertices:o,horizontalFieldOfView:s,imageHeight:c,imageWidth:l,inSRS:u,outSRS:d,verticalFieldOfView:f,cameraRoll:p,options:h}=n,g=new m(u),_=new m(d),v=j(s,f,p??0),y=o.length>15;return a+v.vfov/2>=90?await oe(o,e,l,c,g,_,y,h):await ne(o,e,t,i,r,y,g,_,h)}async function ne(e,t,n,r,i,a,o,s,c){let l=re(e,t,n,r,i);if(!l)return;let{farPlane:d,nearPlane:f}=l,p=await J([...f?.vertexPositions??e.slice(0,3),...d.vertexPositions],o,s,c),m=$(p);return new u({vertexAttributes:new y({position:p}),components:Q(a?X(m,!0):Z(m,!0)),spatialReference:s})}function re(e,t,n,r,i){let a=Y(e),o=Y(e,`near`);if(!a)return;let s=t.length;for(let e=0;e<s;e++){let t=Array.from(n[e]),s=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??i)];ae(r,s,e,o),ie(r,s,e,a)}return{farPlane:a,nearPlane:o}}function ie(e,t,n,i){let{coefficients:a,vertexPositions:o}=i,s=r();S(a,{origin:e,direction:t},s)&&o.splice(n*3,3,...s)}function ae(e,t,n,i){if(!i)return;let a=r();S(i.coefficients,{origin:e,direction:t},a)&&i.vertexPositions.splice(n*3,3,...a)}async function oe(e,t,n,r,i,a,o,s){let c=o?[]:[e[0],e[1],e[2]],l,d=[];for(let i of t)o?(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),c=c.concat(...l),l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),d=d.concat(...l)):(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),c=c.concat(...l));c=c.concat(d);let f=await J(c,i,a,s),p=$(f);return new u({vertexAttributes:new y({position:f}),components:Q(o?X(p,!0):Z(p,!0)),spatialReference:a})}async function J(e,n,r,i){if(n.equals(r))return e;let a=e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]||(e[r]=[]),e[r].push(t),e},[]),{points:o}=await p(new d({points:a,spatialReference:n}),r,i);return t(i),o.flat()}function Y(e,t=`far`){let n=b(),r;switch(t){case`far`:if(r=Array.from(e.length===15?e.slice(3):e.slice(12)),x(n,r,!1))return{coefficients:n,vertexPositions:r};break;case`near`:return r=Array.from(e.slice(0,12)),e.length===15||!x(n,r,!1)?void 0:{coefficients:n,vertexPositions:r}}}const X=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw Error(`Invalid number of vertices`);let n=[],r=e/2,i=Math.round((t?e-2:e)/2);for(let a=0;a<i;a++){let i=a+r,o=t?i+1:i,s=o%e,c=(t?i:o+1)%e;n.push({faces:new Uint32Array([a,c,s,a,a+1,s])})}return n};function Z(e,t=!1){if(e<3||t&&e-1<3)throw Error(`Invalid number of vertices`);let n=[],r=t?e-2:e-1;for(let e=0;e<r;e++)n.push({faces:new Uint32Array([0,e+1,e+2])});return n}const Q=e=>e.map(e=>new _(e)),$=e=>e.length/3;export{V as checkIfFrustumContainsSelectedPoint,B as checkIfPolygonContainsSelectedPoint,G as computePolygonForInspection,P as createCoveragePolygon,R as limitZToGround,J as projectVertices,ee as resizePolygon,te as updateFrustum};
2
+ import{deg2rad as e}from"../../../core/mathUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as i}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{sub as a,add as o,length as s,dot as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import l from"../../../geometry/Circle.js";import u from"../../../geometry/Mesh.js";import d from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectAsync as p}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as h}from"../../../geometry/support/centroid.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import _ from"../../../geometry/support/MeshComponent.js";import{createSphere as v}from"../../../geometry/support/meshUtils.js";import y from"../../../geometry/support/MeshVertexAttributes.js";import{create as b,fromArray as x,intersectRay as S}from"../../../geometry/support/plane.js";import{isWebMercator as C}from"../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnitOfSR as w}from"./utils.js";import{convertToSRUnits as T,getWebMercatorScalingFactor as E,createRotationMatrixFromHPR as D,transformMat3 as O,scaleAndAddWithFactor as k,scaleWithFactor as A,computeHFOVAndVFOV as j,projectiveTransform as M}from"../transformations/utils.js";const N=Math.PI/180;function P(e,t,n){let r=T(e,t.spatialReference);return r.cameraHeight=(t.z??r.cameraHeight)-n,e.isSpherical?te(r,t):F(r,t)}function F(e,t){let{horizontalFieldOfView:n,verticalFieldOfView:r,cameraHeading:i}=e,a=E(t.y,t.spatialReference),o=e.cameraPitch,s=e.cameraRoll??0,c=150;n>150&&(o=90,s=0,c=5);let l=Math.ceil(n/c),u=I(l,i,n),d=V(e)*a,p=new f({spatialReference:t?.spatialReference});p.imageID=e.objectId;let m=null;for(let i of u)m=ee(i,o,e.cameraHeight,t,d,a,r,n,l,p,s,e.nearDistance);return m.imageID=e.objectId,{polygon:p,frustum:m}}function I(e,t,n){let r=[];if(e%2==0)for(let i=0;i<e/2;i++)r.push(t-n/e*(i+.5),t+n/e*(i+.5));else{r.push(t);for(let i=1;i<e/2;i++)r.push(t-n/e*i,t+n/e*i)}return r.sort(),r}function ee(e,t,s,c,l,u,d,f,p,m,h=0,g=0){let _=i(n(),D([e,t,h??0])),v=re({cameraHeight:s,cameraPitch:t,farDistance:l,location:c,horizontalFieldOfView:f,nearDistance:g,verticalFieldOfView:d},_),y=O([0,0,-1],_),{x:b,y:x}=c,S=k([b,x,c.z??s],y,l,u),C=2*Math.tan(d*N/2)*l,w=2*Math.tan(f/p*N/2)*l,T=O([0,1,0],_),E=O([1,0,0],_),j=A(T,C/2,u),M=A(E,w/2,u),P=a(r(),j,M),F=o(r(),j,M),I=L([o(r(),S,P),o(r(),S,F),a(r(),S,P),a(r(),S,F)],s,c,u);return I.push(I[0]),m.addRing(I),v}function L(e,t,n,r){return e.map(e=>ie(e,t,n,r))}function te(e,t){let{farDistance:n,objectId:r,nearDistance:i,cameraHeight:a}=e,o=E(t.y,t.spatialReference),s=new l({center:t.clone(),radius:n*o});if(s.imageID=r,i){let e=new l({center:t.clone(),radius:i*o});s.addRing(e.rings[0])}let c=t.clone();c.z=(t.z??a)-n*o;let u=v(c,{size:2*n*o});return u.imageID=r,{polygon:s,frustum:u}}function ne(e,t){return e.contains(t)}function R({cameraHeading:e,cameraPitch:t,cameraRoll:r,farDistance:a,horizontalFieldOfView:o,nearDistance:s,vectorToPoint:l,verticalFieldOfView:u}){let d=i(n(),D([e,t,r])),f=O([1,0,0],d),p=O([0,1,0],d),m=O([0,0,-1],d),h=c(l,f),g=c(l,p),_=c(l,m);if(_<=0||_<s||_>a)return!1;let v=_*Math.tan(o*N/2),y=_*Math.tan(u*N/2);return Math.abs(h)<=v&&Math.abs(g)<=y}function z(e,t){let n=T(e,e.location.spatialReference);if(t.z==null)return!1;let{horizontalFieldOfView:r,location:i,nearDistance:a,verticalFieldOfView:o}=n,c=V(n);if(r==null||o==null||!Number.isFinite(a)||a<0||!Number.isFinite(c)||c<=0)return!1;let l=E(i.y,i.spatialReference),u=i.z??0,d=[(t.x-i.x)/l,(t.y-i.y)/l,t.z-u];if(n.isSpherical){let e=s(d);return a<=e&&e<=c}let f={vectorToPoint:d,verticalFieldOfView:o,nearDistance:a,farDistance:c};if(r>150){let e=Math.ceil(r/5),t=r/e;return I(e,n.cameraHeading,r).some(e=>R({...f,cameraHeading:e,cameraPitch:90,cameraRoll:0,horizontalFieldOfView:t}))}return R({...f,cameraHeading:n.cameraHeading,cameraPitch:n.cameraPitch,cameraRoll:n.cameraRoll??0,horizontalFieldOfView:r})}function B(e,t){return Math.sign(e)!==Math.sign(t)}function re(e,t,n){let{cameraHeight:i,cameraPitch:s,farDistance:c,location:l,horizontalFieldOfView:d,nearDistance:f,verticalFieldOfView:p}=e,m=l.z??i,h=m-i,g=H(l),_=!(s+p/2>=90),v=2*Math.tan(p*N/2)*f,b=2*Math.tan(d*N/2)*f,x=2*Math.tan(p*N/2)*c,S=2*Math.tan(d*N/2)*c,C,w=[0,0,-1];w=O(w,t),C=k([l.x,l.y,m],w,c,g),_&&(C[2]=h);let T=k([l.x,l.y,m],w,f,g),E=[0,1,0];E=O(E,t);let D=[1,0,0];D=O(D,t);let j=[],M=[];f?(M=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],j=j.concat(o(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(o(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g))))):(j=[l.x,l.y,m],M=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),j=j.concat(o(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(o(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g))));let P=new y({position:Float64Array.from(j)});return new u({vertexAttributes:P,components:M,spatialReference:l.spatialReference})}function ie(e,t,n,i){{let o=n.z??t,s=o-t,c=Math.sqrt((e[2]-o)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/i)**2)*i,l=A(a(r(),[e[0],e[1],e[2]],[n.x,n.y,o]),1/c,1/i),u=t/(o-e[2]),d={x:(1-u)*n.x+u*e[0],y:(1-u)*n.y+u*e[1],z:(1-u)*o+u*e[2]},f=Math.sqrt((d.z-o)**2+(Math.sqrt((d.x-n.x)**2+(d.y-n.y)**2)/i)**2)*i,p=A(a(r(),[d.x,d.y,d.z],[n.x,n.y,o]),1/f,1/i);return B(l[0],p[0])&&B(l[1],p[1])&&B(l[2],p[2])||e[2]>=s?[e[0],e[1],s]:[d.x,d.y,d.z]}}function ae(e){let{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:i,cameraPitch:a,farDistance:o,nearDistance:s}=e,c=H(e.geometry),l=new f({spatialReference:t}),u=Math.abs(1.44*o*c),d=Math.abs(1.44*s*c);(a<20||i==null)&&(d=u);let p=[];return p[0]={x:n+u*Math.sin((i-45)*N),y:r+u*Math.cos((i-45)*N)},p[1]={x:n+u*Math.sin((i+45)*N),y:r+u*Math.cos((i+45)*N)},p[2]={x:n+d*Math.sin((i+135)*N),y:r+d*Math.cos((i+135)*N)},p[3]={x:n+d*Math.sin((i+225)*N),y:r+d*Math.cos((i+225)*N)},l.addRing([[p[0].x,p[0].y,0],[p[1].x,p[1].y,0],[p[2].x,p[2].y,0],[p[3].x,p[3].y,0],[p[0].x,p[0].y,0]]),l}function V(t){let{cameraHeight:n,cameraPitch:r,farDistance:i,location:a,verticalFieldOfView:o}=t;return i??(r+o/2>=90?20/w(a.spatialReference):n/Math.cos(e(r)))}function H(e){return e&&C(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/g.radius))):1}function U(e,t){let n=1+t/100;if(e.declaredClass===`esri.geometry.Circle`){let{radius:t,center:r}=e,i=t*n,a=new l({radius:i,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if(e.declaredClass===`esri.geometry.Polygon`){let t=new f({spatialReference:e.spatialReference}),i=h(e);if(i){let o=[];for(let t=0;t<e.rings[0].length;t++){let s=Math.sqrt((i.x-e.rings[0][t][0])**2+(i.y-e.rings[0][t][1])**2),c=A(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[i.x,i.y,0]),1/s,1),l=k([i.x,i.y,0],c,s*n,1);o.push({x:l[0],y:l[1]})}t.addRing([[o[0].x,o[0].y,0],[o[1].x,o[1].y,0],[o[2].x,o[2].y,0],[o[3].x,o[3].y,0],[o[0].x,o[0].y,0]])}return t}return e}async function W(e,t,n){let{cameraHeight:r,cameraLocation:i,cameraPitch:a,frustumVertices:o,horizontalFieldOfView:s,imageHeight:c,imageWidth:l,inSRS:u,outSRS:d,verticalFieldOfView:f,cameraRoll:p,options:h}=n,g=new m(u),_=new m(d),v=j(s,f,p??0),y=o.length>15;return a+v.vfov/2>=90?await se(o,e,l,c,g,_,y,h):await G(o,e,t,i,r,y,g,_,h)}async function G(e,t,n,r,i,a,o,s,c){let l=K(e,t,n,r,i);if(!l)return;let{farPlane:d,nearPlane:f}=l,p=await J([...f?.vertexPositions??e.slice(0,3),...d.vertexPositions],o,s,c),m=$(p);return new u({vertexAttributes:new y({position:p}),components:Q(a?X(m,!0):Z(m,!0)),spatialReference:s})}function K(e,t,n,r,i){let a=Y(e),o=Y(e,`near`);if(!a)return;let s=t.length;for(let e=0;e<s;e++){let t=Array.from(n[e]),s=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??i)];oe(r,s,e,o),q(r,s,e,a)}return{farPlane:a,nearPlane:o}}function q(e,t,n,i){let{coefficients:a,vertexPositions:o}=i,s=r();S(a,{origin:e,direction:t},s)&&o.splice(n*3,3,...s)}function oe(e,t,n,i){if(!i)return;let a=r();S(i.coefficients,{origin:e,direction:t},a)&&i.vertexPositions.splice(n*3,3,...a)}async function se(e,t,n,r,i,a,o,s){let c=o?[]:[e[0],e[1],e[2]],l,d=[];for(let i of t)o?(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),c=c.concat(...l),l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),d=d.concat(...l)):(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),c=c.concat(...l));c=c.concat(d);let f=await J(c,i,a,s),p=$(f);return new u({vertexAttributes:new y({position:f}),components:Q(o?X(p,!0):Z(p,!0)),spatialReference:a})}async function J(e,n,r,i){if(n.equals(r))return e;let a=e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]||(e[r]=[]),e[r].push(t),e},[]),{points:o}=await p(new d({points:a,spatialReference:n}),r,i);return t(i),o.flat()}function Y(e,t=`far`){let n=b(),r;switch(t){case`far`:if(r=Array.from(e.length===15?e.slice(3):e.slice(12)),x(n,r,!1))return{coefficients:n,vertexPositions:r};break;case`near`:return r=Array.from(e.slice(0,12)),e.length===15||!x(n,r,!1)?void 0:{coefficients:n,vertexPositions:r}}}const X=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw Error(`Invalid number of vertices`);let n=[],r=e/2,i=Math.round((t?e-2:e)/2);for(let a=0;a<i;a++){let i=a+r,o=t?i+1:i,s=o%e,c=(t?i:o+1)%e;n.push({faces:new Uint32Array([a,c,s,a,a+1,s])})}return n};function Z(e,t=!1){if(e<3||t&&e-1<3)throw Error(`Invalid number of vertices`);let n=[],r=t?e-2:e-1;for(let e=0;e<r;e++)n.push({faces:new Uint32Array([0,e+1,e+2])});return n}const Q=e=>e.map(e=>new _(e)),$=e=>e.length/3;export{z as checkIfFrustumContainsSelectedPoint,ne as checkIfPolygonContainsSelectedPoint,ae as computePolygonForInspection,P as createCoveragePolygon,L as limitZToGround,J as projectVertices,U as resizePolygon,W as updateFrustum};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t}):D(e,t)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,512,512,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=S(l,r.registryId,u);if(d==null){let a=new AbortController,o=r.bandIds?.slice();if(o?.length&&i.isBsqTile){let i=new Set(o),s=[],c=Array.from(i);for(let i of c)s.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:a.signal}));d=Promise.all(s).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==o.length){let t=[];for(let n of o){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:a.signal,transferPixelsToWorker:!0}):M(e)})}else d=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:a.signal});C(l,r.registryId,u,d,a),d.catch(()=>w(l,r.registryId,u))}return r.signal&&o(r,()=>{T(l,r.registryId,u)}),d}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t,n){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t},n):D(e,t,n)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,512,512,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=S(l,r.registryId,u);if(d==null){let a=new AbortController,o=r.bandIds?.slice();if(o?.length&&i.isBsqTile){let i=new Set(o),s=[],c=Array.from(i);for(let i of c)s.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:a.signal}));d=Promise.all(s).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==o.length){let t=[];for(let n of o){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:a.signal,transferPixelsToWorker:!0}):M(e)})}else d=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:a.signal});C(l,r.registryId,u,d,a),d.catch(()=>w(l,r.registryId,u))}return r.signal&&o(r,()=>{T(l,r.registryId,u)}),d}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};