glsx-map-sdk.js 21.4 KB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self)["glsx-map-sdk"]=e()}(this,function(){"use strict";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function createCommonjsModule(t,e){return t(e={exports:{}},e.exports),e.exports}var md5=createCommonjsModule(function(module){!function(){var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{},WEB_WORKER=(root.JS_MD5_NO_WINDOW&&(WINDOW=!1),!WINDOW&&"object"==typeof self),NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node,COMMON_JS=(NODE_JS?root=commonjsGlobal:WEB_WORKER&&(root=self),!root.JS_MD5_NO_COMMON_JS&&module.exports),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8,buffer,buffer8,blocks,createOutputMethod=(ARRAY_BUFFER&&(buffer=new ArrayBuffer(68),buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)),!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer}),function(e){return function(t){return new Md5(!0).update(t)[e]()}}),createMethod=function(){var e=createOutputMethod("hex");(e=NODE_JS?nodeWrap(e):e).create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t<OUTPUT_TYPES.length;++t){var r=OUTPUT_TYPES[t];e[r]=createOutputMethod(r)}return e},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if("string"==typeof t)return crypto.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8):ARRAY_BUFFER?(t=new ArrayBuffer(68),this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if("string"!=r){if("object"!=r)throw ERROR;if(null===t)throw ERROR;if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw ERROR;e=!0}for(var o,i,n=0,s=t.length,a=this.blocks,c=this.buffer8;n<s;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)if(ARRAY_BUFFER)for(i=this.start;n<s&&i<64;++n)c[i++]=t[n];else for(i=this.start;n<s&&i<64;++n)a[i>>2]|=t[n]<<SHIFT[3&i++];else if(ARRAY_BUFFER)for(i=this.start;n<s&&i<64;++n)(o=t.charCodeAt(n))<128?c[i++]=o:(o<2048?c[i++]=192|o>>6:(o<55296||57344<=o?c[i++]=224|o>>12:(o=65536+((1023&o)<<10|1023&t.charCodeAt(++n)),c[i++]=240|o>>18,c[i++]=128|o>>12&63),c[i++]=128|o>>6&63),c[i++]=128|63&o);else for(i=this.start;n<s&&i<64;++n)(o=t.charCodeAt(n))<128?a[i>>2]|=o<<SHIFT[3&i++]:(o<2048?a[i>>2]|=(192|o>>6)<<SHIFT[3&i++]:(o<55296||57344<=o?a[i>>2]|=(224|o>>12)<<SHIFT[3&i++]:(o=65536+((1023&o)<<10|1023&t.charCodeAt(++n)),a[i>>2]|=(240|o>>18)<<SHIFT[3&i++],a[i>>2]|=(128|o>>12&63)<<SHIFT[3&i++]),a[i>>2]|=(128|o>>6&63)<<SHIFT[3&i++]),a[i>>2]|=(128|63&o)<<SHIFT[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,64<=i?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return 4294967295<this.bytes&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){var t,e;this.finalized||(this.finalized=!0,(t=this.blocks)[(e=this.lastByteIndex)>>2]|=EXTRA[3&e],56<=e&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash())},Md5.prototype.hash=function(){var t,e,r,o,i,n=this.blocks,s=this.first?((s=((t=((t=n[0]-680876937)<<7|t>>>25)-271733879<<0)^(e=((e=(-271733879^(r=((r=(-1732584194^2004318071&t)+n[1]-117830708)<<12|r>>>20)+t<<0)&(-271733879^t))+n[2]-1126478375)<<17|e>>>15)+r<<0)&(r^t))+n[3]-1316259209)<<22|s>>>10)+e<<0:(t=this.h0,s=this.h1,e=this.h2,((s+=((t=((t+=((r=this.h3)^s&(e^r))+n[0]-680876936)<<7|t>>>25)+s<<0)^(e=((e+=(s^(r=((r+=(e^t&(s^e))+n[1]-389564586)<<12|r>>>20)+t<<0)&(t^s))+n[2]+606105819)<<17|e>>>15)+r<<0)&(r^t))+n[3]-1044525330)<<22|s>>>10)+e<<0);s=((s+=((t=((t+=(r^s&(e^r))+n[4]-176418897)<<7|t>>>25)+s<<0)^(e=((e+=(s^(r=((r+=(e^t&(s^e))+n[5]+1200080426)<<12|r>>>20)+t<<0)&(t^s))+n[6]-1473231341)<<17|e>>>15)+r<<0)&(r^t))+n[7]-45705983)<<22|s>>>10)+e<<0,s=((s+=((t=((t+=(r^s&(e^r))+n[8]+1770035416)<<7|t>>>25)+s<<0)^(e=((e+=(s^(r=((r+=(e^t&(s^e))+n[9]-1958414417)<<12|r>>>20)+t<<0)&(t^s))+n[10]-42063)<<17|e>>>15)+r<<0)&(r^t))+n[11]-1990404162)<<22|s>>>10)+e<<0,s=((s+=((t=((t+=(r^s&(e^r))+n[12]+1804603682)<<7|t>>>25)+s<<0)^(e=((e+=(s^(r=((r+=(e^t&(s^e))+n[13]-40341101)<<12|r>>>20)+t<<0)&(t^s))+n[14]-1502002290)<<17|e>>>15)+r<<0)&(r^t))+n[15]+1236535329)<<22|s>>>10)+e<<0,s=((s+=((r=((r+=(s^e&((t=((t+=(e^r&(s^e))+n[1]-165796510)<<5|t>>>27)+s<<0)^s))+n[6]-1069501632)<<9|r>>>23)+t<<0)^t&((e=((e+=(t^s&(r^t))+n[11]+643717713)<<14|e>>>18)+r<<0)^r))+n[0]-373897302)<<20|s>>>12)+e<<0,s=((s+=((r=((r+=(s^e&((t=((t+=(e^r&(s^e))+n[5]-701558691)<<5|t>>>27)+s<<0)^s))+n[10]+38016083)<<9|r>>>23)+t<<0)^t&((e=((e+=(t^s&(r^t))+n[15]-660478335)<<14|e>>>18)+r<<0)^r))+n[4]-405537848)<<20|s>>>12)+e<<0,s=((s+=((r=((r+=(s^e&((t=((t+=(e^r&(s^e))+n[9]+568446438)<<5|t>>>27)+s<<0)^s))+n[14]-1019803690)<<9|r>>>23)+t<<0)^t&((e=((e+=(t^s&(r^t))+n[3]-187363961)<<14|e>>>18)+r<<0)^r))+n[8]+1163531501)<<20|s>>>12)+e<<0,s=((s+=((r=((r+=(s^e&((t=((t+=(e^r&(s^e))+n[13]-1444681467)<<5|t>>>27)+s<<0)^s))+n[2]-51403784)<<9|r>>>23)+t<<0)^t&((e=((e+=(t^s&(r^t))+n[7]+1735328473)<<14|e>>>18)+r<<0)^r))+n[12]-1926607734)<<20|s>>>12)+e<<0,s=((s+=((i=(r=((r+=((o=s^e)^(t=((t+=(o^r)+n[5]-378558)<<4|t>>>28)+s<<0))+n[8]-2022574463)<<11|r>>>21)+t<<0)^t)^(e=((e+=(i^s)+n[11]+1839030562)<<16|e>>>16)+r<<0))+n[14]-35309556)<<23|s>>>9)+e<<0,s=((s+=((i=(r=((r+=((o=s^e)^(t=((t+=(o^r)+n[1]-1530992060)<<4|t>>>28)+s<<0))+n[4]+1272893353)<<11|r>>>21)+t<<0)^t)^(e=((e+=(i^s)+n[7]-155497632)<<16|e>>>16)+r<<0))+n[10]-1094730640)<<23|s>>>9)+e<<0,s=((s+=((i=(r=((r+=((o=s^e)^(t=((t+=(o^r)+n[13]+681279174)<<4|t>>>28)+s<<0))+n[0]-358537222)<<11|r>>>21)+t<<0)^t)^(e=((e+=(i^s)+n[3]-722521979)<<16|e>>>16)+r<<0))+n[6]+76029189)<<23|s>>>9)+e<<0,s=((s+=((i=(r=((r+=((o=s^e)^(t=((t+=(o^r)+n[9]-640364487)<<4|t>>>28)+s<<0))+n[12]-421815835)<<11|r>>>21)+t<<0)^t)^(e=((e+=(i^s)+n[15]+530742520)<<16|e>>>16)+r<<0))+n[2]-995338651)<<23|s>>>9)+e<<0,s=((s+=((r=((r+=(s^((t=((t+=(e^(s|~r))+n[0]-198630844)<<6|t>>>26)+s<<0)|~e))+n[7]+1126891415)<<10|r>>>22)+t<<0)^((e=((e+=(t^(r|~s))+n[14]-1416354905)<<15|e>>>17)+r<<0)|~t))+n[5]-57434055)<<21|s>>>11)+e<<0,s=((s+=((r=((r+=(s^((t=((t+=(e^(s|~r))+n[12]+1700485571)<<6|t>>>26)+s<<0)|~e))+n[3]-1894986606)<<10|r>>>22)+t<<0)^((e=((e+=(t^(r|~s))+n[10]-1051523)<<15|e>>>17)+r<<0)|~t))+n[1]-2054922799)<<21|s>>>11)+e<<0,s=((s+=((r=((r+=(s^((t=((t+=(e^(s|~r))+n[8]+1873313359)<<6|t>>>26)+s<<0)|~e))+n[15]-30611744)<<10|r>>>22)+t<<0)^((e=((e+=(t^(r|~s))+n[6]-1560198380)<<15|e>>>17)+r<<0)|~t))+n[13]+1309151649)<<21|s>>>11)+e<<0,s=((s+=((r=((r+=(s^((t=((t+=(e^(s|~r))+n[4]-145523070)<<6|t>>>26)+s<<0)|~e))+n[11]-1120210379)<<10|r>>>22)+t<<0)^((e=((e+=(t^(r|~s))+n[2]+718787259)<<15|e>>>17)+r<<0)|~t))+n[9]-343485551)<<21|s>>>11)+e<<0,this.first?(this.h0=t+1732584193<<0,this.h1=s-271733879<<0,this.h2=e-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+s<<0,this.h2=this.h2+e<<0,this.h3=this.h3+r<<0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,o=this.h3;return HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,o=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&o,o>>8&255,o>>16&255,o>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,e,r,o="",i=this.array(),n=0;n<15;)t=i[n++],e=i[n++],r=i[n++],o+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[63&(t<<4|e>>>4)]+BASE64_ENCODE_CHAR[63&(e<<2|r>>>6)]+BASE64_ENCODE_CHAR[63&r];return t=i[n],o+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:root.md5=exports}()}),qs=createCommonjsModule(function(t,e){t.exports=function o(i,n,s){function a(e,t){if(!n[e]){if(!i[e]){var r="function"==typeof commonjsRequire&&commonjsRequire;if(!t&&r)return r(e,!0);if(c)return c(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=n[e]={exports:{}},i[e][0].call(r.exports,function(t){return a(i[e][1][t]||t)},r,r.exports,o,i,n,s)}return n[e].exports}for(var c="function"==typeof commonjsRequire&&commonjsRequire,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,r){var o=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(t){return o.call(t,i,"+")},RFC3986:function(t){return t}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},{}],2:[function(t,e,r){var o=t("./stringify"),i=t("./parse"),t=t("./formats");e.exports={formats:t,parse:i,stringify:o}},{"./formats":1,"./parse":3,"./stringify":4}],3:[function(t,e,r){function c(t,e,r){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,n=/(\[[^[\]]*])/.exec(o),t=n?o.slice(0,n.index):o,s=[];if(t){if(!r.plainObjects&&A.call(Object.prototype,t)&&!r.allowPrototypes)return;s.push(t)}for(var a=0;null!==(n=i.exec(o))&&a<r.depth;){if(a+=1,!r.plainObjects&&A.call(Object.prototype,n[1].slice(1,-1))&&!r.allowPrototypes)return;s.push(n[1])}n&&s.push("["+o.slice(n.index)+"]");for(var c=s,l=r,f=e,u=c.length-1;0<=u;--u){var d,h,p,y=c[u];"[]"===y?d=(d=[]).concat(f):(d=l.plainObjects?Object.create(null):{},h="["===y.charAt(0)&&"]"===y.charAt(y.length-1)?y.slice(1,-1):y,p=parseInt(h,10),!isNaN(p)&&y!==h&&String(p)===h&&0<=p&&l.parseArrays&&p<=l.arrayLimit?(d=[])[p]=f:d[h]=f),f=d}return f}}var l=t("./utils"),A=Object.prototype.hasOwnProperty,f={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:l.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1};e.exports=function(t,e){var r=e?l.assign({},e):{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.ignoreQueryPrefix=!0===r.ignoreQueryPrefix,r.delimiter=("string"==typeof r.delimiter||l.isRegExp(r.delimiter)?r:f).delimiter,r.depth=("number"==typeof r.depth?r:f).depth,r.arrayLimit=("number"==typeof r.arrayLimit?r:f).arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder=("function"==typeof r.decoder?r:f).decoder,r.allowDots=("boolean"==typeof r.allowDots?r:f).allowDots,r.plainObjects=("boolean"==typeof r.plainObjects?r:f).plainObjects,r.allowPrototypes=("boolean"==typeof r.allowPrototypes?r:f).allowPrototypes,r.parameterLimit=("number"==typeof r.parameterLimit?r:f).parameterLimit,r.strictNullHandling=("boolean"==typeof r.strictNullHandling?r:f).strictNullHandling,""===t||null==t)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof t?function(t,e){for(var r={},t=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,o=e.parameterLimit===1/0?void 0:e.parameterLimit,i=t.split(e.delimiter,o),n=0;n<i.length;++n){var s,a=i[n],c=a.indexOf("]="),c=-1===c?a.indexOf("="):c+1,a=-1===c?(s=e.decoder(a,f.decoder),e.strictNullHandling?null:""):(s=e.decoder(a.slice(0,c),f.decoder),e.decoder(a.slice(c+1),f.decoder));A.call(r,s)?r[s]=[].concat(r[s]).concat(a):r[s]=a}return r}(t,r):t,i=r.plainObjects?Object.create(null):{},n=Object.keys(o),s=0;s<n.length;++s)var a=n[s],a=c(a,o[a],r),i=l.merge(i,a,r);return l.compact(i)}},{"./utils":5}],4:[function(t,e,r){function g(t,e,r,o,i,n,s,a,c,l,f,u){var d=t;if("function"==typeof s)d=s(e,d);else if(d instanceof Date)d=l(d);else if(null===d){if(o)return n&&!u?n(e,v.encoder):e;d=""}if("string"==typeof d||"number"==typeof d||"boolean"==typeof d||O.isBuffer(d))return n?[f(u?e:n(e,v.encoder))+"="+f(n(d,v.encoder))]:[f(e)+"="+f(String(d))];var h,p=[];if(void 0!==d){h=Array.isArray(s)?s:(t=Object.keys(d),a?t.sort(a):t);for(var y=0;y<h.length;++y){var A=h[y];i&&null===d[A]||(p=Array.isArray(d)?p.concat(g(d[A],r(e,A),r,o,i,n,s,a,c,l,f,u)):p.concat(g(d[A],e+(c?"."+A:"["+A+"]"),r,o,i,n,s,a,c,l,f,u)))}}return p}var O=t("./utils"),R=t("./formats"),_={brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},o=Date.prototype.toISOString,v={delimiter:"&",encode:!0,encoder:O.encode,encodeValuesOnly:!1,serializeDate:function(t){return o.call(t)},skipNulls:!1,strictNullHandling:!1};e.exports=function(t,e){var r=t,t=e?O.assign({},e):{};if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=(void 0===t.delimiter?v:t).delimiter,o=("boolean"==typeof t.strictNullHandling?t:v).strictNullHandling,i=("boolean"==typeof t.skipNulls?t:v).skipNulls,n=("boolean"==typeof t.encode?t:v).encode,s=("function"==typeof t.encoder?t:v).encoder,a="function"==typeof t.sort?t.sort:null,c=void 0!==t.allowDots&&t.allowDots,l=("function"==typeof t.serializeDate?t:v).serializeDate,f=("boolean"==typeof t.encodeValuesOnly?t:v).encodeValuesOnly;if(void 0===t.format)t.format=R.default;else if(!Object.prototype.hasOwnProperty.call(R.formatters,t.format))throw new TypeError("Unknown format option provided.");var u,d=R.formatters[t.format],h=("function"==typeof t.filter?r=(u=t.filter)("",r):Array.isArray(t.filter)&&(A=u=t.filter),[]);if("object"!=typeof r||null===r)return"";var p=t.arrayFormat in _?t.arrayFormat:!("indices"in t)||t.indices?"indices":"repeat",y=_[p],A=A||Object.keys(r);a&&A.sort(a);for(var b=0;b<A.length;++b){var m=A[b];i&&null===r[m]||(h=h.concat(g(r[m],m,y,o,i,n?s:null,u,a,c,l,d,f)))}p=h.join(e),e=!0===t.addQueryPrefix?"?":"";return 0<p.length?e+p:""}},{"./formats":1,"./utils":5}],5:[function(t,e,r){function s(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},o=0;o<t.length;++o)void 0!==t[o]&&(r[o]=t[o]);return r}var a=Object.prototype.hasOwnProperty,n=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}();e.exports={arrayToObject:s,assign:function(t,r){return Object.keys(r).reduce(function(t,e){return t[e]=r[e],t},t)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],o=0;o<e.length;++o)for(var i=e[o],n=i.obj[i.prop],s=Object.keys(n),a=0;a<s.length;++a){var c=s[a],l=n[c];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(e.push({obj:n,prop:c}),r.push(l))}for(var f=e;f.length;){var u=f.pop(),d=u.obj[u.prop];if(Array.isArray(d)){for(var h=[],p=0;p<d.length;++p)void 0!==d[p]&&h.push(d[p]);u.obj[u.prop]=h}}return d},decode:function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},encode:function(t){if(0===t.length)return t;for(var e="string"==typeof t?t:String(t),r="",o=0;o<e.length;++o){var i=e.charCodeAt(o);45===i||46===i||95===i||126===i||48<=i&&i<=57||65<=i&&i<=90||97<=i&&i<=122?r+=e.charAt(o):i<128?r+=n[i]:i<2048?r+=n[192|i>>6]+n[128|63&i]:i<55296||57344<=i?r+=n[224|i>>12]+n[128|i>>6&63]+n[128|63&i]:(o+=1,i=65536+((1023&i)<<10|1023&e.charCodeAt(o)),r+=n[240|i>>18]+n[128|i>>12&63]+n[128|i>>6&63]+n[128|63&i])}return r},isBuffer:function(t){return null!=t&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},merge:function o(r,i,n){if(!i)return r;if("object"!=typeof i){if(Array.isArray(r))r.push(i);else{if("object"!=typeof r)return[r,i];!n.plainObjects&&!n.allowPrototypes&&a.call(Object.prototype,i)||(r[i]=!0)}return r}var t;return"object"!=typeof r?[r].concat(i):(t=r,Array.isArray(r)&&!Array.isArray(i)&&(t=s(r,n)),Array.isArray(r)&&Array.isArray(i)?(i.forEach(function(t,e){a.call(r,e)?r[e]&&"object"==typeof r[e]?r[e]=o(r[e],t,n):r.push(t):r[e]=t}),r):Object.keys(i).reduce(function(t,e){var r=i[e];return a.call(t,e)?t[e]=o(t[e],r,n):t[e]=r,t},t))}}},{}]},{},[2])(2)});const MAP_OPTIONS={domain:"https://api.map.baidu.com",KEY:"bBk6VKyCi8pmGnnvTsSr6ULPY86JdBCV"},isMiniprogram=!window;class Request{constructor(t=MAP_OPTIONS.KEY,e=MAP_OPTIONS.SECRET){this.key=t,this.secret=e}setLocaleCompare(t){return t.ak=this.key,t.output="json",Object.fromEntries(Object.entries(t).sort(([t],[e])=>t.localeCompare(e)))}getSign(t){return md5(""+decodeURIComponent(qs.stringify(this.setLocaleCompare(t)))+this.secret)}get(t,e){return this.request("GET",t,e)}async request(e,r,t={}){const o=this.getSign(t,r),i={...this.setLocaleCompare(t),sig:o};if(isMiniprogram){wx.showNavigationBarLoading();try{return new Promise((o,t)=>{wx.request({url:""+MAP_OPTIONS.domain+r,data:i,method:e,header:{"content-type":"application/json"},success:({data:t})=>{var{status:e,result:r}=t;0===e?o(r||t):wx.showToast({title:"errMsg",icon:"error"})},fail:t})})}catch(t){throw wx.hideLoading(),console.error("接口异常:",t),wx.showToast({title:"系统异常",icon:"error"}),t}finally{wx.hideNavigationBarLoading()}}else{const n=[];Object.keys(i).map(t=>{n.push(t+"="+encodeURIComponent(i[t]))});try{const t=await(await window.fetch(""+MAP_OPTIONS.domain+r+"?"+n.join("&"),{method:e})).json();if("1"==t.status)return t;throw t.info}catch(t){throw console.error("接口异常:",t),t}}}}class GlMapApi{constructor(t={}){var{key:t,secret:e}=t;this.request=new Request(t,e)}calculateHaversineDistance(t,e){var r=t[0]*Math.PI/180,o=e[0]*Math.PI/180,i=(e[0]-t[0])*Math.PI/180,e=(e[1]-t[1])*Math.PI/180,t=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(o)*Math.sin(e/2)*Math.sin(e/2);return 6371e3*(2*Math.atan2(Math.sqrt(t),Math.sqrt(1-t)))}async calculateDistance(t,e,r=1,o={}){try{var i,n,s,a;return 0==r?{elements:[{distance:this.calculateHaversineDistance(t,e)}]}:(i={1:"driving",2:"riding",3:"walking"},n=JSON.parse(JSON.stringify(t)).join(","),s=JSON.parse(JSON.stringify(e)).join(","),a=(await this.request.get("/direction/v2/"+i[r],{destination:n,origin:s,...o}))["routes"],{elements:a[0]})}catch(t){throw t}}async calculateDistanceMatrix(t,e,r=1,o={}){try{var i={1:"driving",3:"walking"},n=JSON.parse(JSON.stringify(t)).join(","),s=JSON.parse(JSON.stringify(e)).join("|"),a={rows:[{elements:await this.request.get("/routematrix/v2/"+i[r],{destinations:s,origins:n,...o})}]};return Promise.resolve(a)}catch(t){return Promise.reject(t)}}geocoder(t,e={}){return this.request.get("/geocoding/v3",{address:t,...e})}async detailedAdrress(t,e={}){try{var[r,o]=t,i=await this.request.get("/reverse_geocoding/v3",{location:r+`,${o}}`,...e}),{addressComponent:n,formatted_address:s,cityCode:a}=i,c=""+(n.province||"")+(n.city||"")+(n.district||"")+(n.town||""),l={...i,address:c,formatted_addresses:{recommend:s,rough:s,standard_address:s},address_component:{city:n.city,district:n.district,nation:n.country,province:n.province,street:n.town},ad_info:{adcode:n.adcode,city:n.city,city_code:a,district:n.district,location:{lat:r,lng:o},name:""+(n.country+","||"")+(n.province+","||"")+(n.city+","||"")+(n.district||""),nation:n.country,nation_code:"",phone_area_code:a,province:n.province},location:{lat:r,lng:o}};return Promise.resolve(l)}catch(t){return Promise.reject(t)}}getLocationByIp(t={}){return this.request.get("/location/ip",t)}translate(t,e=1,r={}){t=JSON.parse(JSON.stringify(t)).map(t=>t.reverse()).join(";");return this.request.get("/geoconv/v2/",{coords:t,model:e,...r})}async routePlanning(t,e,r=3,o={}){try{var i={3:"driving",2:"riding",1:"walking"},n=JSON.parse(JSON.stringify(t)).join(","),s=JSON.parse(JSON.stringify(e)).join(","),a=(await this.request.get("/direction/v2/"+i[r],{destination:s,origin:n,...o}))["routes"];return Promise.resolve(a)}catch(t){return Promise.reject(t)}}async keywordSearch(t,e=[],r={}){try{var o=await this.request.get("/place/v2/suggestion",{query:t,location:JSON.parse(JSON.stringify(e)).join(","),...r});return Promise.resolve(o)}catch(t){return Promise.reject(t)}}}return GlMapApi});