/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import e from"../../../core/Handles.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{HoveredPoints as o}from"./HoveredPoints.js";import{InputRepresentation2D as s}from"./InputRepresentation2D.js";import{ProfileLine2D as r}from"./ProfileLine2D.js";class p{constructor(t,p){this._handles=new e,this._inputRepresentation=new s({view:t}),this._hoveredPoints=new o({view:t}),this._profileLine=new r({view:t}),this._handles.add([i(()=>p.viewModel.hoveredPoints,e=>this._hoveredPoints.update(e),n),i(()=>{const{state:e,highlightEnabled:t,viewModel:i}=p;return{input:i.input,state:e,highlightEnabled:t}},e=>this._updateInputRepresentation(e),n),i(()=>p.viewModel.chartData,e=>this._profileLine.update(e),n),i(()=>p.viewModel.input?.geometry,()=>{this._profileLine.remove()},n)])}get updating(){return this._inputRepresentation.updating||this._profileLine.updating}destroy(){t(this._handles),t(this._inputRepresentation),t(this._hoveredPoints),t(this._profileLine)}_updateInputRepresentation({input:e,state:t,highlightEnabled:i}){"selected"===t&&i?this._inputRepresentation.update(e):this._inputRepresentation.remove()}}export{p as ElevationProfileView2D};
