"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../utils/common.js"),i=require("./mixins.js"),a=require("./props.js"),e=require("./component.js");const o=i.default(e.default).extend({data:()=>({$amapEditor:null}),props:{editable:a.defineProp({type:Boolean,default:!1,initialize:!1})},async mounted(){await this.context.ready;const t=this.$options.amapMeta.editable;this.editable&&t.startEditing.call(this)},beforeDestroy(){const t=this.$amapEditor;if(t){this.$options.amapMeta.editable.events.forEach(i=>{t.off(i,this.$onAmapEdit)}),t.close()}},watch:{"$props.editable"(t){const i=this.$options.amapMeta.editable;t?this.context.destroyed||i.startEditing.call(this):i.endEditing.call(this)}}});var s=i.default(o).extend({amapMeta:{editable:{events:[],loadEditor:t.panic,initEditor:t.panic,onEdit:t.panic,async initEditing(){if(this.$amapEditor)return this.$amapEditor;const t=this.$options.amapMeta.editable,{context:i}=this;await i.container.ready,await this.$options.amapMeta.editable.loadEditor();const a=i.container.map,e=i.component,{AMap:o}=this;this.$amapEditor=await t.initEditor.call(this,o,a,e);const s=this.$onAmapEdit=t.onEdit.bind(this);return t.events.forEach(t=>{this.$amapEditor.on(t,s)}),this.$amapEditor},async startEditing(){const t=this.$options.amapMeta.editable;(await t.initEditing.call(this)).open()},endEditing(){this.$amapEditor&&this.$amapEditor.close()}}}});exports.default=s;
