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