@arcgis/core 4.34.0-next.41 → 4.34.0-next.43
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.
- package/Basemap.js +1 -1
- package/Ground.js +1 -1
- package/PopupTemplate.js +1 -1
- package/WebDocument2D.js +1 -1
- package/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/016d421114118307d4dd.js +1 -0
- package/assets/esri/core/workers/chunks/07eea90733834313e9fa.js +1 -0
- package/assets/esri/core/workers/chunks/0d73afce787ee1e76b21.js +1 -0
- package/assets/esri/core/workers/chunks/0ebf666564d323d82259.js +1 -0
- package/assets/esri/core/workers/chunks/1a3a4c2c642899be37a0.js +1 -0
- package/assets/esri/core/workers/chunks/20ffac42ff5095af00fe.js +1 -0
- package/assets/esri/core/workers/chunks/{d465e1b3a8a53d9c0a12.js → 24e76fa530fc0c495fb5.js} +1 -1
- package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +1 -0
- package/assets/esri/core/workers/chunks/{9247d768c3eccc0828a9.js → 28d71e1b866113650c75.js} +1 -1
- package/assets/esri/core/workers/chunks/{85bfd380d4f522ff8e83.js → 2ae50b02cdf126a8b562.js} +1 -1
- package/assets/esri/core/workers/chunks/3245d20ea4bb779f87ef.js +1 -0
- package/assets/esri/core/workers/chunks/345ed9ac44e47355803e.js +1 -0
- package/assets/esri/core/workers/chunks/5ae6e2b3557fe8730072.js +1 -0
- package/assets/esri/core/workers/chunks/5f28470304b57e24d94c.js +1 -0
- package/assets/esri/core/workers/chunks/{6c167daf115cd6abb3e5.js → 615915e7c48f0a3d0060.js} +1 -1
- package/assets/esri/core/workers/chunks/655b8d24ffe5405f8ba1.js +1 -0
- package/assets/esri/core/workers/chunks/68a69d3fcad6febf55f6.js +22 -0
- package/assets/esri/core/workers/chunks/6b73926feb5c5d957062.js +1 -0
- package/assets/esri/core/workers/chunks/6cd828cfe41e0cab2068.js +1 -0
- package/assets/esri/core/workers/chunks/{6269c4bbf0f224a954e9.js → 6f4079b7a2b45f304ee6.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad106f5f6d6848f40de3.js → 71b222089f5e9dcee474.js} +1 -1
- package/assets/esri/core/workers/chunks/{962c0ef63de1635fb4aa.js → 7e99fc78bd0f40a8ba81.js} +1 -1
- package/assets/esri/core/workers/chunks/{0a27f9b11d03874809ee.js → 8867368ab9b005460f19.js} +17 -10
- package/assets/esri/core/workers/chunks/892623d938583cd0f006.js +1 -0
- package/assets/esri/core/workers/chunks/99daf4b144838fa9ca67.js +1 -0
- package/assets/esri/core/workers/chunks/{31ad9949b08a5b07218c.js → 9aa84b86262fa8334bc4.js} +22 -21
- package/assets/esri/core/workers/chunks/{cca36750c86352c6d1f9.js → a638f1688ac9525a52a7.js} +1 -1
- package/assets/esri/core/workers/chunks/ab3c018c406dcd81ef9e.js +1 -0
- package/assets/esri/core/workers/chunks/af98c7546be409303213.js +1 -0
- package/assets/esri/core/workers/chunks/b01a90ce699058307bc2.js +1 -0
- package/assets/esri/core/workers/chunks/{9e7af4c3c0f8cf0f5c5b.js → b4251e10621fb3ad03a3.js} +1 -1
- package/assets/esri/core/workers/chunks/b79aa5ba0424641f878b.js +1 -0
- package/assets/esri/core/workers/chunks/b85dbefdb09bc6c99e0d.js +1 -0
- package/assets/esri/core/workers/chunks/bb56defb6dfb9b2c1f27.js +1 -0
- package/assets/esri/core/workers/chunks/c47227a626edc1e1ecf1.js +1 -0
- package/assets/esri/core/workers/chunks/c6da9ba188b627ab3b79.js +1 -0
- package/assets/esri/core/workers/chunks/{9c60599131860f635483.js → cd6398a2951922e13b86.js} +1 -1
- package/assets/esri/core/workers/chunks/ceb63ca9ad473c3f1820.js +1 -0
- package/assets/esri/core/workers/chunks/d392fbbcfac2a1b54bd6.js +1 -0
- package/assets/esri/core/workers/chunks/{7d082bfcd13ad6e8c89d.js → d552b22219ec795aff89.js} +1 -1
- package/assets/esri/core/workers/chunks/{94850c094e076d81a016.js → dca2b487152cde45fb65.js} +1 -1
- package/assets/esri/core/workers/chunks/{7f523fa4d4ade4316625.js → e19cd07df8ce87e18832.js} +1 -1
- package/assets/esri/core/workers/chunks/{c8d57588267e2fc4406c.js → e3f5afdf133c58b3d161.js} +1 -1
- package/assets/esri/core/workers/chunks/e505a101621de39de280.js +1 -0
- package/assets/esri/core/workers/chunks/e5aeb34d918dee539694.js +1 -0
- package/assets/esri/core/workers/chunks/e7806a57d29bca385f1d.js +1 -0
- package/assets/esri/core/workers/chunks/{712c740cf58c2e282efc.js → e962e6b47cb7e5a71c24.js} +1 -1
- package/assets/esri/core/workers/chunks/{88308a0dcc479688e67c.js → f1adf8ebc2c1b93857bf.js} +1 -1
- package/assets/esri/core/workers/chunks/f1b02c4bd5fde235212b.js +1 -0
- package/assets/esri/core/workers/chunks/f65b2d3a91a0c726fee4.js +1 -0
- package/assets/esri/core/workers/chunks/f667096ea325f690c4a6.js +1 -0
- package/assets/esri/core/workers/chunks/fe55833c80cf59df9c2b.js +1 -0
- package/assets/esri/core/workers/chunks/fe6fa1f2c2d54d41645e.js +1 -0
- package/chunks/ComponentShader.glsl.js +6 -5
- package/config.js +1 -1
- package/core/floatRGBA.js +1 -1
- package/core/workers/registry.js +1 -1
- package/graphic/graphicOrigins.d.ts +2 -0
- package/interfaces.d.ts +281 -124
- package/kernel.js +1 -1
- package/layers/CSVLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/GraphicsLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/Layer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/MediaLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/WebTileLayer.js +1 -1
- package/layers/support/BuildingFilter.js +1 -1
- package/layers/support/LayerContingentValuesCache.js +1 -1
- package/layers/support/MapImage.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +1 -1
- package/portal/Portal.js +1 -1
- package/portal/PortalItem.js +1 -1
- package/renderers/DotDensityRenderer.js +1 -1
- package/renderers/FlowRenderer.js +1 -1
- package/renderers/VectorFieldRenderer.js +1 -1
- package/renderers/support/ColormapInfo.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/support/AttributeBinsFeatureSet.js +1 -1
- package/rest/support/DirectionsFeature.js +1 -1
- package/rest/support/FindImagesParameters.js +1 -1
- package/rest/support/ImageAreaParameters.js +1 -1
- package/rest/support/ImageBoundaryParameters.js +1 -1
- package/rest/support/ImageDistanceParameters.js +1 -1
- package/rest/support/ImageGPSInfoParameters.js +1 -1
- package/rest/support/ImageHeightParameters.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageIdentifyParameters.js +1 -1
- package/rest/support/ImagePixelLocationParameters.js +1 -1
- package/rest/support/ImagePointParameters.js +1 -1
- package/rest/support/ImageToMapMultirayParameters.js +1 -1
- package/rest/support/ImageToMapParameters.js +1 -1
- package/rest/support/ImageUrlParameters.js +1 -1
- package/rest/support/MapToImageParameters.js +1 -1
- package/rest/support/MeasureFromImageParameters.js +1 -1
- package/support/revision.js +1 -1
- package/versionManagement/VersionManagementService.js +1 -1
- package/versionManagement/VersioningState.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/Mesh2D.js +1 -1
- package/views/2d/engine/webgl/VertexStream.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/meshing/SimpleMesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/KMLLayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/WMSLayerView2D.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
- package/views/3d/support/GaussianSplatSortWorker.js +5 -0
- package/views/3d/support/GaussianSplatWorkerHandle.js +5 -0
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/flow/loadUtils.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +21 -14
- package/views/3d/webgl-engine/collections/Component/UniformComponentParameters.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js +7 -0
- package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgeBufferWriters.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/BackedBufferObject.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoCache.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +7 -6
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/draw/Draw.js +1 -1
- package/views/support/TileTreeDebugger.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/views/webgl/VertexBuffer.js +1 -1
- package/views/webgl/testFloatBufferBlend.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
- package/widgets/FeatureForm/GroupInput.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/smartMapping/ClassedColorSlider/ClassedColorSliderViewModel.js +1 -1
- package/widgets/smartMapping/ClassedSizeSlider/ClassedSizeSliderViewModel.js +1 -1
- package/widgets/smartMapping/ColorSizeSlider/ColorSizeSliderViewModel.js +1 -1
- package/widgets/smartMapping/ColorSlider/ColorSliderViewModel.js +1 -1
- package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
- package/widgets/smartMapping/OpacitySlider/OpacitySliderViewModel.js +1 -1
- package/widgets/smartMapping/SizeSlider/SizeSliderViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/00ae094cc21bc42faa54.js +0 -1
- package/assets/esri/core/workers/chunks/01bd8f90e55081e65b38.js +0 -1
- package/assets/esri/core/workers/chunks/1cd15aa69f85ecfa32b0.js +0 -1
- package/assets/esri/core/workers/chunks/21a9f9c0cc1cde2fee90.js +0 -1
- package/assets/esri/core/workers/chunks/2ae0bda04fd5386b462f.js +0 -1
- package/assets/esri/core/workers/chunks/31e6eb2685872baf538a.js +0 -1
- package/assets/esri/core/workers/chunks/3358c1b04490706681cc.js +0 -1
- package/assets/esri/core/workers/chunks/34f677e8c1691c10e4e9.js +0 -1
- package/assets/esri/core/workers/chunks/364fb103cb139f26b455.js +0 -1
- package/assets/esri/core/workers/chunks/4ae15645e68e7f6dd6b7.js +0 -1
- package/assets/esri/core/workers/chunks/5156410dd84ea1232a6c.js +0 -1
- package/assets/esri/core/workers/chunks/560bb06cf1bf30df4af3.js +0 -1
- package/assets/esri/core/workers/chunks/5f11fff5bc16fdec42db.js +0 -1
- package/assets/esri/core/workers/chunks/647cff1eaaf1b622f439.js +0 -1
- package/assets/esri/core/workers/chunks/6b5b609b357924fa35be.js +0 -1
- package/assets/esri/core/workers/chunks/719b89341b26c3568c2f.js +0 -1
- package/assets/esri/core/workers/chunks/791b3130b34b52160c1f.js +0 -1
- package/assets/esri/core/workers/chunks/79b389baf972d329c38d.js +0 -1
- package/assets/esri/core/workers/chunks/7a5808c6e67c43274d86.js +0 -1
- package/assets/esri/core/workers/chunks/7ef7f3925495b9ade88c.js +0 -1
- package/assets/esri/core/workers/chunks/90a9b618058dc41294de.js +0 -1
- package/assets/esri/core/workers/chunks/95f0c15d83d1f38e01d0.js +0 -1
- package/assets/esri/core/workers/chunks/a13a36207f265f720255.js +0 -1
- package/assets/esri/core/workers/chunks/a36be186ad10200c420c.js +0 -1
- package/assets/esri/core/workers/chunks/ad1e5c24c1eae5ab8e45.js +0 -1
- package/assets/esri/core/workers/chunks/b481807b31e59cce9931.js +0 -1
- package/assets/esri/core/workers/chunks/bc27cdd7c415ab166536.js +0 -1
- package/assets/esri/core/workers/chunks/c52314b987c63cd630f7.js +0 -1
- package/assets/esri/core/workers/chunks/d1635a7ab0c204852237.js +0 -1
- package/assets/esri/core/workers/chunks/da228aed337f492456cc.js +0 -1
- package/assets/esri/core/workers/chunks/e08b2e9213d35f85916f.js +0 -1
- package/assets/esri/core/workers/chunks/e95a8c988ef822723503.js +0 -1
- package/assets/esri/core/workers/chunks/ec9ed7c9d64f88fcb806.js +0 -1
- package/assets/esri/core/workers/chunks/fd3009164d5e38fda85f.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import{createTask as r}from"../core/asyncUtils.js";import i from"../core/Error.js";import{clone as o}from"../core/lang.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{urlToObject as a,addQueryParameters as n,isProtocolRelative as p,normalize as y}from"../core/urlUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{checkWebPSupport as U}from"./support/imageUtils.js";import I from"./support/SpriteSource.js";import R from"./support/TileInfo.js";import{TilemapCache as O}from"./support/TilemapCache.js";import{loadMetadata as P}from"./support/vectorTileLayerLoader.js";import{createForItemRead as M}from"../portal/support/jsonContext.js";import{parseKnownArcGISOnlineDomain as C}from"../portal/support/urlUtils.js";import{e as V}from"../chunks/persistableUrlUtils.js";import{areSchemasOverlapping as D,unionTileInfos as E}from"../views/2d/engine/vectorTiles/tileInfoUtils.js";import N from"../views/2d/engine/vectorTiles/style/StyleRepository.js";import{getWebGLCapabilities as k}from"../views/webgl/capabilities.js";let B=class extends(_(L(x(v(j(b(T(w(g(s(f))))))))))){constructor(...e){super(...e),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.path=null,this.refreshInterval=0,this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){if(this.sourceNameToSource)for(const e of Object.values(this.sourceNameToSource))e?.destroy();this.primarySource?.destroy(),this._spriteSourceMap.clear()}async prefetchResources(e){await this.loadSpriteSource(globalThis.devicePixelRatio||1,e)}load(e){const r=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},e).catch(l).then(async()=>{if(!this.portalItem?.id)return;const r=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await t(r,{...e,query:{f:"json",...this.customParameters,token:this.apiKey},authMode:this.portalItem.portal.authMode})).data&&this.read({url:r},M(this.portalItem,"portal-item"))}).catch(l).then(()=>this._loadStyle(e));return this.addResolvingPromise(r),Promise.resolve(this)}get attributionDataUrl(){const e=this.currentStyleInfo,t=e?.serviceUrl&&a(e.serviceUrl);if(!t)return null;const r=this._getDefaultAttribution(t.path);return r?n(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const e=this.primarySource;return e?e.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){return this.primarySource?.fullExtent||null}get initialExtent(){return this.primarySource?.initialExtent||null}get parsedUrl(){return this.serviceUrl?a(this.serviceUrl):null}get serviceUrl(){return this.currentStyleInfo?.serviceUrl||null}get spatialReference(){return this.tileInfo?.spatialReference??null}get styleUrl(){return this.currentStyleInfo?.styleUrl||null}writeStyleUrl(e,t){e&&p(e)&&(e=`https:${e}`);const r=C(e);t.styleUrl=V(e,r)}get tileInfo(){const e=[];for(const r in this.sourceNameToSource)e.push(this.sourceNameToSource[r]);let t=this.primarySource?.tileInfo||new R;if(e.length>1)for(let r=0;r<e.length;r++)D(t,e[r].tileInfo)&&(t=E(t,e[r].tileInfo));return t}readTilemapCache(e,t){const r=t.capabilities?.includes("Tilemap");return r?new O({layer:this}):null}readVersion(e,t){return t.version?parseFloat(t.version):parseFloat(t.currentVersion)}async loadSpriteSource(e=1,t){if(!this._spriteSourceMap.has(e)){const r=k().maxTextureSize,i=this.currentStyleInfo?.spriteUrl?n(this.currentStyleInfo.spriteUrl,{...this.customParameters,token:this.apiKey}):null,o=new I({type:"url",spriteUrl:i,pixelRatio:e,spriteFormat:this.currentStyleInfo?.spriteFormat},r);await o.load(t),this._spriteSourceMap.set(e,o)}return this._spriteSourceMap.get(e)}async setSpriteSource(e,t){if(!e)return null;const r=k().maxTextureSize,i=e.spriteUrl,o=i?n(i,{...this.customParameters,token:this.apiKey}):null;if(!o&&"url"===e.type)return null;const s=new I(e,r);try{await s.load(t);const r=e.pixelRatio||1;return this._spriteSourceMap.clear(),this._spriteSourceMap.set(r,s),o&&this.currentStyleInfo&&(this.currentStyleInfo.spriteUrl=o),this.emit("spriteSource-change",{spriteSource:s}),s}catch(a){l(a)}return null}async loadStyle(e,t){const i=e||this.style||this.url;return this._loadingTask&&"string"==typeof i&&this.url===i||(this._loadingTask?.abort(),this._loadingTask=r(e=>(this._spriteSourceMap.clear(),this._getSourceAndStyle(i,{signal:e})),t)),this._loadingTask.promise}getStyleLayerId(e){return this.styleRepository.getStyleLayerId(e)}getStyleLayerIndex(e){return this.styleRepository.getStyleLayerIndex(e)}getPaintProperties(e){return o(this.styleRepository?.getPaintProperties(e))}setPaintProperties(e,t){const r=this.styleRepository.isPainterDataDriven(e);this.styleRepository.setPaintProperties(e,t);const i=this.styleRepository.isPainterDataDriven(e);this.emit("paint-change",{layer:e,paint:t,isDataDriven:r||i})}getStyleLayer(e){return o(this.styleRepository.getStyleLayer(e))}setStyleLayer(e,t){this.styleRepository.setStyleLayer(e,t),this.emit("style-layer-change",{layer:e,index:t})}deleteStyleLayer(e){this.styleRepository.deleteStyleLayer(e),this.emit("delete-style-layer",{layer:e})}getLayoutProperties(e){return o(this.styleRepository.getLayoutProperties(e))}setLayoutProperties(e,t){this.styleRepository.setLayoutProperties(e,t),this.emit("layout-change",{layer:e,layout:t})}setStyleLayerVisibility(e,t){this.styleRepository.setStyleLayerVisibility(e,t),this.emit("style-layer-visibility-change",{layer:e,visibility:t})}getStyleLayerVisibility(e){return this.styleRepository.getStyleLayerVisibility(e)}write(e,t){return t?.origin&&!this.styleUrl?(t.messages&&t.messages.push(new i("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(e,t)}getTileUrl(e,t,r){return null}async _getSourceAndStyle(e,t){if(!e)throw new Error("invalid style!");const r=await P(e,{...t,query:{...this.customParameters,token:this.apiKey}});if("webp"===r.spriteFormat){await U("lossy")||(r.spriteFormat="png")}this._set("currentStyleInfo",{...r}),"string"==typeof e?(this.url=e,this.style=null):(this.url=null,this.style=e),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new N(r.style,!1)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(e){const t=e.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^/]+)?\/arcgis\/rest\/services\/([^/]+(\/[^/]+)*)\/vectortileserver/i),r=["OpenBasemap_v2","OpenBasemap_GCS_v2","OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2","World_Hillshade_v2"];if(!t)return;const i=t[2]&&t[2].toLowerCase();if(!i)return;const o=t[1]||"";for(const s of r)if(s.toLowerCase().includes(i))return y(`//static.arcgis.com/attribution/Vector${o}/${s}`)}async _loadStyle(e){return this._loadingTask?.promise??this.loadStyle(null,e)}};e([u({readOnly:!0})],B.prototype,"attributionDataUrl",null),e([u({type:["show","hide"]})],B.prototype,"listMode",void 0),e([u({json:{read:!0,write:!0}})],B.prototype,"blendMode",void 0),e([u({readOnly:!0,json:{read:!1}})],B.prototype,"capabilities",null),e([u({readOnly:!0})],B.prototype,"currentStyleInfo",void 0),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"fullExtent",null),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"initialExtent",null),e([u({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],B.prototype,"isReference",void 0),e([u({type:["VectorTileLayer"]})],B.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],B.prototype,"parsedUrl",null),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],B.prototype,"path",void 0),e([u({type:Number,json:{write:!1,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],B.prototype,"refreshInterval",void 0),e([u()],B.prototype,"style",void 0),e([u({readOnly:!0})],B.prototype,"serviceUrl",null),e([u({type:S,readOnly:!0})],B.prototype,"spatialReference",null),e([u({readOnly:!0})],B.prototype,"styleRepository",void 0),e([u({readOnly:!0})],B.prototype,"sourceNameToSource",void 0),e([u({readOnly:!0})],B.prototype,"primarySource",void 0),e([u({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],B.prototype,"styleUrl",null),e([h(["portal-item","web-document"],"styleUrl")],B.prototype,"writeStyleUrl",null),e([u({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:R})],B.prototype,"tileInfo",null),e([u()],B.prototype,"tilemapCache",void 0),e([c("service","tilemapCache",["capabilities","tileInfo"])],B.prototype,"readTilemapCache",null),e([u({json:{read:!1},readOnly:!0,value:"vector-tile"})],B.prototype,"type",void 0),e([u({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],B.prototype,"url",void 0),e([u({readOnly:!0})],B.prototype,"version",void 0),e([c("version",["version","currentVersion"])],B.prototype,"readVersion",null),B=e([m("esri.layers.VectorTileLayer")],B);const A=B;export{A as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import{createTask as r}from"../core/asyncUtils.js";import i from"../core/Error.js";import{clone as o}from"../core/lang.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{urlToObject as a,addQueryParameters as n,isProtocolRelative as p,normalize as y}from"../core/urlUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{checkWebPSupport as L}from"./support/imageUtils.js";import U from"./support/SpriteSource.js";import R from"./support/TileInfo.js";import{TilemapCache as O}from"./support/TilemapCache.js";import{loadMetadata as P}from"./support/vectorTileLayerLoader.js";import{createForItemRead as M}from"../portal/support/jsonContext.js";import{parseKnownArcGISOnlineDomain as C}from"../portal/support/urlUtils.js";import{e as V}from"../chunks/persistableUrlUtils.js";import{areSchemasOverlapping as D,unionTileInfos as E}from"../views/2d/engine/vectorTiles/tileInfoUtils.js";import N from"../views/2d/engine/vectorTiles/style/StyleRepository.js";import{getWebGLCapabilities as k}from"../views/webgl/capabilities.js";let K=class extends(_(I(x(v(j(b(T(w(g(s(f))))))))))){constructor(...e){super(...e),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.path=null,this.refreshInterval=0,this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){if(this.sourceNameToSource)for(const e of Object.values(this.sourceNameToSource))e?.destroy();this.primarySource?.destroy(),this._spriteSourceMap.clear()}async prefetchResources(e){await this.loadSpriteSource(globalThis.devicePixelRatio||1,e)}load(e){const r=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},e).catch(l).then(async()=>{if(!this.portalItem?.id)return;const r=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await t(r,{...e,query:{f:"json",...this.customParameters,token:this.apiKey},authMode:this.portalItem.portal.authMode})).data&&this.read({url:r},M(this.portalItem,"portal-item"))}).catch(l).then(()=>this._loadStyle(e));return this.addResolvingPromise(r),Promise.resolve(this)}get apiKey(){return super.apiKey}set apiKey(e){super.apiKey=e}set portalItem(e){super.portalItem=e}get attributionDataUrl(){const e=this.currentStyleInfo,t=e?.serviceUrl&&a(e.serviceUrl);if(!t)return null;const r=this._getDefaultAttribution(t.path);return r?n(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const e=this.primarySource;return e?e.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){return this.primarySource?.fullExtent||null}get initialExtent(){return this.primarySource?.initialExtent||null}get parsedUrl(){return this.serviceUrl?a(this.serviceUrl):null}get serviceUrl(){return this.currentStyleInfo?.serviceUrl||null}get spatialReference(){return this.tileInfo?.spatialReference??null}get styleUrl(){return this.currentStyleInfo?.styleUrl||null}writeStyleUrl(e,t){e&&p(e)&&(e=`https:${e}`);const r=C(e);t.styleUrl=V(e,r)}get tileInfo(){const e=[];for(const r in this.sourceNameToSource)e.push(this.sourceNameToSource[r]);let t=this.primarySource?.tileInfo||new R;if(e.length>1)for(let r=0;r<e.length;r++)D(t,e[r].tileInfo)&&(t=E(t,e[r].tileInfo));return t}readTilemapCache(e,t){const r=t.capabilities?.includes("Tilemap");return r?new O({layer:this}):null}readVersion(e,t){return t.version?parseFloat(t.version):parseFloat(t.currentVersion)}async loadSpriteSource(e=1,t){if(!this._spriteSourceMap.has(e)){const r=k().maxTextureSize,i=this.currentStyleInfo?.spriteUrl?n(this.currentStyleInfo.spriteUrl,{...this.customParameters,token:this.apiKey}):null,o=new U({type:"url",spriteUrl:i,pixelRatio:e,spriteFormat:this.currentStyleInfo?.spriteFormat},r);await o.load(t),this._spriteSourceMap.set(e,o)}return this._spriteSourceMap.get(e)}async setSpriteSource(e,t){if(!e)return null;const r=k().maxTextureSize,i=e.spriteUrl,o=i?n(i,{...this.customParameters,token:this.apiKey}):null;if(!o&&"url"===e.type)return null;const s=new U(e,r);try{await s.load(t);const r=e.pixelRatio||1;return this._spriteSourceMap.clear(),this._spriteSourceMap.set(r,s),o&&this.currentStyleInfo&&(this.currentStyleInfo.spriteUrl=o),this.emit("spriteSource-change",{spriteSource:s}),s}catch(a){l(a)}return null}async loadStyle(e,t){const i=e||this.style||this.url;return this._loadingTask&&"string"==typeof i&&this.url===i||(this._loadingTask?.abort(),this._loadingTask=r(e=>(this._spriteSourceMap.clear(),this._getSourceAndStyle(i,{signal:e})),t)),this._loadingTask.promise}getStyleLayerId(e){return this.styleRepository.getStyleLayerId(e)}getStyleLayerIndex(e){return this.styleRepository.getStyleLayerIndex(e)}getPaintProperties(e){return o(this.styleRepository?.getPaintProperties(e))}setPaintProperties(e,t){const r=this.styleRepository.isPainterDataDriven(e);this.styleRepository.setPaintProperties(e,t);const i=this.styleRepository.isPainterDataDriven(e);this.emit("paint-change",{layer:e,paint:t,isDataDriven:r||i})}getStyleLayer(e){return o(this.styleRepository.getStyleLayer(e))}setStyleLayer(e,t){this.styleRepository.setStyleLayer(e,t),this.emit("style-layer-change",{layer:e,index:t})}deleteStyleLayer(e){this.styleRepository.deleteStyleLayer(e),this.emit("delete-style-layer",{layer:e})}getLayoutProperties(e){return o(this.styleRepository.getLayoutProperties(e))}setLayoutProperties(e,t){this.styleRepository.setLayoutProperties(e,t),this.emit("layout-change",{layer:e,layout:t})}setStyleLayerVisibility(e,t){this.styleRepository.setStyleLayerVisibility(e,t),this.emit("style-layer-visibility-change",{layer:e,visibility:t})}getStyleLayerVisibility(e){return this.styleRepository.getStyleLayerVisibility(e)}write(e,t){return t?.origin&&!this.styleUrl?(t.messages&&t.messages.push(new i("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(e,t)}getTileUrl(e,t,r){return null}async _getSourceAndStyle(e,t){if(!e)throw new Error("invalid style!");const r=await P(e,{...t,query:{...this.customParameters,token:this.apiKey}});if("webp"===r.spriteFormat){await L("lossy")||(r.spriteFormat="png")}this._set("currentStyleInfo",{...r}),"string"==typeof e?(this.url=e,this.style=null):(this.url=null,this.style=e),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new N(r.style,!1)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(e){const t=e.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^/]+)?\/arcgis\/rest\/services\/([^/]+(\/[^/]+)*)\/vectortileserver/i),r=["OpenBasemap_v2","OpenBasemap_GCS_v2","OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2","World_Hillshade_v2"];if(!t)return;const i=t[2]&&t[2].toLowerCase();if(!i)return;const o=t[1]||"";for(const s of r)if(s.toLowerCase().includes(i))return y(`//static.arcgis.com/attribution/Vector${o}/${s}`)}async _loadStyle(e){return this._loadingTask?.promise??this.loadStyle(null,e)}};e([u({readOnly:!0})],K.prototype,"attributionDataUrl",null),e([u({type:["show","hide"]})],K.prototype,"listMode",void 0),e([u({json:{read:!0,write:!0}})],K.prototype,"blendMode",void 0),e([u({readOnly:!0,json:{read:!1}})],K.prototype,"capabilities",null),e([u({readOnly:!0})],K.prototype,"currentStyleInfo",void 0),e([u({json:{read:!1},readOnly:!0,type:d})],K.prototype,"fullExtent",null),e([u({json:{read:!1},readOnly:!0,type:d})],K.prototype,"initialExtent",null),e([u({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],K.prototype,"isReference",void 0),e([u({type:["VectorTileLayer"]})],K.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],K.prototype,"parsedUrl",null),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],K.prototype,"path",void 0),e([u({type:Number,json:{write:!1,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],K.prototype,"refreshInterval",void 0),e([u()],K.prototype,"style",void 0),e([u({readOnly:!0})],K.prototype,"serviceUrl",null),e([u({type:S,readOnly:!0})],K.prototype,"spatialReference",null),e([u({readOnly:!0})],K.prototype,"styleRepository",void 0),e([u({readOnly:!0})],K.prototype,"sourceNameToSource",void 0),e([u({readOnly:!0})],K.prototype,"primarySource",void 0),e([u({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],K.prototype,"styleUrl",null),e([h(["portal-item","web-document"],"styleUrl")],K.prototype,"writeStyleUrl",null),e([u({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:R})],K.prototype,"tileInfo",null),e([u()],K.prototype,"tilemapCache",void 0),e([c("service","tilemapCache",["capabilities","tileInfo"])],K.prototype,"readTilemapCache",null),e([u({json:{read:!1},readOnly:!0,value:"vector-tile"})],K.prototype,"type",void 0),e([u({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],K.prototype,"url",void 0),e([u({readOnly:!0})],K.prototype,"version",void 0),e([c("version",["version","currentVersion"])],K.prototype,"readVersion",null),K=e([m("esri.layers.VectorTileLayer")],K);const B=K;export{B as default};
|
package/layers/WCSLayer.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import o from"../core/Error.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import m from"./Layer.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{CustomParametersMixin as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import o from"../core/Error.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import m from"./Layer.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{CustomParametersMixin as u}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as c}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as y}from"./mixins/RasterJobHandlerMixin.js";import{RefreshableLayer as v}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as g}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as j}from"./mixins/TemporalLayer.js";import{legendEnabled as I,popupEnabled as w}from"./support/commonProperties.js";import b from"./support/Field.js";import{getServicePixelValueField as x,getMultidimensionalFields as S}from"./support/rasterFieldUtils.js";import P from"./support/rasterDatasets/WCSRaster.js";import{createPopupTemplate as O}from"../support/popupUtils.js";const R=new Set(["milliseconds","seconds","minutes","hours","days","weeks","months","years","decades","centuries"]);let T=class extends(d(g(f(h(u(c(y(j(v(s(r(m)))))))))))){constructor(...e){super(...e),this.coverageId=null,this.version=null,this.isReference=null,this.legendEnabled=!0,this.noData=0,this.operationalLayerType="WCS",this.type="wcs",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this._debouncedSaveOperations=i(async(e,t,r)=>{const{save:o,saveAs:s}=await import("./save/imageryUtils.js");switch(e){case 0:return o(this,t);case 1:return s(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WCS"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}get renderer(){return super.renderer}set renderer(e){super.renderer=e}get coverageInfo(){return this.raster.coverageInfo}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[x("Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.multidimensionalInfo;if(r){const t=S(r);e.push(...t)}return e}createPopupTemplate(e){return O({fields:this.rasterFields,title:this.title},e)}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}async _openRaster(e){const t=new P({url:this.url,version:this.version,coverageId:this.coverageId,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters}});if(await t.open({signal:e}),!t.rasterInfo)throw t.destroy(),new o("wcs-layer:load","cannot load resources on "+this.url);const{rasterInfo:r}=t;null==r.noDataValue&&(r.noDataValue=this.noData),this._set("serviceRasterInfo",r),this._set("spatialReference",r.spatialReference),null==this.title&&this.setAtOrigin("title",t.datasetName,"service"),null==this.coverageId&&this.setAtOrigin("coverageId",t.coverageInfo.id,"service"),null==this.version&&t.version&&this.setAtOrigin("version",t.version,"service"),this.setAtOrigin("tileInfo",t.rasterInfo.storageInfo.tileInfo,"service");const{multidimensionalInfo:s}=r;if(null!=s){const e=s.variables[0].dimensions.find(({name:e})=>"StdTime"===e);if(e){let t=e.extent?.[0]??e.values[0];Array.isArray(t)&&(t=t[0]);let r=e.extent?.[1]??e.values[e.values.length-1];Array.isArray(r)&&(r=r[1]);const o=R.has(e.intervalUnit?.toLowerCase())?e.intervalUnit?.toLowerCase():null;this.set("timeInfo",{startField:"StdTime",fullTimeExtent:{start:t,end:r},timeZone:null,interval:o?{value:e.interval,unit:o}:null})}}this.raster=t,this._configDefaultSettings(),this.addHandles(a(()=>this.customParameters,e=>this.raster.ioConfig.customFetchParameters=e))}};e([l({type:String,nonNullable:!0,json:{name:"wcsInfo.coverageId",write:{isRequired:!0,ignoreOrigin:!0}}})],T.prototype,"coverageId",void 0),e([l()],T.prototype,"coverageInfo",null),e([l({type:["1.0.0","1.1.0","1.1.1","1.1.2","2.0.1"],nonNullable:!0,json:{name:"wcsInfo.version",write:{isRequired:!0,ignoreOrigin:!0}}})],T.prototype,"version",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],T.prototype,"isReference",void 0),e([l({json:{read:!0,write:!0}})],T.prototype,"blendMode",void 0),e([l(I)],T.prototype,"legendEnabled",void 0),e([l({type:["show","hide"]})],T.prototype,"listMode",void 0),e([l()],T.prototype,"noData",void 0),e([l({type:["WCS"]})],T.prototype,"operationalLayerType",void 0),e([l()],T.prototype,"raster",void 0),e([l({readOnly:!0})],T.prototype,"type",void 0),e([l(w)],T.prototype,"popupEnabled",void 0),e([l({type:t,json:{name:"popupInfo",write:!0}})],T.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],T.prototype,"defaultPopupTemplate",null),e([l({readOnly:!0,type:[b]})],T.prototype,"fields",void 0),e([l({readOnly:!0,type:[b]})],T.prototype,"rasterFields",null),T=e([p("esri.layers.WCSLayer")],T);const C=T;export{C as default};
|
package/layers/WMSLayer.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import s from"../request.js";import i from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import n from"../core/Error.js";import{JSONMap as l}from"../core/jsonMap.js";import{clone as p}from"../core/lang.js";import{MultiOriginJSONMixin as m}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u}from"../core/promiseUtils.js";import{on as c,watch as y,sync as f}from"../core/reactiveUtils.js";import{renderingSanitizer as d}from"../core/sanitizerUtils.js";import{urlToObject as h,addQueryParameters as g,addProxy as b,makeAbsolute as w,Url as v}from"../core/urlUtils.js";import{property as x}from"../core/accessorSupport/decorators/property.js";import{Integer as j}from"../core/accessorSupport/ensureType.js";import{reader as I}from"../core/accessorSupport/decorators/reader.js";import{subclass as S}from"../core/accessorSupport/decorators/subclass.js";import{writer as F}from"../core/accessorSupport/decorators/writer.js";import{willPropertyWrite as P}from"../core/accessorSupport/write.js";import R from"../geometry/Extent.js";import E from"../geometry/SpatialReference.js";import{getScale as L}from"../geometry/support/scaleUtils.js";import{equals as O}from"../geometry/support/spatialReferenceUtils.js";import U from"./Layer.js";import{BlendLayer as M}from"./mixins/BlendLayer.js";import{OperationalLayer as T}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{RefreshableLayer as C}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as W}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as q}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as N}from"./ogc/crsUtils.js";import{isWmsServer as $}from"./support/arcgisLayerUrl.js";import{legendEnabled as B,url as k}from"./support/commonProperties.js";import{ExportWMSImageParameters as H}from"./support/ExportWMSImageParameters.js";import{createBitmap as G}from"./support/imageBitmapUtils.js";import V from"./support/WMSSublayer.js";import{normalizeWKID as z,toTimeQueryParameter as A,getPopupLayers as D,parseCapabilities as J}from"./support/wmsUtils.js";const Q=new l({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function K(e){return"text/html"===e}function X(e){return"text/plain"===e}let Y=class extends(M(q(C(W(T(_(m(U)))))))){constructor(...e){super(...e),this.allSublayers=new a({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.version=null,this.addHandles([c(()=>this.sublayers,"after-add",({item:e})=>{e.parent=e.layer=this},f),c(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},f),y(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=r.layer=this},f)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(u).then(()=>this._fetchService(t)).then(()=>this._checkLayerValidity())),Promise.resolve(this)}readFullExtentFromItemOrMap(e,t){const r=t.extent;return r?new R({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return null==this.featureInfoFormats?null:this.featureInfoFormats.find(K)??this.featureInfoFormats.find(X)??null}set featureInfoFormat(e){null==e?(this.revert("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(K(e)||X(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,t){return new E(t.spatialReferences[0])}writeSpatialReferences(e,t){const r=this.spatialReference?.wkid;e&&r?(t.spatialReferences=e.filter(e=>e!==r),t.spatialReferences.unshift(r)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,r){return ee(t.layers,r,t.visibleLayers)}readSublayers(e,t,r){return ee(t.layers,r)}writeSublayers(e,t,r,o){t.layers=[];const s=new Map,i=e.flatten(({sublayers:e})=>e??[]);for(const a of i)if("number"==typeof a.parent?.id){const e=s.get(a.parent.id);null!=e?e.push(a.id):s.set(a.parent.id,[a.id])}for(const a of i){const e={sublayer:a,...o},r=a.write({parentLayerId:"number"==typeof a.parent?.id?a.parent.id:-1},e);if(s.has(a.id)&&(r.sublayerIds=s.get(a.id)),!a.sublayers&&a.name){const r=a.write({},e);delete r.id,t.layers.push(r)}}t.visibleLayers=i.filter(({visible:e,sublayers:t})=>e&&!t).map(({name:e})=>e).toArray()}set url(e){if(!e)return void this._set("url",e);const{path:t,query:r}=h(e);for(const s in r)/^(request|service)$/i.test(s)&&delete r[s];const o=g(t,r??{});this._set("url",o)}createExportImageParameters(e,t,r,o){const s=o?.pixelRatio??1,i=L({extent:e,width:t})*s,a=new H({layer:this,scale:i}),{xmin:n,ymin:l,xmax:p,ymax:m,spatialReference:u}=e,c=z(u,this.spatialReferences),y="1.3.0"===this.version&&N(c)?`${l},${n},${m},${p}`:`${n},${l},${p},${m}`,f=a.toJSON(),d="1.3.0"===this.version?"crs":"srs";return{bbox:y,[d]:null==c||isNaN(c)?void 0:"EPSG:"+c,...f}}async fetchImage(e,t,r,o){const i=this.mapUrl,a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=A(o?.timeExtent),l={responseType:"image",query:this._mixCustomParameters({width:t,height:r,...a,time:n,...this.refreshParameters}),signal:o?.signal};return s(i??"",l).then(e=>e.data)}async fetchImageBitmap(e,t,r,o){const i=this.mapUrl??"",a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=A(o?.timeExtent),l={responseType:"blob",query:this._mixCustomParameters({width:t,height:r,...a,time:n,...this.refreshParameters}),signal:o?.signal},{data:p}=await s(i,l);return G(p,i,o?.signal)}fetchFeatureInfo(e,t,r,o,s){const i=L({extent:e,width:t}),a=new H({layer:this,scale:i}),n=D(a.visibleSublayers);if(null==this.featureInfoUrl||null==n)return Promise.resolve([]);if(null==this.fetchFeatureInfoFunction&&null==this.featureInfoFormat)return Promise.resolve([]);const l="1.3.0"===this.version?{I:o,J:s}:{x:o,y:s},p={query_layers:n,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:t,height:r,...l},m={...this.createExportImageParameters(e,t,r),...p},u=this._mixCustomParameters(m);return null!=this.fetchFeatureInfoFunction?this.fetchFeatureInfoFunction(u):this._defaultFetchFeatureInfoFunction(g(this.featureInfoUrl,u))}findSublayerById(e){return this.allSublayers.find(t=>t.id===e)}findSublayerByName(e){return this.allSublayers.find(t=>t.name===e)}serviceSupportsSpatialReference(e){return $(this.url)||null!=this.spatialReferences&&this.spatialReferences.some(t=>{const r=900913===t?E.WebMercator:new E({wkid:t});return O(r,e)})}_defaultFetchFeatureInfoFunction(e){const t=document.createElement("iframe");t.src=b(d.sanitizeUrl(w(e))),t.style.border="none",t.style.margin="0",t.style.width="100%",t.setAttribute("sandbox","");const s=new o({title:this.title,content:t}),i=new r({sourceLayer:this,popupTemplate:s});return Promise.resolve([i])}async _fetchService(e){if(!this.resourceInfo&&this.parsedUrl?.path){const{path:t,query:r}=this.parsedUrl,{data:o}=await s(t,{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...r,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=J(o)}if(this.parsedUrl){const e=new v(this.parsedUrl.path),{httpsDomains:r}=t.request;"https"!==e.scheme||e.port&&"443"!==e.port||!e.host||r.includes(e.host)||r.push(e.host)}this.read(this.resourceInfo,{origin:"service"})}_checkLayerValidity(){if(!this.allSublayers.length)throw new n("wmslayer:empty-layer","The layer doesn't have any sublayer")}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const t={...this.customParameters,...this.customLayerParameters};for(const r in t)e[r.toLowerCase()]=t[r];return e}};function Z(e,t){return e.some(e=>{for(const r in e)if(P(e,r,null,t))return!0;return!1})}function ee(e,t,r){e=e??[];const o=new Map;e.every(e=>null==e.id)&&(e=p(e)).forEach((e,t)=>e.id=t);for(const i of e){const e=new V;e.read(i,t),r&&!r.includes(e.name)&&(e.visible=!1),o.set(e.id,e)}const s=[];for(const a of e){const e=null!=a.id?o.get(a.id):null;if(e)if(null!=a.parentLayerId&&a.parentLayerId>=0){const t=o.get(a.parentLayerId);if(!t)continue;t.sublayers||(t.sublayers=new i),t.sublayers.push(e)}else s.push(e)}return s}e([x({readOnly:!0})],Y.prototype,"allSublayers",void 0),e([x({json:{type:Object,write:!0}})],Y.prototype,"customParameters",void 0),e([x({json:{type:Object,write:!0}})],Y.prototype,"customLayerParameters",void 0),e([x({type:String,json:{write:!0}})],Y.prototype,"copyright",void 0),e([x()],Y.prototype,"description",void 0),e([x({readOnly:!0})],Y.prototype,"dimensions",void 0),e([x({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],Y.prototype,"fullExtent",void 0),e([I(["web-document","portal-item"],"fullExtent",["extent"])],Y.prototype,"readFullExtentFromItemOrMap",null),e([F(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],Y.prototype,"writeFullExtent",null),e([x({type:[R]})],Y.prototype,"fullExtents",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"featureInfoFormat",null),e([x({type:[String],readOnly:!0})],Y.prototype,"featureInfoFormats",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"featureInfoUrl",void 0),e([x()],Y.prototype,"fetchFeatureInfoFunction",void 0),e([x({type:String,json:{origins:{"web-document":{default:"image/png",type:Q.jsonValues,read:{reader:Q.read,source:"format"},write:{writer:Q.write,target:"format"}}}}})],Y.prototype,"imageFormat",void 0),e([I("imageFormat",["supportedImageFormatTypes"])],Y.prototype,"readImageFormat",null),e([x({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],Y.prototype,"imageMaxHeight",void 0),e([x({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],Y.prototype,"imageMaxWidth",void 0),e([x()],Y.prototype,"imageTransparency",void 0),e([x(B)],Y.prototype,"legendEnabled",void 0),e([x({type:["show","hide","hide-children"]})],Y.prototype,"listMode",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"mapUrl",void 0),e([x({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Y.prototype,"isReference",void 0),e([x({type:["WMS"]})],Y.prototype,"operationalLayerType",void 0),e([x()],Y.prototype,"resourceInfo",void 0),e([x({type:E,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],Y.prototype,"spatialReference",void 0),e([I(["web-document","portal-item"],"spatialReference",["spatialReferences"])],Y.prototype,"readSpatialReferenceFromItemOrDocument",null),e([x({type:[j],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],Y.prototype,"spatialReferences",void 0),e([F(["web-document","portal-item"],"spatialReferences")],Y.prototype,"writeSpatialReferences",null),e([x({type:i.ofType(V),json:{write:{target:"layers",overridePolicy(e,t,r){if(Z(this.allSublayers,r))return{ignoreOrigin:!0}}}}})],Y.prototype,"sublayers",void 0),e([I(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],Y.prototype,"readSublayersFromItemOrMap",null),e([I("service","sublayers",["layers"])],Y.prototype,"readSublayers",null),e([F("sublayers",{layers:{type:[V]},visibleLayers:{type:[String]}})],Y.prototype,"writeSublayers",null),e([x({json:{read:!1},readOnly:!0,value:"wms"})],Y.prototype,"type",void 0),e([x(k)],Y.prototype,"url",null),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"version",void 0),Y=e([S("esri.layers.WMSLayer")],Y);const te=Y;export{te as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import s from"../request.js";import i from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import n from"../core/Error.js";import{JSONMap as l}from"../core/jsonMap.js";import{clone as p}from"../core/lang.js";import{MultiOriginJSONMixin as m}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u}from"../core/promiseUtils.js";import{on as c,watch as y,sync as f}from"../core/reactiveUtils.js";import{renderingSanitizer as d}from"../core/sanitizerUtils.js";import{urlToObject as h,addQueryParameters as g,addProxy as b,makeAbsolute as w,Url as v}from"../core/urlUtils.js";import{property as x}from"../core/accessorSupport/decorators/property.js";import{Integer as j}from"../core/accessorSupport/ensureType.js";import{reader as I}from"../core/accessorSupport/decorators/reader.js";import{subclass as S}from"../core/accessorSupport/decorators/subclass.js";import{writer as F}from"../core/accessorSupport/decorators/writer.js";import{willPropertyWrite as P}from"../core/accessorSupport/write.js";import R from"../geometry/Extent.js";import E from"../geometry/SpatialReference.js";import{getScale as L}from"../geometry/support/scaleUtils.js";import{equals as O}from"../geometry/support/spatialReferenceUtils.js";import U from"./Layer.js";import{BlendLayer as M}from"./mixins/BlendLayer.js";import{OperationalLayer as T}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{RefreshableLayer as C}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as W}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as q}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as N}from"./ogc/crsUtils.js";import{isWmsServer as $}from"./support/arcgisLayerUrl.js";import{legendEnabled as B,url as k}from"./support/commonProperties.js";import{ExportWMSImageParameters as H}from"./support/ExportWMSImageParameters.js";import{createBitmap as G}from"./support/imageBitmapUtils.js";import V from"./support/WMSSublayer.js";import{normalizeWKID as z,toTimeQueryParameter as A,getPopupLayers as D,parseCapabilities as J}from"./support/wmsUtils.js";const Q=new l({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function K(e){return"text/html"===e}function X(e){return"text/plain"===e}let Y=class extends(M(q(C(W(T(_(m(U)))))))){constructor(...e){super(...e),this.allSublayers=new a({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.version=null,this.addHandles([c(()=>this.sublayers,"after-add",({item:e})=>{e.parent=e.layer=this},f),c(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},f),y(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=r.layer=this},f)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(u).then(()=>this._fetchService(t)).then(()=>this._checkLayerValidity())),Promise.resolve(this)}set timeInfo(e){super.timeInfo=e}readFullExtentFromItemOrMap(e,t){const r=t.extent;return r?new R({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return null==this.featureInfoFormats?null:this.featureInfoFormats.find(K)??this.featureInfoFormats.find(X)??null}set featureInfoFormat(e){null==e?(this.revert("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(K(e)||X(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,t){return new E(t.spatialReferences[0])}writeSpatialReferences(e,t){const r=this.spatialReference?.wkid;e&&r?(t.spatialReferences=e.filter(e=>e!==r),t.spatialReferences.unshift(r)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,r){return ee(t.layers,r,t.visibleLayers)}readSublayers(e,t,r){return ee(t.layers,r)}writeSublayers(e,t,r,o){t.layers=[];const s=new Map,i=e.flatten(({sublayers:e})=>e??[]);for(const a of i)if("number"==typeof a.parent?.id){const e=s.get(a.parent.id);null!=e?e.push(a.id):s.set(a.parent.id,[a.id])}for(const a of i){const e={sublayer:a,...o},r=a.write({parentLayerId:"number"==typeof a.parent?.id?a.parent.id:-1},e);if(s.has(a.id)&&(r.sublayerIds=s.get(a.id)),!a.sublayers&&a.name){const r=a.write({},e);delete r.id,t.layers.push(r)}}t.visibleLayers=i.filter(({visible:e,sublayers:t})=>e&&!t).map(({name:e})=>e).toArray()}set url(e){if(!e)return void this._set("url",e);const{path:t,query:r}=h(e);for(const s in r)/^(request|service)$/i.test(s)&&delete r[s];const o=g(t,r??{});this._set("url",o)}createExportImageParameters(e,t,r,o){const s=o?.pixelRatio??1,i=L({extent:e,width:t})*s,a=new H({layer:this,scale:i}),{xmin:n,ymin:l,xmax:p,ymax:m,spatialReference:u}=e,c=z(u,this.spatialReferences),y="1.3.0"===this.version&&N(c)?`${l},${n},${m},${p}`:`${n},${l},${p},${m}`,f=a.toJSON(),d="1.3.0"===this.version?"crs":"srs";return{bbox:y,[d]:null==c||isNaN(c)?void 0:"EPSG:"+c,...f}}async fetchImage(e,t,r,o){const i=this.mapUrl,a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=A(o?.timeExtent),l={responseType:"image",query:this._mixCustomParameters({width:t,height:r,...a,time:n,...this.refreshParameters}),signal:o?.signal};return s(i??"",l).then(e=>e.data)}async fetchImageBitmap(e,t,r,o){const i=this.mapUrl??"",a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=A(o?.timeExtent),l={responseType:"blob",query:this._mixCustomParameters({width:t,height:r,...a,time:n,...this.refreshParameters}),signal:o?.signal},{data:p}=await s(i,l);return G(p,i,o?.signal)}fetchFeatureInfo(e,t,r,o,s){const i=L({extent:e,width:t}),a=new H({layer:this,scale:i}),n=D(a.visibleSublayers);if(null==this.featureInfoUrl||null==n)return Promise.resolve([]);if(null==this.fetchFeatureInfoFunction&&null==this.featureInfoFormat)return Promise.resolve([]);const l="1.3.0"===this.version?{I:o,J:s}:{x:o,y:s},p={query_layers:n,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:t,height:r,...l},m={...this.createExportImageParameters(e,t,r),...p},u=this._mixCustomParameters(m);return null!=this.fetchFeatureInfoFunction?this.fetchFeatureInfoFunction(u):this._defaultFetchFeatureInfoFunction(g(this.featureInfoUrl,u))}findSublayerById(e){return this.allSublayers.find(t=>t.id===e)}findSublayerByName(e){return this.allSublayers.find(t=>t.name===e)}serviceSupportsSpatialReference(e){return $(this.url)||null!=this.spatialReferences&&this.spatialReferences.some(t=>{const r=900913===t?E.WebMercator:new E({wkid:t});return O(r,e)})}_defaultFetchFeatureInfoFunction(e){const t=document.createElement("iframe");t.src=b(d.sanitizeUrl(w(e))),t.style.border="none",t.style.margin="0",t.style.width="100%",t.setAttribute("sandbox","");const s=new o({title:this.title,content:t}),i=new r({sourceLayer:this,popupTemplate:s});return Promise.resolve([i])}async _fetchService(e){if(!this.resourceInfo&&this.parsedUrl?.path){const{path:t,query:r}=this.parsedUrl,{data:o}=await s(t,{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...r,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=J(o)}if(this.parsedUrl){const e=new v(this.parsedUrl.path),{httpsDomains:r}=t.request;"https"!==e.scheme||e.port&&"443"!==e.port||!e.host||r.includes(e.host)||r.push(e.host)}this.read(this.resourceInfo,{origin:"service"})}_checkLayerValidity(){if(!this.allSublayers.length)throw new n("wmslayer:empty-layer","The layer doesn't have any sublayer")}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const t={...this.customParameters,...this.customLayerParameters};for(const r in t)e[r.toLowerCase()]=t[r];return e}};function Z(e,t){return e.some(e=>{for(const r in e)if(P(e,r,null,t))return!0;return!1})}function ee(e,t,r){e=e??[];const o=new Map;e.every(e=>null==e.id)&&(e=p(e)).forEach((e,t)=>e.id=t);for(const i of e){const e=new V;e.read(i,t),r&&!r.includes(e.name)&&(e.visible=!1),o.set(e.id,e)}const s=[];for(const a of e){const e=null!=a.id?o.get(a.id):null;if(e)if(null!=a.parentLayerId&&a.parentLayerId>=0){const t=o.get(a.parentLayerId);if(!t)continue;t.sublayers||(t.sublayers=new i),t.sublayers.push(e)}else s.push(e)}return s}e([x({readOnly:!0})],Y.prototype,"allSublayers",void 0),e([x({json:{type:Object,write:!0}})],Y.prototype,"customParameters",void 0),e([x({json:{type:Object,write:!0}})],Y.prototype,"customLayerParameters",void 0),e([x({type:String,json:{write:!0}})],Y.prototype,"copyright",void 0),e([x()],Y.prototype,"description",void 0),e([x({readOnly:!0})],Y.prototype,"dimensions",void 0),e([x({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],Y.prototype,"fullExtent",void 0),e([I(["web-document","portal-item"],"fullExtent",["extent"])],Y.prototype,"readFullExtentFromItemOrMap",null),e([F(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],Y.prototype,"writeFullExtent",null),e([x({type:[R]})],Y.prototype,"fullExtents",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"featureInfoFormat",null),e([x({type:[String],readOnly:!0})],Y.prototype,"featureInfoFormats",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"featureInfoUrl",void 0),e([x()],Y.prototype,"fetchFeatureInfoFunction",void 0),e([x({type:String,json:{origins:{"web-document":{default:"image/png",type:Q.jsonValues,read:{reader:Q.read,source:"format"},write:{writer:Q.write,target:"format"}}}}})],Y.prototype,"imageFormat",void 0),e([I("imageFormat",["supportedImageFormatTypes"])],Y.prototype,"readImageFormat",null),e([x({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],Y.prototype,"imageMaxHeight",void 0),e([x({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],Y.prototype,"imageMaxWidth",void 0),e([x()],Y.prototype,"imageTransparency",void 0),e([x(B)],Y.prototype,"legendEnabled",void 0),e([x({type:["show","hide","hide-children"]})],Y.prototype,"listMode",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"mapUrl",void 0),e([x({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Y.prototype,"isReference",void 0),e([x({type:["WMS"]})],Y.prototype,"operationalLayerType",void 0),e([x()],Y.prototype,"resourceInfo",void 0),e([x({type:E,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],Y.prototype,"spatialReference",void 0),e([I(["web-document","portal-item"],"spatialReference",["spatialReferences"])],Y.prototype,"readSpatialReferenceFromItemOrDocument",null),e([x({type:[j],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],Y.prototype,"spatialReferences",void 0),e([F(["web-document","portal-item"],"spatialReferences")],Y.prototype,"writeSpatialReferences",null),e([x({type:i.ofType(V),json:{write:{target:"layers",overridePolicy(e,t,r){if(Z(this.allSublayers,r))return{ignoreOrigin:!0}}}}})],Y.prototype,"sublayers",void 0),e([I(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],Y.prototype,"readSublayersFromItemOrMap",null),e([I("service","sublayers",["layers"])],Y.prototype,"readSublayers",null),e([F("sublayers",{layers:{type:[V]},visibleLayers:{type:[String]}})],Y.prototype,"writeSublayers",null),e([x({json:{read:!1},readOnly:!0,value:"wms"})],Y.prototype,"type",void 0),e([x(k)],Y.prototype,"url",null),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Y.prototype,"version",void 0),Y=e([S("esri.layers.WMSLayer")],Y);const te=Y;export{te as default};
|
package/layers/WebTileLayer.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import r from"../core/Error.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{replace as o}from"../core/string.js";import{Url as s,ensureTrailingSlash as i,isProtocolRelative as n,normalize as a}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import f from"../geometry/Extent.js";import y from"../geometry/Point.js";import h from"../geometry/SpatialReference.js";import d from"./Layer.js";import{BlendLayer as v}from"./mixins/BlendLayer.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as g}from"./mixins/PortalLayer.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as T}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as b}from"./support/imageBitmapUtils.js";import R from"./support/LOD.js";import S from"./support/TileInfo.js";import{WMTSLayerInfo as x}from"./support/WMTSLayerInfo.js";var L;let U=L=class extends(v(j(T(w(g(l(d))))))){constructor(...e){super(...e),this.copyright="",this.fullExtent=new f(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,h.WebMercator),this.legendEnabled=!1,this.isReference=null,this.popupEnabled=!1,this.spatialReference=h.WebMercator,this.subDomains=null,this.tileInfo=new S({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new y({x:-20037508.342787,y:20037508.342787,spatialReference:h.WebMercator}),spatialReference:h.WebMercator,lods:[new R({level:0,scale:591657527.591555,resolution:156543.033928}),new R({level:1,scale:295828763.795777,resolution:78271.5169639999}),new R({level:2,scale:147914381.897889,resolution:39135.7584820001}),new R({level:3,scale:73957190.948944,resolution:19567.8792409999}),new R({level:4,scale:36978595.474472,resolution:9783.93962049996}),new R({level:5,scale:18489297.737236,resolution:4891.96981024998}),new R({level:6,scale:9244648.868618,resolution:2445.98490512499}),new R({level:7,scale:4622324.434309,resolution:1222.99245256249}),new R({level:8,scale:2311162.217155,resolution:611.49622628138}),new R({level:9,scale:1155581.108577,resolution:305.748113140558}),new R({level:10,scale:577790.554289,resolution:152.874056570411}),new R({level:11,scale:288895.277144,resolution:76.4370282850732}),new R({level:12,scale:144447.638572,resolution:38.2185141425366}),new R({level:13,scale:72223.819286,resolution:19.1092570712683}),new R({level:14,scale:36111.909643,resolution:9.55462853563415}),new R({level:15,scale:18055.954822,resolution:4.77731426794937}),new R({level:16,scale:9027.977411,resolution:2.38865713397468}),new R({level:17,scale:4513.988705,resolution:1.19432856685505}),new R({level:18,scale:2256.994353,resolution:.597164283559817}),new R({level:19,scale:1128.497176,resolution:.298582141647617}),new R({level:20,scale:564.248588,resolution:.14929107082380833}),new R({level:21,scale:282.124294,resolution:.07464553541190416}),new R({level:22,scale:141.062147,resolution:.03732276770595208}),new R({level:23,scale:70.5310735,resolution:.01866138385297604})]}),this.type="web-tile",this.urlTemplate=null,this.wmtsInfo=null}normalizeCtorArgs(e,t){return"string"==typeof e?{urlTemplate:e,...t}:e}load(e){const t=this.loadFromPortal({supportedTypes:["WMTS"]},e).then(()=>{let e="";if(this.urlTemplate)if(this.spatialReference.equals(this.tileInfo.spatialReference)){const t=new s(this.urlTemplate);!(!!this.subDomains&&this.subDomains.length>0)&&t.authority?.includes("{subDomain}")&&(e="is missing 'subDomains' property")}else e="spatialReference must match tileInfo.spatialReference";else e="is missing the required 'urlTemplate' property value";if(e)throw new r("web-tile-layer:load",`WebTileLayer (title: '${this.title}', id: '${this.id}') ${e}`)});return this.addResolvingPromise(t),Promise.resolve(this)}get levelValues(){const e=[];if(!this.tileInfo)return null;for(const t of this.tileInfo.lods)e[t.level]=t.levelValue||t.level;return e}readSpatialReference(e,t){return e||h.fromJSON(t.fullExtent?.spatialReference)}get tileServers(){if(!this.urlTemplate)return null;const e=[],{urlTemplate:t,subDomains:r}=this,l=new s(t),o=l.scheme?l.scheme+"://":"//",n=o+l.authority+"/",a=l.authority;if(a?.includes("{subDomain}")){if(r&&r.length>0&&a.split(".").length>1)for(const s of r)e.push(o+a.replaceAll(/\{subDomain\}/gi,s)+"/")}else e.push(n);return e.map(i)}get urlPath(){if(!this.urlTemplate)return null;const e=this.urlTemplate,t=new s(e),r=(t.scheme?t.scheme+"://":"//")+t.authority+"/";return e.slice(r.length)}readUrlTemplate(e,t){return e||t.templateUrl}writeUrlTemplate(e,t){n(e)&&(e="https:"+e),e&&(e=e.replaceAll(/\{z\}/gi,"{level}").replaceAll(/\{x\}/gi,"{col}").replaceAll(/\{y\}/gi,"{row}"),e=a(e)),t.templateUrl=e}fetchTile(e,r,l,o={}){const{signal:s}=o,i=this.getTileUrl(e,r,l),n={responseType:"image",signal:s,query:{...this.refreshParameters}};return t(i,n).then(e=>e.data)}async fetchImageBitmapTile(e,r,l,o={}){const{signal:s}=o;if(this.fetchTile!==L.prototype.fetchTile){const t=await this.fetchTile(e,r,l,o);return b(t,e,r,l,s)}const i=this.getTileUrl(e,r,l),n={responseType:"blob",signal:s,query:{...this.refreshParameters}},{data:a}=await t(i,n);return b(a,e,r,l,s)}getTileUrl(e,t,r){const{levelValues:l,tileServers:s,urlPath:i}=this;if(!l||!s||!i)return"";const n=l[e];return s[t%s.length]+o(i,{level:n,z:n,col:r,x:r,row:t,y:t})}};e([p({type:String,value:"",json:{write:!0}})],U.prototype,"copyright",void 0),e([p({type:f,json:{write:!0},nonNullable:!0})],U.prototype,"fullExtent",void 0),e([p({readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"legendEnabled",void 0),e([p({type:["show","hide"]})],U.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],U.prototype,"blendMode",void 0),e([p()],U.prototype,"levelValues",null),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],U.prototype,"isReference",void 0),e([p({type:["WebTiledLayer"],value:"WebTiledLayer"})],U.prototype,"operationalLayerType",void 0),e([p({readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"popupEnabled",void 0),e([p({type:h})],U.prototype,"spatialReference",void 0),e([u("spatialReference",["spatialReference","fullExtent.spatialReference"])],U.prototype,"readSpatialReference",null),e([p({type:[String],json:{write:!0}})],U.prototype,"subDomains",void 0),e([p({type:S,json:{write:!0}})],U.prototype,"tileInfo",void 0),e([p({readOnly:!0})],U.prototype,"tileServers",null),e([p({json:{read:!1}})],U.prototype,"type",void 0),e([p()],U.prototype,"urlPath",null),e([p({type:String,json:{origins:{"portal-item":{read:{source:"url"}}}}})],U.prototype,"urlTemplate",void 0),e([u("urlTemplate",["urlTemplate","templateUrl"])],U.prototype,"readUrlTemplate",null),e([c("urlTemplate",{templateUrl:{type:String}})],U.prototype,"writeUrlTemplate",null),e([p({type:x,json:{write:!0}})],U.prototype,"wmtsInfo",void 0),U=L=e([m("esri.layers.WebTileLayer")],U);export{U as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import r from"../core/Error.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{replace as o}from"../core/string.js";import{Url as s,ensureTrailingSlash as i,isProtocolRelative as n,normalize as a}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import f from"../geometry/Extent.js";import y from"../geometry/Point.js";import h from"../geometry/SpatialReference.js";import d from"./Layer.js";import{BlendLayer as v}from"./mixins/BlendLayer.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as g}from"./mixins/PortalLayer.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as T}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as b}from"./support/imageBitmapUtils.js";import R from"./support/LOD.js";import S from"./support/TileInfo.js";import{WMTSLayerInfo as x}from"./support/WMTSLayerInfo.js";var L;let U=L=class extends(v(j(T(w(g(l(d))))))){constructor(...e){super(...e),this.copyright="",this.fullExtent=new f(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,h.WebMercator),this.legendEnabled=!1,this.isReference=null,this.popupEnabled=!1,this.spatialReference=h.WebMercator,this.subDomains=null,this.tileInfo=new S({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new y({x:-20037508.342787,y:20037508.342787,spatialReference:h.WebMercator}),spatialReference:h.WebMercator,lods:[new R({level:0,scale:591657527.591555,resolution:156543.033928}),new R({level:1,scale:295828763.795777,resolution:78271.5169639999}),new R({level:2,scale:147914381.897889,resolution:39135.7584820001}),new R({level:3,scale:73957190.948944,resolution:19567.8792409999}),new R({level:4,scale:36978595.474472,resolution:9783.93962049996}),new R({level:5,scale:18489297.737236,resolution:4891.96981024998}),new R({level:6,scale:9244648.868618,resolution:2445.98490512499}),new R({level:7,scale:4622324.434309,resolution:1222.99245256249}),new R({level:8,scale:2311162.217155,resolution:611.49622628138}),new R({level:9,scale:1155581.108577,resolution:305.748113140558}),new R({level:10,scale:577790.554289,resolution:152.874056570411}),new R({level:11,scale:288895.277144,resolution:76.4370282850732}),new R({level:12,scale:144447.638572,resolution:38.2185141425366}),new R({level:13,scale:72223.819286,resolution:19.1092570712683}),new R({level:14,scale:36111.909643,resolution:9.55462853563415}),new R({level:15,scale:18055.954822,resolution:4.77731426794937}),new R({level:16,scale:9027.977411,resolution:2.38865713397468}),new R({level:17,scale:4513.988705,resolution:1.19432856685505}),new R({level:18,scale:2256.994353,resolution:.597164283559817}),new R({level:19,scale:1128.497176,resolution:.298582141647617}),new R({level:20,scale:564.248588,resolution:.14929107082380833}),new R({level:21,scale:282.124294,resolution:.07464553541190416}),new R({level:22,scale:141.062147,resolution:.03732276770595208}),new R({level:23,scale:70.5310735,resolution:.01866138385297604})]}),this.type="web-tile",this.urlTemplate=null,this.wmtsInfo=null}normalizeCtorArgs(e,t){return"string"==typeof e?{urlTemplate:e,...t}:e}load(e){const t=this.loadFromPortal({supportedTypes:["WMTS"]},e).then(()=>{let e="";if(this.urlTemplate)if(this.spatialReference.equals(this.tileInfo.spatialReference)){const t=new s(this.urlTemplate);!(!!this.subDomains&&this.subDomains.length>0)&&t.authority?.includes("{subDomain}")&&(e="is missing 'subDomains' property")}else e="spatialReference must match tileInfo.spatialReference";else e="is missing the required 'urlTemplate' property value";if(e)throw new r("web-tile-layer:load",`WebTileLayer (title: '${this.title}', id: '${this.id}') ${e}`)});return this.addResolvingPromise(t),Promise.resolve(this)}get levelValues(){const e=[];if(!this.tileInfo)return null;for(const t of this.tileInfo.lods)e[t.level]=t.levelValue||t.level;return e}get loaded(){return super.loaded}readSpatialReference(e,t){return e||h.fromJSON(t.fullExtent?.spatialReference)}get tileServers(){if(!this.urlTemplate)return null;const e=[],{urlTemplate:t,subDomains:r}=this,l=new s(t),o=l.scheme?l.scheme+"://":"//",n=o+l.authority+"/",a=l.authority;if(a?.includes("{subDomain}")){if(r&&r.length>0&&a.split(".").length>1)for(const s of r)e.push(o+a.replaceAll(/\{subDomain\}/gi,s)+"/")}else e.push(n);return e.map(i)}get urlPath(){if(!this.urlTemplate)return null;const e=this.urlTemplate,t=new s(e),r=(t.scheme?t.scheme+"://":"//")+t.authority+"/";return e.slice(r.length)}readUrlTemplate(e,t){return e||t.templateUrl}writeUrlTemplate(e,t){n(e)&&(e="https:"+e),e&&(e=e.replaceAll(/\{z\}/gi,"{level}").replaceAll(/\{x\}/gi,"{col}").replaceAll(/\{y\}/gi,"{row}"),e=a(e)),t.templateUrl=e}fetchTile(e,r,l,o={}){const{signal:s}=o,i=this.getTileUrl(e,r,l),n={responseType:"image",signal:s,query:{...this.refreshParameters}};return t(i,n).then(e=>e.data)}async fetchImageBitmapTile(e,r,l,o={}){const{signal:s}=o;if(this.fetchTile!==L.prototype.fetchTile){const t=await this.fetchTile(e,r,l,o);return b(t,e,r,l,s)}const i=this.getTileUrl(e,r,l),n={responseType:"blob",signal:s,query:{...this.refreshParameters}},{data:a}=await t(i,n);return b(a,e,r,l,s)}getTileUrl(e,t,r){const{levelValues:l,tileServers:s,urlPath:i}=this;if(!l||!s||!i)return"";const n=l[e];return s[t%s.length]+o(i,{level:n,z:n,col:r,x:r,row:t,y:t})}};e([p({type:String,value:"",json:{write:!0}})],U.prototype,"copyright",void 0),e([p({type:f,json:{write:!0},nonNullable:!0})],U.prototype,"fullExtent",void 0),e([p({readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"legendEnabled",void 0),e([p({type:["show","hide"]})],U.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],U.prototype,"blendMode",void 0),e([p()],U.prototype,"levelValues",null),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],U.prototype,"isReference",void 0),e([p({type:["WebTiledLayer"],value:"WebTiledLayer"})],U.prototype,"operationalLayerType",void 0),e([p({readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"popupEnabled",void 0),e([p({type:h})],U.prototype,"spatialReference",void 0),e([u("spatialReference",["spatialReference","fullExtent.spatialReference"])],U.prototype,"readSpatialReference",null),e([p({type:[String],json:{write:!0}})],U.prototype,"subDomains",void 0),e([p({type:S,json:{write:!0}})],U.prototype,"tileInfo",void 0),e([p({readOnly:!0})],U.prototype,"tileServers",null),e([p({json:{read:!1}})],U.prototype,"type",void 0),e([p()],U.prototype,"urlPath",null),e([p({type:String,json:{origins:{"portal-item":{read:{source:"url"}}}}})],U.prototype,"urlTemplate",void 0),e([u("urlTemplate",["urlTemplate","templateUrl"])],U.prototype,"readUrlTemplate",null),e([c("urlTemplate",{templateUrl:{type:String}})],U.prototype,"writeUrlTemplate",null),e([p({type:x,json:{write:!0}})],U.prototype,"wmtsInfo",void 0),U=L=e([m("esri.layers.WebTileLayer")],U);export{U as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import r from"../../core/Collection.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{clone as e}from"../../core/lang.js";import{generateUUID as i}from"../../core/uuid.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"./BuildingFilterAuthoringInfo.js";import l from"./BuildingFilterAuthoringInfoCheckbox.js";import c from"./BuildingFilterBlock.js";var d;const u=r.ofType(c);let m=d=class extends t{constructor(){super(
|
|
5
|
+
import{__decorate as o}from"tslib";import r from"../../core/Collection.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{clone as e}from"../../core/lang.js";import{generateUUID as i}from"../../core/uuid.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"./BuildingFilterAuthoringInfo.js";import l from"./BuildingFilterAuthoringInfoCheckbox.js";import c from"./BuildingFilterBlock.js";var d;const u=r.ofType(c);let m=d=class extends t{constructor(o){super(o),this.description=null,this.filterBlocks=null,this.id=i(),this.name=null}clone(){return new d({description:this.description,filterBlocks:e(this.filterBlocks),id:this.id,name:this.name,filterAuthoringInfo:e(this.filterAuthoringInfo)})}};o([s({type:String,json:{write:!0}})],m.prototype,"description",void 0),o([s({type:u,json:{write:{enabled:!0,isRequired:!0}}})],m.prototype,"filterBlocks",void 0),o([s({types:{key:"type",base:n,typeMap:{checkbox:l}},json:{read:o=>"checkbox"===o?.type?l.fromJSON(o):null,write:!0}})],m.prototype,"filterAuthoringInfo",void 0),o([s({type:String,constructOnly:!0,json:{write:{enabled:!0,isRequired:!0}}})],m.prototype,"id",void 0),o([s({type:String,json:{write:{enabled:!0,isRequired:!0}}})],m.prototype,"name",void 0),m=d=o([p("esri.layers.support.BuildingFilter")],m);export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import f from"./FieldGroup.js";import{isStringField as d,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";import{getNormalizedFeatureTypeInfo as g}from"../../widgets/FeatureForm/featureFormUtils.js";var h;let V=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){return g(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t?.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await C(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await x(n,t);if(i){const t=i.map(t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map(t=>e.fieldsIndex.normalizeFieldName(t))}));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then(()=>this._initializeContingentValues(this.fieldGroupDefinitions,e));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some(e=>t.includes(e)))continue;if(!o.fields.every(e=>n.includes(e))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter(e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l);if(0!==c.length){for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter(e=>e.fields.includes(t));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter(e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=b(i);p[e]||a.push(i),p[e]=!0}}c&&(a=j(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t?.hasContingentValuesDefinition){return(await v(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return void 0!==t?.hasContingentValuesDefinition?[]:C(i,e).then(async t=>{if(t.supportsQueryDataElements){return(await x(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return[]})}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n?.hasContingentValuesDefinition){const n=await S(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await F(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map(e=>{const n=t.contingentValuesDefinition.fieldGroups.find(t=>t.name===e.name);if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new f({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach(n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))}),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find(e=>e.domain===o?.name);e&&(t=e.entries[t])}const u=o?.codedValues.find(e=>e.code===t),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map(e=>{const n=i.find(t=>t.name===e.name);if(n){const i=n.contingencies.map(n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(d(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find(e=>e.code===s),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})});return new f({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.code===e);n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.name===e);n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?O(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function b(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function j(e){let t,n;e.sort((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue);const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function T(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function w(e,t){const n=[];for(const i of e)t.some(e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1})&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?T(e,t):w(e,t)}async function v(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data.fieldGroups??[])}async function x(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function C(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then(e=>e.data)}async function F(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.contingentValueSets?.[0])}async function S(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data)}function O(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find(([e])=>e.trim().toLowerCase()===t.trim().toLowerCase())||[];return i||null}return null}e([o({constructOnly:!0})],V.prototype,"layer",void 0),e([o({constructOnly:!0})],V.prototype,"request",void 0),e([o({type:[f]})],V.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],V.prototype,"fieldGroupDefinitions",void 0),e([o()],V.prototype,"subtypeFieldName",null),V=h=e([r("esri.layers.support.LayerContingentValuesCache")],V);const D=V;export{D as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";import{getNormalizedFeatureTypeInfo as g}from"../../widgets/FeatureForm/featureFormUtils.js";var h;let V=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get loaded(){return super.loaded}get subtypeFieldName(){return g(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t?.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await C(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await x(n,t);if(i){const t=i.map(t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map(t=>e.fieldsIndex.normalizeFieldName(t))}));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then(()=>this._initializeContingentValues(this.fieldGroupDefinitions,e));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some(e=>t.includes(e)))continue;if(!o.fields.every(e=>n.includes(e))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter(e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l);if(0!==c.length){for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter(e=>e.fields.includes(t));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter(e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=b(i);p[e]||a.push(i),p[e]=!0}}c&&(a=j(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t?.hasContingentValuesDefinition){return(await v(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return void 0!==t?.hasContingentValuesDefinition?[]:C(i,e).then(async t=>{if(t.supportsQueryDataElements){return(await x(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return[]})}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n?.hasContingentValuesDefinition){const n=await S(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await F(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map(e=>{const n=t.contingentValuesDefinition.fieldGroups.find(t=>t.name===e.name);if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach(n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))}),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find(e=>e.domain===o?.name);e&&(t=e.entries[t])}const u=o?.codedValues.find(e=>e.code===t),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map(e=>{const n=i.find(t=>t.name===e.name);if(n){const i=n.contingencies.map(n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find(e=>e.code===s),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})});return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.code===e);n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.name===e);n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?O(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function b(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function j(e){let t,n;e.sort((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue);const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function T(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function w(e,t){const n=[];for(const i of e)t.some(e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1})&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?T(e,t):w(e,t)}async function v(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data.fieldGroups??[])}async function x(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function C(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then(e=>e.data)}async function F(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.contingentValueSets?.[0])}async function S(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data)}function O(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find(([e])=>e.trim().toLowerCase()===t.trim().toLowerCase())||[];return i||null}return null}e([o({constructOnly:!0})],V.prototype,"layer",void 0),e([o({constructOnly:!0})],V.prototype,"request",void 0),e([o({type:[d]})],V.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],V.prototype,"fieldGroupDefinitions",void 0),e([o()],V.prototype,"subtypeFieldName",null),V=h=e([r("esri.layers.support.LayerContingentValuesCache")],V);const D=V;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Extent.js";let s=class extends t{constructor(){super(
|
|
5
|
+
import{__decorate as o}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Extent.js";let s=class extends t{constructor(o){super(o),this.extent=null,this.height=null,this.href=null,this.opacity=1,this.rotation=0,this.scale=null,this.visible=!0,this.width=null}};o([r({type:p})],s.prototype,"extent",void 0),o([r()],s.prototype,"height",void 0),o([r()],s.prototype,"href",void 0),o([r()],s.prototype,"opacity",void 0),o([r()],s.prototype,"rotation",void 0),o([r()],s.prototype,"scale",void 0),o([r()],s.prototype,"visible",void 0),o([r()],s.prototype,"width",void 0),s=o([e("esri.layers.support.MapImage")],s);export{s as default};
|
package/networks/Network.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../Graphic.js";import r from"../request.js";import o from"../core/Error.js";import{Loadable as s}from"../core/Loadable.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{isAbortError as n}from"../core/promiseUtils.js";import{urlToObject as l}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import c from"../geometry/Extent.js";import p from"../geometry/SpatialReference.js";import{fromJSON as m}from"../geometry/support/jsonUtils.js";import{versionMatches as h,onApplyEditsEvent as y,onUpdateMomentEvent as f,emitApplyEditsEvent as g}from"../layers/mixins/EditBusLayer.js";import{parse as v}from"../layers/support/arcgisLayerUrl.js";import w from"./support/TopologyValidationJobInfo.js";import{networkFromPortalItem as S}from"./support/utils.js";import{isVersionInEditSession as j,currentSessionId as b,isSafeToEditVersion as I}from"../versionManagement/support/versionManagementUtils.js";let U=class extends(a(s)){static fromPortalItem(e){return S(e)}constructor(e){super(e),this.id=null,this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null,this._historicMoment=null,this._gdbVersion=null,this._sourceIdByLayerId=new Map,this._layerIdBySourceId=new Map,this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:o}=e,s=t===this.featureServiceUrl,i=h(t,r,this.gdbVersion);s&&i&&o.then(e=>{j(t,r)&&(this.historicMoment=e.historicMoment)})},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:r,moment:o}=e,s=t===this.featureServiceUrl,i=h(t,r,this.gdbVersion);s&&i&&(this.historicMoment=o)},this.when().then(()=>{this.addHandles([y(this._applyEditsHandler),f(this._updateMomentHandler)])},()=>{})}initialize(){this.when().catch(e=>{n(e)||i.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})})}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){return l(this.layerUrl)}get featureServiceUrl(){return v(this.parsedUrl.path).url.path}get networkServiceUrl(){return this.featureServiceUrl.replace(/\/FeatureServer/i,"/UtilityNetworkServer")}get layerId(){return v(this.parsedUrl.path).sublayer}get networkSystemLayers(){return null}get gdbVersion(){return this._gdbVersion}set gdbVersion(e){this._gdbVersion=e}get historicMoment(){return this._historicMoment}set historicMoment(e){this._historicMoment=e}async load(e){return this.addResolvingPromise(this._load(e)),this}async _load(e){await Promise.all([this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e),this._fetchLayerMetaData(this.layerUrl,e)])}getLayerIdBySourceId(e){if(!this.dataElement)return null;const t=this._layerIdBySourceId.get(e);if(null!=t)return t;const r=this.dataElement.domainNetworks,o=this._traverseNetworkSources(r,this._layerIdBySourceId,"sourceId","layerId",e);return o>=0?o:null}getSourceIdByLayerId(e){if(!this.dataElement)return null;const t=this._sourceIdByLayerId.get(e);if(null!=t)return t;const r=this.dataElement.domainNetworks,o=this._traverseNetworkSources(r,this._sourceIdByLayerId,"layerId","sourceId",e);return o>=0?o:null}getObjectIdsFromElements(e){const t=[],r=new Map;for(const s of e){const e=this.getLayerIdBySourceId(s.networkSourceId);if(null==e)continue;let t=r.get(e);void 0===t&&(t=[]),t.push(s.objectId),r.set(e,t)}const o=this.featureServiceUrl;return r.forEach((e,r)=>t.push({layerUrl:`${o}/${r}`,objectIds:e})),t}async queryNamedTraceConfigurations(e,t){const[{queryNamedTraceConfigurations:r},{default:o}]=await Promise.all([import("../rest/networks/queryNamedTraceConfigurations.js"),import("../rest/networks/support/QueryNamedTraceConfigurationsParameters.js")]),s=this.networkServiceUrl,i=o.from(e);return(await r(s,i,{...t}))?.namedTraceConfigurations}async validateTopology(e,t){if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");const[{validateNetworkTopology:r},{default:s}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),i=s.from(e);j(this.featureServiceUrl,this.gdbVersion||null)?(i.sessionID=b,await I(this.featureServiceUrl,this.gdbVersion,!0)):i.sessionID=null,i.gdbVersion=this.gdbVersion;const a=this.networkServiceUrl,n=this.featureServiceUrl,l=g(n,null,this.gdbVersion,!0),d=await r(a,i,{...t});if(d?.serviceEdits){const e=[];for(const t of d.serviceEdits){const{editedFeatures:r}=t,o=r?.spatialReference?new p(r.spatialReference):null;e.push({layerId:t.layerId,editedFeatures:{adds:r?.adds?.map(e=>k(e,o))||[],updates:r?.updates?.map(e=>({original:k(e[0],o),current:k(e[1],o)}))||[],deletes:r?.deletes?.map(e=>k(e,o))||[],spatialReference:o}})}l.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],editedFeatures:e,exceededTransferLimit:!1,historicMoment:d.moment})}return d}async submitTopologyValidationJob(e,t){let s=null;if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");if(!this.gdbVersion){const e=this.layerUrl.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,"");s=(await r(e,{responseType:"json",query:{f:"json"}})).data.defaultVersionName}const[{submitValidateNetworkTopologyJob:i},{default:a}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),n=a.from(e);j(this.featureServiceUrl,this.gdbVersion||null)?(n.sessionID=b,await I(this.featureServiceUrl,this.gdbVersion,!0)):n.sessionID=null,n.gdbVersion=this.gdbVersion||s;const l=this.networkServiceUrl,d=this.featureServiceUrl?g(this.featureServiceUrl,null,this.gdbVersion,!0):void 0,u=await i(l,n,{...t});return new w({statusUrl:u,editsResolver:d})}getSourceTypeById(e){if(!this.dataElement)return null;for(const t of this.dataElement.domainNetworks)for(const r of[t.edgeSources??[],t.junctionSources??[]])for(const o of r)if(o.sourceId===e)return r===t.edgeSources?"edge":"junction";return null}_traverseNetworkSources(e,t,r,o,s){for(const i of e)for(const e of[i.edgeSources??[],i.junctionSources??[]])for(const i of e)if(i[r]===s)return t.set(s,i[o]),i[o];return-1}async _fetchLayerMetaData(e,t){const o=await r(e,{responseType:"json",query:{f:"json"},...t});this.sourceJSON=o.data,this.read(o.data,{origin:"service"})}async _fetchDataElement(e,t,o){if(this.dataElement)return;const s=await r(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([t]),f:"json"},...o}).then(e=>e.data.layerDataElements?.[0]);s&&this.read(s,{origin:"service"})}};function k(e,r){return new t({attributes:e.attributes,geometry:m({...e.geometry,spatialReference:r})})}e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:!0}},read:!1}})],U.prototype,"id",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:{source:"name"}}},read:!1}})],U.prototype,"title",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:"url"},write:{target:"url",isRequired:!0}}},read:!1}})],U.prototype,"layerUrl",void 0),e([d({type:Object,json:{origins:{service:{read:!0}},read:!1}})],U.prototype,"dataElement",void 0),e([d({type:c,json:{origins:{service:{read:{source:"extent"}}},read:!1}})],U.prototype,"fullExtent",void 0),e([d({type:p,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:!1}})],U.prototype,"spatialReference",void 0),e([d({type:["utility","trace"],readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"type",void 0),e([d({readOnly:!0})],U.prototype,"datasetName",null),e([d({readOnly:!0})],U.prototype,"owner",null),e([d({readOnly:!0})],U.prototype,"schemaGeneration",null),e([d({readOnly:!0})],U.prototype,"parsedUrl",null),e([d({readOnly:!0})],U.prototype,"featureServiceUrl",null),e([d({readOnly:!0})],U.prototype,"networkServiceUrl",null),e([d({readOnly:!0})],U.prototype,"layerId",null),e([d()],U.prototype,"sourceJSON",void 0),e([d({readOnly:!0})],U.prototype,"networkSystemLayers",null),e([d({type:String})],U.prototype,"gdbVersion",null),e([d({type:Date})],U.prototype,"historicMoment",null),e([d()],U.prototype,"_historicMoment",void 0),e([d()],U.prototype,"_gdbVersion",void 0),U=e([u("esri.networks.Network")],U);const N=U;export{N as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Graphic.js";import r from"../request.js";import o from"../core/Error.js";import{Loadable as s}from"../core/Loadable.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{isAbortError as n}from"../core/promiseUtils.js";import{urlToObject as l}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import c from"../geometry/Extent.js";import p from"../geometry/SpatialReference.js";import{fromJSON as m}from"../geometry/support/jsonUtils.js";import{versionMatches as h,onApplyEditsEvent as y,onUpdateMomentEvent as f,emitApplyEditsEvent as g}from"../layers/mixins/EditBusLayer.js";import{parse as v}from"../layers/support/arcgisLayerUrl.js";import w from"./support/TopologyValidationJobInfo.js";import{networkFromPortalItem as S}from"./support/utils.js";import{isVersionInEditSession as j,currentSessionId as b,isSafeToEditVersion as I}from"../versionManagement/support/versionManagementUtils.js";let U=class extends(a(s)){static fromPortalItem(e){return S(e)}constructor(e){super(e),this.id=null,this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null,this._historicMoment=null,this._gdbVersion=null,this._sourceIdByLayerId=new Map,this._layerIdBySourceId=new Map,this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:o}=e,s=t===this.featureServiceUrl,i=h(t,r,this.gdbVersion);s&&i&&o.then(e=>{j(t,r)&&(this.historicMoment=e.historicMoment)})},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:r,moment:o}=e,s=t===this.featureServiceUrl,i=h(t,r,this.gdbVersion);s&&i&&(this.historicMoment=o)},this.when().then(()=>{this.addHandles([y(this._applyEditsHandler),f(this._updateMomentHandler)])},()=>{})}initialize(){this.when().catch(e=>{n(e)||i.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})})}get loaded(){return super.loaded}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){return l(this.layerUrl)}get featureServiceUrl(){return v(this.parsedUrl.path).url.path}get networkServiceUrl(){return this.featureServiceUrl.replace(/\/FeatureServer/i,"/UtilityNetworkServer")}get layerId(){return v(this.parsedUrl.path).sublayer}get networkSystemLayers(){return null}get gdbVersion(){return this._gdbVersion}set gdbVersion(e){this._gdbVersion=e}get historicMoment(){return this._historicMoment}set historicMoment(e){this._historicMoment=e}async load(e){return this.addResolvingPromise(this._load(e)),this}async _load(e){await Promise.all([this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e),this._fetchLayerMetaData(this.layerUrl,e)])}getLayerIdBySourceId(e){if(!this.dataElement)return null;const t=this._layerIdBySourceId.get(e);if(null!=t)return t;const r=this.dataElement.domainNetworks,o=this._traverseNetworkSources(r,this._layerIdBySourceId,"sourceId","layerId",e);return o>=0?o:null}getSourceIdByLayerId(e){if(!this.dataElement)return null;const t=this._sourceIdByLayerId.get(e);if(null!=t)return t;const r=this.dataElement.domainNetworks,o=this._traverseNetworkSources(r,this._sourceIdByLayerId,"layerId","sourceId",e);return o>=0?o:null}getObjectIdsFromElements(e){const t=[],r=new Map;for(const s of e){const e=this.getLayerIdBySourceId(s.networkSourceId);if(null==e)continue;let t=r.get(e);void 0===t&&(t=[]),t.push(s.objectId),r.set(e,t)}const o=this.featureServiceUrl;return r.forEach((e,r)=>t.push({layerUrl:`${o}/${r}`,objectIds:e})),t}async queryNamedTraceConfigurations(e,t){const[{queryNamedTraceConfigurations:r},{default:o}]=await Promise.all([import("../rest/networks/queryNamedTraceConfigurations.js"),import("../rest/networks/support/QueryNamedTraceConfigurationsParameters.js")]),s=this.networkServiceUrl,i=o.from(e);return(await r(s,i,{...t}))?.namedTraceConfigurations}async validateTopology(e,t){if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");const[{validateNetworkTopology:r},{default:s}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),i=s.from(e);j(this.featureServiceUrl,this.gdbVersion||null)?(i.sessionID=b,await I(this.featureServiceUrl,this.gdbVersion,!0)):i.sessionID=null,i.gdbVersion=this.gdbVersion;const a=this.networkServiceUrl,n=this.featureServiceUrl,l=g(n,null,this.gdbVersion,!0),d=await r(a,i,{...t});if(d?.serviceEdits){const e=[];for(const t of d.serviceEdits){const{editedFeatures:r}=t,o=r?.spatialReference?new p(r.spatialReference):null;e.push({layerId:t.layerId,editedFeatures:{adds:r?.adds?.map(e=>k(e,o))||[],updates:r?.updates?.map(e=>({original:k(e[0],o),current:k(e[1],o)}))||[],deletes:r?.deletes?.map(e=>k(e,o))||[],spatialReference:o}})}l.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],editedFeatures:e,exceededTransferLimit:!1,historicMoment:d.moment})}return d}async submitTopologyValidationJob(e,t){let s=null;if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");if(!this.gdbVersion){const e=this.layerUrl.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,"");s=(await r(e,{responseType:"json",query:{f:"json"}})).data.defaultVersionName}const[{submitValidateNetworkTopologyJob:i},{default:a}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),n=a.from(e);j(this.featureServiceUrl,this.gdbVersion||null)?(n.sessionID=b,await I(this.featureServiceUrl,this.gdbVersion,!0)):n.sessionID=null,n.gdbVersion=this.gdbVersion||s;const l=this.networkServiceUrl,d=this.featureServiceUrl?g(this.featureServiceUrl,null,this.gdbVersion,!0):void 0,u=await i(l,n,{...t});return new w({statusUrl:u,editsResolver:d})}getSourceTypeById(e){if(!this.dataElement)return null;for(const t of this.dataElement.domainNetworks)for(const r of[t.edgeSources??[],t.junctionSources??[]])for(const o of r)if(o.sourceId===e)return r===t.edgeSources?"edge":"junction";return null}_traverseNetworkSources(e,t,r,o,s){for(const i of e)for(const e of[i.edgeSources??[],i.junctionSources??[]])for(const i of e)if(i[r]===s)return t.set(s,i[o]),i[o];return-1}async _fetchLayerMetaData(e,t){const o=await r(e,{responseType:"json",query:{f:"json"},...t});this.sourceJSON=o.data,this.read(o.data,{origin:"service"})}async _fetchDataElement(e,t,o){if(this.dataElement)return;const s=await r(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([t]),f:"json"},...o}).then(e=>e.data.layerDataElements?.[0]);s&&this.read(s,{origin:"service"})}};function k(e,r){return new t({attributes:e.attributes,geometry:m({...e.geometry,spatialReference:r})})}e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:!0}},read:!1}})],U.prototype,"id",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:{source:"name"}}},read:!1}})],U.prototype,"title",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:"url"},write:{target:"url",isRequired:!0}}},read:!1}})],U.prototype,"layerUrl",void 0),e([d({type:Object,json:{origins:{service:{read:!0}},read:!1}})],U.prototype,"dataElement",void 0),e([d({type:c,json:{origins:{service:{read:{source:"extent"}}},read:!1}})],U.prototype,"fullExtent",void 0),e([d({type:p,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:!1}})],U.prototype,"spatialReference",void 0),e([d({type:["utility","trace"],readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"type",void 0),e([d({readOnly:!0})],U.prototype,"datasetName",null),e([d({readOnly:!0})],U.prototype,"owner",null),e([d({readOnly:!0})],U.prototype,"schemaGeneration",null),e([d({readOnly:!0})],U.prototype,"parsedUrl",null),e([d({readOnly:!0})],U.prototype,"featureServiceUrl",null),e([d({readOnly:!0})],U.prototype,"networkServiceUrl",null),e([d({readOnly:!0})],U.prototype,"layerId",null),e([d()],U.prototype,"sourceJSON",void 0),e([d({readOnly:!0})],U.prototype,"networkSystemLayers",null),e([d({type:String})],U.prototype,"gdbVersion",null),e([d({type:Date})],U.prototype,"historicMoment",null),e([d()],U.prototype,"_historicMoment",void 0),e([d()],U.prototype,"_gdbVersion",void 0),U=e([u("esri.networks.Network")],U);const N=U;export{N as default};
|
package/package.json
CHANGED
package/portal/Portal.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import{JSONSupportMixin as i}from"../core/JSONSupport.js";import{Loadable as a}from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as h,throwIfAbortError as d}from"../core/promiseUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{ensureType as y}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import B from"./PortalQueryResult.js";import D from"./PortalUser.js";import{isApiKeyApplicable as G,hasBasemapStylesApiKey as _}from"../support/apiKeyUtils.js";var U;let M;const Q={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:D})};let C=class extends(i(a)){static{U=this}static{this.AUTH_MODE_ANONYMOUS="anonymous"}static{this.AUTH_MODE_AUTO="auto"}static{this.AUTH_MODE_IMMEDIATE="immediate"}static{this.AUTH_MODE_NO_PROMPT="no-prompt"}constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.default3DBasemapQuery=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.hasClassificationSchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.recycleBinEnabled=!1,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useDefault3dBasemap=!1,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){b.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get hasAPIKey(){return G(this.restUrl)}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.slice(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=D.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then(({default:t})=>{n(e),M=t}).then(()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e)).then(e=>{if(!this.hasAPIKey&&r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==U.AUTH_MODE_AUTO&&this.authMode!==U.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),b.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)});return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map(e=>new t({id:e.id,url:e.url})):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}async fetchDefault3DBasemap(e){if(!this.useDefault3dBasemap||!this.default3DBasemapQuery||"none"===this.default3DBasemapQuery)return null;const t=new O;t.query=this.default3DBasemapQuery,t.disableExtraQuery=!0;const r=(await this.queryItems(t,e)).results.find(e=>"Web Scene"===e.type);return r?new M({portalItem:r}):null}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then(e=>e.categorySchema):p(e)?Promise.reject(h()):Promise.resolve([])}async fetchClassificationSchema(e){return this.hasClassificationSchema?this.request(this.restUrl+"/portals/self/classification/classificationSchema",e).then(e=>e.classificationSchema):null}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O({num:100,sortField:"title"});if(t?.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then(e=>e.results)}return p(e)?Promise.reject(h()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P(()=>new U)}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=y(O,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then(e=>{const r=s.clone();return r.start=e.nextStart,new B({nextQueryParams:r,queryParams:s,total:e.total,results:U._resultsToTypedArray(t,{portal:this},e,o)})}).then(e=>Promise.all(e.results.map(t=>"function"==typeof t.when?t.when():e)).then(()=>e,t=>(d(t),e)));return r&&Q[r]?Q[r]().then(({default:e})=>(n(o),i(e))):i()}signIn(){if(this.hasAPIKey)return this.load().then(()=>{if(!this.user)throw new s("portal:not-authenticated","Unable to authenticate user. Portal.user is missing")});if(this.authMode===U.AUTH_MODE_ANONYMOUS||this.authMode===U.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then(()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then(()=>null)):"loading"===this.loadStatus?this.load().then(()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate"))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate"))).then(e=>{e&&(this.sourceJSON=e,this.read(e))});return r?r.getCredential(this.restUrl,{prompt:this.authMode!==U.AUTH_MODE_NO_PROMPT}).then(t=>e(t)):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then(e=>{const t=U._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map(t=>"function"==typeof t.when?t.when():e)).then(()=>t,()=>t)})}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===U.AUTH_MODE_ANONYMOUS||this.authMode===U.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then(e=>e.data)}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new U({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,t){const r=new O;r.query=e||(_()?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),r.disableExtraQuery=!0;const o=await this.queryGroups(r,t);if(!o.total)return[];const s=o.results[0];r.num=100,r.query='type:"Web Map" -type:"Web Application"',r.sortField=s.sortField||"name",r.sortOrder=s.sortOrder||"desc";const i=await s.queryItems(r,t);if(!i.total)return[];return i.results.filter(e=>"Web Map"===e.type).map(e=>new M({portalItem:e}))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];if(_())return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter(e=>"Web Scene"===e.type).map(e=>new M({portalItem:e}))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s;if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map(r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o}))}else s=[];return s}};e([c()],C.prototype,"access",void 0),e([c()],C.prototype,"allSSL",void 0),e([c()],C.prototype,"authMode",void 0),e([c()],C.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],C.prototype,"readAuthorizedCrossOriginDomains",null),e([c()],C.prototype,"basemapGalleryGroupQuery",void 0),e([c({json:{name:"3DBasemapGalleryGroupQuery"}})],C.prototype,"basemapGalleryGroupQuery3D",void 0),e([c()],C.prototype,"bingKey",void 0),e([c()],C.prototype,"canListApps",void 0),e([c()],C.prototype,"canListData",void 0),e([c()],C.prototype,"canListPreProvisionedItems",void 0),e([c()],C.prototype,"canProvisionDirectPurchase",void 0),e([c()],C.prototype,"canSearchPublic",void 0),e([c()],C.prototype,"canShareBingPublic",void 0),e([c()],C.prototype,"canSharePublic",void 0),e([c()],C.prototype,"canSignInArcGIS",void 0),e([c()],C.prototype,"canSignInIDP",void 0),e([c()],C.prototype,"colorSetsGroupQuery",void 0),e([c()],C.prototype,"commentsEnabled",void 0),e([c({type:Date})],C.prototype,"created",void 0),e([c()],C.prototype,"credential",void 0),e([c()],C.prototype,"culture",void 0),e([c()],C.prototype,"currentVersion",void 0),e([c()],C.prototype,"customBaseUrl",void 0),e([c()],C.prototype,"default3DBasemapQuery",void 0),e([c()],C.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],C.prototype,"readDefaultBasemap",null),e([c()],C.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],C.prototype,"readDefaultDevBasemap",null),e([c({type:v})],C.prototype,"defaultExtent",void 0),e([c()],C.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],C.prototype,"readDefaultVectorBasemap",null),e([c()],C.prototype,"description",void 0),e([c()],C.prototype,"devBasemapGalleryGroupQuery",void 0),e([c()],C.prototype,"eueiEnabled",void 0),e([c({readOnly:!0})],C.prototype,"extraQuery",null),e([c()],C.prototype,"featuredGroups",void 0),e([c()],C.prototype,"featuredItemsGroupQuery",void 0),e([c()],C.prototype,"galleryTemplatesGroupQuery",void 0),e([c()],C.prototype,"layoutGroupQuery",void 0),e([c()],C.prototype,"livingAtlasGroupQuery",void 0),e([c({readOnly:!0})],C.prototype,"hasAPIKey",null),e([c()],C.prototype,"hasCategorySchema",void 0),e([c()],C.prototype,"hasClassificationSchema",void 0),e([c()],C.prototype,"helpBase",void 0),e([c()],C.prototype,"helperServices",void 0),e([c()],C.prototype,"helpMap",void 0),e([c()],C.prototype,"homePageFeaturedContent",void 0),e([c()],C.prototype,"homePageFeaturedContentCount",void 0),e([c()],C.prototype,"httpPort",void 0),e([c()],C.prototype,"httpsPort",void 0),e([c()],C.prototype,"id",void 0),e([c()],C.prototype,"ipCntryCode",void 0),e([c({readOnly:!0})],C.prototype,"isOrganization",null),e([c()],C.prototype,"isPortal",void 0),e([c()],C.prototype,"isReadOnly",void 0),e([c({readOnly:!0})],C.prototype,"itemPageUrl",null),e([c()],C.prototype,"layerTemplatesGroupQuery",void 0),e([c()],C.prototype,"maxTokenExpirationMinutes",void 0),e([c({type:Date})],C.prototype,"modified",void 0),e([c()],C.prototype,"name",void 0),e([c()],C.prototype,"portalHostname",void 0),e([c()],C.prototype,"portalMode",void 0),e([c()],C.prototype,"portalProperties",void 0),e([c()],C.prototype,"region",void 0),e([c()],C.prototype,"recycleBinEnabled",void 0),e([c({readOnly:!0})],C.prototype,"restUrl",null),e([c()],C.prototype,"rotatorPanels",void 0),e([c()],C.prototype,"showHomePageDescription",void 0),e([c()],C.prototype,"sourceJSON",void 0),e([c()],C.prototype,"staticImagesUrl",void 0),e([c({json:{name:"2DStylesGroupQuery"}})],C.prototype,"stylesGroupQuery2d",void 0),e([c({json:{name:"stylesGroupQuery"}})],C.prototype,"stylesGroupQuery3d",void 0),e([c()],C.prototype,"supportsHostedServices",void 0),e([c()],C.prototype,"symbolSetsGroupQuery",void 0),e([c()],C.prototype,"templatesGroupQuery",void 0),e([c()],C.prototype,"thumbnail",void 0),e([c({readOnly:!0})],C.prototype,"thumbnailUrl",null),e([c()],C.prototype,"units",void 0),e([c()],C.prototype,"url",void 0),e([c()],C.prototype,"urlKey",void 0),e([m("urlKey")],C.prototype,"readUrlKey",null),e([c()],C.prototype,"user",void 0),e([m("user")],C.prototype,"readUser",null),e([c()],C.prototype,"use3dBasemaps",void 0),e([c()],C.prototype,"useDefault3dBasemap",void 0),e([c()],C.prototype,"useStandardizedQuery",void 0),e([c()],C.prototype,"useVectorBasemaps",void 0),e([c()],C.prototype,"vectorBasemapGalleryGroupQuery",void 0),C=U=e([f("esri.portal.Portal")],C);const b=new FinalizationRegistry(e=>{e.remove()});function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch(()=>{})}}export{C as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import{JSONSupportMixin as a}from"../core/JSONSupport.js";import{Loadable as i}from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as h,throwIfAbortError as d}from"../core/promiseUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{ensureType as y}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import B from"./PortalQueryResult.js";import D from"./PortalUser.js";import{isApiKeyApplicable as G,hasBasemapStylesApiKey as _}from"../support/apiKeyUtils.js";var U;let M;const Q={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:D})};let C=class extends(a(i)){static{U=this}static{this.AUTH_MODE_ANONYMOUS="anonymous"}static{this.AUTH_MODE_AUTO="auto"}static{this.AUTH_MODE_IMMEDIATE="immediate"}static{this.AUTH_MODE_NO_PROMPT="no-prompt"}constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.default3DBasemapQuery=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.hasClassificationSchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.recycleBinEnabled=!1,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useDefault3dBasemap=!1,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){b.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get hasAPIKey(){return G(this.restUrl)}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get loaded(){return super.loaded}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.slice(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=D.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then(({default:t})=>{n(e),M=t}).then(()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e)).then(e=>{if(!this.hasAPIKey&&r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==U.AUTH_MODE_AUTO&&this.authMode!==U.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),b.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)});return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map(e=>new t({id:e.id,url:e.url})):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}async fetchDefault3DBasemap(e){if(!this.useDefault3dBasemap||!this.default3DBasemapQuery||"none"===this.default3DBasemapQuery)return null;const t=new O;t.query=this.default3DBasemapQuery,t.disableExtraQuery=!0;const r=(await this.queryItems(t,e)).results.find(e=>"Web Scene"===e.type);return r?new M({portalItem:r}):null}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then(e=>e.categorySchema):p(e)?Promise.reject(h()):Promise.resolve([])}async fetchClassificationSchema(e){return this.hasClassificationSchema?this.request(this.restUrl+"/portals/self/classification/classificationSchema",e).then(e=>e.classificationSchema):null}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O({num:100,sortField:"title"});if(t?.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then(e=>e.results)}return p(e)?Promise.reject(h()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P(()=>new U)}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=y(O,t),a=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then(e=>{const r=s.clone();return r.start=e.nextStart,new B({nextQueryParams:r,queryParams:s,total:e.total,results:U._resultsToTypedArray(t,{portal:this},e,o)})}).then(e=>Promise.all(e.results.map(t=>"function"==typeof t.when?t.when():e)).then(()=>e,t=>(d(t),e)));return r&&Q[r]?Q[r]().then(({default:e})=>(n(o),a(e))):a()}signIn(){if(this.hasAPIKey)return this.load().then(()=>{if(!this.user)throw new s("portal:not-authenticated","Unable to authenticate user. Portal.user is missing")});if(this.authMode===U.AUTH_MODE_ANONYMOUS||this.authMode===U.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then(()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then(()=>null)):"loading"===this.loadStatus?this.load().then(()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate"))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate"))).then(e=>{e&&(this.sourceJSON=e,this.read(e))});return r?r.getCredential(this.restUrl,{prompt:this.authMode!==U.AUTH_MODE_NO_PROMPT}).then(t=>e(t)):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then(e=>{const t=U._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map(t=>"function"==typeof t.when?t.when():e)).then(()=>t,()=>t)})}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===U.AUTH_MODE_ANONYMOUS||this.authMode===U.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:a=null,cacheBust:i=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:a,cacheBust:i,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then(e=>e.data)}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new U({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,t){const r=new O;r.query=e||(_()?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),r.disableExtraQuery=!0;const o=await this.queryGroups(r,t);if(!o.total)return[];const s=o.results[0];r.num=100,r.query='type:"Web Map" -type:"Web Application"',r.sortField=s.sortField||"name",r.sortOrder=s.sortOrder||"desc";const a=await s.queryItems(r,t);if(!a.total)return[];return a.results.filter(e=>"Web Map"===e.type).map(e=>new M({portalItem:e}))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];if(_())return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const a=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=a.sortField||"name",o.sortOrder=a.sortOrder||"desc";const i=await a.queryItems(o,t);if(!i.total)return[];return i.results.filter(e=>"Web Scene"===e.type).map(e=>new M({portalItem:e}))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s;if(r){const a=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map(r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(a),o}))}else s=[];return s}};e([c()],C.prototype,"access",void 0),e([c()],C.prototype,"allSSL",void 0),e([c()],C.prototype,"authMode",void 0),e([c()],C.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],C.prototype,"readAuthorizedCrossOriginDomains",null),e([c()],C.prototype,"basemapGalleryGroupQuery",void 0),e([c({json:{name:"3DBasemapGalleryGroupQuery"}})],C.prototype,"basemapGalleryGroupQuery3D",void 0),e([c()],C.prototype,"bingKey",void 0),e([c()],C.prototype,"canListApps",void 0),e([c()],C.prototype,"canListData",void 0),e([c()],C.prototype,"canListPreProvisionedItems",void 0),e([c()],C.prototype,"canProvisionDirectPurchase",void 0),e([c()],C.prototype,"canSearchPublic",void 0),e([c()],C.prototype,"canShareBingPublic",void 0),e([c()],C.prototype,"canSharePublic",void 0),e([c()],C.prototype,"canSignInArcGIS",void 0),e([c()],C.prototype,"canSignInIDP",void 0),e([c()],C.prototype,"colorSetsGroupQuery",void 0),e([c()],C.prototype,"commentsEnabled",void 0),e([c({type:Date})],C.prototype,"created",void 0),e([c()],C.prototype,"credential",void 0),e([c()],C.prototype,"culture",void 0),e([c()],C.prototype,"currentVersion",void 0),e([c()],C.prototype,"customBaseUrl",void 0),e([c()],C.prototype,"default3DBasemapQuery",void 0),e([c()],C.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],C.prototype,"readDefaultBasemap",null),e([c()],C.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],C.prototype,"readDefaultDevBasemap",null),e([c({type:v})],C.prototype,"defaultExtent",void 0),e([c()],C.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],C.prototype,"readDefaultVectorBasemap",null),e([c()],C.prototype,"description",void 0),e([c()],C.prototype,"devBasemapGalleryGroupQuery",void 0),e([c()],C.prototype,"eueiEnabled",void 0),e([c({readOnly:!0})],C.prototype,"extraQuery",null),e([c()],C.prototype,"featuredGroups",void 0),e([c()],C.prototype,"featuredItemsGroupQuery",void 0),e([c()],C.prototype,"galleryTemplatesGroupQuery",void 0),e([c()],C.prototype,"layoutGroupQuery",void 0),e([c()],C.prototype,"livingAtlasGroupQuery",void 0),e([c({readOnly:!0})],C.prototype,"hasAPIKey",null),e([c()],C.prototype,"hasCategorySchema",void 0),e([c()],C.prototype,"hasClassificationSchema",void 0),e([c()],C.prototype,"helpBase",void 0),e([c()],C.prototype,"helperServices",void 0),e([c()],C.prototype,"helpMap",void 0),e([c()],C.prototype,"homePageFeaturedContent",void 0),e([c()],C.prototype,"homePageFeaturedContentCount",void 0),e([c()],C.prototype,"httpPort",void 0),e([c()],C.prototype,"httpsPort",void 0),e([c()],C.prototype,"id",void 0),e([c()],C.prototype,"ipCntryCode",void 0),e([c({readOnly:!0})],C.prototype,"isOrganization",null),e([c()],C.prototype,"isPortal",void 0),e([c()],C.prototype,"isReadOnly",void 0),e([c({readOnly:!0})],C.prototype,"itemPageUrl",null),e([c()],C.prototype,"layerTemplatesGroupQuery",void 0),e([c()],C.prototype,"maxTokenExpirationMinutes",void 0),e([c({type:Date})],C.prototype,"modified",void 0),e([c()],C.prototype,"name",void 0),e([c()],C.prototype,"portalHostname",void 0),e([c()],C.prototype,"portalMode",void 0),e([c()],C.prototype,"portalProperties",void 0),e([c()],C.prototype,"region",void 0),e([c()],C.prototype,"recycleBinEnabled",void 0),e([c({readOnly:!0})],C.prototype,"restUrl",null),e([c()],C.prototype,"rotatorPanels",void 0),e([c()],C.prototype,"showHomePageDescription",void 0),e([c()],C.prototype,"sourceJSON",void 0),e([c()],C.prototype,"staticImagesUrl",void 0),e([c({json:{name:"2DStylesGroupQuery"}})],C.prototype,"stylesGroupQuery2d",void 0),e([c({json:{name:"stylesGroupQuery"}})],C.prototype,"stylesGroupQuery3d",void 0),e([c()],C.prototype,"supportsHostedServices",void 0),e([c()],C.prototype,"symbolSetsGroupQuery",void 0),e([c()],C.prototype,"templatesGroupQuery",void 0),e([c()],C.prototype,"thumbnail",void 0),e([c({readOnly:!0})],C.prototype,"thumbnailUrl",null),e([c()],C.prototype,"units",void 0),e([c()],C.prototype,"url",void 0),e([c()],C.prototype,"urlKey",void 0),e([m("urlKey")],C.prototype,"readUrlKey",null),e([c()],C.prototype,"user",void 0),e([m("user")],C.prototype,"readUser",null),e([c()],C.prototype,"use3dBasemaps",void 0),e([c()],C.prototype,"useDefault3dBasemap",void 0),e([c()],C.prototype,"useStandardizedQuery",void 0),e([c()],C.prototype,"useVectorBasemaps",void 0),e([c()],C.prototype,"vectorBasemapGalleryGroupQuery",void 0),C=U=e([f("esri.portal.Portal")],C);const b=new FinalizationRegistry(e=>{e.remove()});function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch(()=>{})}}export{C as default};
|
package/portal/PortalItem.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import{Loadable as a}from"../core/Loadable.js";import{isDataProtocol as n,makeAbsolute as l}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Extent.js";import h from"./Portal.js";import g from"./PortalItemResource.js";import y from"./PortalRating.js";import{a as w}from"../chunks/persistableUrlUtils.js";var v;const f=new Set(["3DTiles Service","CSV","Feature Collection","Feature Service","Feed","GeoJson","Group Layer","Image Service","KML","Knowledge Graph Layer","Map Service","Media Layer","Scene Service","Stream Service","Video Service","Vector Tile Service","WCS","WFS","WMS","WMTS"]),b=new Set(["KML","GeoJson","CSV"]);let k=v=class extends(r(a)){static from(e){return c(v,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.classification=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Geocoding Service"===e?i="Locator":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e?.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"Raster function template"===e?i="Raster Function Template":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e?i="Excalibur Project":"3DTiles Service"===e?i="3D tiles layer":"3DTiles Package"===e&&(i="3D tiles package"),i}readExtent(e){return e&&e.length?new m(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type?.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1,u=!1,m=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":d?"utilitynetwork":a?"featureshosted":"features"):"map service"===e||"wms"===e||"wmts"===e?(c=i.includes("Spatiotemporal"),u=i.includes("Relational"),s=c||u?"mapimages":a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages"):s="scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?i.includes("3DObject")?"3dobjecttileslayer":i.includes("IntegratedMesh")?"integratedmeshtileslayer":"3dtileslayer":"layers"):"web map"===e||"cityengine web scene"===e?s="maps":"web scene"===e?s=i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?s="instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?s="apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?s="mapsgray":"service definition"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?s="datafiles":"360 vr experience"===e?s="360vr":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?s="appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?s="addindesktop":"pdf"===e?s="pdf":"microsoft word"===e?s="word":"microsoft excel"===e?s="excel":"microsoft powerpoint"===e?s="ppt":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?s="datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?s="toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?s="layersgray":"analysis model"===e?s="analysismodel":"scene package"===e?s="scenepackage":"3dtiles package"===e?s="3dtileslayerpackage":"3dtiles service"===e?s="3dtileslayer":"mobile scene package"===e?s="mobilescenepackage":"tile package"===e||"compact tile package"===e?s="tilepackage":"task file"===e?s="taskfile":"report template"===e?s="report-template":"statistical data collection"===e?s="statisticaldatacollection":"insights workbook"===e?s="workbook":"insights model"===e?s="insightsmodel":"insights page"===e?s="insightspage":"insights theme"===e?s="insightstheme":"hub initiative"===e?s="hubinitiative":"hub page"===e?s="hubpage":"hub site application"===e?s="hubsite":"hub event"===e?s="hubevent":"hub project"===e?s="hubproject":"relational database connection"===e?s="relationaldatabaseconnection":"big data file share"===e?s="datastorecollection":"image collection"===e?s="imagecollection":"desktop style"===e?s="desktopstyle":"style"===e?s=i.includes("Dictionary")?"dictionarystyle":"style":"dashboard"===e?s="dashboard":"raster function template"===e?s="rasterprocessingtemplate":"vector tile package"===e?s="vectortilepackage":"ortho mapping project"===e?s="orthomappingproject":"ortho mapping template"===e?s="orthomappingtemplate":"solution"===e?s="solutions":"geopackage"===e?s="geopackage":"deep learning package"===e?s="deeplearningpackage":"real time analytic"===e?s="realtimeanalytics":"reality mapping project"===e?s="realitymappingproject":"big data analytic"===e?s="bigdataanalytics":"feed"===e?s="feed":"excalibur imagery project"===e?s="excaliburimageryproject":"notebook"===e?s="notebook":"storymap"===e?s="storymap":"survey123 add in"===e?s="survey123addin":"mission"===e?s="mission":"mission report"===e?s="missionreport":"mission template"===e?s="missiontemplate":"quickcapture project"===e?s="quickcaptureproject":"pro report"===e?s="proreport":"pro report template"===e?s="proreporttemplate":"urban model"===e?s="urbanmodel":"urban project"===e?s="urbanproject":"web experience"===e?s="experiencebuilder":"web experience template"===e?s="webexperiencetemplate":"experience builder widget"===e?s="experiencebuilderwidget":"experience builder widget package"===e?s="experiencebuilderwidgetpackage":"workflow"===e?s="workflow":"kernel gateway connection"===e?s="kernelgatewayconnection":"insights script"===e?s="insightsscript":"hub initiative template"===e?s="hubinitiativetemplate":"storymap theme"===e?s="storymaptheme":"knowledge graph"===e?s="knowledgegraph":"knowledge graph layer"===e?s="knowledgegraphlayer":"knowledge studio project"===e?s="knowledgestudio":"native application"===e?s="nativeapp":"native application installer"===e?s="nativeappinstaller":"web link chart"===e?s="linkchart":"knowledge graph web investigation"===e?s="investigation":"ogcfeatureserver"===e?s="features":"pro presentation"===e?s="propresentation":"pro project"===e?s="proproject":"insights workbook package"===e?s="insightsworkbookpackage":"apache parquet"===e?s="apacheparquet":"notebook code snippet library"===e?s="notebookcodesnippets":"suitability model"===e?s="suitabilitymodel":"esri classifier definition"===e?s="classifierdefinition":"esri classification schema"===e?s="classificationschema":"insights data engineering workbook"===e?s="dataengineeringworkbook":"insights data engineering model"===e?s="dataengineeringmodel":"deep learning studio project"===e?s="deeplearningproject":"discussion"===e?s="discussion":"allsource project"===e?s="allsourceproject":"api key"===e?s="apikey":"data pipeline"===e?s="datapipelines":"group layer"===e?(m=i.includes("Map"),s=m?"layergroup2d":"layergroup"):s="media layer"===e?"onlinemedialayer":"form"===e?i.includes("Survey123")?"survey":"datafilesgray":"csv"===e?"csv":"image"===e?"image":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){return w(this.itemUrl)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.id;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=h.getDefault()),i=t.load(e).then(()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{}).then(e=>{this.sourceJSON=e,this.read(e)});return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}},i=e instanceof y?e.rating:e;return null==i||isNaN(i)||"number"!=typeof e||(t.query.rating=i),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new y({rating:i,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),classification:o(this.classification),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new v({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const t of["tags","typeKeywords","categories"])e[t]=e[t]?.join(", ");for(const t of["extent","classification"]){const i=e[t];i&&(e[t]=JSON.stringify(i))}return e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new y(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},v)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then(e=>(this.applicationProxies&&!Object.hasOwn(e,"appProxies")&&(this.applicationProxies=null),this.sourceJSON=e,this.read(e),this))}update(e){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const t=e?.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then(()=>this.reload())}):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${r}/copy`,l);return new v({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)n(t)?r.query={data:t}:r.query={url:l(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then(()=>this.reload())}):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResources:r}=await import("./support/resourceUtils.js");return e.portalItem=this,await r(this,[{resource:e,content:t,compress:i?.compress,access:i?.access}],"add",i),e}async removeResource(e,t){const{removeResource:r}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new g({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),classification:o(this.classification),created:this.created?.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified?.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new v({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([p({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([p()],k.prototype,"accessInformation",void 0),e([p({type:String})],k.prototype,"apiKey",void 0),e([p({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([p()],k.prototype,"avgRating",void 0),e([p()],k.prototype,"categories",void 0),e([p()],k.prototype,"classification",void 0),e([p({type:Date})],k.prototype,"created",void 0),e([p()],k.prototype,"culture",void 0),e([p()],k.prototype,"description",void 0),e([p({readOnly:!0})],k.prototype,"displayName",null),e([p({type:m})],k.prototype,"extent",void 0),e([d("extent")],k.prototype,"readExtent",null),e([p()],k.prototype,"groupCategories",void 0),e([p({readOnly:!0})],k.prototype,"iconUrl",null),e([p()],k.prototype,"id",void 0),e([p({readOnly:!0})],k.prototype,"isLayer",null),e([p({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([p()],k.prototype,"itemControl",void 0),e([p({readOnly:!0})],k.prototype,"itemPageUrl",null),e([p({readOnly:!0})],k.prototype,"itemUrl",null),e([p()],k.prototype,"licenseInfo",void 0),e([p({type:Date})],k.prototype,"modified",void 0),e([p()],k.prototype,"name",void 0),e([p()],k.prototype,"numComments",void 0),e([p()],k.prototype,"numRatings",void 0),e([p()],k.prototype,"numViews",void 0),e([p()],k.prototype,"owner",void 0),e([p()],k.prototype,"ownerFolder",void 0),e([p({type:h})],k.prototype,"portal",void 0),e([p()],k.prototype,"screenshots",void 0),e([p()],k.prototype,"size",void 0),e([p()],k.prototype,"snippet",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({type:String})],k.prototype,"sourceUrl",void 0),e([p({type:String})],k.prototype,"spatialReference",void 0),e([p()],k.prototype,"tags",void 0),e([p()],k.prototype,"thumbnail",void 0),e([p({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([p()],k.prototype,"title",void 0),e([p()],k.prototype,"type",void 0),e([p()],k.prototype,"typeKeywords",void 0),e([p({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([p({readOnly:!0})],k.prototype,"userItemUrl",null),k=v=e([u("esri.portal.PortalItem")],k);export{k as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import{Loadable as a}from"../core/Loadable.js";import{isDataProtocol as n,makeAbsolute as l}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Extent.js";import h from"./Portal.js";import g from"./PortalItemResource.js";import y from"./PortalRating.js";import{a as w}from"../chunks/persistableUrlUtils.js";var v;const f=new Set(["3DTiles Service","CSV","Feature Collection","Feature Service","Feed","GeoJson","Group Layer","Image Service","KML","Knowledge Graph Layer","Map Service","Media Layer","Scene Service","Stream Service","Video Service","Vector Tile Service","WCS","WFS","WMS","WMTS"]),b=new Set(["KML","GeoJson","CSV"]);let k=v=class extends(r(a)){static from(e){return c(v,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.classification=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Geocoding Service"===e?i="Locator":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e?.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"Raster function template"===e?i="Raster Function Template":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e?i="Excalibur Project":"3DTiles Service"===e?i="3D tiles layer":"3DTiles Package"===e&&(i="3D tiles package"),i}readExtent(e){return e&&e.length?new m(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type?.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1,u=!1,m=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":d?"utilitynetwork":a?"featureshosted":"features"):"map service"===e||"wms"===e||"wmts"===e?(c=i.includes("Spatiotemporal"),u=i.includes("Relational"),s=c||u?"mapimages":a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages"):s="scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?i.includes("3DObject")?"3dobjecttileslayer":i.includes("IntegratedMesh")?"integratedmeshtileslayer":"3dtileslayer":"layers"):"web map"===e||"cityengine web scene"===e?s="maps":"web scene"===e?s=i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?s="instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?s="apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?s="mapsgray":"service definition"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?s="datafiles":"360 vr experience"===e?s="360vr":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?s="appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?s="addindesktop":"pdf"===e?s="pdf":"microsoft word"===e?s="word":"microsoft excel"===e?s="excel":"microsoft powerpoint"===e?s="ppt":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?s="datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?s="toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?s="layersgray":"analysis model"===e?s="analysismodel":"scene package"===e?s="scenepackage":"3dtiles package"===e?s="3dtileslayerpackage":"3dtiles service"===e?s="3dtileslayer":"mobile scene package"===e?s="mobilescenepackage":"tile package"===e||"compact tile package"===e?s="tilepackage":"task file"===e?s="taskfile":"report template"===e?s="report-template":"statistical data collection"===e?s="statisticaldatacollection":"insights workbook"===e?s="workbook":"insights model"===e?s="insightsmodel":"insights page"===e?s="insightspage":"insights theme"===e?s="insightstheme":"hub initiative"===e?s="hubinitiative":"hub page"===e?s="hubpage":"hub site application"===e?s="hubsite":"hub event"===e?s="hubevent":"hub project"===e?s="hubproject":"relational database connection"===e?s="relationaldatabaseconnection":"big data file share"===e?s="datastorecollection":"image collection"===e?s="imagecollection":"desktop style"===e?s="desktopstyle":"style"===e?s=i.includes("Dictionary")?"dictionarystyle":"style":"dashboard"===e?s="dashboard":"raster function template"===e?s="rasterprocessingtemplate":"vector tile package"===e?s="vectortilepackage":"ortho mapping project"===e?s="orthomappingproject":"ortho mapping template"===e?s="orthomappingtemplate":"solution"===e?s="solutions":"geopackage"===e?s="geopackage":"deep learning package"===e?s="deeplearningpackage":"real time analytic"===e?s="realtimeanalytics":"reality mapping project"===e?s="realitymappingproject":"big data analytic"===e?s="bigdataanalytics":"feed"===e?s="feed":"excalibur imagery project"===e?s="excaliburimageryproject":"notebook"===e?s="notebook":"storymap"===e?s="storymap":"survey123 add in"===e?s="survey123addin":"mission"===e?s="mission":"mission report"===e?s="missionreport":"mission template"===e?s="missiontemplate":"quickcapture project"===e?s="quickcaptureproject":"pro report"===e?s="proreport":"pro report template"===e?s="proreporttemplate":"urban model"===e?s="urbanmodel":"urban project"===e?s="urbanproject":"web experience"===e?s="experiencebuilder":"web experience template"===e?s="webexperiencetemplate":"experience builder widget"===e?s="experiencebuilderwidget":"experience builder widget package"===e?s="experiencebuilderwidgetpackage":"workflow"===e?s="workflow":"kernel gateway connection"===e?s="kernelgatewayconnection":"insights script"===e?s="insightsscript":"hub initiative template"===e?s="hubinitiativetemplate":"storymap theme"===e?s="storymaptheme":"knowledge graph"===e?s="knowledgegraph":"knowledge graph layer"===e?s="knowledgegraphlayer":"knowledge studio project"===e?s="knowledgestudio":"native application"===e?s="nativeapp":"native application installer"===e?s="nativeappinstaller":"web link chart"===e?s="linkchart":"knowledge graph web investigation"===e?s="investigation":"ogcfeatureserver"===e?s="features":"pro presentation"===e?s="propresentation":"pro project"===e?s="proproject":"insights workbook package"===e?s="insightsworkbookpackage":"apache parquet"===e?s="apacheparquet":"notebook code snippet library"===e?s="notebookcodesnippets":"suitability model"===e?s="suitabilitymodel":"esri classifier definition"===e?s="classifierdefinition":"esri classification schema"===e?s="classificationschema":"insights data engineering workbook"===e?s="dataengineeringworkbook":"insights data engineering model"===e?s="dataengineeringmodel":"deep learning studio project"===e?s="deeplearningproject":"discussion"===e?s="discussion":"allsource project"===e?s="allsourceproject":"api key"===e?s="apikey":"data pipeline"===e?s="datapipelines":"group layer"===e?(m=i.includes("Map"),s=m?"layergroup2d":"layergroup"):s="media layer"===e?"onlinemedialayer":"form"===e?i.includes("Survey123")?"survey":"datafilesgray":"csv"===e?"csv":"image"===e?"image":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){return w(this.itemUrl)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get loaded(){return super.loaded}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.id;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=h.getDefault()),i=t.load(e).then(()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{}).then(e=>{this.sourceJSON=e,this.read(e)});return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}},i=e instanceof y?e.rating:e;return null==i||isNaN(i)||"number"!=typeof e||(t.query.rating=i),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new y({rating:i,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),classification:o(this.classification),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new v({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const t of["tags","typeKeywords","categories"])e[t]=e[t]?.join(", ");for(const t of["extent","classification"]){const i=e[t];i&&(e[t]=JSON.stringify(i))}return e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new y(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},v)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then(e=>(this.applicationProxies&&!Object.hasOwn(e,"appProxies")&&(this.applicationProxies=null),this.sourceJSON=e,this.read(e),this))}update(e){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const t=e?.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then(()=>this.reload())}):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${r}/copy`,l);return new v({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)n(t)?r.query={data:t}:r.query={url:l(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then(()=>this.reload())}):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResources:r}=await import("./support/resourceUtils.js");return e.portalItem=this,await r(this,[{resource:e,content:t,compress:i?.compress,access:i?.access}],"add",i),e}async removeResource(e,t){const{removeResource:r}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new g({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),classification:o(this.classification),created:this.created?.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified?.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new v({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([p({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([p()],k.prototype,"accessInformation",void 0),e([p({type:String})],k.prototype,"apiKey",void 0),e([p({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([p()],k.prototype,"avgRating",void 0),e([p()],k.prototype,"categories",void 0),e([p()],k.prototype,"classification",void 0),e([p({type:Date})],k.prototype,"created",void 0),e([p()],k.prototype,"culture",void 0),e([p()],k.prototype,"description",void 0),e([p({readOnly:!0})],k.prototype,"displayName",null),e([p({type:m})],k.prototype,"extent",void 0),e([d("extent")],k.prototype,"readExtent",null),e([p()],k.prototype,"groupCategories",void 0),e([p({readOnly:!0})],k.prototype,"iconUrl",null),e([p()],k.prototype,"id",void 0),e([p({readOnly:!0})],k.prototype,"isLayer",null),e([p({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([p()],k.prototype,"itemControl",void 0),e([p({readOnly:!0})],k.prototype,"itemPageUrl",null),e([p({readOnly:!0})],k.prototype,"itemUrl",null),e([p()],k.prototype,"licenseInfo",void 0),e([p({type:Date})],k.prototype,"modified",void 0),e([p()],k.prototype,"name",void 0),e([p()],k.prototype,"numComments",void 0),e([p()],k.prototype,"numRatings",void 0),e([p()],k.prototype,"numViews",void 0),e([p()],k.prototype,"owner",void 0),e([p()],k.prototype,"ownerFolder",void 0),e([p({type:h})],k.prototype,"portal",void 0),e([p()],k.prototype,"screenshots",void 0),e([p()],k.prototype,"size",void 0),e([p()],k.prototype,"snippet",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({type:String})],k.prototype,"sourceUrl",void 0),e([p({type:String})],k.prototype,"spatialReference",void 0),e([p()],k.prototype,"tags",void 0),e([p()],k.prototype,"thumbnail",void 0),e([p({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([p()],k.prototype,"title",void 0),e([p()],k.prototype,"type",void 0),e([p()],k.prototype,"typeKeywords",void 0),e([p({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([p({readOnly:!0})],k.prototype,"userItemUrl",null),k=v=e([u("esri.portal.PortalItem")],k);export{k as default};
|