@arcgis/core 4.25.0-next.20220710 → 4.25.0-next.20220713

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 (311) hide show
  1. package/TimeExtent.js +1 -1
  2. package/WebMap.js +1 -1
  3. package/WebScene.js +1 -1
  4. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  5. package/arcade/featureset/support/Guid.js +1 -1
  6. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  7. package/arcade/functions/hash.js +1 -1
  8. package/arcade/lib/scanner.js +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/0543424b0e2a388644b0.js +1 -0
  11. package/assets/esri/core/workers/chunks/{d13951412a57e1af6208.js → 146c0462eb219fa7aec8.js} +1 -1
  12. package/assets/esri/core/workers/chunks/18f176c7de71a3a7247f.js +1 -0
  13. package/assets/esri/core/workers/chunks/196e61d9fc80b0bfd0f2.js +1 -0
  14. package/assets/esri/core/workers/chunks/1993eaa2aa2714bd5b8f.js +1 -0
  15. package/assets/esri/core/workers/chunks/1b3733100b9fa41905d0.js +1 -0
  16. package/assets/esri/core/workers/chunks/2560bb8b4c73ea7d41d3.js +1 -0
  17. package/assets/esri/core/workers/chunks/28124f12fd4ca3f5f07e.js +1 -0
  18. package/assets/esri/core/workers/chunks/2f60073d3f14fdfba457.js +1 -0
  19. package/assets/esri/core/workers/chunks/35f3f714d6faa88b0c0c.js +1 -0
  20. package/assets/esri/core/workers/chunks/3fcb0d2c45e276ce355e.js +1 -0
  21. package/assets/esri/core/workers/chunks/3ff904b02414884d0ed6.js +1 -0
  22. package/assets/esri/core/workers/chunks/{c3459e4b453289f57c2f.js → 405b8535631c30162b01.js} +1 -1
  23. package/assets/esri/core/workers/chunks/40d9c753be00b81d9e79.js +1 -0
  24. package/assets/esri/core/workers/chunks/{591a22aaf068a6e0aabb.js → 4ba51f56f9b82aa616ff.js} +1 -1
  25. package/assets/esri/core/workers/chunks/51dc5863b815a89249ff.js +1 -0
  26. package/assets/esri/core/workers/chunks/{8cdeccb6b67098d6a8d7.js → 54b01d2a4aba08d7e16b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{95cb9cd08941c28ebd85.js → 5821d3a6499d8e84f48a.js} +1 -1
  28. package/assets/esri/core/workers/chunks/5c81523410359692e633.js +1 -0
  29. package/assets/esri/core/workers/chunks/6046ed32c45607afbec3.js +1 -0
  30. package/assets/esri/core/workers/chunks/613fffcc5a1e81f370a6.js +1 -0
  31. package/assets/esri/core/workers/chunks/61ddd479abf2c97dd408.js +1 -0
  32. package/assets/esri/core/workers/chunks/698eaae866cf97a56541.js +1 -0
  33. package/assets/esri/core/workers/chunks/{ecb8d864dd00de322657.js → 6ac72a91978acc0372a3.js} +1 -1
  34. package/assets/esri/core/workers/chunks/733f6ac0f92f29bf552a.js +1 -0
  35. package/assets/esri/core/workers/chunks/{35dfba25a9077ab5dbaf.js → 812f929305f8941886d3.js} +2 -2
  36. package/assets/esri/core/workers/chunks/84790eacac4fe2be1d1a.js +1 -0
  37. package/assets/esri/core/workers/chunks/{357a27203f5d8fa152de.js → 8b94a400a04e7a803dc4.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{35d46e4eeb43c256a63b.js → 8d6fb50fff035f21878b.js} +1 -1
  39. package/assets/esri/core/workers/chunks/9ed019174aaf9e3feb61.js +1 -0
  40. package/assets/esri/core/workers/chunks/ab3bd5fecdb97f2d690e.js +1 -0
  41. package/assets/esri/core/workers/chunks/abd68b7ba3be4696611c.js +1 -0
  42. package/assets/esri/core/workers/chunks/b81c0d35f169a7df25c0.js +1 -0
  43. package/assets/esri/core/workers/chunks/c3c05fd41d88d6ab013b.js +1 -0
  44. package/assets/esri/core/workers/chunks/c4db05de1cd997ee2fac.js +1 -0
  45. package/assets/esri/core/workers/chunks/{d00b0f8236f1526099d4.js → c912ae9afa1997a6e1bb.js} +1 -1
  46. package/assets/esri/core/workers/chunks/e08686088be0aaca1a99.js +1 -0
  47. package/assets/esri/core/workers/chunks/e1d8627d8e241249e3b5.js +1 -0
  48. package/assets/esri/core/workers/chunks/f6df87d05eff63c45481.js +1 -0
  49. package/assets/esri/core/workers/chunks/f82d86013c68374822c8.js +1 -0
  50. package/assets/esri/core/workers/chunks/f96e8724ae3458f5e262.js +1 -0
  51. package/assets/esri/core/workers/chunks/fc6423ca92289c739e19.js +1 -0
  52. package/assets/esri/core/workers/chunks/{f6a6178d4df029ff010d.js → fc8c88ef461629881c62.js} +1 -1
  53. package/core/AsyncSequence.js +1 -1
  54. package/core/AsyncUpdate.js +1 -1
  55. package/core/arrayUtils.js +1 -1
  56. package/core/jsonMap.js +1 -1
  57. package/core/libs/rbush/PooledRBush.js +1 -1
  58. package/core/number.js +1 -1
  59. package/core/sql/WhereClause.js +1 -1
  60. package/core/support/WatchUpdatingTracking.js +1 -1
  61. package/core/workers/Connection.js +1 -1
  62. package/core/workers/RemoteClient.js +1 -1
  63. package/core/workers/loaderConfig.js +1 -1
  64. package/geometry/support/meshUtils/exporters/gltf/buffer.js +1 -1
  65. package/geometry/support/meshUtils/exporters/gltf/bufferview.js +1 -1
  66. package/geometry/support/meshUtils/exporters/gltf/glb.js +1 -1
  67. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  68. package/geometry/support/normalizeUtilsSync.js +1 -1
  69. package/identity/IdentityManagerBase.js +1 -1
  70. package/interfaces.d.ts +6 -2
  71. package/layers/BaseElevationLayer.js +1 -1
  72. package/layers/BaseTileLayer.js +1 -1
  73. package/layers/BuildingSceneLayer.js +1 -1
  74. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  75. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  76. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  77. package/layers/mixins/ArcGISImageService.js +1 -1
  78. package/layers/support/ElevationQuery.js +1 -1
  79. package/layers/support/ElevationSampler.js +1 -1
  80. package/layers/support/ElevationTile.js +1 -1
  81. package/layers/support/ExportImageServiceParameters.js +1 -1
  82. package/layers/support/FetchAssociatedFeatureLayer.js +1 -1
  83. package/layers/support/LayerContingentValuesCache.js +1 -1
  84. package/layers/support/Sublayer.js +1 -1
  85. package/layers/support/TileInfo.js +1 -1
  86. package/layers/support/TileKey.js +5 -0
  87. package/layers/support/TilemapCache.js +1 -1
  88. package/layers/support/rasterFormats/ImageCanvasDecoder.js +1 -1
  89. package/package.json +2 -2
  90. package/renderers/DotDensityRenderer.js +1 -1
  91. package/renderers/HeatmapRenderer.js +1 -1
  92. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  93. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  94. package/support/revision.js +1 -1
  95. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  96. package/symbols/cim/TextRasterizer.js +1 -1
  97. package/views/2d/engine/imagery/BrushRasterBitmap.js +1 -1
  98. package/views/2d/engine/imagery/BrushVectorField.js +1 -1
  99. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  100. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  101. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  102. package/views/2d/engine/webgl/GraphicDisplayList.js +1 -1
  103. package/views/2d/engine/webgl/Painter.js +1 -1
  104. package/views/2d/engine/webgl/TileClipper.js +1 -1
  105. package/views/2d/engine/webgl/TurboLine.js +1 -1
  106. package/views/2d/engine/webgl/brushes/BrushBitmap.js +1 -1
  107. package/views/2d/engine/webgl/brushes/WGLBrush.js +1 -1
  108. package/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js +1 -1
  109. package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
  110. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  111. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  112. package/views/2d/engine/webgl/mesh/templates/WGLBaseMarkerTemplate.js +1 -1
  113. package/views/2d/engine/webgl/mesh/templates/WGLLabelTemplate.js +1 -1
  114. package/views/2d/engine/webgl/painter/RenderPass.js +1 -1
  115. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  116. package/views/2d/input/MapViewInputManager.js +1 -1
  117. package/views/2d/input/handlers/DragPan.js +1 -1
  118. package/views/2d/input/handlers/DragRotate.js +1 -1
  119. package/views/2d/input/handlers/GamepadNavigation.js +1 -1
  120. package/views/2d/input/handlers/PinchAction.js +1 -1
  121. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  122. package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
  123. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  124. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  125. package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
  126. package/views/2d/navigation/actions/Pan.js +1 -1
  127. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  128. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  129. package/views/3d/glTF/internal/BinaryStreamReader.js +1 -1
  130. package/views/3d/glTF/internal/Resource.js +1 -1
  131. package/views/3d/input/SceneInputManager.js +1 -1
  132. package/views/3d/input/handlers/DragRotate.js +1 -1
  133. package/views/3d/input/handlers/DragZoom.js +1 -1
  134. package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
  135. package/views/3d/interactive/Manipulator3D.js +1 -1
  136. package/views/3d/interactive/editingTools/snapping/SnapToScene.js +1 -1
  137. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  138. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  139. package/views/3d/interactive/editingTools/transformGraphic/PreserveAspectRatio.js +1 -1
  140. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
  141. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  142. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  143. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  144. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  145. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  146. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  147. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  148. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  149. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  150. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  151. package/views/3d/layers/GraphicsView3D.js +1 -1
  152. package/views/3d/layers/I3SMeshView3D.js +1 -1
  153. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  154. package/views/3d/layers/RouteLayerView3D.js +1 -1
  155. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  156. package/views/3d/layers/SceneLayerView3D.js +1 -1
  157. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  158. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  159. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DPointSymbol.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  166. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  167. package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
  168. package/views/3d/layers/graphics/Labeler.js +1 -1
  169. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  170. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  171. package/views/3d/layers/i3s/Highlights.js +1 -1
  172. package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
  173. package/views/3d/layers/i3s/I3SElevationProvider.js +1 -1
  174. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  175. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  176. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  177. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  178. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  179. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  180. package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
  181. package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
  182. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  183. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  184. package/views/3d/layers/support/featureReference.js +1 -1
  185. package/views/3d/state/GoToOperation.js +1 -1
  186. package/views/3d/state/NearFarHeuristic.js +1 -1
  187. package/views/3d/state/SurfaceCollisionConstraint.js +1 -1
  188. package/views/3d/state/ViewState.js +1 -1
  189. package/views/3d/state/ViewStateManager.js +1 -1
  190. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  191. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  192. package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +1 -1
  193. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  194. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  195. package/views/3d/state/controllers/momentum/MomentumController.js +1 -1
  196. package/views/3d/state/controllers/momentum/PanPlanarMomentumController.js +1 -1
  197. package/views/3d/state/controllers/momentum/ZoomSphericalMomentumController.js +1 -1
  198. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  199. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  200. package/views/3d/support/LimitGraphicsMap.js +1 -1
  201. package/views/3d/support/SharedSymbolResources.js +1 -1
  202. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  203. package/views/3d/support/pointsOfInterest/ContentGeometryUpdates.js +1 -1
  204. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  205. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  206. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  207. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  208. package/views/3d/terrain/PatchRenderData.js +1 -1
  209. package/views/3d/terrain/PlanarPatch.js +1 -1
  210. package/views/3d/terrain/SphericalPatch.js +1 -1
  211. package/views/3d/terrain/TerrainSurface.js +1 -1
  212. package/views/3d/terrain/tileUtils.js +1 -1
  213. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  214. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  215. package/views/3d/webgl-engine/lib/BitSet.js +1 -1
  216. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  217. package/views/3d/webgl-engine/lib/Highlight.js +1 -1
  218. package/views/3d/webgl-engine/lib/InstanceBufferData.js +1 -1
  219. package/views/3d/webgl-engine/lib/MagnifierHelper.js +1 -1
  220. package/views/3d/webgl-engine/lib/Object3DStateSet.js +1 -1
  221. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  222. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  223. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  224. package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
  225. package/views/3d/webgl-engine/lib/TextureBackedBuffer/ManagedTextureBackedBuffer.js +1 -1
  226. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  227. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  228. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  229. package/views/3d/webgl-engine/lib/edgeRendering/edgeBufferWriters.js +1 -1
  230. package/views/3d/webgl-engine/lib/screenSizePerspectiveUtils.js +1 -1
  231. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  232. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  233. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  234. package/views/3d/webgl-engine/materials/StippleTextureRepository.js +1 -1
  235. package/views/DOMContainer.js +1 -1
  236. package/views/GroundView.js +1 -1
  237. package/views/SceneView.js +1 -1
  238. package/views/ToolViewManager.js +1 -1
  239. package/views/input/BrowserEventSource.js +1 -1
  240. package/views/input/InputManager.js +1 -1
  241. package/views/input/ViewEvents.js +1 -1
  242. package/views/input/recognizers/VerticalTwoFingerDrag.js +1 -1
  243. package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
  244. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  245. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  246. package/views/interactive/snapping/SnappingConstraint.js +1 -1
  247. package/views/interactive/snapping/candidates/LineSnappingCandidate.js +1 -1
  248. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  249. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  250. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  251. package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
  252. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  253. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  254. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  255. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
  256. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js +1 -1
  257. package/views/interactive/snapping/snappingUtils.js +1 -1
  258. package/views/webgl/FramebufferObject.js +1 -1
  259. package/webscene/spec-certification/spec.js +1 -1
  260. package/widgets/AreaMeasurement3D.js +1 -1
  261. package/widgets/BasemapGallery.js +1 -1
  262. package/widgets/Daylight.js +1 -1
  263. package/widgets/DirectLineMeasurement3D.js +1 -1
  264. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  265. package/widgets/Editor/EditorViewModel.js +1 -1
  266. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  267. package/widgets/ElevationProfile.js +1 -1
  268. package/widgets/Feature/FeatureViewModel.js +1 -1
  269. package/widgets/LineOfSight.js +1 -1
  270. package/widgets/Measurement.js +1 -1
  271. package/widgets/Popup.js +1 -1
  272. package/widgets/ScaleRangeSlider/ScaleRanges.js +1 -1
  273. package/widgets/ShadowCast.js +1 -1
  274. package/widgets/Slice/SliceViewModel.js +1 -1
  275. package/widgets/Slice.js +1 -1
  276. package/widgets/Spinner.js +1 -1
  277. package/widgets/Weather.js +1 -1
  278. package/widgets/Widget.js +1 -1
  279. package/widgets/support/DatePicker.js +1 -1
  280. package/assets/esri/core/workers/chunks/009386ed70740f87a014.js +0 -1
  281. package/assets/esri/core/workers/chunks/0273e841e78880e450c5.js +0 -1
  282. package/assets/esri/core/workers/chunks/0703495557b0df6878c5.js +0 -1
  283. package/assets/esri/core/workers/chunks/0c067c59a2a1bb4101f9.js +0 -1
  284. package/assets/esri/core/workers/chunks/1970d7a65832b70f7f5c.js +0 -1
  285. package/assets/esri/core/workers/chunks/1cffa7cf5e10ffbd6eb1.js +0 -1
  286. package/assets/esri/core/workers/chunks/1fe8daa3a0f4fea3a61c.js +0 -1
  287. package/assets/esri/core/workers/chunks/2e4887ba01cf8507e3e3.js +0 -1
  288. package/assets/esri/core/workers/chunks/2ee9ba5b08998b4ddb8e.js +0 -1
  289. package/assets/esri/core/workers/chunks/3a42d96ea3b59d33bfe8.js +0 -1
  290. package/assets/esri/core/workers/chunks/3d36278e4f7b8267b78c.js +0 -1
  291. package/assets/esri/core/workers/chunks/3ee5e8d00cd3bc47a9fa.js +0 -1
  292. package/assets/esri/core/workers/chunks/425e16862feccb467191.js +0 -1
  293. package/assets/esri/core/workers/chunks/4a364bc073fdc7c1b563.js +0 -1
  294. package/assets/esri/core/workers/chunks/4ca6ada7a4ccde5b5a24.js +0 -1
  295. package/assets/esri/core/workers/chunks/6ddaf66e5608deda6811.js +0 -1
  296. package/assets/esri/core/workers/chunks/7574316b3af61c389e8f.js +0 -1
  297. package/assets/esri/core/workers/chunks/792b4b0a43b4bbbc14ab.js +0 -1
  298. package/assets/esri/core/workers/chunks/7ad6721cf0ad76ce5a9d.js +0 -1
  299. package/assets/esri/core/workers/chunks/7b32b8e8ebe48ae0dae2.js +0 -1
  300. package/assets/esri/core/workers/chunks/7f00125b02bb7211de43.js +0 -1
  301. package/assets/esri/core/workers/chunks/95451d6405729a9f50c7.js +0 -1
  302. package/assets/esri/core/workers/chunks/9b9a40b84640f00a1dcb.js +0 -1
  303. package/assets/esri/core/workers/chunks/a07ab40977e06cb58486.js +0 -1
  304. package/assets/esri/core/workers/chunks/a9a459639c82c35ada1f.js +0 -1
  305. package/assets/esri/core/workers/chunks/ac07c732aca6e67232f8.js +0 -1
  306. package/assets/esri/core/workers/chunks/beead2b06c994b4e61af.js +0 -1
  307. package/assets/esri/core/workers/chunks/bfb08d3e2208c6178af9.js +0 -1
  308. package/assets/esri/core/workers/chunks/c4e9c71be6299c60c539.js +0 -1
  309. package/assets/esri/core/workers/chunks/cc5a83f3a2b7c8be5db1.js +0 -1
  310. package/assets/esri/core/workers/chunks/ecaf8f030026e41e1d1a.js +0 -1
  311. package/assets/esri/core/workers/chunks/f135822fceac5ad4667c.js +0 -1
package/TimeExtent.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"./chunks/tslib.es6.js";import{JSONSupport as e}from"./core/JSONSupport.js";import{isSome as r,applySome as s,mapOr as i}from"./core/maybe.js";import{truncateDate as n,offsetDate as o}from"./core/timeUtils.js";import{property as l}from"./core/accessorSupport/decorators/property.js";import"./core/arrayUtils.js";import"./core/has.js";import"./core/accessorSupport/ensureType.js";import{reader as a}from"./core/accessorSupport/decorators/reader.js";import{subclass as m}from"./core/accessorSupport/decorators/subclass.js";import{writer as u}from"./core/accessorSupport/decorators/writer.js";var p;let d=p=class extends e{constructor(t){super(t),this.end=null,this.start=null}static get allTime(){return c}static get empty(){return h}readEnd(t,e){return null!=e.end?new Date(e.end):null}writeEnd(t,e){e.end=t?t.getTime():null}get isAllTime(){return this.equals(p.allTime)}get isEmpty(){return this.equals(p.empty)}readStart(t,e){return null!=e.start?new Date(e.start):null}writeStart(t,e){e.start=t?t.getTime():null}clone(){return new p({end:this.end,start:this.start})}equals(t){if(!t)return!1;const e=r(this.start)?this.start.getTime():this.start,s=r(this.end)?this.end.getTime():this.end,i=r(t.start)?t.start.getTime():t.start,n=r(t.end)?t.end.getTime():t.end;return e===i&&s===n}expandTo(t){if(this.isEmpty||this.isAllTime)return this.clone();const e=s(this.start,(e=>n(e,t))),r=s(this.end,(e=>{const r=n(e,t);return"milliseconds"===t?r:o(r,1,t)}));return new p({start:e,end:r})}intersection(t){if(!t)return this.clone();if(this.isEmpty||t.isEmpty)return p.empty;if(this.isAllTime)return t.clone();if(t.isAllTime)return this.clone();const e=i(this.start,-1/0,(t=>t.getTime())),r=i(this.end,1/0,(t=>t.getTime())),s=i(t.start,-1/0,(t=>t.getTime())),n=i(t.end,1/0,(t=>t.getTime()));let o,l;if(s>=e&&s<=r?o=s:e>=s&&e<=n&&(o=e),r>=s&&r<=n?l=r:n>=e&&n<=r&&(l=n),!isNaN(o)&&!isNaN(l)){const t=new p;return t.start=o===-1/0?null:new Date(o),t.end=l===1/0?null:new Date(l),t}return p.empty}offset(t,e){if(this.isEmpty||this.isAllTime)return this.clone();const s=new p,{start:i,end:n}=this;return r(i)&&(s.start=o(i,t,e)),r(n)&&(s.end=o(n,t,e)),s}union(t){if(!t||t.isEmpty)return this.clone();if(this.isEmpty)return t.clone();if(this.isAllTime||t.isAllTime)return c.clone();const e=r(this.start)&&r(t.start)?new Date(Math.min(this.start.getTime(),t.start.getTime())):null,s=r(this.end)&&r(t.end)?new Date(Math.max(this.end.getTime(),t.end.getTime())):null;return new p({start:e,end:s})}};t([l({type:Date,json:{write:{allowNull:!0}}})],d.prototype,"end",void 0),t([a("end")],d.prototype,"readEnd",null),t([u("end")],d.prototype,"writeEnd",null),t([l({readOnly:!0,json:{read:!1}})],d.prototype,"isAllTime",null),t([l({readOnly:!0,json:{read:!1}})],d.prototype,"isEmpty",null),t([l({type:Date,json:{write:{allowNull:!0}}})],d.prototype,"start",void 0),t([a("start")],d.prototype,"readStart",null),t([u("start")],d.prototype,"writeStart",null),d=p=t([m("esri.TimeExtent")],d);const c=new d,h=new d({start:void 0,end:void 0}),y=d;export{y as default};
5
+ import{_ as t}from"./chunks/tslib.es6.js";import{JSONSupport as e}from"./core/JSONSupport.js";import{isSome as r,applySome as s,mapOr as i}from"./core/maybe.js";import{truncateDate as n,offsetDate as o}from"./core/timeUtils.js";import{property as l}from"./core/accessorSupport/decorators/property.js";import"./core/arrayUtils.js";import"./core/has.js";import"./core/accessorSupport/ensureType.js";import{reader as a}from"./core/accessorSupport/decorators/reader.js";import{subclass as m}from"./core/accessorSupport/decorators/subclass.js";import{writer as u}from"./core/accessorSupport/decorators/writer.js";var p;let d=p=class extends e{constructor(t){super(t),this.end=null,this.start=null}static get allTime(){return c}static get empty(){return h}readEnd(t,e){return null!=e.end?new Date(e.end):null}writeEnd(t,e){e.end=t?t.getTime():null}get isAllTime(){return this.equals(p.allTime)}get isEmpty(){return this.equals(p.empty)}readStart(t,e){return null!=e.start?new Date(e.start):null}writeStart(t,e){e.start=t?t.getTime():null}clone(){return new p({end:this.end,start:this.start})}equals(t){if(!t)return!1;const e=r(this.start)?this.start.getTime():this.start,s=r(this.end)?this.end.getTime():this.end,i=r(t.start)?t.start.getTime():t.start,n=r(t.end)?t.end.getTime():t.end;return e===i&&s===n}expandTo(t){if(this.isEmpty||this.isAllTime)return this.clone();const e=s(this.start,(e=>n(e,t))),r=s(this.end,(e=>{const r=n(e,t);return e.getTime()===r.getTime()?r:o(r,1,t)}));return new p({start:e,end:r})}intersection(t){if(!t)return this.clone();if(this.isEmpty||t.isEmpty)return p.empty;if(this.isAllTime)return t.clone();if(t.isAllTime)return this.clone();const e=i(this.start,-1/0,(t=>t.getTime())),r=i(this.end,1/0,(t=>t.getTime())),s=i(t.start,-1/0,(t=>t.getTime())),n=i(t.end,1/0,(t=>t.getTime()));let o,l;if(s>=e&&s<=r?o=s:e>=s&&e<=n&&(o=e),r>=s&&r<=n?l=r:n>=e&&n<=r&&(l=n),!isNaN(o)&&!isNaN(l)){const t=new p;return t.start=o===-1/0?null:new Date(o),t.end=l===1/0?null:new Date(l),t}return p.empty}offset(t,e){if(this.isEmpty||this.isAllTime)return this.clone();const s=new p,{start:i,end:n}=this;return r(i)&&(s.start=o(i,t,e)),r(n)&&(s.end=o(n,t,e)),s}union(t){if(!t||t.isEmpty)return this.clone();if(this.isEmpty)return t.clone();if(this.isAllTime||t.isAllTime)return c.clone();const e=r(this.start)&&r(t.start)?new Date(Math.min(this.start.getTime(),t.start.getTime())):null,s=r(this.end)&&r(t.end)?new Date(Math.max(this.end.getTime(),t.end.getTime())):null;return new p({start:e,end:s})}};t([l({type:Date,json:{write:{allowNull:!0}}})],d.prototype,"end",void 0),t([a("end")],d.prototype,"readEnd",null),t([u("end")],d.prototype,"writeEnd",null),t([l({readOnly:!0,json:{read:!1}})],d.prototype,"isAllTime",null),t([l({readOnly:!0,json:{read:!1}})],d.prototype,"isEmpty",null),t([l({type:Date,json:{write:{allowNull:!0}}})],d.prototype,"start",void 0),t([a("start")],d.prototype,"readStart",null),t([u("start")],d.prototype,"writeStart",null),d=p=t([m("esri.TimeExtent")],d);const c=new d,h=new d({start:void 0,end:void 0}),T=d;export{T as default};
package/WebMap.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import{flatten as o}from"./core/arrayUtils.js";import a from"./core/Collection.js";import s from"./core/Error.js";import n from"./core/Loadable.js";import{loadAll as l}from"./core/loadAll.js";import p from"./core/Logger.js";import{unwrap as m,isSome as h}from"./core/maybe.js";import{MultiOriginJSONMixin as u,MultiOriginJSONSupport as d}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as c}from"./core/Promise.js";import{eachAlways as y}from"./core/promiseUtils.js";import{whenOnce as g}from"./core/reactiveUtils.js";import{urlToObject as w,isDataProtocol as f,dataComponents as b,addQueryParameter as _}from"./core/urlUtils.js";import{property as v}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/accessorSupport/ensureType.js";import{reader as I}from"./core/accessorSupport/decorators/reader.js";import{subclass as A}from"./core/accessorSupport/decorators/subclass.js";import{writer as S}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as j}from"./core/accessorSupport/originUtils.js";import{readLoadable as L}from"./core/accessorSupport/read.js";import O from"./geometry/SpatialReference.js";import{equals as P}from"./geometry/support/spatialReferenceUtils.js";import{geographicToWebMercator as V,webMercatorToGeographic as U}from"./geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as T}from"./layers/support/arcgisLayerUrl.js";import{isFeatureServiceLayer as F,isFeatureCollectionLayer as R}from"./layers/support/layerUtils.js";import W from"./networks/UtilityNetwork.js";import C from"./portal/Portal.js";import k from"./portal/PortalItem.js";import{removeTypeKeyword as M,addTypeKeyword as N,hasTypeKeyword as x,TypeKeyword as E}from"./portal/support/portalItemUtils.js";import{project as B}from"./rest/geometryService/project.js";import G from"./rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as J,isDeveloperBasemapLayer as D,findSpatialReference as K}from"./support/basemapUtils.js";import $ from"./support/MapFloorInfo.js";import z from"./webdoc/GeotriggersInfo.js";import q from"./webdoc/RangeInfo.js";import H from"./webdoc/Widgets.js";import{getOptimalThumbnailSize as Q}from"./webdoc/support/thumbnailUtils.js";import{getLayerJSON as X}from"./webdoc/support/writeUtils.js";import Y from"./webmap/ApplicationProperties.js";import Z from"./webmap/Bookmark.js";import ee from"./webmap/InitialViewProperties.js";import{Version as te}from"./webmap/Version.js";import re from"./webmap/background/ColorBackground.js";const ie=new te(2,25),oe="Web Map",ae=a.ofType(Z),se=a.ofType(W),ne=new Map;ne.set("image/jpeg","jpeg"),ne.set("image/jpg","jpg"),ne.set("image/png","png"),ne.set("image/gif","gif");const le="ArcGIS Pro",pe=E.JSAPI,me="CollectorDisabled",he="Collector",ue="Data Editing",de="OfflineDisabled",ce="Offline",ye="Workforce Project",ge="Workforce Worker",we="Workforce Dispatcher",fe="Offline Map Areas",be="FieldMapsDisabled",_e=E.DEVELOPER_BASEMAP,ve=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));let Ie=class extends(u(n.LoadableMixin(c(r)))){constructor(e){super(e),this.applicationProperties=null,this.bookmarks=new ae,this.floorInfo=null,this.geotriggersInfo=null,this.initialViewProperties=new ee,this.portalItem=null,this.presentation=null,this.sourceVersion=null,this.widgets=null,this.utilityNetworks=null,this.authoringApp=this.authoringAppVersion=null,this._isAuthoringAppSetByUser=this._isAuthoringAppVersionSetByUser=!1}destroy(){const e=this.portalItem;this.portalItem=null,e?.destroy()}initialize(){if(this.when().catch((e=>{p.getLogger(this.declaredClass).error("#load()","Failed to load web map",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t)}}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp=pe}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}readInitialViewProperties(e,t){const r=new ee;t.background&&(r.background=re.fromJSON(t.background));const o=t.initialState?.viewpoint;if(o){if(o.rotation){te.parse(t.version||"","webmap").lessThan(2,20)&&t.authoringApp===le&&(o.rotation*=-1)}r.viewpoint=i.fromJSON(o)}return t.mapRangeInfo&&(r.rangeInfo=q.fromJSON(t.mapRangeInfo)),t.spatialReference&&(r.spatialReference=O.fromJSON(t.spatialReference)),r}writeInitialViewProperties(e,t,r,i){if(!e)return;const o=e.background;o&&o.color&&(t.background=o.write({},i)),e.viewpoint&&(t.initialState={viewpoint:e.viewpoint.write({},i)}),e.rangeInfo&&(t.mapRangeInfo=e.rangeInfo.toJSON(i)),e.spatialReference&&(t.spatialReference=e.spatialReference.write({},i))}writeLayers(e,t,r,i){t[r]=this._writeLayers(e,i,"operational-layers")}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new te(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${ie.major}.${ie.minor}`}writeTables(e,t,r,i){const o=this._writeLayers(e,i,"tables");o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem&&this.portalItem.thumbnailUrl||null}set thumbnailUrl(e){e?(this._override("thumbnailUrl",e),this._thumbnailFilename=this._generateCustomThumbnailFilename(e)):this._clearThumbnailOverride()}load(e){return this.addResolvingPromise(this._loadFromSource()),Promise.resolve(this)}loadAll(){return l(this,(e=>{e(this.ground,this.basemap,this.layers,this.tables)}))}read(e,t){t={...t,origin:"web-map"};const r=this._getAuthoringPropsState();L(this,e,(t=>super.read(e,t)),t),this._restoreAuthoringPropsFromState(r)}write(e,t){if("loaded"!==this.loadStatus){const e=new s("webmap:not-loaded","Web map must be loaded before it can be serialized");throw p.getLogger(this.declaredClass).error("#toJSON()","Web map must be loaded before it can be serialized",this.loadError||this.loadStatus),e}return this._removeDanglingLayerRefs(),t={...t,origin:"web-map",restrictedWebMapWriting:!0,webmap:this},super.write(e,t)}async save(e){e=e||{},this._validateItem(),await this._updateFromPromise,await this.load(),await this._loadLayerContainers(),await this._beforeSave(),await this._validateMap();const t=this.portalItem,r={origin:"web-map",messages:[],writtenProperties:[],url:t.itemUrl&&w(t.itemUrl),portal:t.portal||C.getDefault()},i=this.write({},r);return this._validateJSONForWriting(r,e),await this._updateItemProperties(t),await this._updateItem(t,i,r),await this._updateItemThumbnail(),t}async saveAs(e,t){t=t||{};const r=this._getPortalItem(e);await this._updateFromPromise,await this.load(),await this._loadLayerContainers(),await this._beforeSave(),await this._validateMap();const i={origin:"web-map",messages:[],writtenProperties:[],url:null,portal:r.portal},o=this.write({},i);this._validateJSONForWriting(i,t),await this._updateItemPropertiesForSaveAs(r);const a=this._getThumbnailState();return await this._createItem(r,o,i,t),this._restoreThumbnailFromState(a),await this._updateItemThumbnail(),r}async updateFrom(e,t){const r=this._updateFromInternal(e,t);this._updateFromPromise=r,await r;r===this._updateFromPromise&&(this._updateFromPromise=null)}getLayerJSONFromResourceInfo(e){const t=this.resourceInfo;return this._collectAllLayersJSON(o([t?.baseMap?.baseMapLayers,t?.operationalLayers,this.basemap?.resourceInfo?.data?.baseMapLayers])).find((t=>t.id===e.id))}_collectAllLayersJSON(e){return e.reduce(((e,t)=>(e.push(t),"GroupLayer"===t.layerType&&(e=e.concat(this._collectAllLayersJSON(t.layers||[]))),e)),[])}_writeLayers(e,t,r){t={...t,layerContainerType:r};return e.map((e=>m(X(e,"tables"===r?null:this.getLayerJSONFromResourceInfo(e),t)))).filter(Boolean).toArray()}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-map"}):this.portalItem&&this.portalItem.id?this._loadFromItem(this.portalItem):Promise.resolve(null)}_loadFromItem(e){return e.load().catch((e=>{throw new s("webmap:load-portal-item","Failed to load portal item",{error:e})})).then((()=>{if("Web Map"!==e.type)throw new s("webmap:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Map'",{type:e.type})})).then((()=>e.fetchData())).then((t=>(this.resourceInfo=t,this._readAndLoadFromJSON(t,{origin:"web-map",portal:e.portal||C.getDefault()})))).then((()=>this._computeInitialViewpoint()))}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_validateJSON(e){const t=te.parse(e.version||"","webmap");return ie.validate(t),e.version=`${t.major}.${t.minor}`,e}_loadFromJSON(e,t){const r={context:{...t,layerContainerType:"operational-layers"}};return this.portalItem&&(r.context.portal=this.portalItem.portal||C.getDefault()),import("./layers/support/layersCreator.js").then((({populateOperationalLayers:t})=>{const i=[],o=e.operationalLayers;o&&o.length&&i.push(t(this.layers,o,r));const a={...r,context:{...r.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"},s=e.tables;return s&&s.length&&i.push(t(this.tables,s,a)),y(i).then((()=>{}))}))}async _computeInitialViewpoint(){let e=this.initialViewProperties;const t=e?.viewpoint?.targetGeometry;if(t)return;const r=await this._getExtentFromItem();r&&(e=e?e.clone():new ee,e.viewpoint=new i,e.viewpoint.targetGeometry=r,this.initialViewProperties=e)}async _getExtentFromItem(){const e=this.initialViewProperties?.spatialReference,t=this.portalItem?.extent;if(e&&t){if(e.isWGS84)return t.clone();if(e.isWebMercator)return V(t);return(await import("./portal/support/geometryServiceUtils.js")).getGeometryServiceURL(this.portalItem).then((r=>{const i=new G;return i.geometries=[t],i.outSpatialReference=e,B(r,i)})).then((e=>e[0])).catch((e=>(p.getLogger(this.declaredClass).error("Error projecting item's extent:",e),null)))}return null}_removeDanglingLayerRefs(){const e=this.applicationProperties,t=e&&e.viewing&&e.viewing.search,r=e=>this.allLayers.some((t=>t.id===e));t&&t.layers&&(t.layers=t.layers.filter((e=>r(e.id)))),t&&t.tables&&(t.tables=t.tables.filter((e=>this.tables.some((t=>t.id===e.id)))));const i=e&&e.editing&&e.editing.locationTracking;i&&i.info&&!r(i.info.layerId)&&(e.editing=null);const o=this.presentation&&this.presentation.slides;o&&o.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>r(e.id))))}))}async _validateMap(){if(!this.basemap?.baseLayers.length)throw new s("webmap:save","Map does not have a valid basemap with a base layer.");let e=null;if(await g((()=>{const t=K(this.initialViewProperties,this.basemap);return e=t.spatialReference,!t.updating})),!P(e,this.initialViewProperties.spatialReference))throw new s("webmap:save","The spatial reference of the basemap is not compatible with the one from the map.",{expected:this.initialViewProperties.spatialReference,actual:e})}_validateItem(){if(!this.portalItem)throw p.getLogger(this.declaredClass).error("save: requires the portalItem property to be set"),new s("webmap:portal-item-not-set","Portal item to save to has not been set on the WebMap");this._validateItemType(this.portalItem)}_validateItemType(e){if(e.type!==oe)throw new s("webmap:portal-item-wrong-type",`Portal item needs to have type "${oe}"`)}_loadLayerContainers(){const e=[];return this.basemap&&e.push(this.basemap.load()),this.ground&&e.push(this.ground.load()),y(e).then((()=>{}))}async _beforeSave(){const e=[];for(const t of this.allLayers)if("beforeSave"in t&&"function"==typeof t.beforeSave){const r=t.beforeSave();r&&e.push(r)}await y(e)}_loadAllLayers(){const e=this._getAllLayersAndTables().map((e=>e.load()));return y(e).then((()=>{}))}_getAllLayersAndTables(){return this.allLayers.concat(this.allTables)}_validateJSONForWriting(e,t){let r=e.messages.filter((e=>"error"===e.type)).map((e=>new s(e.name,e.message,e.details)));if(t.ignoreUnsupported&&(r=r.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name))),r.length>0)throw new s("webmap:save","Failed to save webmap due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:r})}async _updateItemProperties(e){e.extent=await this._getWGS84Extent(this.initialViewProperties.viewpoint.targetGeometry),await this._updateTypeKeywords(e)}async _updateItemPropertiesForSaveAs(e){M(e,me),M(e,be),M(e,E.METADATA),M(e,de),M(e,fe),M(e,we),M(e,ye),M(e,ge),await this._updateItemProperties(e)}async _getWGS84Extent(e){const t=e.clone().normalize();let r;if(t.length>1)for(const i of t)r?i.width>r.width&&(r=i):r=i;else r=t[0];return this._projectToWGS84(r)}async _projectToWGS84(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return U(e);const r=await import("./portal/support/geometryServiceUtils.js"),i=await r.getGeometryServiceURL(this.portalItem),o=new G;o.geometries=[e],o.outSpatialReference=O.WGS84;return(await B(i,o))[0]}async _updateTypeKeywords(e){N(e,pe),await this._loadAllLayers(),this._evalCollectorKeyword(e),this._evalDataEditingKeyword(e),this._evalOfflineKeyword(e),this._evalDeveloperBasemapKeyword(e),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}_evalCollectorKeyword(e){x(e,me)||x(e,ye)||x(e,ge)||x(e,we)||!this._hasEditableFeatureLayer()?M(e,he):N(e,he)}_evalDataEditingKeyword(e){this._hasEditableFeatureLayer()?N(e,ue):M(e,ue)}_evalOfflineKeyword(e){!x(e,de)&&this._isOfflineCapableMap()?N(e,ce):M(e,ce)}_evalDeveloperBasemapKeyword(e){J(this.basemap)?N(e,_e):M(e,_e)}_hasEditableFeatureLayer(){return this._getAllLayersAndTables().some((e=>e.loaded&&F(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled))}_isOfflineCapableMap(){return this._getAllLayersAndTables().filter((e=>"group"!==e.type)).every((e=>e.loaded&&this._isOfflineCapableLayer(e)))}_isFeatureCollectionLike(e){return R(e)||"map-notes"===e.type||"route"===e.type}_isOfflineCapableLayer(e){return F(e)&&e.capabilities.operations.supportsSync||this._isFeatureCollectionLike(e)&&!e.portalItem||("tile"===e.type||"vector-tile"===e.type)&&(e.capabilities.operations.supportsExportTiles||this._isExportableAGOLTileLayer(e)||D(e))&&e.spatialReference.equals(this.initialViewProperties.spatialReference)}_isExportableAGOLTileLayer(e){return"tile"===e.type&&(T(e.url)&&ve.some((t=>e.url.toLowerCase().includes("/"+t+"/"))))}async _updateItem(e,t,r){await e.update({data:t}),this._syncUpInstanceWithItem(e,t,r)}async _createItem(e,t,r,i){const o=this.portalItem,a=!!(o&&o.id&&o.portal.user),n=e.portal;if(await n._signIn(),!await this._canCopyItem(o,a,n))throw new s("webmap:save-as-copy-not-allowed","Owner of this map does not allow others to save a copy");await n.user.addItem({item:e,folder:i.folder,data:t}),this.portalItem=e,this._syncUpInstanceWithItem(e,t,r)}async _canCopyItem(e,t,r){return!(h(e)&&e.id&&e.typeKeywords&&e.typeKeywords.includes("useOnly"))||e.portal.portalHostname===r.portalHostname&&(t||await e.reload(),"admin"===e.itemControl||"update"===e.itemControl)}_syncUpInstanceWithItem(e,t,r){d.prototype.read.call(this,{version:t.version,authoringApp:t.authoringApp,authoringAppVersion:t.authoringAppVersion},{origin:"web-map",ignoreDefaults:!0,url:e.itemUrl&&w(e.itemUrl)}),j(r),this.resourceInfo=t}async _updateItemThumbnail(){this.thumbnailUrl&&this._isOverridden("thumbnailUrl")&&(await this.portalItem.updateThumbnail({thumbnail:this.thumbnailUrl,filename:this._thumbnailFilename}),this._clearThumbnailOverride())}_getPortalItem(e){let t=k.from(e);return t.id&&(t=t.clone(),t.id=null),t.type||(t.type=oe),t.portal||(t.portal=C.getDefault()),this._validateItemType(t),t}async _updateFromInternal(e,t){if(t=t||{},await g((()=>e.ready)),this._updateInitialViewProperties(e,t),e.map===this)for(const r of e.allLayerViews)for(const e of["visible","featureEffect"])e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e]);await this._updateThumbnailUrl(e,t)}_updateInitialViewProperties(e,t){if(t.backgroundExcluded||(this.initialViewProperties.background=e.background?.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),t.viewpointExcluded||(this.initialViewProperties.viewpoint=new i({rotation:e.rotation,scale:t.scalePreserved?e.scale:null,targetGeometry:this._getViewExtent(e)})),!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this)}_getViewExtent(e){const t=e.center.clone().normalize(),r=e.extent.clone(),i=r.width/2;return r.xmin=t.x-i,r.xmax=t.x+i,r}async _updateThumbnailUrl(e,t){if(t.thumbnailExcluded)return;const r=Q(e,t.thumbnailSize),i=await e.takeScreenshot({format:"png",width:r.width,height:r.height});this._setAutoGeneratedThumbnail(i.dataUrl)}_setAutoGeneratedThumbnail(e){this.thumbnailUrl=e,this._thumbnailFilename=null}_clearThumbnailOverride(){this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"),this._thumbnailFilename=null}_generateCustomThumbnailFilename(e){if(f(e)){const t=b(e),r=t&&t.mediaType,i=r&&ne.get(r.toLowerCase())||null,o=`thumbnail${Date.now()}`;return i?`${o}.${i}`:o}return null}_getThumbnailState(){let e=this.thumbnailUrl;return e&&(e=this._isOverridden("thumbnailUrl")?e:_(e,"w","8192")),{thumbnailUrl:e,filename:this._thumbnailFilename}}_restoreThumbnailFromState(e){this.thumbnailUrl=e.thumbnailUrl,this._thumbnailFilename=e.filename}_getAuthoringPropsState(){return{authoringApp:this.authoringApp,authoringAppVersion:this.authoringAppVersion,isAuthoringAppSetByUser:this._isAuthoringAppSetByUser,isAuthoringAppVersionSetByUser:this._isAuthoringAppVersionSetByUser}}_restoreAuthoringPropsFromState(e){e.isAuthoringAppSetByUser?this.authoringApp=e.authoringApp:this._isAuthoringAppSetByUser=!1,e.isAuthoringAppVersionSetByUser?this.authoringAppVersion=e.authoringAppVersion:this._isAuthoringAppVersionSetByUser=!1}static fromJSON(e){const t=e;if(!t)throw new s("webmap:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:t})}};Ie.VERSION=ie,e([v({type:Y,json:{write:!0}})],Ie.prototype,"applicationProperties",void 0),e([v({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],Ie.prototype,"authoringApp",null),e([S("authoringApp")],Ie.prototype,"writeAuthoringApp",null),e([v({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],Ie.prototype,"authoringAppVersion",null),e([S("authoringAppVersion")],Ie.prototype,"writeAuthoringAppVersion",null),e([v({json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],Ie.prototype,"basemap",void 0),e([v({type:ae,json:{write:{overridePolicy:e=>({enabled:!!(e&&e.length>0),ignoreOrigin:!0})}}})],Ie.prototype,"bookmarks",void 0),e([v({type:$,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],Ie.prototype,"floorInfo",void 0),e([v({type:z,json:{write:!0}})],Ie.prototype,"geotriggersInfo",void 0),e([v({type:ee,nonNullable:!0,json:{read:{source:["background","initialState.viewpoint","mapRangeInfo","spatialReference"]},write:{ignoreOrigin:!0,target:{background:{type:re},"initialState.viewpoint":{type:i},mapRangeInfo:{type:q},spatialReference:{type:O}}}}})],Ie.prototype,"initialViewProperties",void 0),e([I("initialViewProperties")],Ie.prototype,"readInitialViewProperties",null),e([S("initialViewProperties")],Ie.prototype,"writeInitialViewProperties",null),e([v({json:{read:!1,write:{target:"operationalLayers",ignoreOrigin:!0}}})],Ie.prototype,"layers",void 0),e([S("layers")],Ie.prototype,"writeLayers",null),e([v({type:k})],Ie.prototype,"portalItem",void 0),e([v({json:{write:!0}})],Ie.prototype,"presentation",void 0),e([v()],Ie.prototype,"resourceInfo",void 0),e([v({readOnly:!0,type:te,json:{read:{source:"version"},write:{allowNull:!0,ignoreOrigin:!0,target:"version",isRequired:!0}}})],Ie.prototype,"sourceVersion",void 0),e([I("sourceVersion")],Ie.prototype,"readSourceVersion",null),e([S("sourceVersion")],Ie.prototype,"writeSourceVersion",null),e([v({json:{read:!1,write:{ignoreOrigin:!0}}})],Ie.prototype,"tables",void 0),e([S("tables")],Ie.prototype,"writeTables",null),e([v()],Ie.prototype,"thumbnailUrl",null),e([v({type:H,json:{write:!0}})],Ie.prototype,"widgets",void 0),e([v({type:se,json:{read:!0,write:!0}})],Ie.prototype,"utilityNetworks",void 0),Ie=e([A("esri.WebMap")],Ie);const Ae=Ie;export{Ae as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import a from"./core/Error.js";import s from"./core/Loadable.js";import{loadAll as n}from"./core/loadAll.js";import l from"./core/Logger.js";import{unwrap as p,isSome as m}from"./core/maybe.js";import{MultiOriginJSONMixin as h,MultiOriginJSONSupport as u}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as d}from"./core/Promise.js";import{eachAlways as c}from"./core/promiseUtils.js";import{whenOnce as y}from"./core/reactiveUtils.js";import{urlToObject as g,isDataProtocol as w,dataComponents as f,addQueryParameter as b}from"./core/urlUtils.js";import{property as _}from"./core/accessorSupport/decorators/property.js";import"./core/arrayUtils.js";import"./core/has.js";import"./core/accessorSupport/ensureType.js";import{reader as v}from"./core/accessorSupport/decorators/reader.js";import{subclass as I}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as S}from"./core/accessorSupport/originUtils.js";import{readLoadable as j}from"./core/accessorSupport/read.js";import L from"./geometry/SpatialReference.js";import{equals as O}from"./geometry/support/spatialReferenceUtils.js";import{geographicToWebMercator as P,webMercatorToGeographic as V}from"./geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as U}from"./layers/support/arcgisLayerUrl.js";import{isFeatureServiceLayer as T,isFeatureCollectionLayer as F}from"./layers/support/layerUtils.js";import R from"./networks/UtilityNetwork.js";import W from"./portal/Portal.js";import C from"./portal/PortalItem.js";import{removeTypeKeyword as k,addTypeKeyword as M,hasTypeKeyword as N,TypeKeyword as x}from"./portal/support/portalItemUtils.js";import{project as E}from"./rest/geometryService/project.js";import B from"./rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as G,isDeveloperBasemapLayer as J,findSpatialReference as D}from"./support/basemapUtils.js";import K from"./support/MapFloorInfo.js";import $ from"./webdoc/GeotriggersInfo.js";import z from"./webdoc/RangeInfo.js";import q from"./webdoc/Widgets.js";import{getOptimalThumbnailSize as H}from"./webdoc/support/thumbnailUtils.js";import{getLayerJSON as Q}from"./webdoc/support/writeUtils.js";import X from"./webmap/ApplicationProperties.js";import Y from"./webmap/Bookmark.js";import Z from"./webmap/InitialViewProperties.js";import{Version as ee}from"./webmap/Version.js";import te from"./webmap/background/ColorBackground.js";const re=new ee(2,25),ie="Web Map",oe=o.ofType(Y),ae=o.ofType(R),se=new Map;se.set("image/jpeg","jpeg"),se.set("image/jpg","jpg"),se.set("image/png","png"),se.set("image/gif","gif");const ne="ArcGIS Pro",le=x.JSAPI,pe="CollectorDisabled",me="Collector",he="Data Editing",ue="OfflineDisabled",de="Offline",ce="Workforce Project",ye="Workforce Worker",ge="Workforce Dispatcher",we="Offline Map Areas",fe="FieldMapsDisabled",be=x.DEVELOPER_BASEMAP,_e=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));let ve=class extends(h(s.LoadableMixin(d(r)))){constructor(e){super(e),this.applicationProperties=null,this.bookmarks=new oe,this.floorInfo=null,this.geotriggersInfo=null,this.initialViewProperties=new Z,this.portalItem=null,this.presentation=null,this.sourceVersion=null,this.widgets=null,this.utilityNetworks=null,this.authoringApp=this.authoringAppVersion=null,this._isAuthoringAppSetByUser=this._isAuthoringAppVersionSetByUser=!1}destroy(){const e=this.portalItem;this.portalItem=null,e?.destroy()}initialize(){if(this.when().catch((e=>{l.getLogger(this.declaredClass).error("#load()","Failed to load web map",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t)}}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp=le}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}readInitialViewProperties(e,t){const r=new Z;t.background&&(r.background=te.fromJSON(t.background));const o=t.initialState?.viewpoint;if(o){if(o.rotation){ee.parse(t.version||"","webmap").lessThan(2,20)&&t.authoringApp===ne&&(o.rotation*=-1)}r.viewpoint=i.fromJSON(o)}return t.mapRangeInfo&&(r.rangeInfo=z.fromJSON(t.mapRangeInfo)),t.spatialReference&&(r.spatialReference=L.fromJSON(t.spatialReference)),r}writeInitialViewProperties(e,t,r,i){if(!e)return;const o=e.background;o&&o.color&&(t.background=o.write({},i)),e.viewpoint&&(t.initialState={viewpoint:e.viewpoint.write({},i)}),e.rangeInfo&&(t.mapRangeInfo=e.rangeInfo.toJSON(i)),e.spatialReference&&(t.spatialReference=e.spatialReference.write({},i))}writeLayers(e,t,r,i){t[r]=this._writeLayers(e,i,"operational-layers")}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new ee(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${re.major}.${re.minor}`}writeTables(e,t,r,i){const o=this._writeLayers(e,i,"tables");o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem&&this.portalItem.thumbnailUrl||null}set thumbnailUrl(e){e?(this._override("thumbnailUrl",e),this._thumbnailFilename=this._generateCustomThumbnailFilename(e)):this._clearThumbnailOverride()}load(e){return this.addResolvingPromise(this._loadFromSource()),Promise.resolve(this)}loadAll(){return n(this,(e=>{e(this.ground,this.basemap,this.layers,this.tables)}))}read(e,t){t={...t,origin:"web-map"};const r=this._getAuthoringPropsState();j(this,e,(t=>super.read(e,t)),t),this._restoreAuthoringPropsFromState(r)}write(e,t){if("loaded"!==this.loadStatus){const e=new a("webmap:not-loaded","Web map must be loaded before it can be serialized");throw l.getLogger(this.declaredClass).error("#toJSON()","Web map must be loaded before it can be serialized",this.loadError||this.loadStatus),e}return this._removeDanglingLayerRefs(),t={...t,origin:"web-map",restrictedWebMapWriting:!0,webmap:this},super.write(e,t)}async save(e){e=e||{},this._validateItem(),await this._updateFromPromise,await this.load(),await this._loadLayerContainers(),await this._beforeSave(),await this._validateMap();const t=this.portalItem,r={origin:"web-map",messages:[],writtenProperties:[],url:t.itemUrl&&g(t.itemUrl),portal:t.portal||W.getDefault()},i=this.write({},r);return this._validateJSONForWriting(r,e),await this._updateItemProperties(t),await this._updateItem(t,i,r),await this._updateItemThumbnail(),t}async saveAs(e,t){t=t||{};const r=this._getPortalItem(e);await this._updateFromPromise,await this.load(),await this._loadLayerContainers(),await this._beforeSave(),await this._validateMap();const i={origin:"web-map",messages:[],writtenProperties:[],url:null,portal:r.portal},o=this.write({},i);this._validateJSONForWriting(i,t),await this._updateItemPropertiesForSaveAs(r);const a=this._getThumbnailState();return await this._createItem(r,o,i,t),this._restoreThumbnailFromState(a),await this._updateItemThumbnail(),r}async updateFrom(e,t){const r=this._updateFromInternal(e,t);this._updateFromPromise=r,await r;r===this._updateFromPromise&&(this._updateFromPromise=null)}getLayerJSONFromResourceInfo(e){const t=this.resourceInfo;return this._collectAllLayersJSON([...t?.baseMap?.baseMapLayers||[],...t?.operationalLayers||[],...this.basemap?.resourceInfo?.data?.baseMapLayers||[]]).find((t=>t.id===e.id))}_collectAllLayersJSON(e){return e.reduce(((e,t)=>(e.push(t),"GroupLayer"===t.layerType&&(e=e.concat(this._collectAllLayersJSON(t.layers||[]))),e)),[])}_writeLayers(e,t,r){t={...t,layerContainerType:r};return e.map((e=>p(Q(e,"tables"===r?null:this.getLayerJSONFromResourceInfo(e),t)))).filter(Boolean).toArray()}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-map"}):this.portalItem&&this.portalItem.id?this._loadFromItem(this.portalItem):Promise.resolve(null)}_loadFromItem(e){return e.load().catch((e=>{throw new a("webmap:load-portal-item","Failed to load portal item",{error:e})})).then((()=>{if("Web Map"!==e.type)throw new a("webmap:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Map'",{type:e.type})})).then((()=>e.fetchData())).then((t=>(this.resourceInfo=t,this._readAndLoadFromJSON(t,{origin:"web-map",portal:e.portal||W.getDefault()})))).then((()=>this._computeInitialViewpoint()))}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_validateJSON(e){const t=ee.parse(e.version||"","webmap");return re.validate(t),e.version=`${t.major}.${t.minor}`,e}_loadFromJSON(e,t){const r={context:{...t,layerContainerType:"operational-layers"}};return this.portalItem&&(r.context.portal=this.portalItem.portal||W.getDefault()),import("./layers/support/layersCreator.js").then((({populateOperationalLayers:t})=>{const i=[],o=e.operationalLayers;o&&o.length&&i.push(t(this.layers,o,r));const a={...r,context:{...r.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"},s=e.tables;return s&&s.length&&i.push(t(this.tables,s,a)),c(i).then((()=>{}))}))}async _computeInitialViewpoint(){let e=this.initialViewProperties;const t=e?.viewpoint?.targetGeometry;if(t)return;const r=await this._getExtentFromItem();r&&(e=e?e.clone():new Z,e.viewpoint=new i,e.viewpoint.targetGeometry=r,this.initialViewProperties=e)}async _getExtentFromItem(){const e=this.initialViewProperties?.spatialReference,t=this.portalItem?.extent;if(e&&t){if(e.isWGS84)return t.clone();if(e.isWebMercator)return P(t);return(await import("./portal/support/geometryServiceUtils.js")).getGeometryServiceURL(this.portalItem).then((r=>{const i=new B;return i.geometries=[t],i.outSpatialReference=e,E(r,i)})).then((e=>e[0])).catch((e=>(l.getLogger(this.declaredClass).error("Error projecting item's extent:",e),null)))}return null}_removeDanglingLayerRefs(){const e=this.applicationProperties,t=e&&e.viewing&&e.viewing.search,r=e=>this.allLayers.some((t=>t.id===e));t&&t.layers&&(t.layers=t.layers.filter((e=>r(e.id)))),t&&t.tables&&(t.tables=t.tables.filter((e=>this.tables.some((t=>t.id===e.id)))));const i=e&&e.editing&&e.editing.locationTracking;i&&i.info&&!r(i.info.layerId)&&(e.editing=null);const o=this.presentation&&this.presentation.slides;o&&o.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>r(e.id))))}))}async _validateMap(){if(!this.basemap?.baseLayers.length)throw new a("webmap:save","Map does not have a valid basemap with a base layer.");let e=null;if(await y((()=>{const t=D(this.initialViewProperties,this.basemap);return e=t.spatialReference,!t.updating})),!O(e,this.initialViewProperties.spatialReference))throw new a("webmap:save","The spatial reference of the basemap is not compatible with the one from the map.",{expected:this.initialViewProperties.spatialReference,actual:e})}_validateItem(){if(!this.portalItem)throw l.getLogger(this.declaredClass).error("save: requires the portalItem property to be set"),new a("webmap:portal-item-not-set","Portal item to save to has not been set on the WebMap");this._validateItemType(this.portalItem)}_validateItemType(e){if(e.type!==ie)throw new a("webmap:portal-item-wrong-type",`Portal item needs to have type "${ie}"`)}_loadLayerContainers(){const e=[];return this.basemap&&e.push(this.basemap.load()),this.ground&&e.push(this.ground.load()),c(e).then((()=>{}))}async _beforeSave(){const e=[];for(const t of this.allLayers)if("beforeSave"in t&&"function"==typeof t.beforeSave){const r=t.beforeSave();r&&e.push(r)}await c(e)}_loadAllLayers(){const e=this._getAllLayersAndTables().map((e=>e.load()));return c(e).then((()=>{}))}_getAllLayersAndTables(){return this.allLayers.concat(this.allTables)}_validateJSONForWriting(e,t){let r=e.messages.filter((e=>"error"===e.type)).map((e=>new a(e.name,e.message,e.details)));if(t.ignoreUnsupported&&(r=r.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name))),r.length>0)throw new a("webmap:save","Failed to save webmap due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:r})}async _updateItemProperties(e){e.extent=await this._getWGS84Extent(this.initialViewProperties.viewpoint.targetGeometry),await this._updateTypeKeywords(e)}async _updateItemPropertiesForSaveAs(e){k(e,pe),k(e,fe),k(e,x.METADATA),k(e,ue),k(e,we),k(e,ge),k(e,ce),k(e,ye),await this._updateItemProperties(e)}async _getWGS84Extent(e){const t=e.clone().normalize();let r;if(t.length>1)for(const i of t)r?i.width>r.width&&(r=i):r=i;else r=t[0];return this._projectToWGS84(r)}async _projectToWGS84(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return V(e);const r=await import("./portal/support/geometryServiceUtils.js"),i=await r.getGeometryServiceURL(this.portalItem),o=new B;o.geometries=[e],o.outSpatialReference=L.WGS84;return(await E(i,o))[0]}async _updateTypeKeywords(e){M(e,le),await this._loadAllLayers(),this._evalCollectorKeyword(e),this._evalDataEditingKeyword(e),this._evalOfflineKeyword(e),this._evalDeveloperBasemapKeyword(e),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}_evalCollectorKeyword(e){N(e,pe)||N(e,ce)||N(e,ye)||N(e,ge)||!this._hasEditableFeatureLayer()?k(e,me):M(e,me)}_evalDataEditingKeyword(e){this._hasEditableFeatureLayer()?M(e,he):k(e,he)}_evalOfflineKeyword(e){!N(e,ue)&&this._isOfflineCapableMap()?M(e,de):k(e,de)}_evalDeveloperBasemapKeyword(e){G(this.basemap)?M(e,be):k(e,be)}_hasEditableFeatureLayer(){return this._getAllLayersAndTables().some((e=>e.loaded&&T(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled))}_isOfflineCapableMap(){return this._getAllLayersAndTables().filter((e=>"group"!==e.type)).every((e=>e.loaded&&this._isOfflineCapableLayer(e)))}_isFeatureCollectionLike(e){return F(e)||"map-notes"===e.type||"route"===e.type}_isOfflineCapableLayer(e){return T(e)&&e.capabilities.operations.supportsSync||this._isFeatureCollectionLike(e)&&!e.portalItem||("tile"===e.type||"vector-tile"===e.type)&&(e.capabilities.operations.supportsExportTiles||this._isExportableAGOLTileLayer(e)||J(e))&&e.spatialReference.equals(this.initialViewProperties.spatialReference)}_isExportableAGOLTileLayer(e){return"tile"===e.type&&(U(e.url)&&_e.some((t=>e.url.toLowerCase().includes("/"+t+"/"))))}async _updateItem(e,t,r){await e.update({data:t}),this._syncUpInstanceWithItem(e,t,r)}async _createItem(e,t,r,i){const o=this.portalItem,s=!!(o&&o.id&&o.portal.user),n=e.portal;if(await n._signIn(),!await this._canCopyItem(o,s,n))throw new a("webmap:save-as-copy-not-allowed","Owner of this map does not allow others to save a copy");await n.user.addItem({item:e,folder:i.folder,data:t}),this.portalItem=e,this._syncUpInstanceWithItem(e,t,r)}async _canCopyItem(e,t,r){return!(m(e)&&e.id&&e.typeKeywords&&e.typeKeywords.includes("useOnly"))||e.portal.portalHostname===r.portalHostname&&(t||await e.reload(),"admin"===e.itemControl||"update"===e.itemControl)}_syncUpInstanceWithItem(e,t,r){u.prototype.read.call(this,{version:t.version,authoringApp:t.authoringApp,authoringAppVersion:t.authoringAppVersion},{origin:"web-map",ignoreDefaults:!0,url:e.itemUrl&&g(e.itemUrl)}),S(r),this.resourceInfo=t}async _updateItemThumbnail(){this.thumbnailUrl&&this._isOverridden("thumbnailUrl")&&(await this.portalItem.updateThumbnail({thumbnail:this.thumbnailUrl,filename:this._thumbnailFilename}),this._clearThumbnailOverride())}_getPortalItem(e){let t=C.from(e);return t.id&&(t=t.clone(),t.id=null),t.type||(t.type=ie),t.portal||(t.portal=W.getDefault()),this._validateItemType(t),t}async _updateFromInternal(e,t){if(t=t||{},await y((()=>e.ready)),this._updateInitialViewProperties(e,t),e.map===this)for(const r of e.allLayerViews)for(const e of["visible","featureEffect"])e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e]);await this._updateThumbnailUrl(e,t)}_updateInitialViewProperties(e,t){if(t.backgroundExcluded||(this.initialViewProperties.background=e.background?.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),t.viewpointExcluded||(this.initialViewProperties.viewpoint=new i({rotation:e.rotation,scale:t.scalePreserved?e.scale:null,targetGeometry:this._getViewExtent(e)})),!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this)}_getViewExtent(e){const t=e.center.clone().normalize(),r=e.extent.clone(),i=r.width/2;return r.xmin=t.x-i,r.xmax=t.x+i,r}async _updateThumbnailUrl(e,t){if(t.thumbnailExcluded)return;const r=H(e,t.thumbnailSize),i=await e.takeScreenshot({format:"png",width:r.width,height:r.height});this._setAutoGeneratedThumbnail(i.dataUrl)}_setAutoGeneratedThumbnail(e){this.thumbnailUrl=e,this._thumbnailFilename=null}_clearThumbnailOverride(){this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"),this._thumbnailFilename=null}_generateCustomThumbnailFilename(e){if(w(e)){const t=f(e),r=t&&t.mediaType,i=r&&se.get(r.toLowerCase())||null,o=`thumbnail${Date.now()}`;return i?`${o}.${i}`:o}return null}_getThumbnailState(){let e=this.thumbnailUrl;return e&&(e=this._isOverridden("thumbnailUrl")?e:b(e,"w","8192")),{thumbnailUrl:e,filename:this._thumbnailFilename}}_restoreThumbnailFromState(e){this.thumbnailUrl=e.thumbnailUrl,this._thumbnailFilename=e.filename}_getAuthoringPropsState(){return{authoringApp:this.authoringApp,authoringAppVersion:this.authoringAppVersion,isAuthoringAppSetByUser:this._isAuthoringAppSetByUser,isAuthoringAppVersionSetByUser:this._isAuthoringAppVersionSetByUser}}_restoreAuthoringPropsFromState(e){e.isAuthoringAppSetByUser?this.authoringApp=e.authoringApp:this._isAuthoringAppSetByUser=!1,e.isAuthoringAppVersionSetByUser?this.authoringAppVersion=e.authoringAppVersion:this._isAuthoringAppVersionSetByUser=!1}static fromJSON(e){const t=e;if(!t)throw new a("webmap:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:t})}};ve.VERSION=re,e([_({type:X,json:{write:!0}})],ve.prototype,"applicationProperties",void 0),e([_({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],ve.prototype,"authoringApp",null),e([A("authoringApp")],ve.prototype,"writeAuthoringApp",null),e([_({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],ve.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],ve.prototype,"writeAuthoringAppVersion",null),e([_({json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],ve.prototype,"basemap",void 0),e([_({type:oe,json:{write:{overridePolicy:e=>({enabled:!!(e&&e.length>0),ignoreOrigin:!0})}}})],ve.prototype,"bookmarks",void 0),e([_({type:K,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],ve.prototype,"floorInfo",void 0),e([_({type:$,json:{write:!0}})],ve.prototype,"geotriggersInfo",void 0),e([_({type:Z,nonNullable:!0,json:{read:{source:["background","initialState.viewpoint","mapRangeInfo","spatialReference"]},write:{ignoreOrigin:!0,target:{background:{type:te},"initialState.viewpoint":{type:i},mapRangeInfo:{type:z},spatialReference:{type:L}}}}})],ve.prototype,"initialViewProperties",void 0),e([v("initialViewProperties")],ve.prototype,"readInitialViewProperties",null),e([A("initialViewProperties")],ve.prototype,"writeInitialViewProperties",null),e([_({json:{read:!1,write:{target:"operationalLayers",ignoreOrigin:!0}}})],ve.prototype,"layers",void 0),e([A("layers")],ve.prototype,"writeLayers",null),e([_({type:C})],ve.prototype,"portalItem",void 0),e([_({json:{write:!0}})],ve.prototype,"presentation",void 0),e([_()],ve.prototype,"resourceInfo",void 0),e([_({readOnly:!0,type:ee,json:{read:{source:"version"},write:{allowNull:!0,ignoreOrigin:!0,target:"version",isRequired:!0}}})],ve.prototype,"sourceVersion",void 0),e([v("sourceVersion")],ve.prototype,"readSourceVersion",null),e([A("sourceVersion")],ve.prototype,"writeSourceVersion",null),e([_({json:{read:!1,write:{ignoreOrigin:!0}}})],ve.prototype,"tables",void 0),e([A("tables")],ve.prototype,"writeTables",null),e([_()],ve.prototype,"thumbnailUrl",null),e([_({type:q,json:{write:!0}})],ve.prototype,"widgets",void 0),e([_({type:ae,json:{read:!0,write:!0}})],ve.prototype,"utilityNetworks",void 0),ve=e([I("esri.WebMap")],ve);const Ie=ve;export{Ie as default};
package/WebScene.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import s from"./core/Error.js";import a from"./core/Handles.js";import"./core/has.js";import{clone as n}from"./core/lang.js";import l from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import c from"./core/Logger.js";import{isSome as d}from"./core/maybe.js";import{MultiOriginJSONMixin as h,MultiOriginJSONSupport as u}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as m}from"./core/Promise.js";import{debounce as y,eachAlways as w}from"./core/promiseUtils.js";import{urlToObject as g,addQueryParameter as f}from"./core/urlUtils.js";import{property as v}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import{reader as b}from"./core/accessorSupport/decorators/reader.js";import{subclass as S}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as I}from"./core/accessorSupport/originUtils.js";import{readLoadable as _}from"./core/accessorSupport/read.js";import j from"./geometry/Extent.js";import R from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as L}from"./geometry/projection.js";import P from"./geometry/SpatialReference.js";import{validateWebSceneError as V}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as U}from"./geometry/support/jsonUtils.js";import{isEarth as M}from"./geometry/support/spatialReferenceUtils.js";import O from"./portal/Portal.js";import E from"./portal/PortalItem.js";import C from"./support/MapFloorInfo.js";import{createSchemaValidationError as N,createCopyError as T}from"./support/webSceneUtils.js";import{ViewingMode as G}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as F}from"./views/support/spatialReferenceSupport.js";import{saveResources as $}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as W}from"./webdoc/support/thumbnailUtils.js";import J from"./webscene/ApplicationProperties.js";import x from"./webscene/Environment.js";import k from"./webscene/InitialViewProperties.js";import B from"./webscene/Presentation.js";import q from"./webscene/TransportationNetwork.js";import{Version as K}from"./webscene/Version.js";const D=new K(1,29),H=()=>{const e=8,t=[],r=D.major;for(let i=e;i<=D.minor;i++)t.push(`${r}.${i}`);return t},z="Web Scene",Q="ViewingMode-Local";let X=class extends(l.LoadableMixin(m(h(r)))){constructor(e){super(e),this._handles=new a,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=null,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new B,this.initialViewProperties=new k,this.portalItem=null,this.resourceInfo=null,this._debouncedSaveOperations=y((async(e,t,r)=>{switch(e){case Y.SAVE:return this._saveImpl(t);case Y.SAVE_AS:return this._saveAsImpl(r,t)}})),this.resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{c.getLogger(this.declaredClass).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this._handles.add(this.allLayers.on("change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this._handles.destroy(),this.presentation&&this.presentation.destroy();const e=this.portalItem;this.portalItem=null,e?.destroy()}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){const o={...i,layerContainerType:"operational-layers"},s=e.map((e=>this.verifyWriteLayer(e,i)?e.write({},o):null)).filter((e=>!!e));t[r]=s.toArray()}verifyWriteLayer(e,t){return"write"in e||(t&&t.messages&&t.messages.push(new s("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new K(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${D.major}.${D.minor}`}get thumbnailUrl(){return this.portalItem&&this.portalItem.thumbnailUrl||null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t){const r={};return t.initialState&&t.initialState.environment&&(r.environment=x.fromJSON(t.initialState.environment)),t.spatialReference?r.spatialReference=P.fromJSON(t.spatialReference):r.spatialReference=P.WebMercator,r.viewingMode=t.viewingMode||"global",t.initialState&&t.initialState.viewpoint&&(r.viewpoint=i.fromJSON(t.initialState.viewpoint)),new k(r)}get spatialReference(){return this.initialViewProperties?.spatialReference??P.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){return this.addResolvingPromise(this._loadFromSource()),Promise.resolve(this)}loadAll(){return p(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)))}))}read(e,t){t={...t,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(_(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=(e,t)=>e.visibleLayers.some((e=>e.id===t)),o=t.filter((e=>!r.some((t=>i(t,e.id)))));r.forEach((e=>{e.visibleLayers.addMany(o)}))}}_writeBasemapElevationLayers(e){const t=e.ground&&e.ground.layers;!e.baseMap&&t&&t.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=n(t))}write(e,t){if("loaded"!==this.loadStatus){const e=new s("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw c.getLogger(this.declaredClass).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages.filter((e=>"web-document-write:property-required"===e.name));if(e.length){const t=new s("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw c.getLogger(this.declaredClass).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(Y.SAVE,e)}async _saveImpl(e){this.portalItem||(c.getLogger(this.declaredClass).error("save(): requires the .portalItem property to be set"),await Promise.reject(new s("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene"))),this.portalItem.type!==z&&await Promise.reject(new s("webscene:portal-item-wrong-type",`Portal item needs to have type "${z}"`));const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:this.portalItem.itemUrl&&g(this.portalItem.itemUrl),messages:[],portal:this.portalItem.portal||O.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,e),this._updateTypeKeywords(this.portalItem),await this.portalItem.update({data:i}),await $(this.resourceReferences,r,null),I(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(Y.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=E.from(e);r||(c.getLogger(this.declaredClass).error("saveAs(portalItem): requires a portal item parameter"),await Promise.reject(new s("webscene:portal-item-required","saveAs requires a portal item to save to"))),r.id&&(r=r.clone(),r.id=null);const i=r.portal||O.getDefault();await this._ensureLoadBeforeSave(),r.type=z,r.portal=i;const o=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:null,messages:[],portal:i,portalItem:r,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),a=this.write({},o);await Promise.all(o.resources.pendingOperations),await this._verifySaveAs(a,o,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");return this._updateTypeKeywords(r),await i._signIn(),await i.user.addItem({item:r,folder:t&&t.folder,data:a}),await $(this.resourceReferences,o,null),this.portalItem=r,u.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl&&g(r.itemUrl)}),I(o),n&&(this.thumbnailUrl=l?f(n,"w","8192"):n),o.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await this.portalItem.updateThumbnail({thumbnail:this.thumbnailUrl}),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}_verifySave(e,t,r,i=!1){if(!M(this.spatialReference))return Promise.reject(new s("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently."));let o,a=t.messages.filter((e=>"error"===e.type)).map((e=>new s(e.name,e.message,e.details)));t.blockedRelativeUrls&&(a=a.concat(t.blockedRelativeUrls.map((e=>new s("url:unsupported",`Relative url '${e}' is not supported in Web Scene`))))),r&&r.ignoreUnsupported&&(a=a.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name&&"scenemodification:unsupported"!==e.name))),r?.requiredPropertyChecksDisabled&&(a=a.filter((e=>"web-document-write:property-required"!==e.name)));const n=r&&r.strictSchemaValidationEnabled;return o=n?import("./webscene/support/schemaValidator.js").then((t=>{const r=t.validate(e);if(r.length>0){const e=`webscene did not validate:\n${r.join("\n")}`;c.getLogger(this.declaredClass).error(`${i?"saveAs":"save"}(): ${e}`)}return r.map((e=>new s("webscene:schema-validation",e)))})).then((e=>{if(n&&e.length>0){throw N(e.concat(a))}return a})):Promise.resolve(a),o.then((e=>{if(e.length>0)throw new s("webscene:save","Failed to save webscene due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:e})}))}_verifySaveAs(e,t,r){return this.canNotSaveAs(t)?Promise.reject(T()):this._verifySave(e,t,r,!0)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(e){return e||(e=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),this.write({},e)),e.verifyItemRelativeUrls&&e.verifyItemRelativeUrls.writtenUrls.length>0}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=x.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,d(e.clippingArea)?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this._updateFromThumbnail(e,t.thumbnailSize||void 0)}async _updateFromThumbnail(e,t){const r=W(e,t),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):this.portalItem&&this.portalItem.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}_loadFromJSON(e,t){const r=new o;return this._validateSpatialReference().then((()=>this._validateHeightModelInfo())).then((()=>import("./layers/support/layersCreator.js"))).then((({populateOperationalLayers:i})=>{const{operationalLayers:o,operationalElevationLayers:s,basemapElevationLayers:a}=this._extractOperationalLayers(e),n=[],l={context:{...t,layerContainerType:"operational-layers"}};if(this.portalItem&&(l.context.portal=this.portalItem.portal||O.getDefault()),a.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(i(this.ground.layers,a,e))}if(s.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(i(r,s,e))}return o&&o.length>0&&n.push(i(this.layers,o,l)),w(n).then((()=>{}))})).then((()=>this._loadObjectsWithLayers())).then((()=>{this.ground.layers.addMany(r)}))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[];for(const t of this.allLayers.items)if("beforeSave"in t&&"function"==typeof t.beforeSave){const r=t.beforeSave();r&&e.push(r)}await w(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await w(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new s("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new s("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-scene",url:g(e.itemUrl),portal:e.portal||O.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(t,r),this.resourceReferences={portalItem:e,paths:r.readResourcePaths}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!F(t,G.Global))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||L(e,t)}else{if(!F(t,G.Local))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e&&(d(e.camera)&&e.camera.position&&e.camera.position.spatialReference||d(e.targetGeometry)&&e.targetGeometry.spatialReference),o=e.viewpoint,a=i(o);if(a&&!r(a))return Promise.reject(new s("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new s("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=V(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateJSON(e){const t=K.parse(e.version||"","webscene");return D.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=P.WebMercator.toJSON()),e}_updateTypeKeywords(e){"local"===this.initialViewProperties.viewingMode?e.typeKeywords?e.typeKeywords.includes(Q)||e.typeKeywords.push(Q):e.typeKeywords=[Q]:"global"===this.initialViewProperties.viewingMode&&e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter((e=>e!==Q))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||P.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem&&this.portalItem.itemUrl?g(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties&&this.applicationProperties.viewing&&this.applicationProperties.viewing.search,t=e=>this.allLayers.some((t=>t.id===e));e&&e.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new s("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}};var Y;X.version=`${D.major}.${D.minor}`,e([v({type:J,json:{write:!0}})],X.prototype,"applicationProperties",void 0),e([v({json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],X.prototype,"basemap",void 0),e([v({type:j,json:{read:{source:"clippingArea.geometry",reader:U},write:{target:"clippingArea.geometry"}}})],X.prototype,"clippingArea",void 0),e([A("clippingArea")],X.prototype,"writeClippingArea",null),e([v({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],X.prototype,"clippingEnabled",void 0),e([b("clippingEnabled",["clippingArea"])],X.prototype,"readClippingEnabled",null),e([A("clippingEnabled")],X.prototype,"writeClippingEnabled",null),e([v({type:C,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],X.prototype,"floorInfo",void 0),e([v({type:R,json:{write:!0}})],X.prototype,"heightModelInfo",void 0),e([v({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],X.prototype,"layers",void 0),e([A("layers")],X.prototype,"writeLayers",null),e([v({readOnly:!0,type:K,json:{type:H(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],X.prototype,"sourceVersion",void 0),e([b("sourceVersion",["version"])],X.prototype,"readSourceVersion",null),e([A("sourceVersion")],X.prototype,"writeSourceVersion",null),e([v({json:{read:!1,write:!1}})],X.prototype,"tables",void 0),e([v()],X.prototype,"thumbnailUrl",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],X.prototype,"authoringApp",null),e([A("authoringApp")],X.prototype,"writeAuthoringApp",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],X.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],X.prototype,"writeAuthoringAppVersion",null),e([v({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],X.prototype,"ground",void 0),e([A("ground")],X.prototype,"writeGround",null),e([v({type:o.ofType(q),json:{write:!0}})],X.prototype,"transportationNetworks",void 0),e([v({type:B,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],X.prototype,"presentation",void 0),e([v({type:k,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new k({viewingMode:"global",spatialReference:P.WebMercator})}})],X.prototype,"initialViewProperties",void 0),e([b("initialViewProperties",["initialState.environment","spatialReference","viewingMode","initialState.viewpoint"])],X.prototype,"readInitialViewProperties",null),e([v({type:P,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],X.prototype,"spatialReference",null),e([v({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],X.prototype,"viewingMode",null),e([v({type:E})],X.prototype,"portalItem",void 0),e([v()],X.prototype,"resourceInfo",void 0),X=e([S("esri.WebScene")],X),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(Y||(Y={}));const Z=X;export{Z as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import s from"./core/Error.js";import a from"./core/Handles.js";import"./core/has.js";import{clone as n}from"./core/lang.js";import l from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import c from"./core/Logger.js";import{isSome as d}from"./core/maybe.js";import{MultiOriginJSONMixin as h,MultiOriginJSONSupport as u}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as m}from"./core/Promise.js";import{debounce as y,eachAlways as w}from"./core/promiseUtils.js";import{urlToObject as g,addQueryParameter as f}from"./core/urlUtils.js";import{property as v}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import{reader as b}from"./core/accessorSupport/decorators/reader.js";import{subclass as S}from"./core/accessorSupport/decorators/subclass.js";import{writer as _}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as A}from"./core/accessorSupport/originUtils.js";import{readLoadable as I}from"./core/accessorSupport/read.js";import j from"./geometry/Extent.js";import R from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as L}from"./geometry/projection.js";import P from"./geometry/SpatialReference.js";import{validateWebSceneError as V}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as U}from"./geometry/support/jsonUtils.js";import{isEarth as M}from"./geometry/support/spatialReferenceUtils.js";import O from"./portal/Portal.js";import E from"./portal/PortalItem.js";import C from"./support/MapFloorInfo.js";import{createSchemaValidationError as N,createCopyError as T}from"./support/webSceneUtils.js";import{ViewingMode as G}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as F}from"./views/support/spatialReferenceSupport.js";import{saveResources as $}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as W}from"./webdoc/support/thumbnailUtils.js";import J from"./webscene/ApplicationProperties.js";import x from"./webscene/Environment.js";import k from"./webscene/InitialViewProperties.js";import B from"./webscene/Presentation.js";import q from"./webscene/TransportationNetwork.js";import{Version as K}from"./webscene/Version.js";const D=new K(1,29),H=()=>{const e=8,t=[],r=D.major;for(let i=e;i<=D.minor;i++)t.push(`${r}.${i}`);return t},z="Web Scene",Q="ViewingMode-Local";let X=class extends(l.LoadableMixin(m(h(r)))){constructor(e){super(e),this._handles=new a,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=null,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new B,this.initialViewProperties=new k,this.portalItem=null,this.resourceInfo=null,this._debouncedSaveOperations=y((async(e,t,r)=>{switch(e){case Y.SAVE:return this._saveImpl(t);case Y.SAVE_AS:return this._saveAsImpl(r,t)}})),this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{c.getLogger(this.declaredClass).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this._handles.add(this.allLayers.on("change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this._handles.destroy(),this.presentation&&this.presentation.destroy();const e=this.portalItem;this.portalItem=null,e?.destroy()}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){const o={...i,layerContainerType:"operational-layers"},s=e.map((e=>this.verifyWriteLayer(e,i)?e.write({},o):null)).filter((e=>!!e));t[r]=s.toArray()}verifyWriteLayer(e,t){return"write"in e||(t&&t.messages&&t.messages.push(new s("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new K(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${D.major}.${D.minor}`}get thumbnailUrl(){return this.portalItem&&this.portalItem.thumbnailUrl||null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t){const r={};return t.initialState&&t.initialState.environment&&(r.environment=x.fromJSON(t.initialState.environment)),t.spatialReference?r.spatialReference=P.fromJSON(t.spatialReference):r.spatialReference=P.WebMercator,r.viewingMode=t.viewingMode||"global",t.initialState&&t.initialState.viewpoint&&(r.viewpoint=i.fromJSON(t.initialState.viewpoint)),new k(r)}get spatialReference(){return this.initialViewProperties?.spatialReference??P.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){return this.addResolvingPromise(this._loadFromSource()),Promise.resolve(this)}loadAll(){return p(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)))}))}read(e,t){t={...t,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(I(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=(e,t)=>e.visibleLayers.some((e=>e.id===t)),o=t.filter((e=>!r.some((t=>i(t,e.id)))));r.forEach((e=>{e.visibleLayers.addMany(o)}))}}_writeBasemapElevationLayers(e){const t=e.ground&&e.ground.layers;!e.baseMap&&t&&t.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=n(t))}write(e,t){if("loaded"!==this.loadStatus){const e=new s("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw c.getLogger(this.declaredClass).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages.filter((e=>"web-document-write:property-required"===e.name));if(e.length){const t=new s("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw c.getLogger(this.declaredClass).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(Y.SAVE,e)}async _saveImpl(e){this.portalItem||(c.getLogger(this.declaredClass).error("save(): requires the .portalItem property to be set"),await Promise.reject(new s("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene"))),this.portalItem.type!==z&&await Promise.reject(new s("webscene:portal-item-wrong-type",`Portal item needs to have type "${z}"`));const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:this.portalItem.itemUrl&&g(this.portalItem.itemUrl),messages:[],portal:this.portalItem.portal||O.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,e),this._updateTypeKeywords(this.portalItem),await this.portalItem.update({data:i}),await $(this._resourceReferences,r,null),A(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(Y.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=E.from(e);r||(c.getLogger(this.declaredClass).error("saveAs(portalItem): requires a portal item parameter"),await Promise.reject(new s("webscene:portal-item-required","saveAs requires a portal item to save to"))),r.id&&(r=r.clone(),r.id=null);const i=r.portal||O.getDefault();await this._ensureLoadBeforeSave(),r.type=z,r.portal=i;const o=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:null,messages:[],portal:i,portalItem:r,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),a=this.write({},o);await Promise.all(o.resources.pendingOperations),await this._verifySaveAs(a,o,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");return this._updateTypeKeywords(r),await i._signIn(),await i.user.addItem({item:r,folder:t&&t.folder,data:a}),await $(this._resourceReferences,o,null),this.portalItem=r,u.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl&&g(r.itemUrl)}),A(o),n&&(this.thumbnailUrl=l?f(n,"w","8192"):n),o.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await this.portalItem.updateThumbnail({thumbnail:this.thumbnailUrl}),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}_verifySave(e,t,r,i=!1){if(!M(this.spatialReference))return Promise.reject(new s("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently."));let o,a=t.messages.filter((e=>"error"===e.type)).map((e=>new s(e.name,e.message,e.details)));t.blockedRelativeUrls&&(a=a.concat(t.blockedRelativeUrls.map((e=>new s("url:unsupported",`Relative url '${e}' is not supported in Web Scene`))))),r&&r.ignoreUnsupported&&(a=a.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name&&"scenemodification:unsupported"!==e.name))),r?.requiredPropertyChecksDisabled&&(a=a.filter((e=>"web-document-write:property-required"!==e.name)));const n=r&&r.strictSchemaValidationEnabled;return o=n?import("./webscene/support/schemaValidator.js").then((t=>{const r=t.validate(e);if(r.length>0){const e=`webscene did not validate:\n${r.join("\n")}`;c.getLogger(this.declaredClass).error(`${i?"saveAs":"save"}(): ${e}`)}return r.map((e=>new s("webscene:schema-validation",e)))})).then((e=>{if(n&&e.length>0){throw N(e.concat(a))}return a})):Promise.resolve(a),o.then((e=>{if(e.length>0)throw new s("webscene:save","Failed to save webscene due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:e})}))}_verifySaveAs(e,t,r){return this.canNotSaveAs(t)?Promise.reject(T()):this._verifySave(e,t,r,!0)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(e){return e||(e=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),this.write({},e)),e.verifyItemRelativeUrls&&e.verifyItemRelativeUrls.writtenUrls.length>0}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=x.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,d(e.clippingArea)?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this._updateFromThumbnail(e,t.thumbnailSize||void 0)}async _updateFromThumbnail(e,t){const r=W(e,t),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):this.portalItem&&this.portalItem.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}_loadFromJSON(e,t){const r=new o;return this._validateSpatialReference().then((()=>this._validateHeightModelInfo())).then((()=>import("./layers/support/layersCreator.js"))).then((({populateOperationalLayers:i})=>{const{operationalLayers:o,operationalElevationLayers:s,basemapElevationLayers:a}=this._extractOperationalLayers(e),n=[],l={context:{...t,layerContainerType:"operational-layers"}};if(this.portalItem&&(l.context.portal=this.portalItem.portal||O.getDefault()),a.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(i(this.ground.layers,a,e))}if(s.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(i(r,s,e))}return o&&o.length>0&&n.push(i(this.layers,o,l)),w(n).then((()=>{}))})).then((()=>this._loadObjectsWithLayers())).then((()=>{this.ground.layers.addMany(r)}))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[];for(const t of this.allLayers.items)if("beforeSave"in t&&"function"==typeof t.beforeSave){const r=t.beforeSave();r&&e.push(r)}await w(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await w(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new s("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new s("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-scene",url:g(e.itemUrl),portal:e.portal||O.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(t,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!F(t,G.Global))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||L(e,t)}else{if(!F(t,G.Local))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e&&(d(e.camera)&&e.camera.position&&e.camera.position.spatialReference||d(e.targetGeometry)&&e.targetGeometry.spatialReference),o=e.viewpoint,a=i(o);if(a&&!r(a))return Promise.reject(new s("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new s("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=V(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateJSON(e){const t=K.parse(e.version||"","webscene");return D.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=P.WebMercator.toJSON()),e}_updateTypeKeywords(e){"local"===this.initialViewProperties.viewingMode?e.typeKeywords?e.typeKeywords.includes(Q)||e.typeKeywords.push(Q):e.typeKeywords=[Q]:"global"===this.initialViewProperties.viewingMode&&e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter((e=>e!==Q))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||P.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem&&this.portalItem.itemUrl?g(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties&&this.applicationProperties.viewing&&this.applicationProperties.viewing.search,t=e=>this.allLayers.some((t=>t.id===e));e&&e.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new s("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}};var Y;X.version=`${D.major}.${D.minor}`,e([v({type:J,json:{write:!0}})],X.prototype,"applicationProperties",void 0),e([v({json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],X.prototype,"basemap",void 0),e([v({type:j,json:{read:{source:"clippingArea.geometry",reader:U},write:{target:"clippingArea.geometry"}}})],X.prototype,"clippingArea",void 0),e([_("clippingArea")],X.prototype,"writeClippingArea",null),e([v({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],X.prototype,"clippingEnabled",void 0),e([b("clippingEnabled",["clippingArea"])],X.prototype,"readClippingEnabled",null),e([_("clippingEnabled")],X.prototype,"writeClippingEnabled",null),e([v({type:C,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],X.prototype,"floorInfo",void 0),e([v({type:R,json:{write:!0}})],X.prototype,"heightModelInfo",void 0),e([v({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],X.prototype,"layers",void 0),e([_("layers")],X.prototype,"writeLayers",null),e([v({readOnly:!0,type:K,json:{type:H(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],X.prototype,"sourceVersion",void 0),e([b("sourceVersion",["version"])],X.prototype,"readSourceVersion",null),e([_("sourceVersion")],X.prototype,"writeSourceVersion",null),e([v({json:{read:!1,write:!1}})],X.prototype,"tables",void 0),e([v()],X.prototype,"thumbnailUrl",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],X.prototype,"authoringApp",null),e([_("authoringApp")],X.prototype,"writeAuthoringApp",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],X.prototype,"authoringAppVersion",null),e([_("authoringAppVersion")],X.prototype,"writeAuthoringAppVersion",null),e([v({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],X.prototype,"ground",void 0),e([_("ground")],X.prototype,"writeGround",null),e([v({type:o.ofType(q),json:{write:!0}})],X.prototype,"transportationNetworks",void 0),e([v({type:B,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],X.prototype,"presentation",void 0),e([v({type:k,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new k({viewingMode:"global",spatialReference:P.WebMercator})}})],X.prototype,"initialViewProperties",void 0),e([b("initialViewProperties",["initialState.environment","spatialReference","viewingMode","initialState.viewpoint"])],X.prototype,"readInitialViewProperties",null),e([v({type:P,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],X.prototype,"spatialReference",null),e([v({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],X.prototype,"viewingMode",null),e([v({type:E})],X.prototype,"portalItem",void 0),e([v()],X.prototype,"resourceInfo",void 0),X=e([S("esri.WebScene")],X),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(Y||(Y={}));const Z=X;export{Z as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import t from"../support/FeatureSet.js";import i from"../support/IdSet.js";import{defaultMaxRecords as r,IdState as s}from"../support/shared.js";import a from"../../../rest/support/RelationshipQuery.js";class n extends t{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,this.relatedLayer=null,this.relationship=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this.relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return r}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this.relatedLayer.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this.relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this.relatedLayer.geometryType,this.fields=this.relatedLayer.fields.slice(0),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const r of this._overrideFields)if(r.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this.relatedLayer.objectIdField,this.globalIdField=this.relatedLayer.globalIdField,this.hasM=this.relatedLayer.supportsM,this.hasZ=this.relatedLayer.supportsZ,this.typeIdField=this.relatedLayer.typeIdField,this.types=this.relatedLayer.types}async databaseType(){return await this.relatedLayer.databaseType(),this._databaseType=this.relatedLayer._databaseType,this._databaseType}isTable(){return this.relatedLayer.isTable()}_isInFeatureSet(){return s.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(t){const i={};for(const e of this.fields)i[e.name]=t.attributes[e.name];return new e({geometry:!0===this._removeGeometry?null:t.geometry,attributes:i})}async _getFilteredSet(e,t,r,s,n){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e){return new i([],[],!0,null)}const l=this._layer.nativeCapabilities();if(!1===l.canQueryRelated){return new i([],[],!0,null)}if(l.capabilities.queryRelated&&l.capabilities.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,r,s,n);let d="",o=!1;null!==s&&l.capabilities&&l.capabilities.queryRelated&&!0===l.capabilities.queryRelated.supportsOrderBy&&(d=s.constructClause(),o=!0);const u=new a;u.objectIds=[this._findObjectId];const h=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this.relatedLayer.fields?this.relatedLayer.fields.map((e=>e.name)):["*"]);u.outFields=h,u.relationshipId=this.relationship.id,u.where="1=1";let c=!0;!0===this._removeGeometry&&(c=!1),u.returnGeometry=c,this._requestStandardised&&(u.sqlFormat="standard"),u.outSpatialReference=this.spatialReference,u.orderByFields=""!==d?d.split(","):null;const y=await l.source.queryRelatedFeatures(u);this._checkCancelled(n);const p=y[this._findObjectId]?y[this._findObjectId].features:[],f=[];for(let i=0;i<p.length;i++)this._featureCache[p[i].attributes[this.relatedLayer.objectIdField]]=p[i],f.push(p[i].attributes[this.relatedLayer.objectIdField]);const g=t&&null!==e&&""!==e,_=null!=r;return new i(g||_?f:[],g||_?[]:f,o,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const r of t)if(r.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,r,s,a){let n="",l=!1;const d=this._layer.nativeCapabilities();null!==s&&d&&d.capabilities.queryRelated&&!0===d.capabilities.queryRelated.supportsOrderBy&&(n=s.constructClause(),l=!0),await this.databaseType();const o="1=1";let u=this._maxQueryRate();const h=d.capabilities.query.maxRecordCount;void 0!==h&&h<u&&(u=h);const c=t&&null!==e&&""!==e,y=null!=r;let p=null,f=!0;!0===this._removeGeometry&&(f=!1);const g=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this.relatedLayer.fields?this.relatedLayer.fields.map((e=>e.name)):["*"]);return p=new i(c||y?["GETPAGES"]:[],c||y?[]:["GETPAGES"],l,{outFields:g.join(","),resultRecordCount:u,resultOffset:0,objectIds:[this._findObjectId],where:o,orderByFields:n,returnGeometry:f,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(p,u,0,0,a),p}_expandPagedSet(e,t,i,r,s){return this._expandPagedSetFeatureSet(e,t,i,r,s)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const r=e.pagesDefinition.internal.lastRetrieved,s=r,n=e.pagesDefinition.internal.lastPage,l=this._layer.nativeCapabilities(),d=new a;!0===this._requestStandardised&&(d.sqlFormat="standard"),d.relationshipId=this.relationship.id,d.objectIds=e.pagesDefinition.objectIds,d.resultOffset=e.pagesDefinition.internal.lastPage,d.resultRecordCount=e.pagesDefinition.resultRecordCount,d.outFields=e.pagesDefinition.outFields.split(","),d.where=e.pagesDefinition.where,d.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,d.returnGeometry=e.pagesDefinition.returnGeometry,d.outSpatialReference=this.spatialReference;const o=await l.source.queryRelatedFeatures(d);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let a=0;a<u.length;a++)e.pagesDefinition.internal.set[s+a]=u[a].attributes[this.relatedLayer.objectIdField];for(let a=0;a<u.length;a++)this._featureCache[u[a].attributes[this.relatedLayer.objectIdField]]=u[a];const h=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&h&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,r){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);const a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,r),this._getFeatures(e,t,i,r);let n=0;for(let l=e._lastFetchedIndex;l<e._known.length&&(n++,n<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[l]&&void 0===this._featureCache[e._known[l]]&&(e._known[l]!==t&&s.push(e._known[l]),s.length>i)))&&!(n>=i&&0===s.length);l++);if(0===s.length)return"success";throw new Error("Unaccounted for Features. Not in Feature Collection")}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,r,s,a,n){return{calculated:!1}}get gdbVersion(){return this.relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,r,s){return!1}relationshipMetaData(){return this.relatedLayer.relationshipMetaData()}serviceUrl(){return this.relatedLayer.serviceUrl()}queryAttachments(e,t,i,r,s){return this.relatedLayer.queryAttachments(e,t,i,r,s)}getFeatureByObjectId(e,t){return this.relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this.relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this.relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this.relatedLayer}}export{n as default};
5
+ import e from"../../../Graphic.js";import t from"../support/FeatureSet.js";import i from"../support/IdSet.js";import{defaultMaxRecords as r,IdState as s}from"../support/shared.js";import a from"../../../rest/support/RelationshipQuery.js";class n extends t{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,this._relatedLayer=null,this.relationship=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return r}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this._relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._relatedLayer.geometryType,this.fields=this._relatedLayer.fields.slice(0),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const r of this._overrideFields)if(r.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return s.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(t){const i={};for(const e of this.fields)i[e.name]=t.attributes[e.name];return new e({geometry:!0===this._removeGeometry?null:t.geometry,attributes:i})}async _getFilteredSet(e,t,r,s,n){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e){return new i([],[],!0,null)}const l=this._layer.nativeCapabilities();if(!1===l.canQueryRelated){return new i([],[],!0,null)}if(l.capabilities.queryRelated&&l.capabilities.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,r,s,n);let d="",o=!1;null!==s&&l.capabilities&&l.capabilities.queryRelated&&!0===l.capabilities.queryRelated.supportsOrderBy&&(d=s.constructClause(),o=!0);const u=new a;u.objectIds=[this._findObjectId];const h=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);u.outFields=h,u.relationshipId=this.relationship.id,u.where="1=1";let c=!0;!0===this._removeGeometry&&(c=!1),u.returnGeometry=c,this._requestStandardised&&(u.sqlFormat="standard"),u.outSpatialReference=this.spatialReference,u.orderByFields=""!==d?d.split(","):null;const y=await l.source.queryRelatedFeatures(u);this._checkCancelled(n);const p=y[this._findObjectId]?y[this._findObjectId].features:[],_=[];for(let i=0;i<p.length;i++)this._featureCache[p[i].attributes[this._relatedLayer.objectIdField]]=p[i],_.push(p[i].attributes[this._relatedLayer.objectIdField]);const f=t&&null!==e&&""!==e,g=null!=r;return new i(f||g?_:[],f||g?[]:_,o,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const r of t)if(r.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,r,s,a){let n="",l=!1;const d=this._layer.nativeCapabilities();null!==s&&d&&d.capabilities.queryRelated&&!0===d.capabilities.queryRelated.supportsOrderBy&&(n=s.constructClause(),l=!0),await this.databaseType();const o="1=1";let u=this._maxQueryRate();const h=d.capabilities.query.maxRecordCount;void 0!==h&&h<u&&(u=h);const c=t&&null!==e&&""!==e,y=null!=r;let p=null,_=!0;!0===this._removeGeometry&&(_=!1);const f=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);return p=new i(c||y?["GETPAGES"]:[],c||y?[]:["GETPAGES"],l,{outFields:f.join(","),resultRecordCount:u,resultOffset:0,objectIds:[this._findObjectId],where:o,orderByFields:n,returnGeometry:_,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(p,u,0,0,a),p}_expandPagedSet(e,t,i,r,s){return this._expandPagedSetFeatureSet(e,t,i,r,s)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const r=e.pagesDefinition.internal.lastRetrieved,s=r,n=e.pagesDefinition.internal.lastPage,l=this._layer.nativeCapabilities(),d=new a;!0===this._requestStandardised&&(d.sqlFormat="standard"),d.relationshipId=this.relationship.id,d.objectIds=e.pagesDefinition.objectIds,d.resultOffset=e.pagesDefinition.internal.lastPage,d.resultRecordCount=e.pagesDefinition.resultRecordCount,d.outFields=e.pagesDefinition.outFields.split(","),d.where=e.pagesDefinition.where,d.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,d.returnGeometry=e.pagesDefinition.returnGeometry,d.outSpatialReference=this.spatialReference;const o=await l.source.queryRelatedFeatures(d);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let a=0;a<u.length;a++)e.pagesDefinition.internal.set[s+a]=u[a].attributes[this._relatedLayer.objectIdField];for(let a=0;a<u.length;a++)this._featureCache[u[a].attributes[this._relatedLayer.objectIdField]]=u[a];const h=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&h&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,r){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);const a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,r),this._getFeatures(e,t,i,r);let n=0;for(let l=e._lastFetchedIndex;l<e._known.length&&(n++,n<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[l]&&void 0===this._featureCache[e._known[l]]&&(e._known[l]!==t&&s.push(e._known[l]),s.length>i)))&&!(n>=i&&0===s.length);l++);if(0===s.length)return"success";throw new Error("Unaccounted for Features. Not in Feature Collection")}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,r,s,a,n){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,r,s){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,r,s){return this._relatedLayer.queryAttachments(e,t,i,r,s)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}}export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- const t=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i");function e(t){let e="";for(let r=0;r<t;r++)e+=(65536*(1+Math.random())|0).toString(16).substring(1);return e}class r{constructor(t){if(this.value="",!t)throw new TypeError("Invalid argument; `value` has no value.");this.value=r.EMPTY,t&&t instanceof r?this.value=t.toString():t&&"[object String]"===Object.prototype.toString.call(t)&&r.isGuid(t)&&(this.value=t)}equals(t){return r.isGuid(t)&&this.value===t}isEmpty(){return this.value===r.EMPTY}toString(){return this.value}toJSON(){return this.value}static isGuid(e){return e&&(e instanceof r||t.test(e.toString()))}static create(){return new r([e(2),e(1),e(1),e(1),e(3)].join("-"))}static raw(){return[e(2),e(1),e(1),e(1),e(3)].join("-")}}r.EMPTY="00000000-0000-0000-0000-000000000000";export{r as default};
5
+ const t=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i");function e(t){let e="";for(let r=0;r<t;r++)e+=(65536*(1+Math.random())|0).toString(16).substring(1);return e}class r{constructor(t){if(this._value="",!t)throw new TypeError("Invalid argument; `value` has no value.");this._value=r.EMPTY,t&&t instanceof r?this._value=t.toString():t&&"[object String]"===Object.prototype.toString.call(t)&&r.isGuid(t)&&(this._value=t)}equals(t){return r.isGuid(t)&&this._value===t}isEmpty(){return this._value===r.EMPTY}toString(){return this._value}toJSON(){return this._value}static isGuid(e){return e&&(e instanceof r||t.test(e.toString()))}static create(){return new r([e(2),e(1),e(1),e(1),e(3)].join("-"))}static raw(){return[e(2),e(1),e(1),e(1),e(3)].join("-")}}r.EMPTY="00000000-0000-0000-0000-000000000000";export{r as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- class e{constructor(e){const s=this;s._keys=[],s._values=[],s.length=0,e&&e.forEach((e=>{s.set(e[0],e[1])}))}entries(){return[].slice.call(this.keys().map((e=>[e,this.get(e)])))}keys(){return[].slice.call(this._keys)}values(){return[].slice.call(this._values)}has(e){return this._keys.includes(e)}get(e){const s=this._keys.indexOf(e);return s>-1?this._values[s]:void 0}deepGet(s){if(!s||!s.length)return null;const t=(s,i)=>null==s?null:i.length?t(s instanceof e?s.get(i[0]):s[i[0]],i.slice(1)):s;return t(this.get(s[0]),s.slice(1))}set(e,s){const t=this,i=this._keys.indexOf(e);return i>-1?t._values[i]=s:(t._keys.push(e),t._values.push(s),t.length=t._values.length),this}sortedSet(e,s,t,i){const h=this,l=this._keys.length,r=t||0,n=void 0!==i?i:l-1;if(0===l)return h._keys.push(e),h._values.push(s),h;if(e===this._keys[r])return this._values.splice(r,0,s),this;if(e===this._keys[n])return this._values.splice(n,0,s),this;if(e>this._keys[n])return this._keys.splice(n+1,0,e),this._values.splice(n+1,0,s),this;if(e<this._keys[r])return this._values.splice(r,0,s),this._keys.splice(r,0,e),this;if(r>=n)return this;const u=r+Math.floor((n-r)/2);return e<this._keys[u]?this.sortedSet(e,s,r,u-1):e>this._keys[u]?this.sortedSet(e,s,u+1,n):this}size(){return this.length}clear(){const e=this;return e._keys.length=e.length=e._values.length=0,this}delete(e){const s=this,t=s._keys.indexOf(e);return t>-1&&(s._keys.splice(t,1),s._values.splice(t,1),s.length=s._keys.length,!0)}forEach(e){this._keys.forEach(((s,t)=>{e(this.get(s),s,t)}))}map(e){return this.keys().map(((s,t)=>e(this.get(s),s,t)))}filter(e){const s=this;return s._keys.forEach(((t,i)=>{!1===e(s.get(t),t,i)&&s.delete(t)})),this}clone(){return new e(this.entries())}}class s{constructor(s=20){this._maxEntries=s,this.values=new e}delete(e){this.values.has(e)&&this.values.delete(e)}get(e){let s=null;return this.values.has(e)&&(s=this.values.get(e),this.values.delete(e),this.values.set(e,s)),s}put(e,s){if(this.values.size()>=this._maxEntries){const e=this.values.keys()[0];this.values.delete(e)}this.values.set(e,s)}}class t{constructor(e=20){this._maxEntries=e,this._cache=new s(this._maxEntries)}clear(){this._cache=new s(this._maxEntries)}addToCache(e,s){this._cache.put(e,s)}removeFromCache(e){this._cache.delete(e)}getFromCache(e){return this._cache.get(e)}}export{t as default};
5
+ class e{constructor(e){const s=this;s._keys=[],s._values=[],s.length=0,e&&e.forEach((e=>{s.set(e[0],e[1])}))}entries(){return[].slice.call(this.keys().map((e=>[e,this.get(e)])))}keys(){return[].slice.call(this._keys)}values(){return[].slice.call(this._values)}has(e){return this._keys.includes(e)}get(e){const s=this._keys.indexOf(e);return s>-1?this._values[s]:void 0}deepGet(s){if(!s||!s.length)return null;const t=(s,i)=>null==s?null:i.length?t(s instanceof e?s.get(i[0]):s[i[0]],i.slice(1)):s;return t(this.get(s[0]),s.slice(1))}set(e,s){const t=this,i=this._keys.indexOf(e);return i>-1?t._values[i]=s:(t._keys.push(e),t._values.push(s),t.length=t._values.length),this}sortedSet(e,s,t,i){const h=this,l=this._keys.length,r=t||0,n=void 0!==i?i:l-1;if(0===l)return h._keys.push(e),h._values.push(s),h;if(e===this._keys[r])return this._values.splice(r,0,s),this;if(e===this._keys[n])return this._values.splice(n,0,s),this;if(e>this._keys[n])return this._keys.splice(n+1,0,e),this._values.splice(n+1,0,s),this;if(e<this._keys[r])return this._values.splice(r,0,s),this._keys.splice(r,0,e),this;if(r>=n)return this;const u=r+Math.floor((n-r)/2);return e<this._keys[u]?this.sortedSet(e,s,r,u-1):e>this._keys[u]?this.sortedSet(e,s,u+1,n):this}size(){return this.length}clear(){const e=this;return e._keys.length=e.length=e._values.length=0,this}delete(e){const s=this,t=s._keys.indexOf(e);return t>-1&&(s._keys.splice(t,1),s._values.splice(t,1),s.length=s._keys.length,!0)}forEach(e){this._keys.forEach(((s,t)=>{e(this.get(s),s,t)}))}map(e){return this.keys().map(((s,t)=>e(this.get(s),s,t)))}filter(e){const s=this;return s._keys.forEach(((t,i)=>{!1===e(s.get(t),t,i)&&s.delete(t)})),this}clone(){return new e(this.entries())}}class s{constructor(s=20){this._maxEntries=s,this._values=new e}delete(e){this._values.has(e)&&this._values.delete(e)}get(e){let s=null;return this._values.has(e)&&(s=this._values.get(e),this._values.delete(e),this._values.set(e,s)),s}put(e,s){if(this._values.size()>=this._maxEntries){const e=this._values.keys()[0];this._values.delete(e)}this._values.set(e,s)}}class t{constructor(e=20){this._maxEntries=e,this._cache=new s(this._maxEntries)}clear(){this._cache=new s(this._maxEntries)}addToCache(e,s){this._cache.put(e,s)}removeFromCache(e){this._cache.delete(e)}getFromCache(e){return this._cache.get(e)}}export{t as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- const t=2654435761,s=2246822519,n=3266489917,e=668265263,r=374761393;function h(t){const s=[];for(let n=0,e=t.length;n<e;n++){let e=t.charCodeAt(n);e<128?s.push(e):e<2048?s.push(192|e>>6,128|63&e):e<55296||e>=57344?s.push(224|e>>12,128|e>>6&63,128|63&e):(n++,e=65536+((1023&e)<<10|1023&t.charCodeAt(n)),s.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e))}return new Uint8Array(s)}class i{constructor(t){this._seed=t,this.totallen=0,this.bufs=[],this.init()}init(){return this.bufs=[],this.totallen=0,this}updateFloatArray(t){const s=[];for(const n of t)isNaN(n)?s.push("NaN"):n===1/0?s.push("Infinity"):n===-1/0?s.push("-Infinity"):0===n?s.push("0"):s.push(n.toString(16));this.update(h(s.join("")))}updateIntArray(t){const s=Int32Array.from(t);this.update(new Uint8Array(s.buffer))}updateUint8Array(t){this.update(Uint8Array.from(t))}updateWithString(t){return this.update(h(t))}update(t){return this.bufs.push(t),this.totallen+=t.length,this}digest(){const t=new Uint8Array(this.totallen);let s=0;for(const n of this.bufs)t.set(n,s),s+=n.length;return this.init(),this._xxHash32(t,this._seed)}_xxHash32(h,i=0){const o=h;let u=i+r&4294967295,a=0;if(o.length>=16){const n=[i+t+s&4294967295,i+s&4294967295,i+0&4294967295,i-t&4294967295],e=h,r=e.length-16;let o=0;for(a=0;(4294967280&a)<=r;a+=4){const r=a,h=e[r+0]+(e[r+1]<<8),i=e[r+2]+(e[r+3]<<8),u=h*s+(i*s<<16);let l=n[o]+u&4294967295;l=l<<13|l>>>19;const f=65535&l,p=l>>>16;n[o]=f*t+(p*t<<16)&4294967295,o=o+1&3}u=(n[0]<<1|n[0]>>>31)+(n[1]<<7|n[1]>>>25)+(n[2]<<12|n[2]>>>20)+(n[3]<<18|n[3]>>>14)&4294967295}u=u+h.length&4294967295;const l=h.length-4;for(;a<=l;a+=4){const t=a,s=o[t+0]+(o[t+1]<<8),r=o[t+2]+(o[t+3]<<8);u=u+(s*n+(r*n<<16))&4294967295,u=u<<17|u>>>15,u=(65535&u)*e+((u>>>16)*e<<16)&4294967295}for(;a<o.length;++a){u+=o[a]*r,u=u<<11|u>>>21,u=(65535&u)*t+((u>>>16)*t<<16)&4294967295}return u^=u>>>15,u=((65535&u)*s&4294967295)+((u>>>16)*s<<16),u^=u>>>13,u=((65535&u)*n&4294967295)+((u>>>16)*n<<16),u^=u>>>16,u<0?u+4294967296:u}}export{i as XXH};
5
+ const t=2654435761,s=2246822519,n=3266489917,e=668265263,r=374761393;function h(t){const s=[];for(let n=0,e=t.length;n<e;n++){let e=t.charCodeAt(n);e<128?s.push(e):e<2048?s.push(192|e>>6,128|63&e):e<55296||e>=57344?s.push(224|e>>12,128|e>>6&63,128|63&e):(n++,e=65536+((1023&e)<<10|1023&t.charCodeAt(n)),s.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e))}return new Uint8Array(s)}class i{constructor(t){this._seed=t,this._totallen=0,this._bufs=[],this.init()}init(){return this._bufs=[],this._totallen=0,this}updateFloatArray(t){const s=[];for(const n of t)isNaN(n)?s.push("NaN"):n===1/0?s.push("Infinity"):n===-1/0?s.push("-Infinity"):0===n?s.push("0"):s.push(n.toString(16));this.update(h(s.join("")))}updateIntArray(t){const s=Int32Array.from(t);this.update(new Uint8Array(s.buffer))}updateUint8Array(t){this.update(Uint8Array.from(t))}updateWithString(t){return this.update(h(t))}update(t){return this._bufs.push(t),this._totallen+=t.length,this}digest(){const t=new Uint8Array(this._totallen);let s=0;for(const n of this._bufs)t.set(n,s),s+=n.length;return this.init(),this._xxHash32(t,this._seed)}_xxHash32(h,i=0){const o=h;let u=i+r&4294967295,a=0;if(o.length>=16){const n=[i+t+s&4294967295,i+s&4294967295,i+0&4294967295,i-t&4294967295],e=h,r=e.length-16;let o=0;for(a=0;(4294967280&a)<=r;a+=4){const r=a,h=e[r+0]+(e[r+1]<<8),i=e[r+2]+(e[r+3]<<8),u=h*s+(i*s<<16);let l=n[o]+u&4294967295;l=l<<13|l>>>19;const f=65535&l,p=l>>>16;n[o]=f*t+(p*t<<16)&4294967295,o=o+1&3}u=(n[0]<<1|n[0]>>>31)+(n[1]<<7|n[1]>>>25)+(n[2]<<12|n[2]>>>20)+(n[3]<<18|n[3]>>>14)&4294967295}u=u+h.length&4294967295;const l=h.length-4;for(;a<=l;a+=4){const t=a,s=o[t+0]+(o[t+1]<<8),r=o[t+2]+(o[t+3]<<8);u=u+(s*n+(r*n<<16))&4294967295,u=u<<17|u>>>15,u=(65535&u)*e+((u>>>16)*e<<16)&4294967295}for(;a<o.length;++a){u+=o[a]*r,u=u<<11|u>>>21,u=(65535&u)*t+((u>>>16)*t<<16)&4294967295}return u^=u>>>15,u=((65535&u)*s&4294967295)+((u>>>16)*s<<16),u^=u>>>13,u=((65535&u)*n&4294967295)+((u>>>16)*n<<16),u^=u>>>16,u<0?u+4294967296:u}}export{i as XXH};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{assert as e}from"./assert.js";import{Character as t}from"./character.js";import{Messages as i}from"./messages.js";import{TokenType as s}from"./token.js";function n(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function r(e){return"01234567".indexOf(e)}class h{constructor(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart,this.curlyStack=e.curlyStack}eof(){return this.index>=this.length}throwUnexpectedToken(e=i.UnexpectedTokenIllegal){return this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)}_tolerateUnexpectedToken(e=i.UnexpectedTokenIllegal){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)}_skipSingleLineComment(e){let i=[],s=0,n=null;for(this.trackComment&&(i=[],s=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{line:0,column:0}});!this.eof();){const r=this.source.charCodeAt(this.index);if(++this.index,t.isLineTerminator(r)){if(n){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};const t={multiLine:!1,slice:[s+e,this.index-1],range:[s,this.index-1],loc:n};i.push(t)}return 13===r&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,i}}if(n){n.end={line:this.lineNumber,column:this.index-this.lineStart};const t={multiLine:!1,slice:[s+e,this.index],range:[s,this.index],loc:n};i.push(t)}return i}_skipMultiLineComment(){const e=[];let i=0,s=null;for(this.trackComment&&(i=this.index-2,s={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{line:0,column:0}});!this.eof();){const n=this.source.charCodeAt(this.index);if(t.isLineTerminator(n))13===n&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===n){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,s){s.end={line:this.lineNumber,column:this.index-this.lineStart};const t={multiLine:!0,slice:[i+2,this.index-2],range:[i,this.index],loc:s};e.push(t)}return e}++this.index}else++this.index}if(s){s.end={line:this.lineNumber,column:this.index-this.lineStart};const t={multiLine:!0,slice:[i+2,this.index],range:[i,this.index],loc:s};e.push(t)}return this._tolerateUnexpectedToken(),e}scanComments(){let e=null;this.trackComment&&(e=[]);let i=0===this.index;for(;!this.eof();){let s=this.source.charCodeAt(this.index);if(t.isWhiteSpace(s))++this.index;else if(t.isLineTerminator(s))++this.index,13===s&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,i=!0;else if(47===s)if(s=this.source.charCodeAt(this.index+1),47===s){this.index+=2;const t=this._skipSingleLineComment(2);e&&(e=e.concat(t)),i=!0}else{if(42!==s)break;{this.index+=2;const t=this._skipMultiLineComment();e&&(e=e.concat(t))}}else if(i&&45===s){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;{this.index+=3;const t=this._skipSingleLineComment(3);e&&(e=e.concat(t))}}else{if(60!==s||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;{this.index+=4;const t=this._skipSingleLineComment(4);e&&(e=e.concat(t))}}}return e}_isKeyword(e){switch((e=e.toLowerCase()).length){case 2:return"if"===e||"in"===e;case 3:return"var"===e||"for"===e;case 4:return"else"===e;case 5:return"break"===e;case 6:return"return"===e;case 8:return"function"===e||"continue"===e;default:return!1}}_codePointAt(e){let t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){const i=this.source.charCodeAt(e+1);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536}}return t}_scanHexEscape(e){const i="u"===e?4:2;let s=0;for(let r=0;r<i;++r){if(this.eof()||!t.isHexDigit(this.source.charCodeAt(this.index)))return null;s=16*s+n(this.source[this.index++])}return String.fromCharCode(s)}_scanUnicodeCodePointEscape(){let e=this.source[this.index],i=0;for("}"===e&&this.throwUnexpectedToken();!this.eof()&&(e=this.source[this.index++],t.isHexDigit(e.charCodeAt(0)));)i=16*i+n(e);return(i>1114111||"}"!==e)&&this.throwUnexpectedToken(),t.fromCodePoint(i)}_getIdentifier(){const e=this.index++;for(;!this.eof();){const i=this.source.charCodeAt(this.index);if(92===i)return this.index=e,this._getComplexIdentifier();if(i>=55296&&i<57343)return this.index=e,this._getComplexIdentifier();if(!t.isIdentifierPart(i))break;++this.index}return this.source.slice(e,this.index)}_getComplexIdentifier(){let e,i=this._codePointAt(this.index),s=t.fromCodePoint(i);for(this.index+=s.length,92===i&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this._scanUnicodeCodePointEscape()):(e=this._scanHexEscape("u"),null!==e&&"\\"!==e&&t.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken()),s=e);!this.eof()&&(i=this._codePointAt(this.index),t.isIdentifierPart(i));)e=t.fromCodePoint(i),s+=e,this.index+=e.length,92===i&&(s=s.substr(0,s.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this._scanUnicodeCodePointEscape()):(e=this._scanHexEscape("u"),null!==e&&"\\"!==e&&t.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken()),s+=e);return s}_octalToDecimal(e){let i="0"!==e,s=r(e);return!this.eof()&&t.isOctalDigit(this.source.charCodeAt(this.index))&&(i=!0,s=8*s+r(this.source[this.index++]),"0123".includes(e)&&!this.eof()&&t.isOctalDigit(this.source.charCodeAt(this.index))&&(s=8*s+r(this.source[this.index++]))),{code:s,octal:i}}_scanIdentifier(){let e;const t=this.index,n=92===this.source.charCodeAt(t)?this._getComplexIdentifier():this._getIdentifier();if(e=1===n.length?s.Identifier:this._isKeyword(n)?s.Keyword:"null"===n.toLowerCase()?s.NullLiteral:"true"===n.toLowerCase()||"false"===n.toLowerCase()?s.BooleanLiteral:s.Identifier,e!==s.Identifier&&t+n.length!==this.index){const e=this.index;this.index=t,this._tolerateUnexpectedToken(i.InvalidEscapedReservedWord),this.index=e}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}_scanPunctuator(){const e=this.index;let t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;case"}":++this.index,this.curlyStack.pop();break;default:t=this.source.substr(this.index,4),">>>="===t?this.index+=4:(t=t.substr(0,3),"==="===t||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:(t=t.substr(0,2),"&&"===t||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".includes(t)&&++this.index)))}return this.index===e&&this.throwUnexpectedToken(),{type:s.Punctuator,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}_scanHexLiteral(e){let i="";for(;!this.eof()&&t.isHexDigit(this.source.charCodeAt(this.index));)i+=this.source[this.index++];return 0===i.length&&this.throwUnexpectedToken(),t.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:s.NumericLiteral,value:parseInt("0x"+i,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}_scanBinaryLiteral(e){let i="";for(;!this.eof();){const e=this.source[this.index];if("0"!==e&&"1"!==e)break;i+=this.source[this.index++]}if(0===i.length&&this.throwUnexpectedToken(),!this.eof()){const e=this.source.charCodeAt(this.index);(t.isIdentifierStart(e)||t.isDecimalDigit(e))&&this.throwUnexpectedToken()}return{type:s.NumericLiteral,value:parseInt(i,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}_scanOctalLiteral(e,i){let n="",r=!1;for(t.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&t.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(t.isIdentifierStart(this.source.charCodeAt(this.index))||t.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:s.NumericLiteral,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:i,end:this.index}}_scanNumericLiteral(){const i=this.index;let n=this.source[i];e(t.isDecimalDigit(n.charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point");let r="";if("."!==n){if(r=this.source[this.index++],n=this.source[this.index],"0"===r){if("x"===n||"X"===n)return++this.index,this._scanHexLiteral(i);if("b"===n||"B"===n)return++this.index,this._scanBinaryLiteral(i);if("o"===n||"O"===n)return this._scanOctalLiteral(n,i)}for(;t.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];n=this.source[this.index]}if("."===n){for(r+=this.source[this.index++];t.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];n=this.source[this.index]}if("e"===n||"E"===n)if(r+=this.source[this.index++],n=this.source[this.index],"+"!==n&&"-"!==n||(r+=this.source[this.index++]),t.isDecimalDigit(this.source.charCodeAt(this.index)))for(;t.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];else this.throwUnexpectedToken();return t.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:s.NumericLiteral,value:parseFloat(r),lineNumber:this.lineNumber,lineStart:this.lineStart,start:i,end:this.index}}_scanStringLiteral(){const n=this.index;let r=this.source[n];e("'"===r||'"'===r,"String literal must starts with a quote"),++this.index;let h=!1,c="";for(;!this.eof();){let e=this.source[this.index++];if(e===r){r="";break}if("\\"===e)if(e=this.source[this.index++],e&&t.isLineTerminator(e.charCodeAt(0)))++this.lineNumber,"\r"===e&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(e){case"u":if("{"===this.source[this.index])++this.index,c+=this._scanUnicodeCodePointEscape();else{const t=this._scanHexEscape(e);null===t&&this.throwUnexpectedToken(),c+=t}break;case"x":{const t=this._scanHexEscape(e);null===t&&this.throwUnexpectedToken(i.InvalidHexEscapeSequence),c+=t;break}case"n":c+="\n";break;case"r":c+="\r";break;case"t":c+="\t";break;case"b":c+="\b";break;case"f":c+="\f";break;case"v":c+="\v";break;case"8":case"9":c+=e,this._tolerateUnexpectedToken();break;default:if(e&&t.isOctalDigit(e.charCodeAt(0))){const t=this._octalToDecimal(e);h=t.octal||h,c+=String.fromCharCode(t.code)}else c+=e}else{if(t.isLineTerminator(e.charCodeAt(0)))break;c+=e}}return""!==r&&(this.index=n,this.throwUnexpectedToken()),{type:s.StringLiteral,value:c,octal:h,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}_scanTemplate(){let e="",n=!1;const r=this.index,h="`"===this.source[r];let c=!1,o=2;for(++this.index;!this.eof();){let s=this.source[this.index++];if("`"===s){o=1,c=!0,n=!0;break}if("$"===s){if("{"===this.source[this.index]){this.curlyStack.push("${"),++this.index,n=!0;break}e+=s}else if("\\"===s)if(s=this.source[this.index++],t.isLineTerminator(s.charCodeAt(0)))++this.lineNumber,"\r"===s&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(s){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"u":if("{"===this.source[this.index])++this.index,e+=this._scanUnicodeCodePointEscape();else{const t=this.index,i=this._scanHexEscape(s);null!==i?e+=i:(this.index=t,e+=s)}break;case"x":{const t=this._scanHexEscape(s);null===t&&this.throwUnexpectedToken(i.InvalidHexEscapeSequence),e+=t;break}case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:"0"===s?(t.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(i.TemplateOctalLiteral),e+="\0"):t.isOctalDigit(s.charCodeAt(0))?this.throwUnexpectedToken(i.TemplateOctalLiteral):e+=s}else t.isLineTerminator(s.charCodeAt(0))?(++this.lineNumber,"\r"===s&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index,e+="\n"):e+=s}return n||this.throwUnexpectedToken(),h||this.curlyStack.pop(),{type:s.Template,value:this.source.slice(r+1,this.index-o),cooked:e,head:h,tail:c,lineNumber:this.lineNumber,lineStart:this.lineStart,start:r,end:this.index}}_testRegExp(e,t){const s="￿";let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,((e,t,n)=>{const r=parseInt(t||n,16);return r>1114111&&this.throwUnexpectedToken(i.InvalidRegExp),r<=65535?String.fromCharCode(r):s})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,s));try{RegExp(n)}catch(r){this.throwUnexpectedToken(i.InvalidRegExp)}try{return new RegExp(e,t)}catch(h){return null}}_scanRegExpBody(){let s=this.source[this.index];e("/"===s,"Regular expression literal must start with a slash");let n=this.source[this.index++],r=!1,h=!1;for(;!this.eof();)if(s=this.source[this.index++],n+=s,"\\"===s)s=this.source[this.index++],t.isLineTerminator(s.charCodeAt(0))&&this.throwUnexpectedToken(i.UnterminatedRegExp),n+=s;else if(t.isLineTerminator(s.charCodeAt(0)))this.throwUnexpectedToken(i.UnterminatedRegExp);else if(r)"]"===s&&(r=!1);else{if("/"===s){h=!0;break}"["===s&&(r=!0)}return h||this.throwUnexpectedToken(i.UnterminatedRegExp),n.substr(1,n.length-2)}_scanRegExpFlags(){let e="",i="";for(;!this.eof();){let s=this.source[this.index];if(!t.isIdentifierPart(s.charCodeAt(0)))break;if(++this.index,"\\"!==s||this.eof())i+=s,e+=s;else if(s=this.source[this.index],"u"===s){++this.index;let t=this.index;const s=this._scanHexEscape("u");if(null!==s)for(i+=s,e+="\\u";t<this.index;++t)e+=this.source[t];else this.index=t,i+="u",e+="\\u";this._tolerateUnexpectedToken()}else e+="\\",this._tolerateUnexpectedToken()}return i}scanRegExp(){const e=this.index,t=this._scanRegExpBody(),i=this._scanRegExpFlags(),n=this._testRegExp(t,i);return{type:s.RegularExpression,value:"",pattern:t,flags:i,regex:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}lex(){if(this.eof())return{type:s.EOF,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};const e=this.source.charCodeAt(this.index);return t.isIdentifierStart(e)?this._scanIdentifier():40===e||41===e||59===e?this._scanPunctuator():39===e||34===e?this._scanStringLiteral():46===e?t.isDecimalDigit(this.source.charCodeAt(this.index+1))?this._scanNumericLiteral():this._scanPunctuator():t.isDecimalDigit(e)?this._scanNumericLiteral():96===e||125===e&&"${"===this.curlyStack[this.curlyStack.length-1]?this._scanTemplate():e>=55296&&e<57343&&t.isIdentifierStart(this._codePointAt(this.index))?this._scanIdentifier():this._scanPunctuator()}}export{h as Scanner};
5
+ import{assert as e}from"./assert.js";import{Character as t}from"./character.js";import{Messages as i}from"./messages.js";import{TokenType as s}from"./token.js";function n(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function r(e){return"01234567".indexOf(e)}class h{constructor(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this._length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart,this.curlyStack=e.curlyStack}eof(){return this.index>=this._length}throwUnexpectedToken(e=i.UnexpectedTokenIllegal){return this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)}_tolerateUnexpectedToken(e=i.UnexpectedTokenIllegal){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)}_skipSingleLineComment(e){let i=[],s=0,n=null;for(this.trackComment&&(i=[],s=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{line:0,column:0}});!this.eof();){const r=this.source.charCodeAt(this.index);if(++this.index,t.isLineTerminator(r)){if(n){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};const t={multiLine:!1,slice:[s+e,this.index-1],range:[s,this.index-1],loc:n};i.push(t)}return 13===r&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,i}}if(n){n.end={line:this.lineNumber,column:this.index-this.lineStart};const t={multiLine:!1,slice:[s+e,this.index],range:[s,this.index],loc:n};i.push(t)}return i}_skipMultiLineComment(){const e=[];let i=0,s=null;for(this.trackComment&&(i=this.index-2,s={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{line:0,column:0}});!this.eof();){const n=this.source.charCodeAt(this.index);if(t.isLineTerminator(n))13===n&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===n){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,s){s.end={line:this.lineNumber,column:this.index-this.lineStart};const t={multiLine:!0,slice:[i+2,this.index-2],range:[i,this.index],loc:s};e.push(t)}return e}++this.index}else++this.index}if(s){s.end={line:this.lineNumber,column:this.index-this.lineStart};const t={multiLine:!0,slice:[i+2,this.index],range:[i,this.index],loc:s};e.push(t)}return this._tolerateUnexpectedToken(),e}scanComments(){let e=null;this.trackComment&&(e=[]);let i=0===this.index;for(;!this.eof();){let s=this.source.charCodeAt(this.index);if(t.isWhiteSpace(s))++this.index;else if(t.isLineTerminator(s))++this.index,13===s&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,i=!0;else if(47===s)if(s=this.source.charCodeAt(this.index+1),47===s){this.index+=2;const t=this._skipSingleLineComment(2);e&&(e=e.concat(t)),i=!0}else{if(42!==s)break;{this.index+=2;const t=this._skipMultiLineComment();e&&(e=e.concat(t))}}else if(i&&45===s){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;{this.index+=3;const t=this._skipSingleLineComment(3);e&&(e=e.concat(t))}}else{if(60!==s||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;{this.index+=4;const t=this._skipSingleLineComment(4);e&&(e=e.concat(t))}}}return e}_isKeyword(e){switch((e=e.toLowerCase()).length){case 2:return"if"===e||"in"===e;case 3:return"var"===e||"for"===e;case 4:return"else"===e;case 5:return"break"===e;case 6:return"return"===e;case 8:return"function"===e||"continue"===e;default:return!1}}_codePointAt(e){let t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){const i=this.source.charCodeAt(e+1);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536}}return t}_scanHexEscape(e){const i="u"===e?4:2;let s=0;for(let r=0;r<i;++r){if(this.eof()||!t.isHexDigit(this.source.charCodeAt(this.index)))return null;s=16*s+n(this.source[this.index++])}return String.fromCharCode(s)}_scanUnicodeCodePointEscape(){let e=this.source[this.index],i=0;for("}"===e&&this.throwUnexpectedToken();!this.eof()&&(e=this.source[this.index++],t.isHexDigit(e.charCodeAt(0)));)i=16*i+n(e);return(i>1114111||"}"!==e)&&this.throwUnexpectedToken(),t.fromCodePoint(i)}_getIdentifier(){const e=this.index++;for(;!this.eof();){const i=this.source.charCodeAt(this.index);if(92===i)return this.index=e,this._getComplexIdentifier();if(i>=55296&&i<57343)return this.index=e,this._getComplexIdentifier();if(!t.isIdentifierPart(i))break;++this.index}return this.source.slice(e,this.index)}_getComplexIdentifier(){let e,i=this._codePointAt(this.index),s=t.fromCodePoint(i);for(this.index+=s.length,92===i&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this._scanUnicodeCodePointEscape()):(e=this._scanHexEscape("u"),null!==e&&"\\"!==e&&t.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken()),s=e);!this.eof()&&(i=this._codePointAt(this.index),t.isIdentifierPart(i));)e=t.fromCodePoint(i),s+=e,this.index+=e.length,92===i&&(s=s.substr(0,s.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this._scanUnicodeCodePointEscape()):(e=this._scanHexEscape("u"),null!==e&&"\\"!==e&&t.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken()),s+=e);return s}_octalToDecimal(e){let i="0"!==e,s=r(e);return!this.eof()&&t.isOctalDigit(this.source.charCodeAt(this.index))&&(i=!0,s=8*s+r(this.source[this.index++]),"0123".includes(e)&&!this.eof()&&t.isOctalDigit(this.source.charCodeAt(this.index))&&(s=8*s+r(this.source[this.index++]))),{code:s,octal:i}}_scanIdentifier(){let e;const t=this.index,n=92===this.source.charCodeAt(t)?this._getComplexIdentifier():this._getIdentifier();if(e=1===n.length?s.Identifier:this._isKeyword(n)?s.Keyword:"null"===n.toLowerCase()?s.NullLiteral:"true"===n.toLowerCase()||"false"===n.toLowerCase()?s.BooleanLiteral:s.Identifier,e!==s.Identifier&&t+n.length!==this.index){const e=this.index;this.index=t,this._tolerateUnexpectedToken(i.InvalidEscapedReservedWord),this.index=e}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}_scanPunctuator(){const e=this.index;let t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;case"}":++this.index,this.curlyStack.pop();break;default:t=this.source.substr(this.index,4),">>>="===t?this.index+=4:(t=t.substr(0,3),"==="===t||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:(t=t.substr(0,2),"&&"===t||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".includes(t)&&++this.index)))}return this.index===e&&this.throwUnexpectedToken(),{type:s.Punctuator,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}_scanHexLiteral(e){let i="";for(;!this.eof()&&t.isHexDigit(this.source.charCodeAt(this.index));)i+=this.source[this.index++];return 0===i.length&&this.throwUnexpectedToken(),t.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:s.NumericLiteral,value:parseInt("0x"+i,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}_scanBinaryLiteral(e){let i="";for(;!this.eof();){const e=this.source[this.index];if("0"!==e&&"1"!==e)break;i+=this.source[this.index++]}if(0===i.length&&this.throwUnexpectedToken(),!this.eof()){const e=this.source.charCodeAt(this.index);(t.isIdentifierStart(e)||t.isDecimalDigit(e))&&this.throwUnexpectedToken()}return{type:s.NumericLiteral,value:parseInt(i,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}_scanOctalLiteral(e,i){let n="",r=!1;for(t.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&t.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(t.isIdentifierStart(this.source.charCodeAt(this.index))||t.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:s.NumericLiteral,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:i,end:this.index}}_scanNumericLiteral(){const i=this.index;let n=this.source[i];e(t.isDecimalDigit(n.charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point");let r="";if("."!==n){if(r=this.source[this.index++],n=this.source[this.index],"0"===r){if("x"===n||"X"===n)return++this.index,this._scanHexLiteral(i);if("b"===n||"B"===n)return++this.index,this._scanBinaryLiteral(i);if("o"===n||"O"===n)return this._scanOctalLiteral(n,i)}for(;t.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];n=this.source[this.index]}if("."===n){for(r+=this.source[this.index++];t.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];n=this.source[this.index]}if("e"===n||"E"===n)if(r+=this.source[this.index++],n=this.source[this.index],"+"!==n&&"-"!==n||(r+=this.source[this.index++]),t.isDecimalDigit(this.source.charCodeAt(this.index)))for(;t.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];else this.throwUnexpectedToken();return t.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:s.NumericLiteral,value:parseFloat(r),lineNumber:this.lineNumber,lineStart:this.lineStart,start:i,end:this.index}}_scanStringLiteral(){const n=this.index;let r=this.source[n];e("'"===r||'"'===r,"String literal must starts with a quote"),++this.index;let h=!1,c="";for(;!this.eof();){let e=this.source[this.index++];if(e===r){r="";break}if("\\"===e)if(e=this.source[this.index++],e&&t.isLineTerminator(e.charCodeAt(0)))++this.lineNumber,"\r"===e&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(e){case"u":if("{"===this.source[this.index])++this.index,c+=this._scanUnicodeCodePointEscape();else{const t=this._scanHexEscape(e);null===t&&this.throwUnexpectedToken(),c+=t}break;case"x":{const t=this._scanHexEscape(e);null===t&&this.throwUnexpectedToken(i.InvalidHexEscapeSequence),c+=t;break}case"n":c+="\n";break;case"r":c+="\r";break;case"t":c+="\t";break;case"b":c+="\b";break;case"f":c+="\f";break;case"v":c+="\v";break;case"8":case"9":c+=e,this._tolerateUnexpectedToken();break;default:if(e&&t.isOctalDigit(e.charCodeAt(0))){const t=this._octalToDecimal(e);h=t.octal||h,c+=String.fromCharCode(t.code)}else c+=e}else{if(t.isLineTerminator(e.charCodeAt(0)))break;c+=e}}return""!==r&&(this.index=n,this.throwUnexpectedToken()),{type:s.StringLiteral,value:c,octal:h,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}_scanTemplate(){let e="",n=!1;const r=this.index,h="`"===this.source[r];let c=!1,o=2;for(++this.index;!this.eof();){let s=this.source[this.index++];if("`"===s){o=1,c=!0,n=!0;break}if("$"===s){if("{"===this.source[this.index]){this.curlyStack.push("${"),++this.index,n=!0;break}e+=s}else if("\\"===s)if(s=this.source[this.index++],t.isLineTerminator(s.charCodeAt(0)))++this.lineNumber,"\r"===s&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(s){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"u":if("{"===this.source[this.index])++this.index,e+=this._scanUnicodeCodePointEscape();else{const t=this.index,i=this._scanHexEscape(s);null!==i?e+=i:(this.index=t,e+=s)}break;case"x":{const t=this._scanHexEscape(s);null===t&&this.throwUnexpectedToken(i.InvalidHexEscapeSequence),e+=t;break}case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:"0"===s?(t.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(i.TemplateOctalLiteral),e+="\0"):t.isOctalDigit(s.charCodeAt(0))?this.throwUnexpectedToken(i.TemplateOctalLiteral):e+=s}else t.isLineTerminator(s.charCodeAt(0))?(++this.lineNumber,"\r"===s&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index,e+="\n"):e+=s}return n||this.throwUnexpectedToken(),h||this.curlyStack.pop(),{type:s.Template,value:this.source.slice(r+1,this.index-o),cooked:e,head:h,tail:c,lineNumber:this.lineNumber,lineStart:this.lineStart,start:r,end:this.index}}_testRegExp(e,t){const s="￿";let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,((e,t,n)=>{const r=parseInt(t||n,16);return r>1114111&&this.throwUnexpectedToken(i.InvalidRegExp),r<=65535?String.fromCharCode(r):s})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,s));try{RegExp(n)}catch(r){this.throwUnexpectedToken(i.InvalidRegExp)}try{return new RegExp(e,t)}catch(h){return null}}_scanRegExpBody(){let s=this.source[this.index];e("/"===s,"Regular expression literal must start with a slash");let n=this.source[this.index++],r=!1,h=!1;for(;!this.eof();)if(s=this.source[this.index++],n+=s,"\\"===s)s=this.source[this.index++],t.isLineTerminator(s.charCodeAt(0))&&this.throwUnexpectedToken(i.UnterminatedRegExp),n+=s;else if(t.isLineTerminator(s.charCodeAt(0)))this.throwUnexpectedToken(i.UnterminatedRegExp);else if(r)"]"===s&&(r=!1);else{if("/"===s){h=!0;break}"["===s&&(r=!0)}return h||this.throwUnexpectedToken(i.UnterminatedRegExp),n.substr(1,n.length-2)}_scanRegExpFlags(){let e="",i="";for(;!this.eof();){let s=this.source[this.index];if(!t.isIdentifierPart(s.charCodeAt(0)))break;if(++this.index,"\\"!==s||this.eof())i+=s,e+=s;else if(s=this.source[this.index],"u"===s){++this.index;let t=this.index;const s=this._scanHexEscape("u");if(null!==s)for(i+=s,e+="\\u";t<this.index;++t)e+=this.source[t];else this.index=t,i+="u",e+="\\u";this._tolerateUnexpectedToken()}else e+="\\",this._tolerateUnexpectedToken()}return i}scanRegExp(){const e=this.index,t=this._scanRegExpBody(),i=this._scanRegExpFlags(),n=this._testRegExp(t,i);return{type:s.RegularExpression,value:"",pattern:t,flags:i,regex:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}lex(){if(this.eof())return{type:s.EOF,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};const e=this.source.charCodeAt(this.index);return t.isIdentifierStart(e)?this._scanIdentifier():40===e||41===e||59===e?this._scanPunctuator():39===e||34===e?this._scanStringLiteral():46===e?t.isDecimalDigit(this.source.charCodeAt(this.index+1))?this._scanNumericLiteral():this._scanPunctuator():t.isDecimalDigit(e)?this._scanNumericLiteral():96===e||125===e&&"${"===this.curlyStack[this.curlyStack.length-1]?this._scanTemplate():e>=55296&&e<57343&&t.isIdentifierStart(this._codePointAt(this.index))?this._scanIdentifier():this._scanPunctuator()}}export{h as Scanner};