@arcgis/core 4.34.0-next.17 → 4.34.0-next.19
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/EULA.pdf +0 -0
- package/applications/MapViewer/templateUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{fa894be8cfb6ed485df9.js → 025891f445869e33252b.js} +1 -1
- package/assets/esri/core/workers/chunks/{827919fe23e06e40a330.js → 1a82f903b442a3856bfa.js} +1 -1
- package/assets/esri/core/workers/chunks/{400a4c9fa62964f8fa1d.js → 1f48d6c76f0014064eca.js} +1 -1
- package/assets/esri/core/workers/chunks/22206d13a75d61d77023.js +1 -0
- package/assets/esri/core/workers/chunks/227d25fcbb5f590c4581.js +1 -0
- package/assets/esri/core/workers/chunks/{2ad538440cfb3ab94787.js → 2c0c97acb7714b1e0e01.js} +1 -1
- package/assets/esri/core/workers/chunks/3cf31e51266f40072f71.js +1 -0
- package/assets/esri/core/workers/chunks/3e07de009d5febd62b19.js +1 -0
- package/assets/esri/core/workers/chunks/4072ab8378c235a268ca.js +1 -0
- package/assets/esri/core/workers/chunks/52410198c4b2eccfeadd.js +1 -0
- package/assets/esri/core/workers/chunks/{04e558a970c6a77f243e.js → 5cbaf4ff688aafa6643e.js} +1 -1
- package/assets/esri/core/workers/chunks/5e53c7e29bb6d43d08be.js +1 -0
- package/assets/esri/core/workers/chunks/606782a94adcce6975af.js +1 -0
- package/assets/esri/core/workers/chunks/6f8de923519bb16af8ba.js +1 -0
- package/assets/esri/core/workers/chunks/{53e43798d08ad2075c1f.js → 758776e841fd370e3353.js} +1 -1
- package/assets/esri/core/workers/chunks/764e505f2bafdf5afaf9.js +1 -0
- package/assets/esri/core/workers/chunks/8637b9cb30170ac4eae2.js +1 -0
- package/assets/esri/core/workers/chunks/8656c145ff0ca2e51ea6.js +1 -0
- package/assets/esri/core/workers/chunks/8b4a35e3ed39d8be3394.js +1 -0
- package/assets/esri/core/workers/chunks/903c7a0a47c14442d3c1.js +1 -0
- package/assets/esri/core/workers/chunks/933d4a3b0cee82cc80fe.js +1 -0
- package/assets/esri/core/workers/chunks/{d33a5d79f2163ad62b1d.js → 9965961bad09910f577b.js} +1 -1
- package/assets/esri/core/workers/chunks/9d499a37b960273c3f84.js +1 -0
- package/assets/esri/core/workers/chunks/a507192771e5f4f82973.js +1 -0
- package/assets/esri/core/workers/chunks/{66c8816e91e3f9e214d4.js → a92a344763fbc3cec71e.js} +1 -1
- package/assets/esri/core/workers/chunks/a9e1caf05c81055ae194.js +1 -0
- package/assets/esri/core/workers/chunks/{1415d4e2f5f3193be004.js → aa4ae0e54a0507e8dd0f.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d89e354eeadadca4f7f.js → b421986cb4e45c632f7c.js} +1 -1
- package/assets/esri/core/workers/chunks/c1822b03302c3db71b1f.js +1 -0
- package/assets/esri/core/workers/chunks/d3bfd0c382c2f39a787b.js +1 -0
- package/assets/esri/core/workers/chunks/d568070513f2b98fd9b5.js +1 -0
- package/assets/esri/core/workers/chunks/d6df12bed626d56cd6b2.js +1 -0
- package/assets/esri/core/workers/chunks/{5bfccd5dffda74740aa4.js → df811b31e0446de5d322.js} +1 -1
- package/assets/esri/core/workers/chunks/e0146db608959ead9c97.js +1 -0
- package/assets/esri/core/workers/chunks/ec339075bb4faeec1413.js +1 -0
- package/assets/esri/core/workers/chunks/f4442a2b40e44f90b461.js +1 -0
- package/assets/esri/core/workers/chunks/{fa5715ca3ce95d005b0a.js → faa892ad4cc8a90b6c79.js} +1 -1
- package/assets/esri/themes/base/widgets/_Legend.scss +3 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
- package/chunks/sphere.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/trackingUtils.js +1 -1
- package/core/sql.js +1 -1
- package/geometry/spatialReferenceEllipsoidUtils.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +101 -49
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/orientedImagery/transformations/updateElevation.js +1 -1
- package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/TitleCreator.js +1 -1
- package/layers/support/arcgisLayers.js +1 -1
- package/layers/support/fetchService.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/video/VideoCameraSensorModel.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/loadUtils.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/request.js +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/support/DateBinParameters.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/requestUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectRadial.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/symbols/support/previewCIMSymbol.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/layers/DimensionLayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.js +1 -1
- package/views/layers/ViewshedLayerView.js +1 -1
- package/views/support/drapedUtils.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/FeatureTable/support/templateUtils.js +1 -1
- package/widgets/Legend/styles/support/sizeRampUtils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/assets/esri/core/workers/chunks/1443520c9fb23381f8d5.js +0 -1
- package/assets/esri/core/workers/chunks/254c4f7e277ae9915dce.js +0 -1
- package/assets/esri/core/workers/chunks/273beed633cc37416ad7.js +0 -1
- package/assets/esri/core/workers/chunks/3f8cc157b65a9d570921.js +0 -1
- package/assets/esri/core/workers/chunks/49a57dc1e6d1048fa949.js +0 -1
- package/assets/esri/core/workers/chunks/500fb5f615f0c1db1b66.js +0 -1
- package/assets/esri/core/workers/chunks/513dc2467e9b8b8c6df4.js +0 -1
- package/assets/esri/core/workers/chunks/52239e958a82ebcd2e7a.js +0 -1
- package/assets/esri/core/workers/chunks/5ef1095842e21090f1f4.js +0 -1
- package/assets/esri/core/workers/chunks/7716a9fb380d66ba7292.js +0 -1
- package/assets/esri/core/workers/chunks/78a57f5aeb277b84b3da.js +0 -1
- package/assets/esri/core/workers/chunks/7c56740cac444419e5b4.js +0 -1
- package/assets/esri/core/workers/chunks/802c6b1a6cb9264b8e4f.js +0 -1
- package/assets/esri/core/workers/chunks/8855f1a6224ffbd0bb66.js +0 -1
- package/assets/esri/core/workers/chunks/885e8e90dfe5dbd5053d.js +0 -1
- package/assets/esri/core/workers/chunks/88b1214c284c2ec7d51b.js +0 -1
- package/assets/esri/core/workers/chunks/932808e485f305b6a26a.js +0 -1
- package/assets/esri/core/workers/chunks/beb01d400f1aa089d2dc.js +0 -1
- package/assets/esri/core/workers/chunks/cc1328cacc4ac07eb548.js +0 -1
- package/assets/esri/core/workers/chunks/cfc5e0ec9b0290407383.js +0 -1
- package/assets/esri/core/workers/chunks/d2139307f62ea8bf999a.js +0 -1
- package/assets/esri/core/workers/chunks/ddb66fe6fcd0764daa7a.js +0 -1
- package/assets/esri/core/workers/chunks/eac7af86166c09c6a9be.js +0 -1
- package/assets/esri/core/workers/chunks/ec49e2849766402ad5c7.js +0 -1
- package/assets/esri/core/workers/chunks/f3e179b48bca50c94538.js +0 -1
package/layers/FeatureLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../request.js";import i from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{debounce as d,throwIfAbortError as y,whenOrAbort as c}from"../core/promiseUtils.js";import{sqlAnd as m}from"../core/sql.js";import{urlToObject as h,join as f}from"../core/urlUtils.js";import{property as b}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as T}from"../core/accessorSupport/layerContainerType.js";import F from"../form/FormTemplate.js";import S from"../geometry/SpatialReference.js";import I from"./Layer.js";import{MemorySource as E}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as D}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as x}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as C}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as P}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as M}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as q}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as O}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as A}from"./mixins/OperationalLayer.js";import{OrderedLayer as V}from"./mixins/OrderedLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{PublishableLayer as U}from"./mixins/PublishableLayer.js";import{RefreshableLayer as Q}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as B}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as N}from"./mixins/TemporalLayer.js";import{TrackableLayer as $}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as G,parse as J,cleanTitle as W}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as Z,id as H,labelsVisible as k,opacityDrawingInfo as z,legendEnabled as K,listMode as X,popupEnabled as Y,screenSizePerspectiveEnabled as ee}from"./support/commonProperties.js";import{ensureLayerCredential as te,computeEffectiveEditingEnabled as re,readGlobalIdField as ie,readObjectIdField as oe,createDefaultRenderer as se,addAttachment as ae,updateAttachment as ne,applyEdits as le,uploadAssets as pe,createQuery as ue,deleteAttachments as de,fetchRecomputedExtents as ye,getFeatureType as ce,getFieldDomain as me,queryAttachments as he,queryObjectIds as fe,queryFeatureCount as be,queryExtent as ge,queryRelatedFeatures as we,queryRelatedFeaturesCount as ve,validateBinsQuery as je,hasDataChanged as Te,geometryTypeKebabDict as Fe}from"./support/featureLayerUtils.js";import Se from"./support/FeatureTemplate.js";import Ie from"./support/FeatureType.js";import{defineFieldProperties as Ee}from"./support/fieldProperties.js";import{fixRendererFields as Le,fixTimeInfoFields as De}from"./support/fieldUtils.js";import _e from"./support/LabelClass.js";import{reader as xe}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Ce}from"./support/serviceCapabilitiesUtils.js";import Pe from"./support/TimeInfo.js";import Me from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as qe}from"./support/versionUtils.js";import{DataLayerSource as Oe}from"./support/source/DataLayerSource.js";import{read as Ae}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Ve}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Re,rendererTypes as Ue}from"../renderers/support/typeUtils.js";import Qe from"../rest/support/FeatureSet.js";import Be from"../rest/support/Query.js";import{isNumber as Ne}from"../support/guards.js";import{createPopupTemplate as $e}from"../support/popupUtils.js";import{symbolTypes as Ge}from"../symbols/support/typeUtils.js";import{SaveOperationType as Je}from"../webdoc/interfaces.js";import{opacityToTransparency as We}from"../webdoc/support/opacityUtils.js";const Ze="FeatureLayer";function He(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ke(e){return e&&e instanceof o}const ze=Ee();function Ke(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Xe=class extends(q(O(M(U(P(C(_(V(N($(B(Q(D(A(R(p(x(L(i.ClonableMixin(I)))))))))))))))))))){constructor(...e){super(...e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="ArcGISFeatureLayer",this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=S.WGS84,this.subtypeCode=null,this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=d((async(e,t,r)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case Je.SAVE:return i(this,t);case Je.SAVE_AS:return o(this,r,t)}}))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then((e=>this.initLayerProperties(e)))),Promise.resolve(this);const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(y).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))})).then((()=>te(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new Me({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Ce(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}get effectiveEditingEnabled(){return re(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}readIsTable(e,t){return"Table"===(t=t?.layerDefinition??t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&u(r,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return ie(t.layerDefinition||t)}readObjectIdField(e,t){return oe(t.layerDefinition||t)}get parsedUrl(){const e=h(this.url);return null!=e&&(null!=this.dynamicDataSource?e.path=f(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=f(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Le(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Ae(i,t,r)??void 0;return e||n.getLogger(this).error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:r}),e}return se(t,r)}set source(e){const t=this._get("source");t!==e&&(ke(t)&&this._resetMemorySource(t),ke(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof o?new E({layer:this,items:e}):e:null}readSource(e,t){const r=Qe.fromJSON(t.featureSet);return new E({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map((e=>Se.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition?.name??t.name,i=t.title||t.layerDefinition?.title;if(r){const e=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return this.url?G(this.url,r):r;let t=r;if(!t&&this.url){const e=J(this.url);null!=e&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),W(t)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find((e=>e.name.toLowerCase()===r));e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e?.map((e=>(e=Ie.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}readVisible(e,t){return null!=t.layerDefinition?.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}async addAttachment(e,t){const r=await ae(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ne(this,e,t,r,Ze);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return le(this,e,t)}async uploadAssets(e,t){return pe(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return $e(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await c(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=ue(this);e.dynamicDataSource=this.dynamicDataSource;const t=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,r=m(this.definitionExpression,t);return e.where=r||"1=1",e}async deleteAttachments(e,t){const r=await de(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return ye(this,e,Ze)}getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){return this._titleCreator.getTitle(this,e,t)}getFeatureType(e){return ce(this.types,this.typeIdField,e)}getFieldDomain(e,t){return me(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return he(this,e,t,Ze)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Be.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r;return i}async queryObjectIds(e,t){return await fe(this,e,t,Ze)}async queryFeatureCount(e,t){return be(this,e,t,Ze)}async queryExtent(e,t){return ge(this,e,t,Ze)}async queryRelatedFeatures(e,t){return we(this,e,t,Ze)}async queryRelatedFeaturesCount(e,t){return ve(this,e,t,Ze)}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopFeatures capability");const o=await import("../rest/support/TopFeaturesQuery.js"),a=await r.queryTopFeatures(o.default.from(e),t);if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new s(Ze,"Layer source does not support queryAttributeBins capability");je(e,i,Ze);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t);if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryTopObjectIds(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopObjectIds capability");const o=await import("../rest/support/TopFeaturesQuery.js");return(await r.queryTopObjectIds(o.default.from(e),t)).filter(Ne)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopExtents capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopExtents(o.default.from(e),t)}async queryTopFeatureCount(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryFeatureCount capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopCount(o.default.from(e),t)}read(e,t){const r=e.featureCollection;if((r||"Feature Collection"===e.type)&&(this.resourceInfo=e),r){const{layers:e,showLegend:i}=r;1===e?.length&&(super.read(e[0],t),null!=i&&super.read({showLegend:i},t))}super.read(e,t),t&&"service"===t.origin&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i,messages:o}=t;if(this.dynamicDataSource)return o?.push(He(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if(("web-map"===r||"web-scene"===r)&&"tables"!==i)return o?.push(He(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push(He(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&("web-map"===r||"web-scene"===r)&&"tables"===i)return o?.push(He(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(Ze,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||qe(this,e))}async save(e){return this._debouncedSaveOperations(Je.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Je.SAVE_AS,t,e)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";u("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return r(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)}))}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Le(this.renderer,this.fieldsIndex),De(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Ve(this,{origin:"service"})}async hasDataChanged(){return Te(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach((e=>{const r=e.prototype?.attributes;r&&t&&delete r[t]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new s("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this.addHandles([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};e([b({clonable:!1,readOnly:!0})],Xe.prototype,"_titleCreator",null),e([b(Z)],Xe.prototype,"attributeTableTemplate",void 0),e([w("service","capabilities")],Xe.prototype,"readCapabilities",null),e([b({json:{origins:{"web-scene":{write:!1}},write:!0}})],Xe.prototype,"charts",void 0),e([b({readOnly:!0})],Xe.prototype,"createQueryVersion",null),e([b({json:{read:{source:"layerDefinition.copyrightText"}}})],Xe.prototype,"copyright",void 0),e([b({json:{read:{source:"layerDefinition.displayField"}}})],Xe.prototype,"displayField",void 0),e([b({types:Ge,readOnly:!0})],Xe.prototype,"defaultSymbol",void 0),e([b({type:Oe})],Xe.prototype,"dynamicDataSource",void 0),e([b({type:Boolean})],Xe.prototype,"editingEnabled",null),e([w(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabled",null),e([w("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabledFromWebMap",null),e([j(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabled",null),e([j("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabledToWebMap",null),e([b({readOnly:!0})],Xe.prototype,"effectiveEditingEnabled",null),e([b({clonable:!1,readOnly:!0})],Xe.prototype,"featureTitleFields",null),e([b({...ze.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Ke}}}}})],Xe.prototype,"fields",void 0),e([b(ze.fieldsIndex)],Xe.prototype,"fieldsIndex",void 0),e([b({type:F,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Xe.prototype,"formTemplate",void 0),e([b({json:{read:{source:"layerDefinition.extent"}}})],Xe.prototype,"fullExtent",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Ke,writer(e,t,r){const i=e?Fe.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Fe.read}}})],Xe.prototype,"geometryType",void 0),e([b({json:{read:{source:"layerDefinition.hasM"}}})],Xe.prototype,"hasM",void 0),e([b({json:{read:{source:"layerDefinition.hasZ"}}})],Xe.prototype,"hasZ",void 0),e([b(H)],Xe.prototype,"id",void 0),e([b({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Xe.prototype,"infoFor3D",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Xe.prototype,"isTable",void 0),e([w("service","isTable",["type","geometryType"]),w("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Xe.prototype,"readIsTable",null),e([j("web-map","isTable")],Xe.prototype,"writeIsTable",null),e([b(k)],Xe.prototype,"labelsVisible",void 0),e([b({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:xe,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:xe,write:{layerContainerTypes:T}}})],Xe.prototype,"labelingInfo",void 0),e([b((()=>{const e=a(z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,We(e),t)}}},e})())],Xe.prototype,"opacity",void 0),e([b(K)],Xe.prototype,"legendEnabled",void 0),e([b({type:["show","hide"],json:(()=>{const e=a(X.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Xe.prototype,"listMode",void 0),e([w("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Xe.prototype,"readGlobalIdField",null),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Ke}}}}})],Xe.prototype,"objectIdField",void 0),e([w("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Xe.prototype,"readObjectIdField",null),e([b({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:T}}})],Xe.prototype,"operationalLayerType",void 0),e([b(ze.outFields)],Xe.prototype,"outFields",void 0),e([b({readOnly:!0})],Xe.prototype,"parsedUrl",null),e([b({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Xe.prototype,"path",void 0),e([b(Y)],Xe.prototype,"popupEnabled",void 0),e([b({type:t,json:{name:"popupInfo",write:!0}})],Xe.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],Xe.prototype,"defaultPopupTemplate",null),e([b({types:Ue,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Re,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:T,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}})],Xe.prototype,"renderer",null),e([w("service","renderer",["drawingInfo.renderer","defaultSymbol"]),w("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Xe.prototype,"readRenderer",null),e([b()],Xe.prototype,"resourceInfo",void 0),e([b((()=>{const e=a(ee);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([b({clonable:!1})],Xe.prototype,"source",null),e([g("source")],Xe.prototype,"castSource",null),e([w("portal-item","source",["featureSet"]),w("web-map","source",["featureSet"])],Xe.prototype,"readSource",null),e([b({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Xe.prototype,"spatialReference",void 0),e([b({type:Number})],Xe.prototype,"subtypeCode",void 0),e([b({type:[Se]})],Xe.prototype,"templates",void 0),e([w("templates",["editFieldsInfo","creatorField","editorField","templates"])],Xe.prototype,"readTemplates",null),e([b({type:Pe})],Xe.prototype,"timeInfo",void 0),e([b()],Xe.prototype,"title",void 0),e([w("service","title",["name"]),w("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Xe.prototype,"readTitle",null),e([w("web-map","title",["layerDefinition.name","title"])],Xe.prototype,"readTitleFromWebMap",null),e([b({type:String})],Xe.prototype,"sublayerTitleMode",void 0),e([b({json:{read:!1}})],Xe.prototype,"type",void 0),e([b({type:String})],Xe.prototype,"typeIdField",void 0),e([w("service","typeIdField"),w("typeIdField",["layerDefinition.typeIdField"])],Xe.prototype,"readTypeIdField",null),e([b({type:[Ie]})],Xe.prototype,"types",void 0),e([w("service","types",["types"]),w("types",["layerDefinition.types"])],Xe.prototype,"readTypes",null),e([b({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:T}}}}})],Xe.prototype,"visible",void 0),e([w("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Xe.prototype,"readVisible",null),Xe=e([v("esri.layers.FeatureLayer")],Xe);export{Xe as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../request.js";import i from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{debounce as d,throwIfAbortError as y,whenOrAbort as c}from"../core/promiseUtils.js";import{sqlAnd as m}from"../core/sql.js";import{urlToObject as h,join as f}from"../core/urlUtils.js";import{property as b}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as T}from"../core/accessorSupport/layerContainerType.js";import F from"../form/FormTemplate.js";import S from"../geometry/SpatialReference.js";import I from"./Layer.js";import{MemorySource as E}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as D}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as x}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as C}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as P}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as q}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as M}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as O}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as A}from"./mixins/OperationalLayer.js";import{OrderedLayer as V}from"./mixins/OrderedLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{PublishableLayer as U}from"./mixins/PublishableLayer.js";import{RefreshableLayer as Q}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as B}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as N}from"./mixins/TemporalLayer.js";import{TrackableLayer as $}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as G,parse as J,cleanTitle as W}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as Z,id as H,labelsVisible as k,opacityDrawingInfo as z,legendEnabled as K,listMode as X,popupEnabled as Y,screenSizePerspectiveEnabled as ee}from"./support/commonProperties.js";import{ensureLayerCredential as te,computeEffectiveEditingEnabled as re,readGlobalIdField as ie,readObjectIdField as oe,createDefaultRenderer as se,addAttachment as ae,updateAttachment as ne,applyEdits as le,uploadAssets as pe,createQuery as ue,deleteAttachments as de,fetchRecomputedExtents as ye,getFeatureType as ce,getFieldDomain as me,queryAttachments as he,queryObjectIds as fe,queryFeatureCount as be,queryExtent as ge,queryRelatedFeatures as we,queryRelatedFeaturesCount as ve,validateBinsQuery as je,hasDataChanged as Te,geometryTypeKebabDict as Fe}from"./support/featureLayerUtils.js";import Se from"./support/FeatureTemplate.js";import Ie from"./support/FeatureType.js";import{defineFieldProperties as Ee}from"./support/fieldProperties.js";import{fixRendererFields as Le,fixTimeInfoFields as De}from"./support/fieldUtils.js";import _e from"./support/LabelClass.js";import{reader as xe}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Ce}from"./support/serviceCapabilitiesUtils.js";import Pe from"./support/TimeInfo.js";import qe from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as Me}from"./support/versionUtils.js";import{DataLayerSource as Oe}from"./support/source/DataLayerSource.js";import{read as Ae}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Ve}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Re,rendererTypes as Ue}from"../renderers/support/typeUtils.js";import Qe from"../rest/support/FeatureSet.js";import Be from"../rest/support/Query.js";import{isNumber as Ne}from"../support/guards.js";import{createPopupTemplate as $e}from"../support/popupUtils.js";import{symbolTypes as Ge}from"../symbols/support/typeUtils.js";import{SaveOperationType as Je}from"../webdoc/interfaces.js";import{opacityToTransparency as We}from"../webdoc/support/opacityUtils.js";const Ze="FeatureLayer";function He(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ke(e){return e&&e instanceof o}const ze=Ee();function Ke(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Xe=class extends(M(O(q(U(P(C(_(V(N($(B(Q(D(A(R(p(x(L(i.ClonableMixin(I)))))))))))))))))))){constructor(...e){super(...e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="ArcGISFeatureLayer",this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=S.WGS84,this.subtypeCode=null,this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=d((async(e,t,r)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case Je.SAVE:return i(this,t);case Je.SAVE_AS:return o(this,r,t)}}))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then((e=>this.initLayerProperties(e)))),Promise.resolve(this);const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(y).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))})).then((()=>te(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new qe({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Ce(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}get effectiveEditingEnabled(){return re(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}readIsTable(e,t){return"Table"===(t=t?.layerDefinition??t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&u(r,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return ie(t.layerDefinition||t)}readObjectIdField(e,t){return oe(t.layerDefinition||t)}get parsedUrl(){const e=h(this.url);return null!=e&&(null!=this.dynamicDataSource?e.path=f(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=f(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Le(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Ae(i,t,r)??void 0;return e||n.getLogger(this).error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:r}),e}return se(t,r)}set source(e){const t=this._get("source");t!==e&&(ke(t)&&this._resetMemorySource(t),ke(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof o?new E({layer:this,items:e}):e:null}readSource(e,t){const r=Qe.fromJSON(t.featureSet);return new E({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map((e=>Se.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition?.name??t.name,i=t.title||t.layerDefinition?.title;if(r){const e=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return this.url?G(this.url,r):r;let t=r;if(!t&&this.url){const e=J(this.url);null!=e&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),W(t)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find((e=>e.name.toLowerCase()===r));e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e?.map((e=>(e=Ie.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}readVisible(e,t){return null!=t.layerDefinition?.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}async addAttachment(e,t){const r=await ae(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ne(this,e,t,r,Ze);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return le(this,e,t)}async uploadAssets(e,t){return pe(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return $e(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await c(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=ue(this);e.dynamicDataSource=this.dynamicDataSource;const t=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,r=m(this.definitionExpression,t);return e.where=r||"1=1",e}async deleteAttachments(e,t){const r=await de(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return ye(this,e,Ze)}async getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}async getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getFeatureType(e){return ce(this.types,this.typeIdField,e)}getFieldDomain(e,t){return me(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return he(this,e,t,Ze)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Be.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r;return i}async queryObjectIds(e,t){return await fe(this,e,t,Ze)}async queryFeatureCount(e,t){return be(this,e,t,Ze)}async queryExtent(e,t){return ge(this,e,t,Ze)}async queryRelatedFeatures(e,t){return we(this,e,t,Ze)}async queryRelatedFeaturesCount(e,t){return ve(this,e,t,Ze)}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopFeatures capability");const o=await import("../rest/support/TopFeaturesQuery.js"),a=await r.queryTopFeatures(o.default.from(e),t);if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new s(Ze,"Layer source does not support queryAttributeBins capability");je(e,i,Ze);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t);if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryTopObjectIds(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopObjectIds capability");const o=await import("../rest/support/TopFeaturesQuery.js");return(await r.queryTopObjectIds(o.default.from(e),t)).filter(Ne)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopExtents capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopExtents(o.default.from(e),t)}async queryTopFeatureCount(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryFeatureCount capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopCount(o.default.from(e),t)}read(e,t){const r=e.featureCollection;if((r||"Feature Collection"===e.type)&&(this.resourceInfo=e),r){const{layers:e,showLegend:i}=r;1===e?.length&&(super.read(e[0],t),null!=i&&super.read({showLegend:i},t))}super.read(e,t),t&&"service"===t.origin&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i,messages:o}=t;if(this.dynamicDataSource)return o?.push(He(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if(("web-map"===r||"web-scene"===r)&&"tables"!==i)return o?.push(He(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push(He(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&("web-map"===r||"web-scene"===r)&&"tables"===i)return o?.push(He(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(Ze,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||Me(this,e))}async save(e){return this._debouncedSaveOperations(Je.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Je.SAVE_AS,t,e)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";u("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return r(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)}))}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Le(this.renderer,this.fieldsIndex),De(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Ve(this,{origin:"service"})}async hasDataChanged(){return Te(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach((e=>{const r=e.prototype?.attributes;r&&t&&delete r[t]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new s("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this.addHandles([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};e([b({clonable:!1,readOnly:!0})],Xe.prototype,"_titleCreator",null),e([b(Z)],Xe.prototype,"attributeTableTemplate",void 0),e([w("service","capabilities")],Xe.prototype,"readCapabilities",null),e([b({json:{origins:{"web-scene":{write:!1}},write:!0}})],Xe.prototype,"charts",void 0),e([b({readOnly:!0})],Xe.prototype,"createQueryVersion",null),e([b({json:{read:{source:"layerDefinition.copyrightText"}}})],Xe.prototype,"copyright",void 0),e([b({json:{read:{source:"layerDefinition.displayField"}}})],Xe.prototype,"displayField",void 0),e([b({types:Ge,readOnly:!0})],Xe.prototype,"defaultSymbol",void 0),e([b({type:Oe})],Xe.prototype,"dynamicDataSource",void 0),e([b({type:Boolean})],Xe.prototype,"editingEnabled",null),e([w(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabled",null),e([w("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabledFromWebMap",null),e([j(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabled",null),e([j("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabledToWebMap",null),e([b({readOnly:!0})],Xe.prototype,"effectiveEditingEnabled",null),e([b({clonable:!1,readOnly:!0})],Xe.prototype,"featureTitleFields",null),e([b({...ze.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Ke}}}}})],Xe.prototype,"fields",void 0),e([b(ze.fieldsIndex)],Xe.prototype,"fieldsIndex",void 0),e([b({type:F,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Xe.prototype,"formTemplate",void 0),e([b({json:{read:{source:"layerDefinition.extent"}}})],Xe.prototype,"fullExtent",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Ke,writer(e,t,r){const i=e?Fe.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Fe.read}}})],Xe.prototype,"geometryType",void 0),e([b({json:{read:{source:"layerDefinition.hasM"}}})],Xe.prototype,"hasM",void 0),e([b({json:{read:{source:"layerDefinition.hasZ"}}})],Xe.prototype,"hasZ",void 0),e([b(H)],Xe.prototype,"id",void 0),e([b({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Xe.prototype,"infoFor3D",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Xe.prototype,"isTable",void 0),e([w("service","isTable",["type","geometryType"]),w("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Xe.prototype,"readIsTable",null),e([j("web-map","isTable")],Xe.prototype,"writeIsTable",null),e([b(k)],Xe.prototype,"labelsVisible",void 0),e([b({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:xe,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:xe,write:{layerContainerTypes:T}}})],Xe.prototype,"labelingInfo",void 0),e([b((()=>{const e=a(z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,We(e),t)}}},e})())],Xe.prototype,"opacity",void 0),e([b(K)],Xe.prototype,"legendEnabled",void 0),e([b({type:["show","hide"],json:(()=>{const e=a(X.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Xe.prototype,"listMode",void 0),e([w("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Xe.prototype,"readGlobalIdField",null),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Ke}}}}})],Xe.prototype,"objectIdField",void 0),e([w("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Xe.prototype,"readObjectIdField",null),e([b({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:T}}})],Xe.prototype,"operationalLayerType",void 0),e([b(ze.outFields)],Xe.prototype,"outFields",void 0),e([b({readOnly:!0})],Xe.prototype,"parsedUrl",null),e([b({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Xe.prototype,"path",void 0),e([b(Y)],Xe.prototype,"popupEnabled",void 0),e([b({type:t,json:{name:"popupInfo",write:!0}})],Xe.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],Xe.prototype,"defaultPopupTemplate",null),e([b({types:Ue,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Re,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:T,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}})],Xe.prototype,"renderer",null),e([w("service","renderer",["drawingInfo.renderer","defaultSymbol"]),w("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Xe.prototype,"readRenderer",null),e([b()],Xe.prototype,"resourceInfo",void 0),e([b((()=>{const e=a(ee);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([b({clonable:!1})],Xe.prototype,"source",null),e([g("source")],Xe.prototype,"castSource",null),e([w("portal-item","source",["featureSet"]),w("web-map","source",["featureSet"])],Xe.prototype,"readSource",null),e([b({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Xe.prototype,"spatialReference",void 0),e([b({type:Number})],Xe.prototype,"subtypeCode",void 0),e([b({type:[Se]})],Xe.prototype,"templates",void 0),e([w("templates",["editFieldsInfo","creatorField","editorField","templates"])],Xe.prototype,"readTemplates",null),e([b({type:Pe})],Xe.prototype,"timeInfo",void 0),e([b()],Xe.prototype,"title",void 0),e([w("service","title",["name"]),w("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Xe.prototype,"readTitle",null),e([w("web-map","title",["layerDefinition.name","title"])],Xe.prototype,"readTitleFromWebMap",null),e([b({type:String})],Xe.prototype,"sublayerTitleMode",void 0),e([b({json:{read:!1}})],Xe.prototype,"type",void 0),e([b({type:String})],Xe.prototype,"typeIdField",void 0),e([w("service","typeIdField"),w("typeIdField",["layerDefinition.typeIdField"])],Xe.prototype,"readTypeIdField",null),e([b({type:[Ie]})],Xe.prototype,"types",void 0),e([w("service","types",["types"]),w("types",["layerDefinition.types"])],Xe.prototype,"readTypes",null),e([b({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:T}}}}})],Xe.prototype,"visible",void 0),e([w("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Xe.prototype,"readVisible",null),Xe=e([v("esri.layers.FeatureLayer")],Xe);export{Xe as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{clone as i}from"../core/lang.js";import{setDeepValue as r}from"../core/object.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./FeatureLayer.js";import{useViewTimeProperty as s}from"./mixins/TemporalLayer.js";import{getEffectiveElevationSource as p,orientedImageryTypeMap as m,timeIntervalUnitTypeMap as l,verticalMeasurementTypeMap as d,isOrientationAccuracy as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{clone as i}from"../core/lang.js";import{setDeepValue as r}from"../core/object.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./FeatureLayer.js";import{useViewTimeProperty as s}from"./mixins/TemporalLayer.js";import{getEffectiveElevationSource as p,orientedImageryTypeMap as m,timeIntervalUnitTypeMap as l,verticalMeasurementTypeMap as d,padAccuracyArray as y,isOrientationAccuracy as u}from"./orientedImagery/core/utils.js";import c from"../tables/AttributeTableTemplate.js";import{T as h}from"../chunks/TimeExtent.js";import{SaveOperationType as f}from"../webdoc/interfaces.js";const g=new Set(["demPathPrefix","demPathSuffix","depthImagePathPrefix","depthImagePathSuffix","elevationSource","horizontalMeasurementUnit","imageGeometryField","imageReferenceField","referenceIDField","sequenceOrderField","verticalMeasurementUnit","videoPathPrefix","videoPathSuffix","timeAnimation","visibilityTimeExtent"]),v=(e,t)=>!g.has(t)&&e,j=(e,t,i)=>{const r=`orientedImageryProperties.${e}`;return{name:r,write:t?{ignoreOrigin:!0,target:r,writer:t}:{ignoreOrigin:!0},read:i?{ignoreOrigin:!0,source:r,reader:i}:{ignoreOrigin:!0}}};function P(e){return e.json?(e.json.origins=e.json.origins??{},e.json.origins["web-scene"]={write:!1,read:!1},e):e}function S(e,t,i,r){const{name:o,write:a,read:n}=j(e,t,i),s={name:o,write:a,read:n,origins:{service:{name:`orientedImageryInfo.${o}`,write:t,read:i},"web-scene":{name:o,write:v(a,e),read:v(n,e)},"web-map":{name:o,write:a,read:n}}};return r&&s.origins?(s.type=r,s.origins["web-map"].type=r,s.origins["web-scene"].type=r,s):s}let x=class extends n{constructor(){super(...arguments),this.attributeTableTemplate=null,this.cameraHeading=null,this.cameraHeight=null,this.cameraPitch=null,this.cameraRoll=null,this.coveragePercent=null,this.demPathPrefix=null,this.demPathSuffix=null,this.depthImagePathPrefix=null,this.depthImagePathSuffix=null,this.elevationSource=null,this.farDistance=null,this.geometryType="point",this.horizontalFieldOfView=null,this.horizontalMeasurementUnit=null,this.imageGeometryField="ImageGeometry",this.imagePathPrefix=null,this.imagePathSuffix=null,this.imageReferenceField="OIObjectID",this.imageRotation=null,this.maximumDistance=null,this.nearDistance=null,this.operationalLayerType="OrientedImageryLayer",this.orientationAccuracy=null,this.orientedImageryType=null,this.referenceIDField="OBJECTID",this.sequenceOrderField="SequenceOrder",this.supportedSourceTypes=new Set(["Oriented Imagery Layer"]),this.type="oriented-imagery",this.timeIntervalUnit="days",this.useViewTime=!0,this.verticalFieldOfView=null,this.verticalMeasurementUnit=null,this.videoPathPrefix=null,this.videoPathSuffix=null,this.visibilityTimeExtent=null}get effectiveElevationSource(){const{elevationSource:e,demPathPrefix:t,demPathSuffix:i}=this;return p(e,t,i)}async save(e){return this._debouncedSaveOperations(f.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(f.SAVE_AS,t,e)}findFirstValidLayerId(e){return e.layers?.find((e=>this.supportedSourceTypes.has(e.type)))?.id}_verifySource(){if(super._verifySource(),"point"!==this.geometryType)throw new t("oriented-imagery-layer:invalid-geometry-type","OrientedImageryLayer only supports point geometry type")}};e([o({type:c,json:{write:!1,read:!1}})],x.prototype,"attributeTableTemplate",void 0),e([o({type:Number,json:S("cameraHeading")})],x.prototype,"cameraHeading",void 0),e([o({type:Number,json:S("cameraHeight")})],x.prototype,"cameraHeight",void 0),e([o({type:Number,json:S("cameraPitch")})],x.prototype,"cameraPitch",void 0),e([o({type:Number,json:S("cameraRoll")})],x.prototype,"cameraRoll",void 0),e([o({type:Number,json:S("coveragePercent")})],x.prototype,"coveragePercent",void 0),e([o({type:String,json:S("demPathPrefix")})],x.prototype,"demPathPrefix",void 0),e([o({type:String,json:S("demPathSuffix")})],x.prototype,"demPathSuffix",void 0),e([o({type:String,json:S("depthImagePathPrefix")})],x.prototype,"depthImagePathPrefix",void 0),e([o({type:String,json:S("depthImagePathSuffix")})],x.prototype,"depthImagePathSuffix",void 0),e([o({type:Object,json:S("elevationSource")})],x.prototype,"elevationSource",void 0),e([o({readOnly:!0})],x.prototype,"effectiveElevationSource",null),e([o({type:Number,json:S("farDistance")})],x.prototype,"farDistance",void 0),e([o()],x.prototype,"geometryType",void 0),e([o({type:Number,json:S("horizontalFieldOfView")})],x.prototype,"horizontalFieldOfView",void 0),e([o({type:String,json:S("horizontalMeasurementUnit")})],x.prototype,"horizontalMeasurementUnit",void 0),e([o({type:String,json:{...S("imageGeometryField"),default:"ImageGeometry"}})],x.prototype,"imageGeometryField",void 0),e([o({type:String,json:S("imagePathPrefix")})],x.prototype,"imagePathPrefix",void 0),e([o({type:String,json:S("imagePathSuffix")})],x.prototype,"imagePathSuffix",void 0),e([o({type:String,json:{...S("imageReferenceField"),default:"OIObjectID"}})],x.prototype,"imageReferenceField",void 0),e([o({type:Number,json:S("imageRotation")})],x.prototype,"imageRotation",void 0),e([o({type:Number,json:S("maximumDistance")})],x.prototype,"maximumDistance",void 0),e([o({type:Number,json:S("nearDistance")})],x.prototype,"nearDistance",void 0),e([o({type:["OrientedImageryLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],x.prototype,"operationalLayerType",void 0),e([o({json:{...S("orientationAccuracy",((e,t,i)=>{r(i,e.join(";"),t)}),(e=>{const t=e?.split(";")?.map(Number);return u(t)?y(t):[0,0,0,0,0,0,0,0]}),String)}})],x.prototype,"orientationAccuracy",void 0),e([o({json:{...S("orientedImageryType",m.write,m.read,m.jsonValues.slice(1))}})],x.prototype,"orientedImageryType",void 0),e([o({type:String,json:{...S("referenceIDField"),default:"OBJECTID"}})],x.prototype,"referenceIDField",void 0),e([o({type:String,json:{...S("sequenceOrderField"),default:"SequenceOrder"}})],x.prototype,"sequenceOrderField",void 0),e([o({json:{read:!1},value:"oriented-imagery",readOnly:!0})],x.prototype,"type",void 0),e([o({type:l.apiValues,json:{...S("timeIntervalUnit",l.write,l.read,l.jsonValues)}})],x.prototype,"timeIntervalUnit",void 0),e([o(P(i(s)))],x.prototype,"useViewTime",void 0),e([o({type:Number,json:S("verticalFieldOfView")})],x.prototype,"verticalFieldOfView",void 0),e([o({type:d.apiValues,json:{...S("verticalMeasurementUnit",d.write,d.read,d.jsonValues)}})],x.prototype,"verticalMeasurementUnit",void 0),e([o({type:String,json:S("videoPathPrefix")})],x.prototype,"videoPathPrefix",void 0),e([o({type:String,json:S("videoPathSuffix")})],x.prototype,"videoPathSuffix",void 0),e([o({type:h,json:{origins:{"web-scene":{write:!1,read:!1}}}})],x.prototype,"visibilityTimeExtent",void 0),x=e([a("esri.layers.OrientedImageryLayer")],x);const b=x;export{b as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Clonable.js";import r from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n,whenOrAbort as l}from"../core/promiseUtils.js";import{watch as u,sync as p}from"../core/reactiveUtils.js";import{sqlAnd as y}from"../core/sql.js";import{urlToObject as d,join as c}from"../core/urlUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import b from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as F}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as v}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as L}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as I}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as C}from"./support/arcgisLayerUrl.js";import{id as O}from"./support/commonProperties.js";import{ensureLayerCredential as P,computeEffectiveEditingEnabled as G,addAttachment as A,updateAttachment as U,applyEdits as q,createQuery as D,deleteAttachments as M,fetchRecomputedExtents as R,computeDomainFromSubtypes as $,getFeatureSubtype as V,queryAttachments as k,queryObjectIds as N,queryFeatureCount as Q,queryExtent as H,queryRelatedFeatures as J,queryRelatedFeaturesCount as B,hasDataChanged as Z}from"./support/featureLayerUtils.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixTimeInfoFields as K}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as W,createSimpleRenderersWithUniqueColors as X}from"./support/subtypeGroupLayerUtils.js";import Y from"./support/SubtypeSublayer.js";import ee from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as te}from"./support/versionUtils.js";import re from"../rest/support/Query.js";import{isNumber as se}from"../support/guards.js";import{SaveOperationType as ie}from"../webdoc/interfaces.js";const oe="SubtypeGroupLayer";function ae(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ne(e,t){const r=[];for(const s of e){const e=new Y;e.read(s,t),r.push(e)}return r}const le=z();function ue(){return{name:"layerType",read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let pe=class extends(L(F(v(w(_(E(I(S(x(T(o(j(g(t.ClonableMixin(b))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(r.ofType(Y)),this.useUniqueColorsForSublayers=!0,this.supportedSourceTypes=new Set(["Feature Layer","Table"]),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/featureLayerUtils.js");switch(e){case ie.SAVE:return s(this,t);case ie.SAVE_AS:return i(this,r,t)}})),this.addHandles(u((()=>this.sublayers),((e,t)=>this._handleSublayersChange(e,t)),p))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(n).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>P(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return G(this)}get operationalLayerType(){return this.isTable?"SubtypeGroupTable":"SubtypeGroupLayer"}get parsedUrl(){const e=d(this.url);return null!=e&&null!=this.layerId&&(e.path=c(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?C(this.url,t):t}async addAttachment(e,t){const r=await A(this,e,t,oe);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const s=await U(this,e,t,r,oe);return this.lastEditsEventDate=new Date,s}async applyEdits(e,t){return q(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await l(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=D(this),t=this.sublayers.map((e=>e.subtypeCode));return e.where=y(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){const r=await M(this,e,t,oe);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return R(this,e,oe)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains){const t=$(this,e);if(t)return t}const r=V(this,t?.feature);if(r){const t=r.domains?.[e];return"inherited"===t?.type?this._getLayerDomain(e):t}return this._getLayerDomain(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,t){return k(this,e,t,oe)}async queryFeatures(e,t){const r=await this.load(),s=re.from(e)??r.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await r.source.queryFeatures(s,t);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,t){return(await N(this,e,t,oe)).filter(se)}async queryFeatureCount(e,t){return Q(this,e,t,oe)}async queryExtent(e,t){return H(this,e,t,oe)}async queryRelatedFeatures(e,t){return J(this,e,t,oe)}async queryRelatedFeaturesCount(e,t){return B(this,e,t,oe)}async save(e){return this._debouncedSaveOperations(ie.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(ie.SAVE_AS,t,e)}write(e,t){const{origin:r,layerContainerType:i,messages:o}=t;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return o?.push(ae(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return o?.push(ae(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,t):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&te(this,e)}async getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){const r=this.findSublayerForFeature(e);return r?await r.getFeatureTitle(e,t):this.displayField&&this.fieldsIndex.has(this.displayField)?e.attributes[this.fieldsIndex.get(this.displayField).name]??"":this.objectIdField&&this.fieldsIndex.has(this.objectIdField)?e.attributes[this.fieldsIndex.get(this.objectIdField).name]??"":""}get featureTitleFields(){const e=new Set;for(const t of this.sublayers){const r=t.featureTitleFields;for(const t of r)e.add(t)}return[...e]}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),K(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return Z(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)}))],"sublayers-owner"))}};e([h({readOnly:!0})],pe.prototype,"createQueryVersion",null),e([h({readOnly:!0})],pe.prototype,"editingEnabled",null),e([h({readOnly:!0})],pe.prototype,"effectiveEditingEnabled",null),e([h({...le.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],pe.prototype,"fields",void 0),e([h(le.fieldsIndex)],pe.prototype,"fieldsIndex",void 0),e([h(O)],pe.prototype,"id",void 0),e([h({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],pe.prototype,"listMode",void 0),e([h({type:["SubtypeGroupLayer","SubtypeGroupTable"],json:{...ue(),origins:{"web-document":ue(),"portal-item":ue()}}})],pe.prototype,"operationalLayerType",null),e([h(le.outFields)],pe.prototype,"outFields",void 0),e([h({readOnly:!0})],pe.prototype,"parsedUrl",null),e([h({clonable:!1})],pe.prototype,"source",null),e([h({type:r.ofType(Y),json:{origins:{service:{read:{source:"subtypes",reader(e,t,s){let i=null;if(this.useUniqueColorsForSublayers){const r=W(t,s);i=r?X(e.length,r):null}const o=e.map((({code:e},r)=>{const o=new Y({subtypeCode:e});o.read(t,s);const a=i?.[r];return a&&o.read({drawingInfo:{renderer:a.toJSON()}},s),o}));return new(r.ofType(Y))(o)}}}},read:{source:["layers","tables"],reader(e,t,s){let i;return"SubtypeGroupLayer"===t.layerType&&t.layers?.length?i=ne(t.layers,s):"SubtypeGroupTable"===t.layerType&&t.tables?.length&&(i=ne(t.tables,s)),new(r.ofType(Y))(i)}},write:{ignoreOrigin:!0,writer(e,t,r,s){const i=[];for(const o of e){const e=o.write({},s);i.push(e)}this.isTable?t.tables=i:t.layers=i}}}})],pe.prototype,"sublayers",void 0),e([h()],pe.prototype,"useUniqueColorsForSublayers",void 0),e([h({type:ee})],pe.prototype,"timeInfo",void 0),e([h({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],pe.prototype,"title",void 0),e([m("service","title",["name"])],pe.prototype,"readTitleFromService",null),e([h({json:{read:!1}})],pe.prototype,"type",void 0),e([h({clonable:!1,readOnly:!0})],pe.prototype,"featureTitleFields",null),pe=e([f("esri.layers.SubtypeGroupLayer")],pe);const ye=pe;export{ye as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Clonable.js";import r from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{debounce as n,throwIfAbortError as u,whenOrAbort as l}from"../core/promiseUtils.js";import{watch as p,sync as y}from"../core/reactiveUtils.js";import{sqlAnd as d}from"../core/sql.js";import{urlToObject as c,join as h}from"../core/urlUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../core/accessorSupport/decorators/subclass.js";import g from"./Layer.js";import{APIKeyMixin as w}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{CustomParametersMixin as F}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as v}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as L}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as T}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as E}from"./mixins/OperationalLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as _}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as C}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as O}from"./support/arcgisLayerUrl.js";import{id as P}from"./support/commonProperties.js";import{ensureLayerCredential as U,computeEffectiveEditingEnabled as A,addAttachment as G,updateAttachment as q,applyEdits as D,createQuery as M,deleteAttachments as k,fetchRecomputedExtents as R,computeDomainFromSubtypes as $,getFeatureSubtype as V,queryAttachments as N,queryObjectIds as Q,queryFeatureCount as H,queryExtent as J,queryRelatedFeatures as B,queryRelatedFeaturesCount as z,hasDataChanged as K}from"./support/featureLayerUtils.js";import{defineFieldProperties as Z}from"./support/fieldProperties.js";import{fixTimeInfoFields as W}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as X,createSimpleRenderersWithUniqueColors as Y}from"./support/subtypeGroupLayerUtils.js";import ee from"./support/SubtypeSublayer.js";import te from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as re}from"./support/versionUtils.js";import se from"../rest/support/Query.js";import{isNumber as ie}from"../support/guards.js";import{SaveOperationType as oe}from"../webdoc/interfaces.js";const ae="SubtypeGroupLayer";function ne(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ue(e,t){const r=[];for(const s of e){const e=new ee;e.read(s,t),r.push(e)}return r}const le=Z();function pe(){return{name:"layerType",read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let ye=class extends(T(v(L(j(C(I(_(S(E(x(a(F(w(t.ClonableMixin(g))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(r.ofType(ee)),this.useUniqueColorsForSublayers=!0,this.supportedSourceTypes=new Set(["Feature Layer","Table"]),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=n((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/featureLayerUtils.js");switch(e){case oe.SAVE:return s(this,t);case oe.SAVE_AS:return i(this,r,t)}})),this.addHandles(p((()=>this.sublayers),((e,t)=>this._handleSublayersChange(e,t)),y))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(u).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>U(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return A(this)}get operationalLayerType(){return this.isTable?"SubtypeGroupTable":"SubtypeGroupLayer"}get parsedUrl(){const e=c(this.url);return null!=e&&null!=this.layerId&&(e.path=h(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?O(this.url,t):t}async addAttachment(e,t){const r=await G(this,e,t,ae);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const s=await q(this,e,t,r,ae);return this.lastEditsEventDate=new Date,s}async applyEdits(e,t){return D(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await l(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=M(this),t=this.sublayers.map((e=>e.subtypeCode));return e.where=d(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){const r=await k(this,e,t,ae);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return R(this,e,ae)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains){const t=$(this,e);if(t)return t}const r=V(this,t?.feature);if(r){const t=r.domains?.[e];return"inherited"===t?.type?this._getLayerDomain(e):t}return this._getLayerDomain(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,t){return N(this,e,t,ae)}async queryFeatures(e,t){const r=await this.load(),s=se.from(e)??r.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await r.source.queryFeatures(s,t);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,t){return(await Q(this,e,t,ae)).filter(ie)}async queryFeatureCount(e,t){return H(this,e,t,ae)}async queryExtent(e,t){return J(this,e,t,ae)}async queryRelatedFeatures(e,t){return B(this,e,t,ae)}async queryRelatedFeaturesCount(e,t){return z(this,e,t,ae)}async save(e){return this._debouncedSaveOperations(oe.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(oe.SAVE_AS,t,e)}write(e,t){const{origin:r,layerContainerType:i,messages:o}=t;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return o?.push(ne(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return o?.push(ne(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,t):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&re(this,e)}async getFeatureTitle(e,t){const r=this.findSublayerForFeature(e);return r?await r.getFeatureTitle(e,t):this._getFeatureTitleForUnknownSublayer(e)}async getFeatureTitles(e,t){const r=new Map,s=new Map,i=[s];e.forEach((e=>{const t=this.findSublayerForFeature(e);t?o(r,t,(()=>[])).push(e):s.set(e,this._getFeatureTitleForUnknownSublayer(e))}));const a=await Promise.all(Array.from(r).map((([e,r])=>e.getFeatureTitles(r,t))));return a.forEach((e=>i.push(e))),new Map(i.flatMap((e=>[...e])))}get featureTitleFields(){const e=new Set;for(const t of this.sublayers){const r=t.featureTitleFields;for(const t of r)e.add(t)}return[...e]}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),W(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return K(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)}))],"sublayers-owner"))}_getFeatureTitleForUnknownSublayer(e){const{displayField:t,fieldsIndex:r,objectIdField:s}=this;if(t&&r.has(t))return e.attributes[r.get(t).name]??"";const i=e.getObjectId();return null!=i?i.toString():s&&r.has(s)?e.attributes[r.get(s).name]??"":""}};e([m({readOnly:!0})],ye.prototype,"createQueryVersion",null),e([m({readOnly:!0})],ye.prototype,"editingEnabled",null),e([m({readOnly:!0})],ye.prototype,"effectiveEditingEnabled",null),e([m({...le.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ye.prototype,"fields",void 0),e([m(le.fieldsIndex)],ye.prototype,"fieldsIndex",void 0),e([m(P)],ye.prototype,"id",void 0),e([m({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],ye.prototype,"listMode",void 0),e([m({type:["SubtypeGroupLayer","SubtypeGroupTable"],json:{...pe(),origins:{"web-document":pe(),"portal-item":pe()}}})],ye.prototype,"operationalLayerType",null),e([m(le.outFields)],ye.prototype,"outFields",void 0),e([m({readOnly:!0})],ye.prototype,"parsedUrl",null),e([m({clonable:!1})],ye.prototype,"source",null),e([m({type:r.ofType(ee),json:{origins:{service:{read:{source:"subtypes",reader(e,t,s){let i=null;if(this.useUniqueColorsForSublayers){const r=X(t,s);i=r?Y(e.length,r):null}const o=e.map((({code:e},r)=>{const o=new ee({subtypeCode:e});o.read(t,s);const a=i?.[r];return a&&o.read({drawingInfo:{renderer:a.toJSON()}},s),o}));return new(r.ofType(ee))(o)}}}},read:{source:["layers","tables"],reader(e,t,s){let i;return"SubtypeGroupLayer"===t.layerType&&t.layers?.length?i=ue(t.layers,s):"SubtypeGroupTable"===t.layerType&&t.tables?.length&&(i=ue(t.tables,s)),new(r.ofType(ee))(i)}},write:{ignoreOrigin:!0,writer(e,t,r,s){const i=[];for(const o of e){const e=o.write({},s);i.push(e)}this.isTable?t.tables=i:t.layers=i}}}})],ye.prototype,"sublayers",void 0),e([m()],ye.prototype,"useUniqueColorsForSublayers",void 0),e([m({type:te})],ye.prototype,"timeInfo",void 0),e([m({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],ye.prototype,"title",void 0),e([f("service","title",["name"])],ye.prototype,"readTitleFromService",null),e([m({json:{read:!1}})],ye.prototype,"type",void 0),e([m({clonable:!1,readOnly:!0})],ye.prototype,"featureTitleFields",null),ye=e([b("esri.layers.SubtypeGroupLayer")],ye);const de=ye;export{de as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import{createTask as r}from"../core/asyncUtils.js";import i from"../core/Error.js";import{clone as o}from"../core/lang.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{urlToObject as a,addQueryParameters as n,isProtocolRelative as p,normalize as y}from"../core/urlUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{checkWebPSupport as U}from"./support/imageUtils.js";import I from"./support/SpriteSource.js";import R from"./support/TileInfo.js";import{TilemapCache as O}from"./support/TilemapCache.js";import{loadMetadata as P}from"./support/vectorTileLayerLoader.js";import{createForItemRead as M}from"../portal/support/jsonContext.js";import{parseKnownArcGISOnlineDomain as C}from"../portal/support/urlUtils.js";import{e as V}from"../chunks/persistableUrlUtils.js";import{areSchemasOverlapping as D,unionTileInfos as k}from"../views/2d/engine/vectorTiles/tileInfoUtils.js";import E from"../views/2d/engine/vectorTiles/style/StyleRepository.js";import{getWebGLCapabilities as N}from"../views/webgl/capabilities.js";let B=class extends(_(L(x(v(j(b(T(w(g(s(f))))))))))){constructor(...e){super(...e),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.path=null,this.refreshInterval=0,this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){if(this.sourceNameToSource)for(const e of Object.values(this.sourceNameToSource))e?.destroy();this.primarySource?.destroy(),this._spriteSourceMap.clear()}async prefetchResources(e){await this.loadSpriteSource(globalThis.devicePixelRatio||1,e)}load(e){const r=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},e).catch(l).then((async()=>{if(!this.portalItem?.id)return;const r=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await t(r,{...e,query:{f:"json",...this.customParameters,token:this.apiKey},authMode:this.portalItem.portal.authMode})).data&&this.read({url:r},M(this.portalItem,"portal-item"))})).catch(l).then((()=>this._loadStyle(e)));return this.addResolvingPromise(r),Promise.resolve(this)}get attributionDataUrl(){const e=this.currentStyleInfo,t=e?.serviceUrl&&a(e.serviceUrl);if(!t)return null;const r=this._getDefaultAttribution(t.path);return r?n(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const e=this.primarySource;return e?e.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){return this.primarySource?.fullExtent||null}get initialExtent(){return this.primarySource?.initialExtent||null}get parsedUrl(){return this.serviceUrl?a(this.serviceUrl):null}get serviceUrl(){return this.currentStyleInfo?.serviceUrl||null}get spatialReference(){return this.tileInfo?.spatialReference??null}get styleUrl(){return this.currentStyleInfo?.styleUrl||null}writeStyleUrl(e,t){e&&p(e)&&(e=`https:${e}`);const r=C(e);t.styleUrl=V(e,r)}get tileInfo(){const e=[];for(const r in this.sourceNameToSource)e.push(this.sourceNameToSource[r]);let t=this.primarySource?.tileInfo||new R;if(e.length>1)for(let r=0;r<e.length;r++)D(t,e[r].tileInfo)&&(t=k(t,e[r].tileInfo));return t}readTilemapCache(e,t){const r=t.capabilities?.includes("Tilemap");return r?new O({layer:this}):null}readVersion(e,t){return t.version?parseFloat(t.version):parseFloat(t.currentVersion)}async loadSpriteSource(e=1,t){if(!this._spriteSourceMap.has(e)){const r=N().maxTextureSize,i=this.currentStyleInfo?.spriteUrl?n(this.currentStyleInfo.spriteUrl,{...this.customParameters,token:this.apiKey}):null,o=new I({type:"url",spriteUrl:i,pixelRatio:e,spriteFormat:this.currentStyleInfo?.spriteFormat},r);await o.load(t),this._spriteSourceMap.set(e,o)}return this._spriteSourceMap.get(e)}async setSpriteSource(e,t){if(!e)return null;const r=N().maxTextureSize,i=e.spriteUrl,o=i?n(i,{...this.customParameters,token:this.apiKey}):null;if(!o&&"url"===e.type)return null;const s=new I(e,r);try{await s.load(t);const r=e.pixelRatio||1;return this._spriteSourceMap.clear(),this._spriteSourceMap.set(r,s),o&&this.currentStyleInfo&&(this.currentStyleInfo.spriteUrl=o),this.emit("spriteSource-change",{spriteSource:s}),s}catch(a){l(a)}return null}async loadStyle(e,t){const i=e||this.style||this.url;return this._loadingTask&&"string"==typeof i&&this.url===i||(this._loadingTask?.abort(),this._loadingTask=r((e=>(this._spriteSourceMap.clear(),this._getSourceAndStyle(i,{signal:e}))),t)),this._loadingTask.promise}getStyleLayerId(e){return this.styleRepository.getStyleLayerId(e)}getStyleLayerIndex(e){return this.styleRepository.getStyleLayerIndex(e)}getPaintProperties(e){return o(this.styleRepository?.getPaintProperties(e))}setPaintProperties(e,t){const r=this.styleRepository.isPainterDataDriven(e);this.styleRepository.setPaintProperties(e,t);const i=this.styleRepository.isPainterDataDriven(e);this.emit("paint-change",{layer:e,paint:t,isDataDriven:r||i})}getStyleLayer(e){return o(this.styleRepository.getStyleLayer(e))}setStyleLayer(e,t){this.styleRepository.setStyleLayer(e,t),this.emit("style-layer-change",{layer:e,index:t})}deleteStyleLayer(e){this.styleRepository.deleteStyleLayer(e),this.emit("delete-style-layer",{layer:e})}getLayoutProperties(e){return o(this.styleRepository.getLayoutProperties(e))}setLayoutProperties(e,t){this.styleRepository.setLayoutProperties(e,t),this.emit("layout-change",{layer:e,layout:t})}setStyleLayerVisibility(e,t){this.styleRepository.setStyleLayerVisibility(e,t),this.emit("style-layer-visibility-change",{layer:e,visibility:t})}getStyleLayerVisibility(e){return this.styleRepository.getStyleLayerVisibility(e)}write(e,t){return t?.origin&&!this.styleUrl?(t.messages&&t.messages.push(new i("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(e,t)}getTileUrl(e,t,r){return null}async _getSourceAndStyle(e,t){if(!e)throw new Error("invalid style!");const r=await P(e,{...t,query:{...this.customParameters,token:this.apiKey}});if("webp"===r.spriteFormat){await U("lossy")||(r.spriteFormat="png")}this._set("currentStyleInfo",{...r}),"string"==typeof e?(this.url=e,this.style=null):(this.url=null,this.style=e),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new E(r.style)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(e){const t=e.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^/]+)?\/arcgis\/rest\/services\/([^/]+(\/[^/]+)*)\/vectortileserver/i),r=["OpenBasemap_v2","OpenBasemap_GCS_v2","OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2","World_Hillshade_v2"];if(!t)return;const i=t[2]&&t[2].toLowerCase();if(!i)return;const o=t[1]||"";for(const s of r)if(s.toLowerCase().includes(i))return y(`//static.arcgis.com/attribution/Vector${o}/${s}`)}async _loadStyle(e){return this._loadingTask?.promise??this.loadStyle(null,e)}};e([u({readOnly:!0})],B.prototype,"attributionDataUrl",null),e([u({type:["show","hide"]})],B.prototype,"listMode",void 0),e([u({json:{read:!0,write:!0}})],B.prototype,"blendMode",void 0),e([u({readOnly:!0,json:{read:!1}})],B.prototype,"capabilities",null),e([u({readOnly:!0})],B.prototype,"currentStyleInfo",void 0),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"fullExtent",null),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"initialExtent",null),e([u({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],B.prototype,"isReference",void 0),e([u({type:["VectorTileLayer"]})],B.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],B.prototype,"parsedUrl",null),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],B.prototype,"path",void 0),e([u({type:Number,json:{write:!1,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],B.prototype,"refreshInterval",void 0),e([u()],B.prototype,"style",void 0),e([u({readOnly:!0})],B.prototype,"serviceUrl",null),e([u({type:S,readOnly:!0})],B.prototype,"spatialReference",null),e([u({readOnly:!0})],B.prototype,"styleRepository",void 0),e([u({readOnly:!0})],B.prototype,"sourceNameToSource",void 0),e([u({readOnly:!0})],B.prototype,"primarySource",void 0),e([u({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],B.prototype,"styleUrl",null),e([h(["portal-item","web-document"],"styleUrl")],B.prototype,"writeStyleUrl",null),e([u({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:R})],B.prototype,"tileInfo",null),e([u()],B.prototype,"tilemapCache",void 0),e([c("service","tilemapCache",["capabilities","tileInfo"])],B.prototype,"readTilemapCache",null),e([u({json:{read:!1},readOnly:!0,value:"vector-tile"})],B.prototype,"type",void 0),e([u({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],B.prototype,"url",void 0),e([u({readOnly:!0})],B.prototype,"version",void 0),e([c("version",["version","currentVersion"])],B.prototype,"readVersion",null),B=e([m("esri.layers.VectorTileLayer")],B);const A=B;export{A as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import{createTask as r}from"../core/asyncUtils.js";import i from"../core/Error.js";import{clone as o}from"../core/lang.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{urlToObject as a,addQueryParameters as n,isProtocolRelative as p,normalize as y}from"../core/urlUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{checkWebPSupport as U}from"./support/imageUtils.js";import I from"./support/SpriteSource.js";import R from"./support/TileInfo.js";import{TilemapCache as O}from"./support/TilemapCache.js";import{loadMetadata as P}from"./support/vectorTileLayerLoader.js";import{createForItemRead as M}from"../portal/support/jsonContext.js";import{parseKnownArcGISOnlineDomain as C}from"../portal/support/urlUtils.js";import{e as V}from"../chunks/persistableUrlUtils.js";import{areSchemasOverlapping as D,unionTileInfos as k}from"../views/2d/engine/vectorTiles/tileInfoUtils.js";import E from"../views/2d/engine/vectorTiles/style/StyleRepository.js";import{getWebGLCapabilities as N}from"../views/webgl/capabilities.js";let B=class extends(_(L(x(v(j(b(T(w(g(s(f))))))))))){constructor(...e){super(...e),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.path=null,this.refreshInterval=0,this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){if(this.sourceNameToSource)for(const e of Object.values(this.sourceNameToSource))e?.destroy();this.primarySource?.destroy(),this._spriteSourceMap.clear()}async prefetchResources(e){await this.loadSpriteSource(globalThis.devicePixelRatio||1,e)}load(e){const r=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},e).catch(l).then((async()=>{if(!this.portalItem?.id)return;const r=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await t(r,{...e,query:{f:"json",...this.customParameters,token:this.apiKey},authMode:this.portalItem.portal.authMode})).data&&this.read({url:r},M(this.portalItem,"portal-item"))})).catch(l).then((()=>this._loadStyle(e)));return this.addResolvingPromise(r),Promise.resolve(this)}get attributionDataUrl(){const e=this.currentStyleInfo,t=e?.serviceUrl&&a(e.serviceUrl);if(!t)return null;const r=this._getDefaultAttribution(t.path);return r?n(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const e=this.primarySource;return e?e.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){return this.primarySource?.fullExtent||null}get initialExtent(){return this.primarySource?.initialExtent||null}get parsedUrl(){return this.serviceUrl?a(this.serviceUrl):null}get serviceUrl(){return this.currentStyleInfo?.serviceUrl||null}get spatialReference(){return this.tileInfo?.spatialReference??null}get styleUrl(){return this.currentStyleInfo?.styleUrl||null}writeStyleUrl(e,t){e&&p(e)&&(e=`https:${e}`);const r=C(e);t.styleUrl=V(e,r)}get tileInfo(){const e=[];for(const r in this.sourceNameToSource)e.push(this.sourceNameToSource[r]);let t=this.primarySource?.tileInfo||new R;if(e.length>1)for(let r=0;r<e.length;r++)D(t,e[r].tileInfo)&&(t=k(t,e[r].tileInfo));return t}readTilemapCache(e,t){const r=t.capabilities?.includes("Tilemap");return r?new O({layer:this}):null}readVersion(e,t){return t.version?parseFloat(t.version):parseFloat(t.currentVersion)}async loadSpriteSource(e=1,t){if(!this._spriteSourceMap.has(e)){const r=N().maxTextureSize,i=this.currentStyleInfo?.spriteUrl?n(this.currentStyleInfo.spriteUrl,{...this.customParameters,token:this.apiKey}):null,o=new I({type:"url",spriteUrl:i,pixelRatio:e,spriteFormat:this.currentStyleInfo?.spriteFormat},r);await o.load(t),this._spriteSourceMap.set(e,o)}return this._spriteSourceMap.get(e)}async setSpriteSource(e,t){if(!e)return null;const r=N().maxTextureSize,i=e.spriteUrl,o=i?n(i,{...this.customParameters,token:this.apiKey}):null;if(!o&&"url"===e.type)return null;const s=new I(e,r);try{await s.load(t);const r=e.pixelRatio||1;return this._spriteSourceMap.clear(),this._spriteSourceMap.set(r,s),o&&this.currentStyleInfo&&(this.currentStyleInfo.spriteUrl=o),this.emit("spriteSource-change",{spriteSource:s}),s}catch(a){l(a)}return null}async loadStyle(e,t){const i=e||this.style||this.url;return this._loadingTask&&"string"==typeof i&&this.url===i||(this._loadingTask?.abort(),this._loadingTask=r((e=>(this._spriteSourceMap.clear(),this._getSourceAndStyle(i,{signal:e}))),t)),this._loadingTask.promise}getStyleLayerId(e){return this.styleRepository.getStyleLayerId(e)}getStyleLayerIndex(e){return this.styleRepository.getStyleLayerIndex(e)}getPaintProperties(e){return o(this.styleRepository?.getPaintProperties(e))}setPaintProperties(e,t){const r=this.styleRepository.isPainterDataDriven(e);this.styleRepository.setPaintProperties(e,t);const i=this.styleRepository.isPainterDataDriven(e);this.emit("paint-change",{layer:e,paint:t,isDataDriven:r||i})}getStyleLayer(e){return o(this.styleRepository.getStyleLayer(e))}setStyleLayer(e,t){this.styleRepository.setStyleLayer(e,t),this.emit("style-layer-change",{layer:e,index:t})}deleteStyleLayer(e){this.styleRepository.deleteStyleLayer(e),this.emit("delete-style-layer",{layer:e})}getLayoutProperties(e){return o(this.styleRepository.getLayoutProperties(e))}setLayoutProperties(e,t){this.styleRepository.setLayoutProperties(e,t),this.emit("layout-change",{layer:e,layout:t})}setStyleLayerVisibility(e,t){this.styleRepository.setStyleLayerVisibility(e,t),this.emit("style-layer-visibility-change",{layer:e,visibility:t})}getStyleLayerVisibility(e){return this.styleRepository.getStyleLayerVisibility(e)}write(e,t){return t?.origin&&!this.styleUrl?(t.messages&&t.messages.push(new i("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(e,t)}getTileUrl(e,t,r){return null}async _getSourceAndStyle(e,t){if(!e)throw new Error("invalid style!");const r=await P(e,{...t,query:{...this.customParameters,token:this.apiKey}});if("webp"===r.spriteFormat){await U("lossy")||(r.spriteFormat="png")}this._set("currentStyleInfo",{...r}),"string"==typeof e?(this.url=e,this.style=null):(this.url=null,this.style=e),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new E(r.style,!1)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(e){const t=e.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^/]+)?\/arcgis\/rest\/services\/([^/]+(\/[^/]+)*)\/vectortileserver/i),r=["OpenBasemap_v2","OpenBasemap_GCS_v2","OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2","World_Hillshade_v2"];if(!t)return;const i=t[2]&&t[2].toLowerCase();if(!i)return;const o=t[1]||"";for(const s of r)if(s.toLowerCase().includes(i))return y(`//static.arcgis.com/attribution/Vector${o}/${s}`)}async _loadStyle(e){return this._loadingTask?.promise??this.loadStyle(null,e)}};e([u({readOnly:!0})],B.prototype,"attributionDataUrl",null),e([u({type:["show","hide"]})],B.prototype,"listMode",void 0),e([u({json:{read:!0,write:!0}})],B.prototype,"blendMode",void 0),e([u({readOnly:!0,json:{read:!1}})],B.prototype,"capabilities",null),e([u({readOnly:!0})],B.prototype,"currentStyleInfo",void 0),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"fullExtent",null),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"initialExtent",null),e([u({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],B.prototype,"isReference",void 0),e([u({type:["VectorTileLayer"]})],B.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],B.prototype,"parsedUrl",null),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],B.prototype,"path",void 0),e([u({type:Number,json:{write:!1,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],B.prototype,"refreshInterval",void 0),e([u()],B.prototype,"style",void 0),e([u({readOnly:!0})],B.prototype,"serviceUrl",null),e([u({type:S,readOnly:!0})],B.prototype,"spatialReference",null),e([u({readOnly:!0})],B.prototype,"styleRepository",void 0),e([u({readOnly:!0})],B.prototype,"sourceNameToSource",void 0),e([u({readOnly:!0})],B.prototype,"primarySource",void 0),e([u({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],B.prototype,"styleUrl",null),e([h(["portal-item","web-document"],"styleUrl")],B.prototype,"writeStyleUrl",null),e([u({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:R})],B.prototype,"tileInfo",null),e([u()],B.prototype,"tilemapCache",void 0),e([c("service","tilemapCache",["capabilities","tileInfo"])],B.prototype,"readTilemapCache",null),e([u({json:{read:!1},readOnly:!0,value:"vector-tile"})],B.prototype,"type",void 0),e([u({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],B.prototype,"url",void 0),e([u({readOnly:!0})],B.prototype,"version",void 0),e([c("version",["version","currentVersion"])],B.prototype,"readVersion",null),B=e([m("esri.layers.VectorTileLayer")],B);const A=B;export{A as default};
|
package/layers/VideoLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import r from"../request.js";import{deprecatedProperty as o}from"../core/deprecate.js";import i from"../core/Error.js";import s from"../core/Logger.js";import{clamp as l}from"../core/mathUtils.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as p,initial as y,whenOnce as m}from"../core/reactiveUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import{Integer as d}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as f}from"../core/accessorSupport/PropertyOrigin.js";import v from"../geometry/Extent.js";import g from"../geometry/Polyline.js";import S from"../geometry/SpatialReference.js";import b from"./Layer.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as O,effectProperty as T}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{titleFromUrlAndName as x}from"./support/arcgisLayerUrl.js";import{opacity as U,id as P}from"./support/commonProperties.js";import{normalizeParsedUrlObject as E,urlProperty as N}from"./support/multiLayerServiceUtils.js";import M from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as k}from"./support/serviceCapabilitiesUtils.js";import V from"./support/TelemetryData.js";import F from"./support/TelemetryDisplay.js";import R from"./support/VideoFrame.js";import G from"./support/VideoTimeExtent.js";import J from"./video/VideoController.js";import{getFrameHorizonPoints as A,getGroundControlPoints as H,getTelemetryData as z,getServiceLayersInfo as q,getStyledTelemetrySymbol as D,getSensorTrailPoints as _,readVideoTimeExtent as B}from"./video/videoUtils.js";import W from"../symbols/CIMSymbol.js";import Q from"../symbols/PictureMarkerSymbol.js";import $ from"../symbols/SimpleFillSymbol.js";import Z from"../symbols/SimpleLineSymbol.js";import K from"../symbols/SimpleMarkerSymbol.js";import X from"../symbols/Symbol.js";import{write as Y}from"../symbols/support/jsonUtils.js";function ee(e,t){return{ignoreOrigin:this.originIdOf(t)<f.PORTAL_ITEM}}let te=[];const re=new t([255,127,0]),oe=new t([0,0,0,.05]),ie=new K({angle:0,color:re,size:10,style:"cross"}),se=new $({color:oe,outline:new Z({color:re,width:2})}),le=new Z({color:re,width:1}),ne=new K({angle:0,color:re,outline:{color:[255,255,255],width:1.33},size:10,style:"circle"}),ae=new Z({color:re,width:1}),pe={types:{base:X,key:"type",typeMap:{"simple-marker":K,"picture-marker":Q,cim:W}},json:{name:"drawingInfo.sensorSymbol",write:{writer:Y,overridePolicy:ee}}};function ye(e,t){return{type:t,json:{name:e,write:{overridePolicy:ee}}}}let me=class extends(O(C(j(I(L(n(w(b)))))))){constructor(e){super(e),this.capabilities=null,this.codecs=null,this.connectionInfo=null,this.controller=new J,this.copyright=null,this.created=null,this.customParameters=null,this.description=null,this.elevationSource=null,this.frame=null,this.frameCenterSymbol=ie.clone(),this.frameCount=null,this.frameEffect=null,this.frameOpacity=1,this.frameOutlineSymbol=se.clone(),this.fullExtent=null,this.initialExtent=null,this.layerId=null,this.operationalLayerType="ArcGISVideoLayer",this.playbackInfo=null,this.posterUrl=null,this.qualities=null,this.sensorSymbol=ne.clone(),this.sensorSightLineSymbol=le.clone(),this.sensorTrailSymbol=ae.clone(),this.serviceItemId=null,this.sourceJSON=null,this.sourceQuality=null,this.sourceType=null,this.spatialReference=S.WGS84,this.start=0,this.telemetryDisplay=new F,this.type="video",this.url=null,this.version=null,this.videoLayersInfo=null}initialize(){this.addHandles([p((()=>this.metadata),(()=>{this.notifyChange("telemetry"),this.notifyChange("groundControlPoints"),this.notifyChange("frameHorizonPoints")})),p((()=>this.telemetry?.sensorLocation),(e=>this._setSensorTrail(e)),y)]),m((()=>this.loaded&&"can-play"===this.state&&this.duration>0)).then((()=>{this.start>=0&&this.start<=this.duration&&this.setCurrentTime(this.start)}))}destroy(){this.removeAllHandles(),this.controller&&this.controller.destroy()}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Video Service"],supportsData:!1},e).catch(a).then((()=>this._fetchService(t)));return this.addResolvingPromise(r),Promise.resolve(this)}get autoplay(){return this.controller?.autoplay??!1}set autoplay(e){this.controller.autoplay=e}get buffered(){return this.controller.buffered}readCapabilitiesFromService(e,t){return k(t)}readConnectionInfo(e,t){const r=Object.values(t.connectionUrl);return r?.length&&(this.controller.playerUrl=r[0]),t.connectionUrl}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get frameHorizonPoints(){return A(this.metadata)}get groundControlPoints(){return H(this.metadata)}get isLive(){return this.controller?.isLive??!1}get livestreamStatus(){return this.controller?.livestreamStatus}get loop(){return this.controller.loop}set loop(e){this.controller.loop=e}get metadata(){return this.controller?.currentMetadata}get mimeType(){return this.controller?.mimeType}get muted(){return this.controller.muted}set muted(e){this.controller.muted=e}get parsedUrl(){return E(this)}get playbackRate(){return this.controller.rate}set playbackRate(e){this.controller.rate=e}get playerUrl(){return this.controller.playerUrl}get playing(){return this.controller.playing}get started(){return this.controller?.started??!1}get state(){return this.controller.state}get telemetry(){return z(this.metadata)}readTitleFromService(e,{name:t}){return this.url?x(this.url,t):t}get videoElement(){return this.controller?.element}get videoHeight(){return this.controller?.videoHeight}readLayerInfosFromService(e,t){return q(t)}get videoTimeExtent(){return o(s.getLogger(this),"videoTimeExtent",{replacement:"fullTimeExtent",version:"4.33",warnOnce:!0}),this.fullTimeExtent}get videoWidth(){return this.controller?.videoWidth}get volume(){return this.controller?.volume??0}set volume(e){this.controller.volume=e}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){this.controller.reset()}setCurrentTime(e){if(this.duration<0)return;const t=l(e,0,this.duration);this.controller.setCurrentTime(t)}toGround(e,t){return this.controller?.sensorModel?.metadataSupportsTransforms?this.controller.sensorModel.transformImageToGeo(e,t):null}toVideo(e){if(!this.controller?.sensorModel?.metadataSupportsTransforms)return null;const t=this.controller.sensorModel.transformGeoToImage(e.x,e.y,e.z);return{x:t[0],y:t[1]}}updateTelemetryColor(e){this.frameCenterSymbol=D(this.frameCenterSymbol,e)??ie,this.frameOutlineSymbol=D(this.frameOutlineSymbol,e,oe)??se,this.sensorSightLineSymbol=D(this.sensorSightLineSymbol,e)??le,this.sensorTrailSymbol=D(this.sensorTrailSymbol,e)??ae,this.sensorSymbol=D(this.sensorSymbol,e)??ne}write(e,t){return null==this.layerId?(t?.messages?.push(new i("layer:unsupported",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' cannot be saved to a web map, web scene, or portal item. The ArcGIS server version must be greater than 11.2.`)),null):super.write(e,t)}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:o}=await r(this.url,{query:{f:"json",...this.parsedUrl.query,...this.customParameters},signal:e});if(o&&(this.url=this.url.replace(/^http:/i,"https:")),!t?.currentVersion)return t.currentVersion="11.2",this.sourceJSON=t,void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});if(this.layerId??=t.layers?.[0]?.id??null,null==this.layerId)throw new i("arcgis-layers:url-mismatch","The url is not a valid arcgis resource");const{data:s}=await r(this.parsedUrl.path,{query:{f:"json",...this.customParameters},signal:e});this.sourceJSON={...t,...s},this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl})}_setSensorTrail(e){if(!e)return;const t=_(e,te);te=[...t];const r=te.map((e=>e.toArray())),o=new g({hasZ:e.hasZ,paths:[r]});this.telemetry.sensorTrail=o.clone()}};e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],me.prototype,"autoplay",null),e([u({readOnly:!0})],me.prototype,"buffered",null),e([u({readOnly:!0})],me.prototype,"cameraInfo",void 0),e([u({readOnly:!0,json:{read:!1}})],me.prototype,"capabilities",void 0),e([c("service","capabilities",["supportsAppend","supportsCoverageQuery","supportsExportClip","supportsExportFrameset","supportsMensuration","supportsPreviews","supportsUpdate"])],me.prototype,"readCapabilitiesFromService",null),e([u({readOnly:!0})],me.prototype,"codecs",void 0),e([u({readOnly:!0})],me.prototype,"connectionInfo",void 0),e([c("connectionInfo",["connectionUrl"])],me.prototype,"readConnectionInfo",null),e([u()],me.prototype,"controller",void 0),e([u({type:String})],me.prototype,"copyright",void 0),e([u({readOnly:!0,type:Date})],me.prototype,"created",void 0),e([u({type:Number})],me.prototype,"currentTime",null),e([u({json:{write:!1}})],me.prototype,"customParameters",void 0),e([u({type:String})],me.prototype,"description",void 0),e([u({type:Number})],me.prototype,"duration",null),e([u({readOnly:!0})],me.prototype,"elevationSource",void 0),e([u({type:Boolean})],me.prototype,"ended",null),e([u({type:R})],me.prototype,"frame",void 0),e([u(ye("drawingInfo.frameCenterSymbol",K))],me.prototype,"frameCenterSymbol",void 0),e([u({readOnly:!0,type:d})],me.prototype,"frameCount",void 0),e([u(T)],me.prototype,"frameEffect",void 0),e([u(U)],me.prototype,"frameOpacity",void 0),e([u(ye("drawingInfo.frameOutlineSymbol",$))],me.prototype,"frameOutlineSymbol",void 0),e([u({type:v})],me.prototype,"fullExtent",void 0),e([u({readOnly:!0})],me.prototype,"frameHorizonPoints",null),e([u({readOnly:!0,json:{read:{reader:B,source:"time"}},type:G})],me.prototype,"fullTimeExtent",void 0),e([u({readOnly:!0})],me.prototype,"groundControlPoints",null),e([u(P)],me.prototype,"id",void 0),e([u({type:v})],me.prototype,"initialExtent",void 0),e([u({readOnly:!0})],me.prototype,"isLive",null),e([u({type:d,json:{read:!1,origins:{service:{read:{source:"id"}}}}})],me.prototype,"layerId",void 0),e([u({readOnly:!0})],me.prototype,"livestreamStatus",null),e([u({type:Boolean})],me.prototype,"loop",null),e([u({readOnly:!0})],me.prototype,"metadata",null),e([u({readOnly:!0})],me.prototype,"mimeType",null),e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],me.prototype,"muted",null),e([u({type:["ArcGISVideoLayer"]})],me.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],me.prototype,"parsedUrl",null),e([u({type:M})],me.prototype,"playbackInfo",void 0),e([u({type:Number})],me.prototype,"playbackRate",null),e([u({readOnly:!0,type:String})],me.prototype,"playerUrl",null),e([u({readOnly:!0})],me.prototype,"playing",null),e([u({readOnly:!0,json:{read:{source:"poster"}}})],me.prototype,"posterUrl",void 0),e([u({readOnly:!0})],me.prototype,"qualities",void 0),e([u(pe)],me.prototype,"sensorSymbol",void 0),e([u(ye("drawingInfo.sensorSightLineSymbol",Z))],me.prototype,"sensorSightLineSymbol",void 0),e([u(ye("drawingInfo.sensorTrailSymbol",Z))],me.prototype,"sensorTrailSymbol",void 0),e([u({readOnly:!0})],me.prototype,"serviceItemId",void 0),e([u()],me.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],me.prototype,"sourceQuality",void 0),e([u({readOnly:!0,json:{name:"serviceType"}})],me.prototype,"sourceType",void 0),e([u()],me.prototype,"spatialReference",void 0),e([u({json:{write:!0}})],me.prototype,"start",void 0),e([u({readOnly:!0})],me.prototype,"started",null),e([u({readOnly:!0,type:String})],me.prototype,"state",null),e([u({readOnly:!0,type:V})],me.prototype,"telemetry",null),e([u({type:F,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],me.prototype,"telemetryDisplay",void 0),e([c("service","title",["name"])],me.prototype,"readTitleFromService",null),e([u({readOnly:!0})],me.prototype,"type",void 0),e([u(N())],me.prototype,"url",void 0),e([u({readOnly:!0,type:Number,json:{read:{source:"currentVersion"}}})],me.prototype,"version",void 0),e([u({readOnly:!0})],me.prototype,"videoElement",null),e([u({readOnly:!0})],me.prototype,"videoHeight",null),e([u({readOnly:!0,json:{read:!1}})],me.prototype,"videoLayersInfo",void 0),e([c("service","videoLayersInfo",["id","name","poster","serviceType","type"])],me.prototype,"readLayerInfosFromService",null),e([u({type:G,readOnly:!0})],me.prototype,"videoTimeExtent",null),e([u({readOnly:!0})],me.prototype,"videoWidth",null),e([u()],me.prototype,"volume",null),e([u({readOnly:!0})],me.prototype,"waiting",null),me=e([h("esri.layers.VideoLayer")],me);const ue=me;export{ue as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import r from"../request.js";import{deprecatedProperty as o}from"../core/deprecate.js";import i from"../core/Error.js";import s from"../core/Logger.js";import{clamp as l}from"../core/mathUtils.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as p,initial as y,whenOnce as m}from"../core/reactiveUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import{Integer as d}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as f}from"../core/accessorSupport/PropertyOrigin.js";import v from"../geometry/Extent.js";import g from"../geometry/Polyline.js";import S from"../geometry/SpatialReference.js";import b from"./Layer.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as O,effectProperty as T}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{titleFromUrlAndName as x}from"./support/arcgisLayerUrl.js";import{opacity as U,id as P}from"./support/commonProperties.js";import{normalizeParsedUrlObject as E,urlProperty as N}from"./support/multiLayerServiceUtils.js";import M from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as k}from"./support/serviceCapabilitiesUtils.js";import V from"./support/TelemetryData.js";import F from"./support/TelemetryDisplay.js";import R from"./support/VideoFrame.js";import G from"./support/VideoTimeExtent.js";import J from"./video/VideoController.js";import{getFrameHorizonPoints as A,getGroundControlPoints as H,getTelemetryData as z,getServiceLayersInfo as q,getStyledTelemetrySymbol as D,getSensorTrailPoints as _,readVideoTimeExtent as B}from"./video/videoUtils.js";import W from"../symbols/CIMSymbol.js";import Q from"../symbols/PictureMarkerSymbol.js";import $ from"../symbols/SimpleFillSymbol.js";import Z from"../symbols/SimpleLineSymbol.js";import K from"../symbols/SimpleMarkerSymbol.js";import X from"../symbols/Symbol.js";import{write as Y}from"../symbols/support/jsonUtils.js";function ee(e,t){return{ignoreOrigin:this.originIdOf(t)<f.PORTAL_ITEM}}let te=[];const re=new t([255,127,0]),oe=new t([0,0,0,.05]),ie=new K({angle:0,color:re,size:10,style:"cross"}),se=new $({color:oe,outline:new Z({color:re,width:2})}),le=new Z({color:re,width:1}),ne=new K({angle:0,color:re,outline:{color:[255,255,255],width:1.33},size:10,style:"circle"}),ae=new Z({color:re,width:1}),pe={types:{base:X,key:"type",typeMap:{"simple-marker":K,"picture-marker":Q,cim:W}},json:{name:"drawingInfo.sensorSymbol",write:{writer:Y,overridePolicy:ee}}};function ye(e,t){return{type:t,json:{name:e,write:{overridePolicy:ee}}}}let me=class extends(O(C(j(I(L(n(w(b)))))))){constructor(e){super(e),this.capabilities=null,this.codecs=null,this.connectionInfo=null,this.controller=new J,this.copyright=null,this.created=null,this.customParameters=null,this.description=null,this.elevationSource=null,this.frame=null,this.frameCenterSymbol=ie.clone(),this.frameCount=null,this.frameEffect=null,this.frameOpacity=1,this.frameOutlineSymbol=se.clone(),this.fullExtent=null,this.initialExtent=null,this.layerId=null,this.operationalLayerType="ArcGISVideoLayer",this.playbackInfo=null,this.posterUrl=null,this.qualities=null,this.sensorSymbol=ne.clone(),this.sensorSightLineSymbol=le.clone(),this.sensorTrailSymbol=ae.clone(),this.serviceItemId=null,this.sourceJSON=null,this.sourceQuality=null,this.sourceType=null,this.spatialReference=S.WGS84,this.start=0,this.telemetryDisplay=new F,this.type="video",this.url=null,this.version=null,this.videoLayersInfo=null}initialize(){this.addHandles([p((()=>this.metadata),(()=>{this.notifyChange("telemetry"),this.notifyChange("groundControlPoints"),this.notifyChange("frameHorizonPoints")})),p((()=>this.telemetry?.sensorLocation),(e=>this._setSensorTrail(e)),y)]),m((()=>this.loaded&&"can-play"===this.state&&this.duration>0)).then((()=>{this.start>=0&&this.start<=this.duration&&this.setCurrentTime(this.start)}))}destroy(){this.removeAllHandles(),this.controller&&this.controller.destroy()}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Video Service"],supportsData:!1},e).catch(a).then((()=>this._fetchService(t)));return this.addResolvingPromise(r),Promise.resolve(this)}get autoplay(){return this.controller?.autoplay??!1}set autoplay(e){this.controller.autoplay=e}get buffered(){return this.controller.buffered}readCapabilitiesFromService(e,t){return k(t)}readConnectionInfo(e,t){const r=Object.values(t.connectionUrl);return r?.length&&(this.controller.playerUrl=r[0]),t.connectionUrl}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get frameHorizonPoints(){return A(this.metadata)}get groundControlPoints(){return H(this.metadata)}get isLive(){return this.controller?.isLive??!1}get livestreamStatus(){return this.controller?.livestreamStatus}get loop(){return this.controller.loop}set loop(e){this.controller.loop=e}get metadata(){return this.controller?.currentMetadata}get mimeType(){return this.controller?.mimeType}get muted(){return this.controller.muted}set muted(e){this.controller.muted=e}get parsedUrl(){return E(this)}get playbackRate(){return this.controller.rate}set playbackRate(e){this.controller.rate=e}get playerUrl(){return this.controller.playerUrl}get playing(){return this.controller.playing}get started(){return this.controller?.started??!1}get state(){return this.controller.state}get telemetry(){return z(this.metadata)}readTitleFromService(e,{name:t}){return this.url?x(this.url,t):t}get videoElement(){return this.controller?.element}get videoHeight(){return this.controller?.videoHeight}readLayerInfosFromService(e,t){return q(t)}get videoTimeExtent(){return o(s.getLogger(this),"videoTimeExtent",{replacement:"fullTimeExtent",version:"4.33",warnOnce:!0}),this.fullTimeExtent}get videoWidth(){return this.controller?.videoWidth}get volume(){return this.controller?.volume??0}set volume(e){this.controller.volume=e}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){te=[],this.controller.reset()}setCurrentTime(e){if(this.duration<0)return;const t=l(e,0,this.duration);this.controller.setCurrentTime(t)}toGround(e,t){return this.controller?.sensorModel?.metadataSupportsTransforms?this.controller.sensorModel.transformImageToGeo(e,t):null}toVideo(e){if(!this.controller?.sensorModel?.metadataSupportsTransforms)return null;const t=this.controller.sensorModel.transformGeoToImage(e.x,e.y,e.z);return{x:t[0],y:t[1]}}updateTelemetryColor(e){this.frameCenterSymbol=D(this.frameCenterSymbol,e)??ie,this.frameOutlineSymbol=D(this.frameOutlineSymbol,e,oe)??se,this.sensorSightLineSymbol=D(this.sensorSightLineSymbol,e)??le,this.sensorTrailSymbol=D(this.sensorTrailSymbol,e)??ae,this.sensorSymbol=D(this.sensorSymbol,e)??ne}write(e,t){return null==this.layerId?(t?.messages?.push(new i("layer:unsupported",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' cannot be saved to a web map, web scene, or portal item. The ArcGIS server version must be greater than 11.2.`)),null):super.write(e,t)}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:o}=await r(this.url,{query:{f:"json",...this.parsedUrl.query,...this.customParameters},signal:e});if(o&&(this.url=this.url.replace(/^http:/i,"https:")),!t?.currentVersion)return t.currentVersion="11.2",this.sourceJSON=t,void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});if(this.layerId??=t.layers?.[0]?.id??null,null==this.layerId)throw new i("arcgis-layers:url-mismatch","The url is not a valid arcgis resource");const{data:s}=await r(this.parsedUrl.path,{query:{f:"json",...this.customParameters},signal:e});this.sourceJSON={...t,...s},this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl})}_setSensorTrail(e){if(!e)return;const t=_(e,te);te=[...t];const r=te.map((e=>e.toArray())),o=new g({hasZ:e.hasZ,paths:[r]});this.telemetry.sensorTrail=o.clone()}};e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],me.prototype,"autoplay",null),e([u({readOnly:!0})],me.prototype,"buffered",null),e([u({readOnly:!0})],me.prototype,"cameraInfo",void 0),e([u({readOnly:!0,json:{read:!1}})],me.prototype,"capabilities",void 0),e([c("service","capabilities",["supportsAppend","supportsCoverageQuery","supportsExportClip","supportsExportFrameset","supportsMensuration","supportsPreviews","supportsUpdate"])],me.prototype,"readCapabilitiesFromService",null),e([u({readOnly:!0})],me.prototype,"codecs",void 0),e([u({readOnly:!0})],me.prototype,"connectionInfo",void 0),e([c("connectionInfo",["connectionUrl"])],me.prototype,"readConnectionInfo",null),e([u()],me.prototype,"controller",void 0),e([u({type:String})],me.prototype,"copyright",void 0),e([u({readOnly:!0,type:Date})],me.prototype,"created",void 0),e([u({type:Number})],me.prototype,"currentTime",null),e([u({json:{write:!1}})],me.prototype,"customParameters",void 0),e([u({type:String})],me.prototype,"description",void 0),e([u({type:Number})],me.prototype,"duration",null),e([u({readOnly:!0})],me.prototype,"elevationSource",void 0),e([u({type:Boolean})],me.prototype,"ended",null),e([u({type:R})],me.prototype,"frame",void 0),e([u(ye("drawingInfo.frameCenterSymbol",K))],me.prototype,"frameCenterSymbol",void 0),e([u({readOnly:!0,type:d})],me.prototype,"frameCount",void 0),e([u(T)],me.prototype,"frameEffect",void 0),e([u(U)],me.prototype,"frameOpacity",void 0),e([u(ye("drawingInfo.frameOutlineSymbol",$))],me.prototype,"frameOutlineSymbol",void 0),e([u({type:v})],me.prototype,"fullExtent",void 0),e([u({readOnly:!0})],me.prototype,"frameHorizonPoints",null),e([u({readOnly:!0,json:{read:{reader:B,source:"time"}},type:G})],me.prototype,"fullTimeExtent",void 0),e([u({readOnly:!0})],me.prototype,"groundControlPoints",null),e([u(P)],me.prototype,"id",void 0),e([u({type:v})],me.prototype,"initialExtent",void 0),e([u({readOnly:!0})],me.prototype,"isLive",null),e([u({type:d,json:{read:!1,origins:{service:{read:{source:"id"}}}}})],me.prototype,"layerId",void 0),e([u({readOnly:!0})],me.prototype,"livestreamStatus",null),e([u({type:Boolean})],me.prototype,"loop",null),e([u({readOnly:!0})],me.prototype,"metadata",null),e([u({readOnly:!0})],me.prototype,"mimeType",null),e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],me.prototype,"muted",null),e([u({type:["ArcGISVideoLayer"]})],me.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],me.prototype,"parsedUrl",null),e([u({type:M})],me.prototype,"playbackInfo",void 0),e([u({type:Number})],me.prototype,"playbackRate",null),e([u({readOnly:!0,type:String})],me.prototype,"playerUrl",null),e([u({readOnly:!0})],me.prototype,"playing",null),e([u({readOnly:!0,json:{read:{source:"poster"}}})],me.prototype,"posterUrl",void 0),e([u({readOnly:!0})],me.prototype,"qualities",void 0),e([u(pe)],me.prototype,"sensorSymbol",void 0),e([u(ye("drawingInfo.sensorSightLineSymbol",Z))],me.prototype,"sensorSightLineSymbol",void 0),e([u(ye("drawingInfo.sensorTrailSymbol",Z))],me.prototype,"sensorTrailSymbol",void 0),e([u({readOnly:!0})],me.prototype,"serviceItemId",void 0),e([u()],me.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],me.prototype,"sourceQuality",void 0),e([u({readOnly:!0,json:{name:"serviceType"}})],me.prototype,"sourceType",void 0),e([u()],me.prototype,"spatialReference",void 0),e([u({json:{write:!0}})],me.prototype,"start",void 0),e([u({readOnly:!0})],me.prototype,"started",null),e([u({readOnly:!0,type:String})],me.prototype,"state",null),e([u({readOnly:!0,type:V})],me.prototype,"telemetry",null),e([u({type:F,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],me.prototype,"telemetryDisplay",void 0),e([c("service","title",["name"])],me.prototype,"readTitleFromService",null),e([u({readOnly:!0})],me.prototype,"type",void 0),e([u(N())],me.prototype,"url",void 0),e([u({readOnly:!0,type:Number,json:{read:{source:"currentVersion"}}})],me.prototype,"version",void 0),e([u({readOnly:!0})],me.prototype,"videoElement",null),e([u({readOnly:!0})],me.prototype,"videoHeight",null),e([u({readOnly:!0,json:{read:!1}})],me.prototype,"videoLayersInfo",void 0),e([c("service","videoLayersInfo",["id","name","poster","serviceType","type"])],me.prototype,"readLayerInfosFromService",null),e([u({type:G,readOnly:!0})],me.prototype,"videoTimeExtent",null),e([u({readOnly:!0})],me.prototype,"videoWidth",null),e([u()],me.prototype,"volume",null),e([u({readOnly:!0})],me.prototype,"waiting",null),me=e([h("esri.layers.VideoLayer")],me);const ue=me;export{ue as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clone as e}from"../../../core/lang.js";import{polygonCentroid as t,extentCentroid as i}from"../../../geometry/support/centroid.js";import{getPolygonExtent as s,getGeometryExtent as a}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}from"../../../geometry/support/quantizationUtils.js";import{isValid as n,equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import l from"./AttributesBuilder.js";import{cleanFromGeometryEngine as u,getGeometry as c,transformCentroid as m}from"./geometryUtils.js";import{project as d}from"./projectionSupport.js";import{getDateInNumber as h}from"./queryUtils.js";import{makeEdgeCandidate as p,makeVertexCandidate as f}from"./SnappingCandidate.js";import{isDateField as y,isDateOnlyField as g,isTimestampOffsetField as x,isStringField as T,isTimeOnlyField as I}from"../../support/fieldUtils.js";import F from"../../../rest/support/AutoIntervalBinParameters.js";import _ from"../../../rest/support/DateBinParameters.js";import{unitsDict as V}from"../../../rest/support/DateBinUtils.js";import b from"../../../rest/support/FixedBoundariesBinParameters.js";import v from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as S,calculateStringStatistics as R,calculateStatistics as B,processSummaryStatisticsResult as z,calculateUniqueValuesCount as A,createUVResult as M,calculateClassBreaks as w,resolveCBResult as D,calculateHistogram as P,getAttributeComparator as N,calculatePercentile as q,binIndex as Z,getBinParams as j}from"../../../statistics/utils.js";import{DateTime as G}from"luxon";const C="bin";class E{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new l(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;n(this.query.outSR)&&!o(t.spatialReference,this.query.outSR)?e.queryGeometry=u({spatialReference:this.query.outSR,...d(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=u({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,a=H(this.hasZ,this.hasM),{point:r,mode:n}=e,o="number"==typeof e.distance?e.distance:e.distance.x,l="number"==typeof e.distance?e.distance:e.distance.y,u={candidates:[]},c="esriGeometryPolygon"===this.geometryType,m="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,d=this._getPointCreator(n,t,this.spatialReference,i),h=new U(null,0),y=new U(null,0),g={x:0,y:0,z:0};for(const x of this.items){const t=s.getGeometry(x);if(null==t)continue;const{coords:i}=t,n=t.isPoint?Q:t.lengths;if(h.coords=i,y.coords=i,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const i=n[t],m=e;for(let t=0;t<i;t++,e+=a){if(!c&&t===i-1)continue;const n=h;n.coordsIndex=e;const f=y;f.coordsIndex=t===i-1?m:e+a;const T=g;if(!O(g,r,n,f))continue;const I=(r.x-T.x)/o,F=(r.y-T.y)/l,_=I*I+F*F;_<=1&&u.candidates.push(p(s.getObjectId(x),d(T),Math.sqrt(_),d(n),d(f)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const i=n[t],m=e,p=y;p.coordsIndex=m;for(let t=0;t<i;t++,e+=a){const a=h;if(a.coordsIndex=e,c&&t===i-1&&a.x===p.x&&a.y===p.y)continue;const n=(r.x-a.x)/o,m=(r.y-a.y)/l,y=n*n+m*m;y<=1&&u.candidates.push(f(s.getObjectId(x),d(a),Math.sqrt(y)))}}}else if(m&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<n.length;i++){t.push(e);const s=n[i];e+=s*a,!c&&s>1&&t.push(e-a)}for(const i of t){const e=h;e.coordsIndex=i;const t=(r.x-e.x)/o,a=(r.y-e.y)/l,n=t*t+a*a;n<=1&&u.candidates.push(f(s.getObjectId(x),d(e),Math.sqrt(n)))}}}return u.candidates.sort(((e,t)=>e.distance-t.distance)),u}_getPointCreator(e,t,i,s){const a=null==s||o(i,s)?e=>e:e=>d(e,i,s),{hasZ:r}=this,n=0;return"3d"===e?r&&t?({x:e,y:t,z:i})=>a({x:e,y:t,z:i}):({x:e,y:t})=>a({x:e,y:t,z:n}):({x:e,y:t})=>a({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=y(m)||g(m)||x(m),h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=S({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),f={value:.5,fieldType:m?.type},I=T(m)?R({values:h,supportsNullCount:p,percentileParams:f,outStatisticTypes:c}):B({values:h,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:f,outStatisticTypes:c});return z(I,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=A(o);return M(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=w(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return D(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return P(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const t=s.split(" "),a=t[0],r=this.fieldsIndex.get(a),n=!!t[1]&&"desc"===t[1].toLowerCase(),o=N(r?.type,n);e.sort(((e,t)=>{const s=i(e,a,r),n=i(t,a,r);return o(s,n)}))}}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:c,quantizationParameters:m,resultRecordCount:d,resultOffset:h,returnZ:p,returnM:f}=e,y=null!=d&&t.length>(h||0)+d,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&f,hasZ:a&&p,objectIdFieldName:n,spatialReference:u(c||o),transform:m&&r(m)||null}}_createFeatures(e,t){const i=new l(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:u,returnCentroid:d,maxAllowableOffset:h,resultOffset:p,resultRecordCount:f,returnZ:y=!1,returnM:g=!1}=e,x=a&&y,T=s&&g;let I=[],F=0;const _=[...t];if(this._sortFeatures(_,n,((e,t,s)=>i.getFieldValue(e,t,s))),this.geometryType&&(u||d)){const e=r(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(u&&!d)for(const s of _){const a=this.featureAdapter.getGeometry(s),r={attributes:i.getAttributes(s),geometry:c(this.geometryType,this.hasZ,this.hasM,a,h,e,x,T),metadata:this.featureAdapter.getMetadata?.(s)};t&&a&&!r.geometry&&(r.centroid=m(this,this.featureAdapter.getCentroid(s,this),e)),I[F++]=r}else if(!u&&d)for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:m(this,this.featureAdapter.getCentroid(s,this),e)};else for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:m(this,this.featureAdapter.getCentroid(s,this),e),geometry:c(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(s),h,e,x,T),metadata:this.featureAdapter.getMetadata?.(s)}}else for(const r of _){const e=i.getAttributes(r);e&&(I[F++]={attributes:e})}const V=p||0;if(null!=f){const e=V+f;I=I.slice(V,Math.min(I.length,e))}return I}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{const t=H(this.hasZ,this.hasM),i=this.featureAdapter;e=this.items.reduce(((e,t)=>{const s=i.getGeometry(t);return e+(null!=s&&s.coords.length||0)}),0)/t>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,u=new l(e,this.featureAdapter,this.fieldsIndex),c=e.outStatistics,{groupByFieldsForStatistics:m,having:d,orderByFields:h,resultRecordCount:p}=e,f=m?.length,y=!!f,g=y?m[0]:null,x=y&&!this.fieldsIndex.get(g);for(const l of c??[]){const{outStatisticFieldName:e,statisticType:c}=l,h=l,p="exceedslimit"!==c?l.onStatisticField:void 0,I="percentile_disc"===c||"percentile_cont"===c,F="EnvelopeAggregate"===c||"CentroidAggregate"===c||"ConvexHullAggregate"===c,_=y&&1===f&&(p===g||x)&&"count"===c;if(y){if(!n.has(p)){const e=[];for(const i of m){const s=this._getAttributeValues(u,i,t,a);e.push(s)}n.set(p,this._calculateUniqueValues(e,t,!F&&u.returnDistinctValues))}const i=n.get(p);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:l,itemPositions:c}=i[r],f=n.join(",");if(!d||u.validateItems(l,d)){const i=o.get(f)||{attributes:{}};if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(h,l);i.aggregateGeometries[t]=e}else{let r=null;if(_)r=s;else{const e=this._getAttributeValues(u,p,t,a),i=c.map((t=>e[t]));r=I&&"statisticParameters"in h?this._getPercentileValue(h,i):this._getStatisticValue(h,i,null,u.returnDistinctValues)}i.attributes[e]=r}let r=0;m.forEach(((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t])),o.set(f,i)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(h,t);i.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(u,p,t,a);i.attributes[e]=I&&"statisticParameters"in h?this._getPercentileValue(h,s):this._getStatisticValue(h,s,r,u.returnDistinctValues)}const V="min"!==c&&"max"!==c||!T(this.fieldsIndex.get(p))&&!this._isAnyDateField(p)?null:this.fieldsIndex.get(p)?.type;s.push({name:e,alias:e,type:V||"esriFieldTypeDouble"})}const I=y?Array.from(o.values()):[i];return this._sortFeatures(I,h,((e,t)=>e.attributes[t])),p&&(I.length=Math.min(p,I.length)),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return y(t)||g(t)||x(t)||I(t)}async _getAggregateGeometry(e,r){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:m,spatialReference:d,geometryType:h,hasZ:p,hasM:f}=this,y=r.map((e=>c(h,p,f,m.getGeometry(e)))),g=n(d,y,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=g?s(g):a(o(d,y));x.aggregateGeometries={...e,spatialReference:d},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=g?t(g):i(a(o(d,y)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:d},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=g,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):T(this.fieldsIndex.get(a))||this._isAnyDateField(a)?R({values:t,returnDistinct:s}):B({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return q(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map((i=>e.getFieldValue(i,t,a)));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(t,i,s=!0){const a=new l(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:r,scale:n,timeZone:o}=t;return r?a.getExpressionValues(i,r,{viewingMode:"map",scale:n,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(i,e(t),s)}async _calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map((([e,t])=>({minValue:e,maxValue:t,count:0,items:[]})));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:C,alias:C,type:"esriFieldTypeInteger"}],o=new l(e,this.featureAdapter,this.fieldsIndex),u=new Map,c=[...this.items];this._sortFeatures(c,[i],((e,t,i)=>o.getFieldValue(e,t,i)));const m=this._getAttributeValues(o,i,c,u),d=this._calculateUniqueValues([m],c,o.returnDistinctValues);for(const l in d){const{items:t}=d[l],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map((e=>({...e,attributes:{...e.attributes,[s??i]:l}})))),a.fields)for(const e of a.fields)n.some((t=>t.name===e.name))||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(F.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(_.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(b.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(v.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=j(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:h(l,!1),maxValue:h(u,!1)}),d=await this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n}=e,o=a.unit,l=await this._getDataValues({field:e.field,timeZone:t.outTimeReference?.ianaTimeZone},i),u=I(this.fieldsIndex.get(s)),c=V.toJSON(o),m=l.filter(Boolean).sort(((e,t)=>e-t)),d=null!=r?h(r,u):m[0],p=null!=n?h(n,u):m[m.length-1],f=t.outTimeReference?.ianaTimeZone??"UTC";let y=G.fromMillis(d,{zone:f}).startOf(c);const g=G.fromMillis(p,{zone:f}),x=[];for(;y<g;){const e=y.plus({[c]:a.value});if(e>g){x.push([y.toMillis(),g.toMillis()]);break}x.push([y.toMillis(),e.toMillis()]),y=e}const T=await this._calculateHistogramBins(l,{intervals:x,min:d,max:p},i);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s,timeZone:t.outTimeReference?.ianaTimeZone},i),r=I(this.fieldsIndex.get(s)),n=e.boundaries.map((e=>h(e,r))).sort(((e,t)=>e-t)),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=await this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n}=e,o=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),l=I(this.fieldsIndex.get(s)),u=j(o,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:h(r,l),maxValue:h(n,l)},!0),c=await this._calculateHistogramBins(o,u,i);return this._createFeaturesFromHistogramBins(c,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:C,alias:C,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const h of e){const{minValue:e,maxValue:i,items:s}=h,p={attributes:{}};let f;if(p.attributes[a]=m&&d&&null!=e?G.fromMillis(e,{zone:d}).toISO():e,p.attributes[r]=m&&d&&null!=i?G.fromMillis(i,{zone:d}).toISO():i,l?(f=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),p.attributes[C]=++c,"flat"===t.bin.jsonStyle?n.push(...f.features.map((({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...p.attributes}:{...t,...p.attributes}})))):(p.stackedAttributes=f.features.map((({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t)),n.push(p))):(t.bin?.splitBy&&(p.attributes[C]=++c),f=await this._createStatisticsQueryResponse(t,s,p),n.push(p)),f.fields)for(const t of f.fields)o.some((e=>e.name===t.name))||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function O(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}function H(e,t){return e?t?4:3:t?3:2}class U{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const Q=[1];export{E as QueryEngineResult};
|
|
5
|
+
import{clone as e}from"../../../core/lang.js";import{polygonCentroid as t,extentCentroid as i}from"../../../geometry/support/centroid.js";import{getPolygonExtent as s,getGeometryExtent as a}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}from"../../../geometry/support/quantizationUtils.js";import{isValid as n,equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import l from"./AttributesBuilder.js";import{cleanFromGeometryEngine as u,getGeometry as c,transformCentroid as m}from"./geometryUtils.js";import{project as d}from"./projectionSupport.js";import{getDateInNumber as f}from"./queryUtils.js";import{makeEdgeCandidate as h,makeVertexCandidate as p}from"./SnappingCandidate.js";import{isDateField as y,isDateOnlyField as g,isTimestampOffsetField as x,isStringField as T,isTimeOnlyField as I}from"../../support/fieldUtils.js";import F from"../../../rest/support/AutoIntervalBinParameters.js";import _ from"../../../rest/support/DateBinParameters.js";import{unitsDict as V}from"../../../rest/support/DateBinUtils.js";import b from"../../../rest/support/FixedBoundariesBinParameters.js";import v from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as S,calculateStringStatistics as R,calculateStatistics as B,processSummaryStatisticsResult as z,calculateUniqueValuesCount as M,createUVResult as A,calculateClassBreaks as w,resolveCBResult as D,calculateHistogram as P,getAttributeComparator as N,calculatePercentile as q,binIndex as Z,getBinParams as j}from"../../../statistics/utils.js";import{utc as G}from"../../../time/constants.js";import{DateTime as C}from"luxon";const E="bin";class O{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new l(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;n(this.query.outSR)&&!o(t.spatialReference,this.query.outSR)?e.queryGeometry=u({spatialReference:this.query.outSR,...d(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=u({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,a=Q(this.hasZ,this.hasM),{point:r,mode:n}=e,o="number"==typeof e.distance?e.distance:e.distance.x,l="number"==typeof e.distance?e.distance:e.distance.y,u={candidates:[]},c="esriGeometryPolygon"===this.geometryType,m="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,d=this._getPointCreator(n,t,this.spatialReference,i),f=new U(null,0),y=new U(null,0),g={x:0,y:0,z:0};for(const x of this.items){const t=s.getGeometry(x);if(null==t)continue;const{coords:i}=t,n=t.isPoint?k:t.lengths;if(f.coords=i,y.coords=i,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const i=n[t],m=e;for(let t=0;t<i;t++,e+=a){if(!c&&t===i-1)continue;const n=f;n.coordsIndex=e;const p=y;p.coordsIndex=t===i-1?m:e+a;const T=g;if(!H(g,r,n,p))continue;const I=(r.x-T.x)/o,F=(r.y-T.y)/l,_=I*I+F*F;_<=1&&u.candidates.push(h(s.getObjectId(x),d(T),Math.sqrt(_),d(n),d(p)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const i=n[t],m=e,h=y;h.coordsIndex=m;for(let t=0;t<i;t++,e+=a){const a=f;if(a.coordsIndex=e,c&&t===i-1&&a.x===h.x&&a.y===h.y)continue;const n=(r.x-a.x)/o,m=(r.y-a.y)/l,y=n*n+m*m;y<=1&&u.candidates.push(p(s.getObjectId(x),d(a),Math.sqrt(y)))}}}else if(m&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<n.length;i++){t.push(e);const s=n[i];e+=s*a,!c&&s>1&&t.push(e-a)}for(const i of t){const e=f;e.coordsIndex=i;const t=(r.x-e.x)/o,a=(r.y-e.y)/l,n=t*t+a*a;n<=1&&u.candidates.push(p(s.getObjectId(x),d(e),Math.sqrt(n)))}}}return u.candidates.sort(((e,t)=>e.distance-t.distance)),u}_getPointCreator(e,t,i,s){const a=null==s||o(i,s)?e=>e:e=>d(e,i,s),{hasZ:r}=this,n=0;return"3d"===e?r&&t?({x:e,y:t,z:i})=>a({x:e,y:t,z:i}):({x:e,y:t})=>a({x:e,y:t,z:n}):({x:e,y:t})=>a({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=y(m)||g(m)||x(m),f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),h=S({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),p={value:.5,fieldType:m?.type},I=T(m)?R({values:f,supportsNullCount:h,percentileParams:p,outStatisticTypes:c}):B({values:f,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:h,percentileParams:p,outStatisticTypes:c});return z(I,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=M(o);return A(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),h=w(f,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return D(h,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return P(f,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const t=s.split(" "),a=t[0],r=this.fieldsIndex.get(a),n=!!t[1]&&"desc"===t[1].toLowerCase(),o=N(r?.type,n);e.sort(((e,t)=>{const s=i(e,a,r),n=i(t,a,r);return o(s,n)}))}}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:c,quantizationParameters:m,resultRecordCount:d,resultOffset:f,returnZ:h,returnM:p}=e,y=null!=d&&t.length>(f||0)+d,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&p,hasZ:a&&h,objectIdFieldName:n,spatialReference:u(c||o),transform:m&&r(m)||null}}_createFeatures(e,t){const i=new l(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:u,returnCentroid:d,maxAllowableOffset:f,resultOffset:h,resultRecordCount:p,returnZ:y=!1,returnM:g=!1}=e,x=a&&y,T=s&&g;let I=[],F=0;const _=[...t];if(this._sortFeatures(_,n,((e,t,s)=>i.getFieldValue(e,t,s))),this.geometryType&&(u||d)){const e=r(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(u&&!d)for(const s of _){const a=this.featureAdapter.getGeometry(s),r={attributes:i.getAttributes(s),geometry:c(this.geometryType,this.hasZ,this.hasM,a,f,e,x,T),metadata:this.featureAdapter.getMetadata?.(s)};t&&a&&!r.geometry&&(r.centroid=m(this,this.featureAdapter.getCentroid(s,this),e)),I[F++]=r}else if(!u&&d)for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:m(this,this.featureAdapter.getCentroid(s,this),e)};else for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:m(this,this.featureAdapter.getCentroid(s,this),e),geometry:c(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(s),f,e,x,T),metadata:this.featureAdapter.getMetadata?.(s)}}else for(const r of _){const e=i.getAttributes(r);e&&(I[F++]={attributes:e})}const V=h||0;if(null!=p){const e=V+p;I=I.slice(V,Math.min(I.length,e))}return I}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{const t=Q(this.hasZ,this.hasM),i=this.featureAdapter;e=this.items.reduce(((e,t)=>{const s=i.getGeometry(t);return e+(null!=s&&s.coords.length||0)}),0)/t>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,u=new l(e,this.featureAdapter,this.fieldsIndex),c=e.outStatistics,{groupByFieldsForStatistics:m,having:d,orderByFields:f,resultRecordCount:h}=e,p=m?.length,y=!!p,g=y?m[0]:null,x=y&&!this.fieldsIndex.get(g);for(const l of c??[]){const{outStatisticFieldName:e,statisticType:c}=l,f=l,h="exceedslimit"!==c?l.onStatisticField:void 0,I="percentile_disc"===c||"percentile_cont"===c,F="EnvelopeAggregate"===c||"CentroidAggregate"===c||"ConvexHullAggregate"===c,_=y&&1===p&&(h===g||x)&&"count"===c;if(y){if(!n.has(h)){const e=[];for(const i of m){const s=this._getAttributeValues(u,i,t,a);e.push(s)}n.set(h,this._calculateUniqueValues(e,t,!F&&u.returnDistinctValues))}const i=n.get(h);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:l,itemPositions:c}=i[r],p=n.join(",");if(!d||u.validateItems(l,d)){const i=o.get(p)||{attributes:{}};if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(f,l);i.aggregateGeometries[t]=e}else{let r=null;if(_)r=s;else{const e=this._getAttributeValues(u,h,t,a),i=c.map((t=>e[t]));r=I&&"statisticParameters"in f?this._getPercentileValue(f,i):this._getStatisticValue(f,i,null,u.returnDistinctValues)}i.attributes[e]=r}let r=0;m.forEach(((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t])),o.set(p,i)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(f,t);i.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(u,h,t,a);i.attributes[e]=I&&"statisticParameters"in f?this._getPercentileValue(f,s):this._getStatisticValue(f,s,r,u.returnDistinctValues)}const V="min"!==c&&"max"!==c||!T(this.fieldsIndex.get(h))&&!this._isAnyDateField(h)?null:this.fieldsIndex.get(h)?.type;s.push({name:e,alias:e,type:V||"esriFieldTypeDouble"})}const I=y?Array.from(o.values()):[i];return this._sortFeatures(I,f,((e,t)=>e.attributes[t])),h&&(I.length=Math.min(h,I.length)),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return y(t)||g(t)||x(t)||I(t)}async _getAggregateGeometry(e,r){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:m,spatialReference:d,geometryType:f,hasZ:h,hasM:p}=this,y=r.map((e=>c(f,h,p,m.getGeometry(e)))),g=n(d,y,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=g?s(g):a(o(d,y));x.aggregateGeometries={...e,spatialReference:d},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=g?t(g):i(a(o(d,y)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:d},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=g,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):T(this.fieldsIndex.get(a))||this._isAnyDateField(a)?R({values:t,returnDistinct:s}):B({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return q(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map((i=>e.getFieldValue(i,t,a)));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(t,i,s=!0){const a=new l(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:r,scale:n,timeZone:o}=t;return r?a.getExpressionValues(i,r,{viewingMode:"map",scale:n,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(i,e(t),s)}async _calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map((([e,t])=>({minValue:e,maxValue:t,count:0,items:[]})));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:E,alias:E,type:"esriFieldTypeInteger"}],o=new l(e,this.featureAdapter,this.fieldsIndex),u=new Map,c=[...this.items];this._sortFeatures(c,[i],((e,t,i)=>o.getFieldValue(e,t,i)));const m=this._getAttributeValues(o,i,c,u),d=this._calculateUniqueValues([m],c,o.returnDistinctValues);for(const l in d){const{items:t}=d[l],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map((e=>({...e,attributes:{...e.attributes,[s??i]:l}})))),a.fields)for(const e of a.fields)n.some((t=>t.name===e.name))||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(F.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(_.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(b.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(v.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=j(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:f(l,!1),maxValue:f(u,!1)}),d=await this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n,snapToData:o,returnFullIntervalBin:l}=e,u=a.unit,c=await this._getDataValues({field:e.field,timeZone:t.outTimeReference?.ianaTimeZone},i),m=I(this.fieldsIndex.get(s)),d=V.toJSON(u),h=c.filter(Boolean).sort(((e,t)=>e-t)),p=null!=r?f(r,m):h[0],y=null!=n?f(n,m):h[h.length-1],g={zone:t.outTimeReference?.ianaTimeZone??G},x=C.fromMillis(p,g),T=C.fromMillis(y,g),F=[];if("last"===o){let e=T;for(;e>x;){const t=e.minus({[d]:a.value});if(t<x){F.unshift([l?t.toMillis():x.toMillis(),e.toMillis()]);break}F.unshift([t.toMillis(),e.toMillis()]),e=t}}else{let e="first"===o?x:x.startOf(d);for(;e<=T;){const t=e.plus({[d]:a.value});if(t>T){F.push([e.toMillis(),l?t.toMillis():T.toMillis()]);break}F.push([e.toMillis(),t.toMillis()]),e=t}}const _=await this._calculateHistogramBins(c,{intervals:F,min:p,max:y},i);return this._createFeaturesFromHistogramBins(_,t)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s,timeZone:t.outTimeReference?.ianaTimeZone},i),r=I(this.fieldsIndex.get(s)),n=e.boundaries.map((e=>f(e,r))).sort(((e,t)=>e-t)),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=await this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n}=e,o=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),l=I(this.fieldsIndex.get(s)),u=j(o,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:f(r,l),maxValue:f(n,l)},!0),c=await this._calculateHistogramBins(o,u,i);return this._createFeaturesFromHistogramBins(c,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:E,alias:E,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const f of e){const{minValue:e,maxValue:i,items:s}=f,h={attributes:{}};let p;if(h.attributes[a]=m&&d&&null!=e?C.fromMillis(e,{zone:d}).toISO():e,h.attributes[r]=m&&d&&null!=i?C.fromMillis(i,{zone:d}).toISO():i,l?(p=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),h.attributes[E]=++c,"flat"===t.bin.jsonStyle?n.push(...p.features.map((({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...h.attributes}:{...t,...h.attributes}})))):(h.stackedAttributes=p.features.map((({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t)),n.push(h))):(t.bin?.splitBy&&(h.attributes[E]=++c),p=await this._createStatisticsQueryResponse(t,s,h),n.push(h)),p.fields)for(const t of p.fields)o.some((e=>e.name===t.name))||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function H(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}function Q(e,t){return e?t?4:3:t?3:2}class U{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const k=[1];export{O as QueryEngineResult};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import{clone as r}from"../../core/lang.js";import i from"../../core/Logger.js";import{hasSameOrigin as o,getHost as s,changeHost as n}from"../../core/urlUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as u}from"../../core/accessorSupport/layerContainerType.js";import{OriginId as c,idToName as y}from"../../core/accessorSupport/PropertyOrigin.js";import f from"../../geometry/Extent.js";import m from"../../geometry/HeightModelInfo.js";import h from"../../geometry/SpatialReference.js";import{sanitizeUrlWithLayerId as v,writeUrlWithLayerId as g}from"../support/arcgisLayerUrl.js";import{elevationInfo as I,maxScale as F,minScale as S,url as j}from"../support/commonProperties.js";import b from"../support/EditFieldsInfo.js";import{FeatureIndex as E}from"../support/FeatureIndex.js";import{geometryTypeKebabDict as U,hasCurrentUser as x,isLayerCacheStale as O,supportsQueryOnly as D,readGlobalIdField as M,readObjectIdField as T,readVersion as w}from"../support/featureLayerUtils.js";import R from"../support/GeometryFieldsInfo.js";import C from"../support/LayerFloorInfo.js";import{isPreferredUrlApplicable as B,getPreferredUrl as H,applyPreferredHostToPortalItem as A,getPreferredHost as Q}from"../support/layerUtils.js";import P from"../support/Relationship.js";import{getFeatureLayerCapabilities as q}from"../support/serviceCapabilitiesUtils.js";import V from"../support/Subtype.js";import{hasTypeKeyword as _,typeKeyword as G}from"../../portal/support/portalItemUtils.js";import{timeZoneProperty as Z}from"../../time/timeZoneUtils.js";const k=k=>{let L=class extends k{constructor(){super(...arguments),this.copyright=null,this.capabilities=null,this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.definitionExpression=null,this.displayField=null,this.editFieldsInfo=null,this.editingInfo=null,this.elevationInfo=null,this.fieldsIndex=null,this.floorInfo=null,this.fullExtent=null,this.gdbVersion=null,this.geometryFieldsInfo=null,this.geometryType=null,this.globalIdField=null,this.hasM=void 0,this.hasZ=void 0,this.heightModelInfo=null,this.historicMoment=null,this.indexes=new(t.ofType(E)),this.isTable=!1,this.layerId=void 0,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.preferredTimeZone=null,this.relationships=null,this.returnM=void 0,this.returnZ=void 0,this.serviceDefinitionExpression=null,this.serviceItemId=null,this.sourceJSON=null,this.spatialReference=h.WGS84,this.subtypeField=null,this.subtypes=null,this.trackIdField=null,this.uniqueIdFields=null,this.version=void 0,this._isUrlHostModified=!1}getFieldDomain(){throw new Error("Not implemented")}getField(e){return this.fieldsIndex.get(e)}get authenticationTriggerEvent(){if(!this.url)return null;const{capabilities:e}=this;if(e){const{query:t,operations:r,editing:i}=e;if(!t.supportsQueryByOthers||!t.supportsQueryByAnonymous)return"load";if(r.supportsEditing&&!(i.supportsUpdateByOthers&&i.supportsUpdateByAnonymous&&i.supportsDeleteByOthers&&i.supportsDeleteByAnonymous))return"load"}if(x(this.serviceDefinitionExpression)||x(this.definitionExpression))return"load";if(this.userHasUpdateItemPrivileges){if(O(this))return"load";if(this.hasUpdateItemRestrictions)return e.operations.supportsQuery?"editing":"load"}if(this.userHasFullEditingPrivileges&&this.hasFullEditingRestrictions)return"editing";const t=this.editFieldsInfo;return(t?.creatorField||t?.editorField)&&e?.operations.supportsEditing?"editing":null}readCapabilitiesFromService(e,t){return q(t,this.url)}readEditingInfo(e,t){const{editingInfo:r}=t;return r?{lastEditDate:null!=r.lastEditDate?new Date(r.lastEditDate):null}:null}get effectiveCapabilities(){const e=this.capabilities;if(!e)return null;const t=r(e),{operations:i,editing:o}=t;return D(this)?(this.userHasUpdateItemPrivileges&&(i.supportsQuery=!0),t):this.userHasUpdateItemPrivileges?(i.supportsAdd=i.supportsDelete=i.supportsEditing=i.supportsQuery=i.supportsUpdate=o.supportsDeleteByOthers=o.supportsGeometryUpdate=o.supportsUpdateByOthers=!0,t):(this.userHasFullEditingPrivileges&&i.supportsEditing&&(i.supportsAdd=i.supportsDelete=i.supportsUpdate=o.supportsGeometryUpdate=!0),t)}get effectiveEditingEnabled(){return!1}readGlobalIdFieldFromService(e,t){return M(t)}get hasFullEditingRestrictions(){const e=this.capabilities;if(!e||D(this))return!1;const{operations:t,editing:r}=e;return t.supportsEditing&&!(t.supportsAdd&&t.supportsDelete&&t.supportsUpdate&&r.supportsGeometryUpdate)}get hasUpdateItemRestrictions(){const e=this.capabilities;if(!e)return!1;const{operations:t,editing:r}=e;return D(this)?!t.supportsQuery:!(t.supportsAdd&&t.supportsDelete&&t.supportsEditing&&t.supportsQuery&&t.supportsUpdate&&r.supportsDeleteByOthers&&r.supportsGeometryUpdate&&r.supportsUpdateByOthers)}readIsTableFromService(e,t){return"Table"===t.type}readMaxScale(e,t){return t.effectiveMaxScale||e||0}readMinScale(e,t){return t.effectiveMinScale||e||0}readObjectIdFieldFromService(e,t){return T(t)}readServiceDefinitionExpression(e,t){return t.definitionQuery||t.definitionExpression}readUniqueIdFields(e,t){return t.uniqueIdInfo?.OIDFieldContainsHashValue?t.uniqueIdInfo.fields:null}set url(e){if(null==e)return void this._set("url",e);const t=v({layer:this,url:e,nonStandardUrlAllowed:!0,logger:i.getLogger(this)});this._set("url",t.url),null!=t.layerId&&this._set("layerId",t.layerId)}writeUrl(e,t,r,i){g(this,e,null,t,i)}readVersion(e,t){return w(t)}get isUrlHostModified(){const{loaded:e,url:t,_isUrlHostModified:r}=this;if(r)return!0;if(!e||!t)return!1;if(this.originIdOf("url")<c.USER)return!1;const i=this.sourceJSON?.preferredHost;if(!i)return!1;if(!o(t,`https://${i}`,!0))return!1;for(let s=c.USER-1;s>=c.PORTAL_ITEM;s--){const e=this.getAtOrigin("url",y(s));if(e)return!o(t,e,!0)}return!1}applyPreferredHost(e){const{url:t,portalItem:r}=this;if(!t||!B(r))return;const i=H(t,e);i&&(this._set("url",i),this._isUrlHostModified=!0,r&&A(r,Q(e)))}applyHostFromPortalItem(){const{url:e,portalItem:t}=this;if(!e||this.originIdOf("url")===c.USER||!t?.url||!B(t)||!_(t,G.HOSTED_SERVICE)||o(e,t.url,!0))return;const r=s(t.url);this._set("url",n(e,r)),this._isUrlHostModified=!0}};return e([p({readOnly:!0})],L.prototype,"authenticationTriggerEvent",null),e([p({type:String,json:{origins:{service:{read:{source:"copyrightText"}}}}})],L.prototype,"copyright",void 0),e([p({readOnly:!0,json:{read:!1,origins:{service:{read:{source:["advancedQueryCapabilities","allowGeometryUpdates","allowUpdateWithoutMValues","archivingInfo","capabilities","datesInUnknownTimezone","hasAttachments","hasM","hasZ","isDataBranchVersioned","isDataVersioned","maxRecordCount","maxRecordCountFactor","maxUniqueIDCount","ownershipBasedAccessControlForFeatures","standardMaxRecordCount","supportedQueryFormats","supportsAdvancedQueries","supportsApplyEditsWithGlobalIds","supportsAttachmentsByUploadId","supportsAttachmentsResizing","supportsCalculate","supportsCoordinatesQuantization","supportsExceedsLimitStatistics","supportsFieldDescriptionProperty","supportsQuantizationEditMode","supportsRollbackOnFailureParameter","supportsStatistics","supportsTruncate","supportsValidateSql","tileMaxRecordCount","useStandardizedQueries"]}}}}})],L.prototype,"capabilities",void 0),e([l("service","capabilities")],L.prototype,"readCapabilitiesFromService",null),e([p(Z("dateFieldsTimeReference"))],L.prototype,"dateFieldsTimeZone",void 0),e([p({type:Boolean})],L.prototype,"datesInUnknownTimezone",void 0),e([p({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],L.prototype,"definitionExpression",void 0),e([p({type:String,json:{origins:{service:{read:{source:"displayField"}}}}})],L.prototype,"displayField",void 0),e([p({readOnly:!0,type:b})],L.prototype,"editFieldsInfo",void 0),e([p({readOnly:!0})],L.prototype,"editingInfo",void 0),e([l("editingInfo")],L.prototype,"readEditingInfo",null),e([p({readOnly:!0})],L.prototype,"effectiveCapabilities",null),e([p()],L.prototype,"effectiveEditingEnabled",null),e([p((()=>{const e=r(I),t=e.json.origins;return t["web-map"]={read:!1,write:!1},t["portal-item"]={read:!1,write:!1},e})())],L.prototype,"elevationInfo",void 0),e([p()],L.prototype,"fieldsIndex",void 0),e([p({type:C,json:{name:"layerDefinition.floorInfo",write:{layerContainerTypes:u}}})],L.prototype,"floorInfo",void 0),e([p({type:f,json:{origins:{service:{read:{source:"extent"}}}}})],L.prototype,"fullExtent",void 0),e([p()],L.prototype,"gdbVersion",void 0),e([p({readOnly:!0,type:R,json:{read:{source:"geometryProperties"}}})],L.prototype,"geometryFieldsInfo",void 0),e([p({type:["point","polygon","polyline","multipoint","multipatch","mesh"],json:{origins:{service:{read:U.read}}}})],L.prototype,"geometryType",void 0),e([p({type:String})],L.prototype,"globalIdField",void 0),e([l("service","globalIdField",["globalIdField","fields"])],L.prototype,"readGlobalIdFieldFromService",null),e([p({readOnly:!0})],L.prototype,"hasFullEditingRestrictions",null),e([p({type:Boolean,json:{origins:{service:{read:!0}}}})],L.prototype,"hasM",void 0),e([p({readOnly:!0})],L.prototype,"hasUpdateItemRestrictions",null),e([p({type:Boolean,json:{origins:{service:{read:!0}}}})],L.prototype,"hasZ",void 0),e([p({readOnly:!0,type:m})],L.prototype,"heightModelInfo",void 0),e([p({type:Date})],L.prototype,"historicMoment",void 0),e([p({type:t.ofType(E),readOnly:!0})],L.prototype,"indexes",void 0),e([p({readOnly:!0})],L.prototype,"isTable",void 0),e([l("service","isTable",["type"])],L.prototype,"readIsTableFromService",null),e([p({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{read:!1,write:{target:"id"}}},read:!1}})],L.prototype,"layerId",void 0),e([p(F)],L.prototype,"maxScale",void 0),e([l("service","maxScale",["maxScale","effectiveMaxScale"])],L.prototype,"readMaxScale",null),e([p(S)],L.prototype,"minScale",void 0),e([l("service","minScale",["minScale","effectiveMinScale"])],L.prototype,"readMinScale",null),e([p({type:String})],L.prototype,"objectIdField",void 0),e([l("service","objectIdField",["objectIdField","fields"])],L.prototype,"readObjectIdFieldFromService",null),e([p(Z("preferredTimeReference"))],L.prototype,"preferredTimeZone",void 0),e([p({type:[P],readOnly:!0})],L.prototype,"relationships",void 0),e([p({type:Boolean})],L.prototype,"returnM",void 0),e([p({type:Boolean})],L.prototype,"returnZ",void 0),e([p({readOnly:!0,json:{write:!1}})],L.prototype,"serverGens",void 0),e([p({readOnly:!0})],L.prototype,"serviceDefinitionExpression",void 0),e([l("service","serviceDefinitionExpression",["definitionQuery","definitionExpression"])],L.prototype,"readServiceDefinitionExpression",null),e([p({type:String,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],L.prototype,"serviceItemId",void 0),e([p()],L.prototype,"sourceJSON",void 0),e([p({type:h,json:{origins:{service:{read:{source:"extent.spatialReference"}}}}})],L.prototype,"spatialReference",void 0),e([p({type:String,readOnly:!0,json:{origins:{service:{read:!0}}}})],L.prototype,"subtypeField",void 0),e([p({type:[V],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],L.prototype,"subtypes",void 0),e([p({type:String,json:{read:{source:"timeInfo.trackIdField"}}})],L.prototype,"trackIdField",void 0),e([p({type:[String],readOnly:!0})],L.prototype,"uniqueIdFields",void 0),e([l("service","uniqueIdFields",["uniqueIdInfo.OIDFieldContainsHashValue","uniqueIdInfo.fields"])],L.prototype,"readUniqueIdFields",null),e([p(j)],L.prototype,"url",null),e([a("url")],L.prototype,"writeUrl",null),e([p({json:{origins:{service:{read:!0}},read:!1}})],L.prototype,"version",void 0),e([l("service","version",["currentVersion","capabilities","drawingInfo","hasAttachments","htmlPopupType","relationships","timeInfo","typeIdField","types"])],L.prototype,"readVersion",null),e([p({readOnly:!0})],L.prototype,"isUrlHostModified",null),L=e([d("esri.layers.mixins.FeatureLayerBase")],L),L};export{k as FeatureLayerBase};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{hasSameOrigin as o,getHost as s,changeHost as n}from"../../core/urlUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as u}from"../../core/accessorSupport/layerContainerType.js";import{OriginId as c,idToName as y}from"../../core/accessorSupport/PropertyOrigin.js";import f from"../../geometry/Extent.js";import m from"../../geometry/HeightModelInfo.js";import h from"../../geometry/SpatialReference.js";import{sanitizeUrlWithLayerId as v,writeUrlWithLayerId as g}from"../support/arcgisLayerUrl.js";import{elevationInfo as I,maxScale as F,minScale as S,url as j}from"../support/commonProperties.js";import b from"../support/EditFieldsInfo.js";import{FeatureIndex as E}from"../support/FeatureIndex.js";import{geometryTypeKebabDict as U,hasCurrentUser as x,isLayerCacheStale as O,supportsQueryOnly as M,readGlobalIdField as D,readObjectIdField as T,readVersion as w}from"../support/featureLayerUtils.js";import R from"../support/GeometryFieldsInfo.js";import H from"../support/LayerFloorInfo.js";import{isPreferredUrlApplicable as C,getPreferredUrl as B,applyPreferredHostToPortalItem as A,getPreferredHost as Q}from"../support/layerUtils.js";import _ from"../support/Relationship.js";import{getFeatureLayerCapabilities as P}from"../support/serviceCapabilitiesUtils.js";import q from"../support/Subtype.js";import{hasTypeKeyword as V,typeKeyword as G}from"../../portal/support/portalItemUtils.js";import{timeZoneProperty as Z}from"../../time/timeZoneUtils.js";const k=k=>{let L=class extends k{constructor(){super(...arguments),this.copyright=null,this.capabilities=null,this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.definitionExpression=null,this.displayField=null,this.editFieldsInfo=null,this.editingInfo=null,this.elevationInfo=null,this.fieldsIndex=null,this.floorInfo=null,this.fullExtent=null,this.gdbVersion=null,this.geometryFieldsInfo=null,this.geometryType=null,this.globalIdField=null,this.hasM=void 0,this.hasZ=void 0,this.heightModelInfo=null,this.historicMoment=null,this.indexes=new(t.ofType(E)),this.isTable=!1,this.layerId=void 0,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.preferredTimeZone=null,this.relationships=null,this.returnM=void 0,this.returnZ=void 0,this.serviceDefinitionExpression=null,this.serviceItemId=null,this.sourceJSON=null,this.spatialReference=h.WGS84,this.subtypeField=null,this.subtypes=null,this.trackIdField=null,this.uniqueIdFields=null,this.version=void 0,this._isUrlHostModified=!1,this._isUrlHostModificationEnabled=!1}getFieldDomain(){throw new Error("Not implemented")}getField(e){return this.fieldsIndex.get(e)}get authenticationTriggerEvent(){if(!this.url)return null;const{capabilities:e}=this;if(e){const{query:t,operations:i,editing:r}=e;if(!t.supportsQueryByOthers||!t.supportsQueryByAnonymous)return"load";if(i.supportsEditing&&!(r.supportsUpdateByOthers&&r.supportsUpdateByAnonymous&&r.supportsDeleteByOthers&&r.supportsDeleteByAnonymous))return"load"}if(x(this.serviceDefinitionExpression)||x(this.definitionExpression))return"load";if(this.userHasUpdateItemPrivileges){if(O(this))return"load";if(this.hasUpdateItemRestrictions)return e.operations.supportsQuery?"editing":"load"}if(this.userHasFullEditingPrivileges&&this.hasFullEditingRestrictions)return"editing";const t=this.editFieldsInfo;return(t?.creatorField||t?.editorField)&&e?.operations.supportsEditing?"editing":null}readCapabilitiesFromService(e,t){return P(t,this.url)}readEditingInfo(e,t){const{editingInfo:i}=t;return i?{lastEditDate:null!=i.lastEditDate?new Date(i.lastEditDate):null}:null}get effectiveCapabilities(){const e=this.capabilities;if(!e)return null;const t=i(e),{operations:r,editing:o}=t;return M(this)?(this.userHasUpdateItemPrivileges&&(r.supportsQuery=!0),t):this.userHasUpdateItemPrivileges?(r.supportsAdd=r.supportsDelete=r.supportsEditing=r.supportsQuery=r.supportsUpdate=o.supportsDeleteByOthers=o.supportsGeometryUpdate=o.supportsUpdateByOthers=!0,t):(this.userHasFullEditingPrivileges&&r.supportsEditing&&(r.supportsAdd=r.supportsDelete=r.supportsUpdate=o.supportsGeometryUpdate=!0),t)}get effectiveEditingEnabled(){return!1}readGlobalIdFieldFromService(e,t){return D(t)}get hasFullEditingRestrictions(){const e=this.capabilities;if(!e||M(this))return!1;const{operations:t,editing:i}=e;return t.supportsEditing&&!(t.supportsAdd&&t.supportsDelete&&t.supportsUpdate&&i.supportsGeometryUpdate)}get hasUpdateItemRestrictions(){const e=this.capabilities;if(!e)return!1;const{operations:t,editing:i}=e;return M(this)?!t.supportsQuery:!(t.supportsAdd&&t.supportsDelete&&t.supportsEditing&&t.supportsQuery&&t.supportsUpdate&&i.supportsDeleteByOthers&&i.supportsGeometryUpdate&&i.supportsUpdateByOthers)}readIsTableFromService(e,t){return"Table"===t.type}readMaxScale(e,t){return t.effectiveMaxScale||e||0}readMinScale(e,t){return t.effectiveMinScale||e||0}readObjectIdFieldFromService(e,t){return T(t)}readServiceDefinitionExpression(e,t){return t.definitionQuery||t.definitionExpression}readUniqueIdFields(e,t){return t.uniqueIdInfo?.OIDFieldContainsHashValue?t.uniqueIdInfo.fields:null}set url(e){if(null==e)return void this._set("url",e);const t=v({layer:this,url:e,nonStandardUrlAllowed:!0,logger:r.getLogger(this)});this._set("url",t.url),null!=t.layerId&&this._set("layerId",t.layerId)}writeUrl(e,t,i,r){g(this,e,null,t,r)}readVersion(e,t){return w(t)}get isUrlHostModified(){const{loaded:e,url:t,_isUrlHostModified:i}=this;if(i)return!0;if(!e||!t)return!1;if(this.originIdOf("url")<c.USER)return!1;const r=this.sourceJSON?.preferredHost;if(!r)return!1;if(!o(t,`https://${r}`,!0))return!1;for(let s=c.USER-1;s>=c.PORTAL_ITEM;s--){const e=this.getAtOrigin("url",y(s));if(e)return!o(t,e,!0)}return!1}applyPreferredHost(e){const{url:t,portalItem:i}=this;if(!t||!C(i))return;const r=B();r&&this._isUrlHostModificationEnabled&&(this._set("url",r),this._isUrlHostModified=!0,i&&A(i,Q()))}applyHostFromPortalItem(){const{url:e,portalItem:t}=this;if(!e||this.originIdOf("url")===c.USER||!t?.url||!C(t)||!V(t,G.HOSTED_SERVICE)||o(e,t.url,!0)||!this._isUrlHostModificationEnabled)return;const i=s(t.url);this._set("url",n(e,i)),this._isUrlHostModified=!0}};return e([p({readOnly:!0})],L.prototype,"authenticationTriggerEvent",null),e([p({type:String,json:{origins:{service:{read:{source:"copyrightText"}}}}})],L.prototype,"copyright",void 0),e([p({readOnly:!0,json:{read:!1,origins:{service:{read:{source:["advancedQueryCapabilities","allowGeometryUpdates","allowUpdateWithoutMValues","archivingInfo","capabilities","datesInUnknownTimezone","hasAttachments","hasM","hasZ","isDataBranchVersioned","isDataVersioned","maxRecordCount","maxRecordCountFactor","maxUniqueIDCount","ownershipBasedAccessControlForFeatures","standardMaxRecordCount","supportedQueryFormats","supportsAdvancedQueries","supportsApplyEditsWithGlobalIds","supportsAttachmentsByUploadId","supportsAttachmentsResizing","supportsCalculate","supportsCoordinatesQuantization","supportsExceedsLimitStatistics","supportsFieldDescriptionProperty","supportsQuantizationEditMode","supportsRollbackOnFailureParameter","supportsStatistics","supportsTruncate","supportsValidateSql","tileMaxRecordCount","useStandardizedQueries"]}}}}})],L.prototype,"capabilities",void 0),e([l("service","capabilities")],L.prototype,"readCapabilitiesFromService",null),e([p(Z("dateFieldsTimeReference"))],L.prototype,"dateFieldsTimeZone",void 0),e([p({type:Boolean})],L.prototype,"datesInUnknownTimezone",void 0),e([p({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],L.prototype,"definitionExpression",void 0),e([p({type:String,json:{origins:{service:{read:{source:"displayField"}}}}})],L.prototype,"displayField",void 0),e([p({readOnly:!0,type:b})],L.prototype,"editFieldsInfo",void 0),e([p({readOnly:!0})],L.prototype,"editingInfo",void 0),e([l("editingInfo")],L.prototype,"readEditingInfo",null),e([p({readOnly:!0})],L.prototype,"effectiveCapabilities",null),e([p()],L.prototype,"effectiveEditingEnabled",null),e([p((()=>{const e=i(I),t=e.json.origins;return t["web-map"]={read:!1,write:!1},t["portal-item"]={read:!1,write:!1},e})())],L.prototype,"elevationInfo",void 0),e([p()],L.prototype,"fieldsIndex",void 0),e([p({type:H,json:{name:"layerDefinition.floorInfo",write:{layerContainerTypes:u}}})],L.prototype,"floorInfo",void 0),e([p({type:f,json:{origins:{service:{read:{source:"extent"}}}}})],L.prototype,"fullExtent",void 0),e([p()],L.prototype,"gdbVersion",void 0),e([p({readOnly:!0,type:R,json:{read:{source:"geometryProperties"}}})],L.prototype,"geometryFieldsInfo",void 0),e([p({type:["point","polygon","polyline","multipoint","multipatch","mesh"],json:{origins:{service:{read:U.read}}}})],L.prototype,"geometryType",void 0),e([p({type:String})],L.prototype,"globalIdField",void 0),e([l("service","globalIdField",["globalIdField","fields"])],L.prototype,"readGlobalIdFieldFromService",null),e([p({readOnly:!0})],L.prototype,"hasFullEditingRestrictions",null),e([p({type:Boolean,json:{origins:{service:{read:!0}}}})],L.prototype,"hasM",void 0),e([p({readOnly:!0})],L.prototype,"hasUpdateItemRestrictions",null),e([p({type:Boolean,json:{origins:{service:{read:!0}}}})],L.prototype,"hasZ",void 0),e([p({readOnly:!0,type:m})],L.prototype,"heightModelInfo",void 0),e([p({type:Date})],L.prototype,"historicMoment",void 0),e([p({type:t.ofType(E),readOnly:!0})],L.prototype,"indexes",void 0),e([p({readOnly:!0})],L.prototype,"isTable",void 0),e([l("service","isTable",["type"])],L.prototype,"readIsTableFromService",null),e([p({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{read:!1,write:{target:"id"}}},read:!1}})],L.prototype,"layerId",void 0),e([p(F)],L.prototype,"maxScale",void 0),e([l("service","maxScale",["maxScale","effectiveMaxScale"])],L.prototype,"readMaxScale",null),e([p(S)],L.prototype,"minScale",void 0),e([l("service","minScale",["minScale","effectiveMinScale"])],L.prototype,"readMinScale",null),e([p({type:String})],L.prototype,"objectIdField",void 0),e([l("service","objectIdField",["objectIdField","fields"])],L.prototype,"readObjectIdFieldFromService",null),e([p(Z("preferredTimeReference"))],L.prototype,"preferredTimeZone",void 0),e([p({type:[_],readOnly:!0})],L.prototype,"relationships",void 0),e([p({type:Boolean})],L.prototype,"returnM",void 0),e([p({type:Boolean})],L.prototype,"returnZ",void 0),e([p({readOnly:!0,json:{write:!1}})],L.prototype,"serverGens",void 0),e([p({readOnly:!0})],L.prototype,"serviceDefinitionExpression",void 0),e([l("service","serviceDefinitionExpression",["definitionQuery","definitionExpression"])],L.prototype,"readServiceDefinitionExpression",null),e([p({type:String,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],L.prototype,"serviceItemId",void 0),e([p()],L.prototype,"sourceJSON",void 0),e([p({type:h,json:{origins:{service:{read:{source:"extent.spatialReference"}}}}})],L.prototype,"spatialReference",void 0),e([p({type:String,readOnly:!0,json:{origins:{service:{read:!0}}}})],L.prototype,"subtypeField",void 0),e([p({type:[q],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],L.prototype,"subtypes",void 0),e([p({type:String,json:{read:{source:"timeInfo.trackIdField"}}})],L.prototype,"trackIdField",void 0),e([p({type:[String],readOnly:!0})],L.prototype,"uniqueIdFields",void 0),e([l("service","uniqueIdFields",["uniqueIdInfo.OIDFieldContainsHashValue","uniqueIdInfo.fields"])],L.prototype,"readUniqueIdFields",null),e([p(j)],L.prototype,"url",null),e([a("url")],L.prototype,"writeUrl",null),e([p({json:{origins:{service:{read:!0}},read:!1}})],L.prototype,"version",void 0),e([l("service","version",["currentVersion","capabilities","drawingInfo","hasAttachments","htmlPopupType","relationships","timeInfo","typeIdField","types"])],L.prototype,"readVersion",null),e([p({readOnly:!0})],L.prototype,"isUrlHostModified",null),L=e([d("esri.layers.mixins.FeatureLayerBase")],L),L};export{k as FeatureLayerBase};
|