import{d as S,o as F,x as k,j as H,z as R}from"./vue.1703796278973.js";import{c as W}from"./dayjs.min.1703796278973.js";import{ab as _,ac as J,ad as Z,ae as O,af as G,ag as T,ah as D,ai as x,aj as q,ak as V,al as Q,am as X,an as Y,ao as K,ap as N,aq as L,ar as ee,as as te,at as ne,au as oe}from"./index.17037962789732.js";import{i as U}from"./isArray.1703796278973.js";function ae(e,t,n){if(!_(n))return!1;var s=typeof t;return(s=="number"?J(n)&&Z(t,n.length):s=="string"&&t in n)?O(n[t],e):!1}function ie(e){return G(function(t,n){var s=-1,p=n.length,o=p>1?n[p-1]:void 0,i=p>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(p--,o):void 0,i&&ae(n[0],n[1],i)&&(o=p<3?void 0:o,p=1),t=Object(t);++s{if(e.install=n=>{for(const s of[e,...Object.values(t??{})])n.component(s.name,s)},t)for(const[n,s]of Object.entries(t))e[n]=s;return e};function de(){let e=[],t="0123456789abcdef";for(var n=0;n<36;n++)e[n]=t.substr(Math.floor(Math.random()*16),1);e[14]="4",e[19]=t.substr(e[19]&3|8,1),e[8]=e[13]=e[18]=e[23]="-";var s=e.join("");return s}var ce=function(){var e=[].map.call(arguments,function(t){return t.trim()}).filter(function(t){return t.length}).join("-");return e.length?e.length===1||!/[_.\- ]+/.test(e)?e[0]===e[0].toLowerCase()&&e.slice(1)!==e.slice(1).toLowerCase()?e:e.toLowerCase():e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,function(t,n){return n.toUpperCase()}):""},P=ce,fe=function(){var e=P.apply(P,arguments);return e.charAt(0).toUpperCase()+e.slice(1)};let b;class he{constructor(){this._listener=new Map}addListener(t,n,s,p){if(!AMap)throw new Error("please wait for Map API load");if(!t.on)return;t.on(n,s,p),this._listener.get(t)||this._listener.set(t,{});const o=this._listener.get(t);o[n]||(o[n]=[]),o[n].push(s)}removeListener(t,n,s){if(!AMap)throw new Error("please wait for Map API load");if(!t.off||!this._listener.get(t)||!this._listener.get(t)[n])return;const p=this._listener.get(t)[n];if(s){const o=p.indexOf(s);t.off(n,p[o]),p.splice(o,1)}else p.forEach(o=>{t.off(n,o)}),this._listener.get(t)[n]=[]}addListenerOnce(t,n,s,p){return t.on(n,s,p,!0)}trigger(t,n,s){return t.emit(n,s)}clearListeners(t){const n=this._listener.get(t);n&&Object.keys(n).map(s=>{t.clearEvents(s)})}}b=b||new he;var B=b;function Ue(e){return e?e instanceof AMap.Map:!1}function Pe(e){return e?e instanceof AMap.OverlayGroup:!1}function me(e){if(!e||e.length<4)return e;const t=e.substring(3,e.length);return e[2].toLowerCase()+t}const ge=/^on[A-Z]+/;var ve=S({inject:{parentInstance:{default:null}},inheritAttrs:!1,props:{visible:{type:Boolean,default:!0},zIndex:{type:Number},reEventWhenUpdate:{type:Boolean,default:!1}},emits:["init"],data(){return{needInitComponents:[],unwatchFns:[],propsRedirect:{},converters:{},isDestroy:!1,cacheEvents:{},isMounted:!1}},created(){this.$amapComponent=null,this.$parentComponent=null},mounted(){this.parentInstance&&(this.parentInstance.$amapComponent?this.register():this.parentInstance.addChildComponent(this))},beforeUnmount(){this.$amapComponent&&(this.unregisterEvents(),this.unwatchFns.forEach(e=>e()),this.unwatchFns=[],this.destroyComponent(),this.isDestroy=!0)},beforeUpdate(){this.reEventWhenUpdate&&this.isMounted&&this.$amapComponent&&this.unregisterEvents()},updated(){this.reEventWhenUpdate&&this.isMounted&&this.$amapComponent&&this.registerEvents()},methods:{getHandlerFun(e){return this[`__${e}`]?this[`__${e}`]:this.$amapComponent?this.$amapComponent[`set${fe(e)}`]:null},convertProps(){const e={},{$props:t,propsRedirect:n}=this;return Object.keys(t).reduce((s,p)=>{let o=p;const i=this.convertSignalProp(o,t[o]);return i===void 0||(n&&n[p]&&(o=n[o]),e[o]=i),s},e)},convertSignalProp(e,t){return this.converters&&this.converters[e]?this.converters[e].call(this,t):t},registerEvents(){const e=this.$attrs;Object.keys(e).forEach(t=>{if(ge.test(t)){const n=me(t);B.addListener(this.$amapComponent,n,e[t]),this.cacheEvents[n]=e[t]}})},unregisterEvents(){Object.keys(this.cacheEvents).forEach(e=>{B.removeListener(this.$amapComponent,e,this.cacheEvents[e]),delete this.cacheEvents[e]})},setPropWatchers(){const{propsRedirect:e,$props:t}=this;Object.keys(t).forEach(n=>{let s=n;e&&e[n]&&(s=e[n]);const p=this.getHandlerFun(s);if(!p)return;const o={deep:!1},i=Object.prototype.toString.call(t[n]);(i==="[object Object]"||i==="[object Array]")&&(o.deep=!0);const r=this.$watch(n,d=>{p.call(this.$amapComponent,this.convertSignalProp(n,d))},o);this.unwatchFns.push(r)})},initProps(){["editable","visible","zooms"].forEach(t=>{if(this[t]!==void 0){const n=this.getHandlerFun(t);n&&n.call(this.$amapComponent,this.convertSignalProp(t,this[t]))}})},lazyRegister(){const e=this.parentInstance;e&&e.addChildComponent&&e.addChildComponent(this)},addChildComponent(e){this.needInitComponents.push(e)},createChildren(){for(;this.needInitComponents.length>0;)this.needInitComponents[0].register(),this.needInitComponents.splice(0,1)},register(){this.parentInstance&&!this.$parentComponent&&(this.$parentComponent=this.parentInstance.$amapComponent);const e=this.__initComponent&&this.__initComponent(this.convertProps());e&&e.then?e.then(t=>this.registerRest(t)):this.registerRest(e)},registerRest(e){!this.$amapComponent&&e&&(this.$amapComponent=e),this.registerEvents(),this.initProps(),this.setPropWatchers(),this.$emit("init",this.$amapComponent,this),this.$nextTick(()=>{this.createChildren()}),this.isMounted=!0},$$getInstance(){return this.$amapComponent},destroyComponent(){this.$amapComponent.setMap&&this.$amapComponent.setMap(null),this.$amapComponent.close&&this.$amapComponent.close(),this.$amapComponent.editor&&this.$amapComponent.editor.close()},__visible(e){this.$amapComponent&&this.$amapComponent.show&&this.$amapComponent.hide&&(e===!1?this.$amapComponent.hide():this.$amapComponent.show())},__zIndex(e){this.$amapComponent&&this.$amapComponent.setzIndex&&this.$amapComponent.setzIndex(e)}}}),I={},Ae={get exports(){return I},set exports(e){I=e}};(function(e,t){(function(n,s){e.exports=s()})(W,function(){function n(a){var f=[];return a.AMapUI&&f.push(s(a.AMapUI)),a.Loca&&f.push(p(a.Loca)),Promise.all(f)}function s(a){return new Promise(function(f,u){var l=[];if(a.plugins)for(var c=0;c{M||(M||(e.offline?M=new Promise(t=>{console.log("@vuemap/vue-amap离线部署"),t(window.AMap)}):M=ye(e)),M.then())};var E=S({name:"ElAmap",mixins:[ve],provide(){return{parentInstance:this}},props:{vid:{type:String},center:{type:Array},zoom:{type:Number},rotation:{type:Number},pitch:{type:Number},viewMode:{type:String},features:{type:Array},layers:{type:Array},zooms:{type:Array},resizeEnable:{type:Boolean,default:!0},dragEnable:{type:Boolean,default:!0},zoomEnable:{type:Boolean,default:!0},jogEnable:{type:Boolean,default:!0},pitchEnable:{type:Boolean,default:!0},rotateEnable:{type:Boolean,default:!0},animateEnable:{type:Boolean,default:!0},keyboardEnable:{type:Boolean,default:!0},doubleClickZoom:{type:Boolean,default:!0},scrollWheel:{type:Boolean,default:!0},touchZoom:{type:Boolean,default:!0},touchZoomCenter:{type:Number},showLabel:{type:Boolean,default:!0},defaultCursor:{type:String},isHotspot:{type:Boolean},mapStyle:{type:String},wallColor:{type:[String,Array]},roofColor:{type:[String,Array]},showBuildingBlock:{type:Boolean,default:!0},showIndoorMap:{type:Boolean,default:!1},skyColor:{type:[String,Array]},labelRejectMask:{type:Boolean,default:!1},mask:{type:Array},WebGLParams:{type:Object},terrain:{type:Boolean,default:!1}},emits:["update:zoom","update:center","update:rotation","update:pitch"],data(){return{}},computed:{},mounted(){this.createMap()},beforeUnmount(){this.$amapComponent&&(this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null)},methods:{createMap(){M.then(()=>{const e=this.$el.querySelector(".el-vue-amap"),t=this.vid||de();e.id=t,this.$nextTick(()=>{this.$amapComponent=new AMap.Map(t,this.convertProps()),this.register(),this.bindModelEvents()})}).catch(e=>{console.warn("init map error: ",e)})},bindModelEvents(){this.$amapComponent.on("zoomchange",()=>{this.$emit("update:zoom",this.$amapComponent.getZoom())}),this.$amapComponent.on("rotatechange",()=>{this.$emit("update:rotation",this.$amapComponent.getRotation()),this.$emit("update:pitch",this.$amapComponent.getPitch())}),this.$amapComponent.on("dragging",()=>{this.$emit("update:center",this.getCenter()),this.$emit("update:pitch",this.$amapComponent.getPitch())}),this.$amapComponent.on("touchmove",()=>{this.$emit("update:center",this.getCenter())})},getCenter(){const e=this.$amapComponent.getCenter();return[e.lng,e.lat]},__dragEnable(e){this.$amapComponent&&this.$amapComponent.setStatus({dragEnable:e})},__zoomEnable(e){this.$amapComponent&&this.$amapComponent.setStatus({zoomEnable:e})},__jogEnable(e){this.$amapComponent&&this.$amapComponent.setStatus({jogEnable:e})},__keyboardEnable(e){this.$amapComponent&&this.$amapComponent.setStatus({keyboardEnable:e})},__doubleClickZoom(e){this.$amapComponent&&this.$amapComponent.setStatus({doubleClickZoom:e})},__scrollWheel(e){this.$amapComponent&&this.$amapComponent.setStatus({scrollWheel:e})},__rotateEnable(e){this.$amapComponent&&this.$amapComponent.setStatus({rotateEnable:e})},__resizeEnable(e){this.$amapComponent&&this.$amapComponent.setStatus({resizeEnable:e})},__showIndoorMap(e){this.$amapComponent&&this.$amapComponent.setStatus({showIndoorMap:e})}}});const we={class:"el-vue-amap-container"},$e=R("div",{class:"el-vue-amap"},null,-1);function be(e,t,n,s,p,o){return F(),k("div",we,[$e,H(e.$slots,"default")])}E.render=be;E.__file="src/packages/amap/amap.vue";const Se=le(E);export{Se as E,Ue as a,Pe as b,ie as c,ae as d,j as e,de as g,Be as i,ue as m,ve as r,se as t,le as w};