@arcgis/core 5.1.0-next.72 → 5.1.0-next.74
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/Viewpoint.js +1 -1
- package/applications/Urban/editingSessionUtils.d.ts +95 -0
- package/applications/Urban/editingSessionUtils.js +2 -0
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{91a0227a64a944af3286.js → 003476e950bd27a2f884.js} +2 -2
- package/assets/esri/core/workers/chunks/{8a664451845a47048859.js → 0539b5d015157c1d34a0.js} +1 -1
- package/assets/esri/core/workers/chunks/{5a4d7ba6dc1d4b41d80d.js → 07eff82916681fcff069.js} +1 -1
- package/assets/esri/core/workers/chunks/{b801631b58e6fc6cec8a.js → 0ae360bf253adee46737.js} +1 -1
- package/assets/esri/core/workers/chunks/{8a14e3db28c403b046cf.js → 0d2bc1be5802681666a4.js} +1 -1
- package/assets/esri/core/workers/chunks/0eed2b1b06355ab89013.js +1 -0
- package/assets/esri/core/workers/chunks/{b495f14d90abe8d1a558.js → 12e575a6d2b008b8fc2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{61ef14e42bc09b787d89.js → 13e60f19f436b8d683ae.js} +1 -1
- package/assets/esri/core/workers/chunks/18f77ee3552d92962f15.js +1 -0
- package/assets/esri/core/workers/chunks/1a87e9bbd85ba29b1514.js +1 -0
- package/assets/esri/core/workers/chunks/{aa1a3a849aba84cf585b.js → 1db1656a033f3992f0d6.js} +1 -1
- package/assets/esri/core/workers/chunks/{b54b7cc6b23a70fed700.js → 1f8ccf96069ac3a40c3d.js} +1 -1
- package/assets/esri/core/workers/chunks/{cdf6ad970dc1893dac58.js → 24646a1176ce34039155.js} +1 -1
- package/assets/esri/core/workers/chunks/{93ceb74ac88ef460fe5f.js → 359d3acb3953e64e5a78.js} +1 -1
- package/assets/esri/core/workers/chunks/{b79058f5bda6fcac22f8.js → 37091cf498a16ccad7ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{0839da55707f7c4cf780.js → 3b9100c59a8050f4834e.js} +1 -1
- package/assets/esri/core/workers/chunks/452c01cecbbd1e370098.js +1 -0
- package/assets/esri/core/workers/chunks/47656ec12401e53f4bd3.js +1 -0
- package/assets/esri/core/workers/chunks/{260d4571722cb1ff1366.js → 484d6c1b0fe1633515b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{0d96e39380fd84cea9ba.js → 4bbe684050b3b04681d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{7e6ccf9f3e756186e93e.js → 4c13869d260a902d3014.js} +1 -1
- package/assets/esri/core/workers/chunks/4c97cc922eece3a91b6b.js +1 -0
- package/assets/esri/core/workers/chunks/{656d6963e8f837fbf28f.js → 54023458195549f66215.js} +1 -1
- package/assets/esri/core/workers/chunks/{02876e434dc91c42b2f4.js → 5476c2f7b83f4ccd0335.js} +1 -1
- package/assets/esri/core/workers/chunks/5511e640e171c294f52a.js +2 -0
- package/assets/esri/core/workers/chunks/{faad127dc07e54e7f6d1.js → 5abe34bb0110694f7b42.js} +1 -1
- package/assets/esri/core/workers/chunks/{c1838822b096d5f36a8b.js → 5b324e572737a308500d.js} +1 -1
- package/assets/esri/core/workers/chunks/6124141ac642e4ce1454.js +1 -0
- package/assets/esri/core/workers/chunks/{ae0a572cbbdd9815ee2e.js → 62b3e933f548ce354b99.js} +1 -1
- package/assets/esri/core/workers/chunks/6b66fc32451433129a88.js +1 -0
- package/assets/esri/core/workers/chunks/{6ea8b0d68881d16a2432.js → 6d25230dd85a4ba54c4f.js} +1 -1
- package/assets/esri/core/workers/chunks/6f7aaba26773fe416ac2.js +1 -0
- package/assets/esri/core/workers/chunks/{9f4b97204def91567e3c.js → 7595ceba529ed01c7590.js} +1 -1
- package/assets/esri/core/workers/chunks/75d5ea0da181f9e7425f.js +1312 -0
- package/assets/esri/core/workers/chunks/{af75e91b88e747aa76ac.js → 7601278ebced0c0c31cf.js} +1 -1
- package/assets/esri/core/workers/chunks/{1661684357912726a72a.js → 77dd719516138afb1a2a.js} +1 -1
- package/assets/esri/core/workers/chunks/{6f9ea461c268c421f9c9.js → 7951d93f5f15aa76f49c.js} +1 -1
- package/assets/esri/core/workers/chunks/{ce2aa75e084ee56f5e29.js → 7f55eef696e9ed717bfc.js} +1 -1
- package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +1 -0
- package/assets/esri/core/workers/chunks/{50d5d6654ada9f28345d.js → 85e65ced3312bf9cf162.js} +1 -1
- package/assets/esri/core/workers/chunks/{b92794def31592a6a25f.js → 8d75f6f27c1c17c33992.js} +1 -1
- package/assets/esri/core/workers/chunks/{3cd9bd20e75ba4d5b294.js → 8f4cd30ce23e41c1a42c.js} +1 -1
- package/assets/esri/core/workers/chunks/95d82c619dcbec2e1050.js +1 -0
- package/assets/esri/core/workers/chunks/983f6c8727fd9484718e.js +1 -0
- package/assets/esri/core/workers/chunks/{5a83ea967ecde01d5622.js → 9be9ccce6369f67202bc.js} +1 -1
- package/assets/esri/core/workers/chunks/{628f56c09838eb9c573b.js → a270960d80d8344dd75f.js} +1 -1
- package/assets/esri/core/workers/chunks/{b475f5492c6e3fd4cca8.js → a36761e3122f70fbb3c9.js} +1 -1
- package/assets/esri/core/workers/chunks/{1edd39c7c4acdc591d10.js → a809b811121099a87a98.js} +1 -1
- package/assets/esri/core/workers/chunks/{47f2113357b2aa4f4f37.js → a9d2c83bb10b5ade0ca0.js} +1 -1
- package/assets/esri/core/workers/chunks/abdf146b35e179b5b245.js +1 -0
- package/assets/esri/core/workers/chunks/ad064583f8a836005098.js +1 -0
- package/assets/esri/core/workers/chunks/{d2aa75816e84b1e7fd25.js → afc0baf86ece710ef867.js} +1 -1
- package/assets/esri/core/workers/chunks/b858adff7043683fe41c.js +1 -0
- package/assets/esri/core/workers/chunks/{68b47a5a50e0b5fffca2.js → b905e637a67fbb7af4ae.js} +1 -1
- package/assets/esri/core/workers/chunks/{03894992558d063d0d5e.js → bab23b905678e42815e5.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ef3b8d67b498d655a99.js → bcb021a167580bb1619f.js} +1 -1
- package/assets/esri/core/workers/chunks/be0341567bb19e101a4f.js +1 -0
- package/assets/esri/core/workers/chunks/bec3ee5ea945e1e07a35.js +1 -0
- package/assets/esri/core/workers/chunks/{a65d576e90179a2b5400.js → c5507480344176fad241.js} +1 -1
- package/assets/esri/core/workers/chunks/{d4a9eb4470cc6a1f67fc.js → c5f155fe114a2a05aaf2.js} +2 -2
- package/assets/esri/core/workers/chunks/{84772b023d04e415f17f.js → c61002a117dc2218d6af.js} +1 -1
- package/assets/esri/core/workers/chunks/c70df6ed190f9ebcf6aa.js +1 -0
- package/assets/esri/core/workers/chunks/{0dad0bca8d58b2c63d22.js → c804a66ef7615aa8de89.js} +1 -1
- package/assets/esri/core/workers/chunks/cd7159600ce132e32d04.js +1 -0
- package/assets/esri/core/workers/chunks/{dec6d41d614105e6fd93.js → d00dafad202450e6ee2e.js} +1 -1
- package/assets/esri/core/workers/chunks/d1a7d13e1d48abcd7bf1.js +1 -0
- package/assets/esri/core/workers/chunks/{06df187a116709f69952.js → d35c475f004367e333eb.js} +1 -1
- package/assets/esri/core/workers/chunks/d82da31dc702b8fd6a07.js +1 -0
- package/assets/esri/core/workers/chunks/dd4f431511edd975a53b.js +1 -0
- package/assets/esri/core/workers/chunks/{99101789035f1787c630.js → e785f76c1a75cb1d1e1f.js} +1 -1
- package/assets/esri/core/workers/chunks/f53805c7a84203305b2c.js +1 -0
- package/assets/esri/core/workers/chunks/f590b60fca607d66001a.js +1 -0
- package/assets/esri/core/workers/chunks/{f6d047358d14328f3622.js → f60292d97bcdbf19165b.js} +1 -1
- package/assets/esri/core/workers/chunks/fb5a2205f05afc396119.js +1 -0
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
- package/chunks/GlobalIllumination.glsl.js +186 -116
- package/chunks/GlobalIlluminationBlur.glsl.js +81 -61
- package/chunks/GlobalIlluminationUpscale.glsl.js +66 -0
- package/chunks/geometryEngineBase.js +1 -1
- package/config.js +1 -1
- package/core/has.js +1 -1
- package/form/elements/FieldElement.d.ts +3 -2
- package/form/elements/FieldElement.js +1 -1
- package/form/elements/inputs/Input.d.ts +1 -1
- package/form/elements/inputs/MultipleChoiceInput.d.ts +65 -0
- package/form/elements/inputs/MultipleChoiceInput.js +2 -0
- package/form/elements/inputs/inputUtils.js +1 -1
- package/form/elements/inputs/multipleChoice/Choice.d.ts +30 -0
- package/form/elements/inputs/multipleChoice/Choice.js +2 -0
- package/form/elements/inputs/multipleChoice/OtherChoice.d.ts +28 -0
- package/form/elements/inputs/multipleChoice/OtherChoice.js +2 -0
- package/form/elements/inputs.d.ts +11 -2
- package/form/elements/inputs.js +1 -1
- package/form/support/formUtils.js +1 -1
- package/geometry/geometryEngine.js +1 -1
- package/geometry/geometryEngineJSON.js +1 -1
- package/geometry/operators/projectOperator.d.ts +5 -4
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/geometry/support/normalizeUtils.js +1 -1
- package/geometry/support/normalizeUtilsCommon.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +28 -0
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/support/SymbolLayerDrawing.d.ts +18 -4
- package/package.json +2 -2
- package/popup/Features.d.ts +9 -9
- package/popup/Features.js +1 -1
- package/popup/actionUtils.js +1 -1
- package/popup/actions.js +1 -1
- package/portal/Portal.js +1 -1
- package/portal/PortalQueryParams.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/third-party-notices.txt +7 -29
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/state/GoToOperation.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/support/cameraScaleUtils.js +2 -0
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/renderInfoUtils/line.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +13 -12
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js +21 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +11 -7
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscaleTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/SceneView.d.ts +1 -0
- package/views/draw/support/editingSessionUtils.js +2 -0
- package/views/interactive/sketch/SketchOptions.d.ts +3 -1
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +15 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/SingleFeatureInputAdapter.js +2 -0
- package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +28 -4
- package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +2 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/027c3ea756db68e51f0a.js +0 -1
- package/assets/esri/core/workers/chunks/0c00e5e4bd18467bcecd.js +0 -1
- package/assets/esri/core/workers/chunks/0ef93722524620023f69.js +0 -1
- package/assets/esri/core/workers/chunks/266ba61b72a278d93a26.js +0 -1
- package/assets/esri/core/workers/chunks/2abf124e2956e4f76688.js +0 -1
- package/assets/esri/core/workers/chunks/43678e08a3d9d51c2a6d.js +0 -1
- package/assets/esri/core/workers/chunks/5b278b9980752ef495a2.js +0 -1
- package/assets/esri/core/workers/chunks/5e59ff96aecdf2adcb3b.js +0 -1
- package/assets/esri/core/workers/chunks/74be994d789c57031631.js +0 -1
- package/assets/esri/core/workers/chunks/770880ad43f252962017.js +0 -1
- package/assets/esri/core/workers/chunks/81750c5177d8d52a3e05.js +0 -1
- package/assets/esri/core/workers/chunks/85edbb072a2ce6c1bb30.js +0 -2
- package/assets/esri/core/workers/chunks/943cf0653a2b7de16a4f.js +0 -1
- package/assets/esri/core/workers/chunks/a11f05ddd8314b648f76.js +0 -1
- package/assets/esri/core/workers/chunks/a37fc886227365f7ecd5.js +0 -1
- package/assets/esri/core/workers/chunks/af5db0372d526e592fcc.js +0 -1
- package/assets/esri/core/workers/chunks/bc53ce9a643f82d516c2.js +0 -1
- package/assets/esri/core/workers/chunks/bea70be8e38b8c83ccd2.js +0 -1
- package/assets/esri/core/workers/chunks/c3381b9a36299210ee47.js +0 -1
- package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +0 -1
- package/assets/esri/core/workers/chunks/d8d7331600d93bbca2b4.js +0 -1
- package/assets/esri/core/workers/chunks/dca595fdd5e1a571e441.js +0 -1
- package/assets/esri/core/workers/chunks/de583214195eff13cb00.js +0 -1140
- package/assets/esri/core/workers/chunks/df8143b72ef94806c992.js +0 -1
- package/assets/esri/core/workers/chunks/ef013a77950c1902de11.js +0 -1
- package/assets/esri/core/workers/chunks/fa160a2a5dc9f5a7c34b.js +0 -1
- package/geometry/support/triangulationUtilsDeprecated.js +0 -2
- package/views/3d/layers/graphics/extrudeUtilsDeprecated.js +0 -2
- package/views/3d/support/renderInfoUtils/polygonDeprecated.js +0 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +0 -7
- package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +0 -2
- /package/assets/esri/core/workers/chunks/{85edbb072a2ce6c1bb30.js.LICENSE.txt → 5511e640e171c294f52a.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d4a9eb4470cc6a1f67fc.js.LICENSE.txt → c5f155fe114a2a05aaf2.js.LICENSE.txt} +0 -0
package/popup/Features.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Error.js";import{EventedAccessor as r}from"../core/Evented.js";import s from"../core/Logger.js";import{abortMaybe as o}from"../core/maybe.js";import{debounce as n,isAbortError as a}from"../core/promiseUtils.js";import l from"../core/ReactiveSet.js";import{watch as h,when as u,sync as c}from"../core/reactiveUtils.js";import{addMany as p}from"../core/SetUtils.js";import{property as d,subclass as g}from"../core/accessorSupport/decorators.js";import m from"../geometry/Point.js";import{initializeProjection as f,project as y}from"../geometry/projectionUtils.js";import _ from"../geometry/SpatialReference.js";import{geographicToWebMercator as F}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as v}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as w}from"../layers/LayerConstants.js";import{ActionsCollection as C,zoomToClusteredFeatures as b,browseClusteredFeatures as I,zoomToFeature as P}from"./actions.js";import{isClusterFeature as A,getSelectedTarget as L}from"./actionUtils.js";import j from"./Feature.js";import x from"./support/FeatureAbilities.js";import{getDisplayedSymbol as E}from"../symbols/support/symbolUtils.js";import{system as R}from"../time/constants.js";import{highlightsSupported as O}from"../views/support/layerViewUtils.js";import{GoTo as U}from"../widgets/support/GoTo.js";const S="location-scale-handle",T=()=>[P.clone()],H=()=>[b.clone(),I.clone()];let M=null;function D(e,t){switch(e){case"building-scene":case"map-image":case"tile":case"imagery":return!0;case"imagery-tile":return"2d"===t;default:return!1}}let V=class extends(U(r)){constructor(e){super(e),this._pendingPromises=new l,this._fetchFeaturesController=null,this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this.actions=new C,this.activeFeature=null,this.browseClusterEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureItems=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=n(async e=>{this._cancelLocationUpdate();const t=new AbortController,{signal:i}=t;this._locationUpdateController=t,await this._locationUpdate(e,{signal:i}).catch(()=>{}).finally(()=>{this._locationUpdateController===t&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([h(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),h(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),h(()=>this.location,e=>this._locationChange(e)),h(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),h(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),h(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureItems],()=>this._setGraphicOnFeatureItems()),h(()=>this.featureItems,()=>this._featureItemsChange()),h(()=>[this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureItems()),u(()=>!this.waitingForResult,()=>this._waitingForResultChange(),c),h(()=>this.view?.scale,()=>this._viewScaleChange()),u(()=>!this.open,()=>this.browseClusterEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelFetchingFeatures(),this._cancelCenterAtLocation(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return this.open&&!this.waitingForResult}get allActions(){const e=this._get("allActions")||new C;e.removeAll();const{actions:i,defaultActions:r,defaultPopupTemplateEnabled:s,includeDefaultActions:o,selectedFeature:n}=this,a=o?r.concat(i):i,l=n&&("function"==typeof n.getEffectivePopupTemplate&&n.getEffectivePopupTemplate(s)||n.popupTemplate),h=l?.actions,u=l?.overwriteActions?h:h?.concat(a)??a;return u?.filter(t).forEach(t=>e.add(t)),e}set content(e){this.promises=[],this._set("content",e)}get defaultActions(){const e=this._get("defaultActions")||new C;return e.removeAll(),e.addMany(A(this.selectedFeature)?H():T()),e}get featureCount(){return this.features.length}set features(e){if(this._get("features")===e)return;const t=e||[];this._set("features",t),this._syncSelectedFeatureIndex(t)}get initialDisplayMode(){return this._get("initialDisplayMode")||"feature"}set initialDisplayMode(e){this._set("initialDisplayMode",e),this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,r=e?.spatialReference?.isWGS84;r&&i&&(t=F(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._get("promises")!==e&&(this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),e=e.slice(),p(this._pendingPromises,e),e.reduce((e,t)=>e.finally(()=>t.then(e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)}).finally(()=>this._pendingPromises.delete(t)).catch(()=>{})),Promise.resolve())):this._set("promises",[]))}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureItem(){return this.featureItems[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??R}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureItems.some(e=>e.waitingForContent)}get waitingForResult(){return(!!this._fetchFeaturesController||this.pendingPromisesCount>0)&&0===this.featureCount}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,heading:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:r}=this;if(!r||!e)throw new i("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:r});return r.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}async handleViewClick(e){return this._fetchFeaturesAndOpen(e)}_syncSelectedFeatureIndex(e){const{pendingPromisesCount:t,promiseCount:i,selectedFeatureIndex:r}=this,s=i&&e.length;"list"!==this.initialDisplayMode?s&&t&&-1===r?this.selectedFeatureIndex=0:s&&-1!==r||(this.selectedFeatureIndex=e.length?0:-1):(!s||s&&t===i)&&(this.selectedFeatureIndex=-1)}_centerAtLocation(){const{view:e}=this,t=L(this);this._cancelCenterAtLocation();const r=new AbortController,{signal:o}=r;return this._centerAtLocationController=r,t&&e?this.callGoTo({target:{target:t,scale:e.scale},options:{signal:o}}).catch(e=>{a(e)||s.getLogger(this).error(e)}):Promise.reject(new i("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}_getRoundRobinIndex(e,t){return(e+t)%t}_viewScaleChange(){if(A(this.selectedFeature))return this.browseClusterEnabled=!1,this.open=!1,void this.clear()}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:r}=this;r&&!this._locationUpdateController&&i&&e&&(!t||t.geometry)&&this._centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureItemsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureItems(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:r,featureItems:s}=this;if(null==i)return;const o=((i-1)*r+t)%t,n=o+r;s.slice(o,n).forEach((t,i)=>{t&&(t.graphic??=e[o+i])})}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:r}=this;if(this.browseClusterEnabled=!1,!e||!r)return;const s=v(e)?.type;if("map-image"!==s&&"imagery"!==s&&"imagery-tile"!==s||(e.symbol=await E(e)),(i||!t)&&e.geometry){if("point"===e.geometry.type)return void(this.location=e.geometry);const t=await import("../geometry/operators/labelPointOperator.js");return void(this.location=t.execute(e.geometry))}if(i&&!e.geometry){await this._centerAtLocation();const e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.open=!1)}_destroyFeatureItems(){this.featureItems.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureItems",[])}_updateFeatureItems(){const e=this.selectedFeature,t=this.features,i=this.featureItems,r=this.view,s=this.spatialReference,o=this.map,n=this.timeZone,a=this.location,l=this.featureItemAbilities??new x;if(!t?.length)return void this._destroyFeatureItems();const h=i.slice(),u=[];t.forEach((t,i)=>{if(!t)return;const c=h.findIndex(e=>e?.graphic===t);if(-1!==c){const e=h[c];h.splice(c,1),e.abilities=l,u[i]=e}else{const h=new j({abilities:l,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:s,graphic:t===e?t:null,location:a,map:o,view:r,timeZone:n});u[i]=h}}),h.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureItems",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:r}=this;if(!r)return null;await r.when();const s=e?.spatialReference;return s&&i?(await f(s,i,null,t),r.toScreen(e)):null}_cancelCenterAtLocation(){this._centerAtLocationController=o(this._centerAtLocationController)}_cancelFetchingFeatures(){this._fetchFeaturesController=o(this._fetchFeaturesController)}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:r}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:r}),{signal:r,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const r=new AbortController,{signal:s}=r;this._fetchFeaturesController=r;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:s,event:i});return o.catch(()=>{}).finally(()=>{this._fetchFeaturesController===r&&(this._fetchFeaturesController=null)}),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e;this.removeHandles(S),this.addHandles([h(()=>this.view?.scale,()=>this._debouncedLocationUpdate(t).catch(e=>{a(e)||s.getLogger(this).error(e)})),u(()=>!this.open,()=>{this.removeHandles(S)},{once:!0})],S);const{pendingFeatures:r}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});return{location:t??void 0,promises:r}}async _locationUpdate(e,t){const{spatialReference:i}=this,r=this.selectedFeature?.geometry?.type,o=this.location??e;if(r&&"mesh"!==r&&i&&o&&this.selectedFeature){if("point"===r){const e=await import("../geometry/operators/labelPointOperator.js");return void(this.location=e.execute(this.selectedFeature.geometry))}try{const e=this.selectedFeature;let r=e.geometry;const s=this._getHighlightLayer(e),n=e.getObjectId();if(!s||!this.view)return;if(n){const e=this.view?.allLayerViews.find(e=>e.layer.uid===s.uid);if(!e||!("queryFeatures"in e))return;const o=e.createQuery();o.outSpatialReference=i,o.objectIds=[n],o.returnGeometry=!0;const{features:a}=await e.queryFeatures(o,t);r=a[0]?.geometry}if(!r||"mesh"===r.type)return;r=y(r,i),M??=await Promise.all([import("../geometry/operators/intersectsOperator.js"),import("../geometry/operators/proximityOperator.js")]);const[a,l]=M;if(!a.execute(r,o)){const t=l.getNearestCoordinate(r,o).coordinate??o;this.selectedFeature===e&&(this.location=t)}}catch(n){a(n)||s.getLogger(this).error(n)}}}_cancelLocationUpdate(){this._locationUpdateController=o(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const t=v(e),{layer:i}=e;return t&&"layer"in t&&t.layer?t.layer:"map-notes"===t?.type||"subtype-group"===t?.type?t:i??t}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(D(t.type,i))return e;const r=e.getObjectId();if(null!=r)return r;const s="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||w:null,o=e.attributes;return o&&s&&o[s]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:r,view:s,open:o}=this;if(!s||!r||!o)return;const n=this._getHighlightLayer(i);if(!n)return;const a=this._getHighlightLayerView(s,n);if(!a)return;this._highlightPromises[e]=a;const l=await a;if(!(l&&O(l)&&this._highlightPromises[e]===a&&this[t]&&this.highlightEnabled))return;const h=l.highlight(this._getHighlightTarget(i,n,s.type));this.addHandles(h,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter(e=>!t.includes(e));i?.length&&(this.features=t.concat(i))}};e([d()],V.prototype,"_fetchFeaturesController",void 0),e([d({type:C})],V.prototype,"actions",void 0),e([d({readOnly:!0})],V.prototype,"active",null),e([d()],V.prototype,"activeFeature",void 0),e([d({readOnly:!0})],V.prototype,"allActions",null),e([d()],V.prototype,"browseClusterEnabled",void 0),e([d({value:null})],V.prototype,"content",null),e([d({type:C,readOnly:!0})],V.prototype,"defaultActions",null),e([d({type:Boolean})],V.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],V.prototype,"featureCount",null),e([d()],V.prototype,"featurePage",void 0),e([d({value:[]})],V.prototype,"features",null),e([d()],V.prototype,"featuresPerPage",void 0),e([d()],V.prototype,"featureMenuOpen",void 0),e([d({type:x})],V.prototype,"featureItemAbilities",void 0),e([d({readOnly:!0})],V.prototype,"featureItems",void 0),e([d()],V.prototype,"heading",void 0),e([d()],V.prototype,"highlightEnabled",void 0),e([d()],V.prototype,"includeDefaultActions",void 0),e([d({value:"feature"})],V.prototype,"initialDisplayMode",null),e([d({type:m})],V.prototype,"location",null),e([d()],V.prototype,"map",null),e([d()],V.prototype,"open",void 0),e([d({readOnly:!0})],V.prototype,"pendingPromisesCount",null),e([d({readOnly:!0})],V.prototype,"promiseCount",null),e([d()],V.prototype,"promises",null),e([d({value:null,readOnly:!0})],V.prototype,"selectedFeature",null),e([d({value:-1})],V.prototype,"selectedFeatureIndex",null),e([d({readOnly:!0})],V.prototype,"selectedFeatureItem",null),e([d({type:_})],V.prototype,"spatialReference",null),e([d({readOnly:!0})],V.prototype,"state",null),e([d()],V.prototype,"timeZone",null),e([d()],V.prototype,"updateLocationEnabled",void 0),e([d()],V.prototype,"view",void 0),e([d({readOnly:!0})],V.prototype,"waitingForContents",null),e([d({readOnly:!0})],V.prototype,"waitingForResult",null),e([d()],V.prototype,"zoomFactor",void 0),V=e([g("esri.popup.Features")],V);const Z=V;export{Z as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Error.js";import{EventedAccessor as r}from"../core/Evented.js";import s from"../core/Logger.js";import{abortMaybe as o}from"../core/maybe.js";import{debounce as n,isAbortError as a}from"../core/promiseUtils.js";import l from"../core/ReactiveSet.js";import{watch as h,when as u,sync as c}from"../core/reactiveUtils.js";import{addMany as p}from"../core/SetUtils.js";import{property as d,subclass as g}from"../core/accessorSupport/decorators.js";import m from"../geometry/Point.js";import{initializeProjection as f,project as y}from"../geometry/projectionUtils.js";import _ from"../geometry/SpatialReference.js";import{geographicToWebMercator as F}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as v}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as w}from"../layers/LayerConstants.js";import{ActionsCollection as C,zoomToAggregatedFeatures as b,browseAggregatedFeatures as I,zoomToFeature as P}from"./actions.js";import{getSelectedTarget as A}from"./actionUtils.js";import L from"./Feature.js";import j from"./support/FeatureAbilities.js";import{getDisplayedSymbol as x}from"../symbols/support/symbolUtils.js";import{system as E}from"../time/constants.js";import{highlightsSupported as R}from"../views/support/layerViewUtils.js";import{GoTo as O}from"../widgets/support/GoTo.js";const U="location-scale-handle",S=()=>[P.clone()],T=()=>[b.clone(),I.clone()];let M=null;function H(e,t){switch(e){case"building-scene":case"map-image":case"tile":case"imagery":return!0;case"imagery-tile":return"2d"===t;default:return!1}}let D=class extends(O(r)){constructor(e){super(e),this._pendingPromises=new l,this._fetchFeaturesController=null,this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new j,this.actions=new C,this.activeFeature=null,this.browseClusterEnabled=!1,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureItems=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=n(async e=>{this._cancelLocationUpdate();const t=new AbortController,{signal:i}=t;this._locationUpdateController=t,await this._locationUpdate(e,{signal:i}).catch(()=>{}).finally(()=>{this._locationUpdateController===t&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([h(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),h(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),h(()=>this.location,e=>this._locationChange(e)),h(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),h(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),h(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureItems],()=>this._setGraphicOnFeatureItems()),h(()=>this.featureItems,()=>this._featureItemsChange()),h(()=>[this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureItems()),u(()=>!this.waitingForResult,()=>this._waitingForResultChange(),c),h(()=>this.view?.scale,()=>this._viewScaleChange()),u(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelFetchingFeatures(),this._cancelCenterAtLocation(),this._pendingPromises.clear(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return this.open&&!this.waitingForResult}get allActions(){const e=this._get("allActions")||new C;e.removeAll();const{actions:i,defaultActions:r,defaultPopupTemplateEnabled:s,includeDefaultActions:o,selectedFeature:n}=this,a=o?r.concat(i):i,l=n&&("function"==typeof n.getEffectivePopupTemplate&&n.getEffectivePopupTemplate(s)||n.popupTemplate),h=l?.actions,u=l?.overwriteActions?h:h?.concat(a)??a;return u?.filter(t).forEach(t=>e.add(t)),e}set content(e){this.promises=[],this._set("content",e)}get defaultActions(){const e=this._get("defaultActions")||new C;return e.removeAll(),e.addMany(this.selectedFeature?.isAggregate?T():S()),e}get featureCount(){return this.features.length}set features(e){if(this._get("features")===e)return;const t=e||[];this._set("features",t),this._syncSelectedFeatureIndex(t)}get initialDisplayMode(){return this._get("initialDisplayMode")||"feature"}set initialDisplayMode(e){this._set("initialDisplayMode",e),this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,r=e?.spatialReference?.isWGS84;r&&i&&(t=F(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._get("promises")!==e&&(this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),e=e.slice(),p(this._pendingPromises,e),e.reduce((e,t)=>e.finally(()=>t.then(e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)}).finally(()=>this._pendingPromises.delete(t)).catch(()=>{})),Promise.resolve())):this._set("promises",[]))}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureItem(){return this.featureItems[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??E}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureItems.some(e=>e.waitingForContent)}get waitingForResult(){return(!!this._fetchFeaturesController||this.pendingPromisesCount>0)&&0===this.featureCount}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,heading:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:r}=this;if(!r||!e)throw new i("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:r});return r.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}async handleViewClick(e){return this._fetchFeaturesAndOpen(e)}_syncSelectedFeatureIndex(e){const{pendingPromisesCount:t,promiseCount:i,selectedFeatureIndex:r}=this,s=i&&e.length;"list"!==this.initialDisplayMode?s&&t&&-1===r?this.selectedFeatureIndex=0:s&&-1!==r||(this.selectedFeatureIndex=e.length?0:-1):(!s||s&&t===i)&&(this.selectedFeatureIndex=-1)}_centerAtLocation(){const{view:e}=this,t=A(this);this._cancelCenterAtLocation();const r=new AbortController,{signal:o}=r;return this._centerAtLocationController=r,t&&e?this.callGoTo({target:{target:t,scale:e.scale},options:{signal:o}}).catch(e=>{a(e)||s.getLogger(this).error(e)}):Promise.reject(new i("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}_getRoundRobinIndex(e,t){return(e+t)%t}_viewScaleChange(){if(this.selectedFeature?.isAggregate)return this.aggregatedFeaturesEnabled=!1,this.open=!1,void this.clear()}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:r}=this;r&&!this._locationUpdateController&&i&&e&&(!t||t.geometry)&&this._centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureItemsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureItems(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:r,featureItems:s}=this;if(null==i)return;const o=((i-1)*r+t)%t,n=Math.min(o+r,s.length);for(let a=o;a<n;a++){const t=s[a];t&&(t.graphic??=e[a])}}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;const s=v(e)?.type;if("map-image"!==s&&"imagery"!==s&&"imagery-tile"!==s||(e.symbol=await x(e)),(i||!t)&&e.geometry){if("point"===e.geometry.type)return void(this.location=e.geometry);const t=await import("../geometry/operators/labelPointOperator.js");return void(this.location=t.execute(e.geometry))}if(i&&!e.geometry){await this._centerAtLocation();const e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.open=!1)}_destroyFeatureItems(){this.featureItems.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureItems",[])}_updateFeatureItems(){const e=this.selectedFeature,t=this.features,i=this.featureItems,r=this.view,s=this.spatialReference,o=this.map,n=this.timeZone,a=this.location,l=this.featureItemAbilities??this._defaultFeatureAbilities;if(!t?.length)return void this._destroyFeatureItems();const h=[],u=new Map,c=new Set;i.forEach(e=>{const t=e?.graphic;e&&t&&u.set(t,e)}),t.forEach((t,p)=>{if(!t)return;const d=i[p];if(d&&!c.has(d)&&(null==d.graphic||d.graphic===t))return d.abilities=l,h[p]=d,void c.add(d);const g=u.get(t);if(g&&!c.has(g))return g.abilities=l,h[p]=g,void c.add(g);const m=new L({abilities:l,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:s,graphic:t===e?t:null,location:a,map:o,view:r,timeZone:n});h[p]=m,c.add(m)}),i.forEach(e=>{!e||c.has(e)||e.destroyed||e.destroy()}),this._set("featureItems",h)}async _getScreenPoint(e,t){const{spatialReference:i,view:r}=this;if(!r)return null;await r.when();const s=e?.spatialReference;return s&&i?(await f(s,i,null,t),r.toScreen(e)):null}_cancelCenterAtLocation(){this._centerAtLocationController=o(this._centerAtLocationController)}_cancelFetchingFeatures(){this._fetchFeaturesController=o(this._fetchFeaturesController)}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:r}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:r}),{signal:r,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const r=new AbortController,{signal:s}=r;this._fetchFeaturesController=r;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:s,event:i});return o.catch(()=>{}).finally(()=>{this._fetchFeaturesController===r&&(this._fetchFeaturesController=null)}),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e;this.removeHandles(U),this.addHandles([h(()=>this.view?.scale,()=>this._debouncedLocationUpdate(t).catch(e=>{a(e)||s.getLogger(this).error(e)})),u(()=>!this.open,()=>{this.removeHandles(U)},{once:!0})],U);const{pendingFeatures:r}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});return{location:t??void 0,promises:r}}async _locationUpdate(e,t){const{spatialReference:i}=this,r=this.selectedFeature?.geometry?.type,o=this.location??e;if(r&&"mesh"!==r&&i&&o&&this.selectedFeature){if("point"===r){const e=await import("../geometry/operators/labelPointOperator.js");return void(this.location=e.execute(this.selectedFeature.geometry))}try{const e=this.selectedFeature;let r=e.geometry;const s=this._getHighlightLayer(e),n=e.getObjectId();if(!s||!this.view)return;if(n){const e=this.view?.allLayerViews.find(e=>e.layer.uid===s.uid);if(!e||!("queryFeatures"in e))return;const o=e.createQuery();o.outSpatialReference=i,o.objectIds=[n],o.returnGeometry=!0;const{features:a}=await e.queryFeatures(o,t);r=a[0]?.geometry}if(!r||"mesh"===r.type)return;r=y(r,i),M??=await Promise.all([import("../geometry/operators/intersectsOperator.js"),import("../geometry/operators/proximityOperator.js")]);const[a,l]=M;if(!a.execute(r,o)){const t=l.getNearestCoordinate(r,o).coordinate??o;this.selectedFeature===e&&(this.location=t)}}catch(n){a(n)||s.getLogger(this).error(n)}}}_cancelLocationUpdate(){this._locationUpdateController=o(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const t=v(e),{layer:i}=e;return t&&"layer"in t&&t.layer?t.layer:"map-notes"===t?.type||"subtype-group"===t?.type?t:i??t}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(H(t.type,i))return e;const r=e.getObjectId();if(null!=r)return r;const s="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||w:null,o=e.attributes;return o&&s&&o[s]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:r,view:s,open:o}=this;if(!s||!r||!o)return;const n=this._getHighlightLayer(i);if(!n)return;const a=this._getHighlightLayerView(s,n);if(!a)return;this._highlightPromises[e]=a;const l=await a;if(!(l&&R(l)&&this._highlightPromises[e]===a&&this[t]&&this.highlightEnabled))return;const h=l.highlight(this._getHighlightTarget(i,n,s.type));this.addHandles(h,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=new Set(t),r=e.filter(e=>!i.has(e));r?.length&&(this.features=t.concat(r))}};e([d()],D.prototype,"_fetchFeaturesController",void 0),e([d({type:C})],D.prototype,"actions",void 0),e([d({readOnly:!0})],D.prototype,"active",null),e([d()],D.prototype,"activeFeature",void 0),e([d({readOnly:!0})],D.prototype,"allActions",null),e([d()],D.prototype,"browseClusterEnabled",void 0),e([d()],D.prototype,"aggregatedFeaturesEnabled",void 0),e([d({value:null})],D.prototype,"content",null),e([d({type:C,readOnly:!0})],D.prototype,"defaultActions",null),e([d({type:Boolean})],D.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],D.prototype,"featureCount",null),e([d()],D.prototype,"featurePage",void 0),e([d({value:[]})],D.prototype,"features",null),e([d()],D.prototype,"featuresPerPage",void 0),e([d()],D.prototype,"featureMenuOpen",void 0),e([d({type:j})],D.prototype,"featureItemAbilities",void 0),e([d({readOnly:!0})],D.prototype,"featureItems",void 0),e([d()],D.prototype,"heading",void 0),e([d()],D.prototype,"highlightEnabled",void 0),e([d()],D.prototype,"includeDefaultActions",void 0),e([d({value:"feature"})],D.prototype,"initialDisplayMode",null),e([d({type:m})],D.prototype,"location",null),e([d()],D.prototype,"map",null),e([d()],D.prototype,"open",void 0),e([d({readOnly:!0})],D.prototype,"pendingPromisesCount",null),e([d({readOnly:!0})],D.prototype,"promiseCount",null),e([d()],D.prototype,"promises",null),e([d({value:null,readOnly:!0})],D.prototype,"selectedFeature",null),e([d({value:-1})],D.prototype,"selectedFeatureIndex",null),e([d({readOnly:!0})],D.prototype,"selectedFeatureItem",null),e([d({type:_})],D.prototype,"spatialReference",null),e([d({readOnly:!0})],D.prototype,"state",null),e([d()],D.prototype,"timeZone",null),e([d()],D.prototype,"updateLocationEnabled",void 0),e([d()],D.prototype,"view",void 0),e([d({readOnly:!0})],D.prototype,"waitingForContents",null),e([d({readOnly:!0})],D.prototype,"waitingForResult",null),e([d()],D.prototype,"zoomFactor",void 0),D=e([g("esri.popup.Features")],D);const V=D;export{V as default};
|
package/popup/actionUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
|
|
2
|
+
function e(e){const{selectedFeature:n,location:t,view:l}=e;return l?n??t??null:null}export{e as getSelectedTarget};
|
package/popup/actions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../core/Collection.js";import
|
|
2
|
+
import e from"../core/Collection.js";import o from"../support/actions/ActionBase.js";import t from"../support/actions/ActionButton.js";import s from"../support/actions/ActionToggle.js";const a=e.ofType({key:"type",defaultKeyValue:"button",base:o,typeMap:{button:t,toggle:s}}),i=new t({icon:"magnifying-glass-plus",id:"zoom-to-feature",title:"{messages.zoom}"}),g=new t({icon:"magnifying-glass-plus",id:"zoom-to-aggregated-features",title:"{messages.zoom}"}),r=new t({icon:"table",id:"browse-aggregated-features",title:"{messages.browseAggregatedFeatures}"});export{a as ActionsCollection,r as browseAggregatedFeatures,g as zoomToAggregatedFeatures,i as zoomToFeature};
|
package/portal/Portal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
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 has from"../core/has.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 y,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureType as m}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import{getLocale as v}from"../intl/locale.js";import{ensureDefaultPortalInstance as S}from"./portalDefault.js";import g from"./PortalGroup.js";import P from"./PortalQueryParams.js";import G from"./PortalQueryResult.js";import D from"./PortalUser.js";import{isApiKeyApplicable as O,hasBasemapStylesApiKey as B}from"../support/apiKeyUtils.js";import{reader as Q}from"../core/accessorSupport/decorators/reader.js";var _;let b;const U={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:D})};let M=class extends(a(i)){static{_=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.g3DTilesGalleryGroupQuery=null,this.g3dTilesEnabled=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(){C.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 O(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),b=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!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",T(new WeakRef(this))),C.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){if(this.g3dTilesEnabled&&this.g3DTilesGalleryGroupQuery&&has("enable-feature:basemap-groundlayers")){const e=await this._fetchBasemaps3D(this.g3DTilesGalleryGroupQuery,t);r.unshift(...e)}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 P;t.query=this.default3DBasemapQuery,t.disableExtraQuery=!0;const r=(await this.queryItems(t,e)).results.find(e=>"Web Scene"===e.type);return r?new b({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 P({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||v();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||v();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return S(()=>new _)}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:v().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=m(P,t),a=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then(e=>{const r=s.clone();return r.start=e.nextStart,new G({nextQueryParams:r,queryParams:s,total:e.total,results:_._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&&U[r]?U[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===_.AUTH_MODE_ANONYMOUS||this.authMode===_.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!==_.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=_._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===_.AUTH_MODE_ANONYMOUS||this.authMode===_.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 _({sourceJSON:e})}_getHelperService(e){const t=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 P;r.query=e||(B()?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 b({portalItem:e}))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];if(B())return[];const o=new P({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 b({portalItem:e}))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=b.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([y()],M.prototype,"access",void 0),e([y()],M.prototype,"allSSL",void 0),e([y()],M.prototype,"authMode",void 0),e([y()],M.prototype,"authorizedCrossOriginDomains",void 0),e([Q("authorizedCrossOriginDomains")],M.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],M.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],M.prototype,"basemapGalleryGroupQuery3D",void 0),e([y({json:{name:"g3DTilesGalleryGroupQuery"}})],M.prototype,"g3DTilesGalleryGroupQuery",void 0),e([y({json:{name:"g3dTilesEnabled"}})],M.prototype,"g3dTilesEnabled",void 0),e([y()],M.prototype,"bingKey",void 0),e([y()],M.prototype,"canListApps",void 0),e([y()],M.prototype,"canListData",void 0),e([y()],M.prototype,"canListPreProvisionedItems",void 0),e([y()],M.prototype,"canProvisionDirectPurchase",void 0),e([y()],M.prototype,"canSearchPublic",void 0),e([y()],M.prototype,"canShareBingPublic",void 0),e([y()],M.prototype,"canSharePublic",void 0),e([y()],M.prototype,"canSignInArcGIS",void 0),e([y()],M.prototype,"canSignInIDP",void 0),e([y()],M.prototype,"colorSetsGroupQuery",void 0),e([y()],M.prototype,"commentsEnabled",void 0),e([y({type:Date})],M.prototype,"created",void 0),e([y()],M.prototype,"credential",void 0),e([y()],M.prototype,"culture",void 0),e([y()],M.prototype,"currentVersion",void 0),e([y()],M.prototype,"customBaseUrl",void 0),e([y()],M.prototype,"default3DBasemapQuery",void 0),e([y()],M.prototype,"defaultBasemap",void 0),e([Q("defaultBasemap")],M.prototype,"readDefaultBasemap",null),e([y()],M.prototype,"defaultDevBasemap",void 0),e([Q("defaultDevBasemap")],M.prototype,"readDefaultDevBasemap",null),e([y({type:f})],M.prototype,"defaultExtent",void 0),e([y()],M.prototype,"defaultVectorBasemap",void 0),e([Q("defaultVectorBasemap")],M.prototype,"readDefaultVectorBasemap",null),e([y()],M.prototype,"description",void 0),e([y()],M.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],M.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],M.prototype,"extraQuery",null),e([y()],M.prototype,"featuredGroups",void 0),e([y()],M.prototype,"featuredItemsGroupQuery",void 0),e([y()],M.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],M.prototype,"layoutGroupQuery",void 0),e([y()],M.prototype,"livingAtlasGroupQuery",void 0),e([y({readOnly:!0})],M.prototype,"hasAPIKey",null),e([y()],M.prototype,"hasCategorySchema",void 0),e([y()],M.prototype,"hasClassificationSchema",void 0),e([y()],M.prototype,"helpBase",void 0),e([y()],M.prototype,"helperServices",void 0),e([y()],M.prototype,"helpMap",void 0),e([y()],M.prototype,"homePageFeaturedContent",void 0),e([y()],M.prototype,"homePageFeaturedContentCount",void 0),e([y()],M.prototype,"httpPort",void 0),e([y()],M.prototype,"httpsPort",void 0),e([y()],M.prototype,"id",void 0),e([y()],M.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],M.prototype,"isOrganization",null),e([y()],M.prototype,"isPortal",void 0),e([y()],M.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],M.prototype,"itemPageUrl",null),e([y()],M.prototype,"layerTemplatesGroupQuery",void 0),e([y()],M.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],M.prototype,"modified",void 0),e([y()],M.prototype,"name",void 0),e([y()],M.prototype,"portalHostname",void 0),e([y()],M.prototype,"portalMode",void 0),e([y()],M.prototype,"portalProperties",void 0),e([y()],M.prototype,"region",void 0),e([y()],M.prototype,"recycleBinEnabled",void 0),e([y({readOnly:!0})],M.prototype,"restUrl",null),e([y()],M.prototype,"rotatorPanels",void 0),e([y()],M.prototype,"showHomePageDescription",void 0),e([y()],M.prototype,"sourceJSON",void 0),e([y()],M.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],M.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],M.prototype,"stylesGroupQuery3d",void 0),e([y()],M.prototype,"supportsHostedServices",void 0),e([y()],M.prototype,"symbolSetsGroupQuery",void 0),e([y()],M.prototype,"templatesGroupQuery",void 0),e([y()],M.prototype,"thumbnail",void 0),e([y({readOnly:!0})],M.prototype,"thumbnailUrl",null),e([y()],M.prototype,"units",void 0),e([y()],M.prototype,"url",void 0),e([y()],M.prototype,"urlKey",void 0),e([Q("urlKey")],M.prototype,"readUrlKey",null),e([y()],M.prototype,"user",void 0),e([Q("user")],M.prototype,"readUser",null),e([y()],M.prototype,"use3dBasemaps",void 0),e([y()],M.prototype,"useDefault3dBasemap",void 0),e([y()],M.prototype,"useStandardizedQuery",void 0),e([y()],M.prototype,"useVectorBasemaps",void 0),e([y()],M.prototype,"vectorBasemapGalleryGroupQuery",void 0),M=_=e([c("esri.portal.Portal")],M);const C=new FinalizationRegistry(e=>{e.remove()});function T(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch(()=>{})}}export{M as default};
|
|
2
|
+
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 has from"../core/has.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 y,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureType as m}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import{getLocale as v}from"../intl/locale.js";import{ensureDefaultPortalInstance as S}from"./portalDefault.js";import g from"./PortalGroup.js";import P from"./PortalQueryParams.js";import G from"./PortalQueryResult.js";import O from"./PortalUser.js";import{isApiKeyApplicable as D,hasBasemapStylesApiKey as B}from"../support/apiKeyUtils.js";import{reader as Q}from"../core/accessorSupport/decorators/reader.js";var _;let b;const U={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:O})};let M=class extends(a(i)){static{_=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.g3DTilesGalleryGroupQuery=null,this.g3dTilesEnabled=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(){C.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?`orgid:${this.id}`:null}get hasAPIKey(){return D(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=O.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then(({default:t})=>{n(e),b=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!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",T(new WeakRef(this))),C.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){if(this.g3dTilesEnabled&&this.g3DTilesGalleryGroupQuery&&has("enable-feature:basemap-groundlayers")){const e=await this._fetchBasemaps3D(this.g3DTilesGalleryGroupQuery,t);r.unshift(...e)}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 P;t.query=this.default3DBasemapQuery,t.disableExtraQuery=!0;const r=(await this.queryItems(t,e)).results.find(e=>"Web Scene"===e.type);return r?new b({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 P({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||v();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||v();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return S(()=>new _)}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:v().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=m(P,t),a=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then(e=>{const r=s.clone();return r.start=e.nextStart,new G({nextQueryParams:r,queryParams:s,total:e.total,results:_._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&&U[r]?U[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===_.AUTH_MODE_ANONYMOUS||this.authMode===_.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!==_.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=_._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===_.AUTH_MODE_ANONYMOUS||this.authMode===_.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 _({sourceJSON:e})}_getHelperService(e){const t=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 P;r.query=e||(B()?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 b({portalItem:e}))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];if(B())return[];const o=new P({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 b({portalItem:e}))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=b.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([y()],M.prototype,"access",void 0),e([y()],M.prototype,"allSSL",void 0),e([y()],M.prototype,"authMode",void 0),e([y()],M.prototype,"authorizedCrossOriginDomains",void 0),e([Q("authorizedCrossOriginDomains")],M.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],M.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],M.prototype,"basemapGalleryGroupQuery3D",void 0),e([y({json:{name:"g3DTilesGalleryGroupQuery"}})],M.prototype,"g3DTilesGalleryGroupQuery",void 0),e([y({json:{name:"g3dTilesEnabled"}})],M.prototype,"g3dTilesEnabled",void 0),e([y()],M.prototype,"bingKey",void 0),e([y()],M.prototype,"canListApps",void 0),e([y()],M.prototype,"canListData",void 0),e([y()],M.prototype,"canListPreProvisionedItems",void 0),e([y()],M.prototype,"canProvisionDirectPurchase",void 0),e([y()],M.prototype,"canSearchPublic",void 0),e([y()],M.prototype,"canShareBingPublic",void 0),e([y()],M.prototype,"canSharePublic",void 0),e([y()],M.prototype,"canSignInArcGIS",void 0),e([y()],M.prototype,"canSignInIDP",void 0),e([y()],M.prototype,"colorSetsGroupQuery",void 0),e([y()],M.prototype,"commentsEnabled",void 0),e([y({type:Date})],M.prototype,"created",void 0),e([y()],M.prototype,"credential",void 0),e([y()],M.prototype,"culture",void 0),e([y()],M.prototype,"currentVersion",void 0),e([y()],M.prototype,"customBaseUrl",void 0),e([y()],M.prototype,"default3DBasemapQuery",void 0),e([y()],M.prototype,"defaultBasemap",void 0),e([Q("defaultBasemap")],M.prototype,"readDefaultBasemap",null),e([y()],M.prototype,"defaultDevBasemap",void 0),e([Q("defaultDevBasemap")],M.prototype,"readDefaultDevBasemap",null),e([y({type:f})],M.prototype,"defaultExtent",void 0),e([y()],M.prototype,"defaultVectorBasemap",void 0),e([Q("defaultVectorBasemap")],M.prototype,"readDefaultVectorBasemap",null),e([y()],M.prototype,"description",void 0),e([y()],M.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],M.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],M.prototype,"extraQuery",null),e([y()],M.prototype,"featuredGroups",void 0),e([y()],M.prototype,"featuredItemsGroupQuery",void 0),e([y()],M.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],M.prototype,"layoutGroupQuery",void 0),e([y()],M.prototype,"livingAtlasGroupQuery",void 0),e([y({readOnly:!0})],M.prototype,"hasAPIKey",null),e([y()],M.prototype,"hasCategorySchema",void 0),e([y()],M.prototype,"hasClassificationSchema",void 0),e([y()],M.prototype,"helpBase",void 0),e([y()],M.prototype,"helperServices",void 0),e([y()],M.prototype,"helpMap",void 0),e([y()],M.prototype,"homePageFeaturedContent",void 0),e([y()],M.prototype,"homePageFeaturedContentCount",void 0),e([y()],M.prototype,"httpPort",void 0),e([y()],M.prototype,"httpsPort",void 0),e([y()],M.prototype,"id",void 0),e([y()],M.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],M.prototype,"isOrganization",null),e([y()],M.prototype,"isPortal",void 0),e([y()],M.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],M.prototype,"itemPageUrl",null),e([y()],M.prototype,"layerTemplatesGroupQuery",void 0),e([y()],M.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],M.prototype,"modified",void 0),e([y()],M.prototype,"name",void 0),e([y()],M.prototype,"portalHostname",void 0),e([y()],M.prototype,"portalMode",void 0),e([y()],M.prototype,"portalProperties",void 0),e([y()],M.prototype,"region",void 0),e([y()],M.prototype,"recycleBinEnabled",void 0),e([y({readOnly:!0})],M.prototype,"restUrl",null),e([y()],M.prototype,"rotatorPanels",void 0),e([y()],M.prototype,"showHomePageDescription",void 0),e([y()],M.prototype,"sourceJSON",void 0),e([y()],M.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],M.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],M.prototype,"stylesGroupQuery3d",void 0),e([y()],M.prototype,"supportsHostedServices",void 0),e([y()],M.prototype,"symbolSetsGroupQuery",void 0),e([y()],M.prototype,"templatesGroupQuery",void 0),e([y()],M.prototype,"thumbnail",void 0),e([y({readOnly:!0})],M.prototype,"thumbnailUrl",null),e([y()],M.prototype,"units",void 0),e([y()],M.prototype,"url",void 0),e([y()],M.prototype,"urlKey",void 0),e([Q("urlKey")],M.prototype,"readUrlKey",null),e([y()],M.prototype,"user",void 0),e([Q("user")],M.prototype,"readUser",null),e([y()],M.prototype,"use3dBasemaps",void 0),e([y()],M.prototype,"useDefault3dBasemap",void 0),e([y()],M.prototype,"useStandardizedQuery",void 0),e([y()],M.prototype,"useVectorBasemaps",void 0),e([y()],M.prototype,"vectorBasemapGalleryGroupQuery",void 0),M=_=e([c("esri.portal.Portal")],M);const C=new FinalizationRegistry(e=>{e.remove()});function T(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch(()=>{})}}export{M as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import r from"../core/Accessor.js";import{JSONMap as e}from"../core/jsonMap.js";import{clone as s}from"../core/lang.js";import{property as o,subclass as i}from"../core/accessorSupport/decorators.js";import n from"../geometry/Extent.js";import l from"../geometry/SpatialReference.js";import{project as a}from"../geometry/support/webMercatorUtils.js";var u;const m=new e({avgRating:"avg-rating",numRatings:"num-ratings",numComments:"num-comments",numViews:"num-views"});let p=u=class extends r{constructor(t){super(t),this.categories=null,this.disableExtraQuery=!1,this.extent=null,this.filter=null,this.num=10,this.query=null,this.sortField=null,this.start=1}get sortOrder(){return this._get("sortOrder")||"asc"}set sortOrder(t){"asc"!==t&&"desc"!==t||this._set("sortOrder",t)}clone(){return new u({categories:this.categories?s(this.categories):null,disableExtraQuery:this.disableExtraQuery,extent:this.extent?this.extent.clone():null,filter:this.filter,num:this.num,query:this.query,sortField:this.sortField,sortOrder:this.sortOrder,start:this.start})}toRequestOptions(t,r){let e=[];this.categories&&(e=this.categories.map(t=>Array.isArray(t)?JSON.stringify(t):t));let s="";if(this.extent){const t=a(this.extent,l.WGS84);null!=t&&(s=`${t.xmin},${t.ymin},${t.xmax},${t.ymax}`)}let o=this.query;!this.disableExtraQuery&&
|
|
2
|
+
import{__decorate as t}from"tslib";import r from"../core/Accessor.js";import{JSONMap as e}from"../core/jsonMap.js";import{clone as s}from"../core/lang.js";import{property as o,subclass as i}from"../core/accessorSupport/decorators.js";import n from"../geometry/Extent.js";import l from"../geometry/SpatialReference.js";import{project as a}from"../geometry/support/webMercatorUtils.js";var u;const m=new e({avgRating:"avg-rating",numRatings:"num-ratings",numComments:"num-comments",numViews:"num-views"});let p=u=class extends r{constructor(t){super(t),this.categories=null,this.disableExtraQuery=!1,this.extent=null,this.filter=null,this.num=10,this.query=null,this.sortField=null,this.start=1}get sortOrder(){return this._get("sortOrder")||"asc"}set sortOrder(t){"asc"!==t&&"desc"!==t||this._set("sortOrder",t)}clone(){return new u({categories:this.categories?s(this.categories):null,disableExtraQuery:this.disableExtraQuery,extent:this.extent?this.extent.clone():null,filter:this.filter,num:this.num,query:this.query,sortField:this.sortField,sortOrder:this.sortOrder,start:this.start})}toRequestOptions(t,r){let e=[];this.categories&&(e=this.categories.map(t=>Array.isArray(t)?JSON.stringify(t):t));let s="";if(this.extent){const t=a(this.extent,l.WGS84);null!=t&&(s=`${t.xmin},${t.ymin},${t.xmax},${t.ymax}`)}let o=this.query;const i=t.extraQuery;!this.disableExtraQuery&&i&&(o=o?"("+o+") AND "+i:i);const n={categories:e,bbox:s,q:o,filter:this.filter,num:this.num,sortField:null,sortOrder:null,start:this.start};return this.sortField&&(n.sortField=this.sortField.split(",").map(t=>m.toJSON(t.trim())).join(","),n.sortOrder=this.sortOrder),{query:{...r,...n}}}};t([o()],p.prototype,"categories",void 0),t([o()],p.prototype,"disableExtraQuery",void 0),t([o({type:n})],p.prototype,"extent",void 0),t([o()],p.prototype,"filter",void 0),t([o()],p.prototype,"num",void 0),t([o()],p.prototype,"query",void 0),t([o()],p.prototype,"sortField",void 0),t([o()],p.prototype,"sortOrder",null),t([o()],p.prototype,"start",void 0),p=u=t([i("esri.portal.PortalQueryParams")],p);export{p as default};
|
package/rest/print.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as a}from"../core/jsonMap.js";import{createScreenPoint as i,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{dataComponents as o,normalize as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as u}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as c}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as f,findToken as p}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{formatJsonMap as g}from"./support/fileFormat.js";import{toJSON as b}from"./support/layoutTemplate.js";import{getVisibleLayerViews as h,isScreenshotRequired as w,isBingMapsLayer as S,isBlendLayer as I,getCopyright as x,getSelectionSymbol as v,createPointLayer as D,getContextBoundingBox as L,createPolygonLayer as T,createPolylineLayer as O,createMultipointLayer as V}from"./support/printTaskUtils.js";import E from"./support/PrintTemplate.js";import{toJSON as P}from"./support/reportTemplate.js";import M from"../symbols/WebStyleSymbol.js";import F from"../views/support/HighlightOptions.js";const k={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},N=new a({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),R=new a({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),j=new Map;async function J(e,t,a){const i=await U(e,a),r=await z(t,i);if("sync"===await A(e,a)){const{results:t}=await d(e,r,void 0,a);return t?.[0]?.value}const n=await m(e,r,void 0,a);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,a);return o}async function U(e,a){const i=G(e),r=j.get(i)??{gpServerUrl:i,legendLayerNameMap:{},legendLayers:[],screenshotLayers:[]};return r.gpMetadata??=(await t(i,f({f:"json"},a))).data,r.cimVersion=r.gpMetadata.cimVersion,r.webStyleCache??=new Map,j.set(i,r),r}async function A(e,t){return ve(await U(e,t))}async function C(e,a){const i=await U(e,a),r=i.gpMetadata.tasks,n=i.gpServerUrl;if(i.taskInfos)return i.taskInfos;const o=(await t(e,f({f:"json"},a))).data;i.taskInfos={ExportWebMap:o};const s=r?.filter(e=>e!==o.name)??[];return await Promise.all(s.map(async e=>{const r=(await t(`${n}/${e}`,f({f:"json"},a))).data,o=r.name.startsWith("GetLayoutTemplatesInfo")?"GetLayoutTemplatesInfo":null;o&&(i.taskInfos[o]??=r)})),i.taskInfos}async function q(e,t,a){return(await C(e,a))[t]??null}async function _(e,t,a){const i=await q(e,t,a);return i?.executionType?R.fromJSON(i.executionType):"sync"}async function z(t,a){a=a||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const i=t.template||new E;null==i.showLabels&&(i.showLabels=!0);const r=i.exportOptions;let n;const o=b(i.layout);if(r){if(n={dpi:r.dpi},"map_only"===o?.toLowerCase()||""===o){const{width:e,height:t}=r;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=i.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:e||t?{metricUnit:N.toJSON(e)??void 0,metricLabel:e?k[e]:void 0,nonMetricUnit:N.toJSON(t)??void 0,nonMetricLabel:t?k[t]:void 0}:void 0}}const u=await $(t,i,a);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,a=a=>{const i=a.text,r=a.font,n=r?.family?.toLowerCase();i&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(i)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(i)&&(r.family="Arial Unicode MS"))};for(const i of u.operationalLayers)if(i.featureCollection?.layers)for(const e of i.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&a(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&a(t.symbol)}}let c=null;s?.legendLayers&&(c=s.legendLayers.filter(e=>!a.screenshotLayers.includes(e.layerId)).map(e=>{const t=e.layerId;a.legendLayerNameMap[t]=e.title;const i={id:t};if(e.subLayerIds){i.subLayerIds=e.subLayerIds;const t=e.dynamicLegend;null!=t&&(i.subLayerDynamicLegends=e.subLayerIds.map(()=>t))}return null!=e.dynamicLegend&&(i.dynamicLegend=e.dynamicLegend),i})),t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:a.legendLayers.slice()}}),a.legendLayers.length=0,a.screenshotLayers.length=0,j.set(a.gpServerUrl,a);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g.toJSON(i.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:P(i.report),Report_Item_ID:void 0};if(i.layoutItem){delete y.Layout_Template;const t=i.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(i.reportItem){delete y.Report_Template;const t=i.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function $(e,t,a){const i=e.view;let r=i.spatialReference;const n={operationalLayers:await W(i,t,a)};t.includeTables&&(n.tables=await ue(i));let o=e.extent||a.ssExtent||i.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},a.ssExtent=null,i.background&&(n.background=i.background.toJSON()),i.rotation&&(n.mapOptions.rotation=-i.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||i.scale),null!=i.timeExtent){const e=null!=i.timeExtent.start?i.timeExtent.start.getTime():null,t=null!=i.timeExtent.end?i.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function G(e){let t=e;const a=t.lastIndexOf("/GPServer/");return a>0&&(t=t.slice(0,a+9)),t}async function W(e,t,a){const i=[];let r=0;t.scalePreserved&&(r=t.outScale||e.scale);const n={layerView:null,outScale:r,printTemplate:t,view:e},o=h(e,r);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;n.layerView=s,t=w(s)?await oe(e,n,a):S(e)?B(e):"csv"===e?.type?await H(e,n,a):"catalog-footprint"===e?.type?await K(e,n,a):"feature"===e?.type?await X(e,n,a):"geojson"===e?.type?await Y(e,n,a):"graphics"===e?.type?await Z(e,n,a):"imagery"===e?.type?ee(e,a):"imagery-tile"===e?.type?await te(e,n,a):"kml"===e?.type?await ae(e,n,a):"map-image"===e?.type?ie(e,n,a):"map-notes"===e?.type?await re(n,a):"open-street-map"===e?.type?ne():"stream"===e?.type?await se(e,n,a):"subtype-group"===e?.type?await le(e,a):"tile"===e?.type?ce(e,a):"vector-tile"===e?.type?await ye(e,n,a):"web-tile"===e?.type?fe(e):"wfs"===e?.type?await pe(e,n,a):"wms"===e?.type?de(e,a):"wmts"===e?.type?me(e):await oe(e,n,a),t&&(Array.isArray(t)?i.push(...t):(t.id=e.id,t.title=a.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),i.push(t)))}if(r)for(const s of i)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await Q(null,e.graphics,t,a);r&&i.push(r)}return i}function B(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function K(e,{layerView:t,printTemplate:a},i){if(parseFloat(i.cimVersion)<3.1){return Q(e,await Ie(t),a,i)}const r=e.parent,n={id:(o=xe(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return ge(n,r),n}async function H(e,t,a){e.legendEnabled&&a.legendLayers.push({id:e.id});const i=t.layerView,r=t.printTemplate;if(!(i.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=xe(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return Q(e,await Ie(i),r,a)}async function Q(e,t,a,i){let r;const n=T(),o=O(),s=D(),c=V(),y=D();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=c.layerDefinition.name=i.legendLayerNameMap[e.id]||e.arcgisProps?.title||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),a=n.layerDefinition.drawingInfo;a&&(a.renderer=t);const i=o.layerDefinition.drawingInfo;i&&(i.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=c.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(a.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=xe(e,"web-map"),a=t.layerDefinition?.drawingInfo?.labelingInfo;if(a){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=a);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=a);const i=s.layerDefinition.drawingInfo;i&&(i.labelingInfo=a);const l=c.layerDefinition.drawingInfo;l&&(l.labelingInfo=a)}}}let f;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete c.layerDefinition.drawingInfo);const p=e?.fieldsIndex,d=e?.renderer;if(p){const t=new Set;r&&await u(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,p),f=Array.from(t);const a=p.fields.map(e=>e.toJSON());n.layerDefinition.fields=a,o.layerDefinition.fields=a,s.layerDefinition.fields=a,c.layerDefinition.fields=a}const m=t?.length;let g;for(let u=0;u<m;u++){const e=t[u]||t.at(u);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,De(g.symbol)?g.symbol=await be(g.symbol,i):g.symbol.text&&delete g.attributes),(!a||!a.forceFeatureAttributes)&&f?.length){const e={};for(const t of f)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?c.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const b=[n,o,c,s,y].filter(e=>e.featureSet.features.length>0);for(const l of b){const e=l.featureSet.features.every(e=>e.symbol);if(e&&(!a||!a.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&(await Se(l.layerDefinition.drawingInfo.renderer,i),await he(l.layerDefinition.drawingInfo.renderer,i))}return b.length?{featureCollection:{layers:b},showLabels:r}:null}async function X(e,t,a){let i;const r=e.renderer,n=parseFloat(a.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(n<2.9||"pie-chart"===e.featureReduction.renderer?.type)||"pie-chart"===r?.type&&n<3.1||"dot-density"===r?.type&&n<2.6||"polygon"===e.geometryType&&r?.authoringInfo?.visualVariables?.some(e=>"spike"===e.theme))return oe(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,u="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||u||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await Ie(o);i=await Q(e,t,s,a)}else{if(i={id:(f=xe(e)).id,title:f.title,url:f.url,layerType:f.layerType,customParameters:f.customParameters,layerDefinition:f.layerDefinition,charts:s.includeCharts?f.charts:void 0},s.attributionVisible&&(i.credits=x(e)),i.showLabels=s.showLabels&&e.labelsVisible&&!!e.labelingInfo&&e.labelingInfo.length>0,ge(i,e),delete i.layerDefinition?.featureReduction?.disablePopup,delete i.layerDefinition?.featureReduction?.popupInfo,o.displayFilterEnabled||delete i.layerDefinition?.displayFilterInfo,i.layerDefinition?.drawingInfo?.renderer&&(delete i.layerDefinition.minScale,delete i.layerDefinition.maxScale,await Se(i.layerDefinition.drawingInfo.renderer,a),await he(i.layerDefinition.drawingInfo.renderer,a),"visualVariables"in r&&r.visualVariables?.[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);i.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,i.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=c(o);if(t&&(i.layerDefinition??={},i.layerDefinition.definitionExpression=i.layerDefinition.definitionExpression?`(${i.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(i.layerDefinition??={},i.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight&&"highlightIds"in o){const t=o;i.selectionObjectIds=t.highlightIds;const a=t.highlightOptions??l.defaultHighlight??new F;i.selectionSymbol=v(e.geometryType,a)}}var f;return i}async function Y(e,t,a){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return oe(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});return Q(e,await Ie(t.layerView),t.printTemplate,a)}async function Z(e,{printTemplate:t},a){return Q(e,null,t,a)}function ee(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=xe(e)).layerType,customParameters:i.customParameters};var i;return a.bandIds=e.bandIds,a.compressionQuality=e.compressionQuality,a.format=e.format,a.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(a.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(a.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(a.layerDefinition??={},a.layerDefinition.drawingInfo??={},a.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),ge(a,e),a}async function te(e,t,a){if("flow"===e.renderer?.type||!e.supportsWrite())return oe(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const i={bandIds:(r=xe(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return i.layerType="ArcGISImageServiceLayer",ge(i,e),i}async function ae(e,t,a){const i=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=xe(e,"web-map");return t.type="kml",delete t.layerType,t.url=s(e.url),t}const r=[],n=t.layerView,o="data:image/png;base64,";n.allVisibleMapImages.forEach((t,a)=>{const i={id:`${e.id}_image${a}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};t.href.startsWith(o)?i.imageData=t.href.slice(o.length):i.url=t.href,r.push(i)});const l=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],u={id:e.id,...await Q(null,l,i,a)};return r.push(u),r}function ie(e,{outScale:t,printTemplate:a,view:i},r){let n;const o={id:e.id,subLayerIds:[]};let s=[];const l=t||i.scale,u=e=>{const t=0===l,a=0===e.minScale||l<=e.minScale,i=0===e.maxScale||l>=e.maxScale;if(e.visible&&(t||a&&i))if(e.sublayers)e.sublayers.forEach(u);else{const t=e.toExportImageJSON(),a={id:e.id,name:e.title,layerDefinition:{definitionExpression:t.definitionExpression,drawingInfo:t.drawingInfo,orderBy:t.orderBy,source:t.source}};s.unshift(a),o.subLayerIds.push(e.id)}};var c;return e.sublayers?.forEach(u),s.length&&(s=s.map(({id:e,name:t,layerDefinition:a})=>({id:e,name:t,layerDefinition:a})),n={layerType:(c=xe(e)).layerType,customParameters:c.customParameters},n.layers=s,n.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:o.subLayerIds,a.attributionVisible&&(n.credits=x(e)),e.gdbVersion&&(n.gdbVersion=e.gdbVersion),ge(n,e),e.legendEnabled&&r.legendLayers.push(o)),n}async function re({layerView:e,printTemplate:t},a){const i=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await Q(n,n.source,t,a);e&&i.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await Q(null,n.graphics,t,a);e&&i.push(...e.featureCollection.layers)}return{featureCollection:{layers:i}}}function ne(){return{type:"OpenStreetMap"}}async function oe(e,{printTemplate:t,view:a},r){const n={type:"image"};r.screenshotLayers.push(e.id);const s={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==a.rotation&&(s.rotation=0);const l=r.ssExtent||a.state.extent.clone();let u=96,c=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(u=e.dpi),null!=e.width&&e.width>0&&(c=e.width%2==a.width%2),null!=e.height&&e.height>0&&(y=e.height%2==a.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===a.scale)&&96===u&&(!c||!y)&&a.state.extent.equals(a.extent)&&(s.area={x:0,y:0,width:a.width,height:a.height},c||(s.area.width-=1),y||(s.area.height-=1),!r.ssExtent)){const e=a.toMap(i(s.area.width,s.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const f=await a.takeScreenshot(s);return n.imageData=o(f.dataUrl)?.data,n}async function se(e,{layerView:t,printTemplate:a},i){e.legendEnabled&&i.legendLayers.push({id:e.id});return Q(e,await Ie(t),a,i)}async function le(e,t){if(e.legendEnabled)for(const r of e.sublayers)r.legendEnabled&&t.legendLayers.push({id:r.id});const a={customParameters:(i=xe(e)).customParameters,effect:i.effect,layerDefinition:i.layerDefinition,layerType:i.layerType,layers:i.layers,url:i.url};var i;if(ge(a,e),Array.isArray(a.layers)){for(const e of a.layers)delete e.popupInfo;a.token&&a.layers.length>0&&(a.layers[a.layers.length-1].token=a.token,delete a.token)}return a}async function ue(e){const t=[],a=[];for(const i of e.map.allTables)"feature"!==i.type||i.loaded||a.push(i.load());a.length&&await Promise.allSettled(a);for(const i of e.map.allTables)if("feature"===i.type&&i.loaded&&i.isTable&&"feature-layer"===i.source?.type){const e=(e=>({id:e.id,title:e.title,customParameters:e.customParameters,layerDefinition:{definitionExpression:e.layerDefinition?.definitionExpression},url:e.url}))(xe(i));ge(e,i),t.push(e)}return t.length?t:void 0}function ce(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=xe(e)).layerType,customParameters:i.customParameters};var i;return ge(a,e),a}async function ye(e,t,a){const i=t.layerView;if(e.serviceUrl&&e.styleUrl&&!i.spriteSourceChanged&&!i.styleChanged){const t=p(e.styleUrl,e.apiKey),i=p(e.serviceUrl,e.apiKey);if(!t&&!i||"2.1.0"!==a.cimVersion){const a={type:"VectorTileLayer"};return a.styleUrl=s(e.styleUrl),a.token=t,i!==t&&(a.additionalTokens=[{url:e.serviceUrl,token:i}]),a}}return oe(e,t,a)}function fe(e){const t=e.urlTemplate?.replaceAll("${","{"),a={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(a.subDomains=e.subDomains),a}async function pe(e,t,a){return parseFloat(a.cimVersion)<3.5?oe(e,t,a):(e.legendEnabled&&a.legendLayers.push({id:e.id}),{layerType:(i=xe(e,"web-map")).layerType,layerDefinition:i.layerDefinition,url:i.url,wfsInfo:i.wfsInfo});var i}function de(e,t){let a;const i=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&i.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),i.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:i}),a={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:i,url:s(e.url),version:e.version}),a}function me(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:s(e.url)}}function ge(e,t){t.url&&(e.url=s(e.url||t.url),e.token=p(e.url,t.apiKey))}async function be(e,a){a.canvas||(a.canvas=document.createElement("canvas"));const i=1024;a.canvas.width=i,a.canvas.height=i;const o=a.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const a=L(o);if(!a)return null;o.clearRect(0,0,i,i);const n=r(e.size)/Math.max(a.width,a.height);o.scale(n,n);const u=i/n,c=u/2-a.width/2-a.x,y=u/2-a.height/2-a.y;if(o.translate(c,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const i=e.outline;o.lineWidth=r(i.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${i.color[0]},${i.color[1]},${i.color[2]},${i.color[3]/255})`,o.stroke(t),a.width+=o.lineWidth,a.height+=o.lineWidth}a.width*=n,a.height*=n;const f=o.getImageData(i/2-a.width/2,i/2-a.height/2,Math.ceil(a.width),Math.ceil(a.height));s=f.width,l=f.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(f,0,0)}else{const a="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,i=(await t(a,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(i,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").slice(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function he(e,t){const a=e.type;if("simple"===a&&De(e.symbol))e.symbol=await be(e.symbol,t)??{type:"esriSMS",color:[0,0,0,0],size:0,style:"esriSMSSquare"};else if("uniqueValue"===a){if(De(e.defaultSymbol)&&(e.defaultSymbol=await be(e.defaultSymbol,t)),"uniqueValueInfos"in e&&e.uniqueValueInfos)for(const a of e.uniqueValueInfos)De(a.symbol)&&(a.symbol=await be(a.symbol,t));if("uniqueValueGroups"in e&&e.uniqueValueGroups)for(const a of e.uniqueValueGroups)for(const e of a.classes)De(e.symbol)&&(e.symbol=await be(e.symbol,t))}else if("classBreaks"===a){De(e.defaultSymbol)&&(e.defaultSymbol=await be(e.defaultSymbol,t));for(const a of e.classBreakInfos)De(a.symbol)&&(a.symbol=await be(a.symbol,t))}}async function we(e,t){if("styleSymbolReference"!==e?.type)return e;try{const a=await M.fromJSON(e).fetchSymbol({cache:t.webStyleCache});return a?.toJSON()??e}catch{return e}}async function Se(e,t){if("simple"===e.type&&e.symbol)e.symbol=await we(e.symbol,t);else if("uniqueValue"===e.type){if(e.defaultSymbol=await we(e.defaultSymbol,t),"uniqueValueInfos"in e&&e.uniqueValueInfos)for(const a of e.uniqueValueInfos)a.symbol=await we(a.symbol,t);if("uniqueValueGroups"in e&&e.uniqueValueGroups)for(const a of e.uniqueValueGroups)for(const e of a.classes)e.symbol=await we(e.symbol,t)}else if("classBreaks"===e.type){e.defaultSymbol=await we(e.defaultSymbol,t);for(const a of e.classBreakInfos)a.symbol=await we(a.symbol,t)}}async function Ie(e){return e.queryFeatures(e.createQuery()).then(e=>e.features)}function xe(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function ve(e){return e.gpMetadata?.executionType?R.fromJSON(e.gpMetadata.executionType):"sync"}function De(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{J as execute,z as getGpPrintParams,G as getGpServerUrl,A as getMode,_ as getTaskExecutionMode,q as getTaskInfo,C as getTaskInfos,j as printCacheMap};
|
|
2
|
+
import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as a}from"../core/jsonMap.js";import{createScreenPoint as i,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{dataComponents as o,normalize as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as u}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as c}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as f,findToken as p}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{formatJsonMap as g}from"./support/fileFormat.js";import{toJSON as b}from"./support/layoutTemplate.js";import{getVisibleLayerViews as h,isScreenshotRequired as w,isBingMapsLayer as S,isBlendLayer as I,getCopyright as x,getSelectionSymbol as v,createPointLayer as D,getContextBoundingBox as L,createPolygonLayer as T,createPolylineLayer as O,createMultipointLayer as V}from"./support/printTaskUtils.js";import E from"./support/PrintTemplate.js";import{toJSON as P}from"./support/reportTemplate.js";import M from"../symbols/WebStyleSymbol.js";import F from"../views/support/HighlightOptions.js";const k={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},N=new a({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),R=new a({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),j=new Map;async function J(e,t,a){const i=await U(e,a),r=await z(t,i);if("sync"===await A(e,a)){const{results:t}=await d(e,r,void 0,a);return t?.[0]?.value}const n=await m(e,r,void 0,a);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,a);return o}async function U(e,a){const i=G(e),r=j.get(i)??{gpServerUrl:i,legendLayerNameMap:{},legendLayers:[],screenshotLayers:[]};return r.gpMetadata??=(await t(i,f({f:"json"},a))).data,r.cimVersion=r.gpMetadata.cimVersion,r.webStyleCache??=new Map,j.set(i,r),r}async function A(e,t){return ve(await U(e,t))}async function C(e,a){const i=await U(e,a),r=i.gpMetadata.tasks,n=i.gpServerUrl;if(i.taskInfos)return i.taskInfos;const o=(await t(e,f({f:"json"},a))).data;i.taskInfos={ExportWebMap:o};const s=r?.filter(e=>e!==o.name)??[];return await Promise.all(s.map(async e=>{const r=(await t(`${n}/${e}`,f({f:"json"},a))).data,o=r.name.startsWith("GetLayoutTemplatesInfo")?"GetLayoutTemplatesInfo":null;o&&(i.taskInfos[o]??=r)})),i.taskInfos}async function q(e,t,a){return(await C(e,a))[t]??null}async function _(e,t,a){const i=await q(e,t,a);return i?.executionType?R.fromJSON(i.executionType):"sync"}async function z(t,a){a=a||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const i=t.template||new E;null==i.showLabels&&(i.showLabels=!0);const r=i.exportOptions;let n;const o=b(i.layout);if(r){if(n={dpi:r.dpi},"map_only"===o?.toLowerCase()||""===o){const{width:e,height:t}=r;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=i.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:e||t?{metricUnit:N.toJSON(e)??void 0,metricLabel:e?k[e]:void 0,nonMetricUnit:N.toJSON(t)??void 0,nonMetricLabel:t?k[t]:void 0}:void 0}}const u=await $(t,i,a);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,a=a=>{const i=a.text,r=a.font,n=r?.family?.toLowerCase();i&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(i)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(i)&&(r.family="Arial Unicode MS"))};for(const i of u.operationalLayers)if(i.featureCollection?.layers)for(const e of i.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&a(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&a(t.symbol)}}let c=null;s?.legendLayers&&(c=s.legendLayers.filter(e=>!a.screenshotLayers.includes(e.layerId)).map(e=>{const t=e.layerId;a.legendLayerNameMap[t]=e.title;const i={id:t};if(e.subLayerIds){i.subLayerIds=e.subLayerIds;const t=e.dynamicLegend;null!=t&&(i.subLayerDynamicLegends=e.subLayerIds.map(()=>t))}return null!=e.dynamicLegend&&(i.dynamicLegend=e.dynamicLegend),i})),t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:a.legendLayers.slice()}}),a.legendLayers.length=0,a.screenshotLayers.length=0,j.set(a.gpServerUrl,a);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g.toJSON(i.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:P(i.report),Report_Item_ID:void 0};if(i.layoutItem){delete y.Layout_Template;const t=i.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(i.reportItem){delete y.Report_Template;const t=i.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function $(e,t,a){const i=e.view;let r=i.spatialReference;const n={operationalLayers:await W(i,t,a)};t.includeTables&&(n.tables=await ue(i));let o=e.extent||a.ssExtent||i.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},a.ssExtent=null,i.background&&(n.background=i.background.toJSON()),i.rotation&&(n.mapOptions.rotation=-i.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||i.scale),null!=i.timeExtent){const e=null!=i.timeExtent.start?i.timeExtent.start.getTime():null,t=null!=i.timeExtent.end?i.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function G(e){let t=e;const a=t.lastIndexOf("/GPServer/");return a>0&&(t=t.slice(0,a+9)),t}async function W(e,t,a){const i=[];let r=0;t.scalePreserved&&(r=t.outScale||e.scale);const n={layerView:null,outScale:r,printTemplate:t,view:e},o=h(e,r);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;n.layerView=s,t=w(s)?await oe(e,n,a):S(e)?B(e):"csv"===e?.type?await H(e,n,a):"catalog-footprint"===e?.type?await K(e,n,a):"feature"===e?.type?await X(e,n,a):"geojson"===e?.type?await Y(e,n,a):"graphics"===e?.type?await Z(e,n,a):"imagery"===e?.type?ee(e,a):"imagery-tile"===e?.type?await te(e,n,a):"kml"===e?.type?await ae(e,n,a):"map-image"===e?.type?ie(e,n,a):"map-notes"===e?.type?await re(n,a):"open-street-map"===e?.type?ne():"stream"===e?.type?await se(e,n,a):"subtype-group"===e?.type?await le(e,a):"tile"===e?.type?ce(e,a):"vector-tile"===e?.type?await ye(e,n,a):"web-tile"===e?.type?fe(e):"wfs"===e?.type?await pe(e,n,a):"wms"===e?.type?de(e,a):"wmts"===e?.type?me(e):await oe(e,n,a),t&&(Array.isArray(t)?i.push(...t):(t.id=e.id,t.title=a.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),i.push(t)))}if(r)for(const s of i)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await Q(null,e.graphics,t,a);r&&i.push(r)}return i}function B(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function K(e,{layerView:t,printTemplate:a},i){if(parseFloat(i.cimVersion)<3.1){return Q(e,await Ie(t),a,i)}const r=e.parent,n={id:(o=xe(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return ge(n,r),n}async function H(e,t,a){e.legendEnabled&&a.legendLayers.push({id:e.id});const i=t.layerView,r=t.printTemplate;if(!(i.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=xe(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return Q(e,await Ie(i),r,a)}async function Q(e,t,a,i){let r;const n=T(),o=O(),s=D(),c=V(),y=D();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=c.layerDefinition.name=i.legendLayerNameMap[e.id]||e.arcgisProps?.title||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),a=n.layerDefinition.drawingInfo;a&&(a.renderer=t);const i=o.layerDefinition.drawingInfo;i&&(i.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=c.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(a.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=xe(e),a=t.layerDefinition?.drawingInfo?.labelingInfo;if(a){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=a);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=a);const i=s.layerDefinition.drawingInfo;i&&(i.labelingInfo=a);const l=c.layerDefinition.drawingInfo;l&&(l.labelingInfo=a)}}}let f;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete c.layerDefinition.drawingInfo);const p=e?.fieldsIndex,d=e?.renderer;if(p){const t=new Set;r&&await u(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,p),f=Array.from(t);const a=p.fields.map(e=>e.toJSON());n.layerDefinition.fields=a,o.layerDefinition.fields=a,s.layerDefinition.fields=a,c.layerDefinition.fields=a}const m=t?.length;let g;for(let u=0;u<m;u++){const e=t[u]||t.at(u);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,De(g.symbol)?g.symbol=await be(g.symbol,i):g.symbol.text&&delete g.attributes),(!a||!a.forceFeatureAttributes)&&f?.length){const e={};for(const t of f)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?c.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const b=[n,o,c,s,y].filter(e=>e.featureSet.features.length>0);for(const l of b){const e=l.featureSet.features.every(e=>e.symbol);if(e&&(!a||!a.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&(await Se(l.layerDefinition.drawingInfo.renderer,i),await he(l.layerDefinition.drawingInfo.renderer,i))}return b.length?{featureCollection:{layers:b},showLabels:r}:null}async function X(e,t,a){let i;const r=e.renderer,n=parseFloat(a.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(n<2.9||"pie-chart"===e.featureReduction.renderer?.type)||"pie-chart"===r?.type&&n<3.1||"dot-density"===r?.type&&n<2.6||"polygon"===e.geometryType&&r?.authoringInfo?.visualVariables?.some(e=>"spike"===e.theme))return oe(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,u="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||u||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await Ie(o);i=await Q(e,t,s,a)}else{if(i={id:(f=xe(e)).id,title:f.title,url:f.url,layerType:f.layerType,customParameters:f.customParameters,layerDefinition:f.layerDefinition,charts:s.includeCharts?f.charts:void 0},s.attributionVisible&&(i.credits=x(e)),i.showLabels=s.showLabels&&e.labelsVisible&&!!e.labelingInfo&&e.labelingInfo.length>0,ge(i,e),delete i.layerDefinition?.featureReduction?.disablePopup,delete i.layerDefinition?.featureReduction?.popupInfo,o.displayFilterEnabled||delete i.layerDefinition?.displayFilterInfo,i.layerDefinition?.drawingInfo?.renderer&&(delete i.layerDefinition.minScale,delete i.layerDefinition.maxScale,await Se(i.layerDefinition.drawingInfo.renderer,a),await he(i.layerDefinition.drawingInfo.renderer,a),"visualVariables"in r&&r.visualVariables?.[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);i.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,i.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=c(o);if(t&&(i.layerDefinition??={},i.layerDefinition.definitionExpression=i.layerDefinition.definitionExpression?`(${i.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(i.layerDefinition??={},i.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight&&"highlightIds"in o){const t=o;i.selectionObjectIds=t.highlightIds;const a=t.highlightOptions??l.defaultHighlight??new F;i.selectionSymbol=v(e.geometryType,a)}}var f;return i}async function Y(e,t,a){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return oe(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});return Q(e,await Ie(t.layerView),t.printTemplate,a)}async function Z(e,{printTemplate:t},a){return Q(e,null,t,a)}function ee(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=xe(e)).layerType,customParameters:i.customParameters};var i;return a.bandIds=e.bandIds,a.compressionQuality=e.compressionQuality,a.format=e.format,a.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(a.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(a.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(a.layerDefinition??={},a.layerDefinition.drawingInfo??={},a.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),ge(a,e),a}async function te(e,t,a){if("flow"===e.renderer?.type||!e.supportsWrite())return oe(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const i={bandIds:(r=xe(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return i.layerType="ArcGISImageServiceLayer",ge(i,e),i}async function ae(e,t,a){const i=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=xe(e,"web-map");return t.type="kml",delete t.layerType,t.url=s(e.url),t}const r=[],n=t.layerView,o="data:image/png;base64,";n.allVisibleMapImages.forEach((t,a)=>{const i={id:`${e.id}_image${a}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};t.href.startsWith(o)?i.imageData=t.href.slice(o.length):i.url=t.href,r.push(i)});const l=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],u={id:e.id,...await Q(null,l,i,a)};return r.push(u),r}function ie(e,{outScale:t,printTemplate:a,view:i},r){let n;const o={id:e.id,subLayerIds:[]};let s=[];const l=t||i.scale,u=e=>{const t=0===l,a=0===e.minScale||l<=e.minScale,i=0===e.maxScale||l>=e.maxScale;if(e.visible&&(t||a&&i))if(e.sublayers)e.sublayers.forEach(u);else{const t=e.toExportImageJSON(),a={id:e.id,name:e.title,layerDefinition:{definitionExpression:t.definitionExpression,drawingInfo:t.drawingInfo,orderBy:t.orderBy,source:t.source}};s.unshift(a),o.subLayerIds.push(e.id)}};var c;return e.sublayers?.forEach(u),s.length&&(s=s.map(({id:e,name:t,layerDefinition:a})=>({id:e,name:t,layerDefinition:a})),n={layerType:(c=xe(e)).layerType,customParameters:c.customParameters},n.layers=s,n.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:o.subLayerIds,a.attributionVisible&&(n.credits=x(e)),e.gdbVersion&&(n.gdbVersion=e.gdbVersion),ge(n,e),e.legendEnabled&&r.legendLayers.push(o)),n}async function re({layerView:e,printTemplate:t},a){const i=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await Q(n,n.source,t,a);e&&i.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await Q(null,n.graphics,t,a);e&&i.push(...e.featureCollection.layers)}return{featureCollection:{layers:i}}}function ne(){return{type:"OpenStreetMap"}}async function oe(e,{printTemplate:t,view:a},r){const n={type:"image"};r.screenshotLayers.push(e.id);const s={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==a.rotation&&(s.rotation=0);const l=r.ssExtent||a.state.extent.clone();let u=96,c=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(u=e.dpi),null!=e.width&&e.width>0&&(c=e.width%2==a.width%2),null!=e.height&&e.height>0&&(y=e.height%2==a.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===a.scale)&&96===u&&(!c||!y)&&a.state.extent.equals(a.extent)&&(s.area={x:0,y:0,width:a.width,height:a.height},c||(s.area.width-=1),y||(s.area.height-=1),!r.ssExtent)){const e=a.toMap(i(s.area.width,s.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const f=await a.takeScreenshot(s);return n.imageData=o(f.dataUrl)?.data,n}async function se(e,{layerView:t,printTemplate:a},i){e.legendEnabled&&i.legendLayers.push({id:e.id});return Q(e,await Ie(t),a,i)}async function le(e,t){if(e.legendEnabled)for(const r of e.sublayers)r.legendEnabled&&t.legendLayers.push({id:r.id});const a={customParameters:(i=xe(e)).customParameters,effect:i.effect,layerDefinition:i.layerDefinition,layerType:i.layerType,layers:i.layers,url:i.url};var i;if(ge(a,e),Array.isArray(a.layers)){for(const e of a.layers)delete e.popupInfo;a.token&&a.layers.length>0&&(a.layers[a.layers.length-1].token=a.token,delete a.token)}return a}async function ue(e){const t=[],a=[];for(const i of e.map.allTables)"feature"!==i.type||i.loaded||a.push(i.load());a.length&&await Promise.allSettled(a);for(const i of e.map.allTables)if("feature"===i.type&&i.loaded&&i.isTable&&"feature-layer"===i.source?.type){const e=(e=>({id:e.id,title:e.title,customParameters:e.customParameters,layerDefinition:{definitionExpression:e.layerDefinition?.definitionExpression},url:e.url}))(xe(i));ge(e,i),t.push(e)}return t.length?t:void 0}function ce(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=xe(e)).layerType,customParameters:i.customParameters};var i;return ge(a,e),a}async function ye(e,t,a){const i=t.layerView;if(e.serviceUrl&&e.styleUrl&&!i.spriteSourceChanged&&!i.styleChanged){const t=p(e.styleUrl,e.apiKey),i=p(e.serviceUrl,e.apiKey);if(!t&&!i||"2.1.0"!==a.cimVersion){const a={type:"VectorTileLayer"};return a.styleUrl=s(e.styleUrl),a.token=t,i!==t&&(a.additionalTokens=[{url:e.serviceUrl,token:i}]),a}}return oe(e,t,a)}function fe(e){const t=e.urlTemplate?.replaceAll("${","{"),a={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(a.subDomains=e.subDomains),a}async function pe(e,t,a){return parseFloat(a.cimVersion)<3.5?oe(e,t,a):(e.legendEnabled&&a.legendLayers.push({id:e.id}),{layerType:(i=xe(e,"web-map")).layerType,layerDefinition:i.layerDefinition,url:i.url,wfsInfo:i.wfsInfo});var i}function de(e,t){let a;const i=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&i.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),i.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:i}),a={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:i,url:s(e.url),version:e.version}),a}function me(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:s(e.url)}}function ge(e,t){t.url&&(e.url=s(e.url||t.url),e.token=p(e.url,t.apiKey))}async function be(e,a){a.canvas||(a.canvas=document.createElement("canvas"));const i=1024;a.canvas.width=i,a.canvas.height=i;const o=a.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const a=L(o);if(!a)return null;o.clearRect(0,0,i,i);const n=r(e.size)/Math.max(a.width,a.height);o.scale(n,n);const u=i/n,c=u/2-a.width/2-a.x,y=u/2-a.height/2-a.y;if(o.translate(c,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const i=e.outline;o.lineWidth=r(i.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${i.color[0]},${i.color[1]},${i.color[2]},${i.color[3]/255})`,o.stroke(t),a.width+=o.lineWidth,a.height+=o.lineWidth}a.width*=n,a.height*=n;const f=o.getImageData(i/2-a.width/2,i/2-a.height/2,Math.ceil(a.width),Math.ceil(a.height));s=f.width,l=f.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(f,0,0)}else{const a="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,i=(await t(a,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(i,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").slice(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function he(e,t){const a=e.type;if("simple"===a&&De(e.symbol))e.symbol=await be(e.symbol,t)??{type:"esriSMS",color:[0,0,0,0],size:0,style:"esriSMSSquare"};else if("uniqueValue"===a){if(De(e.defaultSymbol)&&(e.defaultSymbol=await be(e.defaultSymbol,t)),"uniqueValueInfos"in e&&e.uniqueValueInfos)for(const a of e.uniqueValueInfos)De(a.symbol)&&(a.symbol=await be(a.symbol,t));if("uniqueValueGroups"in e&&e.uniqueValueGroups)for(const a of e.uniqueValueGroups)for(const e of a.classes)De(e.symbol)&&(e.symbol=await be(e.symbol,t))}else if("classBreaks"===a){De(e.defaultSymbol)&&(e.defaultSymbol=await be(e.defaultSymbol,t));for(const a of e.classBreakInfos)De(a.symbol)&&(a.symbol=await be(a.symbol,t))}}async function we(e,t){if("styleSymbolReference"!==e?.type)return e;try{const a=await M.fromJSON(e).fetchSymbol({cache:t.webStyleCache});return a?.toJSON()??e}catch{return e}}async function Se(e,t){if("simple"===e.type&&e.symbol)e.symbol=await we(e.symbol,t);else if("uniqueValue"===e.type){if(e.defaultSymbol=await we(e.defaultSymbol,t),"uniqueValueInfos"in e&&e.uniqueValueInfos)for(const a of e.uniqueValueInfos)a.symbol=await we(a.symbol,t);if("uniqueValueGroups"in e&&e.uniqueValueGroups)for(const a of e.uniqueValueGroups)for(const e of a.classes)e.symbol=await we(e.symbol,t)}else if("classBreaks"===e.type){e.defaultSymbol=await we(e.defaultSymbol,t);for(const a of e.classBreakInfos)a.symbol=await we(a.symbol,t)}}async function Ie(e){return e.queryFeatures(e.createQuery()).then(e=>e.features)}function xe(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function ve(e){return e.gpMetadata?.executionType?R.fromJSON(e.gpMetadata.executionType):"sync"}function De(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{J as execute,z as getGpPrintParams,G as getGpServerUrl,A as getMode,_ as getTaskExecutionMode,q as getTaskInfo,C as getTaskInfos,j as printCacheMap};
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const e="20260417",c="4cc2c29e6eae8456a4def54fd1e921131b4252bc";export{e as buildDate,c as commitHash};
|
package/third-party-notices.txt
CHANGED
|
@@ -1841,8 +1841,14 @@ SOFTWARE.
|
|
|
1841
1841
|
-----------------------------------------------------------------
|
|
1842
1842
|
|
|
1843
1843
|
langchainjs/
|
|
1844
|
+
langgraphjs/
|
|
1845
|
+
langchain/openai
|
|
1846
|
+
langchain/core
|
|
1844
1847
|
|
|
1845
|
-
https://github.com/langchain-ai/langchainjs
|
|
1848
|
+
https://github.com/langchain-ai/langchainjs
|
|
1849
|
+
https://github.com/langchain-ai/langgraphjs
|
|
1850
|
+
https://github.com/langchain-ai/langchainjs/blob/main/libs/providers/langchain-openai
|
|
1851
|
+
https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-core
|
|
1846
1852
|
|
|
1847
1853
|
MIT License
|
|
1848
1854
|
|
|
@@ -1868,34 +1874,6 @@ SOFTWARE.
|
|
|
1868
1874
|
|
|
1869
1875
|
-----------------------------------------------------------------
|
|
1870
1876
|
|
|
1871
|
-
langgraphjs/
|
|
1872
|
-
|
|
1873
|
-
https://github.com/langchain-ai/langgraphjs
|
|
1874
|
-
|
|
1875
|
-
The MIT License
|
|
1876
|
-
|
|
1877
|
-
Copyright (c) 2024 LangChain
|
|
1878
|
-
|
|
1879
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1880
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1881
|
-
in the Software without restriction, including without limitation the rights
|
|
1882
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1883
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1884
|
-
furnished to do so, subject to the following conditions:
|
|
1885
|
-
|
|
1886
|
-
The above copyright notice and this permission notice shall be included in
|
|
1887
|
-
all copies or substantial portions of the Software.
|
|
1888
|
-
|
|
1889
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1890
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1891
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1892
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1893
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1894
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1895
|
-
THE SOFTWARE.
|
|
1896
|
-
|
|
1897
|
-
-----------------------------------------------------------------
|
|
1898
|
-
|
|
1899
1877
|
zod/
|
|
1900
1878
|
|
|
1901
1879
|
https://github.com/colinhacks/zod
|