@arcgis/core 4.34.0-next.29 → 4.34.0-next.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/Map.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0260b33daf48fc207880.js +1 -0
  4. package/assets/esri/core/workers/chunks/{f469224c6e4804fd835a.js → 140efe4735605258ecc9.js} +1 -1
  5. package/assets/esri/core/workers/chunks/173c5b8fa1ac7aa6e072.js +1 -0
  6. package/assets/esri/core/workers/chunks/1aa6719be3afbdc7c880.js +1 -0
  7. package/assets/esri/core/workers/chunks/{8552fdb3230f4dd082c6.js → 20a96c17d1a117dfdf77.js} +1 -1
  8. package/assets/esri/core/workers/chunks/28e04ef3575f164f611a.js +1 -0
  9. package/assets/esri/core/workers/chunks/{2173012af606ac4cdf87.js → 2a695b50a384c45ace9a.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{cf635f7ca998dd33d947.js → 439ce953a25b2776cb7f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{ecdbbfebca1fcef567bb.js → 4e267a813e8b10d10b3b.js} +9 -9
  12. package/assets/esri/core/workers/chunks/7099ff8dc699fedea931.js +1 -0
  13. package/assets/esri/core/workers/chunks/{e89698fc404379627349.js → 949dc266ac6f3505d357.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{0aba41e0ee0a591b254b.js → 971b16677b66c16fb6b9.js} +1 -1
  15. package/assets/esri/core/workers/chunks/a809042fdce7ced2a415.js +1 -0
  16. package/assets/esri/core/workers/chunks/{16d82cbec34bc434efcd.js → a82d7e2eecfe654a65de.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{27e089acb1cc76758b0a.js → ac30cf2f9a94597f7665.js} +8 -8
  18. package/assets/esri/core/workers/chunks/{ec4428250dbd807df0bd.js → c50c2f014e8567870686.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{ce3a1ac43e8579db65cd.js → c854c3bb4440fd942c12.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{9cbed3b43d7aadc7e627.js → ca88859fc69fcb4568c0.js} +1 -1
  21. package/assets/esri/core/workers/chunks/e7209654ecdfde926272.js +1 -0
  22. package/assets/esri/core/workers/chunks/e82b1f91465d569012c4.js +1 -0
  23. package/assets/esri/core/workers/chunks/e9311386f58f3cb95c22.js +1 -0
  24. package/assets/esri/core/workers/chunks/{45485d8f0b0e0e0a6365.js → efec0f496491a0647051.js} +1 -1
  25. package/chunks/RealisticTree.glsl.js +6 -6
  26. package/colorUtils.js +1 -1
  27. package/config.js +1 -1
  28. package/core/Evented.js +1 -1
  29. package/interfaces.d.ts +2 -2
  30. package/kernel.js +1 -1
  31. package/layers/CatalogLayer.js +1 -1
  32. package/layers/FeatureLayer.js +1 -1
  33. package/layers/GeoJSONLayer.js +1 -1
  34. package/layers/GraphicsLayer.js +1 -1
  35. package/layers/OGCFeatureLayer.js +1 -1
  36. package/layers/SceneLayer.js +1 -1
  37. package/layers/SubtypeGroupLayer.js +1 -1
  38. package/layers/graphics/data/FeatureStore.js +1 -1
  39. package/layers/graphics/dehydratedPoint.js +1 -1
  40. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  41. package/layers/mixins/SublayersOwner.js +1 -1
  42. package/layers/support/LayerContingentValuesCache.js +1 -1
  43. package/networks/UtilityNetwork.js +1 -1
  44. package/package.json +1 -1
  45. package/portal/support/layersLoader.js +1 -1
  46. package/rest/networks/support/CircuitTraceResult.js +1 -1
  47. package/support/revision.js +1 -1
  48. package/views/2d/engine/ManagedCanvas.js +1 -1
  49. package/views/2d/engine/imagery/RasterTileContainer.js +1 -1
  50. package/views/2d/engine/webgl/Profiler.js +1 -1
  51. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  52. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
  53. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
  54. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  55. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  56. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  57. package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
  58. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  59. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  60. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  61. package/views/2d/support/hitTestUtils.js +1 -1
  62. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  63. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
  64. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementVisualization.js +5 -0
  65. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementConfiguration.js +5 -0
  66. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  67. package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
  68. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  69. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  70. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  71. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  72. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  73. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  74. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  75. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  76. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  77. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  78. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  79. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  80. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  81. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  82. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  83. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  84. package/views/3d/layers/i3s/I3SQueryFeatureStore.js +1 -1
  85. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  86. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  87. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  88. package/views/3d/state/ViewState.js +1 -1
  89. package/views/3d/support/CombinedElevationProvider.js +1 -1
  90. package/views/3d/support/pointsOfInterest/ContentGeometryUpdates.js +1 -1
  91. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  92. package/views/3d/terrain/OverlayRenderer.js +1 -1
  93. package/views/3d/terrain/TerrainSurface.js +1 -1
  94. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  95. package/views/3d/webgl-engine/lib/ChangeSet.js +1 -1
  96. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  97. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  98. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  99. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  100. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  101. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  102. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  103. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  104. package/views/3d/webgl-engine/lib/rendererUtils.js +1 -1
  105. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  106. package/views/DOMContainer.js +1 -1
  107. package/views/Viewport2DMixin.js +1 -1
  108. package/views/draw/DrawManipulator.js +1 -1
  109. package/views/draw/DrawOperation.js +1 -1
  110. package/views/interactive/snapping/SnappingManager.js +1 -1
  111. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  112. package/views/layers/FeatureLayerView.js +1 -1
  113. package/views/layers/support/editableLayerViews.js +1 -1
  114. package/views/support/Scheduler.js +1 -1
  115. package/widgets/Editor/EditorViewModel.js +1 -1
  116. package/widgets/Editor/workflowUtils.js +1 -1
  117. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  118. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  119. package/widgets/Search/SearchViewModel.js +1 -1
  120. package/widgets/support/GeolocationPositioning.js +1 -1
  121. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  122. package/assets/esri/core/workers/chunks/230e7b817ae16505ccf0.js +0 -1
  123. package/assets/esri/core/workers/chunks/450a7ebe2535a55c5193.js +0 -1
  124. package/assets/esri/core/workers/chunks/4599f5cebbafddb6720e.js +0 -1
  125. package/assets/esri/core/workers/chunks/676fec273f2f660a614d.js +0 -1
  126. package/assets/esri/core/workers/chunks/6aced8e446beceefaf2c.js +0 -1
  127. package/assets/esri/core/workers/chunks/9f459805a6698708830a.js +0 -1
  128. package/assets/esri/core/workers/chunks/a4104b21f2b282dfb14f.js +0 -1
  129. package/assets/esri/core/workers/chunks/cab3199d37411c8ed074.js +0 -1
  130. package/assets/esri/core/workers/chunks/fbfe2195ba87d18bc37a.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../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{property as f}from"../core/accessorSupport/decorators/property.js";import{cast as h}from"../core/accessorSupport/decorators/cast.js";import{reader as b}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as v}from"../core/accessorSupport/layerContainerType.js";import T from"../form/FormTemplate.js";import j from"../geometry/SpatialReference.js";import F from"./Layer.js";import{MemorySource as S}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as E}from"./mixins/ArcGISService.js";import{BlendLayer as L}from"./mixins/BlendLayer.js";import{CustomParametersMixin as D}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as _}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as x}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as C}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as P}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as q}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as M}from"./mixins/OperationalLayer.js";import{OrderedLayer as O}from"./mixins/OrderedLayer.js";import{PortalLayer as A}from"./mixins/PortalLayer.js";import{PublishableLayer as R}from"./mixins/PublishableLayer.js";import{RefreshableLayer as Q}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as V}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as U}from"./mixins/TemporalLayer.js";import{TrackableLayer as B}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as N,parse as $,cleanTitle as G}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as J,id as W,labelsVisible as Z,opacityDrawingInfo as H,legendEnabled as z,listMode as k,popupEnabled as K,screenSizePerspectiveEnabled as X}from"./support/commonProperties.js";import{ensureLayerCredential as Y,computeEffectiveEditingEnabled as ee,readGlobalIdField as te,readObjectIdField as re,createDefaultRenderer as ie,addAttachment as oe,updateAttachment as se,applyEdits as ae,uploadAssets as ne,createQuery as le,deleteAttachments as pe,fetchRecomputedExtents as ue,getFeatureType as de,getFieldDomain as ye,queryAttachments as ce,queryObjectIds as me,queryFeatureCount as fe,queryExtent as he,queryRelatedFeatures as be,queryRelatedFeaturesCount as ge,validateBinsQuery as we,hasDataChanged as ve,geometryTypeKebabDict as Te}from"./support/featureLayerUtils.js";import je from"./support/FeatureTemplate.js";import Fe from"./support/FeatureType.js";import{defineFieldProperties as Se}from"./support/fieldProperties.js";import{fixRendererFields as Ie,fixTimeInfoFields as Ee}from"./support/fieldUtils.js";import Le from"./support/LabelClass.js";import{reader as De}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as _e}from"./support/serviceCapabilitiesUtils.js";import xe from"./support/TimeInfo.js";import Ce from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as Pe}from"./support/versionUtils.js";import{DataLayerSource as qe}from"./support/source/DataLayerSource.js";import{read as Me}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Oe}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Ae,rendererTypes as Re}from"../renderers/support/typeUtils.js";import Qe from"../rest/support/FeatureSet.js";import Ve from"../rest/support/Query.js";import{isNumber as Ue}from"../support/guards.js";import{createPopupTemplate as Be}from"../support/popupUtils.js";import{symbolTypes as Ne}from"../symbols/support/typeUtils.js";import{opacityToTransparency as $e}from"../webdoc/support/opacityUtils.js";const Ge="FeatureLayer";function Je(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function We(e){return e&&e instanceof o}const Ze=Se();function He(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let ze=class extends(P(q(C(R(x(_(L(O(U(B(V(Q(E(M(A(p(D(I(i.ClonableMixin(F)))))))))))))))))))){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=j.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 0:return i(this,t);case 1: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(()=>Y(this,"load",e));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new Ce({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,_e(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 ee(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 te(t.layerDefinition||t)}readObjectIdField(e,t){return re(t.layerDefinition||t)}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Ie(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Me(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 ie(t,r)}set source(e){const t=this._get("source");t!==e&&(We(t)&&this._resetMemorySource(t),We(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof o?new S({layer:this,items:e}):e:null}readSource(e,t){const r=Qe.fromJSON(t.featureSet);return new S({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map(e=>je.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?N(this.url,r):r;let t=r;if(!t&&this.url){const e=$(this.url);null!=e&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),G(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=Fe.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 oe(this,e,t,Ge);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await se(this,e,t,r,Ge);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return ae(this,e,t)}async uploadAssets(e,t){return ne(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return Be(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=le(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 pe(this,e,t,Ge);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return ue(this,e,Ge)}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 de(this.types,this.typeIdField,e)}getFieldDomain(e,t){return ye(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return ce(this,e,t,Ge)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Ve.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 me(this,e,t,Ge)}async queryFeatureCount(e,t){return fe(this,e,t,Ge)}async queryExtent(e,t){return he(this,e,t,Ge)}async queryRelatedFeatures(e,t){return be(this,e,t,Ge)}async queryRelatedFeaturesCount(e,t){return ge(this,e,t,Ge)}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(Ge,"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(Ge,"Layer source does not support queryAttributeBins capability");we(e,i,Ge);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(Ge,"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(Ue)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(Ge,"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(Ge,"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(Je(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(Je(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push(Je(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(Je(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(Ge,`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||Pe(this,e))}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,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(),Ie(this.renderer,this.fieldsIndex),Ee(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Oe(this,{origin:"service"})}async hasDataChanged(){return ve(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([f({clonable:!1,readOnly:!0})],ze.prototype,"_titleCreator",null),e([f(J)],ze.prototype,"attributeTableTemplate",void 0),e([b("service","capabilities")],ze.prototype,"readCapabilities",null),e([f({json:{origins:{"web-scene":{write:!1}},write:!0}})],ze.prototype,"charts",void 0),e([f({readOnly:!0})],ze.prototype,"createQueryVersion",null),e([f({json:{read:{source:"layerDefinition.copyrightText"}}})],ze.prototype,"copyright",void 0),e([f({json:{read:{source:"layerDefinition.displayField"}}})],ze.prototype,"displayField",void 0),e([f({types:Ne,readOnly:!0})],ze.prototype,"defaultSymbol",void 0),e([f({type:qe})],ze.prototype,"dynamicDataSource",void 0),e([f({type:Boolean})],ze.prototype,"editingEnabled",null),e([b(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],ze.prototype,"readEditingEnabled",null),e([b("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],ze.prototype,"readEditingEnabledFromWebMap",null),e([w(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],ze.prototype,"writeEditingEnabled",null),e([w("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],ze.prototype,"writeEditingEnabledToWebMap",null),e([f({readOnly:!0})],ze.prototype,"effectiveEditingEnabled",null),e([f({clonable:!1,readOnly:!0})],ze.prototype,"featureTitleFields",null),e([f({...Ze.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:He}}}}})],ze.prototype,"fields",void 0),e([f(Ze.fieldsIndex)],ze.prototype,"fieldsIndex",void 0),e([f({type:T,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],ze.prototype,"formTemplate",void 0),e([f({json:{read:{source:"layerDefinition.extent"}}})],ze.prototype,"fullExtent",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:He,writer(e,t,r){const i=e?Te.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Te.read}}})],ze.prototype,"geometryType",void 0),e([f({json:{read:{source:"layerDefinition.hasM"}}})],ze.prototype,"hasM",void 0),e([f({json:{read:{source:"layerDefinition.hasZ"}}})],ze.prototype,"hasZ",void 0),e([f(W)],ze.prototype,"id",void 0),e([f({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ze.prototype,"infoFor3D",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],ze.prototype,"isTable",void 0),e([b("service","isTable",["type","geometryType"]),b("isTable",["layerDefinition.type","layerDefinition.geometryType"])],ze.prototype,"readIsTable",null),e([w("web-map","isTable")],ze.prototype,"writeIsTable",null),e([f(Z)],ze.prototype,"labelsVisible",void 0),e([f({type:[Le],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:De,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:De,write:{layerContainerTypes:v}}})],ze.prototype,"labelingInfo",void 0),e([f((()=>{const e=a(H);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,$e(e),t)}}},e})())],ze.prototype,"opacity",void 0),e([f(z)],ze.prototype,"legendEnabled",void 0),e([f({type:["show","hide"],json:(()=>{const e=a(k.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],ze.prototype,"listMode",void 0),e([b("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],ze.prototype,"readGlobalIdField",null),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:He}}}}})],ze.prototype,"objectIdField",void 0),e([b("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],ze.prototype,"readObjectIdField",null),e([f({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:v}}})],ze.prototype,"operationalLayerType",void 0),e([f(Ze.outFields)],ze.prototype,"outFields",void 0),e([f({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ze.prototype,"path",void 0),e([f(K)],ze.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:!0}})],ze.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],ze.prototype,"defaultPopupTemplate",null),e([f({types:Re,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Ae,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:v,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:v})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:v})}}})],ze.prototype,"renderer",null),e([b("service","renderer",["drawingInfo.renderer","defaultSymbol"]),b("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],ze.prototype,"readRenderer",null),e([f()],ze.prototype,"resourceInfo",void 0),e([f((()=>{const e=a(X);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],ze.prototype,"screenSizePerspectiveEnabled",void 0),e([f({clonable:!1})],ze.prototype,"source",null),e([h("source")],ze.prototype,"castSource",null),e([b("portal-item","source",["featureSet"]),b("web-map","source",["featureSet"])],ze.prototype,"readSource",null),e([f({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],ze.prototype,"spatialReference",void 0),e([f({type:Number})],ze.prototype,"subtypeCode",void 0),e([f({type:[je]})],ze.prototype,"templates",void 0),e([b("templates",["editFieldsInfo","creatorField","editorField","templates"])],ze.prototype,"readTemplates",null),e([f({type:xe})],ze.prototype,"timeInfo",void 0),e([f()],ze.prototype,"title",void 0),e([b("service","title",["name"]),b("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],ze.prototype,"readTitle",null),e([b("web-map","title",["layerDefinition.name","title"])],ze.prototype,"readTitleFromWebMap",null),e([f({type:String})],ze.prototype,"sublayerTitleMode",void 0),e([f({json:{read:!1}})],ze.prototype,"type",void 0),e([f({type:String})],ze.prototype,"typeIdField",void 0),e([b("service","typeIdField"),b("typeIdField",["layerDefinition.typeIdField"])],ze.prototype,"readTypeIdField",null),e([f({type:[Fe]})],ze.prototype,"types",void 0),e([b("service","types",["types"]),b("types",["layerDefinition.types"])],ze.prototype,"readTypes",null),e([f({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:v}}}}})],ze.prototype,"visible",void 0),e([b("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],ze.prototype,"readVisible",null),ze=e([g("esri.layers.FeatureLayer")],ze);export{ze as default};
5
+ import{__decorate as e}from"tslib";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{property as f}from"../core/accessorSupport/decorators/property.js";import{cast as h}from"../core/accessorSupport/decorators/cast.js";import{reader as b}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as v}from"../core/accessorSupport/layerContainerType.js";import T from"../form/FormTemplate.js";import j from"../geometry/SpatialReference.js";import F from"./Layer.js";import{MemorySource as S}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as E}from"./mixins/ArcGISService.js";import{BlendLayer as L}from"./mixins/BlendLayer.js";import{CustomParametersMixin as D}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as _}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as x}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as C}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as P}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as q}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as M}from"./mixins/OperationalLayer.js";import{OrderedLayer as O}from"./mixins/OrderedLayer.js";import{PortalLayer as A}from"./mixins/PortalLayer.js";import{PublishableLayer as R}from"./mixins/PublishableLayer.js";import{RefreshableLayer as Q}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as V}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as U}from"./mixins/TemporalLayer.js";import{TrackableLayer as B}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as N,parse as $,cleanTitle as G}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as J,id as W,labelsVisible as Z,opacityDrawingInfo as H,legendEnabled as z,listMode as k,popupEnabled as K,screenSizePerspectiveEnabled as X}from"./support/commonProperties.js";import{ensureLayerCredential as Y,computeEffectiveEditingEnabled as ee,readGlobalIdField as te,readObjectIdField as re,createDefaultRenderer as ie,addAttachment as oe,updateAttachment as se,applyEdits as ae,uploadAssets as ne,createQuery as le,deleteAttachments as pe,fetchRecomputedExtents as ue,getFeatureType as de,getFieldDomain as ye,queryAttachments as ce,queryObjectIds as me,queryFeatureCount as fe,queryExtent as he,queryRelatedFeatures as be,queryRelatedFeaturesCount as ge,validateBinsQuery as we,hasDataChanged as ve,geometryTypeKebabDict as Te}from"./support/featureLayerUtils.js";import je from"./support/FeatureTemplate.js";import Fe from"./support/FeatureType.js";import{defineFieldProperties as Se}from"./support/fieldProperties.js";import{fixRendererFields as Ie,fixTimeInfoFields as Ee}from"./support/fieldUtils.js";import Le from"./support/LabelClass.js";import{reader as De}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as _e}from"./support/serviceCapabilitiesUtils.js";import xe from"./support/TimeInfo.js";import Ce from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as Pe}from"./support/versionUtils.js";import{DataLayerSource as qe}from"./support/source/DataLayerSource.js";import{read as Me}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Oe}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Ae,rendererTypes as Re}from"../renderers/support/typeUtils.js";import Qe from"../rest/support/FeatureSet.js";import Ve from"../rest/support/Query.js";import{isNumber as Ue}from"../support/guards.js";import{createPopupTemplate as Be}from"../support/popupUtils.js";import{symbolTypes as Ne}from"../symbols/support/typeUtils.js";import{opacityToTransparency as $e}from"../webdoc/support/opacityUtils.js";const Ge="FeatureLayer";function Je(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function We(e){return e&&e instanceof o}const Ze=Se();function He(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let ze=class extends(P(q(C(R(x(_(L(O(U(B(V(Q(E(M(A(p(D(I(i.ClonableMixin(F)))))))))))))))))))){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=j.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 0:return i(this,t);case 1: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(()=>Y(this,"load",e));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new Ce({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,_e(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 ee(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 te(t.layerDefinition||t)}readObjectIdField(e,t){return re(t.layerDefinition||t)}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Ie(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Me(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 ie(t,r)}set source(e){const t=this._get("source");t!==e&&(We(t)&&this._resetMemorySource(t),We(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof o?new S({layer:this,items:e}):e:null}readSource(e,t){const r=Qe.fromJSON(t.featureSet);return new S({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map(e=>je.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?N(this.url,r):r;let t=r;if(!t&&this.url){const e=$(this.url);null!=e&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),G(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=Fe.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 oe(this,e,t,Ge);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await se(this,e,t,r,Ge);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return ae(this,e,t)}async uploadAssets(e,t){return ne(this,e,t)}createPopupTemplate(e){return Be(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=le(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 pe(this,e,t,Ge);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return ue(this,e,Ge)}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 de(this.types,this.typeIdField,e)}getFieldDomain(e,t){return ye(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return ce(this,e,t,Ge)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Ve.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 me(this,e,t,Ge)}async queryFeatureCount(e,t){return fe(this,e,t,Ge)}async queryExtent(e,t){return he(this,e,t,Ge)}async queryRelatedFeatures(e,t){return be(this,e,t,Ge)}async queryRelatedFeaturesCount(e,t){return ge(this,e,t,Ge)}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(Ge,"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(Ge,"Layer source does not support queryAttributeBins capability");we(e,i,Ge);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(Ge,"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(Ue)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(Ge,"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(Ge,"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(Je(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(Je(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push(Je(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(Je(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(Ge,`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||Pe(this,e))}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,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(),Ie(this.renderer,this.fieldsIndex),Ee(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Oe(this,{origin:"service"})}async hasDataChanged(){return ve(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([f({clonable:!1,readOnly:!0})],ze.prototype,"_titleCreator",null),e([f(J)],ze.prototype,"attributeTableTemplate",void 0),e([b("service","capabilities")],ze.prototype,"readCapabilities",null),e([f({json:{origins:{"web-scene":{write:!1}},write:!0}})],ze.prototype,"charts",void 0),e([f({readOnly:!0})],ze.prototype,"createQueryVersion",null),e([f({json:{read:{source:"layerDefinition.copyrightText"}}})],ze.prototype,"copyright",void 0),e([f({json:{read:{source:"layerDefinition.displayField"}}})],ze.prototype,"displayField",void 0),e([f({types:Ne,readOnly:!0})],ze.prototype,"defaultSymbol",void 0),e([f({type:qe})],ze.prototype,"dynamicDataSource",void 0),e([f({type:Boolean})],ze.prototype,"editingEnabled",null),e([b(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],ze.prototype,"readEditingEnabled",null),e([b("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],ze.prototype,"readEditingEnabledFromWebMap",null),e([w(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],ze.prototype,"writeEditingEnabled",null),e([w("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],ze.prototype,"writeEditingEnabledToWebMap",null),e([f({readOnly:!0})],ze.prototype,"effectiveEditingEnabled",null),e([f({clonable:!1,readOnly:!0})],ze.prototype,"featureTitleFields",null),e([f({...Ze.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:He}}}}})],ze.prototype,"fields",void 0),e([f(Ze.fieldsIndex)],ze.prototype,"fieldsIndex",void 0),e([f({type:T,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],ze.prototype,"formTemplate",void 0),e([f({json:{read:{source:"layerDefinition.extent"}}})],ze.prototype,"fullExtent",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:He,writer(e,t,r){const i=e?Te.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Te.read}}})],ze.prototype,"geometryType",void 0),e([f({json:{read:{source:"layerDefinition.hasM"}}})],ze.prototype,"hasM",void 0),e([f({json:{read:{source:"layerDefinition.hasZ"}}})],ze.prototype,"hasZ",void 0),e([f(W)],ze.prototype,"id",void 0),e([f({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ze.prototype,"infoFor3D",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],ze.prototype,"isTable",void 0),e([b("service","isTable",["type","geometryType"]),b("isTable",["layerDefinition.type","layerDefinition.geometryType"])],ze.prototype,"readIsTable",null),e([w("web-map","isTable")],ze.prototype,"writeIsTable",null),e([f(Z)],ze.prototype,"labelsVisible",void 0),e([f({type:[Le],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:De,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:De,write:{layerContainerTypes:v}}})],ze.prototype,"labelingInfo",void 0),e([f((()=>{const e=a(H);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,$e(e),t)}}},e})())],ze.prototype,"opacity",void 0),e([f(z)],ze.prototype,"legendEnabled",void 0),e([f({type:["show","hide"],json:(()=>{const e=a(k.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],ze.prototype,"listMode",void 0),e([b("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],ze.prototype,"readGlobalIdField",null),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:He}}}}})],ze.prototype,"objectIdField",void 0),e([b("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],ze.prototype,"readObjectIdField",null),e([f({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:v}}})],ze.prototype,"operationalLayerType",void 0),e([f(Ze.outFields)],ze.prototype,"outFields",void 0),e([f({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ze.prototype,"path",void 0),e([f(K)],ze.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:!0}})],ze.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],ze.prototype,"defaultPopupTemplate",null),e([f({types:Re,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Ae,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:v,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:v})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:v})}}})],ze.prototype,"renderer",null),e([b("service","renderer",["drawingInfo.renderer","defaultSymbol"]),b("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],ze.prototype,"readRenderer",null),e([f()],ze.prototype,"resourceInfo",void 0),e([f((()=>{const e=a(X);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],ze.prototype,"screenSizePerspectiveEnabled",void 0),e([f({clonable:!1})],ze.prototype,"source",null),e([h("source")],ze.prototype,"castSource",null),e([b("portal-item","source",["featureSet"]),b("web-map","source",["featureSet"])],ze.prototype,"readSource",null),e([f({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],ze.prototype,"spatialReference",void 0),e([f({type:Number})],ze.prototype,"subtypeCode",void 0),e([f({type:[je]})],ze.prototype,"templates",void 0),e([b("templates",["editFieldsInfo","creatorField","editorField","templates"])],ze.prototype,"readTemplates",null),e([f({type:xe})],ze.prototype,"timeInfo",void 0),e([f()],ze.prototype,"title",void 0),e([b("service","title",["name"]),b("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],ze.prototype,"readTitle",null),e([b("web-map","title",["layerDefinition.name","title"])],ze.prototype,"readTitleFromWebMap",null),e([f({type:String})],ze.prototype,"sublayerTitleMode",void 0),e([f({json:{read:!1}})],ze.prototype,"type",void 0),e([f({type:String})],ze.prototype,"typeIdField",void 0),e([b("service","typeIdField"),b("typeIdField",["layerDefinition.typeIdField"])],ze.prototype,"readTypeIdField",null),e([f({type:[Fe]})],ze.prototype,"types",void 0),e([b("service","types",["types"]),b("types",["layerDefinition.types"])],ze.prototype,"readTypes",null),e([f({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:v}}}}})],ze.prototype,"visible",void 0),e([b("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],ze.prototype,"readVisible",null),ze=e([g("esri.layers.FeatureLayer")],ze);export{ze as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{urlToObject as i}from"../core/urlUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import n from"../geometry/Extent.js";import a from"../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as l}from"../geometry/support/typeUtils.js";import u from"./Layer.js";import{GeoJSONSource as d}from"./graphics/sources/GeoJSONSource.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as c}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as h}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as f}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{OrderedLayer as j}from"./mixins/OrderedLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{TrackableLayer as F}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as O,elevationInfo as T,id as E,labelsVisible as S,legendEnabled as w,opacity as L,popupEnabled as P,screenSizePerspectiveEnabled as q,url as U}from"./support/commonProperties.js";import{validateBinsQuery as D}from"./support/featureLayerUtils.js";import J from"./support/FeatureTemplate.js";import N from"./support/Field.js";import{defineFieldProperties as R}from"./support/fieldProperties.js";import{fixRendererFields as G,fixTimeInfoFields as Q}from"./support/fieldUtils.js";import B from"./support/LabelClass.js";import{reader as C}from"./support/labelingInfo.js";import{webSceneRendererTypes as Z,rendererTypes as V}from"../renderers/support/typeUtils.js";import _ from"../rest/support/Query.js";import{createPopupTemplate as A}from"../support/popupUtils.js";import{timeZoneProperty as M}from"../time/timeZoneUtils.js";const z=R();let k=class extends(j(c(y(f(h(m(I(F(x(b(g(v(r(u)))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.copyright=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.editingEnabled=!1,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="GeoJSON",this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=a.WGS84,this.templates=null,this.title="GeoJSON",this.type="geojson"}destroy(){this.source?.destroy()}load(e){const t=this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},e).catch(o).then(()=>this.source.load(e)).then(()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo"],"service"),G(this.renderer,this.fieldsIndex),Q(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&null==this.geometryType}get parsedUrl(){return i(this.url)}set renderer(e){G(e,this.fieldsIndex),this._set("renderer",e)}set url(e){if(!e)return void this._set("url",e);const t=i(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");await this.load();const o=await r(this,this.source,e,t);return this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0}),o}on(e,t){return super.on(e,t)}createPopupTemplate(e){return A(this,e)}createQuery(){const e=new _,t=this.capabilities?.data;e.returnGeometry=!0,t&&t.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:r,timeExtent:o}=this;return e.timeExtent=null!=r&&null!=o?o.offset(-r.value,r.unit):o||null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(_.from(e)||this.createQuery(),t)).then(e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(_.from(e)||this.createQuery(),t))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(_.from(e)||this.createQuery(),t))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(_.from(e)||this.createQuery(),t))}async queryAttributeBins(e,t){const{source:r,capabilities:o}=await this.load();D(e,o,"GeoJSONLayer");const i=await import("../rest/support/AttributeBinsQuery.js"),s=await r.queryAttributeBins(i.default.from(e),t);if(s.features)for(const p of s.features)p.layer=p.sourceLayer=this;return s}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return null!=t&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([s(O)],k.prototype,"attributeTableTemplate",void 0),e([s({readOnly:!0,json:{read:!1,write:!1}})],k.prototype,"capabilities",null),e([s({type:String})],k.prototype,"copyright",void 0),e([s({readOnly:!0})],k.prototype,"createQueryVersion",null),e([s(M("dateFieldsTimeReference"))],k.prototype,"dateFieldsTimeZone",void 0),e([s({readOnly:!0})],k.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],k.prototype,"definitionExpression",void 0),e([s({type:String})],k.prototype,"displayField",void 0),e([s({type:Boolean})],k.prototype,"editingEnabled",void 0),e([s(T)],k.prototype,"elevationInfo",void 0),e([s({type:[N],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],k.prototype,"fields",void 0),e([s(z.fieldsIndex)],k.prototype,"fieldsIndex",void 0),e([s({type:n,json:{name:"extent"}})],k.prototype,"fullExtent",void 0),e([s({type:["point","polygon","polyline","multipoint"],json:{read:{reader:l.read}}})],k.prototype,"geometryType",void 0),e([s({type:Boolean})],k.prototype,"hasZ",void 0),e([s(E)],k.prototype,"id",void 0),e([s({type:Boolean,readOnly:!0})],k.prototype,"isTable",null),e([s(S)],k.prototype,"labelsVisible",void 0),e([s({type:[B],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:C},write:!0}})],k.prototype,"labelingInfo",void 0),e([s(w)],k.prototype,"legendEnabled",void 0),e([s({type:["show","hide"]})],k.prototype,"listMode",void 0),e([s({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],k.prototype,"objectIdField",void 0),e([s(L)],k.prototype,"opacity",void 0),e([s({type:["GeoJSON"]})],k.prototype,"operationalLayerType",void 0),e([s(z.outFields)],k.prototype,"outFields",void 0),e([s({readOnly:!0})],k.prototype,"parsedUrl",null),e([s(P)],k.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:!0}})],k.prototype,"popupTemplate",void 0),e([s({types:V,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:Z}}}})],k.prototype,"renderer",null),e([s(q)],k.prototype,"screenSizePerspectiveEnabled",void 0),e([s({readOnly:!0})],k.prototype,"source",void 0),e([s({type:a})],k.prototype,"spatialReference",void 0),e([s({type:[J]})],k.prototype,"templates",void 0),e([s()],k.prototype,"title",void 0),e([s({json:{read:!1},readOnly:!0})],k.prototype,"type",void 0),e([s(U)],k.prototype,"url",null),k=e([p("esri.layers.GeoJSONLayer")],k);const W=k;export{W as default};
5
+ import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as i}from"../core/promiseUtils.js";import{urlToObject as o}from"../core/urlUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import n from"../geometry/Extent.js";import a from"../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as l}from"../geometry/support/typeUtils.js";import u from"./Layer.js";import{GeoJSONSource as d}from"./graphics/sources/GeoJSONSource.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as c}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as h}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as f}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{OrderedLayer as j}from"./mixins/OrderedLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{TrackableLayer as F}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as O,elevationInfo as T,id as E,labelsVisible as S,legendEnabled as w,opacity as L,popupEnabled as P,screenSizePerspectiveEnabled as q,url as U}from"./support/commonProperties.js";import{validateBinsQuery as D}from"./support/featureLayerUtils.js";import J from"./support/FeatureTemplate.js";import N from"./support/Field.js";import{defineFieldProperties as R}from"./support/fieldProperties.js";import{fixRendererFields as G,fixTimeInfoFields as Q}from"./support/fieldUtils.js";import B from"./support/LabelClass.js";import{reader as C}from"./support/labelingInfo.js";import{webSceneRendererTypes as Z,rendererTypes as V}from"../renderers/support/typeUtils.js";import _ from"../rest/support/Query.js";import{createPopupTemplate as A}from"../support/popupUtils.js";import{timeZoneProperty as M}from"../time/timeZoneUtils.js";const z=R();let k=class extends(j(c(y(f(h(m(I(F(x(b(g(v(r(u)))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.copyright=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.editingEnabled=!1,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="GeoJSON",this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=a.WGS84,this.templates=null,this.title="GeoJSON",this.type="geojson"}destroy(){this.source?.destroy()}load(e){const t=this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},e).catch(i).then(()=>this.source.load(e)).then(()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo"],"service"),G(this.renderer,this.fieldsIndex),Q(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&null==this.geometryType}get parsedUrl(){return o(this.url)}set renderer(e){G(e,this.fieldsIndex),this._set("renderer",e)}set url(e){if(!e)return void this._set("url",e);const t=o(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");await this.load();const i=await r(this,this.source,e,t);return this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0}),i}createPopupTemplate(e){return A(this,e)}createQuery(){const e=new _,t=this.capabilities?.data;e.returnGeometry=!0,t&&t.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:r,timeExtent:i}=this;return e.timeExtent=null!=r&&null!=i?i.offset(-r.value,r.unit):i||null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(_.from(e)||this.createQuery(),t)).then(e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(_.from(e)||this.createQuery(),t))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(_.from(e)||this.createQuery(),t))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(_.from(e)||this.createQuery(),t))}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();D(e,i,"GeoJSONLayer");const o=await import("../rest/support/AttributeBinsQuery.js"),s=await r.queryAttributeBins(o.default.from(e),t);if(s.features)for(const p of s.features)p.layer=p.sourceLayer=this;return s}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return null!=t&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([s(O)],k.prototype,"attributeTableTemplate",void 0),e([s({readOnly:!0,json:{read:!1,write:!1}})],k.prototype,"capabilities",null),e([s({type:String})],k.prototype,"copyright",void 0),e([s({readOnly:!0})],k.prototype,"createQueryVersion",null),e([s(M("dateFieldsTimeReference"))],k.prototype,"dateFieldsTimeZone",void 0),e([s({readOnly:!0})],k.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],k.prototype,"definitionExpression",void 0),e([s({type:String})],k.prototype,"displayField",void 0),e([s({type:Boolean})],k.prototype,"editingEnabled",void 0),e([s(T)],k.prototype,"elevationInfo",void 0),e([s({type:[N],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],k.prototype,"fields",void 0),e([s(z.fieldsIndex)],k.prototype,"fieldsIndex",void 0),e([s({type:n,json:{name:"extent"}})],k.prototype,"fullExtent",void 0),e([s({type:["point","polygon","polyline","multipoint"],json:{read:{reader:l.read}}})],k.prototype,"geometryType",void 0),e([s({type:Boolean})],k.prototype,"hasZ",void 0),e([s(E)],k.prototype,"id",void 0),e([s({type:Boolean,readOnly:!0})],k.prototype,"isTable",null),e([s(S)],k.prototype,"labelsVisible",void 0),e([s({type:[B],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:C},write:!0}})],k.prototype,"labelingInfo",void 0),e([s(w)],k.prototype,"legendEnabled",void 0),e([s({type:["show","hide"]})],k.prototype,"listMode",void 0),e([s({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],k.prototype,"objectIdField",void 0),e([s(L)],k.prototype,"opacity",void 0),e([s({type:["GeoJSON"]})],k.prototype,"operationalLayerType",void 0),e([s(z.outFields)],k.prototype,"outFields",void 0),e([s({readOnly:!0})],k.prototype,"parsedUrl",null),e([s(P)],k.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:!0}})],k.prototype,"popupTemplate",void 0),e([s({types:V,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:Z}}}})],k.prototype,"renderer",null),e([s(q)],k.prototype,"screenSizePerspectiveEnabled",void 0),e([s({readOnly:!0})],k.prototype,"source",void 0),e([s({type:a})],k.prototype,"spatialReference",void 0),e([s({type:[J]})],k.prototype,"templates",void 0),e([s()],k.prototype,"title",void 0),e([s({json:{read:!1},readOnly:!0})],k.prototype,"type",void 0),e([s(U)],k.prototype,"url",null),k=e([p("esri.layers.GeoJSONLayer")],k);const W=k;export{W as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as r}from"tslib";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as t}from"../core/support/OwningCollection.js";import s from"./Layer.js";import{BlendLayer as i}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as p}from"./mixins/ScaleRangeLayer.js";import{GraphicsCollection as a}from"../support/GraphicsCollection.js";import n from"../symbols/support/ElevationInfo.js";let c=class extends(i(p(s))){constructor(r){super(r),this.elevationInfo=null,this.graphics=new a,this.screenSizePerspectiveEnabled=!0,this.type="graphics",this.internal=!1}destroy(){this.removeAll(),this.graphics.destroy()}add(r){return this.graphics.add(r),this}addMany(r){return this.graphics.addMany(r),this}removeAll(){return this.graphics.removeAll(),this}remove(r){this.graphics.remove(r)}removeMany(r){this.graphics.removeMany(r)}on(r,e){return super.on(r,e)}graphicChanged(r){this.emit("graphic-update",r)}};r([e({type:n})],c.prototype,"elevationInfo",void 0),r([e(t(a,"graphics"))],c.prototype,"graphics",void 0),r([e({type:["show","hide"]})],c.prototype,"listMode",void 0),r([e()],c.prototype,"screenSizePerspectiveEnabled",void 0),r([e({readOnly:!0})],c.prototype,"type",void 0),r([e({constructOnly:!0})],c.prototype,"internal",void 0),c=r([o("esri.layers.GraphicsLayer")],c);export{c as default};
5
+ import{__decorate as r}from"tslib";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as t}from"../core/support/OwningCollection.js";import s from"./Layer.js";import{BlendLayer as i}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as p}from"./mixins/ScaleRangeLayer.js";import{GraphicsCollection as a}from"../support/GraphicsCollection.js";import c from"../symbols/support/ElevationInfo.js";let n=class extends(i(p(s))){constructor(r){super(r),this.elevationInfo=null,this.graphics=new a,this.screenSizePerspectiveEnabled=!0,this.type="graphics",this.internal=!1}destroy(){this.removeAll(),this.graphics.destroy()}add(r){return this.graphics.add(r),this}addMany(r){return this.graphics.addMany(r),this}removeAll(){return this.graphics.removeAll(),this}remove(r){this.graphics.remove(r)}removeMany(r){this.graphics.removeMany(r)}graphicChanged(r){this.emit("graphic-update",r)}};r([e({type:c})],n.prototype,"elevationInfo",void 0),r([e(t(a,"graphics"))],n.prototype,"graphics",void 0),r([e({type:["show","hide"]})],n.prototype,"listMode",void 0),r([e()],n.prototype,"screenSizePerspectiveEnabled",void 0),r([e({readOnly:!0})],n.prototype,"type",void 0),r([e({constructOnly:!0})],n.prototype,"internal",void 0),n=r([o("esri.layers.GraphicsLayer")],n);export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../PopupTemplate.js";import t from"../core/Error.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import n from"../geometry/Extent.js";import p from"../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as l}from"../geometry/support/typeUtils.js";import a from"./Layer.js";import{OGCFeatureSource as d}from"./graphics/sources/OGCFeatureSource.js";import{APIKeyMixin as y}from"./mixins/APIKeyMixin.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as u}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as c}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as f}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as h}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{OrderedLayer as j}from"./mixins/OrderedLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{TrackableLayer as L}from"./mixins/TrackableLayer.js";import{elevationInfo as F,labelsVisible as S,legendEnabled as O,popupEnabled as w,screenSizePerspectiveEnabled as T,url as R}from"./support/commonProperties.js";import C from"./support/FeatureType.js";import D from"./support/Field.js";import{defineFieldProperties as P}from"./support/fieldProperties.js";import{fixRendererFields as E,fixTimeInfoFields as G}from"./support/fieldUtils.js";import q from"./support/LabelClass.js";import{reader as _}from"./support/labelingInfo.js";import{webSceneRendererTypes as B,rendererTypes as M}from"../renderers/support/typeUtils.js";import U from"../rest/support/Query.js";import{createPopupTemplate as A}from"../support/popupUtils.js";const N=P();let Q=class extends(c(y(u(h(f(m(j(I(L(x(g(v(b(i(a))))))))))))))){constructor(e){super(e),this.capabilities=null,this.collectionId=null,this.copyright=null,this.description=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelingInfo=null,this.labelsVisible=!0,this.legendEnabled=!0,this.maxRecordCount=null,this.objectIdField=null,this.operationalLayerType="OGCFeatureLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=null,this.title=null,this.type="ogc-feature",this.typeIdField=null,this.types=null,this.url=null}destroy(){this.source?.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["OGCFeatureServer"]},e).then(()=>this._fetchService(e))),this.when()}get defaultPopupTemplate(){return this.createPopupTemplate()}get effectiveMaxRecordCount(){return this.maxRecordCount??this.capabilities?.query.maxRecordCount??5e3}get isTable(){return this.loaded&&null==this.geometryType}set renderer(e){E(e,this.fieldsIndex),this._set("renderer",e)}on(e,r){return super.on(e,r)}createPopupTemplate(e){return A(this,e)}createQuery(){return new U}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,r){let t,i=!1;const o=r?.feature?.attributes,s=this.typeIdField&&o?.[this.typeIdField];return null!=s&&this.types&&(i=this.types.some(r=>r.id==s&&(t=r.domains?.[e],"inherited"===t?.type&&(t=this._getLayerDomain(e)),!0))),i||t||(t=this._getLayerDomain(e)),t}queryFeatures(e,r){return this.load().then(()=>this.source.queryFeatures(U.from(e)||this.createQuery(),r)).then(e=>(e?.features?.forEach(e=>{e.layer=e.sourceLayer=this}),e))}async queryAttributeBins(e,r){throw new t("OGCFeatureLayer","Layer source does not support queryAttributeBins capability")}serviceSupportsSpatialReference(e){return this.source?.serviceSupportsSpatialReference(e)??!1}async _fetchService(e){await this.source.load(e),this.read(this.source.featureDefinition,{origin:"service"}),E(this.renderer,this.fieldsIndex),G(this.timeInfo,this.fieldsIndex)}_getLayerDomain(e){if(!this.fields)return null;for(const r of this.fields)if(r.name===e&&r.domain)return r.domain;return null}};e([o({readOnly:!0,json:{origins:{service:{read:!0}}}})],Q.prototype,"capabilities",void 0),e([o({type:String,json:{write:!0}})],Q.prototype,"collectionId",void 0),e([o({type:String})],Q.prototype,"copyright",void 0),e([o({readOnly:!0})],Q.prototype,"defaultPopupTemplate",null),e([o({readOnly:!0,type:String,json:{origins:{service:{name:"collection.description"}}}})],Q.prototype,"description",void 0),e([o({type:String})],Q.prototype,"displayField",void 0),e([o({type:Number})],Q.prototype,"effectiveMaxRecordCount",null),e([o(F)],Q.prototype,"elevationInfo",void 0),e([o({type:[D],json:{origins:{service:{name:"layerDefinition.fields"}}}})],Q.prototype,"fields",void 0),e([o(N.fieldsIndex)],Q.prototype,"fieldsIndex",void 0),e([o({readOnly:!0,type:n,json:{origins:{service:{name:"layerDefinition.extent"}}}})],Q.prototype,"fullExtent",void 0),e([o({type:l.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:l.read}}}}})],Q.prototype,"geometryType",void 0),e([o({type:Boolean,json:{origins:{service:{name:"layerDefinition.hasZ"}}}})],Q.prototype,"hasZ",void 0),e([o({type:Boolean,readOnly:!0})],Q.prototype,"isTable",null),e([o({type:[q],json:{origins:{"web-document":{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:_},write:!0}}}})],Q.prototype,"labelingInfo",void 0),e([o(S)],Q.prototype,"labelsVisible",void 0),e([o(O)],Q.prototype,"legendEnabled",void 0),e([o({type:Number})],Q.prototype,"maxRecordCount",void 0),e([o({type:String,json:{origins:{service:{name:"layerDefinition.objectIdField"}}}})],Q.prototype,"objectIdField",void 0),e([o({type:["OGCFeatureLayer"]})],Q.prototype,"operationalLayerType",void 0),e([o(w)],Q.prototype,"popupEnabled",void 0),e([o({type:r,json:{name:"popupInfo",write:!0}})],Q.prototype,"popupTemplate",void 0),e([o({types:M,json:{origins:{service:{name:"layerDefinition.drawingInfo.renderer",write:!1},"web-scene":{types:B,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:!0}})],Q.prototype,"renderer",null),e([o(T)],Q.prototype,"screenSizePerspectiveEnabled",void 0),e([o({readOnly:!0})],Q.prototype,"source",void 0),e([o({readOnly:!0,type:p,json:{origins:{service:{read:!0}}}})],Q.prototype,"spatialReference",void 0),e([o({type:String,json:{write:{enabled:!0,ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"collection.title"}}}})],Q.prototype,"title",void 0),e([o({readOnly:!0,json:{read:!1}})],Q.prototype,"type",void 0),e([o({type:String,readOnly:!0})],Q.prototype,"typeIdField",void 0),e([o({type:[C]})],Q.prototype,"types",void 0),e([o(R)],Q.prototype,"url",void 0),Q=e([s("esri.layers.OGCFeatureLayer")],Q);const V=Q;export{V as default};
5
+ import{__decorate as e}from"tslib";import r from"../PopupTemplate.js";import t from"../core/Error.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import p from"../geometry/Extent.js";import n from"../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as l}from"../geometry/support/typeUtils.js";import a from"./Layer.js";import{OGCFeatureSource as d}from"./graphics/sources/OGCFeatureSource.js";import{APIKeyMixin as y}from"./mixins/APIKeyMixin.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as u}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as c}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as f}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as h}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{OrderedLayer as j}from"./mixins/OrderedLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{TrackableLayer as L}from"./mixins/TrackableLayer.js";import{elevationInfo as F,labelsVisible as S,legendEnabled as O,popupEnabled as w,screenSizePerspectiveEnabled as T,url as R}from"./support/commonProperties.js";import C from"./support/FeatureType.js";import D from"./support/Field.js";import{defineFieldProperties as P}from"./support/fieldProperties.js";import{fixRendererFields as E,fixTimeInfoFields as G}from"./support/fieldUtils.js";import q from"./support/LabelClass.js";import{reader as _}from"./support/labelingInfo.js";import{webSceneRendererTypes as B,rendererTypes as M}from"../renderers/support/typeUtils.js";import U from"../rest/support/Query.js";import{createPopupTemplate as A}from"../support/popupUtils.js";const N=P();let Q=class extends(c(y(u(h(f(m(j(I(L(x(g(v(b(i(a))))))))))))))){constructor(e){super(e),this.capabilities=null,this.collectionId=null,this.copyright=null,this.description=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelingInfo=null,this.labelsVisible=!0,this.legendEnabled=!0,this.maxRecordCount=null,this.objectIdField=null,this.operationalLayerType="OGCFeatureLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=null,this.title=null,this.type="ogc-feature",this.typeIdField=null,this.types=null,this.url=null}destroy(){this.source?.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["OGCFeatureServer"]},e).then(()=>this._fetchService(e))),this.when()}get defaultPopupTemplate(){return this.createPopupTemplate()}get effectiveMaxRecordCount(){return this.maxRecordCount??this.capabilities?.query.maxRecordCount??5e3}get isTable(){return this.loaded&&null==this.geometryType}set renderer(e){E(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return A(this,e)}createQuery(){return new U}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,r){let t,i=!1;const o=r?.feature?.attributes,s=this.typeIdField&&o?.[this.typeIdField];return null!=s&&this.types&&(i=this.types.some(r=>r.id==s&&(t=r.domains?.[e],"inherited"===t?.type&&(t=this._getLayerDomain(e)),!0))),i||t||(t=this._getLayerDomain(e)),t}queryFeatures(e,r){return this.load().then(()=>this.source.queryFeatures(U.from(e)||this.createQuery(),r)).then(e=>(e?.features?.forEach(e=>{e.layer=e.sourceLayer=this}),e))}async queryAttributeBins(e,r){throw new t("OGCFeatureLayer","Layer source does not support queryAttributeBins capability")}serviceSupportsSpatialReference(e){return this.source?.serviceSupportsSpatialReference(e)??!1}async _fetchService(e){await this.source.load(e),this.read(this.source.featureDefinition,{origin:"service"}),E(this.renderer,this.fieldsIndex),G(this.timeInfo,this.fieldsIndex)}_getLayerDomain(e){if(!this.fields)return null;for(const r of this.fields)if(r.name===e&&r.domain)return r.domain;return null}};e([o({readOnly:!0,json:{origins:{service:{read:!0}}}})],Q.prototype,"capabilities",void 0),e([o({type:String,json:{write:!0}})],Q.prototype,"collectionId",void 0),e([o({type:String})],Q.prototype,"copyright",void 0),e([o({readOnly:!0})],Q.prototype,"defaultPopupTemplate",null),e([o({readOnly:!0,type:String,json:{origins:{service:{name:"collection.description"}}}})],Q.prototype,"description",void 0),e([o({type:String})],Q.prototype,"displayField",void 0),e([o({type:Number})],Q.prototype,"effectiveMaxRecordCount",null),e([o(F)],Q.prototype,"elevationInfo",void 0),e([o({type:[D],json:{origins:{service:{name:"layerDefinition.fields"}}}})],Q.prototype,"fields",void 0),e([o(N.fieldsIndex)],Q.prototype,"fieldsIndex",void 0),e([o({readOnly:!0,type:p,json:{origins:{service:{name:"layerDefinition.extent"}}}})],Q.prototype,"fullExtent",void 0),e([o({type:l.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:l.read}}}}})],Q.prototype,"geometryType",void 0),e([o({type:Boolean,json:{origins:{service:{name:"layerDefinition.hasZ"}}}})],Q.prototype,"hasZ",void 0),e([o({type:Boolean,readOnly:!0})],Q.prototype,"isTable",null),e([o({type:[q],json:{origins:{"web-document":{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:_},write:!0}}}})],Q.prototype,"labelingInfo",void 0),e([o(S)],Q.prototype,"labelsVisible",void 0),e([o(O)],Q.prototype,"legendEnabled",void 0),e([o({type:Number})],Q.prototype,"maxRecordCount",void 0),e([o({type:String,json:{origins:{service:{name:"layerDefinition.objectIdField"}}}})],Q.prototype,"objectIdField",void 0),e([o({type:["OGCFeatureLayer"]})],Q.prototype,"operationalLayerType",void 0),e([o(w)],Q.prototype,"popupEnabled",void 0),e([o({type:r,json:{name:"popupInfo",write:!0}})],Q.prototype,"popupTemplate",void 0),e([o({types:M,json:{origins:{service:{name:"layerDefinition.drawingInfo.renderer",write:!1},"web-scene":{types:B,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:!0}})],Q.prototype,"renderer",null),e([o(T)],Q.prototype,"screenSizePerspectiveEnabled",void 0),e([o({readOnly:!0})],Q.prototype,"source",void 0),e([o({readOnly:!0,type:n,json:{origins:{service:{read:!0}}}})],Q.prototype,"spatialReference",void 0),e([o({type:String,json:{write:{enabled:!0,ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"collection.title"}}}})],Q.prototype,"title",void 0),e([o({readOnly:!0,json:{read:!1}})],Q.prototype,"type",void 0),e([o({type:String,readOnly:!0})],Q.prototype,"typeIdField",void 0),e([o({type:[C]})],Q.prototype,"types",void 0),e([o(R)],Q.prototype,"url",void 0),Q=e([s("esri.layers.OGCFeatureLayer")],Q);const V=Q;export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Graphic.js";import r from"../PopupTemplate.js";import i from"../core/Clonable.js";import s from"../core/Collection.js";import o from"../core/Error.js";import{abortHandle as a}from"../core/handleUtils.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d,isAbortError as y,throwIfNotAbortError as u}from"../core/promiseUtils.js";import{whenOnce as c}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{getProperties as f}from"../core/accessorSupport/utils.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Point.js";import b from"./Layer.js";import{NoModelError as w,MultipleModelsError as I}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{CustomParametersMixin as F}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as S}from"./mixins/EditBusLayer.js";import{OperationalLayer as _}from"./mixins/OperationalLayer.js";import{PortalLayer as O}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as P}from"./mixins/ScaleRangeLayer.js";import{SceneService as A}from"./mixins/SceneService.js";import{useViewTimeProperty as T}from"./mixins/TemporalLayer.js";import{TemporalSceneLayer as x}from"./mixins/TemporalSceneLayer.js";import{isHostedAgolService as E}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as D}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as U}from"./support/capabilities.js";import{elevationInfo as R,labelsVisible as q,legendEnabled as C,popupEnabled as G,attributeTableTemplate as N,screenSizePerspectiveEnabled as Q}from"./support/commonProperties.js";import{getFieldDomain as V,computeEffectiveEditingEnabled as M,getGlobalIdToObjectIdMap as k}from"./support/featureLayerUtils.js";import{FeatureReduction as K}from"./support/FeatureReduction.js";import $ from"./support/FeatureReductionSelection.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import z from"./support/FieldsIndex.js";import{fixRendererFields as W,unpackFieldNames as Z}from"./support/fieldUtils.js";import{I3SNodePageDefinition as B,I3SMaterialDefinition as J,I3STextureSetDefinition as X,I3SGeometryDefinition as Y}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as ee,isFileSupported as te}from"./support/infoFor3D.js";import re from"./support/LabelClass.js";import{reader as ie}from"./support/labelingInfo.js";import se from"./support/LayerFloorInfo.js";import{layerLookupMap as oe}from"./support/lazyLayerLoader.js";import{getMeshTransformForMetersToSpatialReference as ae}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as ne}from"./support/RangeInfo.js";import le from"./support/SceneFilter.js";import{cacheIsOutOfSync as pe}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as de}from"./support/sceneLayerStatistics.js";import{loadStyleRenderer as ye}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as ue}from"../renderers/support/typeUtils.js";import ce from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as he,elevationModeUnsupportedMessage as fe,featureExpressionUnsupportedMessage as me}from"../support/elevationInfoUtils.js";import{createPopupTemplate as ge}from"../support/popupUtils.js";import{extractZipFiles as ve}from"../support/zipUtils.js";import{queryAttributesFromCachedAttributesId as be}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as we,getFetchPopupTemplate as Ie}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Le}from"../webdoc/support/opacityUtils.js";const je=new Set(["3DObject","Point"]),Fe=H();let Se=class extends(x(S(A(j(_(O(P(p(F(L(i.ClonableMixin(b)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new s,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null),this.associatedLayer=l(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?V(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new z(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:B.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&M(this.associatedLayer)}get geometryType(){return Oe[this.profile]||"mesh"}set renderer(e){W(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:U;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:y},operations:{supportsEditing:u,supportsAdd:c,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:y,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:u&&b,supportsAdd:w&&c&&b,supportsDelete:w&&f&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some(t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e)),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some(t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e)),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&_e[r]?_e[r]:(n.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(d),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await ye(this,{origin:"service"},t),W(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){n.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ce;return"mesh"===this.geometryType?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e})}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=Z(this.fieldsIndex,await we(this,Ie(this)));return be(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new o("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryObjectIds(e||this.createQuery(),t))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryAttachments(e,t))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(n.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return ge(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new o("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some(t=>t.name===e)}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(0,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:a}=s,n=!!s.infoFor3D,l=i?.globalIdUsed??!0;if(n&&null==a)throw new o(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(n&&!l)throw new o(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return E(s.url)&&n&&null!=e.deleteFeatures&&null!=a&&(i={...i,globalIdToObjectId:await k(s,e.deleteFeatures,a)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw n.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new o("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce((e,t)=>ee(this.infoFor3D,t)?e+1:e,0);0===s&&r(new w),s>1&&r(new I);const a=this.spatialReference,l=t.location??new v({x:0,y:0,z:0,spatialReference:a}),p=l.spatialReference.isGeographic?"local":"georeferenced",{default:d}=await import("../geometry/Mesh.js"),y=d.createWithExternalSource(l,{type:"client",files:i},{vertexSpace:p,transform:ae(l.spatialReference),unitConversionDisabled:!0}),[u]=await this.uploadAssets([y],{...t,useAssetOrigin:!t.location});return u}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;if(!t)return e;return(await ve(e)).filter(e=>te(t,e))}validateLayer(e){if(e.layerType&&!je.has(e.layerType))throw new o("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new o("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new o("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new o("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new o("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new o("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some(t=>t.name===e.name),r=!!this.associatedLayer?.fields?.some(t=>t&&e.name===t.name),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled","attributeTableTemplate"],t=f(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(2===o||3===o)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");if(null==this.associatedLayer?.infoFor3D||!e||!E(this.associatedLayer?.url)||!pe(this))return;f(this).setAtOrigin("fullExtent",e.clone(),2)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await D(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await oe.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){y(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){const e=new AbortController;this.addHandles(a(e));try{await c(()=>this.popupEnabled&&null!=this.popupTemplate,e.signal)}catch(r){return void u(r)}const t=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?n.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):n.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&he(n.getLogger(this),fe("Mesh scene layers","relative-to-scene",e)),he(n.getLogger(this),me("Scene layers",e))}async fetchStatistics(e,t){return await de({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};e([h({types:{key:"type",base:K,typeMap:{selection:$}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],Se.prototype,"featureReduction",void 0),e([h({type:[ne],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],Se.prototype,"rangeInfos",void 0),e([h({json:{read:!1}})],Se.prototype,"associatedLayer",void 0),e([h({type:["show","hide"]})],Se.prototype,"listMode",void 0),e([h({type:["ArcGISSceneServiceLayer"]})],Se.prototype,"operationalLayerType",void 0),e([h({json:{read:!1},readOnly:!0})],Se.prototype,"type",void 0),e([h({...Fe.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"fields",void 0),e([h()],Se.prototype,"types",null),e([h()],Se.prototype,"typeIdField",null),e([h()],Se.prototype,"templates",null),e([h()],Se.prototype,"formTemplate",null),e([h({readOnly:!0,clonable:!1})],Se.prototype,"fieldsIndex",null),e([h({type:se,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Se.prototype,"floorInfo",void 0),e([h(Fe.outFields)],Se.prototype,"outFields",void 0),e([h({type:B,readOnly:!0,json:{read:!1}})],Se.prototype,"nodePages",void 0),e([m("service","nodePages",["nodePages","pointNodePages"])],Se.prototype,"readNodePages",null),e([h({type:[J],readOnly:!0})],Se.prototype,"materialDefinitions",void 0),e([h({type:[X],readOnly:!0})],Se.prototype,"textureSetDefinitions",void 0),e([h({type:[Y],readOnly:!0})],Se.prototype,"geometryDefinitions",void 0),e([h({readOnly:!0})],Se.prototype,"serviceUpdateTimeStamp",void 0),e([h({readOnly:!0})],Se.prototype,"attributeStorageInfo",void 0),e([h({readOnly:!0})],Se.prototype,"statisticsInfo",void 0),e([h({type:s.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],Se.prototype,"excludeObjectIds",void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Se.prototype,"definitionExpression",void 0),e([h({type:le,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Se.prototype,"filter",void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Se.prototype,"path",void 0),e([h(R)],Se.prototype,"elevationInfo",null),e([h({readOnly:!0,json:{read:!1}})],Se.prototype,"effectiveCapabilities",null),e([h({readOnly:!0})],Se.prototype,"effectiveEditingEnabled",null),e([h({type:String})],Se.prototype,"geometryType",null),e([h(q)],Se.prototype,"labelsVisible",void 0),e([h({type:[re],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:ie},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:ie},write:!0}})],Se.prototype,"labelingInfo",void 0),e([h(C)],Se.prototype,"legendEnabled",void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?Le(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],Se.prototype,"opacity",void 0),e([h({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"priority",void 0),e([h({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"semantic",void 0),e([h({types:ue,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],Se.prototype,"renderer",null),e([h({json:{read:!1}})],Se.prototype,"cachedDrawingInfo",void 0),e([m("service","cachedDrawingInfo")],Se.prototype,"readCachedDrawingInfo",null),e([h({readOnly:!0,json:{read:!1}})],Se.prototype,"capabilities",null),e([h({type:Boolean,json:{read:!1}})],Se.prototype,"editingEnabled",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Se.prototype,"infoFor3D",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Se.prototype,"relationships",null),e([h(G)],Se.prototype,"popupEnabled",void 0),e([h({type:r,json:{name:"popupInfo",write:!0}})],Se.prototype,"popupTemplate",void 0),e([h({readOnly:!0,json:{read:!1}})],Se.prototype,"defaultPopupTemplate",null),e([h(N)],Se.prototype,"attributeTableTemplate",void 0),e([h({type:String,json:{read:!1}})],Se.prototype,"objectIdField",void 0),e([m("service","objectIdField",["objectIdField","fields"])],Se.prototype,"readObjectIdField",null),e([h({type:String,json:{read:!1}})],Se.prototype,"globalIdField",void 0),e([m("service","globalIdField",["globalIdField","fields"])],Se.prototype,"readGlobalIdField",null),e([h({readOnly:!0,type:String,json:{read:!1}})],Se.prototype,"displayField",null),e([h({type:String,json:{read:!1}})],Se.prototype,"profile",void 0),e([m("service","profile",["store.profile"])],Se.prototype,"readProfile",null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],Se.prototype,"normalReferenceFrame",void 0),e([h(Q)],Se.prototype,"screenSizePerspectiveEnabled",void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"serviceItemId",void 0),e([h(T)],Se.prototype,"useViewTime",null),Se=e([g("esri.layers.SceneLayer")],Se);const _e={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Oe={"mesh-pyramids":"mesh",points:"point"},Pe=Se;export{Pe as default};
5
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import r from"../PopupTemplate.js";import i from"../core/Clonable.js";import s from"../core/Collection.js";import o from"../core/Error.js";import{abortHandle as a}from"../core/handleUtils.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d,isAbortError as y,throwIfNotAbortError as u}from"../core/promiseUtils.js";import{whenOnce as c}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{getProperties as f}from"../core/accessorSupport/utils.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Point.js";import b from"./Layer.js";import{NoModelError as w,MultipleModelsError as I}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{CustomParametersMixin as F}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as S}from"./mixins/EditBusLayer.js";import{OperationalLayer as _}from"./mixins/OperationalLayer.js";import{PortalLayer as O}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as P}from"./mixins/ScaleRangeLayer.js";import{SceneService as A}from"./mixins/SceneService.js";import{useViewTimeProperty as T}from"./mixins/TemporalLayer.js";import{TemporalSceneLayer as x}from"./mixins/TemporalSceneLayer.js";import{isHostedAgolService as E}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as D}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as U}from"./support/capabilities.js";import{elevationInfo as R,labelsVisible as q,legendEnabled as C,popupEnabled as G,attributeTableTemplate as N,screenSizePerspectiveEnabled as Q}from"./support/commonProperties.js";import{getFieldDomain as V,computeEffectiveEditingEnabled as M,getGlobalIdToObjectIdMap as k}from"./support/featureLayerUtils.js";import{FeatureReduction as K}from"./support/FeatureReduction.js";import $ from"./support/FeatureReductionSelection.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import z from"./support/FieldsIndex.js";import{fixRendererFields as W,unpackFieldNames as Z}from"./support/fieldUtils.js";import{I3SNodePageDefinition as B,I3SMaterialDefinition as J,I3STextureSetDefinition as X,I3SGeometryDefinition as Y}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as ee,isFileSupported as te}from"./support/infoFor3D.js";import re from"./support/LabelClass.js";import{reader as ie}from"./support/labelingInfo.js";import se from"./support/LayerFloorInfo.js";import{layerLookupMap as oe}from"./support/lazyLayerLoader.js";import{getMeshTransformForMetersToSpatialReference as ae}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as ne}from"./support/RangeInfo.js";import le from"./support/SceneFilter.js";import{cacheIsOutOfSync as pe}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as de}from"./support/sceneLayerStatistics.js";import{loadStyleRenderer as ye}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as ue}from"../renderers/support/typeUtils.js";import ce from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as he,elevationModeUnsupportedMessage as fe,featureExpressionUnsupportedMessage as me}from"../support/elevationInfoUtils.js";import{createPopupTemplate as ge}from"../support/popupUtils.js";import{extractZipFiles as ve}from"../support/zipUtils.js";import{queryAttributesFromCachedAttributesId as be}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as we,getFetchPopupTemplate as Ie}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Le}from"../webdoc/support/opacityUtils.js";const je=new Set(["3DObject","Point"]),Fe=H();let Se=class extends(x(S(A(j(_(O(P(p(F(L(i.ClonableMixin(b)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new s,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null),this.associatedLayer=l(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?V(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new z(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:B.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&M(this.associatedLayer)}get geometryType(){return Oe[this.profile]||"mesh"}set renderer(e){W(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:U;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:y},operations:{supportsEditing:u,supportsAdd:c,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:y,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:u&&b,supportsAdd:w&&c&&b,supportsDelete:w&&f&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some(t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e)),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some(t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e)),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&_e[r]?_e[r]:(n.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(d),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await ye(this,{origin:"service"},t),W(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){n.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ce;return"mesh"===this.geometryType?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e})}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=Z(this.fieldsIndex,await we(this,Ie(this)));return be(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new o("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryObjectIds(e||this.createQuery(),t))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryAttachments(e,t))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(n.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return ge(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new o("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some(t=>t.name===e)}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(0,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:a}=s,n=!!s.infoFor3D,l=i?.globalIdUsed??!0;if(n&&null==a)throw new o(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(n&&!l)throw new o(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return E(s.url)&&n&&null!=e.deleteFeatures&&null!=a&&(i={...i,globalIdToObjectId:await k(s,e.deleteFeatures,a)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw n.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new o("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce((e,t)=>ee(this.infoFor3D,t)?e+1:e,0);0===s&&r(new w),s>1&&r(new I);const a=this.spatialReference,l=t.location??new v({x:0,y:0,z:0,spatialReference:a}),p=l.spatialReference.isGeographic?"local":"georeferenced",{default:d}=await import("../geometry/Mesh.js"),y=d.createWithExternalSource(l,{type:"client",files:i},{vertexSpace:p,transform:ae(l.spatialReference),unitConversionDisabled:!0}),[u]=await this.uploadAssets([y],{...t,useAssetOrigin:!t.location});return u}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;if(!t)return e;return(await ve(e)).filter(e=>te(t,e))}validateLayer(e){if(e.layerType&&!je.has(e.layerType))throw new o("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new o("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new o("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new o("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new o("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new o("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some(t=>t.name===e.name),r=!!this.associatedLayer?.fields?.some(t=>t&&e.name===t.name),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled","attributeTableTemplate"],t=f(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(2===o||3===o)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");if(null==this.associatedLayer?.infoFor3D||!e||!E(this.associatedLayer?.url)||!pe(this))return;f(this).setAtOrigin("fullExtent",e.clone(),2)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await D(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await oe.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){y(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){const e=new AbortController;this.addHandles(a(e));try{await c(()=>this.popupEnabled&&null!=this.popupTemplate,e.signal)}catch(r){return void u(r)}const t=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?n.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):n.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&he(n.getLogger(this),fe("Mesh scene layers","relative-to-scene",e)),he(n.getLogger(this),me("Scene layers",e))}async fetchStatistics(e,t){return await de({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};e([h({types:{key:"type",base:K,typeMap:{selection:$}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],Se.prototype,"featureReduction",void 0),e([h({type:[ne],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],Se.prototype,"rangeInfos",void 0),e([h({json:{read:!1}})],Se.prototype,"associatedLayer",void 0),e([h({type:["show","hide"]})],Se.prototype,"listMode",void 0),e([h({type:["ArcGISSceneServiceLayer"]})],Se.prototype,"operationalLayerType",void 0),e([h({json:{read:!1},readOnly:!0})],Se.prototype,"type",void 0),e([h({...Fe.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"fields",void 0),e([h()],Se.prototype,"types",null),e([h()],Se.prototype,"typeIdField",null),e([h()],Se.prototype,"templates",null),e([h()],Se.prototype,"formTemplate",null),e([h({readOnly:!0,clonable:!1})],Se.prototype,"fieldsIndex",null),e([h({type:se,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Se.prototype,"floorInfo",void 0),e([h(Fe.outFields)],Se.prototype,"outFields",void 0),e([h({type:B,readOnly:!0,json:{read:!1}})],Se.prototype,"nodePages",void 0),e([m("service","nodePages",["nodePages","pointNodePages"])],Se.prototype,"readNodePages",null),e([h({type:[J],readOnly:!0})],Se.prototype,"materialDefinitions",void 0),e([h({type:[X],readOnly:!0})],Se.prototype,"textureSetDefinitions",void 0),e([h({type:[Y],readOnly:!0})],Se.prototype,"geometryDefinitions",void 0),e([h({readOnly:!0})],Se.prototype,"serviceUpdateTimeStamp",void 0),e([h({readOnly:!0})],Se.prototype,"attributeStorageInfo",void 0),e([h({readOnly:!0})],Se.prototype,"statisticsInfo",void 0),e([h({type:s.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],Se.prototype,"excludeObjectIds",void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Se.prototype,"definitionExpression",void 0),e([h({type:le,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Se.prototype,"filter",void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Se.prototype,"path",void 0),e([h(R)],Se.prototype,"elevationInfo",null),e([h({readOnly:!0,json:{read:!1}})],Se.prototype,"effectiveCapabilities",null),e([h({readOnly:!0})],Se.prototype,"effectiveEditingEnabled",null),e([h({type:String})],Se.prototype,"geometryType",null),e([h(q)],Se.prototype,"labelsVisible",void 0),e([h({type:[re],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:ie},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:ie},write:!0}})],Se.prototype,"labelingInfo",void 0),e([h(C)],Se.prototype,"legendEnabled",void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?Le(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],Se.prototype,"opacity",void 0),e([h({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"priority",void 0),e([h({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"semantic",void 0),e([h({types:ue,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],Se.prototype,"renderer",null),e([h({json:{read:!1}})],Se.prototype,"cachedDrawingInfo",void 0),e([m("service","cachedDrawingInfo")],Se.prototype,"readCachedDrawingInfo",null),e([h({readOnly:!0,json:{read:!1}})],Se.prototype,"capabilities",null),e([h({type:Boolean,json:{read:!1}})],Se.prototype,"editingEnabled",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Se.prototype,"infoFor3D",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Se.prototype,"relationships",null),e([h(G)],Se.prototype,"popupEnabled",void 0),e([h({type:r,json:{name:"popupInfo",write:!0}})],Se.prototype,"popupTemplate",void 0),e([h({readOnly:!0,json:{read:!1}})],Se.prototype,"defaultPopupTemplate",null),e([h(N)],Se.prototype,"attributeTableTemplate",void 0),e([h({type:String,json:{read:!1}})],Se.prototype,"objectIdField",void 0),e([m("service","objectIdField",["objectIdField","fields"])],Se.prototype,"readObjectIdField",null),e([h({type:String,json:{read:!1}})],Se.prototype,"globalIdField",void 0),e([m("service","globalIdField",["globalIdField","fields"])],Se.prototype,"readGlobalIdField",null),e([h({readOnly:!0,type:String,json:{read:!1}})],Se.prototype,"displayField",null),e([h({type:String,json:{read:!1}})],Se.prototype,"profile",void 0),e([m("service","profile",["store.profile"])],Se.prototype,"readProfile",null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],Se.prototype,"normalReferenceFrame",void 0),e([h(Q)],Se.prototype,"screenSizePerspectiveEnabled",void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"serviceItemId",void 0),e([h(T)],Se.prototype,"useViewTime",null),Se=e([g("esri.layers.SceneLayer")],Se);const _e={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Oe={"mesh-pyramids":"mesh",points:"point"},Pe=Se;export{Pe as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../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{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import f from"./Layer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as F}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as j}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as v}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as L}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as _}from"./support/arcgisLayerUrl.js";import{id as C}from"./support/commonProperties.js";import{ensureLayerCredential as O,computeEffectiveEditingEnabled as P,addAttachment as G,updateAttachment as U,applyEdits as q,createQuery as D,deleteAttachments as M,fetchRecomputedExtents as A,computeDomainFromSubtypes as k,getFeatureSubtype as R,queryAttachments as $,queryObjectIds as N,queryFeatureCount as Q,queryExtent as H,queryRelatedFeatures as J,queryRelatedFeaturesCount as V,hasDataChanged as B}from"./support/featureLayerUtils.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixTimeInfoFields as K}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as Z,createSimpleRenderersWithUniqueColors as W}from"./support/subtypeGroupLayerUtils.js";import X from"./support/SubtypeSublayer.js";import Y from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as ee}from"./support/versionUtils.js";import te from"../rest/support/Query.js";import{isNumber as re}from"../support/guards.js";const se="SubtypeGroupLayer";function ie(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function oe(e,t){const r=[];for(const s of e){const e=new X;e.read(s,t),r.push(e)}return r}const ae=z();function ne(){return{name:"layerType",read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let ue=class extends(v(F(j(w(I(E(x(g(L(T(a(S(b(t.ClonableMixin(f))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(r.ofType(X)),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 0:return s(this,t);case 1: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(()=>O(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 P(this)}get operationalLayerType(){return this.isTable?"SubtypeGroupTable":"SubtypeGroupLayer"}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?_(this.url,t):t}async addAttachment(e,t){const r=await G(this,e,t,se);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const s=await U(this,e,t,r,se);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=d(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){const r=await M(this,e,t,se);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return A(this,e,se)}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=k(this,e);if(t)return t}const r=R(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 $(this,e,t,se)}async queryFeatures(e,t){const r=await this.load(),s=te.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,se)).filter(re)}async queryFeatureCount(e,t){return Q(this,e,t,se)}async queryExtent(e,t){return H(this,e,t,se)}async queryRelatedFeatures(e,t){return J(this,e,t,se)}async queryRelatedFeaturesCount(e,t){return V(this,e,t,se)}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,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(ie(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(ie(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&&ee(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);if(t)o(r,t,()=>[]).push(e);else{const t=e.getObjectId()??e.attributes[this.objectIdField];s.set(t,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(),K(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return B(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([c({readOnly:!0})],ue.prototype,"createQueryVersion",null),e([c({readOnly:!0})],ue.prototype,"editingEnabled",null),e([c({readOnly:!0})],ue.prototype,"effectiveEditingEnabled",null),e([c({...ae.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ue.prototype,"fields",void 0),e([c(ae.fieldsIndex)],ue.prototype,"fieldsIndex",void 0),e([c(C)],ue.prototype,"id",void 0),e([c({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],ue.prototype,"listMode",void 0),e([c({type:["SubtypeGroupLayer","SubtypeGroupTable"],json:{...ne(),origins:{"web-document":ne(),"portal-item":ne()}}})],ue.prototype,"operationalLayerType",null),e([c(ae.outFields)],ue.prototype,"outFields",void 0),e([c({clonable:!1})],ue.prototype,"source",null),e([c({type:r.ofType(X),json:{origins:{service:{read:{source:"subtypes",reader(e,t,s){let i=null;if(this.useUniqueColorsForSublayers){const r=Z(t,s);i=r?W(e.length,r):null}const o=e.map(({code:e},r)=>{const o=new X({subtypeCode:e});o.read(t,s);const a=i?.[r];return a&&o.read({drawingInfo:{renderer:a.toJSON()}},s),o});return new(r.ofType(X))(o)}}}},read:{source:["layers","tables"],reader(e,t,s){let i;return"SubtypeGroupLayer"===t.layerType&&t.layers?.length?i=oe(t.layers,s):"SubtypeGroupTable"===t.layerType&&t.tables?.length&&(i=oe(t.tables,s)),new(r.ofType(X))(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}}}})],ue.prototype,"sublayers",void 0),e([c()],ue.prototype,"useUniqueColorsForSublayers",void 0),e([c({type:Y})],ue.prototype,"timeInfo",void 0),e([c({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],ue.prototype,"title",void 0),e([h("service","title",["name"])],ue.prototype,"readTitleFromService",null),e([c({json:{read:!1}})],ue.prototype,"type",void 0),e([c({clonable:!1,readOnly:!0})],ue.prototype,"featureTitleFields",null),ue=e([m("esri.layers.SubtypeGroupLayer")],ue);const le=ue;export{le as default};
5
+ import{__decorate as e}from"tslib";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{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import f from"./Layer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as F}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as j}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as v}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as L}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as _}from"./support/arcgisLayerUrl.js";import{id as C}from"./support/commonProperties.js";import{ensureLayerCredential as O,computeEffectiveEditingEnabled as P,addAttachment as G,updateAttachment as U,applyEdits as q,createQuery as D,deleteAttachments as M,fetchRecomputedExtents as A,computeDomainFromSubtypes as k,getFeatureSubtype as R,queryAttachments as $,queryObjectIds as N,queryFeatureCount as Q,queryExtent as H,queryRelatedFeatures as J,queryRelatedFeaturesCount as V,hasDataChanged as B}from"./support/featureLayerUtils.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixTimeInfoFields as K}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as Z,createSimpleRenderersWithUniqueColors as W}from"./support/subtypeGroupLayerUtils.js";import X from"./support/SubtypeSublayer.js";import Y from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as ee}from"./support/versionUtils.js";import te from"../rest/support/Query.js";import{isNumber as re}from"../support/guards.js";const se="SubtypeGroupLayer";function ie(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function oe(e,t){const r=[];for(const s of e){const e=new X;e.read(s,t),r.push(e)}return r}const ae=z();function ne(){return{name:"layerType",read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let ue=class extends(v(F(j(w(I(E(x(g(L(T(a(S(b(t.ClonableMixin(f))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(r.ofType(X)),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 0:return s(this,t);case 1: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(()=>O(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 P(this)}get operationalLayerType(){return this.isTable?"SubtypeGroupTable":"SubtypeGroupLayer"}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?_(this.url,t):t}async addAttachment(e,t){const r=await G(this,e,t,se);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const s=await U(this,e,t,r,se);return this.lastEditsEventDate=new Date,s}async applyEdits(e,t){return q(this,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=d(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){const r=await M(this,e,t,se);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return A(this,e,se)}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=k(this,e);if(t)return t}const r=R(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 $(this,e,t,se)}async queryFeatures(e,t){const r=await this.load(),s=te.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,se)).filter(re)}async queryFeatureCount(e,t){return Q(this,e,t,se)}async queryExtent(e,t){return H(this,e,t,se)}async queryRelatedFeatures(e,t){return J(this,e,t,se)}async queryRelatedFeaturesCount(e,t){return V(this,e,t,se)}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,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(ie(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(ie(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&&ee(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);if(t)o(r,t,()=>[]).push(e);else{const t=e.getObjectId()??e.attributes[this.objectIdField];s.set(t,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(),K(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return B(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([c({readOnly:!0})],ue.prototype,"createQueryVersion",null),e([c({readOnly:!0})],ue.prototype,"editingEnabled",null),e([c({readOnly:!0})],ue.prototype,"effectiveEditingEnabled",null),e([c({...ae.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ue.prototype,"fields",void 0),e([c(ae.fieldsIndex)],ue.prototype,"fieldsIndex",void 0),e([c(C)],ue.prototype,"id",void 0),e([c({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],ue.prototype,"listMode",void 0),e([c({type:["SubtypeGroupLayer","SubtypeGroupTable"],json:{...ne(),origins:{"web-document":ne(),"portal-item":ne()}}})],ue.prototype,"operationalLayerType",null),e([c(ae.outFields)],ue.prototype,"outFields",void 0),e([c({clonable:!1})],ue.prototype,"source",null),e([c({type:r.ofType(X),json:{origins:{service:{read:{source:"subtypes",reader(e,t,s){let i=null;if(this.useUniqueColorsForSublayers){const r=Z(t,s);i=r?W(e.length,r):null}const o=e.map(({code:e},r)=>{const o=new X({subtypeCode:e});o.read(t,s);const a=i?.[r];return a&&o.read({drawingInfo:{renderer:a.toJSON()}},s),o});return new(r.ofType(X))(o)}}}},read:{source:["layers","tables"],reader(e,t,s){let i;return"SubtypeGroupLayer"===t.layerType&&t.layers?.length?i=oe(t.layers,s):"SubtypeGroupTable"===t.layerType&&t.tables?.length&&(i=oe(t.tables,s)),new(r.ofType(X))(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}}}})],ue.prototype,"sublayers",void 0),e([c()],ue.prototype,"useUniqueColorsForSublayers",void 0),e([c({type:Y})],ue.prototype,"timeInfo",void 0),e([c({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],ue.prototype,"title",void 0),e([h("service","title",["name"])],ue.prototype,"readTitleFromService",null),e([c({json:{read:!1}})],ue.prototype,"type",void 0),e([c({clonable:!1,readOnly:!0})],ue.prototype,"featureTitleFields",null),ue=e([m("esri.layers.SubtypeGroupLayer")],ue);const le=ue;export{le 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{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import r from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{fromRect as o,create as i}from"../../../geometry/support/aaBoundingBox.js";import{create as n}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as u}from"../featureConversionUtils.js";import{BoundsStore as a}from"./BoundsStore.js";import{cleanFromGeometryEngine as d}from"./geometryUtils.js";import{optimizedFeatureQueryEngineAdapter as h}from"./optimizedFeatureQueryEngineAdapter.js";const m=i();class f{constructor(e){this.geometryInfo=e,this._boundsStore=new a,this._featuresById=new Map,this._usedMemory=0,this.events=new r,this.featureAdapter=h}get usedMemory(){return this._usedMemory}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach(t=>{null!=t.geometry&&t.geometry.coords&&(e+=t.geometry.coords.length)}),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(e){if(null==this.fullBounds)return null;const[t,r,s,o]=this.fullBounds;return{xmin:t,ymin:r,xmax:s,ymax:o,spatialReference:d(e)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(t){const r=t.map(e=>this._upsert(e));return this._emitChanged(),r.filter(e)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged(),this._usedMemory=0}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(const r of e){const e=this._boundsStore.get(r.objectId);e&&t(o(m,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,e=>{t(this._featuresById.get(e))})}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const r=e.objectId;if(null==r)return void s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e}));const o=this._featuresById.get(r);let i;if(o?(e.displayId=o.displayId,i=this._boundsStore.get(r),this._boundsStore.delete(r),this._usedMemory-=this.estimateFeatureUsedMemory?.(o)??0):null!=this.onFeatureAdd&&this.onFeatureAdd(e),!e.geometry?.coords?.length)return this._boundsStore.set(r,null),void this._featuresById.set(r,e);i=u(null!=i?i:n(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),null!=i&&this._boundsStore.set(r,i),this._featuresById.set(r,e),this._usedMemory+=this.estimateFeatureUsedMemory?.(e)??0}_upsert(e){const r=e?.objectId;if(null==r)return s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const o=this._featuresById.get(r);if(!o)return this._add(e),e;this._usedMemory-=this.estimateFeatureUsedMemory?.(o)??0;const{geometry:i,attributes:a}=e;for(const t in a)o.attributes[t]=a[t];return i&&(o.geometry=i,this._boundsStore.set(r,u(n(),i,this.geometryInfo.hasZ,this.geometryInfo.hasM)??null)),this._usedMemory+=this.estimateFeatureUsedMemory?.(o)??0,o}_remove(e){null!=this.onFeatureRemove&&this.onFeatureRemove(e);const t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(e)??0,e}}export{f as default};
5
+ import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import r from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{fromRect as o,create as i}from"../../../geometry/support/aaBoundingBox.js";import{create as n}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as u}from"../featureConversionUtils.js";import{BoundsStore as a}from"./BoundsStore.js";import{cleanFromGeometryEngine as d}from"./geometryUtils.js";import{optimizedFeatureQueryEngineAdapter as h}from"./optimizedFeatureQueryEngineAdapter.js";const m=i();class f{constructor(e){this.geometryInfo=e,this._boundsStore=new a,this._featuresById=new Map,this._usedMemory=0,this.events=new r.EventEmitter,this.featureAdapter=h}get usedMemory(){return this._usedMemory}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach(t=>{null!=t.geometry&&t.geometry.coords&&(e+=t.geometry.coords.length)}),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(e){if(null==this.fullBounds)return null;const[t,r,s,o]=this.fullBounds;return{xmin:t,ymin:r,xmax:s,ymax:o,spatialReference:d(e)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(t){const r=t.map(e=>this._upsert(e));return this._emitChanged(),r.filter(e)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged(),this._usedMemory=0}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(const r of e){const e=this._boundsStore.get(r.objectId);e&&t(o(m,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,e=>{t(this._featuresById.get(e))})}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const r=e.objectId;if(null==r)return void s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e}));const o=this._featuresById.get(r);let i;if(o?(e.displayId=o.displayId,i=this._boundsStore.get(r),this._boundsStore.delete(r),this._usedMemory-=this.estimateFeatureUsedMemory?.(o)??0):null!=this.onFeatureAdd&&this.onFeatureAdd(e),!e.geometry?.coords?.length)return this._boundsStore.set(r,null),void this._featuresById.set(r,e);i=u(null!=i?i:n(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),null!=i&&this._boundsStore.set(r,i),this._featuresById.set(r,e),this._usedMemory+=this.estimateFeatureUsedMemory?.(e)??0}_upsert(e){const r=e?.objectId;if(null==r)return s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const o=this._featuresById.get(r);if(!o)return this._add(e),e;this._usedMemory-=this.estimateFeatureUsedMemory?.(o)??0;const{geometry:i,attributes:a}=e;for(const t in a)o.attributes[t]=a[t];return i&&(o.geometry=i,this._boundsStore.set(r,u(n(),i,this.geometryInfo.hasZ,this.geometryInfo.hasM)??null)),this._usedMemory+=this.estimateFeatureUsedMemory?.(o)??0,o}_remove(e){null!=this.onFeatureRemove&&this.onFeatureRemove(e);const t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(e)??0,e}}export{f 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
- function e(e,n,t,a){return{x:e,y:n,z:t,hasZ:null!=t,hasM:!1,spatialReference:a,type:"point"}}function n(e,n,t,a,l){e.x=n,e.y=t,e.z=a,e.hasZ=null!=a,e.spatialReference=l}export{e as makeDehydratedPoint,n as setDehydratedPoint};
5
+ function t(t,i,s,e){return{x:t,y:i,z:s,hasZ:null!=s,hasM:!1,spatialReference:e,type:"point"}}function i(t,i,s,e,n){t.x=i,t.y=s,t.z=e,t.hasZ=null!=e,t.spatialReference=n}class s{constructor(t,i,s,e,n){this.spatialReference=t,this._position=void 0!==n?[i,s,e??0,n??0]:void 0!==e?[i,s,e??0]:[i,s],this._flags=(void 0!==e?1:0)+(void 0!==n?2:0)}get hasZ(){return!(1&~this._flags)}get hasM(){return!(2&~this._flags)}get type(){return"point"}get x(){return this._position[0]}get y(){return this._position[1]}get z(){return this.hasZ?this._position[2]:void 0}get m(){return this.hasM?this._position[3]:void 0}}export{s as ImmutableDehydratedPoint,t as makeDehydratedPoint,i as setDehydratedPoint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../PopupTemplate.js";import{clone as r}from"../../core/lang.js";import i from"../../core/Logger.js";import{MultiOriginJSONMixin as o}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import p from"../../geometry/Extent.js";import l from"../../geometry/Point.js";import y from"../../geometry/Polygon.js";import u from"../../geometry/Polyline.js";import{initializeProjection as m,project as d}from"../../geometry/projectionUtils.js";import h from"../../geometry/SpatialReference.js";import{wgs84 as c}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as f}from"../../geometry/support/typeUtils.js";import g from"../Layer.js";import j from"../graphics/data/FeatureStore.js";import{QueryEngine as b}from"../graphics/data/QueryEngine.js";import{createCapabilities as w,createDrawingInfo as T}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as I,systemAggregationCountFieldName as v,systemIsSpatialFieldName as S,systemLayoutGeometryFieldName as O,systemOriginIdFieldName as E,systemDestinationIdFieldName as x}from"./constants.js";import{KnowledgeGraphSublayerBase as N}from"./KnowledgeGraphSublayerBase.js";import{getDisplayLabelProperty as L,getLinkChartDefaultLabelingInfo as F,getMapDefaultLabelingInfo as _,getKGSublayerSymbolColor as R,getDefaultLCRelationshipSublayerSymbol as Q}from"./layerUtils.js";import{BlendLayer as C,blendModeProperty as M,effectProperty as J}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as k,displayFilterEnabledProperty as P,displayFilterInfoProperty as D}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as q,featureEffectProperty as G}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as U}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Z,orderByProperty as A}from"../mixins/OrderedLayer.js";import{RefreshableLayer as B}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as V}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as K,useViewTimeProperty as H}from"../mixins/TemporalLayer.js";import{legendEnabled as W,maxScale as Y,minScale as z,opacity as X,popupEnabled as $}from"../support/commonProperties.js";import{featureReductionProperty as ee}from"../support/featureReductionUtils.js";import te from"../support/Field.js";import{fixRendererFields as re,fixTimeInfoFields as ie}from"../support/fieldUtils.js";import oe from"../support/LabelClass.js";import{reader as se}from"../support/labelingInfo.js";import ne from"../support/TimeInfo.js";import ae from"../../renderers/SimpleRenderer.js";import{fromJSON as pe}from"../../renderers/support/jsonUtils.js";import{rendererTypes as le}from"../../renderers/support/typeUtils.js";import ye from"../../rest/support/FeatureSet.js";import ue from"../../rest/support/Query.js";import{createPopupTemplate as me}from"../../support/popupUtils.js";import{applyColorToSymbol as de}from"../../symbols/support/utils.js";import he from"../../core/workers/RemoteClient.js";function ce(e){if(!e.json)return e;e.json.write=fe(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=fe(e.write))}return e}function fe(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=ge(e)),e):!0===e?je():e}function ge(e){const{target:t,writer:r,overridePolicy:i,...o}=e;return function(e,t){const r=be.call(this,e,t);return r.enabled?{...o,...r}:r}}function je(){return{overridePolicy:be}}function be(e,t){const r=!!this.geometryType;let i={enabled:r};return r&&(i={...i,...we.call(this,e,t)}),i}function we(e,t){return{ignoreOrigin:this.originIdOf(t)>0}}let Te=class extends(N(k(U(q(C(Z(K(V(B(o(g))))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=w(!1,!0),this.charts=null,this.definitionExpression=null,this.displayField="",this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=I,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then(()=>{const e=new MessageChannel;return new he(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=ue.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]})},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach(t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(te.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))}),e.push(te.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),te.fromJSON({name:v,type:"esriFieldTypeInteger",alias:v,editable:!1}),te.fromJSON({name:S,type:"esriFieldTypeInteger",alias:S,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?f.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return O;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");if(!this.objectType||!this.parentCompositeLayer||!this.graphTypeName)return null;const e=this.objectType.properties?L(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?F(this.graphType,this.graphTypeName,e):_(this.graphTypeName,this.geometryType,e)}set renderer(e){re(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map(e=>e.name).indexOf(this.graphTypeName),r=R(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new ae({type:"simple",symbol:Q(r)});const e=pe(T(f.toJSON("point")).renderer);return de(e.symbol,r),e}const i=pe(T(f.toJSON(this.geometryType)).renderer);return de(i.symbol,r),i}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??h.WGS84}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return me(this,e)}createQuery(){return new ue({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e),o=ye.fromJSON(await i.executeQuery(r.toJSON(),t?.signal));return o.features.forEach(e=>{e.sourceLayer=this}),o}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:o}=await this._setupQueryObjects(r),s=await o.executeQueryForExtent(i.toJSON(),t?.signal);let n;return n=null!=s.extent?.xmin&&null!=s.extent?.xmax&&null!=s.extent?.ymin&&null!=s.extent?.ymax?new p(s.extent):new p,{count:s.count,extent:n}}async queryObjectIds(e,t){await this.load();const r=ue.from(e);let i;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return await i.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new j({geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new b({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new ue({where:"1=1",outFields:[I]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then(()=>ie(this.timeInfo,this.fieldsIndex))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=ue.from(e),i=r.geometry;if(i&&!i.spatialReference?.isWGS84&&(await m(i.spatialReference,c),r.geometry=d(i instanceof y||i instanceof u||i instanceof l?i:i.extent,c)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(o)}}};function Ie(e,t,r){const o=[["ESRI__AGGREGATION_COUNT",v],["ESRI__ORIGIN_ID",E],["ESRI__DESTINATION_ID",x],["ESRI__LAYOUT_GEOMETRY",O]];try{for(const t of e)for(const[e,r]of o)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(s){i.getLogger(this).warn("Error updating labelingInfo",s)}return se(e,t,r)}e([s(ce(r(M)))],Te.prototype,"blendMode",void 0),e([s()],Te.prototype,"capabilities",void 0),e([s({readOnly:!0})],Te.prototype,"userHasUpdateItemPrivileges",null),e([s({json:{origins:{"web-scene":{write:!1}},write:je()}})],Te.prototype,"charts",void 0),e([s({readOnly:!0})],Te.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Te.prototype,"definitionExpression",void 0),e([s()],Te.prototype,"displayField",void 0),e([s(ce(r(P)))],Te.prototype,"displayFilterEnabled",void 0),e([s(ce(r(D)))],Te.prototype,"displayFilterInfo",void 0),e([s(ce(r(J)))],Te.prototype,"effect",void 0),e([s()],Te.prototype,"elevationInfo",void 0),e([s(ce(r(G)))],Te.prototype,"featureEffect",void 0),e([s(ce(r(ee)))],Te.prototype,"featureReduction",null),e([s()],Te.prototype,"fields",null),e([s()],Te.prototype,"geometryType",null),e([s()],Te.prototype,"geometryFieldName",null),e([s({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Te.prototype,"graphType",void 0),e([s({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Te.prototype,"graphTypeName",null),e([s()],Te.prototype,"hasM",null),e([s()],Te.prototype,"hasZ",null),e([s({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Te.prototype,"id",void 0),e([s({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Te.prototype,"labelsVisible",void 0),e([s({type:[oe],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:Ie,write:je()}})],Te.prototype,"labelingInfo",null),e([s({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Te.prototype,"layerType",void 0),e([s(ce(r(W)))],Te.prototype,"legendEnabled",void 0),e([s(ce(r(Y)))],Te.prototype,"maxScale",void 0),e([s(ce(r(z)))],Te.prototype,"minScale",void 0),e([s()],Te.prototype,"objectIdField",void 0),e([s()],Te.prototype,"objectType",void 0),e([s(ce(r(X)))],Te.prototype,"opacity",void 0),e([s(ce(r(A)))],Te.prototype,"orderBy",void 0),e([s({clonable:!1})],Te.prototype,"parent",void 0),e([s()],Te.prototype,"parentCompositeLayer",void 0),e([s(ce(r($)))],Te.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Te.prototype,"popupTemplate",void 0),e([s({type:Number,json:{write:{overridePolicy:we}}})],Te.prototype,"refreshInterval",void 0),e([s({types:le,json:{name:"layerDefinition.drawingInfo.renderer",write:je()}})],Te.prototype,"renderer",null),e([s()],Te.prototype,"source",void 0),e([s()],Te.prototype,"spatialReference",null),e([s({type:ne,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],Te.prototype,"timeInfo",null),e([s({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Te.prototype,"title",null),e([a("title")],Te.prototype,"writeTitle",null),e([s({json:{read:!1}})],Te.prototype,"type",void 0),e([s(ce(r(H)))],Te.prototype,"useViewTime",void 0),e([s({type:Boolean,json:{name:"visibility",write:je()}})],Te.prototype,"visible",void 0),Te=e([n("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Te);export{Te as default};
5
+ import{__decorate as e}from"tslib";import t from"../../PopupTemplate.js";import{clone as r}from"../../core/lang.js";import i from"../../core/Logger.js";import{MultiOriginJSONMixin as o}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import p from"../../geometry/Extent.js";import l from"../../geometry/Point.js";import y from"../../geometry/Polygon.js";import u from"../../geometry/Polyline.js";import{initializeProjection as m,project as d}from"../../geometry/projectionUtils.js";import h from"../../geometry/SpatialReference.js";import{wgs84 as c}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as f}from"../../geometry/support/typeUtils.js";import g from"../Layer.js";import j from"../graphics/data/FeatureStore.js";import{QueryEngine as b}from"../graphics/data/QueryEngine.js";import{createCapabilities as w,createDrawingInfo as T}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as I,systemAggregationCountFieldName as v,systemIsSpatialFieldName as S,systemLayoutGeometryFieldName as O,systemOriginIdFieldName as E,systemDestinationIdFieldName as x}from"./constants.js";import{KnowledgeGraphSublayerBase as N}from"./KnowledgeGraphSublayerBase.js";import{getDisplayLabelProperty as L,getLinkChartDefaultLabelingInfo as F,getMapDefaultLabelingInfo as _,getKGSublayerSymbolColor as R,getDefaultLCRelationshipSublayerSymbol as Q}from"./layerUtils.js";import{BlendLayer as C,blendModeProperty as M,effectProperty as J}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as k,displayFilterEnabledProperty as P,displayFilterInfoProperty as D}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as q,featureEffectProperty as G}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as U}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Z,orderByProperty as A}from"../mixins/OrderedLayer.js";import{RefreshableLayer as B}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as V}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as K,useViewTimeProperty as H}from"../mixins/TemporalLayer.js";import{legendEnabled as W,maxScale as Y,minScale as z,opacity as X,popupEnabled as $}from"../support/commonProperties.js";import{featureReductionProperty as ee}from"../support/featureReductionUtils.js";import te from"../support/Field.js";import{fixRendererFields as re,fixTimeInfoFields as ie}from"../support/fieldUtils.js";import oe from"../support/LabelClass.js";import{reader as se}from"../support/labelingInfo.js";import ne from"../support/TimeInfo.js";import ae from"../../renderers/SimpleRenderer.js";import{fromJSON as pe}from"../../renderers/support/jsonUtils.js";import{rendererTypes as le}from"../../renderers/support/typeUtils.js";import ye from"../../rest/support/FeatureSet.js";import ue from"../../rest/support/Query.js";import{createPopupTemplate as me}from"../../support/popupUtils.js";import{applyColorToSymbol as de}from"../../symbols/support/utils.js";import he from"../../core/workers/RemoteClient.js";function ce(e){if(!e.json)return e;e.json.write=fe(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=fe(e.write))}return e}function fe(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=ge(e)),e):!0===e?je():e}function ge(e){const{target:t,writer:r,overridePolicy:i,...o}=e;return function(e,t){const r=be.call(this,e,t);return r.enabled?{...o,...r}:r}}function je(){return{overridePolicy:be}}function be(e,t){const r=!!this.geometryType;let i={enabled:r};return r&&(i={...i,...we.call(this,e,t)}),i}function we(e,t){return{ignoreOrigin:this.originIdOf(t)>0}}let Te=class extends(N(k(U(q(C(Z(K(V(B(o(g))))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=w(!1,!0),this.charts=null,this.definitionExpression=null,this.displayField="",this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=I,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then(()=>{const e=new MessageChannel;return new he(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=ue.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]})},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach(t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(te.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))}),e.push(te.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),te.fromJSON({name:v,type:"esriFieldTypeInteger",alias:v,editable:!1}),te.fromJSON({name:S,type:"esriFieldTypeInteger",alias:S,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?f.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return O;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}set graphTypeName(e){this._set("graphTypeName",e)}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");if(!this.objectType||!this.parentCompositeLayer||!this.graphTypeName)return null;const e=this.objectType.properties?L(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?F(this.graphType,this.graphTypeName,e):_(this.graphTypeName,this.geometryType,e)}set renderer(e){re(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map(e=>e.name).indexOf(this.graphTypeName),r=R(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new ae({type:"simple",symbol:Q(r)});const e=pe(T(f.toJSON("point")).renderer);return de(e.symbol,r),e}const i=pe(T(f.toJSON(this.geometryType)).renderer);return de(i.symbol,r),i}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??h.WGS84}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return me(this,e)}createQuery(){return new ue({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e),o=ye.fromJSON(await i.executeQuery(r.toJSON(),t?.signal));return o.features.forEach(e=>{e.sourceLayer=this}),o}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:o}=await this._setupQueryObjects(r),s=await o.executeQueryForExtent(i.toJSON(),t?.signal);let n;return n=null!=s.extent?.xmin&&null!=s.extent?.xmax&&null!=s.extent?.ymin&&null!=s.extent?.ymax?new p(s.extent):new p,{count:s.count,extent:n}}async queryObjectIds(e,t){await this.load();const r=ue.from(e);let i;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return await i.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new j({geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new b({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new ue({where:"1=1",outFields:[I]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then(()=>ie(this.timeInfo,this.fieldsIndex))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=ue.from(e),i=r.geometry;if(i&&!i.spatialReference?.isWGS84&&(await m(i.spatialReference,c),r.geometry=d(i instanceof y||i instanceof u||i instanceof l?i:i.extent,c)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(o)}}};function Ie(e,t,r){const o=[["ESRI__AGGREGATION_COUNT",v],["ESRI__ORIGIN_ID",E],["ESRI__DESTINATION_ID",x],["ESRI__LAYOUT_GEOMETRY",O]];try{for(const t of e)for(const[e,r]of o)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(s){i.getLogger(this).warn("Error updating labelingInfo",s)}return se(e,t,r)}e([s(ce(r(M)))],Te.prototype,"blendMode",void 0),e([s()],Te.prototype,"capabilities",void 0),e([s({readOnly:!0})],Te.prototype,"userHasUpdateItemPrivileges",null),e([s({json:{origins:{"web-scene":{write:!1}},write:je()}})],Te.prototype,"charts",void 0),e([s({readOnly:!0})],Te.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Te.prototype,"definitionExpression",void 0),e([s()],Te.prototype,"displayField",void 0),e([s(ce(r(P)))],Te.prototype,"displayFilterEnabled",void 0),e([s(ce(r(D)))],Te.prototype,"displayFilterInfo",void 0),e([s(ce(r(J)))],Te.prototype,"effect",void 0),e([s()],Te.prototype,"elevationInfo",void 0),e([s(ce(r(G)))],Te.prototype,"featureEffect",void 0),e([s(ce(r(ee)))],Te.prototype,"featureReduction",null),e([s()],Te.prototype,"fields",null),e([s()],Te.prototype,"geometryType",null),e([s()],Te.prototype,"geometryFieldName",null),e([s({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Te.prototype,"graphType",void 0),e([s({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Te.prototype,"graphTypeName",null),e([s()],Te.prototype,"hasM",null),e([s()],Te.prototype,"hasZ",null),e([s({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Te.prototype,"id",void 0),e([s({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Te.prototype,"labelsVisible",void 0),e([s({type:[oe],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:Ie,write:je()}})],Te.prototype,"labelingInfo",null),e([s({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Te.prototype,"layerType",void 0),e([s(ce(r(W)))],Te.prototype,"legendEnabled",void 0),e([s(ce(r(Y)))],Te.prototype,"maxScale",void 0),e([s(ce(r(z)))],Te.prototype,"minScale",void 0),e([s()],Te.prototype,"objectIdField",void 0),e([s()],Te.prototype,"objectType",void 0),e([s(ce(r(X)))],Te.prototype,"opacity",void 0),e([s(ce(r(A)))],Te.prototype,"orderBy",void 0),e([s({clonable:!1})],Te.prototype,"parent",void 0),e([s()],Te.prototype,"parentCompositeLayer",void 0),e([s(ce(r($)))],Te.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Te.prototype,"popupTemplate",void 0),e([s({type:Number,json:{write:{overridePolicy:we}}})],Te.prototype,"refreshInterval",void 0),e([s({types:le,json:{name:"layerDefinition.drawingInfo.renderer",write:je()}})],Te.prototype,"renderer",null),e([s()],Te.prototype,"source",void 0),e([s()],Te.prototype,"spatialReference",null),e([s({type:ne,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],Te.prototype,"timeInfo",null),e([s({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Te.prototype,"title",null),e([a("title")],Te.prototype,"writeTitle",null),e([s({json:{read:!1}})],Te.prototype,"type",void 0),e([s(ce(r(H)))],Te.prototype,"useViewTime",void 0),e([s({type:Boolean,json:{name:"visibility",write:je()}})],Te.prototype,"visible",void 0),Te=e([n("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Te);export{Te as default};