/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as i}from"tslib";import s from"../../../../core/Accessor.js";import{mapCollection as t}from"../../../../core/mapCollectionUtils.js";import{property as a,subclass as e}from"../../../../core/accessorSupport/decorators.js";import r from"../../../../layers/GraphicsLayer.js";import{ElevationProfileInputVisualization2D as o}from"./ElevationProfileInputVisualization2D.js";import{ElevationProfileLineVisualization2D as n}from"./ElevationProfileLineVisualization2D.js";let l=class extends s{constructor(i){super(i),this._graphicsLayer=new r({listMode:"hide",internal:!0})}initialize(){const{view:i,analysisViewData:s}=this;i.map.add(this._graphicsLayer),i.map.layers.reorder(this._graphicsLayer,0),this._inputVisualization=new o({view:i,analysisViewData:s}),this._lineVisualizations=t(()=>s.analysis.profiles,t=>new n({view:i,analysisViewData:s,line:t,addGraphic:i=>{i.attributes={index:s.analysis.profiles.indexOf(t)},this._graphicsLayer.add(i),this._graphicsLayer.graphics.sort((i,s)=>{const t=i.attributes?.index??0;return(s.attributes?.index??0)-t})}}))}destroy(){this._inputVisualization.destroy(),this._lineVisualizations.destroy(),this._graphicsLayer.graphics.drain(i=>{i.destroyed||i.destroy()}),this._graphicsLayer.removeFromParent(),this._graphicsLayer.destroy()}get updating(){return this._inputVisualization.updating||this._lineVisualizations.some(i=>i.updating)}};i([a()],l.prototype,"view",void 0),i([a()],l.prototype,"analysisViewData",void 0),i([a()],l.prototype,"updating",null),l=i([e("esri.views.2d.analysis.ElevationProfile.ElevationProfileVisualization2D")],l);export{l as ElevationProfileVisualization2D};
