import{g as n}from"./element-plus-DSMJnpwa.js";var o,e={exports:{}};const a=n((o||(o=1,e.exports=function(){function n(n){var a=[];return n.AMapUI&&a.push(o(n.AMapUI)),n.Loca&&a.push(e(n.Loca)),Promise.all(a)}function o(n){return new Promise(function(o,e){var i=[];if(n.plugins)for(var l=0;l<n.plugins.length;l+=1)-1==p.AMapUI.plugins.indexOf(n.plugins[l])&&i.push(n.plugins[l]);if(t.AMapUI===a.failed)e("前次请求 AMapUI 失败");else if(t.AMapUI===a.notload){t.AMapUI=a.loading,p.AMapUI.version=n.version||p.AMapUI.version,l=p.AMapUI.version;var r=document.body||document.head,c=document.createElement("script");c.type="text/javascript",c.src="https://webapi.amap.com/ui/"+l+"/main.js",c.onerror=function(n){t.AMapUI=a.failed,e("请求 AMapUI 失败")},c.onload=function(){if(t.AMapUI=a.loaded,i.length)window.AMapUI.loadUI(i,function(){for(var n=0,e=i.length;n<e;n++){var a=i[n].split("/").slice(-1)[0];window.AMapUI[a]=arguments[n]}for(o();s.AMapUI.length;)s.AMapUI.splice(0,1)[0]()});else for(o();s.AMapUI.length;)s.AMapUI.splice(0,1)[0]()},r.appendChild(c)}else t.AMapUI===a.loaded?n.version&&n.version!==p.AMapUI.version?e("不允许多个版本 AMapUI 混用"):i.length?window.AMapUI.loadUI(i,function(){for(var n=0,e=i.length;n<e;n++){var a=i[n].split("/").slice(-1)[0];window.AMapUI[a]=arguments[n]}o()}):o():n.version&&n.version!==p.AMapUI.version?e("不允许多个版本 AMapUI 混用"):s.AMapUI.push(function(n){n?e(n):i.length?window.AMapUI.loadUI(i,function(){for(var n=0,e=i.length;n<e;n++){var a=i[n].split("/").slice(-1)[0];window.AMapUI[a]=arguments[n]}o()}):o()})})}function e(n){return new Promise(function(o,e){if(t.Loca===a.failed)e("前次请求 Loca 失败");else if(t.Loca===a.notload){t.Loca=a.loading,p.Loca.version=n.version||p.Loca.version;var i=p.Loca.version,l=p.AMap.version.startsWith("2"),r=i.startsWith("2");if(l&&!r||!l&&r)e("JSAPI 与 Loca 版本不对应！！");else{l=p.key,r=document.body||document.head;var c=document.createElement("script");c.type="text/javascript",c.src="https://webapi.amap.com/loca?v="+i+"&key="+l,c.onerror=function(n){t.Loca=a.failed,e("请求 AMapUI 失败")},c.onload=function(){for(t.Loca=a.loaded,o();s.Loca.length;)s.Loca.splice(0,1)[0]()},r.appendChild(c)}}else t.Loca===a.loaded?n.version&&n.version!==p.Loca.version?e("不允许多个版本 Loca 混用"):o():n.version&&n.version!==p.Loca.version?e("不允许多个版本 Loca 混用"):s.Loca.push(function(n){n?e(n):e()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var a,i;(i=a||(a={})).notload="notload",i.loading="loading",i.loaded="loaded",i.failed="failed";var p={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},t={AMap:a.notload,AMapUI:a.notload,Loca:a.notload},s={AMapUI:[],Loca:[]},l=[],r=function(n){"function"==typeof n&&(t.AMap===a.loaded?n(window.AMap):l.push(n))};return{load:function(o){return new Promise(function(e,i){if(t.AMap==a.failed)i("");else if(t.AMap==a.notload){var s=o.key,c=o.version,d=o.plugins;s?(window.AMap&&"lbs.amap.com"!==location.host&&i("禁止多种API加载方式混用"),p.key=s,p.AMap.version=c||p.AMap.version,p.AMap.plugins=d||p.AMap.plugins,t.AMap=a.loading,c=document.body||document.head,window.___onAPILoaded=function(p){if(delete window.___onAPILoaded,p)t.AMap=a.failed,i(p);else for(t.AMap=a.loaded,n(o).then(function(){e(window.AMap)}).catch(i);l.length;)l.splice(0,1)[0]()},(d=document.createElement("script")).type="text/javascript",d.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+p.AMap.version+"&key="+s+"&plugin="+p.AMap.plugins.join(","),d.onerror=function(n){t.AMap=a.failed,i(n)},c.appendChild(d)):i("请填写key")}else if(t.AMap==a.loaded)if(o.key&&o.key!==p.key)i("多个不一致的 key");else if(o.version&&o.version!==p.AMap.version)i("不允许多个版本 JSAPI 混用");else{if(s=[],o.plugins)for(c=0;c<o.plugins.length;c+=1)-1==p.AMap.plugins.indexOf(o.plugins[c])&&s.push(o.plugins[c]);s.length?window.AMap.plugin(s,function(){n(o).then(function(){e(window.AMap)}).catch(i)}):n(o).then(function(){e(window.AMap)}).catch(i)}else if(o.key&&o.key!==p.key)i("多个不一致的 key");else if(o.version&&o.version!==p.AMap.version)i("不允许多个版本 JSAPI 混用");else{var u=[];if(o.plugins)for(c=0;c<o.plugins.length;c+=1)-1==p.AMap.plugins.indexOf(o.plugins[c])&&u.push(o.plugins[c]);r(function(){u.length?window.AMap.plugin(u,function(){n(o).then(function(){e(window.AMap)}).catch(i)}):n(o).then(function(){e(window.AMap)}).catch(i)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,p={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},t={AMap:a.notload,AMapUI:a.notload,Loca:a.notload},s={AMap:[],AMapUI:[],Loca:[]}}}}()),e.exports));export{a as A};
