@arcgis/core 4.34.0-next.17 → 4.34.0-next.18

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 (136) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{400a4c9fa62964f8fa1d.js → 1f48d6c76f0014064eca.js} +1 -1
  3. package/assets/esri/core/workers/chunks/3cf31e51266f40072f71.js +1 -0
  4. package/assets/esri/core/workers/chunks/4325fdd96d9ea344132e.js +1 -0
  5. package/assets/esri/core/workers/chunks/68374cf42a069436830d.js +1 -0
  6. package/assets/esri/core/workers/chunks/6f8de923519bb16af8ba.js +1 -0
  7. package/assets/esri/core/workers/chunks/85753105268aeff84e69.js +1 -0
  8. package/assets/esri/core/workers/chunks/8637b9cb30170ac4eae2.js +1 -0
  9. package/assets/esri/core/workers/chunks/872f151a3a2bc9052be0.js +1 -0
  10. package/assets/esri/core/workers/chunks/8b4a35e3ed39d8be3394.js +1 -0
  11. package/assets/esri/core/workers/chunks/{d33a5d79f2163ad62b1d.js → 9965961bad09910f577b.js} +1 -1
  12. package/assets/esri/core/workers/chunks/9d499a37b960273c3f84.js +1 -0
  13. package/assets/esri/core/workers/chunks/a507192771e5f4f82973.js +1 -0
  14. package/assets/esri/core/workers/chunks/a9e1caf05c81055ae194.js +1 -0
  15. package/assets/esri/core/workers/chunks/{1415d4e2f5f3193be004.js → aa4ae0e54a0507e8dd0f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/d3bfd0c382c2f39a787b.js +1 -0
  17. package/assets/esri/core/workers/chunks/d6df12bed626d56cd6b2.js +1 -0
  18. package/assets/esri/core/workers/chunks/e0146db608959ead9c97.js +1 -0
  19. package/assets/esri/core/workers/chunks/f4442a2b40e44f90b461.js +1 -0
  20. package/assets/esri/core/workers/chunks/{fa5715ca3ce95d005b0a.js → faa892ad4cc8a90b6c79.js} +1 -1
  21. package/assets/esri/themes/base/widgets/_Legend.scss +2 -0
  22. package/assets/esri/themes/dark/main.css +1 -1
  23. package/assets/esri/themes/light/main.css +1 -1
  24. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  25. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  26. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  27. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  28. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  29. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  30. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  31. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  32. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  33. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  34. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  35. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  36. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  37. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  38. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  39. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  40. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  41. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  42. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  43. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  50. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  51. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  52. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  53. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  54. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  55. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  56. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  57. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  58. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  59. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  63. package/chunks/sphere.js +1 -1
  64. package/config.js +1 -1
  65. package/core/accessorSupport/trackingUtils.js +1 -1
  66. package/core/sql.js +1 -1
  67. package/geometry/spatialReferenceEllipsoidUtils.js +1 -1
  68. package/geometry/support/sphere.js +1 -1
  69. package/interfaces.d.ts +38 -33
  70. package/kernel.js +1 -1
  71. package/layers/FeatureLayer.js +1 -1
  72. package/layers/SubtypeGroupLayer.js +1 -1
  73. package/layers/VectorTileLayer.js +1 -1
  74. package/layers/VideoLayer.js +1 -1
  75. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  76. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  77. package/layers/orientedImagery/core/utils.js +1 -1
  78. package/layers/orientedImagery/transformations/updateElevation.js +1 -1
  79. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  80. package/layers/orientedImagery/transformations/utils.js +1 -1
  81. package/layers/support/SubtypeSublayer.js +1 -1
  82. package/layers/support/TitleCreator.js +1 -1
  83. package/layers/support/fieldUtils.js +1 -1
  84. package/layers/video/VideoCameraSensorModel.js +1 -1
  85. package/layers/video/VideoController.js +1 -1
  86. package/networks/UtilityNetwork.js +1 -1
  87. package/package.json +1 -1
  88. package/rest/knowledgeGraphService.js +1 -1
  89. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  90. package/support/revision.js +1 -1
  91. package/symbols/support/previewCIMSymbol.js +1 -1
  92. package/symbols/support/previewSymbol2D.js +1 -1
  93. package/symbols/support/svgUtils.js +1 -1
  94. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  95. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  96. package/views/3d/camera/intersectionUtils.js +1 -1
  97. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  98. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  99. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  100. package/views/3d/state/ViewState.js +1 -1
  101. package/views/3d/state/ViewStateManager.js +1 -1
  102. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  103. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  104. package/views/3d/state/utils/navigationUtils.js +1 -1
  105. package/views/3d/terrain/OverlayManager.js +1 -1
  106. package/views/3d/terrain/TerrainSurface.js +1 -1
  107. package/views/3d/terrain/TileRenderer.js +1 -1
  108. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  109. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  110. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  111. package/views/SceneView.js +1 -1
  112. package/views/support/drapedUtils.js +1 -1
  113. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  114. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  115. package/widgets/Expand.js +1 -1
  116. package/widgets/Legend/styles/support/sizeRampUtils.js +1 -1
  117. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  118. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  119. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  120. package/widgets/OrientedImageryViewer.js +1 -1
  121. package/widgets/support/GridControls.js +1 -1
  122. package/assets/esri/core/workers/chunks/254c4f7e277ae9915dce.js +0 -1
  123. package/assets/esri/core/workers/chunks/273beed633cc37416ad7.js +0 -1
  124. package/assets/esri/core/workers/chunks/49a57dc1e6d1048fa949.js +0 -1
  125. package/assets/esri/core/workers/chunks/500fb5f615f0c1db1b66.js +0 -1
  126. package/assets/esri/core/workers/chunks/52239e958a82ebcd2e7a.js +0 -1
  127. package/assets/esri/core/workers/chunks/78a57f5aeb277b84b3da.js +0 -1
  128. package/assets/esri/core/workers/chunks/802c6b1a6cb9264b8e4f.js +0 -1
  129. package/assets/esri/core/workers/chunks/88b1214c284c2ec7d51b.js +0 -1
  130. package/assets/esri/core/workers/chunks/932808e485f305b6a26a.js +0 -1
  131. package/assets/esri/core/workers/chunks/beb01d400f1aa089d2dc.js +0 -1
  132. package/assets/esri/core/workers/chunks/cfc5e0ec9b0290407383.js +0 -1
  133. package/assets/esri/core/workers/chunks/d2139307f62ea8bf999a.js +0 -1
  134. package/assets/esri/core/workers/chunks/ddb66fe6fcd0764daa7a.js +0 -1
  135. package/assets/esri/core/workers/chunks/eac7af86166c09c6a9be.js +0 -1
  136. package/assets/esri/core/workers/chunks/ec49e2849766402ad5c7.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{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../request.js";import i from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{debounce as d,throwIfAbortError as y,whenOrAbort as c}from"../core/promiseUtils.js";import{sqlAnd as m}from"../core/sql.js";import{urlToObject as h,join as f}from"../core/urlUtils.js";import{property as b}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as T}from"../core/accessorSupport/layerContainerType.js";import F from"../form/FormTemplate.js";import S from"../geometry/SpatialReference.js";import I from"./Layer.js";import{MemorySource as E}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as D}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as x}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as C}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as P}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as M}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as q}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as O}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as A}from"./mixins/OperationalLayer.js";import{OrderedLayer as V}from"./mixins/OrderedLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{PublishableLayer as U}from"./mixins/PublishableLayer.js";import{RefreshableLayer as Q}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as B}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as N}from"./mixins/TemporalLayer.js";import{TrackableLayer as $}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as G,parse as J,cleanTitle as W}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as Z,id as H,labelsVisible as k,opacityDrawingInfo as z,legendEnabled as K,listMode as X,popupEnabled as Y,screenSizePerspectiveEnabled as ee}from"./support/commonProperties.js";import{ensureLayerCredential as te,computeEffectiveEditingEnabled as re,readGlobalIdField as ie,readObjectIdField as oe,createDefaultRenderer as se,addAttachment as ae,updateAttachment as ne,applyEdits as le,uploadAssets as pe,createQuery as ue,deleteAttachments as de,fetchRecomputedExtents as ye,getFeatureType as ce,getFieldDomain as me,queryAttachments as he,queryObjectIds as fe,queryFeatureCount as be,queryExtent as ge,queryRelatedFeatures as we,queryRelatedFeaturesCount as ve,validateBinsQuery as je,hasDataChanged as Te,geometryTypeKebabDict as Fe}from"./support/featureLayerUtils.js";import Se from"./support/FeatureTemplate.js";import Ie from"./support/FeatureType.js";import{defineFieldProperties as Ee}from"./support/fieldProperties.js";import{fixRendererFields as Le,fixTimeInfoFields as De}from"./support/fieldUtils.js";import _e from"./support/LabelClass.js";import{reader as xe}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Ce}from"./support/serviceCapabilitiesUtils.js";import Pe from"./support/TimeInfo.js";import Me from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as qe}from"./support/versionUtils.js";import{DataLayerSource as Oe}from"./support/source/DataLayerSource.js";import{read as Ae}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Ve}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Re,rendererTypes as Ue}from"../renderers/support/typeUtils.js";import Qe from"../rest/support/FeatureSet.js";import Be from"../rest/support/Query.js";import{isNumber as Ne}from"../support/guards.js";import{createPopupTemplate as $e}from"../support/popupUtils.js";import{symbolTypes as Ge}from"../symbols/support/typeUtils.js";import{SaveOperationType as Je}from"../webdoc/interfaces.js";import{opacityToTransparency as We}from"../webdoc/support/opacityUtils.js";const Ze="FeatureLayer";function He(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ke(e){return e&&e instanceof o}const ze=Ee();function Ke(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Xe=class extends(q(O(M(U(P(C(_(V(N($(B(Q(D(A(R(p(x(L(i.ClonableMixin(I)))))))))))))))))))){constructor(...e){super(...e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="ArcGISFeatureLayer",this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=S.WGS84,this.subtypeCode=null,this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=d((async(e,t,r)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case Je.SAVE:return i(this,t);case Je.SAVE_AS:return o(this,r,t)}}))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then((e=>this.initLayerProperties(e)))),Promise.resolve(this);const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(y).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))})).then((()=>te(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new Me({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Ce(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}get effectiveEditingEnabled(){return re(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}readIsTable(e,t){return"Table"===(t=t?.layerDefinition??t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&u(r,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return ie(t.layerDefinition||t)}readObjectIdField(e,t){return oe(t.layerDefinition||t)}get parsedUrl(){const e=h(this.url);return null!=e&&(null!=this.dynamicDataSource?e.path=f(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=f(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Le(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Ae(i,t,r)??void 0;return e||n.getLogger(this).error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:r}),e}return se(t,r)}set source(e){const t=this._get("source");t!==e&&(ke(t)&&this._resetMemorySource(t),ke(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof o?new E({layer:this,items:e}):e:null}readSource(e,t){const r=Qe.fromJSON(t.featureSet);return new E({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map((e=>Se.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition?.name??t.name,i=t.title||t.layerDefinition?.title;if(r){const e=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return this.url?G(this.url,r):r;let t=r;if(!t&&this.url){const e=J(this.url);null!=e&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),W(t)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find((e=>e.name.toLowerCase()===r));e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e?.map((e=>(e=Ie.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}readVisible(e,t){return null!=t.layerDefinition?.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}async addAttachment(e,t){const r=await ae(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ne(this,e,t,r,Ze);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return le(this,e,t)}async uploadAssets(e,t){return pe(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return $e(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await c(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=ue(this);e.dynamicDataSource=this.dynamicDataSource;const t=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,r=m(this.definitionExpression,t);return e.where=r||"1=1",e}async deleteAttachments(e,t){const r=await de(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return ye(this,e,Ze)}getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){return this._titleCreator.getTitle(this,e,t)}getFeatureType(e){return ce(this.types,this.typeIdField,e)}getFieldDomain(e,t){return me(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return he(this,e,t,Ze)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Be.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r;return i}async queryObjectIds(e,t){return await fe(this,e,t,Ze)}async queryFeatureCount(e,t){return be(this,e,t,Ze)}async queryExtent(e,t){return ge(this,e,t,Ze)}async queryRelatedFeatures(e,t){return we(this,e,t,Ze)}async queryRelatedFeaturesCount(e,t){return ve(this,e,t,Ze)}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopFeatures capability");const o=await import("../rest/support/TopFeaturesQuery.js"),a=await r.queryTopFeatures(o.default.from(e),t);if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new s(Ze,"Layer source does not support queryAttributeBins capability");je(e,i,Ze);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t);if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryTopObjectIds(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopObjectIds capability");const o=await import("../rest/support/TopFeaturesQuery.js");return(await r.queryTopObjectIds(o.default.from(e),t)).filter(Ne)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopExtents capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopExtents(o.default.from(e),t)}async queryTopFeatureCount(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryFeatureCount capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopCount(o.default.from(e),t)}read(e,t){const r=e.featureCollection;if((r||"Feature Collection"===e.type)&&(this.resourceInfo=e),r){const{layers:e,showLegend:i}=r;1===e?.length&&(super.read(e[0],t),null!=i&&super.read({showLegend:i},t))}super.read(e,t),t&&"service"===t.origin&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i,messages:o}=t;if(this.dynamicDataSource)return o?.push(He(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if(("web-map"===r||"web-scene"===r)&&"tables"!==i)return o?.push(He(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push(He(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&("web-map"===r||"web-scene"===r)&&"tables"===i)return o?.push(He(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(Ze,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||qe(this,e))}async save(e){return this._debouncedSaveOperations(Je.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Je.SAVE_AS,t,e)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";u("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return r(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)}))}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Le(this.renderer,this.fieldsIndex),De(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Ve(this,{origin:"service"})}async hasDataChanged(){return Te(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach((e=>{const r=e.prototype?.attributes;r&&t&&delete r[t]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new s("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this.addHandles([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};e([b({clonable:!1,readOnly:!0})],Xe.prototype,"_titleCreator",null),e([b(Z)],Xe.prototype,"attributeTableTemplate",void 0),e([w("service","capabilities")],Xe.prototype,"readCapabilities",null),e([b({json:{origins:{"web-scene":{write:!1}},write:!0}})],Xe.prototype,"charts",void 0),e([b({readOnly:!0})],Xe.prototype,"createQueryVersion",null),e([b({json:{read:{source:"layerDefinition.copyrightText"}}})],Xe.prototype,"copyright",void 0),e([b({json:{read:{source:"layerDefinition.displayField"}}})],Xe.prototype,"displayField",void 0),e([b({types:Ge,readOnly:!0})],Xe.prototype,"defaultSymbol",void 0),e([b({type:Oe})],Xe.prototype,"dynamicDataSource",void 0),e([b({type:Boolean})],Xe.prototype,"editingEnabled",null),e([w(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabled",null),e([w("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabledFromWebMap",null),e([j(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabled",null),e([j("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabledToWebMap",null),e([b({readOnly:!0})],Xe.prototype,"effectiveEditingEnabled",null),e([b({clonable:!1,readOnly:!0})],Xe.prototype,"featureTitleFields",null),e([b({...ze.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Ke}}}}})],Xe.prototype,"fields",void 0),e([b(ze.fieldsIndex)],Xe.prototype,"fieldsIndex",void 0),e([b({type:F,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Xe.prototype,"formTemplate",void 0),e([b({json:{read:{source:"layerDefinition.extent"}}})],Xe.prototype,"fullExtent",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Ke,writer(e,t,r){const i=e?Fe.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Fe.read}}})],Xe.prototype,"geometryType",void 0),e([b({json:{read:{source:"layerDefinition.hasM"}}})],Xe.prototype,"hasM",void 0),e([b({json:{read:{source:"layerDefinition.hasZ"}}})],Xe.prototype,"hasZ",void 0),e([b(H)],Xe.prototype,"id",void 0),e([b({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Xe.prototype,"infoFor3D",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Xe.prototype,"isTable",void 0),e([w("service","isTable",["type","geometryType"]),w("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Xe.prototype,"readIsTable",null),e([j("web-map","isTable")],Xe.prototype,"writeIsTable",null),e([b(k)],Xe.prototype,"labelsVisible",void 0),e([b({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:xe,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:xe,write:{layerContainerTypes:T}}})],Xe.prototype,"labelingInfo",void 0),e([b((()=>{const e=a(z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,We(e),t)}}},e})())],Xe.prototype,"opacity",void 0),e([b(K)],Xe.prototype,"legendEnabled",void 0),e([b({type:["show","hide"],json:(()=>{const e=a(X.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Xe.prototype,"listMode",void 0),e([w("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Xe.prototype,"readGlobalIdField",null),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Ke}}}}})],Xe.prototype,"objectIdField",void 0),e([w("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Xe.prototype,"readObjectIdField",null),e([b({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:T}}})],Xe.prototype,"operationalLayerType",void 0),e([b(ze.outFields)],Xe.prototype,"outFields",void 0),e([b({readOnly:!0})],Xe.prototype,"parsedUrl",null),e([b({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Xe.prototype,"path",void 0),e([b(Y)],Xe.prototype,"popupEnabled",void 0),e([b({type:t,json:{name:"popupInfo",write:!0}})],Xe.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],Xe.prototype,"defaultPopupTemplate",null),e([b({types:Ue,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Re,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:T,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}})],Xe.prototype,"renderer",null),e([w("service","renderer",["drawingInfo.renderer","defaultSymbol"]),w("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Xe.prototype,"readRenderer",null),e([b()],Xe.prototype,"resourceInfo",void 0),e([b((()=>{const e=a(ee);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([b({clonable:!1})],Xe.prototype,"source",null),e([g("source")],Xe.prototype,"castSource",null),e([w("portal-item","source",["featureSet"]),w("web-map","source",["featureSet"])],Xe.prototype,"readSource",null),e([b({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Xe.prototype,"spatialReference",void 0),e([b({type:Number})],Xe.prototype,"subtypeCode",void 0),e([b({type:[Se]})],Xe.prototype,"templates",void 0),e([w("templates",["editFieldsInfo","creatorField","editorField","templates"])],Xe.prototype,"readTemplates",null),e([b({type:Pe})],Xe.prototype,"timeInfo",void 0),e([b()],Xe.prototype,"title",void 0),e([w("service","title",["name"]),w("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Xe.prototype,"readTitle",null),e([w("web-map","title",["layerDefinition.name","title"])],Xe.prototype,"readTitleFromWebMap",null),e([b({type:String})],Xe.prototype,"sublayerTitleMode",void 0),e([b({json:{read:!1}})],Xe.prototype,"type",void 0),e([b({type:String})],Xe.prototype,"typeIdField",void 0),e([w("service","typeIdField"),w("typeIdField",["layerDefinition.typeIdField"])],Xe.prototype,"readTypeIdField",null),e([b({type:[Ie]})],Xe.prototype,"types",void 0),e([w("service","types",["types"]),w("types",["layerDefinition.types"])],Xe.prototype,"readTypes",null),e([b({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:T}}}}})],Xe.prototype,"visible",void 0),e([w("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Xe.prototype,"readVisible",null),Xe=e([v("esri.layers.FeatureLayer")],Xe);export{Xe as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../request.js";import i from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{debounce as d,throwIfAbortError as y,whenOrAbort as c}from"../core/promiseUtils.js";import{sqlAnd as m}from"../core/sql.js";import{urlToObject as h,join as f}from"../core/urlUtils.js";import{property as b}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as T}from"../core/accessorSupport/layerContainerType.js";import F from"../form/FormTemplate.js";import S from"../geometry/SpatialReference.js";import I from"./Layer.js";import{MemorySource as E}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as D}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as x}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as C}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as P}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as q}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as M}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as O}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as A}from"./mixins/OperationalLayer.js";import{OrderedLayer as V}from"./mixins/OrderedLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{PublishableLayer as U}from"./mixins/PublishableLayer.js";import{RefreshableLayer as Q}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as B}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as N}from"./mixins/TemporalLayer.js";import{TrackableLayer as $}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as G,parse as J,cleanTitle as W}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as Z,id as H,labelsVisible as k,opacityDrawingInfo as z,legendEnabled as K,listMode as X,popupEnabled as Y,screenSizePerspectiveEnabled as ee}from"./support/commonProperties.js";import{ensureLayerCredential as te,computeEffectiveEditingEnabled as re,readGlobalIdField as ie,readObjectIdField as oe,createDefaultRenderer as se,addAttachment as ae,updateAttachment as ne,applyEdits as le,uploadAssets as pe,createQuery as ue,deleteAttachments as de,fetchRecomputedExtents as ye,getFeatureType as ce,getFieldDomain as me,queryAttachments as he,queryObjectIds as fe,queryFeatureCount as be,queryExtent as ge,queryRelatedFeatures as we,queryRelatedFeaturesCount as ve,validateBinsQuery as je,hasDataChanged as Te,geometryTypeKebabDict as Fe}from"./support/featureLayerUtils.js";import Se from"./support/FeatureTemplate.js";import Ie from"./support/FeatureType.js";import{defineFieldProperties as Ee}from"./support/fieldProperties.js";import{fixRendererFields as Le,fixTimeInfoFields as De}from"./support/fieldUtils.js";import _e from"./support/LabelClass.js";import{reader as xe}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Ce}from"./support/serviceCapabilitiesUtils.js";import Pe from"./support/TimeInfo.js";import qe from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as Me}from"./support/versionUtils.js";import{DataLayerSource as Oe}from"./support/source/DataLayerSource.js";import{read as Ae}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Ve}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Re,rendererTypes as Ue}from"../renderers/support/typeUtils.js";import Qe from"../rest/support/FeatureSet.js";import Be from"../rest/support/Query.js";import{isNumber as Ne}from"../support/guards.js";import{createPopupTemplate as $e}from"../support/popupUtils.js";import{symbolTypes as Ge}from"../symbols/support/typeUtils.js";import{SaveOperationType as Je}from"../webdoc/interfaces.js";import{opacityToTransparency as We}from"../webdoc/support/opacityUtils.js";const Ze="FeatureLayer";function He(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ke(e){return e&&e instanceof o}const ze=Ee();function Ke(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Xe=class extends(M(O(q(U(P(C(_(V(N($(B(Q(D(A(R(p(x(L(i.ClonableMixin(I)))))))))))))))))))){constructor(...e){super(...e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="ArcGISFeatureLayer",this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=S.WGS84,this.subtypeCode=null,this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=d((async(e,t,r)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case Je.SAVE:return i(this,t);case Je.SAVE_AS:return o(this,r,t)}}))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then((e=>this.initLayerProperties(e)))),Promise.resolve(this);const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(y).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))})).then((()=>te(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new qe({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Ce(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}get effectiveEditingEnabled(){return re(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}readIsTable(e,t){return"Table"===(t=t?.layerDefinition??t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&u(r,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return ie(t.layerDefinition||t)}readObjectIdField(e,t){return oe(t.layerDefinition||t)}get parsedUrl(){const e=h(this.url);return null!=e&&(null!=this.dynamicDataSource?e.path=f(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=f(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Le(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Ae(i,t,r)??void 0;return e||n.getLogger(this).error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:r}),e}return se(t,r)}set source(e){const t=this._get("source");t!==e&&(ke(t)&&this._resetMemorySource(t),ke(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof o?new E({layer:this,items:e}):e:null}readSource(e,t){const r=Qe.fromJSON(t.featureSet);return new E({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map((e=>Se.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition?.name??t.name,i=t.title||t.layerDefinition?.title;if(r){const e=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return this.url?G(this.url,r):r;let t=r;if(!t&&this.url){const e=J(this.url);null!=e&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),W(t)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find((e=>e.name.toLowerCase()===r));e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e?.map((e=>(e=Ie.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}readVisible(e,t){return null!=t.layerDefinition?.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}async addAttachment(e,t){const r=await ae(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ne(this,e,t,r,Ze);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return le(this,e,t)}async uploadAssets(e,t){return pe(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return $e(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await c(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=ue(this);e.dynamicDataSource=this.dynamicDataSource;const t=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,r=m(this.definitionExpression,t);return e.where=r||"1=1",e}async deleteAttachments(e,t){const r=await de(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return ye(this,e,Ze)}async getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}async getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getFeatureType(e){return ce(this.types,this.typeIdField,e)}getFieldDomain(e,t){return me(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return he(this,e,t,Ze)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Be.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r;return i}async queryObjectIds(e,t){return await fe(this,e,t,Ze)}async queryFeatureCount(e,t){return be(this,e,t,Ze)}async queryExtent(e,t){return ge(this,e,t,Ze)}async queryRelatedFeatures(e,t){return we(this,e,t,Ze)}async queryRelatedFeaturesCount(e,t){return ve(this,e,t,Ze)}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopFeatures capability");const o=await import("../rest/support/TopFeaturesQuery.js"),a=await r.queryTopFeatures(o.default.from(e),t);if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new s(Ze,"Layer source does not support queryAttributeBins capability");je(e,i,Ze);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t);if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryTopObjectIds(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopObjectIds capability");const o=await import("../rest/support/TopFeaturesQuery.js");return(await r.queryTopObjectIds(o.default.from(e),t)).filter(Ne)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopExtents capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopExtents(o.default.from(e),t)}async queryTopFeatureCount(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryFeatureCount capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopCount(o.default.from(e),t)}read(e,t){const r=e.featureCollection;if((r||"Feature Collection"===e.type)&&(this.resourceInfo=e),r){const{layers:e,showLegend:i}=r;1===e?.length&&(super.read(e[0],t),null!=i&&super.read({showLegend:i},t))}super.read(e,t),t&&"service"===t.origin&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i,messages:o}=t;if(this.dynamicDataSource)return o?.push(He(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if(("web-map"===r||"web-scene"===r)&&"tables"!==i)return o?.push(He(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push(He(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&("web-map"===r||"web-scene"===r)&&"tables"===i)return o?.push(He(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(Ze,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||Me(this,e))}async save(e){return this._debouncedSaveOperations(Je.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Je.SAVE_AS,t,e)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";u("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return r(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)}))}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Le(this.renderer,this.fieldsIndex),De(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Ve(this,{origin:"service"})}async hasDataChanged(){return Te(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach((e=>{const r=e.prototype?.attributes;r&&t&&delete r[t]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new s("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this.addHandles([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};e([b({clonable:!1,readOnly:!0})],Xe.prototype,"_titleCreator",null),e([b(Z)],Xe.prototype,"attributeTableTemplate",void 0),e([w("service","capabilities")],Xe.prototype,"readCapabilities",null),e([b({json:{origins:{"web-scene":{write:!1}},write:!0}})],Xe.prototype,"charts",void 0),e([b({readOnly:!0})],Xe.prototype,"createQueryVersion",null),e([b({json:{read:{source:"layerDefinition.copyrightText"}}})],Xe.prototype,"copyright",void 0),e([b({json:{read:{source:"layerDefinition.displayField"}}})],Xe.prototype,"displayField",void 0),e([b({types:Ge,readOnly:!0})],Xe.prototype,"defaultSymbol",void 0),e([b({type:Oe})],Xe.prototype,"dynamicDataSource",void 0),e([b({type:Boolean})],Xe.prototype,"editingEnabled",null),e([w(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabled",null),e([w("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabledFromWebMap",null),e([j(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabled",null),e([j("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabledToWebMap",null),e([b({readOnly:!0})],Xe.prototype,"effectiveEditingEnabled",null),e([b({clonable:!1,readOnly:!0})],Xe.prototype,"featureTitleFields",null),e([b({...ze.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Ke}}}}})],Xe.prototype,"fields",void 0),e([b(ze.fieldsIndex)],Xe.prototype,"fieldsIndex",void 0),e([b({type:F,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Xe.prototype,"formTemplate",void 0),e([b({json:{read:{source:"layerDefinition.extent"}}})],Xe.prototype,"fullExtent",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Ke,writer(e,t,r){const i=e?Fe.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Fe.read}}})],Xe.prototype,"geometryType",void 0),e([b({json:{read:{source:"layerDefinition.hasM"}}})],Xe.prototype,"hasM",void 0),e([b({json:{read:{source:"layerDefinition.hasZ"}}})],Xe.prototype,"hasZ",void 0),e([b(H)],Xe.prototype,"id",void 0),e([b({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Xe.prototype,"infoFor3D",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Xe.prototype,"isTable",void 0),e([w("service","isTable",["type","geometryType"]),w("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Xe.prototype,"readIsTable",null),e([j("web-map","isTable")],Xe.prototype,"writeIsTable",null),e([b(k)],Xe.prototype,"labelsVisible",void 0),e([b({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:xe,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:xe,write:{layerContainerTypes:T}}})],Xe.prototype,"labelingInfo",void 0),e([b((()=>{const e=a(z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,We(e),t)}}},e})())],Xe.prototype,"opacity",void 0),e([b(K)],Xe.prototype,"legendEnabled",void 0),e([b({type:["show","hide"],json:(()=>{const e=a(X.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Xe.prototype,"listMode",void 0),e([w("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Xe.prototype,"readGlobalIdField",null),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Ke}}}}})],Xe.prototype,"objectIdField",void 0),e([w("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Xe.prototype,"readObjectIdField",null),e([b({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:T}}})],Xe.prototype,"operationalLayerType",void 0),e([b(ze.outFields)],Xe.prototype,"outFields",void 0),e([b({readOnly:!0})],Xe.prototype,"parsedUrl",null),e([b({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Xe.prototype,"path",void 0),e([b(Y)],Xe.prototype,"popupEnabled",void 0),e([b({type:t,json:{name:"popupInfo",write:!0}})],Xe.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],Xe.prototype,"defaultPopupTemplate",null),e([b({types:Ue,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Re,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:T,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}})],Xe.prototype,"renderer",null),e([w("service","renderer",["drawingInfo.renderer","defaultSymbol"]),w("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Xe.prototype,"readRenderer",null),e([b()],Xe.prototype,"resourceInfo",void 0),e([b((()=>{const e=a(ee);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([b({clonable:!1})],Xe.prototype,"source",null),e([g("source")],Xe.prototype,"castSource",null),e([w("portal-item","source",["featureSet"]),w("web-map","source",["featureSet"])],Xe.prototype,"readSource",null),e([b({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Xe.prototype,"spatialReference",void 0),e([b({type:Number})],Xe.prototype,"subtypeCode",void 0),e([b({type:[Se]})],Xe.prototype,"templates",void 0),e([w("templates",["editFieldsInfo","creatorField","editorField","templates"])],Xe.prototype,"readTemplates",null),e([b({type:Pe})],Xe.prototype,"timeInfo",void 0),e([b()],Xe.prototype,"title",void 0),e([w("service","title",["name"]),w("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Xe.prototype,"readTitle",null),e([w("web-map","title",["layerDefinition.name","title"])],Xe.prototype,"readTitleFromWebMap",null),e([b({type:String})],Xe.prototype,"sublayerTitleMode",void 0),e([b({json:{read:!1}})],Xe.prototype,"type",void 0),e([b({type:String})],Xe.prototype,"typeIdField",void 0),e([w("service","typeIdField"),w("typeIdField",["layerDefinition.typeIdField"])],Xe.prototype,"readTypeIdField",null),e([b({type:[Ie]})],Xe.prototype,"types",void 0),e([w("service","types",["types"]),w("types",["layerDefinition.types"])],Xe.prototype,"readTypes",null),e([b({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:T}}}}})],Xe.prototype,"visible",void 0),e([w("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Xe.prototype,"readVisible",null),Xe=e([v("esri.layers.FeatureLayer")],Xe);export{Xe as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Clonable.js";import r from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n,whenOrAbort as l}from"../core/promiseUtils.js";import{watch as u,sync as p}from"../core/reactiveUtils.js";import{sqlAnd as y}from"../core/sql.js";import{urlToObject as d,join as c}from"../core/urlUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import b from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as F}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as v}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as L}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as I}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as C}from"./support/arcgisLayerUrl.js";import{id as O}from"./support/commonProperties.js";import{ensureLayerCredential as P,computeEffectiveEditingEnabled as G,addAttachment as A,updateAttachment as U,applyEdits as q,createQuery as D,deleteAttachments as M,fetchRecomputedExtents as R,computeDomainFromSubtypes as $,getFeatureSubtype as V,queryAttachments as k,queryObjectIds as N,queryFeatureCount as Q,queryExtent as H,queryRelatedFeatures as J,queryRelatedFeaturesCount as B,hasDataChanged as Z}from"./support/featureLayerUtils.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixTimeInfoFields as K}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as W,createSimpleRenderersWithUniqueColors as X}from"./support/subtypeGroupLayerUtils.js";import Y from"./support/SubtypeSublayer.js";import ee from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as te}from"./support/versionUtils.js";import re from"../rest/support/Query.js";import{isNumber as se}from"../support/guards.js";import{SaveOperationType as ie}from"../webdoc/interfaces.js";const oe="SubtypeGroupLayer";function ae(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ne(e,t){const r=[];for(const s of e){const e=new Y;e.read(s,t),r.push(e)}return r}const le=z();function ue(){return{name:"layerType",read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let pe=class extends(L(F(v(w(_(E(I(S(x(T(o(j(g(t.ClonableMixin(b))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(r.ofType(Y)),this.useUniqueColorsForSublayers=!0,this.supportedSourceTypes=new Set(["Feature Layer","Table"]),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/featureLayerUtils.js");switch(e){case ie.SAVE:return s(this,t);case ie.SAVE_AS:return i(this,r,t)}})),this.addHandles(u((()=>this.sublayers),((e,t)=>this._handleSublayersChange(e,t)),p))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(n).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>P(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return G(this)}get operationalLayerType(){return this.isTable?"SubtypeGroupTable":"SubtypeGroupLayer"}get parsedUrl(){const e=d(this.url);return null!=e&&null!=this.layerId&&(e.path=c(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?C(this.url,t):t}async addAttachment(e,t){const r=await A(this,e,t,oe);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const s=await U(this,e,t,r,oe);return this.lastEditsEventDate=new Date,s}async applyEdits(e,t){return q(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await l(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=D(this),t=this.sublayers.map((e=>e.subtypeCode));return e.where=y(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){const r=await M(this,e,t,oe);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return R(this,e,oe)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains){const t=$(this,e);if(t)return t}const r=V(this,t?.feature);if(r){const t=r.domains?.[e];return"inherited"===t?.type?this._getLayerDomain(e):t}return this._getLayerDomain(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,t){return k(this,e,t,oe)}async queryFeatures(e,t){const r=await this.load(),s=re.from(e)??r.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await r.source.queryFeatures(s,t);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,t){return(await N(this,e,t,oe)).filter(se)}async queryFeatureCount(e,t){return Q(this,e,t,oe)}async queryExtent(e,t){return H(this,e,t,oe)}async queryRelatedFeatures(e,t){return J(this,e,t,oe)}async queryRelatedFeaturesCount(e,t){return B(this,e,t,oe)}async save(e){return this._debouncedSaveOperations(ie.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(ie.SAVE_AS,t,e)}write(e,t){const{origin:r,layerContainerType:i,messages:o}=t;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return o?.push(ae(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return o?.push(ae(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,t):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&te(this,e)}async getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){const r=this.findSublayerForFeature(e);return r?await r.getFeatureTitle(e,t):this.displayField&&this.fieldsIndex.has(this.displayField)?e.attributes[this.fieldsIndex.get(this.displayField).name]??"":this.objectIdField&&this.fieldsIndex.has(this.objectIdField)?e.attributes[this.fieldsIndex.get(this.objectIdField).name]??"":""}get featureTitleFields(){const e=new Set;for(const t of this.sublayers){const r=t.featureTitleFields;for(const t of r)e.add(t)}return[...e]}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),K(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return Z(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)}))],"sublayers-owner"))}};e([h({readOnly:!0})],pe.prototype,"createQueryVersion",null),e([h({readOnly:!0})],pe.prototype,"editingEnabled",null),e([h({readOnly:!0})],pe.prototype,"effectiveEditingEnabled",null),e([h({...le.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],pe.prototype,"fields",void 0),e([h(le.fieldsIndex)],pe.prototype,"fieldsIndex",void 0),e([h(O)],pe.prototype,"id",void 0),e([h({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],pe.prototype,"listMode",void 0),e([h({type:["SubtypeGroupLayer","SubtypeGroupTable"],json:{...ue(),origins:{"web-document":ue(),"portal-item":ue()}}})],pe.prototype,"operationalLayerType",null),e([h(le.outFields)],pe.prototype,"outFields",void 0),e([h({readOnly:!0})],pe.prototype,"parsedUrl",null),e([h({clonable:!1})],pe.prototype,"source",null),e([h({type:r.ofType(Y),json:{origins:{service:{read:{source:"subtypes",reader(e,t,s){let i=null;if(this.useUniqueColorsForSublayers){const r=W(t,s);i=r?X(e.length,r):null}const o=e.map((({code:e},r)=>{const o=new Y({subtypeCode:e});o.read(t,s);const a=i?.[r];return a&&o.read({drawingInfo:{renderer:a.toJSON()}},s),o}));return new(r.ofType(Y))(o)}}}},read:{source:["layers","tables"],reader(e,t,s){let i;return"SubtypeGroupLayer"===t.layerType&&t.layers?.length?i=ne(t.layers,s):"SubtypeGroupTable"===t.layerType&&t.tables?.length&&(i=ne(t.tables,s)),new(r.ofType(Y))(i)}},write:{ignoreOrigin:!0,writer(e,t,r,s){const i=[];for(const o of e){const e=o.write({},s);i.push(e)}this.isTable?t.tables=i:t.layers=i}}}})],pe.prototype,"sublayers",void 0),e([h()],pe.prototype,"useUniqueColorsForSublayers",void 0),e([h({type:ee})],pe.prototype,"timeInfo",void 0),e([h({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],pe.prototype,"title",void 0),e([m("service","title",["name"])],pe.prototype,"readTitleFromService",null),e([h({json:{read:!1}})],pe.prototype,"type",void 0),e([h({clonable:!1,readOnly:!0})],pe.prototype,"featureTitleFields",null),pe=e([f("esri.layers.SubtypeGroupLayer")],pe);const ye=pe;export{ye as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Clonable.js";import r from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{debounce as n,throwIfAbortError as u,whenOrAbort as l}from"../core/promiseUtils.js";import{watch as p,sync as y}from"../core/reactiveUtils.js";import{sqlAnd as d}from"../core/sql.js";import{urlToObject as c,join as h}from"../core/urlUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../core/accessorSupport/decorators/subclass.js";import g from"./Layer.js";import{APIKeyMixin as w}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{CustomParametersMixin as F}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as v}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as L}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as T}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as E}from"./mixins/OperationalLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as _}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as C}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as O}from"./support/arcgisLayerUrl.js";import{id as P}from"./support/commonProperties.js";import{ensureLayerCredential as U,computeEffectiveEditingEnabled as A,addAttachment as G,updateAttachment as q,applyEdits as D,createQuery as M,deleteAttachments as k,fetchRecomputedExtents as R,computeDomainFromSubtypes as $,getFeatureSubtype as V,queryAttachments as N,queryObjectIds as Q,queryFeatureCount as H,queryExtent as J,queryRelatedFeatures as B,queryRelatedFeaturesCount as z,hasDataChanged as K}from"./support/featureLayerUtils.js";import{defineFieldProperties as Z}from"./support/fieldProperties.js";import{fixTimeInfoFields as W}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as X,createSimpleRenderersWithUniqueColors as Y}from"./support/subtypeGroupLayerUtils.js";import ee from"./support/SubtypeSublayer.js";import te from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as re}from"./support/versionUtils.js";import se from"../rest/support/Query.js";import{isNumber as ie}from"../support/guards.js";import{SaveOperationType as oe}from"../webdoc/interfaces.js";const ae="SubtypeGroupLayer";function ne(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ue(e,t){const r=[];for(const s of e){const e=new ee;e.read(s,t),r.push(e)}return r}const le=Z();function pe(){return{name:"layerType",read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let ye=class extends(T(v(L(j(C(I(_(S(E(x(a(F(w(t.ClonableMixin(g))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(r.ofType(ee)),this.useUniqueColorsForSublayers=!0,this.supportedSourceTypes=new Set(["Feature Layer","Table"]),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=n((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/featureLayerUtils.js");switch(e){case oe.SAVE:return s(this,t);case oe.SAVE_AS:return i(this,r,t)}})),this.addHandles(p((()=>this.sublayers),((e,t)=>this._handleSublayersChange(e,t)),y))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(u).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>U(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return A(this)}get operationalLayerType(){return this.isTable?"SubtypeGroupTable":"SubtypeGroupLayer"}get parsedUrl(){const e=c(this.url);return null!=e&&null!=this.layerId&&(e.path=h(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?O(this.url,t):t}async addAttachment(e,t){const r=await G(this,e,t,ae);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const s=await q(this,e,t,r,ae);return this.lastEditsEventDate=new Date,s}async applyEdits(e,t){return D(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await l(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=M(this),t=this.sublayers.map((e=>e.subtypeCode));return e.where=d(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){const r=await k(this,e,t,ae);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return R(this,e,ae)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains){const t=$(this,e);if(t)return t}const r=V(this,t?.feature);if(r){const t=r.domains?.[e];return"inherited"===t?.type?this._getLayerDomain(e):t}return this._getLayerDomain(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,t){return N(this,e,t,ae)}async queryFeatures(e,t){const r=await this.load(),s=se.from(e)??r.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await r.source.queryFeatures(s,t);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,t){return(await Q(this,e,t,ae)).filter(ie)}async queryFeatureCount(e,t){return H(this,e,t,ae)}async queryExtent(e,t){return J(this,e,t,ae)}async queryRelatedFeatures(e,t){return B(this,e,t,ae)}async queryRelatedFeaturesCount(e,t){return z(this,e,t,ae)}async save(e){return this._debouncedSaveOperations(oe.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(oe.SAVE_AS,t,e)}write(e,t){const{origin:r,layerContainerType:i,messages:o}=t;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return o?.push(ne(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return o?.push(ne(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,t):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&re(this,e)}async getFeatureTitle(e,t){const r=this.findSublayerForFeature(e);return r?await r.getFeatureTitle(e,t):this._getFeatureTitleForUnknownSublayer(e)}async getFeatureTitles(e,t){const r=new Map,s=new Map,i=[s];e.forEach((e=>{const t=this.findSublayerForFeature(e);t?o(r,t,(()=>[])).push(e):s.set(e,this._getFeatureTitleForUnknownSublayer(e))}));const a=await Promise.all(Array.from(r).map((([e,r])=>e.getFeatureTitles(r,t))));return a.forEach((e=>i.push(e))),new Map(i.flatMap((e=>[...e])))}get featureTitleFields(){const e=new Set;for(const t of this.sublayers){const r=t.featureTitleFields;for(const t of r)e.add(t)}return[...e]}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),W(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return K(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)}))],"sublayers-owner"))}_getFeatureTitleForUnknownSublayer(e){const{displayField:t,fieldsIndex:r,objectIdField:s}=this;if(t&&r.has(t))return e.attributes[r.get(t).name]??"";const i=e.getObjectId();return null!=i?i.toString():s&&r.has(s)?e.attributes[r.get(s).name]??"":""}};e([m({readOnly:!0})],ye.prototype,"createQueryVersion",null),e([m({readOnly:!0})],ye.prototype,"editingEnabled",null),e([m({readOnly:!0})],ye.prototype,"effectiveEditingEnabled",null),e([m({...le.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ye.prototype,"fields",void 0),e([m(le.fieldsIndex)],ye.prototype,"fieldsIndex",void 0),e([m(P)],ye.prototype,"id",void 0),e([m({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],ye.prototype,"listMode",void 0),e([m({type:["SubtypeGroupLayer","SubtypeGroupTable"],json:{...pe(),origins:{"web-document":pe(),"portal-item":pe()}}})],ye.prototype,"operationalLayerType",null),e([m(le.outFields)],ye.prototype,"outFields",void 0),e([m({readOnly:!0})],ye.prototype,"parsedUrl",null),e([m({clonable:!1})],ye.prototype,"source",null),e([m({type:r.ofType(ee),json:{origins:{service:{read:{source:"subtypes",reader(e,t,s){let i=null;if(this.useUniqueColorsForSublayers){const r=X(t,s);i=r?Y(e.length,r):null}const o=e.map((({code:e},r)=>{const o=new ee({subtypeCode:e});o.read(t,s);const a=i?.[r];return a&&o.read({drawingInfo:{renderer:a.toJSON()}},s),o}));return new(r.ofType(ee))(o)}}}},read:{source:["layers","tables"],reader(e,t,s){let i;return"SubtypeGroupLayer"===t.layerType&&t.layers?.length?i=ue(t.layers,s):"SubtypeGroupTable"===t.layerType&&t.tables?.length&&(i=ue(t.tables,s)),new(r.ofType(ee))(i)}},write:{ignoreOrigin:!0,writer(e,t,r,s){const i=[];for(const o of e){const e=o.write({},s);i.push(e)}this.isTable?t.tables=i:t.layers=i}}}})],ye.prototype,"sublayers",void 0),e([m()],ye.prototype,"useUniqueColorsForSublayers",void 0),e([m({type:te})],ye.prototype,"timeInfo",void 0),e([m({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],ye.prototype,"title",void 0),e([f("service","title",["name"])],ye.prototype,"readTitleFromService",null),e([m({json:{read:!1}})],ye.prototype,"type",void 0),e([m({clonable:!1,readOnly:!0})],ye.prototype,"featureTitleFields",null),ye=e([b("esri.layers.SubtypeGroupLayer")],ye);const de=ye;export{de as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import{createTask as r}from"../core/asyncUtils.js";import i from"../core/Error.js";import{clone as o}from"../core/lang.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{urlToObject as a,addQueryParameters as n,isProtocolRelative as p,normalize as y}from"../core/urlUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{checkWebPSupport as U}from"./support/imageUtils.js";import I from"./support/SpriteSource.js";import R from"./support/TileInfo.js";import{TilemapCache as O}from"./support/TilemapCache.js";import{loadMetadata as P}from"./support/vectorTileLayerLoader.js";import{createForItemRead as M}from"../portal/support/jsonContext.js";import{parseKnownArcGISOnlineDomain as C}from"../portal/support/urlUtils.js";import{e as V}from"../chunks/persistableUrlUtils.js";import{areSchemasOverlapping as D,unionTileInfos as k}from"../views/2d/engine/vectorTiles/tileInfoUtils.js";import E from"../views/2d/engine/vectorTiles/style/StyleRepository.js";import{getWebGLCapabilities as N}from"../views/webgl/capabilities.js";let B=class extends(_(L(x(v(j(b(T(w(g(s(f))))))))))){constructor(...e){super(...e),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.path=null,this.refreshInterval=0,this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){if(this.sourceNameToSource)for(const e of Object.values(this.sourceNameToSource))e?.destroy();this.primarySource?.destroy(),this._spriteSourceMap.clear()}async prefetchResources(e){await this.loadSpriteSource(globalThis.devicePixelRatio||1,e)}load(e){const r=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},e).catch(l).then((async()=>{if(!this.portalItem?.id)return;const r=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await t(r,{...e,query:{f:"json",...this.customParameters,token:this.apiKey},authMode:this.portalItem.portal.authMode})).data&&this.read({url:r},M(this.portalItem,"portal-item"))})).catch(l).then((()=>this._loadStyle(e)));return this.addResolvingPromise(r),Promise.resolve(this)}get attributionDataUrl(){const e=this.currentStyleInfo,t=e?.serviceUrl&&a(e.serviceUrl);if(!t)return null;const r=this._getDefaultAttribution(t.path);return r?n(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const e=this.primarySource;return e?e.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){return this.primarySource?.fullExtent||null}get initialExtent(){return this.primarySource?.initialExtent||null}get parsedUrl(){return this.serviceUrl?a(this.serviceUrl):null}get serviceUrl(){return this.currentStyleInfo?.serviceUrl||null}get spatialReference(){return this.tileInfo?.spatialReference??null}get styleUrl(){return this.currentStyleInfo?.styleUrl||null}writeStyleUrl(e,t){e&&p(e)&&(e=`https:${e}`);const r=C(e);t.styleUrl=V(e,r)}get tileInfo(){const e=[];for(const r in this.sourceNameToSource)e.push(this.sourceNameToSource[r]);let t=this.primarySource?.tileInfo||new R;if(e.length>1)for(let r=0;r<e.length;r++)D(t,e[r].tileInfo)&&(t=k(t,e[r].tileInfo));return t}readTilemapCache(e,t){const r=t.capabilities?.includes("Tilemap");return r?new O({layer:this}):null}readVersion(e,t){return t.version?parseFloat(t.version):parseFloat(t.currentVersion)}async loadSpriteSource(e=1,t){if(!this._spriteSourceMap.has(e)){const r=N().maxTextureSize,i=this.currentStyleInfo?.spriteUrl?n(this.currentStyleInfo.spriteUrl,{...this.customParameters,token:this.apiKey}):null,o=new I({type:"url",spriteUrl:i,pixelRatio:e,spriteFormat:this.currentStyleInfo?.spriteFormat},r);await o.load(t),this._spriteSourceMap.set(e,o)}return this._spriteSourceMap.get(e)}async setSpriteSource(e,t){if(!e)return null;const r=N().maxTextureSize,i=e.spriteUrl,o=i?n(i,{...this.customParameters,token:this.apiKey}):null;if(!o&&"url"===e.type)return null;const s=new I(e,r);try{await s.load(t);const r=e.pixelRatio||1;return this._spriteSourceMap.clear(),this._spriteSourceMap.set(r,s),o&&this.currentStyleInfo&&(this.currentStyleInfo.spriteUrl=o),this.emit("spriteSource-change",{spriteSource:s}),s}catch(a){l(a)}return null}async loadStyle(e,t){const i=e||this.style||this.url;return this._loadingTask&&"string"==typeof i&&this.url===i||(this._loadingTask?.abort(),this._loadingTask=r((e=>(this._spriteSourceMap.clear(),this._getSourceAndStyle(i,{signal:e}))),t)),this._loadingTask.promise}getStyleLayerId(e){return this.styleRepository.getStyleLayerId(e)}getStyleLayerIndex(e){return this.styleRepository.getStyleLayerIndex(e)}getPaintProperties(e){return o(this.styleRepository?.getPaintProperties(e))}setPaintProperties(e,t){const r=this.styleRepository.isPainterDataDriven(e);this.styleRepository.setPaintProperties(e,t);const i=this.styleRepository.isPainterDataDriven(e);this.emit("paint-change",{layer:e,paint:t,isDataDriven:r||i})}getStyleLayer(e){return o(this.styleRepository.getStyleLayer(e))}setStyleLayer(e,t){this.styleRepository.setStyleLayer(e,t),this.emit("style-layer-change",{layer:e,index:t})}deleteStyleLayer(e){this.styleRepository.deleteStyleLayer(e),this.emit("delete-style-layer",{layer:e})}getLayoutProperties(e){return o(this.styleRepository.getLayoutProperties(e))}setLayoutProperties(e,t){this.styleRepository.setLayoutProperties(e,t),this.emit("layout-change",{layer:e,layout:t})}setStyleLayerVisibility(e,t){this.styleRepository.setStyleLayerVisibility(e,t),this.emit("style-layer-visibility-change",{layer:e,visibility:t})}getStyleLayerVisibility(e){return this.styleRepository.getStyleLayerVisibility(e)}write(e,t){return t?.origin&&!this.styleUrl?(t.messages&&t.messages.push(new i("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(e,t)}getTileUrl(e,t,r){return null}async _getSourceAndStyle(e,t){if(!e)throw new Error("invalid style!");const r=await P(e,{...t,query:{...this.customParameters,token:this.apiKey}});if("webp"===r.spriteFormat){await U("lossy")||(r.spriteFormat="png")}this._set("currentStyleInfo",{...r}),"string"==typeof e?(this.url=e,this.style=null):(this.url=null,this.style=e),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new E(r.style)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(e){const t=e.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^/]+)?\/arcgis\/rest\/services\/([^/]+(\/[^/]+)*)\/vectortileserver/i),r=["OpenBasemap_v2","OpenBasemap_GCS_v2","OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2","World_Hillshade_v2"];if(!t)return;const i=t[2]&&t[2].toLowerCase();if(!i)return;const o=t[1]||"";for(const s of r)if(s.toLowerCase().includes(i))return y(`//static.arcgis.com/attribution/Vector${o}/${s}`)}async _loadStyle(e){return this._loadingTask?.promise??this.loadStyle(null,e)}};e([u({readOnly:!0})],B.prototype,"attributionDataUrl",null),e([u({type:["show","hide"]})],B.prototype,"listMode",void 0),e([u({json:{read:!0,write:!0}})],B.prototype,"blendMode",void 0),e([u({readOnly:!0,json:{read:!1}})],B.prototype,"capabilities",null),e([u({readOnly:!0})],B.prototype,"currentStyleInfo",void 0),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"fullExtent",null),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"initialExtent",null),e([u({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],B.prototype,"isReference",void 0),e([u({type:["VectorTileLayer"]})],B.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],B.prototype,"parsedUrl",null),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],B.prototype,"path",void 0),e([u({type:Number,json:{write:!1,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],B.prototype,"refreshInterval",void 0),e([u()],B.prototype,"style",void 0),e([u({readOnly:!0})],B.prototype,"serviceUrl",null),e([u({type:S,readOnly:!0})],B.prototype,"spatialReference",null),e([u({readOnly:!0})],B.prototype,"styleRepository",void 0),e([u({readOnly:!0})],B.prototype,"sourceNameToSource",void 0),e([u({readOnly:!0})],B.prototype,"primarySource",void 0),e([u({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],B.prototype,"styleUrl",null),e([h(["portal-item","web-document"],"styleUrl")],B.prototype,"writeStyleUrl",null),e([u({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:R})],B.prototype,"tileInfo",null),e([u()],B.prototype,"tilemapCache",void 0),e([c("service","tilemapCache",["capabilities","tileInfo"])],B.prototype,"readTilemapCache",null),e([u({json:{read:!1},readOnly:!0,value:"vector-tile"})],B.prototype,"type",void 0),e([u({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],B.prototype,"url",void 0),e([u({readOnly:!0})],B.prototype,"version",void 0),e([c("version",["version","currentVersion"])],B.prototype,"readVersion",null),B=e([m("esri.layers.VectorTileLayer")],B);const A=B;export{A as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import{createTask as r}from"../core/asyncUtils.js";import i from"../core/Error.js";import{clone as o}from"../core/lang.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{urlToObject as a,addQueryParameters as n,isProtocolRelative as p,normalize as y}from"../core/urlUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{checkWebPSupport as U}from"./support/imageUtils.js";import I from"./support/SpriteSource.js";import R from"./support/TileInfo.js";import{TilemapCache as O}from"./support/TilemapCache.js";import{loadMetadata as P}from"./support/vectorTileLayerLoader.js";import{createForItemRead as M}from"../portal/support/jsonContext.js";import{parseKnownArcGISOnlineDomain as C}from"../portal/support/urlUtils.js";import{e as V}from"../chunks/persistableUrlUtils.js";import{areSchemasOverlapping as D,unionTileInfos as k}from"../views/2d/engine/vectorTiles/tileInfoUtils.js";import E from"../views/2d/engine/vectorTiles/style/StyleRepository.js";import{getWebGLCapabilities as N}from"../views/webgl/capabilities.js";let B=class extends(_(L(x(v(j(b(T(w(g(s(f))))))))))){constructor(...e){super(...e),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.path=null,this.refreshInterval=0,this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){if(this.sourceNameToSource)for(const e of Object.values(this.sourceNameToSource))e?.destroy();this.primarySource?.destroy(),this._spriteSourceMap.clear()}async prefetchResources(e){await this.loadSpriteSource(globalThis.devicePixelRatio||1,e)}load(e){const r=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},e).catch(l).then((async()=>{if(!this.portalItem?.id)return;const r=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await t(r,{...e,query:{f:"json",...this.customParameters,token:this.apiKey},authMode:this.portalItem.portal.authMode})).data&&this.read({url:r},M(this.portalItem,"portal-item"))})).catch(l).then((()=>this._loadStyle(e)));return this.addResolvingPromise(r),Promise.resolve(this)}get attributionDataUrl(){const e=this.currentStyleInfo,t=e?.serviceUrl&&a(e.serviceUrl);if(!t)return null;const r=this._getDefaultAttribution(t.path);return r?n(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const e=this.primarySource;return e?e.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){return this.primarySource?.fullExtent||null}get initialExtent(){return this.primarySource?.initialExtent||null}get parsedUrl(){return this.serviceUrl?a(this.serviceUrl):null}get serviceUrl(){return this.currentStyleInfo?.serviceUrl||null}get spatialReference(){return this.tileInfo?.spatialReference??null}get styleUrl(){return this.currentStyleInfo?.styleUrl||null}writeStyleUrl(e,t){e&&p(e)&&(e=`https:${e}`);const r=C(e);t.styleUrl=V(e,r)}get tileInfo(){const e=[];for(const r in this.sourceNameToSource)e.push(this.sourceNameToSource[r]);let t=this.primarySource?.tileInfo||new R;if(e.length>1)for(let r=0;r<e.length;r++)D(t,e[r].tileInfo)&&(t=k(t,e[r].tileInfo));return t}readTilemapCache(e,t){const r=t.capabilities?.includes("Tilemap");return r?new O({layer:this}):null}readVersion(e,t){return t.version?parseFloat(t.version):parseFloat(t.currentVersion)}async loadSpriteSource(e=1,t){if(!this._spriteSourceMap.has(e)){const r=N().maxTextureSize,i=this.currentStyleInfo?.spriteUrl?n(this.currentStyleInfo.spriteUrl,{...this.customParameters,token:this.apiKey}):null,o=new I({type:"url",spriteUrl:i,pixelRatio:e,spriteFormat:this.currentStyleInfo?.spriteFormat},r);await o.load(t),this._spriteSourceMap.set(e,o)}return this._spriteSourceMap.get(e)}async setSpriteSource(e,t){if(!e)return null;const r=N().maxTextureSize,i=e.spriteUrl,o=i?n(i,{...this.customParameters,token:this.apiKey}):null;if(!o&&"url"===e.type)return null;const s=new I(e,r);try{await s.load(t);const r=e.pixelRatio||1;return this._spriteSourceMap.clear(),this._spriteSourceMap.set(r,s),o&&this.currentStyleInfo&&(this.currentStyleInfo.spriteUrl=o),this.emit("spriteSource-change",{spriteSource:s}),s}catch(a){l(a)}return null}async loadStyle(e,t){const i=e||this.style||this.url;return this._loadingTask&&"string"==typeof i&&this.url===i||(this._loadingTask?.abort(),this._loadingTask=r((e=>(this._spriteSourceMap.clear(),this._getSourceAndStyle(i,{signal:e}))),t)),this._loadingTask.promise}getStyleLayerId(e){return this.styleRepository.getStyleLayerId(e)}getStyleLayerIndex(e){return this.styleRepository.getStyleLayerIndex(e)}getPaintProperties(e){return o(this.styleRepository?.getPaintProperties(e))}setPaintProperties(e,t){const r=this.styleRepository.isPainterDataDriven(e);this.styleRepository.setPaintProperties(e,t);const i=this.styleRepository.isPainterDataDriven(e);this.emit("paint-change",{layer:e,paint:t,isDataDriven:r||i})}getStyleLayer(e){return o(this.styleRepository.getStyleLayer(e))}setStyleLayer(e,t){this.styleRepository.setStyleLayer(e,t),this.emit("style-layer-change",{layer:e,index:t})}deleteStyleLayer(e){this.styleRepository.deleteStyleLayer(e),this.emit("delete-style-layer",{layer:e})}getLayoutProperties(e){return o(this.styleRepository.getLayoutProperties(e))}setLayoutProperties(e,t){this.styleRepository.setLayoutProperties(e,t),this.emit("layout-change",{layer:e,layout:t})}setStyleLayerVisibility(e,t){this.styleRepository.setStyleLayerVisibility(e,t),this.emit("style-layer-visibility-change",{layer:e,visibility:t})}getStyleLayerVisibility(e){return this.styleRepository.getStyleLayerVisibility(e)}write(e,t){return t?.origin&&!this.styleUrl?(t.messages&&t.messages.push(new i("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(e,t)}getTileUrl(e,t,r){return null}async _getSourceAndStyle(e,t){if(!e)throw new Error("invalid style!");const r=await P(e,{...t,query:{...this.customParameters,token:this.apiKey}});if("webp"===r.spriteFormat){await U("lossy")||(r.spriteFormat="png")}this._set("currentStyleInfo",{...r}),"string"==typeof e?(this.url=e,this.style=null):(this.url=null,this.style=e),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new E(r.style,!1)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(e){const t=e.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^/]+)?\/arcgis\/rest\/services\/([^/]+(\/[^/]+)*)\/vectortileserver/i),r=["OpenBasemap_v2","OpenBasemap_GCS_v2","OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2","World_Hillshade_v2"];if(!t)return;const i=t[2]&&t[2].toLowerCase();if(!i)return;const o=t[1]||"";for(const s of r)if(s.toLowerCase().includes(i))return y(`//static.arcgis.com/attribution/Vector${o}/${s}`)}async _loadStyle(e){return this._loadingTask?.promise??this.loadStyle(null,e)}};e([u({readOnly:!0})],B.prototype,"attributionDataUrl",null),e([u({type:["show","hide"]})],B.prototype,"listMode",void 0),e([u({json:{read:!0,write:!0}})],B.prototype,"blendMode",void 0),e([u({readOnly:!0,json:{read:!1}})],B.prototype,"capabilities",null),e([u({readOnly:!0})],B.prototype,"currentStyleInfo",void 0),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"fullExtent",null),e([u({json:{read:!1},readOnly:!0,type:d})],B.prototype,"initialExtent",null),e([u({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],B.prototype,"isReference",void 0),e([u({type:["VectorTileLayer"]})],B.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],B.prototype,"parsedUrl",null),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],B.prototype,"path",void 0),e([u({type:Number,json:{write:!1,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],B.prototype,"refreshInterval",void 0),e([u()],B.prototype,"style",void 0),e([u({readOnly:!0})],B.prototype,"serviceUrl",null),e([u({type:S,readOnly:!0})],B.prototype,"spatialReference",null),e([u({readOnly:!0})],B.prototype,"styleRepository",void 0),e([u({readOnly:!0})],B.prototype,"sourceNameToSource",void 0),e([u({readOnly:!0})],B.prototype,"primarySource",void 0),e([u({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],B.prototype,"styleUrl",null),e([h(["portal-item","web-document"],"styleUrl")],B.prototype,"writeStyleUrl",null),e([u({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:R})],B.prototype,"tileInfo",null),e([u()],B.prototype,"tilemapCache",void 0),e([c("service","tilemapCache",["capabilities","tileInfo"])],B.prototype,"readTilemapCache",null),e([u({json:{read:!1},readOnly:!0,value:"vector-tile"})],B.prototype,"type",void 0),e([u({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],B.prototype,"url",void 0),e([u({readOnly:!0})],B.prototype,"version",void 0),e([c("version",["version","currentVersion"])],B.prototype,"readVersion",null),B=e([m("esri.layers.VectorTileLayer")],B);const A=B;export{A as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import r from"../request.js";import{deprecatedProperty as o}from"../core/deprecate.js";import i from"../core/Error.js";import s from"../core/Logger.js";import{clamp as l}from"../core/mathUtils.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as p,initial as y,whenOnce as m}from"../core/reactiveUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import{Integer as d}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as f}from"../core/accessorSupport/PropertyOrigin.js";import v from"../geometry/Extent.js";import g from"../geometry/Polyline.js";import S from"../geometry/SpatialReference.js";import b from"./Layer.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as O,effectProperty as T}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{titleFromUrlAndName as x}from"./support/arcgisLayerUrl.js";import{opacity as U,id as P}from"./support/commonProperties.js";import{normalizeParsedUrlObject as E,urlProperty as N}from"./support/multiLayerServiceUtils.js";import M from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as k}from"./support/serviceCapabilitiesUtils.js";import V from"./support/TelemetryData.js";import F from"./support/TelemetryDisplay.js";import R from"./support/VideoFrame.js";import G from"./support/VideoTimeExtent.js";import J from"./video/VideoController.js";import{getFrameHorizonPoints as A,getGroundControlPoints as H,getTelemetryData as z,getServiceLayersInfo as q,getStyledTelemetrySymbol as D,getSensorTrailPoints as _,readVideoTimeExtent as B}from"./video/videoUtils.js";import W from"../symbols/CIMSymbol.js";import Q from"../symbols/PictureMarkerSymbol.js";import $ from"../symbols/SimpleFillSymbol.js";import Z from"../symbols/SimpleLineSymbol.js";import K from"../symbols/SimpleMarkerSymbol.js";import X from"../symbols/Symbol.js";import{write as Y}from"../symbols/support/jsonUtils.js";function ee(e,t){return{ignoreOrigin:this.originIdOf(t)<f.PORTAL_ITEM}}let te=[];const re=new t([255,127,0]),oe=new t([0,0,0,.05]),ie=new K({angle:0,color:re,size:10,style:"cross"}),se=new $({color:oe,outline:new Z({color:re,width:2})}),le=new Z({color:re,width:1}),ne=new K({angle:0,color:re,outline:{color:[255,255,255],width:1.33},size:10,style:"circle"}),ae=new Z({color:re,width:1}),pe={types:{base:X,key:"type",typeMap:{"simple-marker":K,"picture-marker":Q,cim:W}},json:{name:"drawingInfo.sensorSymbol",write:{writer:Y,overridePolicy:ee}}};function ye(e,t){return{type:t,json:{name:e,write:{overridePolicy:ee}}}}let me=class extends(O(C(j(I(L(n(w(b)))))))){constructor(e){super(e),this.capabilities=null,this.codecs=null,this.connectionInfo=null,this.controller=new J,this.copyright=null,this.created=null,this.customParameters=null,this.description=null,this.elevationSource=null,this.frame=null,this.frameCenterSymbol=ie.clone(),this.frameCount=null,this.frameEffect=null,this.frameOpacity=1,this.frameOutlineSymbol=se.clone(),this.fullExtent=null,this.initialExtent=null,this.layerId=null,this.operationalLayerType="ArcGISVideoLayer",this.playbackInfo=null,this.posterUrl=null,this.qualities=null,this.sensorSymbol=ne.clone(),this.sensorSightLineSymbol=le.clone(),this.sensorTrailSymbol=ae.clone(),this.serviceItemId=null,this.sourceJSON=null,this.sourceQuality=null,this.sourceType=null,this.spatialReference=S.WGS84,this.start=0,this.telemetryDisplay=new F,this.type="video",this.url=null,this.version=null,this.videoLayersInfo=null}initialize(){this.addHandles([p((()=>this.metadata),(()=>{this.notifyChange("telemetry"),this.notifyChange("groundControlPoints"),this.notifyChange("frameHorizonPoints")})),p((()=>this.telemetry?.sensorLocation),(e=>this._setSensorTrail(e)),y)]),m((()=>this.loaded&&"can-play"===this.state&&this.duration>0)).then((()=>{this.start>=0&&this.start<=this.duration&&this.setCurrentTime(this.start)}))}destroy(){this.removeAllHandles(),this.controller&&this.controller.destroy()}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Video Service"],supportsData:!1},e).catch(a).then((()=>this._fetchService(t)));return this.addResolvingPromise(r),Promise.resolve(this)}get autoplay(){return this.controller?.autoplay??!1}set autoplay(e){this.controller.autoplay=e}get buffered(){return this.controller.buffered}readCapabilitiesFromService(e,t){return k(t)}readConnectionInfo(e,t){const r=Object.values(t.connectionUrl);return r?.length&&(this.controller.playerUrl=r[0]),t.connectionUrl}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get frameHorizonPoints(){return A(this.metadata)}get groundControlPoints(){return H(this.metadata)}get isLive(){return this.controller?.isLive??!1}get livestreamStatus(){return this.controller?.livestreamStatus}get loop(){return this.controller.loop}set loop(e){this.controller.loop=e}get metadata(){return this.controller?.currentMetadata}get mimeType(){return this.controller?.mimeType}get muted(){return this.controller.muted}set muted(e){this.controller.muted=e}get parsedUrl(){return E(this)}get playbackRate(){return this.controller.rate}set playbackRate(e){this.controller.rate=e}get playerUrl(){return this.controller.playerUrl}get playing(){return this.controller.playing}get started(){return this.controller?.started??!1}get state(){return this.controller.state}get telemetry(){return z(this.metadata)}readTitleFromService(e,{name:t}){return this.url?x(this.url,t):t}get videoElement(){return this.controller?.element}get videoHeight(){return this.controller?.videoHeight}readLayerInfosFromService(e,t){return q(t)}get videoTimeExtent(){return o(s.getLogger(this),"videoTimeExtent",{replacement:"fullTimeExtent",version:"4.33",warnOnce:!0}),this.fullTimeExtent}get videoWidth(){return this.controller?.videoWidth}get volume(){return this.controller?.volume??0}set volume(e){this.controller.volume=e}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){this.controller.reset()}setCurrentTime(e){if(this.duration<0)return;const t=l(e,0,this.duration);this.controller.setCurrentTime(t)}toGround(e,t){return this.controller?.sensorModel?.metadataSupportsTransforms?this.controller.sensorModel.transformImageToGeo(e,t):null}toVideo(e){if(!this.controller?.sensorModel?.metadataSupportsTransforms)return null;const t=this.controller.sensorModel.transformGeoToImage(e.x,e.y,e.z);return{x:t[0],y:t[1]}}updateTelemetryColor(e){this.frameCenterSymbol=D(this.frameCenterSymbol,e)??ie,this.frameOutlineSymbol=D(this.frameOutlineSymbol,e,oe)??se,this.sensorSightLineSymbol=D(this.sensorSightLineSymbol,e)??le,this.sensorTrailSymbol=D(this.sensorTrailSymbol,e)??ae,this.sensorSymbol=D(this.sensorSymbol,e)??ne}write(e,t){return null==this.layerId?(t?.messages?.push(new i("layer:unsupported",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' cannot be saved to a web map, web scene, or portal item. The ArcGIS server version must be greater than 11.2.`)),null):super.write(e,t)}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:o}=await r(this.url,{query:{f:"json",...this.parsedUrl.query,...this.customParameters},signal:e});if(o&&(this.url=this.url.replace(/^http:/i,"https:")),!t?.currentVersion)return t.currentVersion="11.2",this.sourceJSON=t,void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});if(this.layerId??=t.layers?.[0]?.id??null,null==this.layerId)throw new i("arcgis-layers:url-mismatch","The url is not a valid arcgis resource");const{data:s}=await r(this.parsedUrl.path,{query:{f:"json",...this.customParameters},signal:e});this.sourceJSON={...t,...s},this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl})}_setSensorTrail(e){if(!e)return;const t=_(e,te);te=[...t];const r=te.map((e=>e.toArray())),o=new g({hasZ:e.hasZ,paths:[r]});this.telemetry.sensorTrail=o.clone()}};e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],me.prototype,"autoplay",null),e([u({readOnly:!0})],me.prototype,"buffered",null),e([u({readOnly:!0})],me.prototype,"cameraInfo",void 0),e([u({readOnly:!0,json:{read:!1}})],me.prototype,"capabilities",void 0),e([c("service","capabilities",["supportsAppend","supportsCoverageQuery","supportsExportClip","supportsExportFrameset","supportsMensuration","supportsPreviews","supportsUpdate"])],me.prototype,"readCapabilitiesFromService",null),e([u({readOnly:!0})],me.prototype,"codecs",void 0),e([u({readOnly:!0})],me.prototype,"connectionInfo",void 0),e([c("connectionInfo",["connectionUrl"])],me.prototype,"readConnectionInfo",null),e([u()],me.prototype,"controller",void 0),e([u({type:String})],me.prototype,"copyright",void 0),e([u({readOnly:!0,type:Date})],me.prototype,"created",void 0),e([u({type:Number})],me.prototype,"currentTime",null),e([u({json:{write:!1}})],me.prototype,"customParameters",void 0),e([u({type:String})],me.prototype,"description",void 0),e([u({type:Number})],me.prototype,"duration",null),e([u({readOnly:!0})],me.prototype,"elevationSource",void 0),e([u({type:Boolean})],me.prototype,"ended",null),e([u({type:R})],me.prototype,"frame",void 0),e([u(ye("drawingInfo.frameCenterSymbol",K))],me.prototype,"frameCenterSymbol",void 0),e([u({readOnly:!0,type:d})],me.prototype,"frameCount",void 0),e([u(T)],me.prototype,"frameEffect",void 0),e([u(U)],me.prototype,"frameOpacity",void 0),e([u(ye("drawingInfo.frameOutlineSymbol",$))],me.prototype,"frameOutlineSymbol",void 0),e([u({type:v})],me.prototype,"fullExtent",void 0),e([u({readOnly:!0})],me.prototype,"frameHorizonPoints",null),e([u({readOnly:!0,json:{read:{reader:B,source:"time"}},type:G})],me.prototype,"fullTimeExtent",void 0),e([u({readOnly:!0})],me.prototype,"groundControlPoints",null),e([u(P)],me.prototype,"id",void 0),e([u({type:v})],me.prototype,"initialExtent",void 0),e([u({readOnly:!0})],me.prototype,"isLive",null),e([u({type:d,json:{read:!1,origins:{service:{read:{source:"id"}}}}})],me.prototype,"layerId",void 0),e([u({readOnly:!0})],me.prototype,"livestreamStatus",null),e([u({type:Boolean})],me.prototype,"loop",null),e([u({readOnly:!0})],me.prototype,"metadata",null),e([u({readOnly:!0})],me.prototype,"mimeType",null),e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],me.prototype,"muted",null),e([u({type:["ArcGISVideoLayer"]})],me.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],me.prototype,"parsedUrl",null),e([u({type:M})],me.prototype,"playbackInfo",void 0),e([u({type:Number})],me.prototype,"playbackRate",null),e([u({readOnly:!0,type:String})],me.prototype,"playerUrl",null),e([u({readOnly:!0})],me.prototype,"playing",null),e([u({readOnly:!0,json:{read:{source:"poster"}}})],me.prototype,"posterUrl",void 0),e([u({readOnly:!0})],me.prototype,"qualities",void 0),e([u(pe)],me.prototype,"sensorSymbol",void 0),e([u(ye("drawingInfo.sensorSightLineSymbol",Z))],me.prototype,"sensorSightLineSymbol",void 0),e([u(ye("drawingInfo.sensorTrailSymbol",Z))],me.prototype,"sensorTrailSymbol",void 0),e([u({readOnly:!0})],me.prototype,"serviceItemId",void 0),e([u()],me.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],me.prototype,"sourceQuality",void 0),e([u({readOnly:!0,json:{name:"serviceType"}})],me.prototype,"sourceType",void 0),e([u()],me.prototype,"spatialReference",void 0),e([u({json:{write:!0}})],me.prototype,"start",void 0),e([u({readOnly:!0})],me.prototype,"started",null),e([u({readOnly:!0,type:String})],me.prototype,"state",null),e([u({readOnly:!0,type:V})],me.prototype,"telemetry",null),e([u({type:F,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],me.prototype,"telemetryDisplay",void 0),e([c("service","title",["name"])],me.prototype,"readTitleFromService",null),e([u({readOnly:!0})],me.prototype,"type",void 0),e([u(N())],me.prototype,"url",void 0),e([u({readOnly:!0,type:Number,json:{read:{source:"currentVersion"}}})],me.prototype,"version",void 0),e([u({readOnly:!0})],me.prototype,"videoElement",null),e([u({readOnly:!0})],me.prototype,"videoHeight",null),e([u({readOnly:!0,json:{read:!1}})],me.prototype,"videoLayersInfo",void 0),e([c("service","videoLayersInfo",["id","name","poster","serviceType","type"])],me.prototype,"readLayerInfosFromService",null),e([u({type:G,readOnly:!0})],me.prototype,"videoTimeExtent",null),e([u({readOnly:!0})],me.prototype,"videoWidth",null),e([u()],me.prototype,"volume",null),e([u({readOnly:!0})],me.prototype,"waiting",null),me=e([h("esri.layers.VideoLayer")],me);const ue=me;export{ue as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import r from"../request.js";import{deprecatedProperty as o}from"../core/deprecate.js";import i from"../core/Error.js";import s from"../core/Logger.js";import{clamp as l}from"../core/mathUtils.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as p,initial as y,whenOnce as m}from"../core/reactiveUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import{Integer as d}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as f}from"../core/accessorSupport/PropertyOrigin.js";import v from"../geometry/Extent.js";import g from"../geometry/Polyline.js";import S from"../geometry/SpatialReference.js";import b from"./Layer.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as O,effectProperty as T}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{titleFromUrlAndName as x}from"./support/arcgisLayerUrl.js";import{opacity as U,id as P}from"./support/commonProperties.js";import{normalizeParsedUrlObject as E,urlProperty as N}from"./support/multiLayerServiceUtils.js";import M from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as k}from"./support/serviceCapabilitiesUtils.js";import V from"./support/TelemetryData.js";import F from"./support/TelemetryDisplay.js";import R from"./support/VideoFrame.js";import G from"./support/VideoTimeExtent.js";import J from"./video/VideoController.js";import{getFrameHorizonPoints as A,getGroundControlPoints as H,getTelemetryData as z,getServiceLayersInfo as q,getStyledTelemetrySymbol as D,getSensorTrailPoints as _,readVideoTimeExtent as B}from"./video/videoUtils.js";import W from"../symbols/CIMSymbol.js";import Q from"../symbols/PictureMarkerSymbol.js";import $ from"../symbols/SimpleFillSymbol.js";import Z from"../symbols/SimpleLineSymbol.js";import K from"../symbols/SimpleMarkerSymbol.js";import X from"../symbols/Symbol.js";import{write as Y}from"../symbols/support/jsonUtils.js";function ee(e,t){return{ignoreOrigin:this.originIdOf(t)<f.PORTAL_ITEM}}let te=[];const re=new t([255,127,0]),oe=new t([0,0,0,.05]),ie=new K({angle:0,color:re,size:10,style:"cross"}),se=new $({color:oe,outline:new Z({color:re,width:2})}),le=new Z({color:re,width:1}),ne=new K({angle:0,color:re,outline:{color:[255,255,255],width:1.33},size:10,style:"circle"}),ae=new Z({color:re,width:1}),pe={types:{base:X,key:"type",typeMap:{"simple-marker":K,"picture-marker":Q,cim:W}},json:{name:"drawingInfo.sensorSymbol",write:{writer:Y,overridePolicy:ee}}};function ye(e,t){return{type:t,json:{name:e,write:{overridePolicy:ee}}}}let me=class extends(O(C(j(I(L(n(w(b)))))))){constructor(e){super(e),this.capabilities=null,this.codecs=null,this.connectionInfo=null,this.controller=new J,this.copyright=null,this.created=null,this.customParameters=null,this.description=null,this.elevationSource=null,this.frame=null,this.frameCenterSymbol=ie.clone(),this.frameCount=null,this.frameEffect=null,this.frameOpacity=1,this.frameOutlineSymbol=se.clone(),this.fullExtent=null,this.initialExtent=null,this.layerId=null,this.operationalLayerType="ArcGISVideoLayer",this.playbackInfo=null,this.posterUrl=null,this.qualities=null,this.sensorSymbol=ne.clone(),this.sensorSightLineSymbol=le.clone(),this.sensorTrailSymbol=ae.clone(),this.serviceItemId=null,this.sourceJSON=null,this.sourceQuality=null,this.sourceType=null,this.spatialReference=S.WGS84,this.start=0,this.telemetryDisplay=new F,this.type="video",this.url=null,this.version=null,this.videoLayersInfo=null}initialize(){this.addHandles([p((()=>this.metadata),(()=>{this.notifyChange("telemetry"),this.notifyChange("groundControlPoints"),this.notifyChange("frameHorizonPoints")})),p((()=>this.telemetry?.sensorLocation),(e=>this._setSensorTrail(e)),y)]),m((()=>this.loaded&&"can-play"===this.state&&this.duration>0)).then((()=>{this.start>=0&&this.start<=this.duration&&this.setCurrentTime(this.start)}))}destroy(){this.removeAllHandles(),this.controller&&this.controller.destroy()}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Video Service"],supportsData:!1},e).catch(a).then((()=>this._fetchService(t)));return this.addResolvingPromise(r),Promise.resolve(this)}get autoplay(){return this.controller?.autoplay??!1}set autoplay(e){this.controller.autoplay=e}get buffered(){return this.controller.buffered}readCapabilitiesFromService(e,t){return k(t)}readConnectionInfo(e,t){const r=Object.values(t.connectionUrl);return r?.length&&(this.controller.playerUrl=r[0]),t.connectionUrl}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get frameHorizonPoints(){return A(this.metadata)}get groundControlPoints(){return H(this.metadata)}get isLive(){return this.controller?.isLive??!1}get livestreamStatus(){return this.controller?.livestreamStatus}get loop(){return this.controller.loop}set loop(e){this.controller.loop=e}get metadata(){return this.controller?.currentMetadata}get mimeType(){return this.controller?.mimeType}get muted(){return this.controller.muted}set muted(e){this.controller.muted=e}get parsedUrl(){return E(this)}get playbackRate(){return this.controller.rate}set playbackRate(e){this.controller.rate=e}get playerUrl(){return this.controller.playerUrl}get playing(){return this.controller.playing}get started(){return this.controller?.started??!1}get state(){return this.controller.state}get telemetry(){return z(this.metadata)}readTitleFromService(e,{name:t}){return this.url?x(this.url,t):t}get videoElement(){return this.controller?.element}get videoHeight(){return this.controller?.videoHeight}readLayerInfosFromService(e,t){return q(t)}get videoTimeExtent(){return o(s.getLogger(this),"videoTimeExtent",{replacement:"fullTimeExtent",version:"4.33",warnOnce:!0}),this.fullTimeExtent}get videoWidth(){return this.controller?.videoWidth}get volume(){return this.controller?.volume??0}set volume(e){this.controller.volume=e}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){te=[],this.controller.reset()}setCurrentTime(e){if(this.duration<0)return;const t=l(e,0,this.duration);this.controller.setCurrentTime(t)}toGround(e,t){return this.controller?.sensorModel?.metadataSupportsTransforms?this.controller.sensorModel.transformImageToGeo(e,t):null}toVideo(e){if(!this.controller?.sensorModel?.metadataSupportsTransforms)return null;const t=this.controller.sensorModel.transformGeoToImage(e.x,e.y,e.z);return{x:t[0],y:t[1]}}updateTelemetryColor(e){this.frameCenterSymbol=D(this.frameCenterSymbol,e)??ie,this.frameOutlineSymbol=D(this.frameOutlineSymbol,e,oe)??se,this.sensorSightLineSymbol=D(this.sensorSightLineSymbol,e)??le,this.sensorTrailSymbol=D(this.sensorTrailSymbol,e)??ae,this.sensorSymbol=D(this.sensorSymbol,e)??ne}write(e,t){return null==this.layerId?(t?.messages?.push(new i("layer:unsupported",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' cannot be saved to a web map, web scene, or portal item. The ArcGIS server version must be greater than 11.2.`)),null):super.write(e,t)}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:o}=await r(this.url,{query:{f:"json",...this.parsedUrl.query,...this.customParameters},signal:e});if(o&&(this.url=this.url.replace(/^http:/i,"https:")),!t?.currentVersion)return t.currentVersion="11.2",this.sourceJSON=t,void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});if(this.layerId??=t.layers?.[0]?.id??null,null==this.layerId)throw new i("arcgis-layers:url-mismatch","The url is not a valid arcgis resource");const{data:s}=await r(this.parsedUrl.path,{query:{f:"json",...this.customParameters},signal:e});this.sourceJSON={...t,...s},this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl})}_setSensorTrail(e){if(!e)return;const t=_(e,te);te=[...t];const r=te.map((e=>e.toArray())),o=new g({hasZ:e.hasZ,paths:[r]});this.telemetry.sensorTrail=o.clone()}};e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],me.prototype,"autoplay",null),e([u({readOnly:!0})],me.prototype,"buffered",null),e([u({readOnly:!0})],me.prototype,"cameraInfo",void 0),e([u({readOnly:!0,json:{read:!1}})],me.prototype,"capabilities",void 0),e([c("service","capabilities",["supportsAppend","supportsCoverageQuery","supportsExportClip","supportsExportFrameset","supportsMensuration","supportsPreviews","supportsUpdate"])],me.prototype,"readCapabilitiesFromService",null),e([u({readOnly:!0})],me.prototype,"codecs",void 0),e([u({readOnly:!0})],me.prototype,"connectionInfo",void 0),e([c("connectionInfo",["connectionUrl"])],me.prototype,"readConnectionInfo",null),e([u()],me.prototype,"controller",void 0),e([u({type:String})],me.prototype,"copyright",void 0),e([u({readOnly:!0,type:Date})],me.prototype,"created",void 0),e([u({type:Number})],me.prototype,"currentTime",null),e([u({json:{write:!1}})],me.prototype,"customParameters",void 0),e([u({type:String})],me.prototype,"description",void 0),e([u({type:Number})],me.prototype,"duration",null),e([u({readOnly:!0})],me.prototype,"elevationSource",void 0),e([u({type:Boolean})],me.prototype,"ended",null),e([u({type:R})],me.prototype,"frame",void 0),e([u(ye("drawingInfo.frameCenterSymbol",K))],me.prototype,"frameCenterSymbol",void 0),e([u({readOnly:!0,type:d})],me.prototype,"frameCount",void 0),e([u(T)],me.prototype,"frameEffect",void 0),e([u(U)],me.prototype,"frameOpacity",void 0),e([u(ye("drawingInfo.frameOutlineSymbol",$))],me.prototype,"frameOutlineSymbol",void 0),e([u({type:v})],me.prototype,"fullExtent",void 0),e([u({readOnly:!0})],me.prototype,"frameHorizonPoints",null),e([u({readOnly:!0,json:{read:{reader:B,source:"time"}},type:G})],me.prototype,"fullTimeExtent",void 0),e([u({readOnly:!0})],me.prototype,"groundControlPoints",null),e([u(P)],me.prototype,"id",void 0),e([u({type:v})],me.prototype,"initialExtent",void 0),e([u({readOnly:!0})],me.prototype,"isLive",null),e([u({type:d,json:{read:!1,origins:{service:{read:{source:"id"}}}}})],me.prototype,"layerId",void 0),e([u({readOnly:!0})],me.prototype,"livestreamStatus",null),e([u({type:Boolean})],me.prototype,"loop",null),e([u({readOnly:!0})],me.prototype,"metadata",null),e([u({readOnly:!0})],me.prototype,"mimeType",null),e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],me.prototype,"muted",null),e([u({type:["ArcGISVideoLayer"]})],me.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],me.prototype,"parsedUrl",null),e([u({type:M})],me.prototype,"playbackInfo",void 0),e([u({type:Number})],me.prototype,"playbackRate",null),e([u({readOnly:!0,type:String})],me.prototype,"playerUrl",null),e([u({readOnly:!0})],me.prototype,"playing",null),e([u({readOnly:!0,json:{read:{source:"poster"}}})],me.prototype,"posterUrl",void 0),e([u({readOnly:!0})],me.prototype,"qualities",void 0),e([u(pe)],me.prototype,"sensorSymbol",void 0),e([u(ye("drawingInfo.sensorSightLineSymbol",Z))],me.prototype,"sensorSightLineSymbol",void 0),e([u(ye("drawingInfo.sensorTrailSymbol",Z))],me.prototype,"sensorTrailSymbol",void 0),e([u({readOnly:!0})],me.prototype,"serviceItemId",void 0),e([u()],me.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],me.prototype,"sourceQuality",void 0),e([u({readOnly:!0,json:{name:"serviceType"}})],me.prototype,"sourceType",void 0),e([u()],me.prototype,"spatialReference",void 0),e([u({json:{write:!0}})],me.prototype,"start",void 0),e([u({readOnly:!0})],me.prototype,"started",null),e([u({readOnly:!0,type:String})],me.prototype,"state",null),e([u({readOnly:!0,type:V})],me.prototype,"telemetry",null),e([u({type:F,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],me.prototype,"telemetryDisplay",void 0),e([c("service","title",["name"])],me.prototype,"readTitleFromService",null),e([u({readOnly:!0})],me.prototype,"type",void 0),e([u(N())],me.prototype,"url",void 0),e([u({readOnly:!0,type:Number,json:{read:{source:"currentVersion"}}})],me.prototype,"version",void 0),e([u({readOnly:!0})],me.prototype,"videoElement",null),e([u({readOnly:!0})],me.prototype,"videoHeight",null),e([u({readOnly:!0,json:{read:!1}})],me.prototype,"videoLayersInfo",void 0),e([c("service","videoLayersInfo",["id","name","poster","serviceType","type"])],me.prototype,"readLayerInfosFromService",null),e([u({type:G,readOnly:!0})],me.prototype,"videoTimeExtent",null),e([u({readOnly:!0})],me.prototype,"videoWidth",null),e([u()],me.prototype,"volume",null),e([u({readOnly:!0})],me.prototype,"waiting",null),me=e([h("esri.layers.VideoLayer")],me);const ue=me;export{ue as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Clonable.js";import r from"../../../core/Error.js";import o from"../../../core/JSONSupport.js";import a from"../../../core/Logger.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../../core/accessorSupport/decorators/writer.js";import m from"../../../geometry/Point.js";import{getGeometryZScaler as u}from"../../../geometry/support/zscale.js";import d from"./CameraOrientation.js";import y from"./cameraOrientationFactory.js";import{appendPrefixAndSuffix as f,getEffectiveElevationSource as g,orientedImageryTypeMap as h}from"./utils.js";import{CameraOrientationType as v}from"../enums/CameraOrientationType.js";import{ltpToGeographic as w}from"../transformations/utils.js";function O(e){throw new r("exposure-point:missing-default-value",`a value for ${e} is missing in default properties`)}function j(e,t){throw new r("exposure-point:missing-attribute-value",`a value for ${e} is missing in attribute table`,{exposurePoint:t})}const b=e=>({cast:e=>{const t=parseFloat(e);return Number.isFinite(t)?t:void 0},json:{name:e,write:{writer:(e,t,r)=>{t[r]=Number.isFinite(e)?e:void 0}}}}),S=e=>({cast:e=>"string"==typeof e?e.split(";").map(Number):e,json:{default:e,write:{writer:(e,t,r)=>{t[r]=e?.join(";")}}}});let I=class extends(t.ClonableMixin(o)){constructor(e){super(e),this._geometry=null,this.cameraOrientation=null,this.elevation=null,this.elevationSource=null,this.name=null,this.sourceMap=null}read(e,t){const r={},{attributes:o,geometry:a}=e,i={};for(const s in o)r[s.toLowerCase()]=o[s],i[s.toLowerCase()]=s;const n=e.layer??{};n.sequenceOrderField?.length&&(r.sequenceorder=o[n.sequenceOrderField],i.sequenceorder=n.sequenceOrderField),super.read({geometry:a,layer:n,sourceMap:i,...r},t)}write(e,t){const r=super.write(e,t),{sourceMap:o}=this;if(!o||!r)return r;const a={};for(const i in r){const e=o[i.toLowerCase()];e&&(a[e]=r[i])}return a}readCameraHeading(e,t){const{cameraheading:r,camheading:o,layer:a}=t;return r??o??a.cameraHeading}readCameraHeight(e,t){const{cameraheight:r,avghtag:o,layer:a}=t;return r??o??a.cameraHeight}readCamOffset(e,t){const{cameraoffset:r,camoffset:o}=t;return r?.split(";").map(Number)??o?.split(";").map(Number)??null}writeCameraOffset(e,t){e&&(t.cameraOffset=e.join(";"))}readCameraOrientation(e,t){const{cameraorientation:r,camori:o}=t;return r??o}readCameraPitch(e,t){const{camerapitch:r,campitch:o,layer:a}=t;return r??o??a.cameraPitch}readCameraRoll(e,t){const{cameraroll:r,camroll:o,layer:a}=t;return r??o??a.cameraRoll}readDepthImage(e,t){const{depthimage:r,depthimg:o,layer:a}=t,i=r??o??null,{depthImagePathPrefix:n,depthImagePathSuffix:s}=a??{};return f(i,n,s)}readElevationSource(e,t){const{elevationsource:r,layer:o}=t,{demPathSuffix:a,demPathPrefix:i}=o;if(r){const e=this._parseIfJSON(r);return g(e,i,a)}return o.effectiveElevationSource}readFarDistance(e,t){const{fardistance:r,fardist:o,layer:a}=t;return r??o??a.farDistance}get geometry(){const e=this._geometry.clone();if(!e)return null;const{cameraOffset:t}=this;if(t){const[r,o,a]=t;e.x+=r,e.y+=o,null!=e.z&&null!=a&&(e.z+=a)}return e}set geometry(e){this._geometry=e}readHFOV(e,t){const{horizontalfieldofview:r,hfov:o,layer:a}=t;return r??o??a.horizontalFieldOfView}readImageURL(e,t){const{imagepath:r,layer:o}=t;r||j("imagePath",this);const{imagePathPrefix:a,imagePathSuffix:i}=o;return f(r,a,i)}readImageRotation(e,t){const{imagerotation:r,imgrot:o,layer:a}=t;return r??o??a.imageRotation}get isHorizontal(){return"horizontal"===this.orientedImageryType}get isInspection(){return"inspection"===this.orientedImageryType}get isNadir(){return"nadir"===this.orientedImageryType}get isOblique(){return"oblique"===this.orientedImageryType}get isSpherical(){return"360"===this.orientedImageryType}get location(){const{cameraOrientation:e,cameraHeight:t,elevation:r}=this;if(e){const{type:t,x:r,y:o,z:a,horizontalWKID:i,verticalWKID:n}=e,s="number"==typeof i?{wkid:i}:{wkt:i};if(t===v.LTP){const{latitude:t,longitude:r,ellipsoidRadius:o,squaredEccentricity:a,properties:i}=e,{x:n,y:s,z:p}=i;return new m(w([n,s,p],[t,r,o,a]))}const p=new m({x:r,y:o,z:a,spatialReference:s}),c=n?u("point",{wkid:n},s):null;return c&&c(p),p}if("number"!=typeof t)throw O("cameraHeight");const o=this.geometry.clone();return o.z=o.hasZ?o.z:(r??0)+t,o}set matrix(e){if(!e||9!==e.length)return a.getLogger(this).warn("Ignoring rotation matrix because it doesn't have 9 values",{value:e}),void this._set("matrix",null);this._set("matrix",e)}readNearDistance(e,t){const{neardistance:r,neardist:o,layer:a}=t;return r??o??a.nearDistance}readOffsetFromStart(e,t){return t.offsetfromstart??null}readOrientationAccuracy(e,t){const{accuracy:r,orientationaccuracy:o}=t;return o?.split(";").map(Number)??r?.split(";").map(Number)??null}writeOrientationAccuracy(e,t){e&&(t.orientationAccuracy=e.join(";"))}readOIType(e,t){const{orientedimagerytype:r,oitype:o,camerapitch:a,campitch:i,layer:n}=t,s=h.read(r??o??n.orientedImageryType),p=a??i??n.cameraPitch;return"oblique"===s?p<10?"nadir":"oblique":s}set radial(e){if(e)if("string"!=typeof e)this._set("radial",e);else{const[t,r,o]=e.split(";").map(Number);this._set("radial",[t??0,r??0,o??0])}else this._set("radial",[0,0,0])}readSequenceOrder(e,t){const{layer:r}=t;return t[r.sequenceOrderField.toLowerCase()]}writeSequenceOrder(e,t){if(!e)return;const{sourceMap:r}=this;if(r){t[r.sequenceorder]=e}}set tangential(e){if(e)if("string"!=typeof e)this._set("tangential",e);else{const[t,r]=e.split(";").map(Number);this._set("tangential",[t??0,r??0])}else this._set("tangential",[0,0])}readVFOV(e,t){const{verticalfieldofview:r,vfov:o,layer:a}=t;return r??o??a.verticalFieldOfView}_parseIfJSON(e){let t=null;try{t=JSON.parse(e)}catch(r){a.getLogger(this).error("couldn't parse the given elevation source JSON",e,r)}return t}};e([i()],I.prototype,"_geometry",void 0),e([i(b())],I.prototype,"a0",void 0),e([i(b())],I.prototype,"a1",void 0),e([i(b())],I.prototype,"a2",void 0),e([i({type:Date,json:{write:{enabled:!0,target:"acquisitionDate"},name:"acquisitiondate"}})],I.prototype,"acquisitionDate",void 0),e([i(b())],I.prototype,"b0",void 0),e([i(b())],I.prototype,"b1",void 0),e([i(b())],I.prototype,"b2",void 0),e([i({type:Number,json:{write:!0,read:{source:["cameraheading","camheading","layer.cameraHeading"]}}})],I.prototype,"cameraHeading",void 0),e([p("cameraHeading")],I.prototype,"readCameraHeading",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraHeight",void 0),e([p("cameraHeight",["cameraheight","avghtag","layer.cameraHeight"])],I.prototype,"readCameraHeight",null),e([i()],I.prototype,"cameraOffset",void 0),e([p("cameraOffset",["cameraoffset","camoffset"])],I.prototype,"readCamOffset",null),e([l("cameraOffset")],I.prototype,"writeCameraOffset",null),e([i({json:{write:{writer:(e,t,r)=>{t[r]=e.toString()}}},type:d}),n((e=>e?y.getCameraOrientation(e):null))],I.prototype,"cameraOrientation",void 0),e([p("cameraOrientation",["cameraorientation","camori"])],I.prototype,"readCameraOrientation",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraPitch",void 0),e([p("cameraPitch",["camerapitch","campitch","layer.cameraPitch"])],I.prototype,"readCameraPitch",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraRoll",void 0),e([p("cameraRoll",["cameraroll","camroll","layer.cameraRoll"])],I.prototype,"readCameraRoll",null),e([i({json:{write:!0},type:String})],I.prototype,"depthImage",void 0),e([p("depthImage",["depthimage","depthimg"])],I.prototype,"readDepthImage",null),e([i({type:Number,json:{write:!0}})],I.prototype,"elevation",void 0),e([i({json:{write:!0},clonable:"reference"})],I.prototype,"elevationSource",void 0),e([p("elevationSource",["elevationsource","layer.effectiveElevationSource"])],I.prototype,"readElevationSource",null),e([i({json:{name:"exposurestationid",write:{target:"exposureStationId"}},type:String})],I.prototype,"exposureStationId",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"farDistance",void 0),e([p("farDistance",["fardistance","fardist","layer.farDistance"])],I.prototype,"readFarDistance",null),e([i(b("focallength"))],I.prototype,"focalLength",void 0),e([i({type:m,json:{name:"geometry"}})],I.prototype,"geometry",null),e([i({type:Number,json:{write:!0}})],I.prototype,"horizontalFieldOfView",void 0),e([p("horizontalFieldOfView",["horizontalfieldofview","hfov","layer.horizontalFieldOfView"])],I.prototype,"readHFOV",null),e([i({json:{write:!0},type:String})],I.prototype,"imagePath",void 0),e([p("imagePath",["imagepath"])],I.prototype,"readImageURL",null),e([i({type:Number,json:{write:!0}})],I.prototype,"imageRotation",void 0),e([p("imageRotation",["imagerotation","imgrot","layer.imageRotation"])],I.prototype,"readImageRotation",null),e([i()],I.prototype,"isHorizontal",null),e([i()],I.prototype,"isInspection",null),e([i()],I.prototype,"isNadir",null),e([i()],I.prototype,"isOblique",null),e([i()],I.prototype,"isSpherical",null),e([i()],I.prototype,"location",null),e([i(S())],I.prototype,"matrix",null),e([i({json:{write:!0},type:String})],I.prototype,"name",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"nearDistance",void 0),e([p("nearDistance",["neardistance","neardist","layer.nearDistance"])],I.prototype,"readNearDistance",null),e([i({json:{write:!0,name:"objectid"},type:Number})],I.prototype,"objectId",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"offsetFromStart",void 0),e([p("offsetFromStart",["offsetfromstart"])],I.prototype,"readOffsetFromStart",null),e([i()],I.prototype,"orientationAccuracy",void 0),e([p("orientationAccuracy",["accuracy","orientationaccuracy"])],I.prototype,"readOrientationAccuracy",null),e([l("orientationAccuracy")],I.prototype,"writeOrientationAccuracy",null),e([s(h)],I.prototype,"orientedImageryType",void 0),e([p("orientedImageryType",["orientedimagerytype","oitype","layer.orientedImageryType"])],I.prototype,"readOIType",null),e([i({type:Number,json:{write:!0,read:{source:"principalx"}}})],I.prototype,"principalX",void 0),e([i({type:Number,json:{write:!0,read:{source:"principaly"}}})],I.prototype,"principalY",void 0),e([i(S([0,0,0]))],I.prototype,"radial",null),e([i({type:String})],I.prototype,"sequenceOrder",void 0),e([p("sequenceOrder",["sequenceorder","layer.sequenceOrderField"])],I.prototype,"readSequenceOrder",null),e([l("sequenceOrder")],I.prototype,"writeSequenceOrder",null),e([i({type:Object})],I.prototype,"sourceMap",void 0),e([i(S([0,0]))],I.prototype,"tangential",null),e([i({type:Number,json:{write:!0}})],I.prototype,"verticalFieldOfView",void 0),e([p("verticalFieldOfView",["verticalfieldofview","vfov","layer.verticalFieldOfView"])],I.prototype,"readVFOV",null),I=e([c("esri.layers.orientedImagery.core.ExposurePoint")],I);export{I as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Clonable.js";import r from"../../../core/Error.js";import o from"../../../core/JSONSupport.js";import a from"../../../core/Logger.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../../core/accessorSupport/decorators/writer.js";import m from"../../../geometry/Point.js";import{getGeometryZScaler as u}from"../../../geometry/support/zscale.js";import y from"./CameraOrientation.js";import d from"./cameraOrientationFactory.js";import{appendPrefixAndSuffix as f,getEffectiveElevationSource as g,getMetersPerUnitOfSR as h,orientedImageryTypeMap as v}from"./utils.js";import{CameraOrientationType as w}from"../enums/CameraOrientationType.js";import{ltpToGeographic as O}from"../transformations/utils.js";function j(e){throw new r("exposure-point:missing-default-value",`a value for ${e} is missing in default properties`)}function b(e,t){throw new r("exposure-point:missing-attribute-value",`a value for ${e} is missing in attribute table`,{exposurePoint:t})}const S=e=>({cast:e=>{const t=parseFloat(e);return Number.isFinite(t)?t:void 0},json:{name:e,write:{writer:(e,t,r)=>{t[r]=Number.isFinite(e)?e:void 0}}}}),N=e=>({cast:e=>"string"==typeof e?e.split(";").map(Number):e,json:{default:e,write:{writer:(e,t,r)=>{t[r]=e?.join(";")}}}});let I=class extends(t.ClonableMixin(o)){constructor(e){super(e),this._geometry=null,this.cameraOrientation=null,this.elevation=null,this.elevationSource=null,this.name=null,this.sourceMap=null}read(e,t){const r={},{attributes:o,geometry:a}=e,i={};for(const s in o)r[s.toLowerCase()]=o[s],i[s.toLowerCase()]=s;const n=e.layer??{};n.sequenceOrderField?.length&&(r.sequenceorder=o[n.sequenceOrderField],i.sequenceorder=n.sequenceOrderField),super.read({geometry:a,layer:n,sourceMap:i,...r},t)}write(e,t){const r=super.write(e,t),{sourceMap:o}=this;if(!o||!r)return r;const a={};for(const i in r){const e=o[i.toLowerCase()];e&&(a[e]=r[i])}return a}readCameraHeading(e,t){const{cameraheading:r,camheading:o,layer:a}=t;return r??o??a.cameraHeading}readCameraHeight(e,t){const{cameraheight:r,avghtag:o,layer:a}=t;return r??o??a.cameraHeight}readCamOffset(e,t){const{cameraoffset:r,camoffset:o}=t;return r?.split(";").map(Number)??o?.split(";").map(Number)??null}writeCameraOffset(e,t){e&&(t.cameraOffset=e.join(";"))}readCameraOrientation(e,t){const{cameraorientation:r,camori:o}=t;return r??o}readCameraPitch(e,t){const{camerapitch:r,campitch:o,layer:a}=t;return r??o??a.cameraPitch}readCameraRoll(e,t){const{cameraroll:r,camroll:o,layer:a}=t;return r??o??a.cameraRoll}readDepthImage(e,t){const{depthimage:r,depthimg:o,layer:a}=t,i=r??o??null,{depthImagePathPrefix:n,depthImagePathSuffix:s}=a??{};return f(i,n,s)}readElevationSource(e,t){const{elevationsource:r,layer:o}=t,{demPathSuffix:a,demPathPrefix:i}=o;if(r){const e=this._parseIfJSON(r);return g(e,i,a)}return o.effectiveElevationSource}readFarDistance(e,t){const{fardistance:r,fardist:o,layer:a}=t;return r??o??a.farDistance}get geometry(){const e=this._geometry.clone();if(!e)return null;const{cameraOffset:t}=this;if(t){const[r,o,a]=t;e.x+=r,e.y+=o,null!=e.z&&null!=a&&(e.z+=a)}return e}set geometry(e){this._geometry=e}writeGeometry(e,t){t.geometry=this._geometry.toJSON()}readHFOV(e,t){const{horizontalfieldofview:r,hfov:o,layer:a}=t;return r??o??a.horizontalFieldOfView}readImageURL(e,t){const{imagepath:r,layer:o}=t;r||b("imagePath",this);const{imagePathPrefix:a,imagePathSuffix:i}=o;return f(r,a,i)}readImageRotation(e,t){const{imagerotation:r,imgrot:o,layer:a}=t;return r??o??a.imageRotation}get isHorizontal(){return"horizontal"===this.orientedImageryType}get isInspection(){return"inspection"===this.orientedImageryType}get isNadir(){return"nadir"===this.orientedImageryType}get isOblique(){return"oblique"===this.orientedImageryType}get isSpherical(){return"360"===this.orientedImageryType}get location(){const{cameraOrientation:e,cameraHeight:t,elevation:r}=this;if(e){const{type:t,x:r,y:o,z:a,horizontalWKID:i,verticalWKID:n}=e,s="number"==typeof i?{wkid:i}:{wkt:i};if(t===w.LTP){const{latitude:t,longitude:r,ellipsoidRadius:o,squaredEccentricity:a,properties:i}=e,{x:n,y:s,z:p}=i;return new m(O([n,s,p],[t,r,o,a]))}const p=new m({x:r,y:o,z:a,spatialReference:s}),c=n?u("point",{wkid:n},s):null;return c&&c(p),p}if("number"!=typeof t)throw j("cameraHeight");const o=this.geometry.clone();return o.z=o.hasZ?o.z:(r??0)+t/h(o.spatialReference),o}set matrix(e){if(!e||9!==e.length)return a.getLogger(this).warn("Ignoring rotation matrix because it doesn't have 9 values",{value:e}),void this._set("matrix",null);this._set("matrix",e)}readNearDistance(e,t){const{neardistance:r,neardist:o,layer:a}=t;return r??o??a.nearDistance}readOffsetFromStart(e,t){return t.offsetfromstart??null}readOrientationAccuracy(e,t){const{accuracy:r,orientationaccuracy:o}=t;return o?.split(";").map(Number)??r?.split(";").map(Number)??null}writeOrientationAccuracy(e,t){e&&(t.orientationAccuracy=e.join(";"))}readOIType(e,t){const{orientedimagerytype:r,oitype:o,camerapitch:a,campitch:i,layer:n}=t,s=v.read(r??o??n.orientedImageryType),p=a??i??n.cameraPitch;return"oblique"===s?p<10?"nadir":"oblique":s}set radial(e){if(e)if("string"!=typeof e)this._set("radial",e);else{const[t,r,o]=e.split(";").map(Number);this._set("radial",[t??0,r??0,o??0])}else this._set("radial",[0,0,0])}readSequenceOrder(e,t){const{layer:r}=t;return t[r.sequenceOrderField.toLowerCase()]}writeSequenceOrder(e,t){if(!e)return;const{sourceMap:r}=this;if(r){t[r.sequenceorder]=e}}set tangential(e){if(e)if("string"!=typeof e)this._set("tangential",e);else{const[t,r]=e.split(";").map(Number);this._set("tangential",[t??0,r??0])}else this._set("tangential",[0,0])}readVFOV(e,t){const{verticalfieldofview:r,vfov:o,layer:a}=t;return r??o??a.verticalFieldOfView}_parseIfJSON(e){let t=null;try{t=JSON.parse(e)}catch(r){a.getLogger(this).error("couldn't parse the given elevation source JSON",e,r)}return t}clone(){const e=super.clone();return e._geometry=this._geometry.clone(),e}};e([i()],I.prototype,"_geometry",void 0),e([i(S())],I.prototype,"a0",void 0),e([i(S())],I.prototype,"a1",void 0),e([i(S())],I.prototype,"a2",void 0),e([i({type:Date,json:{write:{enabled:!0,target:"acquisitionDate"},name:"acquisitiondate"}})],I.prototype,"acquisitionDate",void 0),e([i(S())],I.prototype,"b0",void 0),e([i(S())],I.prototype,"b1",void 0),e([i(S())],I.prototype,"b2",void 0),e([i({type:Number,json:{write:!0,read:{source:["cameraheading","camheading","layer.cameraHeading"]}}})],I.prototype,"cameraHeading",void 0),e([p("cameraHeading")],I.prototype,"readCameraHeading",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraHeight",void 0),e([p("cameraHeight",["cameraheight","avghtag","layer.cameraHeight"])],I.prototype,"readCameraHeight",null),e([i()],I.prototype,"cameraOffset",void 0),e([p("cameraOffset",["cameraoffset","camoffset"])],I.prototype,"readCamOffset",null),e([l("cameraOffset")],I.prototype,"writeCameraOffset",null),e([i({json:{write:{writer:(e,t,r)=>{t[r]=e.toString()}}},type:y}),n((e=>e?d.getCameraOrientation(e):null))],I.prototype,"cameraOrientation",void 0),e([p("cameraOrientation",["cameraorientation","camori"])],I.prototype,"readCameraOrientation",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraPitch",void 0),e([p("cameraPitch",["camerapitch","campitch","layer.cameraPitch"])],I.prototype,"readCameraPitch",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraRoll",void 0),e([p("cameraRoll",["cameraroll","camroll","layer.cameraRoll"])],I.prototype,"readCameraRoll",null),e([i({json:{write:!0},type:String})],I.prototype,"depthImage",void 0),e([p("depthImage",["depthimage","depthimg"])],I.prototype,"readDepthImage",null),e([i({type:Number,json:{write:!0}})],I.prototype,"elevation",void 0),e([i({json:{write:!0},clonable:"reference"})],I.prototype,"elevationSource",void 0),e([p("elevationSource",["elevationsource","layer.effectiveElevationSource"])],I.prototype,"readElevationSource",null),e([i({json:{name:"exposurestationid",write:{target:"exposureStationId"}},type:String})],I.prototype,"exposureStationId",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"farDistance",void 0),e([p("farDistance",["fardistance","fardist","layer.farDistance"])],I.prototype,"readFarDistance",null),e([i(S("focallength"))],I.prototype,"focalLength",void 0),e([i({type:m,json:{name:"geometry"}})],I.prototype,"geometry",null),e([l("geometry")],I.prototype,"writeGeometry",null),e([i({type:Number,json:{write:!0}})],I.prototype,"horizontalFieldOfView",void 0),e([p("horizontalFieldOfView",["horizontalfieldofview","hfov","layer.horizontalFieldOfView"])],I.prototype,"readHFOV",null),e([i({json:{write:!0},type:String})],I.prototype,"imagePath",void 0),e([p("imagePath",["imagepath"])],I.prototype,"readImageURL",null),e([i({type:Number,json:{write:!0}})],I.prototype,"imageRotation",void 0),e([p("imageRotation",["imagerotation","imgrot","layer.imageRotation"])],I.prototype,"readImageRotation",null),e([i()],I.prototype,"isHorizontal",null),e([i()],I.prototype,"isInspection",null),e([i()],I.prototype,"isNadir",null),e([i()],I.prototype,"isOblique",null),e([i()],I.prototype,"isSpherical",null),e([i()],I.prototype,"location",null),e([i(N())],I.prototype,"matrix",null),e([i({json:{write:!0},type:String})],I.prototype,"name",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"nearDistance",void 0),e([p("nearDistance",["neardistance","neardist","layer.nearDistance"])],I.prototype,"readNearDistance",null),e([i({json:{write:!0,name:"objectid"},type:Number})],I.prototype,"objectId",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"offsetFromStart",void 0),e([p("offsetFromStart",["offsetfromstart"])],I.prototype,"readOffsetFromStart",null),e([i()],I.prototype,"orientationAccuracy",void 0),e([p("orientationAccuracy",["accuracy","orientationaccuracy"])],I.prototype,"readOrientationAccuracy",null),e([l("orientationAccuracy")],I.prototype,"writeOrientationAccuracy",null),e([s(v)],I.prototype,"orientedImageryType",void 0),e([p("orientedImageryType",["orientedimagerytype","oitype","layer.orientedImageryType"])],I.prototype,"readOIType",null),e([i({type:Number,json:{write:!0,read:{source:"principalx"}}})],I.prototype,"principalX",void 0),e([i({type:Number,json:{write:!0,read:{source:"principaly"}}})],I.prototype,"principalY",void 0),e([i(N([0,0,0]))],I.prototype,"radial",null),e([i({type:String})],I.prototype,"sequenceOrder",void 0),e([p("sequenceOrder",["sequenceorder","layer.sequenceOrderField"])],I.prototype,"readSequenceOrder",null),e([l("sequenceOrder")],I.prototype,"writeSequenceOrder",null),e([i({type:Object})],I.prototype,"sourceMap",void 0),e([i(N([0,0]))],I.prototype,"tangential",null),e([i({type:Number,json:{write:!0}})],I.prototype,"verticalFieldOfView",void 0),e([p("verticalFieldOfView",["verticalfieldofview","vfov","layer.verticalFieldOfView"])],I.prototype,"readVFOV",null),I=e([c("esri.layers.orientedImagery.core.ExposurePoint")],I);export{I 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{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as n}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{a,f as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import c from"../../../geometry/Mesh.js";import s from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectWithZConversion as l}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{earth as u}from"../../../geometry/support/Ellipsoid.js";import h from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as p}from"../../../geometry/support/MeshVertexAttributes.js";import{create as y,fromArray as g,intersectRay as x}from"../../../geometry/support/plane.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as w,createRotationMatrixFromHPR as M,transformMat3 as R,scaleAndAddWithFactor as j,scaleWithFactor as v,computeHFOVAndVFOV as P,projectiveTransform as D}from"../transformations/utils.js";const b=Math.PI/180;function A(e){return e.isSpherical?H(e):I(e)}function I(e){const{horizontalFieldOfView:t,verticalFieldOfView:r,geometry:n,cameraHeading:a}=e,o=w(n.y,n.spatialReference);let i=e.cameraPitch,c=e.cameraRoll??0,s=150;t>150&&(i=90,c=0,s=5);const l=Math.ceil(t/s),m=z(l,a,t);let u=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*b);e.cameraPitch+r/2>=90&&(u=(e.farDistance||20)*o);const h=new f({spatialReference:n?.spatialReference});h.imageID=e.objectId;let p=null;for(const f of m)p=V(f,i,e.cameraHeight,n,u,o,r,t,l,h,c,e.nearDistance);return p.imageID=e.objectId,{polygon:h,frustum:p}}function z(e,t,r){const n=[];if(e%2==0)for(let a=0;a<e/2;a++)n.push(t-r/e*(a+.5),t+r/e*(a+.5));else{n.push(t);for(let a=1;a<e/2;a++)n.push(t-r/e*a,t+r/e*a)}return n.sort(),n}function V(e,i,c,s,f,l,m,u,h,p,y=0,g=0){const x=n(t(),M([e,i,y??0])),d=q({cameraHeight:c,cameraPitch:i,farDistance:f,location:s,horizontalFieldOfView:u,nearDistance:g,verticalFieldOfView:m},x),w=R([0,0,-1],x),{x:P,y:D}=s,A=j([P,D,c],w,f,l),I=2*Math.tan(m*b/2)*f,z=2*Math.tan(u/h*b/2)*f,V=R([0,1,0],x),H=R([1,0,0],x),O=v(V,I/2,l),S=v(H,z/2,l),C=a(r(),O,S),U=o(r(),O,S),E=F([o(r(),A,C),o(r(),A,U),a(r(),A,C),a(r(),A,U)],c,s,l);return E.push(E[0]),p.addRing(E),d}function F(e,t,r,n){return e.map((e=>C(e,t,r,n)))}function H(e){const{geometry:t,farDistance:r,objectId:n,nearDistance:a,cameraHeight:o}=e,s=w(t.y,t.spatialReference),f=new i({center:t.clone(),radius:r*s});if(f.imageID=n,a){const e=new i({center:t.clone(),radius:a*s});f.addRing(e.rings[0])}const l=t.clone();l.z=o-r*s;const m=c.createSphere(l,{size:2*r*s});return m.imageID=n,{polygon:f,frustum:m}}function O(e,t){return e.contains(t)}function S(e,t){return Math.sign(e)!==Math.sign(t)}function q(e,t,n){const{cameraHeight:i,cameraPitch:s,farDistance:f,location:l,horizontalFieldOfView:m,nearDistance:u,verticalFieldOfView:h}=e,y=E(l),g=s+h/2>=90==!1,x=2*Math.tan(h*b/2)*u,d=2*Math.tan(m*b/2)*u,w=2*Math.tan(h*b/2)*f,M=2*Math.tan(m*b/2)*f;let P,D;D=[0,0,-1],D=R(D,t),P=j([l.x,l.y,i],D,f,y),g&&(P[2]=0);const A=j([l.x,l.y,i],D,u,y);let I=[0,1,0];I=R(I,t);let z=[1,0,0];z=R(z,t);let V=[],F=[];u?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(o(r(),A,a(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(o(r(),A,o(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(a(r(),A,a(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(a(r(),A,o(r(),v(I,x/2,y),v(z,d/2,y))))):(V=[l.x,l.y,i],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(o(r(),P,a(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(o(r(),P,o(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(a(r(),P,a(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(a(r(),P,o(r(),v(I,w/2,y),v(z,M/2,y))));const H=new p({position:Float64Array.from(V)});return new c({vertexAttributes:H,components:F,spatialReference:l.spatialReference})}function C(e,t,n,o){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/o)**2)*o,c=v(a(r(),[e[0],e[1],e[2]],[n.x,n.y,t]),1/i,1/o),s=t/(t-e[2]),f={x:(1-s)*n.x+s*e[0],y:(1-s)*n.y+s*e[1],z:(1-s)*t+s*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/o)**2)*o,m=v(a(r(),[f.x,f.y,f.z],[n.x,n.y,t]),1/l,1/o);return S(c[0],m[0])&&S(c[1],m[1])&&S(c[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function U(e){const{spatialReference:t,x:r,y:n}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:c}=e,s=E(e.geometry),l=new f({spatialReference:t}),m=Math.abs(1.44*i*s);let u=Math.abs(1.44*c*s);(o<20||null==a)&&(u=m);const h=[];return h[0]={x:r+m*Math.sin((a-45)*b),y:n+m*Math.cos((a-45)*b)},h[1]={x:r+m*Math.sin((a+45)*b),y:n+m*Math.cos((a+45)*b)},h[2]={x:r+u*Math.sin((a+135)*b),y:n+u*Math.cos((a+135)*b)},h[3]={x:r+u*Math.sin((a+225)*b),y:n+u*Math.cos((a+225)*b)},l.addRing([[h[0].x,h[0].y,0],[h[1].x,h[1].y,0],[h[2].x,h[2].y,0],[h[3].x,h[3].y,0],[h[0].x,h[0].y,0]]),l}function E(e){return e&&d(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/u.radius))):1}function k(e,t){const n=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:r}=e,a=new i({radius:t*n,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if("esri.geometry.Polygon"===e.declaredClass){const t=new f({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let t=0;t<e.rings[0].length;t++){const c=Math.sqrt((o.x-e.rings[0][t][0])**2+(o.y-e.rings[0][t][1])**2),s=v(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[o.x,o.y,0]),1/c,1),f=j([o.x,o.y,0],s,c*n,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function L(e,t,r){const{cameraHeight:n,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:c,imageHeight:s,imageWidth:f,inSRS:l,outSRS:u,verticalFieldOfView:h,cameraRoll:p,options:y}=r,g=new m(l),x=new m(u),d=P(c,h,p??0),w=i.length>15;return o+d.vfov/2>=90?await K(i,e,f,s,g,x,w,y):await W(i,e,t,a,n,w,g,x,y)}async function W(e,t,r,n,a,o,i,s,f){const l=B(e,t,r,n,a);if(!l)return;const{farPlane:m,nearPlane:u}=l,h=await N([...u?.vertexPositions??e.slice(0,3),...m.vertexPositions],i,s,f),y=Z(h);return new c({vertexAttributes:new p({position:h}),components:Y(o?T(y,!0):X(y,!0)),spatialReference:s})}function B(e,t,r,n,a){const o=Q(e),i=Q(e,"near");if(!o)return;const c=t.length;for(let s=0;s<c;s++){const e=Array.from(r[s]),t=[e[0]-n[0],e[1]-n[1],e[2]-(n[2]??a)];J(n,t,s,i),G(n,t,s,o)}return{farPlane:o,nearPlane:i}}function G(e,t,n,a){const{coefficients:o,vertexPositions:i}=a,c=r();x(o,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function J(e,t,n,a){if(!a)return;const o=r();x(a.coefficients,{origin:e,direction:t},o)&&a.vertexPositions.splice(3*n,3,...o)}async function K(e,t,r,n,a,o,i,s){let f,l=i?new Array:[e[0],e[1],e[2]],m=new Array;for(const c of t)i?(f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),l=l.concat(...f),f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),m=m.concat(...f)):(f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),l=l.concat(...f));l=l.concat(m);const u=await N(l,a,o,s),h=Z(u);return new c({vertexAttributes:new p({position:u}),components:Y(i?T(h,!0):X(h,!0)),spatialReference:o})}async function N(t,r,n,a){if(r.equals(n))return t;const o=t.reduce(((e,t,r)=>{const n=Math.floor(r/3);return e[n]||(e[n]=new Array),e[n].push(t),e}),new Array),{points:i}=await l(new s(o,r),n,a);return e(a),i.flat()}function Q(e,t="far"){const r=y();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),g(r,n,!1))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!g(r,n,!1))return;return{coefficients:r,vertexPositions:n}}}const T=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw new Error("Invalid number of vertices");const r=[],n=e/2,a=Math.round((t?e-2:e)/2);for(let o=0;o<a;o++){const a=o+n,i=t?a+1:a,c=i%e,s=(t?a:i+1)%e;r.push({faces:new Uint32Array([o,s,c,o,o+1,c])})}return r};function X(e,t=!1){if(e<3||t&&e-1<3)throw new Error("Invalid number of vertices");const r=[],n=t?e-2:e-1;for(let a=0;a<n;a++)r.push({faces:new Uint32Array([0,a+1,a+2])});return r}const Y=e=>e.map((e=>new h(e))),Z=e=>e.length/3;export{O as checkIfPolygonContainsSelectedPoint,U as computePolygonForInspection,A as createCoveragePolygon,F as limitZToGround,N as projectVertices,k as resizePolygon,L as updateFrustum};
5
+ import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as n}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{a,f as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import c from"../../../geometry/Mesh.js";import s from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectWithZConversion as l}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{earth as u}from"../../../geometry/support/Ellipsoid.js";import h from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as p}from"../../../geometry/support/MeshVertexAttributes.js";import{create as y,fromArray as g,intersectRay as x}from"../../../geometry/support/plane.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{convertToSRUnits as w,getWebMercatorScalingFactor as M,createRotationMatrixFromHPR as R,transformMat3 as j,scaleAndAddWithFactor as v,scaleWithFactor as P,computeHFOVAndVFOV as D,projectiveTransform as b}from"../transformations/utils.js";const A=Math.PI/180;function I(e){const t=w(e,e.geometry.spatialReference);return e.isSpherical?O(t):z(t)}function z(e){const{horizontalFieldOfView:t,verticalFieldOfView:r,geometry:n,cameraHeading:a}=e,o=M(n.y,n.spatialReference);let i=e.cameraPitch,c=e.cameraRoll??0,s=150;t>150&&(i=90,c=0,s=5);const l=Math.ceil(t/s),m=V(l,a,t);let u=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*A);e.cameraPitch+r/2>=90&&(u=(e.farDistance||20)*o);const h=new f({spatialReference:n?.spatialReference});h.imageID=e.objectId;let p=null;for(const f of m)p=F(f,i,e.cameraHeight,n,u,o,r,t,l,h,c,e.nearDistance);return p.imageID=e.objectId,{polygon:h,frustum:p}}function V(e,t,r){const n=[];if(e%2==0)for(let a=0;a<e/2;a++)n.push(t-r/e*(a+.5),t+r/e*(a+.5));else{n.push(t);for(let a=1;a<e/2;a++)n.push(t-r/e*a,t+r/e*a)}return n.sort(),n}function F(e,i,c,s,f,l,m,u,h,p,y=0,g=0){const x=n(t(),R([e,i,y??0])),d=C({cameraHeight:c,cameraPitch:i,farDistance:f,location:s,horizontalFieldOfView:u,nearDistance:g,verticalFieldOfView:m},x),w=j([0,0,-1],x),{x:M,y:D}=s,b=v([M,D,c],w,f,l),I=2*Math.tan(m*A/2)*f,z=2*Math.tan(u/h*A/2)*f,V=j([0,1,0],x),F=j([1,0,0],x),O=P(V,I/2,l),S=P(F,z/2,l),q=a(r(),O,S),U=o(r(),O,S),E=H([o(r(),b,q),o(r(),b,U),a(r(),b,q),a(r(),b,U)],c,s,l);return E.push(E[0]),p.addRing(E),d}function H(e,t,r,n){return e.map((e=>U(e,t,r,n)))}function O(e){const{geometry:t,farDistance:r,objectId:n,nearDistance:a,cameraHeight:o}=e,s=M(t.y,t.spatialReference),f=new i({center:t.clone(),radius:r*s});if(f.imageID=n,a){const e=new i({center:t.clone(),radius:a*s});f.addRing(e.rings[0])}const l=t.clone();l.z=o-r*s;const m=c.createSphere(l,{size:2*r*s});return m.imageID=n,{polygon:f,frustum:m}}function S(e,t){return e.contains(t)}function q(e,t){return Math.sign(e)!==Math.sign(t)}function C(e,t,n){const{cameraHeight:i,cameraPitch:s,farDistance:f,location:l,horizontalFieldOfView:m,nearDistance:u,verticalFieldOfView:h}=e,y=k(l),g=s+h/2>=90==!1,x=2*Math.tan(h*A/2)*u,d=2*Math.tan(m*A/2)*u,w=2*Math.tan(h*A/2)*f,M=2*Math.tan(m*A/2)*f;let R,D;D=[0,0,-1],D=j(D,t),R=v([l.x,l.y,i],D,f,y),g&&(R[2]=0);const b=v([l.x,l.y,i],D,u,y);let I=[0,1,0];I=j(I,t);let z=[1,0,0];z=j(z,t);let V=[],F=[];u?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(o(r(),b,a(r(),P(I,x/2,y),P(z,d/2,y)))),V=V.concat(o(r(),b,o(r(),P(I,x/2,y),P(z,d/2,y)))),V=V.concat(a(r(),b,a(r(),P(I,x/2,y),P(z,d/2,y)))),V=V.concat(a(r(),b,o(r(),P(I,x/2,y),P(z,d/2,y))))):(V=[l.x,l.y,i],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(o(r(),R,a(r(),P(I,w/2,y),P(z,M/2,y)))),V=V.concat(o(r(),R,o(r(),P(I,w/2,y),P(z,M/2,y)))),V=V.concat(a(r(),R,a(r(),P(I,w/2,y),P(z,M/2,y)))),V=V.concat(a(r(),R,o(r(),P(I,w/2,y),P(z,M/2,y))));const H=new p({position:Float64Array.from(V)});return new c({vertexAttributes:H,components:F,spatialReference:l.spatialReference})}function U(e,t,n,o){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/o)**2)*o,c=P(a(r(),[e[0],e[1],e[2]],[n.x,n.y,t]),1/i,1/o),s=t/(t-e[2]),f={x:(1-s)*n.x+s*e[0],y:(1-s)*n.y+s*e[1],z:(1-s)*t+s*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/o)**2)*o,m=P(a(r(),[f.x,f.y,f.z],[n.x,n.y,t]),1/l,1/o);return q(c[0],m[0])&&q(c[1],m[1])&&q(c[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function E(e){const{spatialReference:t,x:r,y:n}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:c}=e,s=k(e.geometry),l=new f({spatialReference:t}),m=Math.abs(1.44*i*s);let u=Math.abs(1.44*c*s);(o<20||null==a)&&(u=m);const h=[];return h[0]={x:r+m*Math.sin((a-45)*A),y:n+m*Math.cos((a-45)*A)},h[1]={x:r+m*Math.sin((a+45)*A),y:n+m*Math.cos((a+45)*A)},h[2]={x:r+u*Math.sin((a+135)*A),y:n+u*Math.cos((a+135)*A)},h[3]={x:r+u*Math.sin((a+225)*A),y:n+u*Math.cos((a+225)*A)},l.addRing([[h[0].x,h[0].y,0],[h[1].x,h[1].y,0],[h[2].x,h[2].y,0],[h[3].x,h[3].y,0],[h[0].x,h[0].y,0]]),l}function k(e){return e&&d(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/u.radius))):1}function L(e,t){const n=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:r}=e,a=new i({radius:t*n,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if("esri.geometry.Polygon"===e.declaredClass){const t=new f({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let t=0;t<e.rings[0].length;t++){const c=Math.sqrt((o.x-e.rings[0][t][0])**2+(o.y-e.rings[0][t][1])**2),s=P(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[o.x,o.y,0]),1/c,1),f=v([o.x,o.y,0],s,c*n,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function W(e,t,r){const{cameraHeight:n,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:c,imageHeight:s,imageWidth:f,inSRS:l,outSRS:u,verticalFieldOfView:h,cameraRoll:p,options:y}=r,g=new m(l),x=new m(u),d=D(c,h,p??0),w=i.length>15;return o+d.vfov/2>=90?await N(i,e,f,s,g,x,w,y):await B(i,e,t,a,n,w,g,x,y)}async function B(e,t,r,n,a,o,i,s,f){const l=G(e,t,r,n,a);if(!l)return;const{farPlane:m,nearPlane:u}=l,h=await Q([...u?.vertexPositions??e.slice(0,3),...m.vertexPositions],i,s,f),y=$(h);return new c({vertexAttributes:new p({position:h}),components:Z(o?X(y,!0):Y(y,!0)),spatialReference:s})}function G(e,t,r,n,a){const o=T(e),i=T(e,"near");if(!o)return;const c=t.length;for(let s=0;s<c;s++){const e=Array.from(r[s]),t=[e[0]-n[0],e[1]-n[1],e[2]-(n[2]??a)];K(n,t,s,i),J(n,t,s,o)}return{farPlane:o,nearPlane:i}}function J(e,t,n,a){const{coefficients:o,vertexPositions:i}=a,c=r();x(o,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function K(e,t,n,a){if(!a)return;const o=r();x(a.coefficients,{origin:e,direction:t},o)&&a.vertexPositions.splice(3*n,3,...o)}async function N(e,t,r,n,a,o,i,s){let f,l=i?new Array:[e[0],e[1],e[2]],m=new Array;for(const c of t)i?(f=b([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),l=l.concat(...f),f=b([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),m=m.concat(...f)):(f=b([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),l=l.concat(...f));l=l.concat(m);const u=await Q(l,a,o,s),h=$(u);return new c({vertexAttributes:new p({position:u}),components:Z(i?X(h,!0):Y(h,!0)),spatialReference:o})}async function Q(t,r,n,a){if(r.equals(n))return t;const o=t.reduce(((e,t,r)=>{const n=Math.floor(r/3);return e[n]||(e[n]=new Array),e[n].push(t),e}),new Array),{points:i}=await l(new s(o,r),n,a);return e(a),i.flat()}function T(e,t="far"){const r=y();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),g(r,n,!1))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!g(r,n,!1))return;return{coefficients:r,vertexPositions:n}}}const X=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw new Error("Invalid number of vertices");const r=[],n=e/2,a=Math.round((t?e-2:e)/2);for(let o=0;o<a;o++){const a=o+n,i=t?a+1:a,c=i%e,s=(t?a:i+1)%e;r.push({faces:new Uint32Array([o,s,c,o,o+1,c])})}return r};function Y(e,t=!1){if(e<3||t&&e-1<3)throw new Error("Invalid number of vertices");const r=[],n=t?e-2:e-1;for(let a=0;a<n;a++)r.push({faces:new Uint32Array([0,a+1,a+2])});return r}const Z=e=>e.map((e=>new h(e))),$=e=>e.length/3;export{S as checkIfPolygonContainsSelectedPoint,E as computePolygonForInspection,I as createCoveragePolygon,H as limitZToGround,Q as projectVertices,L as resizePolygon,W as updateFrustum};
@@ -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{JSONMap as e}from"../../../core/jsonMap.js";import{geographicToWebMercator as t}from"../../../geometry/support/webMercatorUtils.js";import r from"./cameraOrientationRegistry.js";import{isConstantElevation as n,ConstantElevation as i,ElevationSource as o}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as s}from"../enums/CameraOrientationType.js";function l(e,t,r){return t&&(e=`${t}${e}`),r&&(e+=`${r}`),e}function a(e,t,r){let{url:n}=e;return n?(n=l(n,t,r),new o({...e,url:n})):null}function u(e,t,r){return e?n(e)?new i(e):a(e,t,r):e}const c=new e({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),f=new e({Feet:"feet",Meter:"meter"}),p=new e({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique",Terrestrial360Video:"terrestrial-360-video",TerrestrialFrameVideo:"terrestrial-frame-video",Aerial360Video:"aerial-360-video",AerialFrameVideo:"aerial-frame-video","":null}),m=new Map;function h(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,y,w,v,D,z,$,I]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,omega:s,phi:l,kappa:a,...d([u,c,f,p,m,h],[y,w],[v,D,z],[$,I],g)}}m.set(`${s.HPR}`,y),m.set(`${s.YPR}`,w),m.set(`${s.OPK}`,h),m.set(`${s.LTP}`,v);const g=e=>{const t=e.map((e=>parseFloat(e))).filter((e=>!isNaN(e)));if(t.length===e.length)return t};function d(e,t,r,n,i){const o=g(e),s=g(t),l=g(r),a=g(n);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function y(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,y,w,v,D,z,$,I]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,heading:s,pitch:l,roll:a,...d([u,c,f,p,m,h],[y,w],[v,D,z],[$,I],g)}}function w(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,y,w,v,D,z,$,I]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,yaw:s,pitch:l,roll:a,...d([u,c,f,p,m,h],[y,w],[v,D,z],[$,I],g)}}function v(e){const[t,n,i,o,s,...l]=e.slice(1),a=m.get(s),u=r.get(s)?.constructor;if(!a||!u)return null;return{latitude:t,longitude:n,ellipsoidRadius:i,squaredEccentricity:o,properties:new u(a([s,"",...l]))}}function D(e){if(!e)return null;const t=`${e}`.split("|");if(0===t.length)return null;const n=r.get(t[0]);if(!n)return null;const i=m.get(t[0]);if(!i)return null;return new(0,n.constructor)(i(t))}function z(e){return Array.isArray(e)&&9===e?.length&&!e.some(isNaN)}function $(e){return e.spatialReference.isGeographic?t(e):e.clone()}export{l as appendPrefixAndSuffix,$ as convertGeographicToWebMercator,D as createCameraOrientation,u as getEffectiveElevationSource,z as isOrientationAccuracy,p as orientedImageryTypeMap,a as processElevationSource,c as timeIntervalUnitTypeMap,m as transformersRegistry,f as verticalMeasurementTypeMap};
5
+ import{JSONMap as e}from"../../../core/jsonMap.js";import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import{geographicToWebMercator as r}from"../../../geometry/support/webMercatorUtils.js";import n from"./cameraOrientationRegistry.js";import{isConstantElevation as i,ConstantElevation as o,ElevationSource as s}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as l}from"../enums/CameraOrientationType.js";function a(e,t,r){return t&&(e=`${t}${e}`),r&&(e+=`${r}`),e}function u(e,t,r){let{url:n}=e;return n?(n=a(n,t,r),new s({...e,url:n})):null}function c(e,t,r){return e?i(e)?new o(e):u(e,t,r):e}const f=new e({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),p=new e({Feet:"feet",Meter:"meter"}),m=new e({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique",Terrestrial360Video:"terrestrial-360-video",TerrestrialFrameVideo:"terrestrial-frame-video",Aerial360Video:"aerial-360-video",AerialFrameVideo:"aerial-frame-video","":null}),h=new Map;function g(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,w,v,D,z,$,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,omega:s,phi:l,kappa:a,...y([u,c,f,p,m,h],[d,w],[v,D,z],[$,j],g)}}h.set(`${l.HPR}`,w),h.set(`${l.YPR}`,v),h.set(`${l.OPK}`,g),h.set(`${l.LTP}`,D);const d=e=>{const t=e.map((e=>parseFloat(e))).filter((e=>!isNaN(e)));if(t.length===e.length)return t};function y(e,t,r,n,i){const o=d(e),s=d(t),l=d(r),a=d(n);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function w(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,w,v,D,z,$,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,heading:s,pitch:l,roll:a,...y([u,c,f,p,m,h],[d,w],[v,D,z],[$,j],g)}}function v(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,w,v,D,z,$,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,yaw:s,pitch:l,roll:a,...y([u,c,f,p,m,h],[d,w],[v,D,z],[$,j],g)}}function D(e){const[t,r,i,o,s,...l]=e.slice(1),a=h.get(s),u=n.get(s)?.constructor;if(!a||!u)return null;return{latitude:t,longitude:r,ellipsoidRadius:i,squaredEccentricity:o,properties:new u(a([s,"",...l]))}}function z(e){if(!e)return null;const t=`${e}`.split("|");if(0===t.length)return null;const r=n.get(t[0]);if(!r)return null;const i=h.get(t[0]);if(!i)return null;return new(0,r.constructor)(i(t))}function $(e){return Array.isArray(e)&&9===e?.length&&!e.some(isNaN)}function j(e){return e.spatialReference.isGeographic?r(e):e.clone()}function I(e){return e.isGeographic?1:t(e)}export{a as appendPrefixAndSuffix,j as convertGeographicToWebMercator,z as createCameraOrientation,c as getEffectiveElevationSource,I as getMetersPerUnitOfSR,$ as isOrientationAccuracy,m as orientedImageryTypeMap,u as processElevationSource,f as timeIntervalUnitTypeMap,h as transformersRegistry,p as verticalMeasurementTypeMap};
@@ -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{updateUsingElevationSampler as t,updateUsingElevationSource as e,updateUsingConstant as a}from"./updateElevationUtils.js";import{isUpdateElevationWithElevationSampler as r,isUpdateElevationWithElevationSource as o}from"./utils.js";async function i(i,n,l){const s=Array.isArray(i)?i:[i];let u;if(r(n))u=await t(s,n.elevationSample,l);else if(o(n)){const{elevationSource:t,extent:a}=n,{url:r,lod:o,rasterFunction:i}=t;u=await e(s,{url:r,lod:o,rasterFunction:i,extent:a},l)}else u=await a(s,n.elevationSource.constantElevation,l);return Array.isArray(i)?u:u[0]}export{i as default};
5
+ import{updateUsingElevationSampler as t,updateUsingElevationSource as e,updateUsingAverageGroundElevation as a,updateUsingConstant as r}from"./updateElevationUtils.js";import{isUpdateElevationWithElevationSampler as n,isUpdateElevationWithElevationSource as o}from"./utils.js";async function i(i,l,s){const u=Array.isArray(i)?i:[i];let c;if(n(l))c=await t(u,l.elevationSample,s);else if(o(l)){const{elevationSource:t,extent:a}=l,{url:r,lod:n,rasterFunction:o}=t;c=await e(u,{url:r,lod:n,rasterFunction:o,extent:a},s)}else c="averageGroundElevation"in l?a(u,l):await r(u,l.elevationSource.constantElevation,s);return Array.isArray(i)?c:c[0]}export{i 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 e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as r,waitTick as a}from"../../../core/promiseUtils.js";import{projectWithZConversion as o}from"../../../geometry/projectionUtils.js";import{fromExtent as n}from"../../../geometry/support/aaBoundingRect.js";import i from"../../ElevationLayer.js";import s from"../../ImageryLayer.js";import c from"../../ImageryTileLayer.js";import{TileElevationSampler as l}from"../../support/ElevationSampler.js";import{ElevationTile as u}from"../../support/ElevationTile.js";import{ElevationTileData as m}from"../../support/ElevationTileData.js";import p from"../../support/RasterFunction.js";import f from"../../support/TileInfo.js";import{TileKey as w}from"../../support/TileKey.js";import{identify as y}from"../../../rest/imageService.js";import g from"../../../rest/support/ImageIdentifyParameters.js";import{fetchArcGISServiceJSON as d}from"../../../support/requestPresets.js";import{logAndThrow as v}from"../../../widgets/OrientedImageryViewer/utils.js";async function I(t,r,a){if(!r.extent||!r.url)throw v("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await j(r);if(!o)throw v("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return E(t,o,a)}async function E(e,t,r){await a(r);const o=N(t,r),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}var h;!function(e){e[e.DYNAMIC=0]="DYNAMIC",e[e.ELEVATION=1]="ELEVATION",e[e.IMAGE=2]="IMAGE"}(h||(h={}));const j=async(e,a)=>{let o;const{extent:n,rasterFunction:i,url:s,lod:c}=e;try{o=await R(s)}catch(l){if(r(l))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",l)}switch(o){case h.DYNAMIC:return await L(s,n,i,a);case h.ELEVATION:return await A(s,n,c,a);default:return}};async function A(e,a,o,n){const s=new i(e);let c;try{const{tileInfo:e}=await s.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";c=await s.createElevationSampler(a,{...n,demResolution:t})}catch(l){if(r(l))return;t.getLogger(s).error(l)}finally{s.destroy()}return c}async function L(e,t,r,a){const o=r?new p({functionName:r}):void 0,i=new s({url:e,rasterFunction:o,format:"lerc"});await i.load(a);let c,y=512,g=512;const d=t.width/t.height;d>1?(g/=d,c=t.height/g):(y*=d,c=t.width/y);const v=await i.internalFetchImage(t,y,g,a),I=f.create({scales:[c],size:512,spatialReference:t.spatialReference}),E=new w(null,0,0,0,n(t)),h=new m(v.pixelData.pixelBlock.pixels[0],y,g,0),j=new u(E,h);return new l(j,I,void 0)}async function R(t,r){await a(r);const o=await d(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?h.IMAGE:h.ELEVATION:h.DYNAMIC}function N(e,t){return async r=>{let a=r.clone();const n=r.spatialReference.equals(e.spatialReference)?a:await o(r,e.spatialReference,t),i=e.queryElevation(n);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await o(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function T(e,t,r){return await a(r),e.map((e=>(e.z=t,e)))}async function M(e,a,o){const{url:n,rasterFunction:i}=a;let s;try{s=await R(n,o)}catch(l){r(l)||t.getLogger("esri.layers.orientedImagery.transformations").error(l)}switch(s){case h.ELEVATION:case h.DYNAMIC:{const t=await y(n,new g({geometry:e,rasterFunction:i?new p({functionName:i}):void 0}));if(t.value?.[0]){const r=e.clone();return r.z=+t.value[0],r}break}case h.IMAGE:{const t=new c(n,o);await t.load();const r=await t.identify(e,o);if(r.value?.[0]){const t=e.clone();return t.z=+r.value[0],t}break}}return e}export{j as getElevationSampler,L as getElevationSamplerFromDynamicImageService,A as getElevationSamplerFromElevationLayer,T as updateUsingConstant,E as updateUsingElevationSampler,I as updateUsingElevationSource,M as updateZfromService,R as validateElevationSourceURL};
5
+ import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as r,waitTick as a}from"../../../core/promiseUtils.js";import o from"../../../geometry/Extent.js";import{projectWithZConversion as n}from"../../../geometry/projectionUtils.js";import{load as i,execute as s}from"../../../geometry/operators/projectOperator.js";import{fromExtent as c}from"../../../geometry/support/aaBoundingRect.js";import l from"../../ElevationLayer.js";import m from"../../ImageryLayer.js";import p from"../../ImageryTileLayer.js";import{getMetersPerUnitOfSR as u}from"../core/utils.js";import{TileElevationSampler as f}from"../../support/ElevationSampler.js";import{ElevationTile as y}from"../../support/ElevationTile.js";import{ElevationTileData as w}from"../../support/ElevationTileData.js";import g from"../../support/RasterFunction.js";import d from"../../support/TileInfo.js";import{TileKey as v}from"../../support/TileKey.js";import{identify as E}from"../../../rest/imageService.js";import I from"../../../rest/support/ImageIdentifyParameters.js";import{fetchArcGISServiceJSON as j}from"../../../support/requestPresets.js";import{logAndThrow as R}from"../../../widgets/OrientedImageryViewer/utils.js";async function h(t,r,a){if(!r.extent||!r.url)throw R("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await L(r);if(!o)throw R("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return x(t,o,a)}async function x(e,t,r){await a(r);const o=C(t,r),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}var A;!function(e){e[e.DYNAMIC=0]="DYNAMIC",e[e.ELEVATION=1]="ELEVATION",e[e.IMAGE=2]="IMAGE"}(A||(A={}));const L=async(e,a)=>{let o;const{extent:n,rasterFunction:i,url:s,lod:c}=e;try{o=await T(s)}catch(l){if(r(l))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",l)}switch(o){case A.DYNAMIC:return await M(s,n,i,a);case A.ELEVATION:return await N(s,n,c,a);default:return}};async function N(e,a,o,n){const i=new l(e);let s;try{const{tileInfo:e}=await i.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";s=await i.createElevationSampler(a,{...n,demResolution:t})}catch(c){if(r(c))return;t.getLogger(i).error(c)}finally{i.destroy()}return s}async function M(e,t,r,a){const n=r?new g({functionName:r}):void 0,l=new m({url:e,rasterFunction:n,format:"lerc"});await l.load(a);const p=512,u=t.center,E=Math.max(t.width,t.height);let I=new o({xmin:u.x-E/2,ymin:u.y-E/2,xmax:u.x+E/2,ymax:u.y+E/2,spatialReference:t.spatialReference});l.spatialReference.equals(I.spatialReference)||(await i(),I=s(I,l.spatialReference));const j=await l.fetchPixels(I,p,p,a),R=d.create({scales:[E/p],size:p,spatialReference:I.spatialReference}),h=new v(null,0,0,0,c(I)),x=new w(j.pixelBlock.pixels[0],p,p,0),A=new y(h,x);return new f(A,R,void 0)}async function T(t,r){await a(r);const o=await j(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?A.IMAGE:A.ELEVATION:A.DYNAMIC}function C(e,t){return async r=>{let a=r.clone();const o=r.spatialReference.equals(e.spatialReference)?a:await n(r,e.spatialReference,t),i=e.queryElevation(o);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await n(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function O(e,t,r){return await a(r),e.map((e=>(e.z=t,e)))}async function z(e,a,o){const{url:n,rasterFunction:i}=a;let s;try{s=await T(n,o)}catch(c){r(c)||t.getLogger("esri.layers.orientedImagery.transformations").error(c)}switch(s){case A.ELEVATION:case A.DYNAMIC:{const t=await E(n,new I({geometry:e,rasterFunction:i?new g({functionName:i}):void 0}));if(t.value?.[0]){const r=e.clone();return r.z=+t.value[0],r}break}case A.IMAGE:{const t=new p(n,o);await t.load();const r=await t.identify(e,o);if(r.value?.[0]){const t=e.clone();return t.z=+r.value[0],t}break}}return e}function D(e,t){const{averageGroundElevation:r,spatialReference:a}=t,o=u(a);return e.map((e=>{const t=e.clone();return t.z=r*o/e.spatialReference.metersPerUnit,t}))}export{L as getElevationSampler,M as getElevationSamplerFromDynamicImageService,N as getElevationSamplerFromElevationLayer,D as updateUsingAverageGroundElevation,O as updateUsingConstant,x as updateUsingElevationSampler,h as updateUsingElevationSource,z as updateZfromService,T as validateElevationSourceURL};