@arcgis/core 4.33.0-next.20250423 → 4.33.0-next.20250424

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 (204) hide show
  1. package/Graphic.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/Analysis.d.ts +4 -0
  4. package/analysis/Analysis.js +1 -1
  5. package/analysis/SliceAnalysis.js +1 -1
  6. package/analysis/SlicePlane.js +1 -1
  7. package/analysis/support/AnalysisOriginWebScene.d.ts +4 -0
  8. package/analysis/support/AnalysisOriginWebScene.js +5 -0
  9. package/analysis/support/SliceAnalysisExcludedLayer.js +5 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{d4d011eea16a89a5aad9.js → 0219c3f9408d3fa3c9a0.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{4f8782b3b6ad414409e8.js → 0a48b9734ab4c64a6f4f.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{ccc50f28f217e50cc2c3.js → 1427e7953c3d8c87c5e8.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{184d7c8ea818bec5c462.js → 146b3699a9e8b1f2dcc2.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{8ba7d44eff348004f084.js → 1a6d2d090b643a87408a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +1 -0
  17. package/assets/esri/core/workers/chunks/{5e5225623977e61fd0ef.js → 213adc87c843d627c5d6.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{fa8a3c75f9b41d31559b.js → 265f69d153b7b6f07e42.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{769b66cca8347f0f84db.js → 279bbd61b32577693a4a.js} +1 -1
  20. package/assets/esri/core/workers/chunks/290b065b377f9d2ee058.js +1 -0
  21. package/assets/esri/core/workers/chunks/29d3245261a7223124ed.js +1 -0
  22. package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +1 -0
  23. package/assets/esri/core/workers/chunks/5958af341014e13475d2.js +1 -0
  24. package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +1 -0
  25. package/assets/esri/core/workers/chunks/{26e0a0a13060cd3e4291.js → 626ba3a7dee952308566.js} +1 -1
  26. package/assets/esri/core/workers/chunks/7cd32b10ed0e18e44ef2.js +1 -0
  27. package/assets/esri/core/workers/chunks/7ffa68d69c138db1295d.js +1 -0
  28. package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +1 -0
  29. package/assets/esri/core/workers/chunks/9661ee8569ee208e6237.js +1 -0
  30. package/assets/esri/core/workers/chunks/974742af7beb000c4b4a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{e27fa1e84f16b7f19a90.js → 9850ff14bd9c7da81c65.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{a276980c06d5d311a37e.js → 9f416cc5673665f8c37c.js} +1 -1
  33. package/assets/esri/core/workers/chunks/a0c51c4c30a5f749dfc6.js +1 -0
  34. package/assets/esri/core/workers/chunks/{fdcbd28f38bc485ac5e3.js → ab6ecd8eeec5ff761b34.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{5bdd5ae2d2f23ef6b331.js → c87e2a63b96e0da77dfe.js} +1 -1
  36. package/assets/esri/core/workers/chunks/cc4dd739c4c7e3ccea3f.js +1 -0
  37. package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +1 -0
  38. package/assets/esri/core/workers/chunks/{26fcbe053194bd78fcc3.js → d8474dca270b25705699.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{7c42281188b874ffcdad.js → db5913824d5e5a2a8365.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{48a1bb1e171dd06a7c6e.js → dd94585508f49863dc15.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{9408a72968cbd985dd24.js → f2cef954b58c6604642c.js} +34 -34
  42. package/chunks/BloomBlur.glsl.js +7 -7
  43. package/chunks/BloomComposition.glsl.js +24 -25
  44. package/chunks/cameraUtilsSpherical.js +1 -1
  45. package/chunks/sphere.js +1 -1
  46. package/core/Collection.js +1 -1
  47. package/core/JSONSupport.js +1 -1
  48. package/core/SetUtils.js +1 -1
  49. package/{views/webgl/GLObjectType.js → core/support/jsonUtils.js} +1 -1
  50. package/core/urlUtils.js +1 -1
  51. package/geometry/Mesh.js +1 -1
  52. package/geometry/support/normalizeUtilsSync.js +1 -1
  53. package/geometry/support/sphere.js +1 -1
  54. package/interfaces.d.ts +344 -111
  55. package/layers/DimensionLayer.js +1 -1
  56. package/layers/RouteLayer.js +1 -1
  57. package/layers/SubtypeGroupLayer.js +1 -1
  58. package/layers/ViewshedLayer.js +1 -1
  59. package/layers/graphics/data/QueryEngine.js +1 -1
  60. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  61. package/layers/orientedImagery/transformations/utils.js +1 -1
  62. package/layers/support/FieldsIndex.js +1 -1
  63. package/layers/support/VideoElement.js +1 -1
  64. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  65. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  66. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  67. package/layers/support/rasterFormats/{TiffTags.js → tiffTag.js} +1 -1
  68. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  69. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  70. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  71. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  72. package/layers/support/rasterFunctions/RemapFunction.js +1 -1
  73. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  74. package/layers/support/videoUtils.js +5 -0
  75. package/package.json +1 -1
  76. package/portal/schemas/definitions.js +1 -1
  77. package/renderers/UniqueValueRenderer.js +1 -1
  78. package/renderers/support/colorRampUtils.js +1 -1
  79. package/support/revision.js +1 -1
  80. package/symbols/IconSymbol3DLayer.js +1 -1
  81. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  82. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  84. package/views/2d/engine/webgl/textureUtils.js +1 -1
  85. package/views/2d/layers/MediaLayerView2D.js +1 -1
  86. package/views/2d/layers/TileLayerView2D.js +1 -1
  87. package/views/2d/layers/support/DebugOverlay.js +1 -1
  88. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  89. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  90. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  91. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  92. package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +1 -1
  93. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  94. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  95. package/views/3d/camera/constraintUtils/distance.js +1 -1
  96. package/views/3d/camera/intersectionUtils.js +1 -1
  97. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  98. package/views/3d/environment/atmosphereUtils.js +1 -1
  99. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  100. package/views/3d/interactive/visualElements/EngineVisualElement.js +1 -1
  101. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  102. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  103. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  104. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  105. package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
  106. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  107. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  108. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  109. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  110. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  111. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  112. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  113. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  114. package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +1 -1
  115. package/views/3d/interactive/visualElements/VisualElement.js +1 -1
  116. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  117. package/views/3d/layers/I3SMeshView3D.js +1 -1
  118. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  119. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  120. package/views/3d/state/ConstraintsManager.js +1 -1
  121. package/views/3d/state/NearFarHeuristic.js +1 -1
  122. package/views/3d/state/ViewState.js +1 -1
  123. package/views/3d/state/ViewStateManager.js +1 -1
  124. package/views/3d/state/utils/navigationUtils.js +1 -1
  125. package/views/3d/support/cameraUtilsSpherical.js +1 -1
  126. package/views/3d/support/geometryUtils/sphere.js +1 -1
  127. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  128. package/views/3d/webgl/ManagedDepthTexture.js +1 -1
  129. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  130. package/views/3d/webgl-engine/core/FBOCacheFormats.js +5 -0
  131. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +12 -14
  132. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
  133. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  134. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  135. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  136. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  137. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  138. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  139. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  140. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  141. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  142. package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
  143. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  144. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  145. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  146. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  147. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  148. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  149. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  150. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  151. package/views/SceneView.js +1 -1
  152. package/views/VideoView.js +1 -1
  153. package/views/webgl/FBOAttachmentType.js +5 -0
  154. package/views/webgl/FramebufferObject.js +1 -1
  155. package/views/webgl/Renderbuffer.js +1 -1
  156. package/views/webgl/RenderbufferDescriptor.js +1 -1
  157. package/views/webgl/Texture.js +1 -1
  158. package/views/webgl/TextureDescriptor.js +1 -1
  159. package/views/webgl/textureUtils.js +1 -1
  160. package/webscene/InitialViewProperties.js +1 -1
  161. package/webscene/Presentation.js +1 -1
  162. package/webscene/Slide.js +1 -1
  163. package/webscene/SlideLegendInfo.js +1 -1
  164. package/webscene/background/ColorBackground.js +1 -1
  165. package/webscene/spec-certification/api.js +1 -1
  166. package/webscene/spec-certification/compare.js +1 -1
  167. package/webscene/spec-certification/index.js +1 -1
  168. package/webscene/spec-certification/spec.js +1 -1
  169. package/webscene/spec-certification/utils.js +1 -1
  170. package/webscene/support/Description.js +1 -1
  171. package/webscene/support/SlideElements.js +1 -1
  172. package/webscene/support/SlideEnvironment.js +1 -1
  173. package/webscene/support/SlideGround.js +1 -1
  174. package/webscene/support/SlideVisibleLayer.js +1 -1
  175. package/webscene/support/Title.js +1 -1
  176. package/webscene/support/analysisUtils.js +5 -0
  177. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  178. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  179. package/widgets/Editor/EditorViewModel.js +1 -1
  180. package/widgets/Editor/UpdateWorkflow.js +1 -1
  181. package/widgets/Editor/support/SketchController.js +5 -0
  182. package/widgets/Editor/workflowUtils.js +1 -1
  183. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  184. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  185. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  186. package/widgets/FeatureTable.js +1 -1
  187. package/widgets/LayerList/LayerListItem.js +1 -1
  188. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  189. package/widgets/Widget.js +1 -1
  190. package/widgets/support/SelectionList.js +1 -1
  191. package/widgets/support/SnappingControls.js +1 -1
  192. package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +0 -1
  193. package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +0 -1
  194. package/assets/esri/core/workers/chunks/388a763da712ca71ccf4.js +0 -1
  195. package/assets/esri/core/workers/chunks/5ffc3ca6c6a4d32e1282.js +0 -1
  196. package/assets/esri/core/workers/chunks/642a595353a86f3717e3.js +0 -1
  197. package/assets/esri/core/workers/chunks/93e9dfd1ba8f393c6c47.js +0 -1
  198. package/assets/esri/core/workers/chunks/95379fdd6917c8a84c71.js +0 -1
  199. package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +0 -1
  200. package/assets/esri/core/workers/chunks/a197c86d42cc9ce21924.js +0 -1
  201. package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +0 -1
  202. package/assets/esri/core/workers/chunks/dd8e72d6784a8ebc115d.js +0 -1
  203. package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +0 -1
  204. package/views/webgl/formats.js +0 -5
package/Graphic.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"./chunks/tslib.es6.js";import e from"./PopupTemplate.js";import r from"./core/Clonable.js";import{deprecatedConstructorSignature as i}from"./core/deprecate.js";import s from"./core/JSONSupport.js";import o from"./core/Logger.js";import{when as a}from"./core/reactiveUtils.js";import{generateUID as l}from"./core/uid.js";import{property as n}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/RandomLCG.js";import{subclass as p}from"./core/accessorSupport/decorators/subclass.js";import{fromJSON as h}from"./geometry/support/jsonUtils.js";import{geometryTypes as u}from"./geometry/support/typeUtils.js";import{symbolTypes as m}from"./symbols/support/typeUtils.js";var g;function y(t){if(!t)return null;const e={};for(const r in t){const i=h(t[r]);i&&(e[r]=i)}return 0!==Object.keys(e).length?e:null}function c(t){if(null==t)return null;const e={};for(const r in t){const i=t[r];i&&(e[r]=i.toJSON())}return 0!==Object.keys(e).length?e:null}let f=class extends(r.ClonableMixin(s)){static{g=this}constructor(t){super(t),this.isAggregate=!1,this.layer=null,this.origin=null,this.popupTemplate=null,this.sourceLayer=null,this._version=0,Object.defineProperty(this,"uid",{value:l(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1}),arguments.length>1&&i(o.getLogger(this),"Graphic",{version:"4.30"})}initialize(){this._watchMeshGeometryChanges()}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),"mesh"!==t?.type&&this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}get version(){return this._version}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}cloneShallow(){return new g({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;const e=this.origin&&"layer"in this.origin?this.origin.layer:null;for(const r of[e,this.sourceLayer,this.layer])if(r){if("popupTemplate"in r&&r.popupTemplate)return r.popupTemplate;if(t&&"defaultPopupTemplate"in r&&null!=r.defaultPopupTemplate)return r.defaultPopupTemplate}return null}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){if(this.attributes){const r=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",r,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){return{aggregateGeometries:c(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:s.isSerializable(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null}}notifyMeshTransformChanged(t={}){const{geometry:e}=this;if("mesh"===e?.type){const r={origin:e.origin,transform:e.transform};this._notifyLayer("origin-transform",r,r,t.action)}}_notifyLayer(t,e,r,i){if(this._version++,!this.layer||!("graphicChanged"in this.layer))return;const s={graphic:this,property:t,oldValue:e,newValue:r};"origin-transform"===t&&(s.action=i),"attributes"===t&&(s.attributeName=i),this.layer.graphicChanged(s)}_watchMeshGeometryChanges(){this.addHandles([a((()=>"mesh"===this.geometry?.type&&this.geometry.vertexSpace.origin?{localMatrix:this.geometry.transform?.localMatrix,origin:this.geometry.vertexSpace.origin}:void 0),(({localMatrix:t,origin:e})=>{this._lastMeshTransform.localMatrix===t&&this._lastMeshTransform.origin===e||(this._lastMeshTransform.localMatrix=t,this._lastMeshTransform.origin=e,this.notifyMeshTransformChanged())})),a((()=>"mesh"===this.geometry?.type?{vertexAttributes:this.geometry.vertexAttributes}:void 0),(()=>{const t=this.geometry;"mesh"===t?.type&&t.vertexSpace.origin?(this._lastMeshTransform.localMatrix=t.transform?.localMatrix,this._lastMeshTransform.origin=t.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",this.geometry,this.geometry)}),{equals:(t,e)=>t===e,sync:!0})])}};t([n({value:null,json:{read:y}})],f.prototype,"aggregateGeometries",null),t([n({value:null})],f.prototype,"attributes",null),t([n({value:null,types:u,json:{read:h}})],f.prototype,"geometry",null),t([n({type:Boolean})],f.prototype,"isAggregate",void 0),t([n({clonable:"reference"})],f.prototype,"layer",void 0),t([n({clonable:"reference"})],f.prototype,"origin",void 0),t([n({type:e})],f.prototype,"popupTemplate",void 0),t([n({clonable:"reference"})],f.prototype,"sourceLayer",void 0),t([n({value:null,types:m})],f.prototype,"symbol",null),t([n({clonable:!1,json:{read:!1,write:!1}})],f.prototype,"_version",void 0),t([n({type:Boolean,value:!0})],f.prototype,"visible",null),f=g=t([p("esri.Graphic")],f);const b=f;export{b as default};
5
+ import{_ as t}from"./chunks/tslib.es6.js";import e from"./PopupTemplate.js";import r from"./core/Clonable.js";import{deprecatedConstructorSignature as s}from"./core/deprecate.js";import i from"./core/JSONSupport.js";import o from"./core/Logger.js";import{when as a}from"./core/reactiveUtils.js";import{generateUID as l}from"./core/uid.js";import{property as n}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/RandomLCG.js";import{subclass as p}from"./core/accessorSupport/decorators/subclass.js";import{isSerializable as h}from"./core/support/jsonUtils.js";import{fromJSON as u}from"./geometry/support/jsonUtils.js";import{geometryTypes as m}from"./geometry/support/typeUtils.js";import{symbolTypes as g}from"./symbols/support/typeUtils.js";var y;function c(t){if(!t)return null;const e={};for(const r in t){const s=u(t[r]);s&&(e[r]=s)}return 0!==Object.keys(e).length?e:null}function f(t){if(null==t)return null;const e={};for(const r in t){const s=t[r];s&&(e[r]=s.toJSON())}return 0!==Object.keys(e).length?e:null}let b=class extends(r.ClonableMixin(i)){static{y=this}constructor(t){super(t),this.isAggregate=!1,this.layer=null,this.origin=null,this.popupTemplate=null,this.sourceLayer=null,this._version=0,Object.defineProperty(this,"uid",{value:l(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1}),arguments.length>1&&s(o.getLogger(this),"Graphic",{version:"4.30"})}initialize(){this._watchMeshGeometryChanges()}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),"mesh"!==t?.type&&this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}get version(){return this._version}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}cloneShallow(){return new y({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;const e=this.origin&&"layer"in this.origin?this.origin.layer:null;for(const r of[e,this.sourceLayer,this.layer])if(r){if("popupTemplate"in r&&r.popupTemplate)return r.popupTemplate;if(t&&"defaultPopupTemplate"in r&&null!=r.defaultPopupTemplate)return r.defaultPopupTemplate}return null}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){if(this.attributes){const r=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",r,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){return{aggregateGeometries:f(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:h(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null}}notifyMeshTransformChanged(t={}){const{geometry:e}=this;if("mesh"===e?.type){const r={origin:e.origin,transform:e.transform};this._notifyLayer("origin-transform",r,r,t.action)}}_notifyLayer(t,e,r,s){if(this._version++,!this.layer||!("graphicChanged"in this.layer))return;const i={graphic:this,property:t,oldValue:e,newValue:r};"origin-transform"===t&&(i.action=s),"attributes"===t&&(i.attributeName=s),this.layer.graphicChanged(i)}_watchMeshGeometryChanges(){this.addHandles([a((()=>"mesh"===this.geometry?.type&&this.geometry.vertexSpace.origin?{localMatrix:this.geometry.transform?.localMatrix,origin:this.geometry.vertexSpace.origin}:void 0),(({localMatrix:t,origin:e})=>{this._lastMeshTransform.localMatrix===t&&this._lastMeshTransform.origin===e||(this._lastMeshTransform.localMatrix=t,this._lastMeshTransform.origin=e,this.notifyMeshTransformChanged())})),a((()=>"mesh"===this.geometry?.type?{vertexAttributes:this.geometry.vertexAttributes}:void 0),(()=>{const t=this.geometry;"mesh"===t?.type&&t.vertexSpace.origin?(this._lastMeshTransform.localMatrix=t.transform?.localMatrix,this._lastMeshTransform.origin=t.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",this.geometry,this.geometry)}),{equals:(t,e)=>t===e,sync:!0})])}};t([n({value:null,json:{read:c}})],b.prototype,"aggregateGeometries",null),t([n({value:null})],b.prototype,"attributes",null),t([n({value:null,types:m,json:{read:u}})],b.prototype,"geometry",null),t([n({type:Boolean})],b.prototype,"isAggregate",void 0),t([n({clonable:"reference"})],b.prototype,"layer",void 0),t([n({clonable:"reference"})],b.prototype,"origin",void 0),t([n({type:e})],b.prototype,"popupTemplate",void 0),t([n({clonable:"reference"})],b.prototype,"sourceLayer",void 0),t([n({value:null,types:g})],b.prototype,"symbol",null),t([n({clonable:!1,json:{read:!1,write:!1}})],b.prototype,"_version",void 0),t([n({type:Boolean,value:!0})],b.prototype,"visible",null),b=y=t([p("esri.Graphic")],b);const d=b;export{d as default};
package/WebScene.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.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/Loadable.js";import{loadAll as l}from"./core/loadAll.js";import p from"./core/Logger.js";import{destroyMaybe as c}from"./core/maybe.js";import{MultiOriginJSONMixin as d,MultiOriginJSONSupport as h}from"./core/MultiOriginJSONSupport.js";import m from"./core/Promise.js";import{debounce as u}from"./core/promiseUtils.js";import{on as y,watch as w}from"./core/reactiveUtils.js";import{urlToObject as f,addQueryParameter as g}from"./core/urlUtils.js";import b from"./core/Warning.js";import{property as v}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import{reader as S}from"./core/accessorSupport/decorators/reader.js";import{subclass as _}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as I}from"./core/accessorSupport/originUtils.js";import{readLoadable as j}from"./core/accessorSupport/read.js";import L from"./geometry/Extent.js";import V from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as R}from"./geometry/projection.js";import E from"./geometry/SpatialReference.js";import{validateWebSceneError as P}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as M}from"./geometry/support/jsonUtils.js";import{isEarth as O}from"./geometry/support/spatialReferenceUtils.js";import U from"./portal/Portal.js";import C from"./portal/PortalItem.js";import{createForItemWrite as N}from"./portal/support/jsonContext.js";import{toggleTypeKeyword as T,typeKeyword as x}from"./portal/support/portalItemUtils.js";import{hasDeveloperBasemapLayer as G}from"./support/basemapUtils.js";import F from"./support/MapFloorInfo.js";import{WebSceneTag as W}from"./support/tagSymbols.js";import{createSchemaValidationError as J}from"./support/webSceneUtils.js";import $ from"./time/TimeExtent.js";import{ViewingMode as B}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as q}from"./views/support/spatialReferenceSupport.js";import{SaveOperationType as k}from"./webdoc/interfaces.js";import D from"./webdoc/Widgets.js";import{updateItemWithResources as H,saveResources as K}from"./webdoc/support/resourceUtils.js";import{evaluateWriteErrors as z}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as Q}from"./webdoc/support/thumbnailUtils.js";import{isCopyAllowed as X,initializeNewItem as Y}from"./webdoc/support/webdocSaveUtils.js";import Z from"./webscene/ApplicationProperties.js";import ee from"./webscene/Environment.js";import te from"./webscene/InitialViewProperties.js";import re from"./webscene/Presentation.js";import ie from"./webscene/TransportationNetwork.js";import{Version as oe}from"./webscene/Version.js";import{alphaCutoff as se}from"./webscene/support/AlphaCutoff.js";import{getLoader as ae}from"./webscene/support/schemaValidatorLoader.js";var ne;const le=new oe(1,37),pe=()=>{const e=8,t=[],r=le.major;for(let i=e;i<=le.minor;i++)t.push(`${r}.${i}`);return t},ce="Web Scene";let de=class extends(n.LoadableMixin(m.EsriPromiseMixin(d(r)))){static{ne=W}constructor(e){super(e),this[ne]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new re,this.initialViewProperties=new te,this.portalItem=null,this.resourceInfo=null,this.widgets=null,this._debouncedSaveOperations=u((async(e,t,r)=>{switch(e){case k.SAVE:return this._saveImpl(t);case k.SAVE_AS:return this._saveAsImpl(r,t)}})),this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{p.getLogger(this).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(y((()=>this.allLayers),"change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=c(this.portalItem)}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){t[r]=this._layersToJSON(e,"operational-layers",i)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new oe(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${le.major}.${le.minor}`}writeTables(e,t,r,i){const o=this._layersToJSON(e,"tables",i);o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem?.thumbnailUrl??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t){const r={};t.initialState?.environment&&(r.environment=ee.fromJSON(t.initialState.environment)),r.spatialReference=t.spatialReference?E.fromJSON(t.spatialReference):E.WebMercator,r.viewingMode=t.viewingMode??"global",t.initialState?.viewpoint&&(r.viewpoint=i.fromJSON(t.initialState.viewpoint));const o=t.initialState?.timeExtent;return null!=o&&(r.timeExtent=$.fromArray(o)),new te(r)}get spatialReference(){return this.initialViewProperties?.spatialReference??E.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){const t=this.ground;return this.addResolvingPromise(this._loadFromSource().then((()=>{t&&t!==this.ground&&t.destroy(),this._validateFeatureLayerSymbolVisibility()}))),Promise.resolve(this)}loadAll(){return l(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)),this.tables)}))}read(e,t){t={...t,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(j(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion?.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=(e,t)=>e.visibleLayers.some((e=>e.id===t)),o=t.filter((e=>!r.some((t=>i(t,e.id)))));r.forEach((e=>{e.visibleLayers.addMany(o)}))}}_writeBasemapElevationLayers(e){const t=e.ground?.layers;!e.baseMap&&t?.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=a(t))}_layersToJSON(e,t,r){const i={...r,layerContainerType:t};return e.map((e=>this._verifyWritableLayer(e,r)?e.write({},i):null)).filter((e=>!!e)).toArray()}_verifyWritableLayer(e,t){return!!e.persistenceEnabled&&("write"in e||(t?.messages&&t.messages.push(new s("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1))}write(e,t){if("loaded"!==this.loadStatus){const e=new s("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw p.getLogger(this).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages?.filter((e=>"web-document-write:property-required"===e.name))??[];if(e.length){const t=new s("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw p.getLogger(this).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(k.SAVE,e)}async _saveImpl(e){if(!this.portalItem)throw new s("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(this.portalItem?.type!==ce)throw new s("webscene:portal-item-wrong-type",`Portal item needs to have type "${ce}"`);const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls(N(this.portalItem,"web-scene",!0)),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,k.SAVE,e),this._updateTypeKeywords(this.portalItem),await H(this.portalItem,i,this._resourceReferences,r),I(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(k.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=C.from(e);if(!r)throw new s("webscene:portal-item-required","saveAs requires a portal item to save to");r.id&&(r=r.clone(),r.id=null);const i=r.portal||U.getDefault();await this._ensureLoadBeforeSave(),r.type=ce,r.portal=i;const o=this._enableVerifyItemRelativeUrls(N(r,"web-scene",!0)),a=this.write({},o);await Promise.all(o.resources.pendingOperations),await this._verifySaveAs(a,o,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");this._updateTypeKeywords(r),await i.signIn();const p=this.portalItem,c={item:p,authenticated:!(!p?.id||!p.portal.user)},{copyAllowed:d,itemReloaded:m}=await X(c,i);if(c.authenticated||=m,!d)throw new s(`${o.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const u={...t,copyAllResources:!0};return await Y(r,c,a,u)&&(this._resourceReferences.portalItem=r),await K(this._resourceReferences,o),this.portalItem=r,h.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?f(r.itemUrl):void 0}),I(o),n&&(this.thumbnailUrl=l?g(n,"w","8192"):n),o.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}async _verifySave(e,t,r,i){if(!O(this.spatialReference))throw new s("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently.");const{ignoreUnsupported:o,requiredPropertyChecksDisabled:a,strictSchemaValidationEnabled:n}=i||{};z(t,{errorName:"webscene:save"},{ignoreUnsupported:o,supplementalUnsupportedErrors:["scenemodification:unsupported"],requiredPropertyChecksDisabled:a});const l=ae();if(n&&l){const t=(await l()).validate(e);if(!t.length)return;const i=`webscene did not validate:\n${t.join("\n")}`;p.getLogger(this).error(`${r===k.SAVE_AS?"saveAs":"save"}(): ${i}`);const o=t.map((e=>new s("webscene:schema-validation",e)));throw J(o)}}_verifySaveAs(e,t,r){return this._verifySave(e,t,k.SAVE_AS,r)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(){return!1}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=ee.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,this.initialViewProperties.timeExtent=e.timeExtent?.clone()??null,null!=e.clippingArea?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}if(!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this);(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this._updateFromThumbnail(e,t.thumbnailSize??void 0)}async _updateFromThumbnail(e,t){const r=Q(e,t),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):this.portalItem?.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion?.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion?.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}async _loadFromJSON(e,t){const r=new o;await this._validateSpatialReference(),await this._validateHeightModelInfo();const{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js"),{operationalLayers:s,operationalElevationLayers:a,basemapElevationLayers:n}=this._extractOperationalLayers(e),l=[],p={context:{...t,layerContainerType:"operational-layers"}};if(this.portalItem&&(p.context.portal=this.portalItem.portal||U.getDefault()),n.length>0){const e={...p,context:{...p.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",l.push(i(this.ground.layers,n,e))}if(a.length>0){const e={...p,context:{...p.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",l.push(i(r,a,e))}s&&s.length>0&&l.push(i(this.layers,s,p)),e.tables?.length&&l.push(i(this.tables,e.tables,{...p,context:{...p.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"})),await Promise.allSettled(l),await this._loadObjectsWithLayers(),this.ground.layers.addMany(r.filter((e=>"base-elevation"===e.type||"elevation"===e.type)))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[],t=[...this.allLayers.items];for(const{basemap:r}of this.presentation.slides.items)r&&(t.push(...r.baseLayers.items),t.push(...r.referenceLayers.items));for(const r of t)if("beforeSave"in r&&"function"==typeof r.beforeSave){const t=r.beforeSave();t&&e.push(t)}await Promise.allSettled(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await Promise.allSettled(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new s("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new s("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-scene",url:f(e.itemUrl),portal:e.portal||U.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(t,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!q(t,B.Global))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||R(e,t)}else{if(!q(t,B.Local))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e?.camera?.position.spatialReference??e?.targetGeometry?.spatialReference,o=e.viewpoint,a=i(o);if(a&&!r(a))return Promise.reject(new s("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new s("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=P(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateFeatureLayerSymbolVisibility(){this.sourceVersion?.greaterEqual(1,35)||this.layers.forEach((e=>{"feature"===e.type&&e.addHandles(w((()=>e.loaded),(()=>{"on-the-ground"===e.elevationInfo?.mode&&"simple"===e.renderer?.type&&"polygon-3d"===e.renderer.symbol?.type&&e.renderer.symbol.symbolLayers.some((t=>"fill"===t.type&&null!=t.material&&((!t.material.color||t.material.color.a*e.opacity<se)&&(e.loadWarnings.push(new b("feature-layer:invisible-draped-symbols","FeatureLayer has fully transparent symbols which will no longer render or highlight",{layer:e})),!0))))}),{once:!0,sync:!0}))}))}_validateJSON(e){const t=oe.parse(e.version||"","webscene");return le.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=E.WebMercator.toJSON()),e}_updateTypeKeywords(e){T(e,x.LOCAL_SCENE,"local"===this.initialViewProperties.viewingMode),T(e,x.DEVELOPER_BASEMAP,G(this.basemap)||this.presentation.slides.some((({basemap:e})=>!!e&&G(e)))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||E.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem?.itemUrl?f(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties?.viewing?.search,t=e=>this.allLayers.some((t=>t.id===e&&t.persistenceEnabled));e?.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new s("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}static{this.version=`${le.major}.${le.minor}`}};e([v({type:Z,json:{write:!0}})],de.prototype,"applicationProperties",void 0),e([v({type:L,json:{read:{source:"clippingArea.geometry",reader:M},write:{target:"clippingArea.geometry"}}})],de.prototype,"clippingArea",void 0),e([A("clippingArea")],de.prototype,"writeClippingArea",null),e([v({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],de.prototype,"clippingEnabled",void 0),e([S("clippingEnabled",["clippingArea"])],de.prototype,"readClippingEnabled",null),e([A("clippingEnabled")],de.prototype,"writeClippingEnabled",null),e([v({type:F,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],de.prototype,"floorInfo",void 0),e([v({type:V,json:{write:!0}})],de.prototype,"heightModelInfo",void 0),e([v({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],de.prototype,"layers",void 0),e([A("layers")],de.prototype,"writeLayers",null),e([v({readOnly:!0,type:oe,json:{type:pe(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],de.prototype,"sourceVersion",void 0),e([S("sourceVersion",["version"])],de.prototype,"readSourceVersion",null),e([A("sourceVersion")],de.prototype,"writeSourceVersion",null),e([v({json:{read:!1,write:{enabled:!0,ignoreOrigin:!0}}})],de.prototype,"tables",void 0),e([A("tables")],de.prototype,"writeTables",null),e([v()],de.prototype,"thumbnailUrl",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],de.prototype,"authoringApp",null),e([A("authoringApp")],de.prototype,"writeAuthoringApp",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],de.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],de.prototype,"writeAuthoringAppVersion",null),e([v({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],de.prototype,"ground",void 0),e([A("ground")],de.prototype,"writeGround",null),e([v({type:o.ofType(ie),json:{write:!0}})],de.prototype,"transportationNetworks",void 0),e([v({type:re,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],de.prototype,"presentation",void 0),e([v({type:te,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new te({viewingMode:"global",spatialReference:E.WebMercator})}})],de.prototype,"initialViewProperties",void 0),e([S("initialViewProperties",["initialState.timeExtent","initialState.environment","initialState.viewpoint","spatialReference","viewingMode"])],de.prototype,"readInitialViewProperties",null),e([v({type:E,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],de.prototype,"spatialReference",null),e([v({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],de.prototype,"viewingMode",null),e([v({type:C})],de.prototype,"portalItem",void 0),e([v()],de.prototype,"resourceInfo",void 0),e([v({type:D,json:{write:!0}})],de.prototype,"widgets",void 0),de=e([_("esri.WebScene")],de);const he=de;export{he as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./core/Collection.js";import o from"./core/Error.js";import{clone as s}from"./core/lang.js";import a from"./core/Loadable.js";import{loadAll as n}from"./core/loadAll.js";import l from"./core/Logger.js";import{destroyMaybe as p}from"./core/maybe.js";import{MultiOriginJSONMixin as c,MultiOriginJSONSupport as d}from"./core/MultiOriginJSONSupport.js";import h from"./core/Promise.js";import{debounce as m}from"./core/promiseUtils.js";import{on as u,watch as y}from"./core/reactiveUtils.js";import{urlToObject as w,addQueryParameter as f}from"./core/urlUtils.js";import g from"./core/Warning.js";import{property as b}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import{reader as v}from"./core/accessorSupport/decorators/reader.js";import{subclass as _}from"./core/accessorSupport/decorators/subclass.js";import{writer as S}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as A}from"./core/accessorSupport/originUtils.js";import{readLoadable as I}from"./core/accessorSupport/read.js";import j from"./geometry/Extent.js";import L from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as V}from"./geometry/projection.js";import P from"./geometry/SpatialReference.js";import{validateWebSceneError as R}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as E}from"./geometry/support/jsonUtils.js";import{isEarth as M}from"./geometry/support/spatialReferenceUtils.js";import O from"./portal/Portal.js";import U from"./portal/PortalItem.js";import{createForItemWrite as C}from"./portal/support/jsonContext.js";import{toggleTypeKeyword as T,typeKeyword as N}from"./portal/support/portalItemUtils.js";import{hasDeveloperBasemapLayer as x}from"./support/basemapUtils.js";import F from"./support/MapFloorInfo.js";import{WebSceneTag as G}from"./support/tagSymbols.js";import{createSchemaValidationError as W}from"./support/webSceneUtils.js";import{ViewingMode as $}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as J}from"./views/support/spatialReferenceSupport.js";import{SaveOperationType as k}from"./webdoc/interfaces.js";import B from"./webdoc/Widgets.js";import{updateItemWithResources as q,saveResources as H}from"./webdoc/support/resourceUtils.js";import{evaluateWriteErrors as D}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as K}from"./webdoc/support/thumbnailUtils.js";import{isCopyAllowed as z,initializeNewItem as Q}from"./webdoc/support/webdocSaveUtils.js";import X from"./webscene/ApplicationProperties.js";import Y from"./webscene/Environment.js";import Z from"./webscene/InitialViewProperties.js";import ee from"./webscene/Presentation.js";import te from"./webscene/TransportationNetwork.js";import{Version as re}from"./webscene/Version.js";import{alphaCutoff as ie}from"./webscene/support/AlphaCutoff.js";import{getLoader as oe}from"./webscene/support/schemaValidatorLoader.js";var se;const ae=new re(1,37),ne=()=>{const e=8,t=[],r=ae.major;for(let i=e;i<=ae.minor;i++)t.push(`${r}.${i}`);return t},le="Web Scene";let pe=class extends(a.LoadableMixin(h.EsriPromiseMixin(c(r)))){static{se=G}constructor(e){super(e),this[se]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this._afterLoadHooks=[],this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new ee,this.initialViewProperties=new Z,this.portalItem=null,this.resourceInfo=null,this.widgets=null,this._debouncedSaveOperations=m((async(e,t,r)=>{switch(e){case k.SAVE:return this._saveImpl(t);case k.SAVE_AS:return this._saveAsImpl(r,t)}})),this._loadContext={origin:"web-scene",initiator:this,hooks:{onAfterLoad:e=>{this._afterLoadHooks.push(e)}}},this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{l.getLogger(this).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(u((()=>this.allLayers),"change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=p(this.portalItem)}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){t[r]=this._layersToJSON(e,"operational-layers",i)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new re(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${ae.major}.${ae.minor}`}writeTables(e,t,r,i){const o=this._layersToJSON(e,"tables",i);o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem?.thumbnailUrl??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t,r){const{viewingMode:i,spatialReference:o}=t,s=new Z,a={...t.initialState};return void 0!==o&&(a.spatialReference=o),void 0!==i&&(a.viewingMode=i),s.read(a,r),s}get spatialReference(){return this.initialViewProperties?.spatialReference??P.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){const t=this.ground;return this.addResolvingPromise(this._loadFromSource().then((()=>{t&&t!==this.ground&&t.destroy(),this._validateFeatureLayerSymbolVisibility()}))),Promise.resolve(this)}loadAll(){return n(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)),this.tables)}))}read(e,t){t??=this._loadContext,t.origin="web-scene";const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(I(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion?.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=(e,t)=>e.visibleLayers.some((e=>e.id===t)),o=t.filter((e=>!r.some((t=>i(t,e.id)))));r.forEach((e=>{e.visibleLayers.addMany(o)}))}}_writeBasemapElevationLayers(e){const t=e.ground?.layers;!e.baseMap&&t?.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=s(t))}_layersToJSON(e,t,r){const i={...r,layerContainerType:t};return e.map((e=>this._verifyWritableLayer(e,r)?e.write({},i):null)).filter((e=>!!e)).toArray()}_verifyWritableLayer(e,t){return!!e.persistenceEnabled&&("write"in e||(t?.messages&&t.messages.push(new o("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1))}write(e,t){if("loaded"!==this.loadStatus){const e=new o("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw l.getLogger(this).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages?.filter((e=>"web-document-write:property-required"===e.name))??[];if(e.length){const t=new o("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw l.getLogger(this).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(k.SAVE,e)}async _saveImpl(e){if(!this.portalItem)throw new o("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(this.portalItem?.type!==le)throw new o("webscene:portal-item-wrong-type",`Portal item needs to have type "${le}"`);const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls(C(this.portalItem,"web-scene",!0)),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,k.SAVE,e),this._updateTypeKeywords(this.portalItem),await q(this.portalItem,i,this._resourceReferences,r),A(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(k.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=U.from(e);if(!r)throw new o("webscene:portal-item-required","saveAs requires a portal item to save to");r.id&&(r=r.clone(),r.id=null);const i=r.portal||O.getDefault();await this._ensureLoadBeforeSave(),r.type=le,r.portal=i;const s=this._enableVerifyItemRelativeUrls(C(r,"web-scene",!0)),a=this.write({},s);await Promise.all(s.resources.pendingOperations),await this._verifySaveAs(a,s,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");this._updateTypeKeywords(r),await i.signIn();const p=this.portalItem,c={item:p,authenticated:!(!p?.id||!p.portal.user)},{copyAllowed:h,itemReloaded:m}=await z(c,i);if(c.authenticated||=m,!h)throw new o(`${s.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const u={...t,copyAllResources:!0};return await Q(r,c,a,u)&&(this._resourceReferences.portalItem=r),await H(this._resourceReferences,s),this.portalItem=r,d.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?w(r.itemUrl):void 0}),A(s),n&&(this.thumbnailUrl=l?f(n,"w","8192"):n),s.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}async _verifySave(e,t,r,i){if(!M(this.spatialReference))throw new o("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently.");const{ignoreUnsupported:s,requiredPropertyChecksDisabled:a,strictSchemaValidationEnabled:n}=i||{};D(t,{errorName:"webscene:save"},{ignoreUnsupported:s,supplementalUnsupportedErrors:["scenemodification:unsupported"],requiredPropertyChecksDisabled:a});const p=oe();if(n&&p){const t=(await p()).validate(e);if(!t.length)return;const i=`webscene did not validate:\n${t.join("\n")}`;l.getLogger(this).error(`${r===k.SAVE_AS?"saveAs":"save"}(): ${i}`);const s=t.map((e=>new o("webscene:schema-validation",e)));throw W(s)}}_verifySaveAs(e,t,r){return this._verifySave(e,t,k.SAVE_AS,r)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(){return!1}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=Y.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,this.initialViewProperties.timeExtent=e.timeExtent?.clone()??null,this.initialViewProperties.analyses.updateFrom(e),null!=e.clippingArea?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}if(!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this);(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this._updateFromThumbnail(e,t.thumbnailSize??void 0)}async _updateFromThumbnail(e,t){const r=K(e,t),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}async _loadFromSource(){this.resourceInfo?await this._loadFromJSON(this.resourceInfo):this.portalItem?.id?await this._loadFromItem(this.portalItem):await this._loadObjectsWithLayers(),await this._afterLoad()}async _afterLoad(){for(;this._afterLoadHooks.length;){const e=this._afterLoadHooks.slice();this._afterLoadHooks.length=0,await Promise.allSettled(e.map((e=>e(this._loadContext))))}}_readAndLoadFromJSON(e){const t=this._loadContext,r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion?.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion?.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}async _loadFromJSON(e){const t=new i;await this._validateSpatialReference(),await this._validateHeightModelInfo();const{populateOperationalLayers:r}=await import("./layers/support/layersCreator.js"),{operationalLayers:o,operationalElevationLayers:s,basemapElevationLayers:a}=this._extractOperationalLayers(e),n=[],l={context:{...this._loadContext,layerContainerType:"operational-layers"}};if(this.portalItem&&(l.context.portal=this.portalItem.portal||O.getDefault()),a.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(r(this.ground.layers,a,e))}if(s.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(r(t,s,e))}o&&o.length>0&&n.push(r(this.layers,o,l)),e.tables?.length&&n.push(r(this.tables,e.tables,{...l,context:{...l.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"})),await Promise.allSettled(n),await this._loadObjectsWithLayers(),this.ground.layers.addMany(t.filter((e=>"base-elevation"===e.type||"elevation"===e.type)))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[],t=[...this.allLayers.items];for(const{basemap:r}of this.presentation.slides.items)r&&(t.push(...r.baseLayers.items),t.push(...r.referenceLayers.items));for(const r of t)if("beforeSave"in r&&"function"==typeof r.beforeSave){const t=r.beforeSave();t&&e.push(t)}await Promise.allSettled(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await Promise.allSettled(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new o("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new o("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r=this._loadContext;r.url=w(e.itemUrl),r.portal=e.portal||O.getDefault(),r.portalItem=e,r.readResourcePaths=[],await this._readAndLoadFromJSON(t),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!J(t,$.Global))return Promise.reject(new o("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||V(e,t)}else{if(!J(t,$.Local))return Promise.reject(new o("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e?.camera?.position.spatialReference??e?.targetGeometry?.spatialReference,s=e.viewpoint,a=i(s);if(a&&!r(a))return Promise.reject(new o("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new o("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=R(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateFeatureLayerSymbolVisibility(){this.sourceVersion?.greaterEqual(1,35)||this.layers.forEach((e=>{"feature"===e.type&&e.addHandles(y((()=>e.loaded),(()=>{"on-the-ground"===e.elevationInfo?.mode&&"simple"===e.renderer?.type&&"polygon-3d"===e.renderer.symbol?.type&&e.renderer.symbol.symbolLayers.some((t=>"fill"===t.type&&null!=t.material&&((!t.material.color||t.material.color.a*e.opacity<ie)&&(e.loadWarnings.push(new g("feature-layer:invisible-draped-symbols","FeatureLayer has fully transparent symbols which will no longer render or highlight",{layer:e})),!0))))}),{once:!0,sync:!0}))}))}_validateJSON(e){const t=re.parse(e.version||"","webscene");return ae.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=P.WebMercator.toJSON()),e}_updateTypeKeywords(e){T(e,N.LOCAL_SCENE,"local"===this.initialViewProperties.viewingMode),T(e,N.DEVELOPER_BASEMAP,x(this.basemap)||this.presentation.slides.some((({basemap:e})=>!!e&&x(e)))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||P.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem?.itemUrl?w(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties?.viewing?.search,t=e=>this.allLayers.some((t=>t.id===e&&t.persistenceEnabled));e?.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new o("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}static{this.version=`${ae.major}.${ae.minor}`}};e([b({type:X,json:{write:!0}})],pe.prototype,"applicationProperties",void 0),e([b({type:j,json:{read:{source:"clippingArea.geometry",reader:E},write:{target:"clippingArea.geometry"}}})],pe.prototype,"clippingArea",void 0),e([S("clippingArea")],pe.prototype,"writeClippingArea",null),e([b({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],pe.prototype,"clippingEnabled",void 0),e([v("clippingEnabled",["clippingArea"])],pe.prototype,"readClippingEnabled",null),e([S("clippingEnabled")],pe.prototype,"writeClippingEnabled",null),e([b({type:F,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],pe.prototype,"floorInfo",void 0),e([b({type:L,json:{write:!0}})],pe.prototype,"heightModelInfo",void 0),e([b({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],pe.prototype,"layers",void 0),e([S("layers")],pe.prototype,"writeLayers",null),e([b({readOnly:!0,type:re,json:{type:ne(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],pe.prototype,"sourceVersion",void 0),e([v("sourceVersion",["version"])],pe.prototype,"readSourceVersion",null),e([S("sourceVersion")],pe.prototype,"writeSourceVersion",null),e([b({json:{read:!1,write:{enabled:!0,ignoreOrigin:!0}}})],pe.prototype,"tables",void 0),e([S("tables")],pe.prototype,"writeTables",null),e([b()],pe.prototype,"thumbnailUrl",null),e([b({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],pe.prototype,"authoringApp",null),e([S("authoringApp")],pe.prototype,"writeAuthoringApp",null),e([b({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],pe.prototype,"authoringAppVersion",null),e([S("authoringAppVersion")],pe.prototype,"writeAuthoringAppVersion",null),e([b({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],pe.prototype,"ground",void 0),e([S("ground")],pe.prototype,"writeGround",null),e([b({type:i.ofType(te),json:{write:!0}})],pe.prototype,"transportationNetworks",void 0),e([b({type:ee,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],pe.prototype,"presentation",void 0),e([b({type:Z,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new Z({viewingMode:"global",spatialReference:P.WebMercator})}})],pe.prototype,"initialViewProperties",void 0),e([v("initialViewProperties",["initialState","spatialReference","viewingMode"])],pe.prototype,"readInitialViewProperties",null),e([b({type:P,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],pe.prototype,"spatialReference",null),e([b({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],pe.prototype,"viewingMode",null),e([b({type:U})],pe.prototype,"portalItem",void 0),e([b()],pe.prototype,"resourceInfo",void 0),e([b({type:B,json:{write:!0}})],pe.prototype,"widgets",void 0),pe=e([_("esri.WebScene")],pe);const ce=pe;export{ce as default};
@@ -0,0 +1,4 @@
1
+ import "../interfaces";
2
+
3
+ import Analysis = __esri.Analysis;
4
+ export default Analysis;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import s from"../core/Accessor.js";import t from"../core/Clonable.js";import o from"../core/Identifiable.js";import r from"../core/JSONSupport.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";let n=0,p=class extends(r.JSONSupportMixin(t.ClonableMixin(o.IdentifiableMixin(s)))){constructor(e){super(e),this.id=`${Date.now().toString(16)}-analysis-${n++}`,this.title=null}get parent(){return this._get("parent")}set parent(e){const s=this.parent;if(null!=s)switch(s.type){case"line-of-sight":case"dimension":case"viewshed":s.releaseAnalysis(this);break;case"2d":case"3d":s.analyses.includes(this)&&s.analyses.remove(this)}this._set("parent",e)}};e([i({type:String,constructOnly:!0,clonable:!1})],p.prototype,"id",void 0),e([i({type:String})],p.prototype,"title",void 0),e([i({clonable:!1,value:null})],p.prototype,"parent",null),p=e([a("esri.analysis.Analysis")],p);const l=p;export{l as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{AnalysisOriginWebScene as s}from"./support/AnalysisOriginWebScene.js";import o from"../core/Accessor.js";import r from"../core/Clonable.js";import t from"../core/Identifiable.js";import i from"../core/JSONSupport.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";let p=0,c=class extends(i.JSONSupportMixin(r.ClonableMixin(t.IdentifiableMixin(o)))){constructor(e){super(e),this.id=`${Date.now().toString(16)}-analysis-${p++}`,this.origin=null}get parent(){return this._get("parent")}set parent(e){const s=this.parent;if(null!=s)switch(s.type){case"line-of-sight":case"dimension":case"viewshed":s.releaseAnalysis(this);break;case"2d":case"3d":s.analyses.includes(this)&&s.analyses.remove(this)}this._set("parent",e)}};e([n({type:String,constructOnly:!0,clonable:!1})],c.prototype,"id",void 0),e([n({clonable:!1,value:null})],c.prototype,"parent",null),e([n({types:{key:"type",base:null,typeMap:{"web-scene":s}}})],c.prototype,"origin",void 0),c=e([a("esri.analysis.Analysis")],c);const l=c;export{l 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"./Analysis.js";import o from"./SlicePlane.js";import s from"../core/Collection.js";import{referenceSetter as r,castForReferenceSetter as l}from"../core/collectionUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";let i=class extends t{constructor(e){super(e),this.type="slice",this.tiltEnabled=!1,this.shape=null,this.excludeGroundSurface=!1}get excludedLayers(){return this._get("excludedLayers")||new s}set excludedLayers(e){this._set("excludedLayers",r(e,this._get("excludedLayers")))}get valid(){return null!=this.shape?.position}clear(){this.shape=null}};e([p({type:["slice"]})],i.prototype,"type",void 0),e([p()],i.prototype,"tiltEnabled",void 0),e([p({types:{key:"type",base:null,typeMap:{plane:o},defaultKeyValue:"plane"}})],i.prototype,"shape",void 0),e([p({cast:l,clonable:e=>e.slice()})],i.prototype,"excludedLayers",null),e([p({type:Boolean,nonNullable:!0})],i.prototype,"excludeGroundSurface",void 0),e([p({readOnly:!0})],i.prototype,"valid",null),i=e([a("esri.analysis.SliceAnalysis")],i);const c=i;export{c as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"./Analysis.js";import o from"./SlicePlane.js";import{SliceAnalysisExcludedLayer as t}from"./support/SliceAnalysisExcludedLayer.js";import s from"../core/Collection.js";import{referenceSetter as l,castForReferenceSetter as a}from"../core/collectionUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../core/accessorSupport/decorators/writer.js";let n=class extends r{constructor(e){super(e),this.type="slice",this.tiltEnabled=!1,this.shape=null,this.excludeGroundSurface=!1}get excludedLayers(){return this._get("excludedLayers")||new s}set excludedLayers(e){this._set("excludedLayers",l(e,this._get("excludedLayers")))}writeExcludedLayers(e,r,o,s){0!==e.length&&(r[o]=e.toArray().map((e=>t.fromLayer(e).toJSON(s))))}readExcludedLayers(e,r,o){const s=o?.initiator;s&&o?.hooks?.onAfterLoad((async()=>{for(const r of e){const{layerId:e,sublayerId:l}=t.fromJSON(r,o),a=s.allLayers.find((({id:r})=>r===e));if(a)if(null!=l&&"allSublayers"in a){await a.load();const e=a.allSublayers.find((({id:e})=>e===l));e&&"type"in e&&"building-component"===e.type&&this.excludedLayers.add(e)}else this.excludedLayers.add(a)}}))}get valid(){return null!=this.shape?.position}clear(){this.shape=null}};e([i({type:["slice"],json:{read:!1,write:{isRequired:!0}}})],n.prototype,"type",void 0),e([i({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],n.prototype,"tiltEnabled",void 0),e([i({types:{key:"type",base:null,typeMap:{plane:o},defaultKeyValue:"plane"},json:{write:{isRequired:!0}}})],n.prototype,"shape",void 0),e([i({cast:a,clonable:e=>e.slice(),json:{type:[t],write:!0}})],n.prototype,"excludedLayers",null),e([p("excludedLayers")],n.prototype,"writeExcludedLayers",null),e([d("excludedLayers")],n.prototype,"readExcludedLayers",null),e([i({type:Boolean,nonNullable:!0,json:{write:!0}})],n.prototype,"excludeGroundSurface",void 0),e([i({readOnly:!0})],n.prototype,"valid",null),n=e([c("esri.analysis.SliceAnalysis")],n);const u=n;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../chunks/tslib.es6.js";import t from"../core/Clonable.js";import{cyclicalDegrees as r}from"../core/Cyclical.js";import e from"../core/JSONSupport.js";import{equalsMaybe as i}from"../core/maybe.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{cast as p}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{ensureNumber as n}from"../core/accessorSupport/ensureType.js";import{persistable as l}from"../core/accessorSupport/decorators/persistable.js";import m from"../geometry/Point.js";let c=class extends(t.ClonableMixin(e)){constructor(o){super(o),this.type="plane",this.position=null,this.heading=0,this.tilt=0,this.width=10,this.height=10}equals(o){return this.heading===o.heading&&this.tilt===o.tilt&&i(this.position,o.position)&&this.width===o.width&&this.height===o.height}};o([s({readOnly:!0,json:{read:!1,write:!0}})],c.prototype,"type",void 0),o([s({type:m}),l()],c.prototype,"position",void 0),o([s({type:Number,nonNullable:!0,range:{min:0,max:360}}),l(),p((o=>r.normalize(n(o),0,!0)))],c.prototype,"heading",void 0),o([s({type:Number,nonNullable:!0,range:{min:0,max:360}}),l(),p((o=>r.normalize(n(o),0,!0)))],c.prototype,"tilt",void 0),o([s({type:Number,nonNullable:!0}),l()],c.prototype,"width",void 0),o([s({type:Number,nonNullable:!0}),l()],c.prototype,"height",void 0),c=o([a("esri.analysis.SlicePlane")],c);const h=c;export{h as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import o from"../core/Clonable.js";import{cyclicalDegrees as t}from"../core/Cyclical.js";import r from"../core/JSONSupport.js";import{equalsMaybe as i}from"../core/maybe.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{cast as p}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{ensureNumber as a}from"../core/accessorSupport/ensureType.js";import l from"../geometry/Point.js";let m=class extends(o.ClonableMixin(r)){constructor(e){super(e),this.type="plane",this.position=null,this.heading=0,this.tilt=0,this.width=10,this.height=10}equals(e){return this.heading===e.heading&&this.tilt===e.tilt&&i(this.position,e.position)&&this.width===e.width&&this.height===e.height}};e([s({type:["plane"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],m.prototype,"type",void 0),e([s({type:l,json:{write:{isRequired:!0}}})],m.prototype,"position",void 0),e([s({type:Number,nonNullable:!0,range:{min:0,max:360},json:{write:{isRequired:!0}}}),p((e=>t.normalize(a(e),0,!0)))],m.prototype,"heading",void 0),e([s({type:Number,nonNullable:!0,range:{min:0,max:360},json:{write:{isRequired:!0}}}),p((e=>t.normalize(a(e),0,!0)))],m.prototype,"tilt",void 0),e([s({type:Number,nonNullable:!0,range:{min:0},json:{write:{isRequired:!0}}})],m.prototype,"width",void 0),e([s({type:Number,nonNullable:!0,range:{min:0},json:{write:{isRequired:!0}}})],m.prototype,"height",void 0),m=e([n("esri.analysis.SlicePlane")],m);const c=m;export{c as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import AnalysisOriginWebScene = __esri.AnalysisOriginWebScene;
4
+ export { AnalysisOriginWebScene };
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../core/Clonable.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let t=class extends o{constructor(r){super(r),this.type="web-scene"}equals(r){return this.type===r.type}};r([s()],t.prototype,"type",void 0),t=r([e("esri.analysis.support.AnalysisOriginWebScene")],t);export{t as AnalysisOriginWebScene};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let t=class extends o{constructor(r){super(r),this.layerId=""}static fromLayer(r){return new this({layerId:"building-component"===r.type?r.layer.id:r.id,sublayerId:"building-component"===r.type?r.id:void 0})}};r([e({type:String,json:{write:{isRequired:!0}}})],t.prototype,"layerId",void 0),r([e({type:Number,json:{write:!0}})],t.prototype,"sublayerId",void 0),t=r([s("esri.analysis.support.SliceAnalysisExcludedLayer")],t);export{t as SliceAnalysisExcludedLayer};