import{ak as e}from"./index-d052b22f-1780912037814v=1.0.0.js";function t(e,o){e=e.replace(/=/g,"");var n=[];switch(o.constructor){case String:case Number:case Boolean:n.push(encodeURIComponent(e)+"="+encodeURIComponent(o));break;case Array:o.forEach((function(o){n=n.concat(t(e+"[]=",o))}));break;case Object:Object.keys(o).forEach((function(a){var r=o[a];n=n.concat(t(e+"["+a+"]",r))}))}return n}function o(e){var t=[];return e.forEach((function(e){"string"==typeof e?t.push(e):t=t.concat(o(e))})),t}function n(e,n,a){if(void 0===n&&(n={}),"string"!=typeof e)throw new Error('[Vue-jsonp] Type of param "url" is not string.');if("object"!=typeof n||!n)throw new Error("[Vue-jsonp] Invalid params, should be an object.");return a="number"==typeof a?a:5e3,new Promise((function(r,c){var s="string"==typeof n.callbackQuery?n.callbackQuery:"callback",i="string"==typeof n.callbackName?n.callbackName:"jsonp_"+(Math.floor(1e5*Math.random())*Date.now()).toString(16);n[s]=i,delete n.callbackQuery,delete n.callbackName;var u=[];Object.keys(n).forEach((function(e){u=u.concat(t(e,n[e]))}));var p=o(u).join("&"),l=function(){f(),clearTimeout(d),c({status:400,statusText:"Bad Request"})},f=function(){b.removeEventListener("error",l)},m=function(){document.body.removeChild(b),delete window[i]},d=null;a>-1&&(d=setTimeout((function(){f(),m(),c({statusText:"Request Timeout",status:408})}),a)),window[i]=function(e){clearTimeout(d),f(),m(),r(e)};var b=document.createElement("script");b.addEventListener("error",l),b.src=e+(/\?/.test(e)?"&":"?")+p,document.body.appendChild(b)}))}const a=async(t,o)=>{const a={output:"jsonp",location:`${t},${o}`,key:e};return await n("https://apis.map.qq.com/ws/geocoder/v1",a)},r=async t=>{const o={output:"jsonp",key:e,...t};return await n("https://apis.map.qq.com/ws/district/v1/search",o)};export{r as g,a as q};
