/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{property as r,subclass as s}from"../../../../core/accessorSupport/decorators.js";import a from"./createFlowStyle.js";import n from"./FlowContainer.js";import l from"./FlowStrategy.js";import{loadImagery as h}from"../../../support/flow/dataUtils.js";let p=class extends i{constructor(){super(...arguments),this._loadImagery=(t,e,i,o,r)=>h(this.layer,t,e,i,o,r),this._createFlowMesh=(t,e,i,o,r)=>this.layer.createFlowMesh({meshType:t,flowData:i,simulationSettings:e,startInfo:o},{signal:r}),this.attached=!1,this.type="flow",this.timeExtent=null,this.redrawOrRefetch=async()=>{this._updateVisualization()}}get updating(){return!this.attached||this._strategy.updating}attach(){const{layer:t}=this,e=()=>{this._loadImagery=(e,i,o,r,s)=>h(t,e,i,o,r,s),this._updateVisualization()};"multidimensionalDefinition"in t?this.addHandles(o(()=>t.multidimensionalDefinition,e)):this.addHandles([o(()=>t.mosaicRule,e),o(()=>t.rasterFunction,e),o(()=>t.definitionExpression,e)]),this.container=new n,this._strategy=new l({flowContainer:this.container}),this._updateVisualization()}detach(){this._strategy.destroy(),this.container?.removeAllChildren(),this.container=null,this.removeHandles()}update(t){t.stationary?this._strategy.update(t):this.layerView.requestUpdate()}hitTest(t){return new e({attributes:{},geometry:t.clone(),layer:this.layer})}moveEnd(){}async doRefresh(){}_updateVisualization(){const t=this.layer.renderer;if(null==t||"flow"!==t.type)return;const e=a(t,{loadImagery:this._loadImagery,createFlowMesh:this._createFlowMesh,timeExtent:this.timeExtent});this.container.flowStyle=e,this.layerView.requestUpdate()}};t([r()],p.prototype,"_strategy",void 0),t([r()],p.prototype,"attached",void 0),t([r()],p.prototype,"container",void 0),t([r()],p.prototype,"layer",void 0),t([r()],p.prototype,"layerView",void 0),t([r()],p.prototype,"type",void 0),t([r()],p.prototype,"updating",null),t([r()],p.prototype,"timeExtent",void 0),p=t([s("esri.views.2d.engine.flow.FlowView2D")],p);export{p as default};
