/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import{watch as r,syncAndInitial as l,on as i}from"../../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{MediaElementControllerControlPoints as a}from"./media/MediaElementControllerControlPoints.js";import{MediaElementControllerShape as m}from"./media/MediaElementControllerShape.js";import{MediaElementManipulator3D as p}from"./media/MediaElementManipulator3D.js";import{isMediaElementVisibleLayerView as d}from"./media/mediaElementUtils.js";const c=Symbol();let u=class extends t{get operations(){return this._controller?.operations}get elevationInfo(){return{mode:"on-the-ground",offset:0}}get _layerView(){const e=this.view.allLayerViews.find(e=>e.layer===this.layer);return"media-3d"===e?.type?e:null}get visible(){return d(this._layerView,this.element)}get isDraped(){return!0}get origin(){return null}get updating(){return!!this._controller?.updating}get _controllerClass(){return"transform"===this.tool||"control-points"!==this.element.georeference?.type?m:a}constructor(e){super(e),this.tool="transform"}initialize(){this.addHandles([r(()=>this._controllerClass,e=>this._updateController(e),l),i(()=>this._layerView,"element-render-changed",({element:e})=>{this.element===e&&this.emit("committed")})])}toMap(e){const{layer:t,element:o}=this;return this.view.toMap(e,{include:{layer:t,element:o}})}createManipulator(e){const{view:t,layer:o,element:r}=this;return new p({view:t,layer:o,element:r,...e})}_updateController(e){if(this._controller&&this._controller instanceof e)return;this.removeHandles(c);const{view:t,layer:r,element:l}=this,i=()=>{this.emit("modified-externally")};this._controller=new e({view:t,layer:r,element:l,onModifiedExternally:i}),i(),this.addHandles(o(this._controller),c)}};e([n({constructOnly:!0})],u.prototype,"view",void 0),e([n({constructOnly:!0})],u.prototype,"layer",void 0),e([n({constructOnly:!0})],u.prototype,"element",void 0),e([n()],u.prototype,"tool",void 0),e([n()],u.prototype,"_controller",void 0),e([n()],u.prototype,"elevationInfo",null),e([n()],u.prototype,"_layerView",null),e([n()],u.prototype,"visible",null),e([n()],u.prototype,"updating",null),e([n()],u.prototype,"_controllerClass",null),u=e([s("esri.views.3d.interactive.editingTools.ManipulatedObject3DMediaElement")],u);export{u as ManipulatedObject3DMediaElement};
