tg-map-vue3 3.9.9 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +4 -1
- package/dist/src/components/TgMap.vue.d.ts +1877 -83
- package/dist/src/components/TgMapWidget.vue.d.ts +3 -3
- package/dist/src/components/controls/TgCustomControl.vue.d.ts +1 -2
- package/dist/src/components/controls/TgMapTypeControl.vue.d.ts +8 -9
- package/dist/src/components/controls/TgScaleControl.vue.d.ts +4 -5
- package/dist/src/components/controls/TgStreetViewControl.vue.d.ts +4 -4
- package/dist/src/components/controls/TgZoomControl.vue.d.ts +4 -4
- package/dist/src/components/extra/TgHeatmap.vue.d.ts +2 -2
- package/dist/src/components/extra/TgMarkerClusterer.vue.d.ts +3 -4
- package/dist/src/components/index.d.ts +4 -41
- package/dist/src/components/layers/TgTrafficLayer.vue.d.ts +1 -1
- package/dist/src/components/map-hooks.d.ts +4 -4
- package/dist/src/components/map-mixin.d.ts +2 -2
- package/dist/src/components/overlays/TgCircle.vue.d.ts +19 -14
- package/dist/src/components/overlays/TgElementOverlay.vue.d.ts +5 -7
- package/dist/src/components/overlays/TgInfoBox.vue.d.ts +5 -7
- package/dist/src/components/overlays/TgInfoWindow.vue.d.ts +16 -17
- package/dist/src/components/overlays/TgLabel.vue.d.ts +4 -7
- package/dist/src/components/overlays/TgMarker.vue.d.ts +89 -45
- package/dist/src/components/overlays/TgPolygon.vue.d.ts +64 -27
- package/dist/src/components/overlays/TgPolyline.vue.d.ts +16 -12
- package/dist/src/components/overlays/TgRectangle.vue.d.ts +28 -27
- package/dist/src/utils/hooks.d.ts +4 -0
- package/dist/src/utils/vue-utils.d.ts +13 -2
- package/dist/tg-map.cjs +2 -17
- package/dist/tg-map.cjs.map +1 -1
- package/dist/tg-map.js +679 -6481
- package/dist/tg-map.js.map +1 -1
- package/package.json +14 -13
- package/dist/src/map/event-target.d.ts +0 -71
- package/dist/src/map/event.d.ts +0 -46
- package/dist/src/map/lat-lng.d.ts +0 -157
- package/dist/src/map/map/baidu-map.d.ts +0 -82
- package/dist/src/map/map/controls/control.d.ts +0 -112
- package/dist/src/map/map/controls/map-type.control.d.ts +0 -29
- package/dist/src/map/map/controls/scale.control.d.ts +0 -15
- package/dist/src/map/map/controls/street-view.control.d.ts +0 -20
- package/dist/src/map/map/controls/zoom.control.d.ts +0 -15
- package/dist/src/map/map/extra/autocomplete.d.ts +0 -41
- package/dist/src/map/map/extra/heatmap.d.ts +0 -71
- package/dist/src/map/map/extra/map-urls.d.ts +0 -59
- package/dist/src/map/map/extra/marker-clusterer.d.ts +0 -73
- package/dist/src/map/map/extra/places-service.d.ts +0 -46
- package/dist/src/map/map/extra/search-box.d.ts +0 -38
- package/dist/src/map/map/google-map.d.ts +0 -81
- package/dist/src/map/map/here-map.d.ts +0 -78
- package/dist/src/map/map/map-options.d.ts +0 -60
- package/dist/src/map/map/map-type.d.ts +0 -110
- package/dist/src/map/map/map.d.ts +0 -168
- package/dist/src/map/map/overlay/baidu-info-box.d.ts +0 -82
- package/dist/src/map/map/overlay/circle.d.ts +0 -51
- package/dist/src/map/map/overlay/element-overlay.d.ts +0 -37
- package/dist/src/map/map/overlay/google-label.d.ts +0 -68
- package/dist/src/map/map/overlay/icon.d.ts +0 -122
- package/dist/src/map/map/overlay/info-box.d.ts +0 -60
- package/dist/src/map/map/overlay/info-window.d.ts +0 -111
- package/dist/src/map/map/overlay/label.d.ts +0 -102
- package/dist/src/map/map/overlay/marker-label.d.ts +0 -19
- package/dist/src/map/map/overlay/marker.d.ts +0 -143
- package/dist/src/map/map/overlay/overlay.d.ts +0 -46
- package/dist/src/map/map/overlay/polygon.d.ts +0 -42
- package/dist/src/map/map/overlay/polyline.d.ts +0 -71
- package/dist/src/map/map/overlay/rectangle.d.ts +0 -50
- package/dist/src/map/map/overlay/shape.d.ts +0 -65
- package/dist/src/map/map-config.d.ts +0 -25
- package/dist/src/map/map-factory.d.ts +0 -10
- package/dist/src/map/map-loader.d.ts +0 -19
- package/dist/src/map/types.d.ts +0 -17
- package/dist/src/map/unions.d.ts +0 -19
- package/dist/src/utils/arrays.d.ts +0 -19
- package/dist/src/utils/baidu-utils.d.ts +0 -23
- package/dist/src/utils/elements.d.ts +0 -4
- package/dist/src/utils/formatter.d.ts +0 -1
- package/dist/src/utils/google-utils.d.ts +0 -34
- package/dist/src/utils/here-utils.d.ts +0 -10
- package/dist/src/utils/mapped-types.d.ts +0 -90
- package/dist/src/utils/maps-utils/index.d.ts +0 -2
- package/dist/src/utils/maps-utils/math-util.d.ts +0 -59
- package/dist/src/utils/maps-utils/poly-util.d.ts +0 -103
- package/dist/src/utils/maps-utils/spherical-util.d.ts +0 -67
- package/dist/src/utils/objects.d.ts +0 -27
- package/dist/src/utils/spherical-utils.d.ts +0 -27
- package/dist/src/utils/strings.d.ts +0 -21
- package/dist/src/utils/utils.d.ts +0 -13
- package/dist/src/utils/values.d.ts +0 -34
- package/src/map/dts/baidu.d.ts +0 -53
- package/src/map/dts/google.d.ts +0 -10
- package/src/map/dts/here-v31.d.ts +0 -16
- package/src/map/dts/index.d.ts +0 -4
- package/src/map/dts/js-modules.d.ts +0 -15
package/dist/tg-map.cjs
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
2
|
-
"use strict";var ci=Object.defineProperty;var di=(i,t,e)=>t in i?ci(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var m=(i,t,e)=>di(i,typeof t!="symbol"?t+"":t,e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const O=require("tg-commons"),C=require("vue");function ee(i,t,e){Object.keys(i).forEach(r=>{r.startsWith("update:")||e!=null&&e.includes(r)||t.addEventListener(r,i[r])})}let ui=1;function pi(){return ui++}function je(i,t){return t.__id__||(t.__id__=pi()),`${i}::${t.__id__}`}function et(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ze={exports:{}},gi=Ze.exports,nr;function mi(){return nr||(nr=1,function(i){(function(t,e){i.exports?i.exports=e():t.coordtransform=e()})(gi,function(){var t=52.35987755982988,e=3.141592653589793,r=6378245,n=.006693421622965943;function s(l,d,f,v){this.west=Math.min(l,f),this.north=Math.max(d,v),this.east=Math.max(l,f),this.south=Math.min(d,v)}s.prototype.contain=function(l,d){return this.west<=l&&this.east>=l&&this.north>=d&&this.south<=d};var a=[new s(79.4462,49.2204,96.33,42.8899),new s(109.6872,54.1415,135.0002,39.3742),new s(73.1246,42.8899,124.143255,29.5297),new s(82.9684,29.5297,97.0352,26.7186),new s(97.0253,29.5297,124.367395,20.414096),new s(107.975793,20.414096,111.744104,17.871542)],h=[new s(119.921265,25.398623,122.497559,21.785006),new s(101.8652,22.284,106.665,20.0988),new s(106.4525,21.5422,108.051,20.4878),new s(109.0323,55.8175,119.127,50.3257),new s(127.4568,55.8175,137.0227,49.5574),new s(131.2662,44.8922,137.0227,42.5692),new s(73.1246,35.398637,77.948114,29.5297)],o=[new s(114.505238,22.138258,113.845,22.428903),new s(113.97,22.507833,114.45,22.428903)];function c(l,d,f=!0){for(var v=0;v<a.length;v++)if(a[v].contain(l,d)){for(var w=0;w<h.length;w++)if(h[w].contain(l,d))return!1;if(f){for(var w=0;w<o.length;w++)if(o[w].contain(l,d))return!1}return!0}return!1}function p(l,d){var f=l-.0065,v=d-.006,w=Math.sqrt(f*f+v*v)-2e-5*Math.sin(v*t),P=Math.atan2(v,f)-3e-6*Math.cos(f*t),E=w*Math.cos(P),S=w*Math.sin(P);return[E,S]}function u(l,d){var f=Math.sqrt(l*l+d*d)+2e-5*Math.sin(d*t),v=Math.atan2(d,l)+3e-6*Math.cos(l*t),w=f*Math.cos(v)+.0065,P=f*Math.sin(v)+.006;return[w,P]}function g(l,d){return _(l,d)}function y(l,d){var f=_(l,d);return[l*2-f[0],d*2-f[1]]}function _(l,d){var f=M(l-105,d-35),v=b(l-105,d-35),w=d/180*e,P=Math.sin(w);P=1-n*P*P;var E=Math.sqrt(P);f=f*180/(r*(1-n)/(P*E)*e),v=v*180/(r/E*Math.cos(w)*e);var S=d+f,D=l+v;return[D,S]}function M(l,d){var f=-100+2*l+3*d+.2*d*d+.1*l*d+.2*Math.sqrt(Math.abs(l));return f+=(20*Math.sin(6*l*e)+20*Math.sin(2*l*e))*2/3,f+=(20*Math.sin(d*e)+40*Math.sin(d/3*e))*2/3,f+=(160*Math.sin(d/12*e)+320*Math.sin(d*e/30))*2/3,f}function b(l,d){var f=300+l+2*d+.1*l*l+.1*l*d+.1*Math.sqrt(Math.abs(l));return f+=(20*Math.sin(6*l*e)+20*Math.sin(2*l*e))*2/3,f+=(20*Math.sin(l*e)+40*Math.sin(l/3*e))*2/3,f+=(150*Math.sin(l/12*e)+300*Math.sin(l/30*e))*2/3,f}return{rawBd09ToGcj02:p,rawGcj02ToBd09:u,rawWgs84ToGcj02:g,rawGcj02ToWgs84:y,bd09ToGcj02:p,gcj02ToBd09:u,wgs84ToGcj02:function(l,d){return c(l,d)?g(l,d):[l,d]},gcj02ToWgs84:function(l,d){return c(l,d)?y(l,d):[l,d]},bd09ToWgs84:function(l,d){if(!c(l,d,!1))return[l,d];var f=p(l,d);return y(f[0],f[1])},wgs84ToBd09:function(l,d){if(!c(l,d,!1))return[l,d];var f=g(l,d);return u(f[0],f[1])}}})}(Ze)),Ze.exports}var fi=mi();const ae=et(fi);function yi(i,t){return i instanceof t}function vi(i,t){if(i instanceof t)return i}function Ve(i,t){return(i==null?void 0:i.$options.name)===t.name}function Zt(i,t){return Ve(i,t)?i:void 0}function tt(i,t,e){let r=t;for(;r;){if(Ve(r,i))return r;if(e&&Ve(r,e))return;r=r.$parent}}function _i(i){return i}var z=(i=>(i.wgs84="wgs84",i.gcj02="gcj02",i.bd09="bd09",i))(z||{});const kt="wgs84",G=class G{constructor(t,e,r){this.lat=t,this.lng=e,this.coord=r,O.noop()}static _normalize(t,e){const r=e>90?90:e<-90?-90:e;return[t>180?(t+180)%360-180:t<-180?(t-180)%360+180:t,r]}static fromBaidu(t,e){return new G(t.lat,t.lng,e)}static fromGoogle(t,e){return new G(t.lat(),t.lng(),e)}static fromHere(t,e){return new G(t.lat,t.lng,e)}static fromLiteral(t){return new G(t.lat,t.lng,t.coord||kt)}static fromLngLat(t,e,r=kt){return new G(e,t,r)}static create(t,e,r=kt){return new G(t,e,r)}to(t){const e=t;if(this.coord===e)return this;const[r,n]=this._convert(e);return new G(n,r,e)}toBaidu(t,e=!1){let r=this.lat,n=this.lng;return this.coord!==t&&([n,r]=this._convert(t)),e&&([n,r]=G._normalize(n,r)),new BMap.Point(n,r)}toGoogle(t){let e=this.lat,r=this.lng;return this.coord!==t&&([r,e]=this._convert(t)),new google.maps.LatLng(e,r)}toHere(t){let e=this.lat,r=this.lng;return this.coord!==t&&([r,e]=this._convert(t)),new H.geo.Point(e,r)}_convert(t){switch(this.coord){case"bd09":return t==="gcj02"?ae.bd09ToGcj02(this.lng,this.lat):ae.bd09ToWgs84(this.lng,this.lat);case"gcj02":return t==="wgs84"?ae.gcj02ToWgs84(this.lng,this.lat):ae.gcj02ToBd09(this.lng,this.lat);case"wgs84":return t==="bd09"?ae.wgs84ToBd09(this.lng,this.lat):ae.wgs84ToGcj02(this.lng,this.lat)}throw new Error(`不支持的坐标转换: ${this.coord}=>${t}`)}normalize(){const[t,e]=G._normalize(this.lng,this.lat);return e===this.lat&&t===this.lng?this:new G(e,t,this.coord)}equals(t){return this===t?!0:this.lat===t.lat&&this.lng===t.lng&&this.coord===t.coord}toString(){return JSON.stringify(this)}};m(G,"ZERO",G.create(0,0));let x=G;const re=class re{constructor(t,e){m(this,"coord");this.sw=t,this.ne=e,O.assert(t.coord===e.coord,"sw和ne的coord应该相同"),O.assert(Number.isFinite(t.lat)&&Number.isFinite(t.lng)&&Number.isFinite(e.lat)&&Number.isFinite(e.lng),`sw(${t})和ne(${e})不能包含NaN或Infinite`),O.assert(t.lat<=e.lat,`sw.lat(${t.lat})应该比ne.lat(${e.lat})小`),this.coord=t.coord}static isBetweenLng(t,e,r){return t<=e?t<=r&&r<=e:t<=r||r<=e}static fromArray(t){if(t.length===0)return;const e=new re.Builder(t[0]);for(let r=1;r<t.length;r++)e.include(t[r]);return e.build()}static from(...t){return this.fromArray(t)??O.throwError("positions中没有点")}static fromGoogle(t,e){return new re(x.fromGoogle(t.getSouthWest(),e),x.fromGoogle(t.getNorthEast(),e))}static fromBaidu(t,e){return new re(x.fromBaidu(t.getSouthWest(),e),x.fromBaidu(t.getNorthEast(),e))}static create(t,e){return this.from(t,e)}isEmpty(){return this.sw.equals(this.ne)}contains(t){const{lat:e,lng:r}=t.to(this.coord);return this.sw.lat<=e&&e<=this.ne.lat&&re.isBetweenLng(this.sw.lng,this.ne.lng,r)}getCenter(){if(this.sw.equals(this.ne))return this.sw;const t=(this.sw.lat+this.ne.lat)/2,e=(this.sw.lng+this.ne.lng+(this.sw.lng<this.ne.lng?0:360))/2;return x.create(t,e,this.coord)}toString(){return JSON.stringify(this)}equals(t){return this.sw.equals(t.sw)&&this.ne.equals(t.ne)}toRectArray(){const t=this.sw.coord;return[this.sw,x.fromLngLat(this.sw.lng,this.ne.lat,t),this.ne,x.fromLngLat(this.ne.lng,this.sw.lat,t)]}toGoogle(t){return new google.maps.LatLngBounds(this.sw.toGoogle(t),this.ne.toGoogle(t))}toBaidu(t){return new BMap.Bounds(this.sw.toBaidu(t),this.ne.toBaidu(t))}toBaiduArray(t){return[this.sw.toBaidu(t),this.ne.toBaidu(t)]}};m(re,"EMPTY",new re(x.ZERO,x.ZERO));let K=re;(i=>{class t{constructor(r){m(this,"coord");m(this,"minLat");m(this,"minLng");m(this,"maxLat");m(this,"maxLng");this.coord=r.coord,this.minLat=this.maxLat=r.lat,this.minLng=this.maxLng=r.lng}build(){return new i(x.create(this.minLat,this.minLng,this.coord),x.create(this.maxLat,this.maxLng,this.coord))}include(r){const{lat:n,lng:s}=r.to(this.coord);return this.minLat=Math.min(this.minLat,n),this.maxLat=Math.max(this.maxLat,n),i.isBetweenLng(this.minLng,this.maxLng,s)||(this.delta(this.minLng,s)<this.delta(s,this.maxLng)?this.minLng=s:this.maxLng=s),this}delta(r,n){return(r-n+360)%360}}i.Builder=t})(K||(K={}));exports.Location=void 0;(i=>{function t(r,n){if(r==null)return;if(typeof r=="string")return r;const s=r.to(n);return`${s.lat},${s.lng}`}i.toString=t;function e(r){return typeof r=="string"||r==null?void 0:r.coord}i.getCoordType=e})(exports.Location||(exports.Location={}));function yr(){BMap.OverlayV3||(BMap.OverlayV3=BMap.Overlay)}function Mi(){const i=window.$BAIDU$;"kT"in i||Object.defineProperty(i,"kT",{get:()=>i._instances,enumerable:!0,configurable:!0})}const sr={equals(i,t){return i.lat===t.lat&&i.lng===t.lng}};var $t;(i=>{function t(e){return e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight}i.isScrollable=t})($t||($t={}));exports.Arrays=void 0;(i=>{function t(n,s){for(const a of n)if(a instanceof s)return a}i.findByType=t;function e(n,s){return n.includes(s)}i.includesTyped=e;function r(n,s,a){const h=s>=0?s:n.length+s;if(a===void 0)return n[h];n[h]=a}i.at=r})(exports.Arrays||(exports.Arrays={}));exports.MVCArrays=void 0;(i=>{function t(n,s){const a=n.getLength();for(let h=0;h<a;h++)if(n.getAt(h)===s)return h;return-1}i.indexOf=t;function e(n,s){const a=t(n,s);if(a!==-1)return n.removeAt(a)}i.remove=e;function r(n,s){return[n.addListener("insert_at",s),n.addListener("remove_at",s),n.addListener("set_at",s)]}i.listenChanged=r})(exports.MVCArrays||(exports.MVCArrays={}));function vr(i,t,e){return i.addListener(t,e).remove}function bi(i,t,e){return i.addEventListener(t,e),()=>i.removeEventListener(t,e)}function Ci(i,t,e,r){return i.addEventListener(t,e,r),()=>i.removeEventListener(t,e,r)}function or(i,t,e){return i.addEventListener(t,e),()=>i.removeEventListener(t,e)}class _r{constructor(t,e){m(this,"eventMap",new Map);m(this,"target",O.lateinit());this.inner=t,this.coordTypeSupplier=e,this.addEventListener=this.addEventListener.bind(this),this.removeEventListener=this.removeEventListener.bind(this)}setTarget(t){return this.target=t,this}}class rt{constructor(t,e){m(this,"eventHub",new Mr);this.delegate=t,this.options=e}notify(t){this.eventHub.notify(t)}hasListener(t){return this.eventHub.hasListener(t)}setTarget(t){return this.delegate.setTarget(t),this}addEventListener(t,e){if(exports.Arrays.includesTyped(this.options.types,t)){this.eventHub.hasListener(t)||this.options.onListen(t),this.eventHub.addEventListener(t,e);return}this.delegate.addEventListener(t,e)}removeEventListener(t,e){if(exports.Arrays.includesTyped(this.options.types,t)){this.eventHub.removeEventListener(t,e),this.eventHub.hasListener(t)||this.options.onCancel(t);return}this.delegate.removeEventListener(t,e)}}const Qe=class Qe extends _r{addEventListener(t,e){const r=je(t,e);if(this.eventMap.get(r)){console.warn("listener已经添加过了",r,e);return}const n=this.inner.addListener(Qe.EVENT_TYPE_MAP[t]||t,s=>{const a={type:t,target:this.target,originalEvent:s};s!=null&&s.latLng&&(a.position=x.fromGoogle(s.latLng,this.coordTypeSupplier.coordType)),e.call(this.target,a)});this.eventMap.set(r,n)}removeEventListener(t,e){const r=je(t,e),n=this.eventMap.get(r);n?(n.remove(),this.eventMap.delete(r)):console.warn("移除失败, 不存在该listener",r,e)}};m(Qe,"EVENT_TYPE_MAP",{"center-changed":"center_changed","zoom-changed":"zoom_changed","radius-changed":"radius_changed","bounds-changed":"bounds_changed","map-type-changed":"maptypeid_changed","map-mousedown":"mousedown","map-mousemove":"mousemove","map-mouseup":"mouseup","map-dblclick":"dblclick"});let de=Qe;const Ee=class Ee extends _r{addEventListener(t,e){const r=je(t,e);if(this.eventMap.get(r)){console.warn("listener已经添加过了",r,e);return}const n=s=>{const a={type:t,target:this.target,originalEvent:s};s.point&&(a.position=x.fromBaidu(s.point,this.coordTypeSupplier.coordType)),e.call(this.target,a)};this.inner.addEventListener(Ee.EVENT_TYPE_MAP[t]||t,n),this.eventMap.set(r,n)}removeEventListener(t,e){const r=je(t,e),n=this.eventMap.get(r);n?(this.inner.removeEventListener(Ee.EVENT_TYPE_MAP[t]||t,n),this.eventMap.delete(r)):console.warn("移除失败, 不存在该listener",r,e)}};m(Ee,"EVENT_TYPE_MAP",{drag:"dragging",closeclick:"clickclose",contextmenu:"rightclick","zoom-changed":"zoomend","map-type-changed":"maptypechange"});let Se=Ee;class Mr{constructor(){m(this,"typeMap",new Map)}addEventListener(t,e){let r=this.typeMap.get(t);r||(r=[],this.typeMap.set(t,r)),!r.includes(e)&&r.push(e)}removeEventListener(t,e){const r=this.typeMap.get(t);r&&O.Arrays.remove(r,e)}hasListener(t){const e=this.typeMap.get(t);return e!=null&&e.length>0}notify(t){const e=this.typeMap.get(t.type);e&&e.forEach(r=>r.call(t.target,t))}}class Gt{constructor(t,e){m(this,"keyToValue",new Map);m(this,"valueToKey",new Map);O.assert(t.length===e.length);for(let r=t.length-1;r>=0;r--)this.keyToValue.set(t[r],e[r]),this.valueToKey.set(e[r],t[r])}toKey(t){return this.valueToKey.get(t)??O.throwError()}toValue(t){return this.keyToValue.get(t)??O.throwError()}}class br{constructor(t,e=10){m(this,"map",new Map);this.values=t,this.maxSize4Debug=e,O.noop()}getValueMap(t){let e=this.map.get(t);if(!e){e=new Map;for(let r=this.values.length-1;r>=0;r--){const n=this.values[r];e.set(t.call(n),n)}this.map.set(t,e),process.env.NODE_ENV!=="production"&&this.map.size>this.maxSize4Debug&&console.warn(`this.map的大小(${this.map.size})超过了设置的最大大小(${this.maxSize4Debug}), 这可能是由于你每次都创建新的keySelector造成的, 请保证相同功能的keySelector只创建一个对象`)}return e}getOrNull(t,e){return this.getValueMap(t).get(e)}get(t,e){return this.getOrNull(t,e)??O.throwError(`key(${e})不存在与valueMap(${this.getValueMap(t)})中`)}}class he{constructor(t){m(this,"value");this.creator=t,O.noop()}get(){return this.value===void 0&&(this.value=this.creator()),this.value}}var R=(i=>(i.TOP_LEFT="top-left",i.TOP_CENTER="top-center",i.TOP_RIGHT="top-right",i.BOTTOM_LEFT="bottom-left",i.BOTTOM_CENTER="bottom-center",i.BOTTOM_RIGHT="bottom-right",i.LEFT_TOP="left-top",i.LEFT_CENTER="left-center",i.LEFT_BOTTOM="left-bottom",i.RIGHT_TOP="right-top",i.RIGHT_CENTER="right-center",i.RIGHT_BOTTOM="right-bottom",i))(R||{});exports.ControlPositionConverter=void 0;(i=>{let t,e;const r=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right","left-top","left-center","left-bottom","right-top","right-center","right-bottom"];function n(){return t||(t=new Gt(r,[BMAP_ANCHOR_TOP_LEFT,BMAP_ANCHOR_TOP_LEFT,BMAP_ANCHOR_TOP_RIGHT,BMAP_ANCHOR_BOTTOM_LEFT,BMAP_ANCHOR_BOTTOM_LEFT,BMAP_ANCHOR_BOTTOM_RIGHT,BMAP_ANCHOR_TOP_LEFT,BMAP_ANCHOR_BOTTOM_LEFT,BMAP_ANCHOR_BOTTOM_LEFT,BMAP_ANCHOR_TOP_RIGHT,BMAP_ANCHOR_BOTTOM_RIGHT,BMAP_ANCHOR_BOTTOM_RIGHT])),t}i.getBaidu=n;function s(){return e||(e=new Gt(r,[google.maps.ControlPosition.TOP_LEFT,google.maps.ControlPosition.TOP_CENTER,google.maps.ControlPosition.TOP_RIGHT,google.maps.ControlPosition.BOTTOM_LEFT,google.maps.ControlPosition.BOTTOM_CENTER,google.maps.ControlPosition.BOTTOM_RIGHT,google.maps.ControlPosition.LEFT_TOP,google.maps.ControlPosition.LEFT_CENTER,google.maps.ControlPosition.LEFT_BOTTOM,google.maps.ControlPosition.RIGHT_TOP,google.maps.ControlPosition.RIGHT_CENTER,google.maps.ControlPosition.RIGHT_BOTTOM])),e}i.getGoogle=s})(exports.ControlPositionConverter||(exports.ControlPositionConverter={}));class Cr{constructor(t){m(this,"inner");this.position=t,O.noop()}}class it{}class Tr extends it{constructor(t,e){super(),this.visible=t,this.position=e}isVisible(){return this.visible}setVisible(t){this.visible=t}getPosition(){return this.position}setPosition(t){this.position=t}addTo(t){}removeFrom(t){}}class nt extends it{constructor(t,e){super(),this.inner=t,this.position=e}isVisible(){return this.inner.isVisible()}setVisible(t){t?this.inner.show():this.inner.hide()}getPosition(){return this.position??exports.ControlPositionConverter.getBaidu().toKey(this.inner.getAnchor())}setPosition(t){this.position=t,this.inner.setAnchor(exports.ControlPositionConverter.getBaidu().toValue(t))}addTo(t){t.innerMap.addControl(this.inner)}removeFrom(t){t.innerMap.removeControl(this.inner)}}class De extends it{constructor(e,r){super();m(this,"visible",!1);m(this,"map");this._type=e,this.position=r}isVisible(){return this.visible}setVisible(e){this.visible=e,this.tryUpdateOptions()}getPosition(){return this.position}setPosition(e){this.position=e,this.tryUpdateOptions()}addTo(e){this.map||(this.map=e,this.setVisible(!0))}removeFrom(){this.map&&(this.setVisible(!1),this.map=void 0)}onCreateOptions(){return{position:exports.ControlPositionConverter.getGoogle().toValue(this.position)}}tryUpdateOptions(){this.map&&this.map.innerMap.setOptions({[`${this._type}Control`]:this.visible,[`${this._type}ControlOptions`]:this.onCreateOptions()})}}var Wt=(i=>(i.normal="normal",i.satellite="satellite",i.hybrid="hybrid",i))(Wt||{});class V{constructor(t,e,r,n){this.id=t,this.baidu=e,this.google=r,this.googleCoordType=n,O.noop()}getId(){return this.id}getBaiduCoordType(){return z.bd09}asBaiduMapType(){return this.baidu()}getGoogleCoordType(){return this.googleCoordType}getGoogleMapTypeId(){return this.google()}asGoogleMapType(){O.throwUnsupported("google的内置地图没有对应的实例")}}class Ti{constructor(t,e){m(this,"baiduLayerCached",new he(()=>{const t=new BMap.TileLayer({});return t.getTilesUrl=(e,r)=>{const n=Math.pow(2,r-1),s=e.x+n,a=n-1-e.y;return this.options.getTileUrl({x:s,y:a},r)},t}));m(this,"baiduMapTypeCached",new he(()=>{const t=new BMap.MapType(this.options.name,this.baiduLayerCached.get(),{maxZoom:this.options.maxZoom,minZoom:this.options.minZoom,tips:this.options.describe});return t.__baidu_map_type__=this,t}));m(this,"googleCached",new he(()=>{const t=new google.maps.ImageMapType({getTileUrl:(e,r)=>this.options.getTileUrl(e,r),tileSize:new google.maps.Size(256,256),name:this.options.name,alt:this.options.describe,maxZoom:this.options.maxZoom,minZoom:this.options.minZoom});return t.__google_map_type__=this,t}));this.coordType=t,this.options=e,O.noop()}get id(){return this.options.id}getBaiduCoordType(){return this.coordType}asBaiduMapType(){return this.baiduMapTypeCached.get()}asBaiduLayer(){return this.baiduLayerCached.get()}getGoogleCoordType(){return this.coordType}asGoogleMapType(){return this.googleCached.get()}asGoogleLayer(){O.throwUnsupported("这个方法不会被调用")}}class Or{constructor(){m(this,"baiduCache",new he(()=>new BMap.TrafficLayer));m(this,"googleCache",new he(()=>new google.maps.TrafficLayer))}asBaiduLayer(){return this.baiduCache.get()}asGoogleLayer(){return this.googleCache.get()}}exports.MapType=void 0;(i=>{i.NORMAL=new V("normal",()=>BMAP_NORMAL_MAP,()=>google.maps.MapTypeId.ROADMAP,z.gcj02),i.SATELLITE=new V("satellite",()=>BMAP_SATELLITE_MAP,()=>google.maps.MapTypeId.SATELLITE,z.wgs84),i.HYBRID=new V("hybrid",()=>BMAP_HYBRID_MAP,()=>google.maps.MapTypeId.HYBRID,z.gcj02),i.TERRAIN=new V("terrain",()=>BMAP_PERSPECTIVE_MAP,()=>google.maps.MapTypeId.TERRAIN,z.wgs84),i.BUILD_IN_MAP_TYPES=new br([i.NORMAL,i.SATELLITE,i.HYBRID,i.TERRAIN])})(exports.MapType||(exports.MapType={}));var Ht=(i=>(i.DEFAULT="default",i.HORIZONTAL="horizontal",i.DROPDOWN="dropdown",i))(Ht||{});const wr=[exports.MapType.NORMAL,exports.MapType.SATELLITE,exports.MapType.HYBRID];class st extends nt{static create(t){const e=t.mapTypes??wr,r={default:BMAP_MAPTYPE_CONTROL_HORIZONTAL,horizontal:BMAP_MAPTYPE_CONTROL_HORIZONTAL,dropdown:BMAP_MAPTYPE_CONTROL_DROPDOWN},n=new BMap.MapTypeControl({type:t.type&&r[t.type],mapTypes:e.map(s=>s.asBaiduMapType())});return t.position&&n.setAnchor(exports.ControlPositionConverter.getBaidu().toValue(t.position)),new st(n,t.position)}}const se=class se extends De{constructor(t="default",e=R.TOP_LEFT,r=wr){super("mapType",e),this.type=t,this.mapTypes=r,se.type2google||(se.type2google={default:google.maps.MapTypeControlStyle.DEFAULT,horizontal:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,dropdown:google.maps.MapTypeControlStyle.DROPDOWN_MENU})}static create(t){return new se(t.type,t.position,t.mapTypes)}onCreateOptions(){const t=super.onCreateOptions();return t.style=se.type2google[this.type],t.mapTypeIds=this.mapTypes.map(e=>e instanceof V?e.getGoogleMapTypeId():e.id),t}addTo(t){super.addTo(t),this.mapTypes.forEach(e=>{e instanceof V||t.innerMap.mapTypes.set(e.id,e.asGoogleMapType())})}};m(se,"type2google");let Fe=se;class ot extends nt{static create(t){const e=new BMap.ScaleControl({anchor:t.position&&exports.ControlPositionConverter.getBaidu().toValue(t.position)});return new ot(e,t.position)}}class at extends De{static create(t){return new at(t.position)}constructor(t=R.BOTTOM_RIGHT){super("scale",t)}}class lt extends Tr{static create(t){return new lt(!0,t.position??R.RIGHT_BOTTOM)}}class ht extends De{static create(t){return new ht(t.position)}constructor(t=R.RIGHT_BOTTOM){super("streetView",t)}}class ct extends nt{static create(t){const e=new BMap.NavigationControl({type:BMAP_NAVIGATION_CONTROL_ZOOM,anchor:t.position&&exports.ControlPositionConverter.getBaidu().toValue(t.position)});return new ct(e,t.position)}}class dt extends De{static create(t){return new dt(t.position)}constructor(t=R.RIGHT_BOTTOM){super("zoom",t)}}let Oi,wi;const ie={get LATLNG_ZERO(){return Oi??(Oi=new google.maps.LatLng({lat:0,lng:0}))},get BOUNDS_ZERO(){return wi??(wi=new google.maps.LatLngBounds(this.LATLNG_ZERO,this.LATLNG_ZERO))}};function xr(i,t={country:"",province:"",city:"",district:"",street:"",streetNumber:""}){for(const e of i)for(const r of e.types)switch(r){case"street_number":t.streetNumber=e.long_name;break;case"route":t.street=e.long_name;break;case"locality":t.city=e.long_name;break;case"sublocality":t.district=e.long_name;break;case"administrative_area_level_1":t.province=e.long_name;break;case"country":t.country=e.long_name;break}return t}function Pr(i,t){var r;const e=i.address_components&&xr(i.address_components);return{country:(e==null?void 0:e.country)??"",province:(e==null?void 0:e.province)??"",city:(e==null?void 0:e.city)??"",id:i.place_id??"",address:i.formatted_address??"",position:x.fromGoogle(((r=i.geometry)==null?void 0:r.location)??ie.LATLNG_ZERO,t.coordType),title:i.name??""}}class jt{}class Lr extends jt{constructor(e,r){super();m(this,"inner");this.map=e,this.inner=new google.maps.places.Autocomplete(r.input,{fields:["address_components","name"]}),r.bindToMap&&this.inner.bindTo("bounds",e.innerMap)}setBounds(e){this.inner.setBounds(e.toGoogle(this.map.coordType))}addResultListener(e){return vr(this.inner,"place_changed",()=>{const r=this.inner.getPlace(),n={title:r.name??"",province:"",city:"",district:"",street:"",streetNumber:"",country:""};r.address_components&&xr(r.address_components,n),e(n)})}}class Er extends jt{constructor(e,r){super();m(this,"inner");m(this,"input");m(this,"removeableArray",[]);if(this.map=e,this.input=r.input,this.inner=new BMap.Autocomplete({input:r.input,location:r.bindToMap?e.innerMap:void 0}),r.bindToMap){const n=()=>{this.inner.setLocation(this.map.innerMap)};this.removeableArray.push(or(this.map,"center-changed",n)),this.removeableArray.push(or(this.map,"zoom-changed",n))}}setBounds(e){this.inner.setLocation(e.getCenter().toBaidu(this.map.coordType))}addResultListener(e){let r=0;const n=bi(this.inner,"confirm",a=>{const h=a.item.value;r=Date.now(),e(Object.assign({title:h.business,country:""},h))}),s=Ci(this.input,"keyup",a=>{a.key==="Enter"&&Date.now()-r>100&&e({title:this.input.value,country:"",city:"",district:"",province:"",street:"",streetNumber:""})});return()=>{s(),n()}}}var We={exports:{}},xi=We.exports,ar;function Pi(){return ar||(ar=1,function(i,t){(function(e,r){i.exports=r()})(xi,function(){const e=function(){var s={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.45:"rgb(0,0,255)",.55:"rgb(0,255,255)",.65:"rgb(0,255,0)",.95:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},a=function(){var y=function(b){this._coordinator={},this._data=[],this._radi=[],this._min=0,this._max=1,this._xField=b.xField||b.defaultXField,this._yField=b.yField||b.defaultYField,this._valueField=b.valueField||b.defaultValueField,b.radius&&(this._cfgRadius=b.radius)},_=s.defaultRadius;return y.prototype={_organiseData:function(M,b){var l=M[this._xField],d=M[this._yField],f=this._radi,v=this._data,w=this._max,P=this._min,E=M[this._valueField]||1,S=M.radius||this._cfgRadius||_;return v[l]||(v[l]=[],f[l]=[]),v[l][d]?v[l][d]+=E:(v[l][d]=E,f[l][d]=S),v[l][d]>w?(b?this.setDataMax(v[l][d]):this._max=v[l][d],!1):{x:l,y:d,value:E,radius:S,min:P,max:w}},_unOrganizeData:function(){var M=[],b=this._data,l=this._radi;for(var d in b)for(var f in b[d])M.push({x:d,y:f,radius:l[d][f],value:b[d][f]});return{min:this._min,max:this._max,data:M}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var M=arguments[0],b=M.length;b--;)this.addData.call(this,M[b]);else{var l=this._organiseData(arguments[0],!0);l&&this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[l]})}return this},setData:function(M){var b=M.data,l=b.length;this._data=[],this._radi=[];for(var d=0;d<l;d++)this._organiseData(b[d],!1);return this._max=M.max,this._min=M.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(M){return this._max=M,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(M){return this._min=M,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(M){this._coordinator=M},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},y}(),h=function(){var y=function(l){var d=l.gradient||l.defaultGradient,f=document.createElement("canvas"),v=f.getContext("2d");f.width=256,f.height=1;var w=v.createLinearGradient(0,0,256,1);for(var P in d)w.addColorStop(P,d[P]);return v.fillStyle=w,v.fillRect(0,0,256,1),v.getImageData(0,0,256,1).data},_=function(l,d){var f=document.createElement("canvas"),v=f.getContext("2d"),w=l,P=l;if(f.width=f.height=l*2,d==1)v.beginPath(),v.arc(w,P,l,0,2*Math.PI,!1),v.fillStyle="rgba(0,0,0,1)",v.fill();else{var E=v.createRadialGradient(w,P,l*d,w,P,l);E.addColorStop(0,"rgba(0,0,0,1)"),E.addColorStop(1,"rgba(0,0,0,0)"),v.fillStyle=E,v.fillRect(0,0,2*l,2*l)}return f},M=function(P){for(var d=[],f=P.min,v=P.max,w=P.radi,P=P.data,E=Object.keys(P),S=E.length;S--;)for(var D=E[S],I=Object.keys(P[D]),j=I.length;j--;){var k=I[j],N=P[D][k],U=w[D][k];d.push({x:D,y:k,value:N,radius:U})}return{min:f,max:v,data:d}};function b(l){var d=l.element,f=this.shadowCanvas=document.createElement("canvas"),v=this.canvas=l.canvas||document.createElement("canvas");this._renderBoundaries=[1e4,1e4,0,0];var w=getComputedStyle(l.element)||{};v.className="heatmap-canvas",this._width=v.width=f.width=+w.width.replace(/px/,""),this._height=v.height=f.height=+w.height.replace(/px/,""),this.shadowCtx=f.getContext("2d"),this.ctx=v.getContext("2d"),v.style.cssText=f.style.cssText="position:absolute;left:0;top:0;",d.style.position="relative",d.appendChild(v),this._palette=y(l),this._templates={},this._setStyles(l)}return b.prototype={renderPartial:function(l){this._drawAlpha(l),this._colorize()},renderAll:function(l){this._clear(),this._drawAlpha(M(l)),this._colorize()},_updateGradient:function(l){this._palette=y(l)},updateConfig:function(l,d){l.gradient!==d.gradient&&this._updateGradient(l),this._setStyles(l)},setDimensions:function(l,d){this._width=l,this._height=d,this.canvas.width=this.shadowCanvas.width=l,this.canvas.height=this.shadowCanvas.height=d},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(l){this._blur=l.blur==0?0:l.blur||l.defaultBlur,l.backgroundColor&&(this.canvas.style.backgroundColor=l.backgroundColor),this._opacity=(l.opacity||0)*255,this._maxOpacity=(l.maxOpacity||l.defaultMaxOpacity)*255,this._minOpacity=(l.minOpacity||l.defaultMinOpacity)*255,this._useGradientOpacity=!!l.useGradientOpacity},_drawAlpha:function(v){for(var d=this._min=v.min,f=this._max=v.max,v=v.data||[],w=v.length,P=1-this._blur;w--;){var E=v[w],S=E.x,D=E.y,I=E.radius,j=Math.min(E.value,f),k=S-I,N=D-I,U=this.shadowCtx,Z;this._templates[I]?Z=this._templates[I]:this._templates[I]=Z=_(I,P),U.globalAlpha=(j-d)/(f-d),U.drawImage(Z,k,N),k<this._renderBoundaries[0]&&(this._renderBoundaries[0]=k),N<this._renderBoundaries[1]&&(this._renderBoundaries[1]=N),k+2*I>this._renderBoundaries[2]&&(this._renderBoundaries[2]=k+2*I),N+2*I>this._renderBoundaries[3]&&(this._renderBoundaries[3]=N+2*I)}},_colorize:function(){var l=this._renderBoundaries[0],d=this._renderBoundaries[1],f=this._renderBoundaries[2]-l,v=this._renderBoundaries[3]-d,w=this._width,P=this._height,E=this._opacity,S=this._maxOpacity,D=this._minOpacity,I=this._useGradientOpacity;l<0&&(l=0),d<0&&(d=0),l+f>w&&(f=w-l),d+v>P&&(v=P-d);for(var j=this.shadowCtx.getImageData(l,d,f,v),k=j.data,N=k.length,U=this._palette,Z=3;Z<N;Z+=4){var ve=k[Z],_e=ve*4;if(_e){var Me;E>0?Me=E:ve<S?ve<D?Me=D:Me=ve:Me=S,k[Z-3]=U[_e],k[Z-2]=U[_e+1],k[Z-1]=U[_e+2],k[Z]=I?U[_e+3]:Me}}this.ctx.putImageData(j,l,d),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(l){var d,f=this.shadowCtx,v=f.getImageData(l.x,l.y,1,1),w=v.data[3],P=this._max,E=this._min;return d=Math.abs(P-E)*(w/255)>>0,d},getDataURL:function(){return this.canvas.toDataURL()}},b}(),o=function(){var y=!1;return s.defaultRenderer==="canvas2d"&&(y=h),y}(),c={merge:function(){for(var g={},y=arguments.length,_=0;_<y;_++){var M=arguments[_];for(var b in M)g[b]=M[b]}return g}},p=function(){var y=function(){function l(){this.cStore={}}return l.prototype={on:function(d,f,v){var w=this.cStore;w[d]||(w[d]=[]),w[d].push(function(P){return f.call(v,P)})},emit:function(d,f){var v=this.cStore;if(v[d])for(var w=v[d].length,P=0;P<w;P++){var E=v[d][P];E(f)}}},l}(),_=function(b){var l=b._renderer,d=b._coordinator,f=b._store;d.on("renderpartial",l.renderPartial,l),d.on("renderall",l.renderAll,l),d.on("extremachange",function(v){b._config.onExtremaChange&&b._config.onExtremaChange({min:v.min,max:v.max,gradient:b._config.gradient||b._config.defaultGradient})}),f.setCoordinator(d)};function M(){var b=this._config=c.merge(s,arguments[0]||{});if(this._coordinator=new y,b.plugin){var l=b.plugin;if(s.plugins[l]){var d=s.plugins[l];this._renderer=new d.renderer(b),this._store=new d.store(b)}else throw new Error("Plugin '"+l+"' not found. Maybe it was not registered.")}else this._renderer=new o(b),this._store=new a(b);_(this)}return M.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(b){const l=this._config;return this._config=c.merge(this._config,b),this._renderer.updateConfig(this._config,l),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(b){return this._store.getValueAt?this._store.getValueAt(b):this._renderer.getValueAt?this._renderer.getValueAt(b):null}},M}(),u={create:function(g){return new p(g)},register:function(g,y){s.plugins[g]=y}};return u}();var r=function(s){Reflect.getPrototypeOf(r.prototype)!==BMap.Overlay.prototype&&Reflect.setPrototypeOf(r.prototype,BMap.Overlay.prototype),this.conf=s,this.conf.visible=s.visible===void 0?!0:s.visible,this.heatmap=null,this.latlngs=[],this.bounds=null};r.prototype=Object.create(typeof BMap>"u"?null:BMap.Overlay.prototype),r.prototype.initialize=function(s){this._map=s;var a=document.createElement("div");if(a.style.position="absolute",a.style.top=0,a.style.left=0,a.style.border=0,a.style.width=this._map.getSize().width+"px",a.style.height=this._map.getSize().height+"px",this.conf.element=a,!n())return a;s.getPanes().mapPane.appendChild(a),this.conf.valueField=this.conf.valueField||"count",this.heatmap=e.create(this.conf);var h=this;return s.addEventListener("resize",function(o){var c=o.size;a.style.width=c.width+"px",a.style.height=c.height+"px",h.heatmap._renderer.setDimensions(c.width,c.height),h.draw()}),this._div=a,a},r.prototype.draw=function(){if(n()){var s=this._map.getBounds();if(!s.equals(this.bounds)){this.bounds=s;var a=this._map.pointToOverlayPixel(s.getNorthEast()),h=this._map.pointToOverlayPixel(s.getSouthWest()),o=a.y,c=h.x,p=h.y-a.y,u=a.x-h.x;if(this.conf.element.style.left=c+"px",this.conf.element.style.top=o+"px",this.conf.element.style.width=u+"px",this.conf.element.style.height=p+"px",this.latlngs.length>0){this.heatmap.removeData();var g=this.latlngs.length;const l={max:this.heatmap._store.getData().max,data:[]};for(;g--;){var y=this.latlngs[g].latlng;if(s.containsPoint(y)){var _=this._map.pointToOverlayPixel(y),c=this._map.pointToOverlayPixel(s.getSouthWest()).x,o=this._map.pointToOverlayPixel(s.getNorthEast()).y,M=new BMap.Pixel(_.x-c,_.y-o),b=this.pixelTransform(M);l.data.push({x:b.x,y:b.y,count:this.latlngs[g].c})}}this.conf.radiusChangeByZoom&&(this.heatmap._store._cfgRadius=this.conf.radiusChangeByZoom(this._map.getZoom())),this.heatmap.setData(l)}}}},r.prototype.pixelTransform=function(s){for(var a=this.heatmap.width,h=this.heatmap.height;s.x<0;)s.x+=a;for(;s.x>a;)s.x-=a;for(;s.y<0;)s.y+=h;for(;s.y>h;)s.y-=h;return s.x=s.x>>0,s.y=s.y>>0,s},r.prototype.setDataSet=function(s){if(this.data=s,!!n()){var a=this._map.getBounds(),h={max:s.max,data:[]},o=s.data,c=o.length;for(this.latlngs=[],this.heatmap.removeData(),this.conf.radiusChangeByZoom&&(this.heatmap._store._cfgRadius=this.conf.radiusChangeByZoom(this._map.getZoom()));c--;){var p=new BMap.Point(o[c].lng,o[c].lat);if(this.latlngs.push({latlng:p,c:o[c].count}),!!a.containsPoint(p)){var u=this._map.pointToOverlayPixel(p),g=this._map.pointToOverlayPixel(a.getSouthWest()).x,y=this._map.pointToOverlayPixel(a.getNorthEast()).y,_=new BMap.Pixel(u.x-g,u.y-y),M=this.pixelTransform(_);h.data.push({x:M.x,y:M.y,count:o[c].count})}}this.heatmap.setData(h)}},r.prototype.addDataPoint=function(s,a,h){if(n()){this.data&&this.data.data&&this.data.data.push({lng:s,lat:a,count:h});var o=new BMap.Point(s,a),c=this.pixelTransform(this._map.pointToOverlayPixel(o));this.heatmap.store.addDataPoint(c.x,c.y,h),this.latlngs.push({latlng:o,c:h})}},r.prototype.toggle=function(){n()&&(this.conf.visible===!0?this.conf.visible=!1:this.conf.visible=!0,this.conf.visible?this.conf.element.style.display="block":this.conf.element.style.display="none")},r.prototype.setOptions=function(s){if(n()){for(var a in s)a=="radius"&&(this.heatmap._store._cfgRadius=s[a]);this.heatmap.configure(s),this.data&&this.setDataSet(this.data)}};function n(){var s=document.createElement("canvas");return!!(s.getContext&&s.getContext("2d"))}return r})}(We)),We.exports}var Li=Pi();const Ei=et(Li),lr=10,Ue={toGoogle:(i,t)=>({opacity:i.opacity,radius:i.radius??lr,gradient:i.gradient&&Object.entries(i.gradient).sort(([e],[r])=>+e-+r).map(([e,r])=>r),maxIntensity:i.maxIntensity,data:qe.toGoogle(i.data,t)}),toBaidu:(i,t,e)=>({opacity:i.opacity,radius:i.radius??lr,gradient:i.gradient,data:qe.toBaidu(i.data,t,e)})},qe={toGoogle:(i,t)=>i.map(e=>"weight"in e?{weight:e.weight,location:e.position.toGoogle(t)}:e.toGoogle(t)),toBaidu:(i,t,e)=>{let r=1;return{data:i.map(s=>{let a,h;return"weight"in s?(a=s.position.to(t),h=s.weight):(a=s.to(t),h=1),r<h&&(r=h),{lng:a.lng,lat:a.lat,count:h}}),max:e??r}}};class Vt{}class Br extends Vt{constructor(e,r){super();m(this,"inner");this.map=e,this.inner=new google.maps.visualization.HeatmapLayer(Ue.toGoogle(r,this.map.coordType)),this.inner.setMap(e.innerMap)}setData(e){this.inner.setData(qe.toGoogle(e,this.map.coordType))}setOptions(e){this.inner.setOptions(Ue.toGoogle(e,this.map.coordType))}remove(){this.inner.setMap(null)}}class Ir extends Vt{constructor(e,r){super();m(this,"inner");this.map=e;const n=Ue.toBaidu(r,this.map.coordType,r.maxIntensity);this.inner=new Ei(n),e.innerMap.addOverlay(this.inner),this.inner.setDataSet(n.data)}get innerDataMax(){var e;return(e=this.inner.data)==null?void 0:e.max}set innerDataMax(e){var r;((r=this.inner).data??(r.data={})).max=e}setData(e){this.inner.setDataSet(qe.toBaidu(e,this.map.coordType,this.innerDataMax))}setOptions(e){const r=Ue.toBaidu(e,this.map.coordType,e.maxIntensity??this.innerDataMax);e.data!==this.inner.data?this.inner.setDataSet(r.data):e.maxIntensity&&(this.innerDataMax=e.maxIntensity),this.inner.setOptions(r)}remove(){this.map.innerMap.removeOverlay(this.inner)}}class Ft{constructor(t){this.options=t}}function xe(i,t,e){const r=new URL(t,i),n=new URLSearchParams(Object.entries(e).filter(Yr));return r.search="?"+n.toString(),r}function At(){const i=window.location.hostname.split(".").filter(t=>!exports.Strings.isInt(t));return i.length===3?i.join("."):[...i,"tg","map","urls"].slice(0,3).join(".")}const Be=class Be extends Ft{directions(t,e,r){return xe(Be.BASE_URL,"dir/",{api:"1",origin:exports.Location.toString(t,z.gcj02),destination:exports.Location.toString(e,z.gcj02),travelmode:r})}search(t){return xe(Be.BASE_URL,"search/",{api:"1",query:exports.Location.toString(t,z.gcj02)})}};m(Be,"BASE_URL","https://www.google.com/maps/");let Ye=Be;const le=class le extends Ft{directions(t,e,r="driving"){const n=exports.Location.getCoordType(e)??exports.Location.getCoordType(t)??z.bd09,s=exports.Location.toString(e,n);return xe(le.BASE_URL,"direction",{origin:exports.Location.toString(t,n)??(typeof e!="string"?`name:请选择起点|latlng:${s}`:s),destination:s,coord_type:n===z.bd09?void 0:n,mode:r,output:"html",region:"中国",src:At()})}search(t){return typeof t=="string"?this.geocoderApi(t):this.latlngApi(t)}latlngApi(t){const e=t.to(z.bd09);return new URL(`https://map.baidu.com/?latlng=${e.lat},${e.lng}`)}markerApi(t,e,r){return xe(le.BASE_URL,"marker",{location:`${t.lat},${t.lng}`,coord_type:t.coord===z.bd09?void 0:t.coord,title:e,content:r,output:"html",src:At()})}geocoderApi(t){return xe(le.BASE_URL,"geocoder",{...typeof t=="string"?{address:t}:{location:`${t.lat},${t.lng}`,coord_type:t.coord===z.bd09?void 0:t.coord},output:"html",src:At()})}};m(le,"BASE_URL","https://api.map.baidu.com/");let Ke=le,Bi=class Sr{constructor(t,e,r){this.extend(Sr,google.maps.OverlayView),this.map_=t,this.MARKER_CLUSTER_IMAGE_PATH_="../images/m",this.MARKER_CLUSTER_IMAGE_EXTENSION_="png",this.markers_=[],this.clusters_=[],this.sizes=[53,56,66,78,90],this.styles_=[],this.ready_=!1;var n=r||{};this.zIndex_=n.zIndex||google.maps.Marker.MAX_ZINDEX+1,this.gridSize_=n.gridSize||60,this.minClusterSize_=n.minimumClusterSize||2,this.maxZoom_=n.maxZoom||null,this.styles_=n.styles||[],this.imagePath_=n.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_,this.imageExtension_=n.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_,this.zoomOnClick_=!0,n.zoomOnClick!=null&&(this.zoomOnClick_=n.zoomOnClick),this.averageCenter_=!1,n.averageCenter!=null&&(this.averageCenter_=n.averageCenter),this.setupStyles_(),this.setMap(t),this.prevZoom_=this.map_.getZoom();var s=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var a=s.map_.getZoom(),h=s.map_.minZoom||0,o=Math.min(s.map_.maxZoom||100,s.map_.mapTypes[s.map_.getMapTypeId()].maxZoom);a=Math.min(Math.max(a,h),o),s.prevZoom_!=a&&(s.prevZoom_=a,s.resetViewport())}),google.maps.event.addListener(this.map_,"idle",function(){s.redraw()}),e&&(e.length||Object.keys(e).length)&&this.addMarkers(e,!1)}extend(t,e){return(function(r){for(var n in r.prototype)this.prototype[n]=r.prototype[n];return this}).apply(t,[e])}onAdd(){this.setReady_(!0)}draw(){}setupStyles_(){if(!this.styles_.length)for(var t=0,e;e=this.sizes[t];t++)this.styles_.push({url:this.imagePath_+(t+1)+"."+this.imageExtension_,height:e,width:e})}fitMapToMarkers(){for(var t=this.getMarkers(),e=new google.maps.LatLngBounds,r=0,n;n=t[r];r++)e.extend(n.getPosition());this.map_.fitBounds(e)}setZIndex(t){this.zIndex_=t}getZIndex(){return this.zIndex_}setStyles(t){this.styles_=t}getStyles(){return this.styles_}isZoomOnClick(){return this.zoomOnClick_}isAverageCenter(){return this.averageCenter_}getMarkers(){return this.markers_}getTotalMarkers(){return this.markers_.length}setMaxZoom(t){this.maxZoom_=t}getMaxZoom(){return this.maxZoom_}calculator_(t,e){for(var r=0,n=t.length,s=n;s!==0;)s=parseInt(s/10,10),r++;return r=Math.min(r,e),{text:n,index:r}}setCalculator(t){this.calculator_=t}getCalculator(){return this.calculator_}addMarkers(t,e){if(t.length)for(let r=0,n;n=t[r];r++)this.pushMarkerTo_(n);else if(Object.keys(t).length)for(let r in t)this.pushMarkerTo_(t[r]);e||this.redraw()}pushMarkerTo_(t){if(t.isAdded=!1,t.draggable){var e=this;google.maps.event.addListener(t,"dragend",function(){t.isAdded=!1,e.repaint()})}this.markers_.push(t)}addMarker(t,e){this.pushMarkerTo_(t),e||this.redraw()}removeMarker_(t){var e=-1;if(this.markers_.indexOf)e=this.markers_.indexOf(t);else for(var r=0,n;n=this.markers_[r];r++)if(n==t){e=r;break}return e==-1?!1:(t.setMap(null),this.markers_.splice(e,1),!0)}removeMarker(t,e){var r=this.removeMarker_(t);return!e&&r?(this.resetViewport(),this.redraw(),!0):!1}removeMarkers(t,e){for(var r=t===this.getMarkers()?t.slice():t,n=!1,s=0,a;a=r[s];s++){var h=this.removeMarker_(a);n=n||h}if(!e&&n)return this.resetViewport(),this.redraw(),!0}setReady_(t){this.ready_||(this.ready_=t,this.createClusters_())}getTotalClusters(){return this.clusters_.length}getMap(){return this.map_}setMap(t){this.map_=t}getGridSize(){return this.gridSize_}setGridSize(t){this.gridSize_=t}getMinClusterSize(){return this.minClusterSize_}setMinClusterSize(t){this.minClusterSize_=t}getExtendedBounds(t){var e=this.getProjection(),r=new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()),n=new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()),s=e.fromLatLngToDivPixel(r);s.x+=this.gridSize_,s.y-=this.gridSize_;var a=e.fromLatLngToDivPixel(n);a.x-=this.gridSize_,a.y+=this.gridSize_;var h=e.fromDivPixelToLatLng(s),o=e.fromDivPixelToLatLng(a);return t.extend(h),t.extend(o),t}isMarkerInBounds_(t,e){return e.contains(t.getPosition())}clearMarkers(){this.resetViewport(!0),this.markers_=[]}resetViewport(t){for(let e=0,r;r=this.clusters_[e];e++)r.remove();for(let e=0,r;r=this.markers_[e];e++)r.isAdded=!1,t&&r.setMap(null);this.clusters_=[]}repaint(){var t=this.clusters_.slice();this.clusters_.length=0,this.resetViewport(),this.redraw(),setTimeout(function(){for(var e=0,r;r=t[e];e++)r.remove()},0)}redraw(){this.createClusters_()}distanceBetweenPoints_(t,e){if(!t||!e)return 0;var r=6371,n=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,a=Math.sin(n/2)*Math.sin(n/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2),h=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)),o=r*h;return o}addToClosestCluster_(t){for(var e=4e4,r=null,n=0,s;s=this.clusters_[n];n++){var a=s.getCenter();if(a){var h=this.distanceBetweenPoints_(a,t.getPosition());h<e&&(e=h,r=s)}}if(r&&r.isMarkerInClusterBounds(t))r.addMarker(t);else{var o=new Ii(this);o.addMarker(t),this.clusters_.push(o)}}createClusters_(){if(this.ready_)for(var t=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),e=this.getExtendedBounds(t),r=0,n;n=this.markers_[r];r++)!n.isAdded&&this.isMarkerInBounds_(n,e)&&this.addToClosestCluster_(n)}},Ii=class{constructor(t){this.markerClusterer_=t,this.map_=t.getMap(),this.gridSize_=t.getGridSize(),this.minClusterSize_=t.getMinClusterSize(),this.averageCenter_=t.isAverageCenter(),this.center_=null,this.markers_=[],this.bounds_=null,this.clusterIcon_=new Ut(this,t.getStyles(),t.getGridSize())}isMarkerAlreadyAdded(t){if(this.markers_.indexOf)return this.markers_.indexOf(t)!=-1;for(var e=0,r;r=this.markers_[e];e++)if(r==t)return!0;return!1}addMarker(t){if(this.isMarkerAlreadyAdded(t))return!1;if(!this.center_)this.center_=t.getPosition(),this.calculateBounds_();else if(this.averageCenter_){var e=this.markers_.length+1,r=(this.center_.lat()*(e-1)+t.getPosition().lat())/e,n=(this.center_.lng()*(e-1)+t.getPosition().lng())/e;this.center_=new google.maps.LatLng(r,n),this.calculateBounds_()}t.isAdded=!0,this.markers_.push(t);var s=this.markers_.length;if(s<this.minClusterSize_&&t.getMap()!=this.map_&&t.setMap(this.map_),s==this.minClusterSize_)for(var a=0;a<s;a++)this.markers_[a].setMap(null);return s>=this.minClusterSize_&&t.setMap(null),this.updateIcon(),!0}getMarkerClusterer(){return this.markerClusterer_}getBounds(){for(var t=new google.maps.LatLngBounds(this.center_,this.center_),e=this.getMarkers(),r=0,n;n=e[r];r++)t.extend(n.getPosition());return t}remove(){this.clusterIcon_.remove(),this.markers_.length=0,delete this.markers_}getSize(){return this.markers_.length}getMarkers(){return this.markers_}getCenter(){return this.center_}calculateBounds_(){var t=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(t)}isMarkerInClusterBounds(t){return this.bounds_.contains(t.getPosition())}getMap(){return this.map_}updateIcon(){var t=this.map_.getZoom(),e=this.markerClusterer_.getMaxZoom();if(e&&t>e){for(var r=0,n;n=this.markers_[r];r++)n.setMap(this.map_);return}if(this.markers_.length<this.minClusterSize_){this.clusterIcon_.hide();return}var s=this.markerClusterer_.getStyles().length,a=this.markerClusterer_.getCalculator()(this.markers_,s);this.clusterIcon_.setCenter(this.center_),this.clusterIcon_.setSums(a),this.clusterIcon_.show()}};class Ut{constructor(t,e,r){t.getMarkerClusterer().extend(Ut,google.maps.OverlayView),this.styles_=e,this.padding_=r||0,this.cluster_=t,this.center_=null,this.map_=t.getMap(),this.div_=null,this.sums_=null,this.visible_=!1,this.setMap(this.map_)}triggerClusterClick(){var t=this.cluster_.getBounds(),e=this.cluster_.getMarkerClusterer();google.maps.event.trigger(e.map_,"clusterclick",this.cluster_),e.isZoomOnClick()&&(this.map_.fitBounds(t),this.map_.setCenter(t.getCenter()))}onAdd(){if(this.div_=document.createElement("DIV"),this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.innerHTML=this.sums_.text}var e=this.getPanes();e.overlayMouseTarget.appendChild(this.div_);var r=this;google.maps.event.addDomListener(this.div_,"click",function(){r.triggerClusterClick()})}getPosFromLatLng_(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=parseInt(this.width_/2,10),e.y-=parseInt(this.height_/2,10),e}draw(){if(this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.top=t.y+"px",this.div_.style.left=t.x+"px"}}hide(){this.div_&&(this.div_.style.display="none"),this.visible_=!1}show(){if(this.div_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.style.display=""}this.visible_=!0}remove(){this.setMap(null)}onRemove(){this.div_&&this.div_.parentNode&&(this.hide(),this.div_.parentNode.removeChild(this.div_),this.div_=null)}setSums(t){this.sums_=t,this.text_=t.text,this.index_=t.index,this.div_&&(this.div_.innerHTML=t.text),this.useStyle()}useStyle(){var t=Math.max(0,this.sums_.index-1);t=Math.min(this.styles_.length-1,t);var e=this.styles_[t];this.url_=e.url,this.height_=e.height,this.width_=e.width,this.textColor_=e.textColor,this.anchor_=e.anchor,this.textSize_=e.textSize,this.backgroundPosition_=e.backgroundPosition}setCenter(t){this.center_=t}createCss(t){var e=[];e.push("z-index:"+this.cluster_.markerClusterer_.getZIndex()+";"),e.push("background-image:url("+this.url_+");");var r=this.backgroundPosition_?this.backgroundPosition_:"0 0";e.push("background-position:"+r+";"),typeof this.anchor_=="object"?(typeof this.anchor_[0]=="number"&&this.anchor_[0]>0&&this.anchor_[0]<this.height_?e.push("height:"+(this.height_-this.anchor_[0])+"px; padding-top:"+this.anchor_[0]+"px;"):e.push("height:"+this.height_+"px; line-height:"+this.height_+"px;"),typeof this.anchor_[1]=="number"&&this.anchor_[1]>0&&this.anchor_[1]<this.width_?e.push("width:"+(this.width_-this.anchor_[1])+"px; padding-left:"+this.anchor_[1]+"px;"):e.push("width:"+this.width_+"px; text-align:center;")):e.push("height:"+this.height_+"px; line-height:"+this.height_+"px; width:"+this.width_+"px; text-align:center;");var n=this.textColor_?this.textColor_:"black",s=this.textSize_?this.textSize_:11;return e.push("cursor:pointer; top:"+t.y+"px; left:"+t.x+"px; color:"+n+"; position:absolute; font-size:"+s+"px; font-family:Arial,sans-serif; font-weight:bold"),e.join("")}}var He={exports:{}},Si=He.exports,hr;function ki(){return hr||(hr=1,function(i,t){(function(e,r){i.exports=r()})(Si,function(){var e,r=e=r||{version:"1.3.8"},n={};r.guid="$BAIDU$",n[r.guid]=n[r.guid]||{},r.dom=r.dom||{},r.dom.g=function(o){return typeof o=="string"||o instanceof String?document.getElementById(o):o&&o.nodeName&&(o.nodeType==1||o.nodeType==9)?o:null},r.g=r.G=r.dom.g,r.dom.getDocument=function(o){return o=r.dom.g(o),o.nodeType==9?o:o.ownerDocument||o.document},r.lang=r.lang||{},r.lang.isString=function(o){return Object.prototype.toString.call(o)=="[object String]"},r.isString=r.lang.isString,r.dom._g=function(o){return r.lang.isString(o)?document.getElementById(o):o},r._g=r.dom._g,r.browser=r.browser||{},/msie (\d+\.\d)/i.test(navigator.userAgent)&&(r.browser.ie=r.ie=document.documentMode||+RegExp.$1),r.dom.getComputedStyle=function(o,c){o=r.dom._g(o);var p=r.dom.getDocument(o),u;return p.defaultView&&p.defaultView.getComputedStyle&&(u=p.defaultView.getComputedStyle(o,null),u)?u[c]||u.getPropertyValue(c):""},r.dom._styleFixer=r.dom._styleFixer||{},r.dom._styleFilter=r.dom._styleFilter||[],r.dom._styleFilter.filter=function(o,c,p){for(var u=0,g=r.dom._styleFilter,y;y=g[u];u++)(y=y[p])&&(c=y(o,c));return c},r.string=r.string||{},r.string.toCamelCase=function(o){return o.indexOf("-")<0&&o.indexOf("_")<0?o:o.replace(/[-_][^-_]/g,function(c){return c.charAt(1).toUpperCase()})},r.dom.getStyle=function(o,c){var p=r.dom;o=p.g(o),c=r.string.toCamelCase(c);var u=o.style[c]||(o.currentStyle?o.currentStyle[c]:"")||p.getComputedStyle(o,c);if(!u){var g=p._styleFixer[c];g&&(u=g.get?g.get(o):r.dom.getStyle(o,g))}return(g=p._styleFilter)&&(u=g.filter(c,u,"get")),u},r.getStyle=r.dom.getStyle,/opera\/(\d+\.\d)/i.test(navigator.userAgent)&&(r.browser.opera=+RegExp.$1),r.browser.isWebkit=/webkit/i.test(navigator.userAgent),r.browser.isGecko=/gecko/i.test(navigator.userAgent)&&!/like gecko/i.test(navigator.userAgent),r.browser.isStrict=document.compatMode=="CSS1Compat",r.dom.getPosition=function(o){o=r.dom.g(o);var c=r.dom.getDocument(o),p=r.browser,u=r.dom.getStyle;p.isGecko>0&&c.getBoxObjectFor&&u(o,"position")=="absolute"&&(o.style.top===""||o.style.left);var g={left:0,top:0},y=p.ie&&!p.isStrict?c.body:c.documentElement,_,M;if(o==y)return g;if(o.getBoundingClientRect){M=o.getBoundingClientRect(),g.left=Math.floor(M.left)+Math.max(c.documentElement.scrollLeft,c.body.scrollLeft),g.top=Math.floor(M.top)+Math.max(c.documentElement.scrollTop,c.body.scrollTop),g.left-=c.documentElement.clientLeft,g.top-=c.documentElement.clientTop;var b=c.body,l=parseInt(u(b,"borderLeftWidth")),d=parseInt(u(b,"borderTopWidth"));p.ie&&!p.isStrict&&(g.left-=isNaN(l)?2:l,g.top-=isNaN(d)?2:d)}else{_=o;do{if(g.left+=_.offsetLeft,g.top+=_.offsetTop,p.isWebkit>0&&u(_,"position")=="fixed"){g.left+=c.body.scrollLeft,g.top+=c.body.scrollTop;break}_=_.offsetParent}while(_&&_!=o);for((p.opera>0||p.isWebkit>0&&u(o,"position")=="absolute")&&(g.top-=c.body.offsetTop),_=o.offsetParent;_&&_!=c.body;)g.left-=_.scrollLeft,(!p.opera||_.tagName!="TR")&&(g.top-=_.scrollTop),_=_.offsetParent}return g},r.event=r.event||{},r.event._listeners=r.event._listeners||[],r.event.on=function(o,c,p){c=c.replace(/^on/i,""),o=r.dom._g(o);var u=function(b){p.call(o,b)},g=r.event._listeners,y=r.event._eventFilter,_,M=c;return c=c.toLowerCase(),y&&y[c]&&(_=y[c](o,c,u),M=_.type,u=_.listener),o.addEventListener?o.addEventListener(M,u,!1):o.attachEvent&&o.attachEvent("on"+M,u),g[g.length]=[o,c,p,u,M],o},r.on=r.event.on,function(){var o=n[r.guid];r.lang.guid=function(){return"TANGRAM__"+(o._counter++).toString(36)},o._counter=o._counter||1}(),n[r.guid]._instances=n[r.guid]._instances||{},r.lang.isFunction=function(o){return Object.prototype.toString.call(o)=="[object Function]"},r.lang.Class=function(o){this.guid=o||r.lang.guid(),n[r.guid]._instances[this.guid]=this},n[r.guid]._instances=n[r.guid]._instances||{},r.lang.Class.prototype.dispose=function(){delete n[r.guid]._instances[this.guid];for(var o in this)r.lang.isFunction(this[o])||delete this[o];this.disposed=!0},r.lang.Class.prototype.toString=function(){return"[object "+(this._className||"Object")+"]"},r.lang.Event=function(o,c){this.type=o,this.returnValue=!0,this.target=c||null,this.currentTarget=null},r.lang.Class.prototype.addEventListener=function(o,c,p){if(r.lang.isFunction(c)){!this.__listeners&&(this.__listeners={});var u=this.__listeners,g;if(typeof p=="string"&&p){if(/[^\w\-]/.test(p))throw"nonstandard key:"+p;c.hashCode=p,g=p}o.indexOf("on")!=0&&(o="on"+o),typeof u[o]!="object"&&(u[o]={}),g=g||r.lang.guid(),c.hashCode=g,u[o][g]=c}},r.lang.Class.prototype.removeEventListener=function(o,c){if(!(typeof c<"u"&&(r.lang.isFunction(c)&&!(c=c.hashCode)||!r.lang.isString(c)))){!this.__listeners&&(this.__listeners={}),o.indexOf("on")!=0&&(o="on"+o);var p=this.__listeners;if(p[o])if(typeof c<"u")p[o][c]&&delete p[o][c];else for(var u in p[o])delete p[o][u]}},r.lang.Class.prototype.dispatchEvent=function(o,c){r.lang.isString(o)&&(o=new r.lang.Event(o)),!this.__listeners&&(this.__listeners={}),c=c||{};for(var p in c)o[p]=c[p];var p,u=this.__listeners,g=o.type;if(o.target=o.target||this,o.currentTarget=this,g.indexOf("on")!=0&&(g="on"+g),r.lang.isFunction(this[g])&&this[g].apply(this,arguments),typeof u[g]=="object")for(p in u[g])u[g][p].apply(this,arguments);return o.returnValue},r.lang.inherits=function(o,c,p){var u,g,y=o.prototype,_=new Function;_.prototype=c.prototype,g=o.prototype=new _;for(u in y)g[u]=y[u];o.prototype.constructor=o,o.superClass=c.prototype,typeof p=="string"&&(g._className=p)},r.inherits=r.lang.inherits;var s="http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m",a="png",h=function(o,c,p){try{BMap}catch{throw Error("Baidu Map JS API is not ready yet!")}e.lang.inherits(h,BMap.Overlay,"TextIconOverlay"),this._position=o,this._text=c,this._options=p||{},this._styles=this._options.styles||[],this._zIndex=this._options.zIndex,!this._styles.length&&this._setupDefaultStyles()};return h.prototype._setupDefaultStyles=function(){for(var o=[53,56,66,78,90],c=0,p;p=o[c];c++)this._styles.push({url:s+c+"."+a,size:new BMap.Size(p,p)})},h.prototype.initialize=function(o){return this._map=o,this._domElement=document.createElement("div"),this._updateCss(),this._updateText(),this._updatePosition(),this._bind(),this._map.getPanes().markerMouseTarget.appendChild(this._domElement),this._domElement},h.prototype.draw=function(){this._map&&this._updatePosition()},h.prototype.getText=function(){return this._text},h.prototype.setText=function(o){o&&(!this._text||this._text.toString()!=o.toString())&&(this._text=o,this._updateText(),this._updateCss(),this._updatePosition())},h.prototype.getPosition=function(){return this._position},h.prototype.setPosition=function(o){o&&(!this._position||!this._position.equals(o))&&(this._position=o,this._updatePosition())},h.prototype.getStyleByText=function(o,c){var p=parseInt(o),u=parseInt(p/10);return u=Math.max(0,u),u=Math.min(u,c.length-1),c[u]},h.prototype._updateCss=function(){if(this._domElement){var o=this.getStyleByText(this._text,this._styles);this._domElement.style.cssText=this._buildCssText(o)}},h.prototype._updateText=function(){this._domElement&&(this._domElement.innerHTML=this._text)},h.prototype._updatePosition=function(){if(this._domElement&&this._position){var o=this._domElement.style,c=this._map.pointToOverlayPixel(this._position);c.x-=Math.ceil(parseInt(o.width)/2),c.y-=Math.ceil(parseInt(o.height)/2),o.left=c.x+"px",o.top=c.y+"px"}},h.prototype._buildCssText=function(o){var c=o.url,p=o.size,u=o.anchor,g=o.offset,y=o.textColor||"black",_=o.textSize||10,M=[];if(this._zIndex&&M.push("z-index:"+this._zIndex+";"),e.browser.ie<7)M.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+c+'");');else{M.push("background-image:url("+c+");");var b="0 0";g instanceof BMap.Size&&(b=g.width+"px "+g.height+"px"),M.push("background-position:"+b+";")}return p instanceof BMap.Size&&(u instanceof BMap.Size?(u.height>0&&u.height<p.height&&M.push("height:"+(p.height-u.height)+"px; padding-top:"+u.height+"px;"),u.width>0&&u.width<p.width&&M.push("width:"+(p.width-u.width)+"px; padding-left:"+u.width+"px;")):(M.push("height:"+p.height+"px; line-height:"+p.height+"px;"),M.push("width:"+p.width+"px; text-align:center;"))),M.push("cursor:pointer; color:"+y+"; position:absolute; font-size:"+_+"px; font-family:Arial,sans-serif; font-weight:bold"),M.join("")},h.prototype._bind=function(){if(!this._domElement)return;var o=this,c=this._map,p=e.lang.Event;function u(g,y){var _=g.srcElement||g.target,M=g.clientX||g.pageX,b=g.clientY||g.pageY;if(g&&y&&M&&b&&_){var l=e.dom.getPosition(c.getContainer());y.pixel=new BMap.Pixel(M-l.left,b-l.top),y.point=c.pixelToPoint(y.pixel)}return y}e.event.on(this._domElement,"mouseover",function(g){o.dispatchEvent(u(g,new p("onmouseover")))}),e.event.on(this._domElement,"mouseout",function(g){o.dispatchEvent(u(g,new p("onmouseout")))}),e.event.on(this._domElement,"click",function(g){o.dispatchEvent(u(g,new p("onclick")))})},h})}(He)),He.exports}var Ai=ki();const cr=et(Ai);var kr=function(i,t,e){t=Ri(t);var r=i.pointToPixel(t.getNorthEast()),n=i.pointToPixel(t.getSouthWest());r.x+=e,r.y-=e,n.x-=e,n.y+=e;var s=i.pixelToPoint(r),a=i.pixelToPoint(n);return new BMap.Bounds(a,s)},Ri=function(i){var t=Ne(i.getNorthEast().lng,-180,180),e=Ne(i.getSouthWest().lng,-180,180),r=Ne(i.getNorthEast().lat,-74,74),n=Ne(i.getSouthWest().lat,-74,74);return new BMap.Bounds(new BMap.Point(e,n),new BMap.Point(t,r))},Ne=function(i,t,e){return t&&(i=Math.max(i,t)),e&&(i=Math.min(i,e)),i},Ar=function(i){return Object.prototype.toString.call(i)==="[object Array]"},Rr=function(i,t){var e=-1;if(Ar(t)){if(t.indexOf)e=t.indexOf(i);else for(var r=0,n;n=t[r];r++)if(n===i){e=r;break}}return e},B=function(i,t){try{BMap}catch{throw Error("Baidu Map JS API is not ready yet!")}if(i){this._map=i,this._markers=[],this._clusters=[];var e=t||{};this._zIndex=e.zIndex,this._gridSize=e.gridSize||60,this._maxZoom=e.maxZoom||18,this._minClusterSize=e.minClusterSize||2,this._isAverageCenter=!1,e.isAverageCenter!=null&&(this._isAverageCenter=e.isAverageCenter),this._styles=e.styles||[];var r=this;this._map.addEventListener("zoomend",function(){r._redraw()}),this._map.addEventListener("moveend",function(){r._redraw()});var n=e.markers;Ar(n)&&this.addMarkers(n)}};B.prototype.addMarkers=function(i){if(i.length){for(var t=0,e=i.length;t<e;t++)this._pushMarkerTo(i[t]);this._createClusters()}};B.prototype._pushMarkerTo=function(i){var t=Rr(i,this._markers);t===-1&&(i.isInCluster=!1,this._markers.push(i))};B.prototype.addMarker=function(i){this._pushMarkerTo(i),this._createClusters()};B.prototype._createClusters=function(){var i=this._map.getBounds();if(i.getCenter()){for(var t=kr(this._map,i,this._gridSize),e=0,r;r=this._markers[e];e++)!r.isInCluster&&t.containsPoint(r.getPosition())&&this._addToClosestCluster(r);for(var n=this._markers.length,e=0;e<n;e++)this._clusters[e]&&this._clusters[e].render()}};B.prototype._addToClosestCluster=function(i){var t=4e6,e=null;i.getPosition();for(var r=0,n;n=this._clusters[r];r++){var s=n.getCenter();if(s){var a=this._map.getDistance(s,i.getPosition());a<t&&(t=a,e=n)}}if(e&&e.isMarkerInClusterBounds(i))e.addMarker(i);else{var n=new X(this);n.addMarker(i),this._clusters.push(n)}};B.prototype._clearLastClusters=function(){for(var i=0,t;t=this._clusters[i];i++)t.remove();this._clusters=[],this._removeMarkersFromCluster()};B.prototype._removeMarkersFromCluster=function(){for(var i=0,t;t=this._markers[i];i++)t.isInCluster=!1};B.prototype._removeMarkersFromMap=function(){for(var i=0,t;t=this._markers[i];i++){t.isInCluster=!1;var e=t.getLabel();this._map.removeOverlay(t),t.setLabel(e)}};B.prototype._removeMarker=function(i){var t=Rr(i,this._markers);return t===-1?!1:(this._map.removeOverlay(i),this._markers.splice(t,1),!0)};B.prototype.removeMarker=function(i){var t=this._removeMarker(i);return t&&(this._clearLastClusters(),this._createClusters()),t};B.prototype.removeMarkers=function(i){for(var t=!1,e=0;e<i.length;e++){var r=this._removeMarker(i[e]);t=t||r}return t&&(this._clearLastClusters(),this._createClusters()),t};B.prototype.clearMarkers=function(){this._clearLastClusters(),this._removeMarkersFromMap(),this._markers=[]};B.prototype._redraw=function(){this._clearLastClusters(),this._createClusters()};B.prototype.getGridSize=function(){return this._gridSize};B.prototype.setGridSize=function(i){this._gridSize=i,this._redraw()};B.prototype.getMaxZoom=function(){return this._maxZoom};B.prototype.setMaxZoom=function(i){this._maxZoom=i,this._redraw()};B.prototype.getZIndex=function(){return this._zIndex};B.prototype.setZIndex=function(i){this._zIndex!=i&&(this.zIndex=i,this._redraw())};B.prototype.getStyles=function(){return this._styles};B.prototype.setStyles=function(i){this._styles=i,this._redraw()};B.prototype.getMinClusterSize=function(){return this._minClusterSize};B.prototype.setMinClusterSize=function(i){this._minClusterSize=i,this._redraw()};B.prototype.isAverageCenter=function(){return this._isAverageCenter};B.prototype.getMap=function(){return this._map};B.prototype.getMarkers=function(){return this._markers};B.prototype.getClustersCount=function(){for(var i=0,t=0,e;e=this._clusters[t];t++)e.isReal()&&i++;return i};B.prototype._textCalculator=function(i){return i.length.toString()};B.prototype._stylesIndexCalculator=null;B.prototype.setTextCalculator=function(i){this._textCalculator=i};B.prototype.setStylesIndexCalculator=function(i){this._stylesIndexCalculator=i};function X(i){var t=this;this._markerClusterer=i,this._map=i.getMap(),this._minClusterSize=i.getMinClusterSize(),this._isAverageCenter=i.isAverageCenter(),this._center=null,this._markers=[],this._gridBounds=null,this._isReal=!1,this._clusterMarker=new cr(this._center,this._markers.length,{styles:this._markerClusterer.getStyles(),zIndex:i._zIndex}),this._clusterMarker.getStyleByText=function(e,r){if(t._markerClusterer._stylesIndexCalculator){var n=t._markerClusterer._stylesIndexCalculator(t._markers,r.length);return r[n]}return cr.prototype.getStyleByText.call(this,e,r)},this._clusterMarker.addEventListener&&this._clusterMarker.addEventListener("click",function(e){t._map.setViewport(t.getBounds())})}X.prototype.addMarker=function(i){if(this.isMarkerInCluster(i))return!1;if(!this._center)this._center=i.getPosition(),this.updateGridBounds();else if(this._isAverageCenter){var t=this._markers.length+1,e=(this._center.lat*(t-1)+i.getPosition().lat)/t,r=(this._center.lng*(t-1)+i.getPosition().lng)/t;this._center=new BMap.Point(r,e),this.updateGridBounds()}return i.isInCluster=!0,this._markers.push(i),!0};X.prototype.render=function(){var i=this._markers.length;if(i<this._minClusterSize)for(var t=0;t<i;t++)this._map.addOverlay(this._markers[t]);else this._map.addOverlay(this._clusterMarker),this._isReal=!0,this.updateClusterMarker()};X.prototype.isMarkerInCluster=function(i){if(this._markers.indexOf)return this._markers.indexOf(i)!=-1;for(var t=0,e;e=this._markers[t];t++)if(e===i)return!0;return!1};X.prototype.isMarkerInClusterBounds=function(i){return this._gridBounds.containsPoint(i.getPosition())};X.prototype.isReal=function(i){return this._isReal};X.prototype.updateGridBounds=function(){var i=new BMap.Bounds(this._center,this._center);this._gridBounds=kr(this._map,i,this._markerClusterer.getGridSize())};X.prototype.updateClusterMarker=function(){if(this._map.getZoom()>this._markerClusterer.getMaxZoom()){this._clusterMarker&&this._map.removeOverlay(this._clusterMarker);for(var i=0,t;t=this._markers[i];i++)this._map.addOverlay(t);return}if(this._markers.length<this._minClusterSize){this._clusterMarker.hide();return}this._clusterMarker.setPosition(this._center),this._clusterMarker.setText(this._markerClusterer._textCalculator(this._markers))};X.prototype.remove=function(){for(var i=0,t;t=this._markers[i];i++){var e=this._markers[i].getLabel();this._markers[i].getMap()&&this._map.removeOverlay(this._markers[i]),this._markers[i].setLabel(e)}this._map.removeOverlay(this._clusterMarker),this._markers.length=0,delete this._markers};X.prototype.getBounds=function(){for(var i=new BMap.Bounds(this._center,this._center),t=0,e;e=this._markers[t];t++)i.extend(e.getPosition());return i};X.prototype.getCenter=function(){return this._center};var Xe;(i=>{function t(r){return{url:r.url,size:new BMap.Size(r.size.width,r.size.height),anchor:r.anchor&&new BMap.Size(r.anchor.x,r.anchor.y),offset:r.offset&&new BMap.Size(r.offset.x,r.offset.y),textColor:r.textColor,textSize:r.textSize}}i.toBaidu=t;function e(r){return{url:r.url,width:r.size.width,height:r.size.height,anchor:r.anchor&&[r.anchor.y,r.anchor.x],backgroundPosition:r.offset&&`${r.offset.x} ${r.offset.y}`,textColor:r.textColor,textSize:r.textSize}}i.toGoogle=e})(Xe||(Xe={}));class qt{constructor(t){this.map=t,O.noop()}clearMarkers(){this.inner.clearMarkers()}addMarker(t){this.inner.addMarker(t.innerOverlay)}removeMarker(t){return this.inner.removeMarker(t.innerOverlay)}addMarkers(t){this.inner.addMarkers(t.map(e=>e.innerOverlay))}removeMarkers(t){return this.inner.removeMarkers(t.map(e=>e.innerOverlay))}}class Dr extends qt{constructor(e,r){var s;super(e);m(this,"inner");this.inner=new B(e.innerMap,{gridSize:r.gridSize,maxZoom:r.maxZoom,minClusterSize:r.minClusterSize,isAverageCenter:r.averageCenter,styles:(s=r.styles)==null?void 0:s.map(a=>Xe.toBaidu(a)),zIndex:r.zIndex});const n=r.stylesIndexCalculator;n&&this.inner.setStylesIndexCalculator((a,h)=>n(a.length,h)),r.markers&&this.addMarkers(r.markers)}recreate(){this.inner._redraw()}}class zr extends qt{constructor(e,r){var s,a;super(e);m(this,"inner");this.inner=new Bi(e.innerMap,(s=r.markers)==null?void 0:s.map(h=>h.innerOverlay),{gridSize:r.gridSize,maxZoom:r.maxZoom,minimumClusterSize:r.minClusterSize,averageCenter:r.averageCenter,styles:(a=r.styles)==null?void 0:a.map(h=>Xe.toGoogle(h)),zIndex:r.zIndex});const n=r.stylesIndexCalculator;n&&this.inner.setCalculator((h,o)=>({text:h.length,index:n(h.length,o)+1}))}recreate(){this.inner.repaint()}}class Yt{constructor(){O.noop()}}class $r extends Yt{constructor(e,r){super();m(this,"inner");this.map=e,this.inner=new google.maps.places.PlacesService(e.innerMap)}search(e,r){return this.searchImpl(e,r instanceof x?r.toGoogle(this.map.coordType):r??this.map.innerMap.getCenter())}searchInBounds(e,r){return this.searchImpl(e,r.toGoogle(this.map.coordType))}searchNearBy(e,r,n){return this.searchImpl(e,{center:r.toGoogle(this.map.coordType),radius:n})}searchImpl(e,r){return new Promise((n,s)=>{this.inner.findPlaceFromQuery({query:e,fields:["formatted_address","geometry","name","place_id"],locationBias:r},(a,h)=>{switch(h){case google.maps.places.PlacesServiceStatus.ZERO_RESULTS:case google.maps.places.PlacesServiceStatus.OK:{const o=(a??[]).map(c=>Pr(c,this.map));n(o);break}default:s(new Error(`status: ${h}`));break}})})}}class Gr extends Yt{constructor(e,r){super();m(this,"searchRequestMap",new Map);m(this,"currentSearch");this.map=e}get inner(){return this.currentSearch}search(e,r){return this.newSearch(r instanceof x?r.toBaidu(this.map.coordType):r??this.map.innerMap.getCenter(),n=>{n.search(e)})}searchInBounds(e,r){return this.newSearch(void 0,n=>{n.searchInBounds(e,r.toBaidu(this.map.coordType))})}searchNearBy(e,r,n){return this.newSearch(void 0,s=>{s.searchNearby(e,r.toBaidu(this.map.coordType),n)})}newSearch(e,r){return new Promise((n,s)=>{const a=new BMap.LocalSearch(e??this.map.innerMap,{onSearchComplete:h=>{Array.isArray(h)&&O.throwUnsupported("当前只支持一次搜索一条数据");const o=a.getStatus();switch(o){case BMAP_STATUS_SUCCESS:{const c=[];for(let p=0;p<h.getCurrentNumPois();p++){const u=h.getPoi(p);c.push({id:u.uid,city:u.city,country:"",position:x.fromBaidu(u.point,this.map.coordType),province:u.province,title:u.title,address:u.address})}n(c);break}case BMAP_STATUS_UNKNOWN_LOCATION:n([]);break;default:s(new Error(`status: ${o}`));break}}});r(a)})}}class Kt{constructor(t,e){m(this,"onData");m(this,"onError");this.map=t,this.input=e,O.noop()}setSearchListener(t,e){return this.onData&&O.throwError("setSearchListener只能调用一次"),this.onData=t,this.onError=e,O.noop}}class Nr extends Kt{constructor(e,r){super(e,r.input);m(this,"searchBox");this.searchBox=new google.maps.places.SearchBox(r.input),this.searchBox.bindTo("bounds",e.innerMap)}setSearchListener(e,r){return super.setSearchListener(e,r),vr(this.searchBox,"places_changed",()=>{const n=this.searchBox.getPlaces();e((n??[]).map(s=>Pr(s,this.map)))})}search(){this.input.value&&(google.maps.event.trigger(this.input,"focus",{}),google.maps.event.trigger(this.input,"keydown",{keyCode:13}))}}class Zr extends Kt{constructor(e,r){super(e,r.input);m(this,"autocomplete");m(this,"placesService");this.autocomplete=e.createAutocomplete({input:r.input,bindToMap:!0}),this.placesService=e.createPlacesService({})}setSearchListener(e,r){return super.setSearchListener(e,r),this.autocomplete.addResultListener(n=>{this.searchImpl(n.country+n.province+n.city+n.district+n.street+n.streetNumber+n.title)})}search(){this.input.value&&this.searchImpl(this.input.value)}searchImpl(e){this.placesService.search(e).then(this.onData,this.onError)}}var Wr=(i=>(i[i.WORLD=1]="WORLD",i[i.STATE=5]="STATE",i[i.CITY=10]="CITY",i[i.STREET=15]="STREET",i[i.BUILDING=20]="BUILDING",i))(Wr||{});class ut{constructor(t){m(this,"latestInfoWindow");m(this,"delegate",O.lateinit());this.element=t,process.env.NODE_ENV!=="production"&&setTimeout(()=>{this.delegate||console.warn(`${this.constructor.name}继承了AbstractMap, 但未调用setEventTargetDelegate(delegate)`)})}setEventTargetDelegate(t){this.delegate=t.setTarget(this)}addEventListener(t,e){this.delegate.addEventListener(t,e)}removeEventListener(t,e){this.delegate.removeEventListener(t,e)}getLatestInfoWindow(){return this.latestInfoWindow}setLatestInfoWindowInternal(t){this.latestInfoWindow=t}addOverlayMapType(t){this.addLayer(t)}removeOverlayMapType(t){this.removeLayer(t)}addControl(t){t.addTo(this)}removeControl(t){t.removeFrom(this)}getZoom(){return this.innerMap.getZoom()??0}setZoom(t){this.innerMap.setZoom(t)}}var Rt,dr;function Di(){if(dr)return Rt;dr=1;var i=function(d){return t(d)&&!e(d)};function t(l){return!!l&&typeof l=="object"}function e(l){var d=Object.prototype.toString.call(l);return d==="[object RegExp]"||d==="[object Date]"||s(l)}var r=typeof Symbol=="function"&&Symbol.for,n=r?Symbol.for("react.element"):60103;function s(l){return l.$$typeof===n}function a(l){return Array.isArray(l)?[]:{}}function h(l,d){return d.clone!==!1&&d.isMergeableObject(l)?M(a(l),l,d):l}function o(l,d,f){return l.concat(d).map(function(v){return h(v,f)})}function c(l,d){if(!d.customMerge)return M;var f=d.customMerge(l);return typeof f=="function"?f:M}function p(l){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(l).filter(function(d){return Object.propertyIsEnumerable.call(l,d)}):[]}function u(l){return Object.keys(l).concat(p(l))}function g(l,d){try{return d in l}catch{return!1}}function y(l,d){return g(l,d)&&!(Object.hasOwnProperty.call(l,d)&&Object.propertyIsEnumerable.call(l,d))}function _(l,d,f){var v={};return f.isMergeableObject(l)&&u(l).forEach(function(w){v[w]=h(l[w],f)}),u(d).forEach(function(w){y(l,w)||(g(l,w)&&f.isMergeableObject(d[w])?v[w]=c(w,f)(l[w],d[w],f):v[w]=h(d[w],f))}),v}function M(l,d,f){f=f||{},f.arrayMerge=f.arrayMerge||o,f.isMergeableObject=f.isMergeableObject||i,f.cloneUnlessOtherwiseSpecified=h;var v=Array.isArray(d),w=Array.isArray(l),P=v===w;return P?v?f.arrayMerge(l,d,f):_(l,d,f):h(d,f)}M.all=function(d,f){if(!Array.isArray(d))throw new Error("first argument should be an array");return d.reduce(function(v,w){return M(v,w,f)},{})};var b=M;return Rt=b,Rt}var zi=Di();const Hr=et(zi);/*!
|
|
3
|
-
* isobject <https://github.com/jonschlinkert/isobject>
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
|
-
* Released under the MIT License.
|
|
7
|
-
*/function $i(i){return i!=null&&typeof i=="object"&&Array.isArray(i)===!1}/*!
|
|
8
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
11
|
-
* Released under the MIT License.
|
|
12
|
-
*/function ur(i){return $i(i)===!0&&Object.prototype.toString.call(i)==="[object Object]"}function jr(i){var t,e;return!(ur(i)===!1||(t=i.constructor,typeof t!="function")||(e=t.prototype,ur(e)===!1)||e.hasOwnProperty("isPrototypeOf")===!1)}exports.Objects=void 0;(i=>{function t(p,u){return p.reduce((g,y)=>(g[u(y)]=y,g),{})}i.fromArray=t;function e(p){return p.reduce((u,g)=>(u[g[0]]=g[1],u),{})}i.fromEntries=e;function r(p){return JSON.stringify(p,(u,g)=>typeof g=="object"&&Object.getPrototypeOf(g)!==Object.prototype?g.toString!==Object.prototype.toString?g.toString():`[object ${Object.getPrototypeOf(g).constructor.name}]`:g)}i.toJsonSafely=r;function n(p){jr(p)&&Object.keys(p).forEach(u=>{p[u]===void 0?delete p[u]:n(p[u])})}i.deleteUndefinedPropertyOnPlainObjectDeeply=n;function s(p,u,g){let y=p[u];return y===void 0&&(y=g(),p[u]=y),y}i.putIfAbsent=s;function a(p,...u){const g=pr(u),y={};for(const _ in p)g(_)||(y[_]=p[_]);return y}i.omit=a;function h(p,...u){const g=pr(u),y={};for(const _ in p)g(_)&&(y[_]=p[_]);return y}i.pick=h;function o(p,u){const g=typeof u=="string"?u.split("."):u;let y=p;for(const _ of g){if(y==null)return;y=y[_]}return y}i.get=o;function c(p,u){const g=typeof u=="string"?u.split("."):u,y=o(p,g.slice(0,-1)),_=g[g.length-1];y!=null&&delete y[_]}i.del=c})(exports.Objects||(exports.Objects={}));function pr(i){if(i.length<=4)return i.includes.bind(i);{const t=new Set(i);return t.has.bind(t)}}exports.Objects.toJsonSafely;const Vr=["single","multi"];var J=(i=>(i.auto="auto",i.none="none",i.greedy="greedy",i.cooperative="cooperative",i))(J||{});exports.MapOptions=void 0;(i=>{function t(e){exports.Objects.deleteUndefinedPropertyOnPlainObjectDeeply(e);const r={center:x.ZERO,zoom:5};return Hr(r,e||{},{isMergeableObject:jr})}i.create=t})(exports.MapOptions||(exports.MapOptions={}));class Xt{constructor(t,e){m(this,"_delegate");this.innerOverlay=t,this.coordType=e}get delegate(){return this._delegate??(this._delegate=this.createDelegate().setTarget(this)),this._delegate}addEventListener(t,e){this.delegate.addEventListener(t,e)}removeEventListener(t,e){this.delegate.removeEventListener(t,e)}remove(){this.map.removeOverlay(this)}}class pt extends Xt{constructor(t,e,r){super(t,e),this.map=r}createDelegate(){return new de(this.innerOverlay,this.map)}isVisible(){return this.innerOverlay.getVisible()}setVisible(t){this.innerOverlay.setVisible(t)}}class ze extends Xt{constructor(t,e,r){super(t,e),this.map=r}createDelegate(){return new Se(this.innerOverlay,this.map)}get overlay(){return this.innerOverlay}isVisible(){return this.overlay.isVisible()}setVisible(t){t?this.overlay.show():this.overlay.hide()}visibleOptionInternal(t){return t!==void 0&&(t||this.setVisible(!1)),this}}const Ie=class Ie extends ze{constructor(t,e,r,n){super(t,e,r),this.state=n}isEditable(){return this.state.editable}setEditable(t){this.state.editable=t,t?this.innerOverlay.enableEditing():this.innerOverlay.disableEditing()}setStrokeColor(t){this.innerOverlay.setStrokeColor(t)}setStrokeOpacity(t){this.innerOverlay.setStrokeOpacity(t+Ie.OPACITY_DELTA)}setStrokeWeight(t){this.innerOverlay.setStrokeWeight(t)}setFillColor(t){this.innerOverlay.setFillColor(t)}setFillOpacity(t){this.innerOverlay.setFillOpacity(t+Ie.OPACITY_DELTA)}};m(Ie,"OPACITY_DELTA",.001);let Y=Ie;class gt extends pt{isEditable(){return this.innerOverlay.getEditable()}setEditable(t){this.innerOverlay.setEditable(t)}setStrokeColor(t){this.innerOverlay.setOptions({strokeColor:t})}setStrokeOpacity(t){this.innerOverlay.setOptions({strokeOpacity:t})}setStrokeWeight(t){this.innerOverlay.setOptions({strokeWeight:t})}setFillColor(t){this.innerOverlay.setOptions({fillColor:t})}setFillOpacity(t){this.innerOverlay.setOptions({fillOpacity:t})}}class mt extends Y{constructor(){super(...arguments);m(this,"prevCenter");m(this,"prevRadius");m(this,"isDoingSetCenter",!1);m(this,"isDoingSetRadius",!1);m(this,"eventHubDelegate");m(this,"onRadiusChanged",()=>{var r;const e=this.innerOverlay.getRadius();this.prevRadius!==e&&(this.isDoingSetRadius||(r=this.eventHubDelegate)==null||r.notify({type:"radius-changed",target:this}),this.prevRadius=e)});m(this,"onCenterChanged",()=>{var r;const e=this.innerOverlay.getCenter();this.prevCenter!==e&&(this.isDoingSetCenter||(r=this.eventHubDelegate)==null||r.notify({type:"center-changed",target:this}),this.prevCenter=e)});m(this,"resetEditableTimeoutId")}static create(e){const r=this.coordType,n=new BMap.Circle(e.center.toBaidu(r),e.radius,{enableClicking:e.clickable,enableEditing:!1,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity!=null?e.strokeOpacity+Y.OPACITY_DELTA:void 0,strokeWeight:e.strokeWeight,fillColor:e.fillColor,fillOpacity:e.fillOpacity!=null?e.fillOpacity+Y.OPACITY_DELTA:void 0}),s=new mt(n,r,this,{editable:!!e.editable}).visibleOptionInternal(e.visible);return s.state.editable&&setTimeout(()=>{s.state.editable&&n.enableEditing()},0),s}createDelegate(){return this.eventHubDelegate=new rt(super.createDelegate(),{types:["radius-changed","center-changed"],onListen:e=>{e==="radius-changed"?(this.prevRadius=this.innerOverlay.getRadius(),this.innerOverlay.addEventListener("lineupdate",this.onRadiusChanged)):(this.prevCenter=this.innerOverlay.getCenter(),this.innerOverlay.addEventListener("lineupdate",this.onCenterChanged))},onCancel:e=>{this.innerOverlay.removeEventListener("lineupdate",e==="radius-changed"?this.onRadiusChanged:this.onCenterChanged)}})}setCenter(e){this.coordType=this.map.coordType,this.isDoingSetCenter=!0,this.innerOverlay.setCenter(e.toBaidu(this.coordType)),this.isDoingSetCenter=!1,this.state.editable&&(clearTimeout(this.resetEditableTimeoutId),this.resetEditableTimeoutId=setTimeout(()=>{this.state.editable&&(this.innerOverlay.disableEditing(),this.innerOverlay.enableEditing())},0))}getCenter(){return x.fromBaidu(this.innerOverlay.getCenter(),this.coordType)}setRadius(e){this.isDoingSetRadius=!0,this.innerOverlay.setRadius(e),this.isDoingSetRadius=!1}getRadius(){return this.innerOverlay.getRadius()}}class ft extends gt{static create(t){const e=this.coordType,r=new google.maps.Circle({center:t.center.toGoogle(e),radius:t.radius,clickable:t.clickable,editable:t.editable,strokeColor:t.strokeColor,strokeOpacity:t.strokeOpacity,strokeWeight:t.strokeWeight,fillColor:t.fillColor,fillOpacity:t.fillOpacity,visible:t.visible});return new ft(r,e,this)}setCenter(t){this.coordType=this.map.coordType,this.innerOverlay.setCenter(t.toGoogle(this.coordType))}getCenter(){return x.fromGoogle(this.innerOverlay.getCenter()??ie.LATLNG_ZERO,this.coordType)}setRadius(t){this.innerOverlay.setRadius(t)}getRadius(){return this.innerOverlay.getRadius()}}exports.Point=void 0;(i=>{i.ZERO={x:0,y:0}})(exports.Point||(exports.Point={}));let Dt;function Gi(i,t,e,r,n,s){return Dt||(Dt=Ni()),new Dt(i,t,e,r,n,s)}function Ni(){yr();const i=new BMap.Point(0,0);return class extends BMap.OverlayV3{constructor(r,n=i,s=exports.Point.ZERO,a,h=654,o=""){super();m(this,"container");m(this,"border");m(this,"inner");m(this,"map");m(this,"marker");this.content=r,this.position=n,this.offset=s;const c="baidu-info-box-container";this.container=document.createElement("div"),this.container.className=c,this.container.style.position="absolute";const p=g=>g.stopPropagation();this.container.onclick=p,this.container.ondblclick=p,this.container.oncontextmenu=p,this.container.onmousedown=p,this.container.onmousemove=p,this.container.onmousewheel=p,this.border=document.createElement("div"),this.border.className=`${c}__border ${o}`,this.inner=document.createElement("div"),this.inner.className=c+"__inner";const u=document.createElement("span");u.className=c+"__close",u.addEventListener("click",()=>{this.close(),this.dispatchEvent({type:"onclickclose"})}),this.inner.appendChild(r),this.border.appendChild(this.inner),this.border.appendChild(u),this.container.appendChild(this.border),a&&this.setZIndex(a),this.setMaxWidth(h),this.onMarkerPositionChanged=this.onMarkerPositionChanged.bind(this)}initialize(r){return this.map=r,r.getPanes().floatPane.appendChild(this.container),this.container}draw(){if(!this.map)return;const r=this.marker?this.marker.getPosition():this.position,n=this.map.pointToOverlayPixel(r),s=n.x+this.offset.x,a=n.y+this.offset.y;this.container.style.left=`${s}px`,this.container.style.top=`${a}px`}open(r,n){n&&n===this.marker||(this.marker&&this.detachMarker(this.marker),this.marker=n,this.marker&&this.attachMarker(this.marker),this.isOpen()?this.draw():this.marker&&!this.marker.getMap()||r.addOverlay(this))}attachMarker(r){r.__info_box__=this,r.addEventListener("dragging",this.onMarkerPositionChanged),r.addEventListener("dragend",this.onMarkerPositionChanged)}detachMarker(r){r.__info_box__=void 0,r.removeEventListener("dragging",this.onMarkerPositionChanged),r.removeEventListener("dragend",this.onMarkerPositionChanged)}close(){this.map&&(this.map.removeOverlay(this),this.marker&&(this.detachMarker(this.marker),this.marker=void 0),this.map=void 0)}isOpen(){return this.map&&this.map.getPanes().floatPane===this.container.parentNode}onMarkerPositionChanged(){this.draw()}setZIndex(r){this.container.style.zIndex=`${r}`}setMaxWidth(r){this.border.style.maxWidth=`${r}px`}setPosition(r){this.marker||(this.position=r,this.draw())}getPosition(){return this.position}setOffset(r){this.offset=r,this.draw()}getOffset(){return this.offset}}}class yt{constructor(t){this.delegate=t,this.delegate.setTarget(this)}addEventListener(t,e){this.delegate.addEventListener(t,e)}removeEventListener(t,e){this.delegate.removeEventListener(t,e)}}class vt extends yt{constructor(t,e,r){super(new Se(t,e)),this.inner=t,this.map=e,this.state=r}static create(t){const e=t.position||x.ZERO,r=new BMap.InfoWindow(t.content,{maxWidth:t.maxWidth,offset:t.offset&&new BMap.Size(t.offset.x,t.offset.y),enableAutoPan:!t.disableAutoPan});return new vt(r,this,{position:e})}isOpen(){return this.inner.isOpen()}open(t){t?t.innerOverlay.openInfoWindow(this.inner):this.map.innerMap.openInfoWindow(this.inner,(this.state.position||x.ZERO).toBaidu(this.map.coordType)),this.map.setLatestInfoWindowInternal(this)}close(){this.inner.isOpen()&&this.map.innerMap.closeInfoWindow()}getPosition(){const t=this.inner.getPosition();return t&&x.fromBaidu(t,this.map.coordType)||this.state.position||x.ZERO}setPosition(t){this.state.position=t,this.inner.isOpen()&&this.open()}}class _t extends yt{constructor(e,r){super(new de(e,r));m(this,"eventHub",new Mr);m(this,"isOpened",!1);this.inner=e,this.map=r,e.addListener("closeclick",()=>{this.isOpened=!1,this.eventHub.hasListener("close")&&this.eventHub.notify({type:"close",target:this})}),e.addListener("map_changed",()=>{const n=this.isOpened;this.isOpened=!!e.getMap(),n&&!this.isOpened&&this.eventHub.hasListener("close")&&this.eventHub.notify({type:"close",target:this})})}static create(e){const r=e.position||x.ZERO,n=new google.maps.InfoWindow({content:e.content,maxWidth:e.maxWidth,pixelOffset:e.offset&&new google.maps.Size(e.offset.x,e.offset.y),position:r.toGoogle(this.coordType),disableAutoPan:e.disableAutoPan});return new _t(n,this)}isOpen(){return this.isOpened}addEventListener(e,r){if(e==="open"||e==="close"){this.eventHub.addEventListener(e,r);return}super.addEventListener(e,r)}removeEventListener(e,r){if(e==="open"||e==="close"){this.eventHub.removeEventListener(e,r);return}super.removeEventListener(e,r)}open(e){if(!this.isOpened){if(this.map.mapOptions.infoWindowMode==="single"){const r=this.map.getLatestInfoWindow();r&&r.close()}this.inner.open(this.map.innerMap,e==null?void 0:e.innerOverlay),this.isOpened=!0,this.map.setLatestInfoWindowInternal(this),this.eventHub.notify({type:"open",target:this})}}close(){this.isOpened&&(this.isOpened=!1,this.inner.close(),this.eventHub.notify({type:"close",target:this}))}getPosition(){return x.fromGoogle(this.inner.getPosition()??ie.LATLNG_ZERO,this.map.coordType)}setPosition(e){this.inner.setPosition(e.toGoogle(this.map.coordType))}}class Mt extends ze{constructor(t,e,r){super(t,e,r),this.baiduMap=r}static create(t){var n;const e=this.coordType,r=Gi(t.content,(n=t.position)==null?void 0:n.toBaidu(e),t.offset,t.zIndex,t.maxWidth,t.borderClass);return new Mt(r,e,this)}open(t){this.innerOverlay.open(this.baiduMap.innerMap,t==null?void 0:t.innerOverlay)}close(){this.innerOverlay.close()}getPosition(){return x.fromBaidu(this.innerOverlay.getPosition(),this.coordType)}setPosition(t){this.coordType=this.map.coordType,this.innerOverlay.setPosition(t.toBaidu(this.coordType))}setMaxWidth(t){this.innerOverlay.setMaxWidth(t)}setZIndex(t){this.innerOverlay.setZIndex(t)}}class bt extends yt{constructor(t,e,r){super(new de(t,r)),this.inner=t,this.coordType=e,this.map=r}static create(t){var s;const e=this.coordType,r=new google.maps.InfoWindow({content:t.content,position:(s=t.position)==null?void 0:s.toGoogle(e),pixelOffset:t.offset&&new google.maps.Size(t.offset.x,t.offset.y),zIndex:t.zIndex,maxWidth:t.maxWidth}),n=t.borderClass;return n&&r.addListener("domready",()=>{var h;const a=(h=t.content.parentElement)==null?void 0:h.parentElement;a&&a.className.includes("gm-style-iw-c")&&!a.className.includes(n)&&(a.className+=` ${n}`)}),new bt(r,e,this)}open(t){this.inner.open(this.map.innerMap,t==null?void 0:t.innerOverlay)}close(){this.inner.close()}getPosition(){return x.fromGoogle(this.inner.getPosition()??ie.LATLNG_ZERO,this.coordType)}setPosition(t){this.coordType=this.map.coordType,this.inner.setPosition(t.toGoogle(this.coordType))}isOpen(){return this.inner.getMap()!=null}setMaxWidth(t){if(this.isOpen()){const e=this.inner.getMap(),r=this.inner.getAnchor();this.inner.close(),this.inner.setOptions({maxWidth:t}),this.inner.open(e,r)}else this.inner.setOptions({maxWidth:t})}setZIndex(t){this.inner.setZIndex(t)}}exports.Strings=void 0;(i=>{function t(s,a){if(s!==void 0)return Object.values(a).includes(s)?s:void 0}i.toEnumOrNull=t;function e(s){return s.split(`
|
|
13
|
-
`).map(a=>a.trim()).join(`
|
|
14
|
-
`)}i.trimIndent=e;function r(s){return s.replace(/([^A-Z]?)([A-Z])/g,(a,h,o)=>h?`${h}-${o.toLowerCase()}`:o.toLowerCase())}i.pascal2kebab=r;function n(s){return/^-?\d+$/.test(s)}i.isInt=n})(exports.Strings||(exports.Strings={}));var ue=(i=>(i.map="map",i.overlay="overlay",i.overlayMouseTarget="overlayMouseTarget",i.float="float",i))(ue||{});exports.MapPanes=void 0;(i=>{function t(r,n){switch(r){case"float":return n.floatPane;case"overlayMouseTarget":return n.overlayMouseTarget;case"overlay":return n.overlayLayer;case"map":return n.mapPane;default:O.assertNever(r)}}i.toGoogle=t;function e(r,n){switch(r){case"float":return n.floatPane;case"overlayMouseTarget":return n.markerMouseTarget;case"overlay":return n.markerPane;case"map":return n.mapPane;default:O.assertNever(r)}}i.toBaidu=e})(exports.MapPanes||(exports.MapPanes={}));class Fr{constructor(t,e){m(this,"baidu");m(this,"google");m(this,"projection");m(this,"element",O.lateinit());m(this,"mapPane");this.map=t,this.mapPane=e.mapPane}create(){return this.element=this.onCreate(),this.element.className+=" element-overlay",this.element}draw(){this.projection&&this.onDraw(this.projection)}getProjection(){return this.projection}asBaidu(){if(!this.baidu){const t=this;yr();class e extends BMap.OverlayV3{initialize(s){var o;const a=t.create(),h=s.getPanes();return(o=exports.MapPanes.toBaidu(t.mapPane,h))==null||o.appendChild(a),a}draw(){t.draw()}}this.baidu=new e;const r=t.map.innerMap;this.projection={fromLatLngToOverlayPoint(n){return r.pointToOverlayPixel(n.toBaidu(t.map.coordType))},fromOverlayPointToLatLng(n){return x.fromBaidu(r.overlayPixelToPoint(new BMap.Pixel(n.x,n.y)),t.map.coordType)}}}return this.baidu}asGoogle(){if(!this.google){const t=this;class e extends google.maps.OverlayView{onAdd(){const n=t.create(),s=this.getPanes()??O.throwError("onAdd回调中一定会有panes");exports.MapPanes.toGoogle(t.mapPane,s).appendChild(n)}draw(){t.draw()}onRemove(){var n;(n=t.element.parentNode)==null||n.removeChild(t.element)}}this.google=new e,this.projection={fromLatLngToOverlayPoint(r){return t.google.getProjection().fromLatLngToDivPixel(r.toGoogle(t.map.coordType))??exports.Point.ZERO},fromOverlayPointToLatLng(r){return x.fromGoogle(t.google.getProjection().fromDivPixelToLatLng(new google.maps.Point(r.x,r.y))??ie.LATLNG_ZERO,t.map.coordType)}}}return this.google}}let zt;function Zi(i,t,e,r,n){return zt||(zt=Wi()),new zt(i,t,e,r,n)}function Wi(){return class extends google.maps.OverlayView{constructor(e,r,n,s=ue.overlayMouseTarget,a){super();m(this,"container");this.position=r,this.offset=n,this._mapPane=s,this.container=document.createElement("div"),this.container.className="label-container",this.container.style.position="absolute",a&&this.setZIndex(a),this.container.addEventListener("click",()=>{google.maps.event.trigger(this,"click")}),this.setElement(e)}setZIndex(e){this.container.style.zIndex=`${e}`}setElement(e){const r=this.container.firstChild;r!==e&&(r?this.container.replaceChild(r,e):this.container.appendChild(e))}onAdd(){const e=this.getPanes()??O.throwError("onAdd回调中一定能够获取panes");exports.MapPanes.toGoogle(this._mapPane,e).appendChild(this.container)}draw(){var e,r;if(this.container.style.display=this.position?"block":"none",this.position){const n=this.getProjection();if(n){const s=n.fromLatLngToDivPixel(this.position);s&&(this.container.style.left=`${s.x+(((e=this.offset)==null?void 0:e.x)??0)}px`,this.container.style.top=`${s.y+(((r=this.offset)==null?void 0:r.y)??0)}px`)}}}onRemove(){var e;(e=this.container.parentNode)==null||e.removeChild(this.container)}setPosition(e){this.position=e,this.draw()}getPosition(){return this.position}setOffset(e){this.offset=e,this.draw()}getOffset(){return this.offset}getVisible(){return this.container.style.visibility!=="hidden"}setVisible(e){this.container.style.visibility=e?"visible":"hidden"}}}var pe;(i=>{function t(r){return typeof r=="string"?r:r.outerHTML}i.toString=t;function e(r){if(typeof r=="string"){const n=document.createElement("div");return n.innerHTML=r,n}return r}i.toElement=e})(pe||(pe={}));class Jt extends ze{constructor(e,r,n,s){super(e,r,n);m(this,"icon");m(this,"iconAnchor");m(this,"content",O.lateinit());m(this,"contentObserver");this.setContentInternal(s,!0)}static create(e){var a;const r=this.coordType,n=new BMap.Label(pe.toString(e.content),{position:(a=e.position)==null?void 0:a.toBaidu(r),offset:e.offset&&new BMap.Size(e.offset.x,e.offset.y)});e.zIndex&&n.setZIndex(e.zIndex),n.setStyle({border:"0px",padding:"0px",backgroundColor:"unset"});const s=new Jt(n,r,this,e.content);return n.__label__=s,s}setContentInternal(e,r=!1){this.content!==e&&(this.contentObserver&&(this.contentObserver.disconnect(),this.contentObserver=void 0),typeof e!="string"&&(this.contentObserver=new MutationObserver(()=>{this.innerOverlay.setContent(e.outerHTML)}),this.contentObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})),r||this.innerOverlay.setContent(pe.toString(e)),this.content=e)}setZIndex(e){this.innerOverlay.setZIndex(e)}getPosition(){return x.fromBaidu(this.innerOverlay.getPosition(),this.coordType)}setPosition(e){this.coordType=this.map.coordType,this.innerOverlay.setPosition(e.toBaidu(this.coordType))}getOffset(){const e=this.innerOverlay.getOffset();let r=0,n=0;return this.iconAnchor&&(r=this.iconAnchor.width,n=this.iconAnchor.height),{x:e.width-r,y:e.height-n}}setOffset(e){let r=0,n=0;this.iconAnchor&&(r=this.iconAnchor.width,n=this.iconAnchor.height),this.innerOverlay.setOffset(new BMap.Size(e.x+r,e.y+n))}setContent(e){this.setContentInternal(e)}attachIcon(e){var h;let r;if(e instanceof BMap.Icon)r=e.anchor;else if(e)if(e.anchor)r=e.anchor;else{const o=((h=e.__icon__)==null?void 0:h.baiduLabelOffset)??{x:0,y:0};r={width:e.style.anchor.width+o.x,height:e.style.anchor.height+o.y},process.env.NODE_ENV!=="production"&&setTimeout(()=>{var u,g;if(O.assert(e.__icon__,`${e}必须是由'SymbolIcon.toBaidu()'创建的`),!e.anchor){console.log("BaiduLabelOverlay.attachIcon","Bmap.Symbol.anchor尚未计算完成");return}const c=e.anchor.width-e.style.anchor.width,p=e.anchor.height-e.style.anchor.height;if(o.x!==c||o.y!==p){const y=[(u=e.__icon__.anchor)==null?void 0:u.x,(g=e.__icon__.anchor)==null?void 0:g.y,e.__icon__.rotation,e.__icon__.scale,e.__icon__.strokeWeight].map(_=>_??"").join(",");console.warn("BaiduLabelOverlay.attachIcon",e.__icon__,exports.Strings.trimIndent(`
|
|
15
|
-
为了保证Label的位置正确, 请将SymbolIcon(${y})中baiduLabelOffset的值改写成:
|
|
16
|
-
${JSON.stringify({x:c,y:p})}
|
|
17
|
-
`))}},1)}const n=this.innerOverlay.getOffset();let s=n.width,a=n.height;this.iconAnchor&&(s-=this.iconAnchor.width,a-=this.iconAnchor.height),r&&(s+=r.width,a+=r.height),this.innerOverlay.setOffset(new BMap.Size(s,a)),this.icon=e,this.iconAnchor=r}}class Qt extends pt{static create(t){var n;const e=this.coordType,r=Zi(pe.toElement(t.content),(n=t.position)==null?void 0:n.toGoogle(e),t.offset,t.mapPane,t.zIndex);return new Qt(r,e,this)}setZIndex(t){this.innerOverlay.setZIndex(t)}setContent(t){this.innerOverlay.setElement(pe.toElement(t))}getPosition(){const t=this.innerOverlay.getPosition();return t?x.fromGoogle(t,this.coordType):x.ZERO}setPosition(t){this.coordType=this.map.coordType,this.innerOverlay.setPosition(t.toGoogle(this.coordType))}getOffset(){return this.innerOverlay.getOffset()??exports.Point.ZERO}setOffset(t){this.innerOverlay.setOffset(t)}}const ke={toGoogle:i=>"url"in i?exports.Icon.toGoogle(i):exports.SymbolIcon.toGoogle(i),toBaidu:i=>"url"in i?exports.Icon.toBaidu(i):exports.SymbolIcon.toBaidu(i)};exports.Icon=void 0;(i=>{function t(r){return{url:r.url,size:new google.maps.Size(r.size.width,r.size.height),origin:r.origin&&new google.maps.Point(r.origin.x,r.origin.y),scaledSize:r.scaledSize&&new google.maps.Size(r.scaledSize.width,r.scaledSize.height),anchor:r.anchor&&new google.maps.Point(r.anchor.x,r.anchor.y),labelOrigin:r.labelOrigin&&new google.maps.Point(r.labelOrigin.x,r.labelOrigin.y)}}i.toGoogle=t;function e(r){const n=new BMap.Icon(r.url,new BMap.Size(r.size.width,r.size.height),{imageOffset:r.origin&&new BMap.Size(-r.origin.x,-r.origin.y),imageSize:r.scaledSize&&new BMap.Size(r.scaledSize.width,r.scaledSize.height),anchor:r.anchor?new BMap.Size(r.anchor.x,r.anchor.y):new BMap.Size(r.size.width/2,r.size.height)});return n.__icon__=r,n}i.toBaidu=e})(exports.Icon||(exports.Icon={}));exports.SymbolIcon=void 0;(i=>{function t(r){return{path:typeof r.path=="string"?r.path:r.path.google(),anchor:r.anchor&&new google.maps.Point(r.anchor.x,r.anchor.y),fillColor:r.fillColor,fillOpacity:r.fillOpacity,scale:r.scale,rotation:r.rotation,strokeColor:r.strokeColor,strokeOpacity:r.strokeOpacity,strokeWeight:r.strokeWeight}}i.toGoogle=t;function e(r){const n=new BMap.Symbol(typeof r.path=="string"?r.path:r.path.baidu(),{anchor:r.anchor&&new BMap.Size(r.anchor.x,r.anchor.y),fillColor:r.fillColor,fillOpacity:r.fillOpacity,scale:r.scale,rotation:r.rotation,strokeColor:r.strokeColor,strokeOpacity:r.strokeOpacity,strokeWeight:r.strokeWeight});return n.__icon__=r,n}i.toBaidu=e})(exports.SymbolIcon||(exports.SymbolIcon={}));const Hi={CIRCLE:{baidu:()=>BMap_Symbol_SHAPE_CIRCLE,google:()=>google.maps.SymbolPath.CIRCLE},BACKWARD_CLOSED_ARROW:{baidu:()=>BMap_Symbol_SHAPE_BACKWARD_CLOSED_ARROW,google:()=>google.maps.SymbolPath.BACKWARD_CLOSED_ARROW},BACKWARD_OPEN_ARROW:{baidu:()=>BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW,google:()=>google.maps.SymbolPath.BACKWARD_OPEN_ARROW},FORWARD_CLOSED_ARROW:{baidu:()=>BMap_Symbol_SHAPE_FORWARD_CLOSED_ARROW,google:()=>google.maps.SymbolPath.FORWARD_CLOSED_ARROW},FORWARD_OPEN_ARROW:{baidu:()=>BMap_Symbol_SHAPE_FORWARD_OPEN_ARROW,google:()=>google.maps.SymbolPath.FORWARD_OPEN_ARROW}};exports.IconSequence=void 0;(i=>{function t(r){return{icon:exports.SymbolIcon.toGoogle(r.icon),offset:r.offset,repeat:r.repeat,fixedRotation:r.fixedRotation}}i.toGoogle=t;function e(r){return new BMap.IconSequence(exports.SymbolIcon.toBaidu(r.icon),r.offset,r.repeat??"",r.fixedRotation)}i.toBaidu=e})(exports.IconSequence||(exports.IconSequence={}));const Nt={toBaidu:i=>{const t=["baidu-marker-label"];i.className&&t.push(i.className);const e=new BMap.Label(`<span class="${t.join(" ")}">${i.text}</span>`);return e.setStyle({border:"0px",padding:"0px",backgroundColor:"unset",color:i.color??"black",fontSize:i.fontSize??"14px",fontWeight:i.fontWeight??"",fontFamily:i.fontFamily??"Roboto, Arial, sans-serif"}),e},toGoogle:i=>i};class ge extends ze{constructor(t,e,r,n){super(t,e,r),this.state=n}static create(t){const e=this.coordType,r=t.icon,n={title:t.title,icon:r&&ke.toBaidu(r),enableClicking:t.clickable,enableDragging:t.draggable,raiseOnDrag:t.crossOnDrag===void 0?!0:t.crossOnDrag,draggingCursor:t.cursor},s=new BMap.Marker(t.position.toBaidu(e,t.normalizePositionForBaidu),n);s.__create_by_tg__=!0,t.zIndex!==void 0&&s.setZIndex(t.zIndex);const a=t.clickable===void 0?!0:t.clickable,h=!!t.draggable,o=new ge(s,e,this,{clickable:a,draggable:h,zIndex:t.zIndex,normalize:t.normalizePositionForBaidu}).visibleOptionInternal(t.visible);return t.label&&o.setLabel(t.label),o}getPosition(){return x.fromBaidu(this.innerOverlay.getPosition(),this.coordType)}setPosition(t){var e;this.coordType=this.map.coordType,this.innerOverlay.setPosition(t.toBaidu(this.coordType,this.state.normalize)),(e=this.innerOverlay.__info_box__)==null||e.onMarkerPositionChanged()}setTitle(t){this.innerOverlay.setTitle(t)}getTitle(){return this.innerOverlay.getTitle()}setIcon(t){const e=ke.toBaidu(t);this.innerOverlay.setIcon(e),this._updateMarkerLabelOffset();const r=this.getLabelOverlay();r&&r.attachIcon(e)}getIcon(){return this.innerOverlay.getIcon()}setClickable(t){this.state.clickable=t}isClickable(){return this.state.clickable}setDraggable(t){this.state.draggable=t,t?this.innerOverlay.enableDragging():this.innerOverlay.disableDragging()}isDraggable(){return this.state.draggable}setZIndex(t){this.state.zIndex=t,this.innerOverlay.setZIndex(t||0)}getZIndex(){return this.state.zIndex}setLabel(t){const e=this.innerOverlay.getLabel();e&&this.map.innerMap.removeOverlay(e),this.innerOverlay.setLabel(Nt.toBaidu(t)),this._updateMarkerLabelOffset()}_updateMarkerLabelOffset(){const t=this.innerOverlay.getIcon(),e=t.__icon__,r=this.innerOverlay.getLabel();if(r&&t&&!e&&t.imageUrl==="https://api.map.baidu.com/images/marker_red_sprite.png"){r.setOffset(new BMap.Size(9,9));return}!r||!e||!("size"in e)||r.setOffset(e.labelOrigin?new BMap.Size(e.labelOrigin.x,e.labelOrigin.y):new BMap.Size(e.size.width/2,e.size.height/2))}attachLabelOverlay(t){const e=this.getLabelOverlay();process.env.NODE_ENV!=="production"&&this.innerOverlay.getLabel()&&!e&&console.warn("当前label不是LabelOverlay, 可能是混用 MarkerLabel/marker.setLabel() 和 LabelOverlay/<tg-label> 导致的, 请不要混用他们两者",this.innerOverlay.getLabel()),e&&e.attachIcon(void 0),t&&t.attachIcon(this.innerOverlay.getIcon()),this.innerOverlay.setLabel(t==null?void 0:t.innerOverlay)}getLabelOverlay(){var t;return(t=this.innerOverlay.getLabel())==null?void 0:t.__label__}}class Ct extends pt{constructor(){super(...arguments);m(this,"label");m(this,"labelPositionListener");m(this,"labelVisibleListener");m(this,"labelMapChangedListener")}static create(e){const r=this.coordType,n=e.icon,s={position:e.position.toGoogle(r),title:e.title,label:e.label&&Nt.toGoogle(e.label),zIndex:e.zIndex,visible:e.visible,icon:n&&ke.toGoogle(n),clickable:e.clickable,draggable:e.draggable,crossOnDrag:e.crossOnDrag,cursor:e.cursor,anchorPoint:new google.maps.Point(0,0)};return new Ct(new google.maps.Marker(s),r,this)}getPosition(){return x.fromGoogle(this.innerOverlay.getPosition(),this.coordType)}setPosition(e){this.coordType=this.map.coordType,this.innerOverlay.setPosition(e.toGoogle(this.coordType))}setTitle(e){this.innerOverlay.setTitle(e)}getTitle(){return this.innerOverlay.getTitle()||""}setIcon(e){this.innerOverlay.setIcon(ke.toGoogle(e))}getIcon(){return this.innerOverlay.getIcon()}setClickable(e){this.innerOverlay.setClickable(e)}isClickable(){return this.innerOverlay.getClickable()}setDraggable(e){this.innerOverlay.setDraggable(e)}isDraggable(){return!!this.innerOverlay.getDraggable()}setZIndex(e){this.innerOverlay.setZIndex(e===void 0?null:e)}getZIndex(){const e=this.innerOverlay.getZIndex();return e===null?void 0:e}setLabel(e){this.innerOverlay.setLabel(Nt.toGoogle(e))}attachLabelOverlay(e){if(this.label&&this.map.removeOverlay(this.label),this.labelPositionListener&&this.labelPositionListener.remove(),this.labelVisibleListener&&this.labelVisibleListener.remove(),this.labelMapChangedListener&&this.labelMapChangedListener.remove(),e){const r=()=>{e.innerOverlay.setPosition(this.innerOverlay.getPosition())},n=()=>{e.innerOverlay.setVisible(this.innerOverlay.getVisible())},s=()=>{this.innerOverlay.getMap()?this.map.addOverlay(e):this.map.removeOverlay(e)};s(),r(),n(),this.label=e,this.labelMapChangedListener=this.innerOverlay.addListener("map_changed",s),this.labelPositionListener=this.innerOverlay.addListener("position_changed",r),this.labelVisibleListener=this.innerOverlay.addListener("visible_changed",n)}else this.label=void 0,this.labelPositionListener=void 0,this.labelVisibleListener=void 0,this.labelMapChangedListener=void 0}}class Tt extends Y{constructor(){super(...arguments);m(this,"eventHubDelegate");m(this,"prevPath");m(this,"isDoingSetPath",!1);m(this,"onLineUpdate",()=>{var r;const e=this.innerOverlay.getPath();e!==this.prevPath&&(this.isDoingSetPath||(r=this.eventHubDelegate)==null||r.notify({type:this.pathEditedEventType,target:this,originalEvent:{prevPath:this.prevPath,path:e}}),this.prevPath=e)})}setPathInternal(e){this.isDoingSetPath=!0,this.innerOverlay.setPath(e),this.isDoingSetPath=!1}createDelegate(){return this.eventHubDelegate=new rt(super.createDelegate(),{types:[this.pathEditedEventType],onListen:()=>{this.prevPath=this.innerOverlay.getPath(),this.innerOverlay.addEventListener("lineupdate",this.onLineUpdate)},onCancel:()=>{this.innerOverlay.removeEventListener("lineupdate",this.onLineUpdate),this.prevPath=void 0}})}}class Ot extends Tt{constructor(){super(...arguments);m(this,"pathEditedEventType","path-edited")}static create(e){var s,a;const r=this.coordType,n=new BMap.Polyline(e.path.map(h=>h.toBaidu(r)),{enableClicking:e.clickable,enableEditing:e.editable,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity!=null?e.strokeOpacity+Y.OPACITY_DELTA:void 0,strokeWeight:e.strokeWeight,icons:(s=e.icons)==null?void 0:s.map(exports.IconSequence.toBaidu)});return new Ot(n,r,this,{editable:!!e.editable,symbolIcons:(a=e.icons)==null?void 0:a.map(h=>h.icon)}).visibleOptionInternal(e.visible)}getPath(){return this.innerOverlay.getPath().map(e=>x.fromBaidu(e,this.coordType))}setPath(e){this.coordType=this.map.coordType,this.setPathInternal(e.map(r=>r.toBaidu(this.coordType)))}remove(){var e;super.remove(),(e=this.state.symbolIcons)!=null&&e.length&&this.map.innerMap.getOverlays().filter(n=>{var o;if(!(n instanceof BMap.Marker))return!1;const s=n;if(s.__create_by_tg__)return!1;const a=s.getIcon();if(!(a instanceof BMap.Symbol))return!1;const h=a;return h.__icon__?(o=this.state.symbolIcons)==null?void 0:o.includes(h.__icon__):!1}).forEach(n=>this.map.innerMap.removeOverlay(n))}}class wt extends gt{constructor(){super(...arguments);m(this,"pathChangedListeners");m(this,"eventHubDelegate")}static create(e){var s;const r=this.coordType,n=new google.maps.Polyline({path:e.path.map(a=>a.toGoogle(r)),clickable:e.clickable,editable:e.editable,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight,visible:e.visible,icons:(s=e.icons)==null?void 0:s.map(exports.IconSequence.toGoogle)});return new wt(n,r,this)}setupPathChangedListeners(){const e=()=>{var n;return(n=this.eventHubDelegate)==null?void 0:n.notify({type:"path-edited",target:this})},r=this.innerOverlay.getPath();this.pathChangedListeners=exports.MVCArrays.listenChanged(r,e)}clearPathChangedListeners(){var e;(e=this.pathChangedListeners)==null||e.forEach(r=>r.remove()),this.pathChangedListeners=void 0}createDelegate(){return this.eventHubDelegate=new rt(super.createDelegate(),{types:["path-edited"],onListen:()=>this.setupPathChangedListeners(),onCancel:()=>this.clearPathChangedListeners()})}getPath(){const e=[];return this.innerOverlay.getPath().forEach(r=>{e.push(x.fromGoogle(r,this.coordType))}),e}setPath(e){var r;this.coordType=this.map.coordType,this.innerOverlay.setPath(e.map(n=>n.toGoogle(this.coordType))),(r=this.eventHubDelegate)!=null&&r.hasListener("path-edited")&&this.setupPathChangedListeners()}}class xt extends Tt{constructor(){super(...arguments);m(this,"pathEditedEventType","paths-edited")}static create(e){const r=this.coordType;e.paths.length>1&&console.warn("baidu不支持多path, 只会显示paths[0]");const n=e.paths[0]||[],s=new BMap.Polygon(n.map(a=>a.toBaidu(r)),{enableClicking:e.clickable,enableEditing:e.editable,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity!=null?e.strokeOpacity+Y.OPACITY_DELTA:void 0,strokeWeight:e.strokeWeight,fillColor:e.fillColor,fillOpacity:e.fillOpacity!=null?e.fillOpacity+Y.OPACITY_DELTA:void 0});return new xt(s,r,this,{editable:!!e.editable}).visibleOptionInternal(e.visible)}getPaths(){return[this.innerOverlay.getPath().map(e=>x.fromBaidu(e,this.coordType))]}setPaths(e){e.length>1&&console.warn("baidu不支持多path, 只会显示paths[0]"),this.coordType=this.map.coordType,this.setPathInternal((e[0]||[]).map(r=>r.toBaidu(this.coordType)))}}class Pt extends gt{constructor(){super(...arguments);m(this,"pathChangedListeners");m(this,"eventHubDelegate")}static create(e){const r=this.coordType,n=new google.maps.Polygon({paths:e.paths.map(s=>s.map(a=>a.toGoogle(r))),clickable:e.clickable,editable:e.editable,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight,fillColor:e.fillColor,fillOpacity:e.fillOpacity,visible:e.visible});return new Pt(n,r,this)}setupPathChangedListeners(){const e=()=>{var n;return(n=this.eventHubDelegate)==null?void 0:n.notify({type:"paths-edited",target:this})},r=this.innerOverlay.getPaths();this.pathChangedListeners=[],r.forEach(n=>{this.pathChangedListeners.push(...exports.MVCArrays.listenChanged(n,e))})}clearPathChangedListeners(){var e;(e=this.pathChangedListeners)==null||e.forEach(r=>r.remove()),this.pathChangedListeners=void 0}createDelegate(){return this.eventHubDelegate=new rt(super.createDelegate(),{types:["paths-edited"],onListen:()=>this.setupPathChangedListeners(),onCancel:()=>this.clearPathChangedListeners()})}getPaths(){const e=this.innerOverlay.getPaths(),r=[];return e.forEach(n=>{const s=[];r.push(s),n.forEach(a=>{s.push(x.fromGoogle(a,this.coordType))})}),r}setPaths(e){var r;this.coordType=this.map.coordType,this.innerOverlay.setPaths(e.map(n=>n.map(s=>s.toGoogle(this.coordType)))),(r=this.eventHubDelegate)!=null&&r.hasListener("paths-edited")&&this.setupPathChangedListeners()}}class Lt extends Tt{constructor(e,r,n,s){super(e,r,n,s);m(this,"pathEditedEventType","bounds-changed");m(this,"isDoingUpdateRectangle",!1);m(this,"onBoundsChanged",({originalEvent:e})=>{if(this.isDoingUpdateRectangle)return;const r=e.prevPath??[],n=e.path;setTimeout(()=>{let s=n;const a=n.length;if(r.length===4)if(a>r.length){for(let o=0;o<a;o++)if(r[o]==null||!sr.equals(n[o],r[o])){const c=n[(o-2+a)%a],p=n[(o-1+a)%a],u=n[o],g=n[(o+1)%a],y=n[(o+2)%a];let _;p.lat===g.lat?_=new BMap.Point(p.lng,u.lat):p.lng===g.lng?_=new BMap.Point(u.lng,p.lat):_=u,s=[c,y,_];break}}else if(a===r.length){for(let o=0;o<a;o++)if(!sr.equals(n[o],r[o])){s=[n[o],n[(o+2)%4]];break}}else a<r.length;const h=K.fromArray(s.map(o=>x.fromBaidu(o,this.coordType)));h&&(this.isDoingUpdateRectangle=!0,this.innerOverlay.setPath(h.toRectArray().map(o=>o.toBaidu(this.coordType))),this.isDoingUpdateRectangle=!1)},0)});this.addEventListener("bounds-changed",this.onBoundsChanged)}static create(e){const r=this.coordType,n=new BMap.Polygon(e.bounds.toRectArray().map(s=>s.toBaidu(r)),{enableClicking:e.clickable,enableEditing:e.editable,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity!=null?e.strokeOpacity+Y.OPACITY_DELTA:void 0,strokeWeight:e.strokeWeight,fillColor:e.fillColor,fillOpacity:e.fillOpacity!=null?e.fillOpacity+Y.OPACITY_DELTA:void 0});return new Lt(n,r,this,{editable:!!e.editable}).visibleOptionInternal(e.visible)}getBounds(){return K.fromBaidu(this.innerOverlay.getBounds(),this.coordType)}setBounds(e){const r=e.toRectArray();this.innerOverlay.getPath().length===r.length?e.toRectArray().forEach((n,s)=>{this.innerOverlay.setPositionAt(s,n.toBaidu(this.coordType))}):this.setPathInternal(r.map(n=>n.toBaidu(this.coordType)))}}class Et extends gt{static create(t){const e=this.coordType,r=new google.maps.Rectangle({bounds:t.bounds.toGoogle(e),clickable:t.clickable,editable:t.editable,strokeColor:t.strokeColor,strokeOpacity:t.strokeOpacity,strokeWeight:t.strokeWeight,fillColor:t.fillColor,fillOpacity:t.fillOpacity,visible:t.visible});return new Et(r,e,this)}getBounds(){return K.fromGoogle(this.innerOverlay.getBounds()??ie.BOUNDS_ZERO,this.coordType)}setBounds(t){const e=t.toGoogle(this.coordType);e.equals(this.innerOverlay.getBounds())||this.innerOverlay.setBounds(e)}}const ne=1;class ji extends ut{constructor(e,r){var n;super(e);m(this,"buildInMapTypeId2BIMT");m(this,"baiduMapType2BIMT");m(this,"map");m(this,"createLabel",Jt.create);m(this,"createCircle",mt.create);m(this,"createPolygon",xt.create);m(this,"createPolyline",Ot.create);m(this,"createRectangle",Lt.create);m(this,"createInfoWindow",vt.create);m(this,"createInfoBox",Mt.create);m(this,"createMarker",ge.create);m(this,"createMapTypeControl",st.create);m(this,"createZoomControl",ct.create);m(this,"createStreetViewControl",lt.create);m(this,"createScaleControl",ot.create);this.buildInMapTypeId2BIMT=exports.MapType.BUILD_IN_MAP_TYPES.getValueMap(V.prototype.getId),this.baiduMapType2BIMT=exports.MapType.BUILD_IN_MAP_TYPES.getValueMap(V.prototype.asBaiduMapType),Mi(),this.map=new BMap.Map(e,{minZoom:r.minZoom&&r.minZoom+ne,maxZoom:r.maxZoom&&r.maxZoom+ne,mapType:r.buildInMapTypeId&&((n=this.buildInMapTypeId2BIMT.get(r.buildInMapTypeId))==null?void 0:n.asBaiduMapType()),enableMapClick:!1}),this.map.centerAndZoom(r.center.toBaidu(this.coordType),r.zoom+ne),this.setGestureHandling(r.gestureHandling),r.infoWindowMode==="multi"&&console.warn("baidu不支持多个InfoWindow, 可能会出现未知问题"),r.mapStyle&&this.map.setMapStyleV2(r.mapStyle.baidu),this.setEventTargetDelegate(new Se(this.map,this)),this.map.addEventListener("addoverlay",s=>{const a=s.target.__info_box__;a&&(console.debug("add:info-box",a),this.map.addOverlay(a))}),this.map.addEventListener("removeoverlay",s=>{const a=s.target.__info_box__;a&&(console.debug("remove:info-box",a),this.map.removeOverlay(a))})}setGestureHandling(e=J.auto){switch(e===J.auto&&(e=this.element.parentElement&&$t.isScrollable(this.element.parentElement)?J.cooperative:J.greedy),e){case J.cooperative:this.map.disableScrollWheelZoom(),this.map.enableDragging(),this.map.enableDoubleClickZoom();break;case J.greedy:this.map.enableScrollWheelZoom(),this.map.enableDragging(),this.map.enableDoubleClickZoom();break;case J.none:this.map.disableDragging(),this.map.disableScrollWheelZoom(),this.map.disableDoubleClickZoom();break}}get innerMap(){return this.map}get coordType(){return this.getMapType().getBaiduCoordType()}addEventListener(e,r){if(e==="center-changed"){super.addEventListener("movestart",r),super.addEventListener("moving",r),super.addEventListener("moveend",r),super.addEventListener("zoomend",r);return}super.addEventListener(e,r)}removeEventListener(e,r){if(e==="center-changed"){super.removeEventListener("movestart",r),super.removeEventListener("moving",r),super.removeEventListener("moveend",r),super.removeEventListener("zoomend",r);return}super.removeEventListener(e,r)}fromContainerPointToLatLng(e){return x.fromBaidu(this.innerMap.pixelToPoint(new BMap.Pixel(e.x,e.y)),this.coordType)}fromLatLngToContainerPoint(e){return this.innerMap.pointToPixel(e.toBaidu(this.coordType))}setDefaultCursor(e){this.innerMap.setDefaultCursor(e)}setDraggable(e){e?this.innerMap.enableDragging():this.innerMap.disableDragging()}setDoubleClickZoom(e){e?this.map.enableDoubleClickZoom():this.map.disableDoubleClickZoom()}getCenter(){return x.fromBaidu(this.map.getCenter(),this.coordType)}setCenter(e){this.map.setCenter(e.toBaidu(this.coordType))}getZoom(){return super.getZoom()-ne}setZoom(e){return super.setZoom(e+ne)}setMinZoom(e){this.map.setMinZoom(e+ne)}setMaxZoom(e){this.map.setMaxZoom(e+ne)}setMapStyle(e){this.map.setMapStyleV2((e==null?void 0:e.baidu)??{styleJson:[]})}setBuildInMapTypeId(e){var n;const r=(n=this.buildInMapTypeId2BIMT.get(e))==null?void 0:n.asBaiduMapType();this.map.setMapType(r??O.throwError("理论上来说不可能为空"))}setMapType(e){this.map.setMapType(e.asBaiduMapType())}getMapType(){const e=this.map.getMapType(),r=this.baiduMapType2BIMT.get(e);return r||(e.__baidu_map_type__??O.throwError("实现asBaiduMapType()时, 忘了给实例设置__baidu_map_type__?"))}addLayer(e){this.map.addTileLayer(e.asBaiduLayer())}removeLayer(e){this.map.removeTileLayer(e.asBaiduLayer())}panTo(e){this.map.panTo(e.toBaidu(this.coordType))}panBy(e,r){this.map.panBy(e,r)}fitBounds(e,r){this.map.setViewport(e.toBaiduArray(this.coordType),{margins:r&&[r.top,r.right,r.bottom,r.left]})}getBounds(){return K.fromBaidu(this.map.getBounds(),this.coordType)}addElementOverlay(e){this.map.addOverlay(e.asBaidu())}removeElementOverlay(e){this.map.removeOverlay(e.asBaidu())}addOverlay(e){this.map.addOverlay(e.innerOverlay)}removeOverlay(e){this.map.removeOverlay(e.innerOverlay)}addCustomControl(e){if(!e.inner){const r=class extends BMap.Control{constructor(){super(...arguments);m(this,"defaultAnchor",exports.ControlPositionConverter.getBaidu().toValue(e.position));m(this,"defaultOffset",new BMap.Size(0,0))}initialize(s){const a=e.onCreateElement();return s.getContainer().appendChild(a),a}};e.inner=new r,this.map.addControl(e.inner)}}removeCustomControl(e){e.inner&&(O.assert(e.inner instanceof BMap.Control,`control.inner(${e.inner})需要是BMap.Control`),this.map.removeControl(e.inner))}createMarkerClusterer(e){return new Dr(this,e)}createHeatmap(e){return new Ir(this,e)}createAutocomplete(e){return new Er(this,e)}createSearchBox(e){return new Zr(this,e)}createPlacesService(e){return new Gr(this,e)}createMapUrls(e){return new Ke(e)}}class Vi extends ut{constructor(e,r){var s,a;super(e);m(this,"buildInMapTypeId2BIMT");m(this,"googleMapTypeId2BIMT");m(this,"map");m(this,"createLabel",Qt.create);m(this,"createCircle",ft.create);m(this,"createPolygon",Pt.create);m(this,"createPolyline",wt.create);m(this,"createRectangle",Et.create);m(this,"createInfoWindow",_t.create);m(this,"createInfoBox",bt.create);m(this,"createMarker",Ct.create);m(this,"createMapTypeControl",Fe.create);m(this,"createZoomControl",dt.create);m(this,"createStreetViewControl",ht.create);m(this,"createScaleControl",at.create);this.mapOptions=r,this.buildInMapTypeId2BIMT=exports.MapType.BUILD_IN_MAP_TYPES.getValueMap(V.prototype.getId),this.googleMapTypeId2BIMT=exports.MapType.BUILD_IN_MAP_TYPES.getValueMap(V.prototype.getGoogleMapTypeId);const n=r.buildInMapTypeId&&this.buildInMapTypeId2BIMT.get(r.buildInMapTypeId);this.map=new google.maps.Map(e,{center:r.center.toGoogle((n??exports.MapType.NORMAL).getGoogleCoordType()),zoom:r.zoom,disableDefaultUI:!0,gestureHandling:r.gestureHandling,minZoom:r.minZoom,maxZoom:r.maxZoom,styles:(s=r.mapStyle)==null?void 0:s.google.styles,mapId:(a=r.mapStyle)==null?void 0:a.google.mapId,mapTypeId:n==null?void 0:n.getGoogleMapTypeId()}),this.setEventTargetDelegate(new de(this.map,this))}setGestureHandling(e){this.map.setOptions({gestureHandling:e})}get innerMap(){return this.map}get coordType(){return this.getMapType().getGoogleCoordType()}fromContainerPointToLatLng(e){const r=this.innerMap.getProjection(),n=this.innerMap.getBounds();if(r==null||n==null)return x.ZERO;const s=r.fromLatLngToPoint(n.getSouthWest()),a=r.fromLatLngToPoint(n.getNorthEast()),h=this.innerMap.getZoom();if(s==null||a==null||h==null)return x.ZERO;const o=Math.pow(2,h),c=new google.maps.Point(e.x/o+s.x,e.y/o+a.y);return x.fromGoogle(r.fromPointToLatLng(c)??ie.LATLNG_ZERO,this.coordType)}fromLatLngToContainerPoint(e){const r=this.innerMap.getProjection(),n=this.innerMap.getBounds();if(r==null||n==null)return exports.Point.ZERO;const s=r.fromLatLngToPoint(n.getSouthWest()),a=r.fromLatLngToPoint(n.getNorthEast()),h=this.innerMap.getZoom();if(s==null||a==null||h==null)return exports.Point.ZERO;const o=Math.pow(2,h),c=r.fromLatLngToPoint(e.toGoogle(this.coordType));return c==null?exports.Point.ZERO:{x:(c.x-s.x)*o,y:(c.y-a.y)*o}}setDefaultCursor(e){this.innerMap.setOptions({draggableCursor:e})}setDraggable(e){this.innerMap.setOptions({draggable:e})}setDoubleClickZoom(e){this.map.setOptions({disableDoubleClickZoom:!e})}getCenter(){return x.fromGoogle(this.map.getCenter()??ie.LATLNG_ZERO,this.coordType)}setCenter(e){this.map.setCenter(e.toGoogle(this.coordType))}setMinZoom(e){this.map.setOptions({minZoom:e})}setMaxZoom(e){this.map.setOptions({maxZoom:e})}setMapStyle(e){this.map.setOptions({styles:e==null?void 0:e.google.styles,mapId:e==null?void 0:e.google.mapId})}setBuildInMapTypeId(e){var n;const r=(n=this.buildInMapTypeId2BIMT.get(e))==null?void 0:n.getGoogleMapTypeId();this.map.setMapTypeId(r??O.throwError("理论上来说不可能为空"))}setMapType(e){e instanceof V?this.map.setMapTypeId(e.getGoogleMapTypeId()):(this.map.mapTypes.set(e.id,e.asGoogleMapType()),this.map.setMapTypeId(e.id))}getMapType(){const e=this.map.getMapTypeId()??google.maps.MapTypeId.ROADMAP,r=this.googleMapTypeId2BIMT.get(e);return r||(this.map.mapTypes.get(e).__google_map_type__??O.throwError(`实现${e}的asGoogleMapType()时, 忘了给实例设置__google_map_type__?`))}addOverlayMapType(e){this.map.overlayMapTypes.push(e.asGoogleMapType())}removeOverlayMapType(e){exports.MVCArrays.remove(this.map.overlayMapTypes,e.asGoogleMapType())}addLayer(e){e.asGoogleLayer().setMap(this.map)}removeLayer(e){e.asGoogleLayer().setMap(null)}panTo(e){this.map.panTo(e.toGoogle(this.coordType))}panBy(e,r){this.map.panBy(e,r)}fitBounds(e,r){this.map.fitBounds(e.toGoogle(this.coordType),r)}getBounds(){const e=this.map.getBounds();return e?K.fromGoogle(e,this.coordType):K.EMPTY}addElementOverlay(e){e.asGoogle().setMap(this.map)}removeElementOverlay(e){e.asGoogle().setMap(null)}addOverlay(e){e.innerOverlay.setMap(this.map)}removeOverlay(e){e.innerOverlay.setMap(null)}addCustomControl(e){e.inner||(e.inner=e.onCreateElement(),this.map.controls[exports.ControlPositionConverter.getGoogle().toValue(e.position)].push(e.inner))}removeCustomControl(e){if(e.inner){const r=this.map.controls[exports.ControlPositionConverter.getGoogle().toValue(e.position)];exports.MVCArrays.remove(r,e.inner)}}createMarkerClusterer(e){return new zr(this,e)}createHeatmap(e){return new Br(this,e)}createAutocomplete(e){return new Lr(this,e)}createSearchBox(e){return new Nr(this,e)}createPlacesService(e){return new $r(this,e)}createMapUrls(e){return new Ye(e)}}const Je=["3.0"],Fi={baidu:{version:"3.0",key:""},google:{version:"quarterly",key:"",language:"en-us",libraries:["places","visualization"]},here:{version:Je[0],key:""}};let Ur;function er(){return Ur||O.throwError("请先安装: Vue<PartialTgMapConfig>.use(TgMap, {})")}function qr(i){i!=null&&(Ur=Hr(Fi,i))}class Ui extends ut{constructor(e,r){var a;super(e);m(this,"map");m(this,"defaultLayers");this.mapOptions=r;const n=er().here;Je.includes(n.version)||O.throwError(`不支持${n.version}, HereMap当前只支持如下版本: ${Je}`);const s=new H.service.Platform({app_id:n.key.split(",")[0],app_code:n.key.split(",")[1]});this.defaultLayers=s.createDefaultLayers(),this.map=new H.Map(e,this.defaultLayers.normal.map,{zoom:r.zoom,center:(a=r.center)==null?void 0:a.toHere(this.coordType)}),new H.mapevents.Behavior(new H.mapevents.MapEvents(this.map)),H.ui.UI.createDefault(this.map,this.defaultLayers)}get innerMap(){return this.map}get coordType(){return z.wgs84}getCenter(){return x.fromHere(this.map.getCenter(),this.coordType)}setCenter(e){this.map.setCenter(e.toHere(this.coordType))}setGestureHandling(e){throw new Error("Method not implemented.")}fromContainerPointToLatLng(e){throw new Error("Method not implemented.")}fromLatLngToContainerPoint(e){throw new Error("Method not implemented.")}setDefaultCursor(e){throw new Error("Method not implemented.")}setDraggable(e){throw new Error("Method not implemented.")}setDoubleClickZoom(e){throw new Error("Method not implemented.")}setMinZoom(e){throw new Error("Method not implemented.")}setMaxZoom(e){throw new Error("Method not implemented.")}setMapStyle(e){throw new Error("Method not implemented.")}setBuildInMapTypeId(e){throw new Error("Method not implemented.")}setMapType(e){throw new Error("Method not implemented.")}getMapType(){throw new Error("Method not implemented.")}addLayer(e){throw new Error("Method not implemented.")}removeLayer(e){throw new Error("Method not implemented.")}panTo(e){throw new Error("Method not implemented.")}panBy(e,r){throw new Error("Method not implemented.")}fitBounds(e,r){throw new Error("Method not implemented.")}getBounds(){throw new Error("Method not implemented.")}addElementOverlay(e){throw new Error("Method not implemented.")}removeElementOverlay(e){throw new Error("Method not implemented.")}addOverlay(e){throw new Error("Method not implemented.")}removeOverlay(e){throw new Error("Method not implemented.")}createMarker(e){throw new Error("Method not implemented.")}createMarkerClusterer(e){throw new Error("Method not implemented.")}createHeatmap(e){throw new Error("Method not implemented.")}createAutocomplete(e){throw new Error("Method not implemented.")}createSearchBox(e){throw new Error("Method not implemented.")}createPlacesService(e){throw new Error("Method not implemented.")}createMapUrls(e){throw new Error("Method not implemented.")}createInfoWindow(e){throw new Error("Method not implemented.")}createInfoBox(e){throw new Error("Method not implemented.")}createPolyline(e){throw new Error("Method not implemented.")}createPolygon(e){throw new Error("Method not implemented.")}createRectangle(e){throw new Error("Method not implemented.")}createCircle(e){throw new Error("Method not implemented.")}createLabel(e){throw new Error("Method not implemented.")}addCustomControl(e){throw new Error("Method not implemented.")}removeCustomControl(e){throw new Error("Method not implemented.")}createMapTypeControl(e){throw new Error("Method not implemented.")}createZoomControl(e){throw new Error("Method not implemented.")}createStreetViewControl(e){throw new Error("Method not implemented.")}createScaleControl(e){throw new Error("Method not implemented.")}}var q=(i=>(i.google="google",i.baidu="baidu",i.here="here",i))(q||{});exports.TgMapFactory=void 0;(i=>{function t(e,r,n){const s=exports.MapOptions.create(n);switch(e){case"google":return new Vi(r,s);case"baidu":return new ji(r,s);case"here":return new Ui(r,s)}}i.createMap=t})(exports.TgMapFactory||(exports.TgMapFactory={}));function qi(i){throw new Error(`todo: ${i}`)}function Yi(i){return i}function Yr(i){return i[1]!=null}function Kr(i){let t=null;return()=>t??(t=i().catch(e=>(t=null,Promise.reject(e))))}const Ki={};function Xr(i){return exports.Objects.putIfAbsent(Ki,i,()=>Kr(()=>Xi({type:i,config:er()[i]})))()}function Xi({type:i,config:t}){const e=window,r=Ji(i);if(exports.Objects.get(e,r))return Promise.resolve();switch(i!==q.here&&!t.key&&O.throwError(`请先配置${i}地图的key`),i){case q.google:return gr(`https://maps.googleapis.com/maps/api/js?key=${t.key}&language=${t.language}&v=${t.version}&libraries=${t.libraries.join(",")}`);case q.baidu:return gr(`https://api.map.baidu.com/api?v=${t.version}&ak=${t.key}`);case q.here:return Ce(be("core",t.version)).then(()=>Promise.all([Ce(be("service",t.version)),Ce(be("mapevents",t.version)),Ce(be("clustering",t.version)),Ce(be("ui",t.version))])).catch(n=>(exports.Objects.del(e,r),Promise.reject(n)));default:O.assertNever(i)}}function be(i,t=Je[0]){return`https://js.api.here.com/v3/${t}/mapsjs-${i}.js`}function Ji(i){switch(i){case q.google:return"google.maps";case q.baidu:return"BMap";case q.here:return"H"}}let Qi=0;function gr(i,t="callback"){return new Promise((e,r)=>{const n=`__callback${Qi++}`;window[n]=e;const s=document.createElement("script");s.src=`${i}&${t}=${n}`,s.onerror=r,document.body.appendChild(s)})}function Ce(i){return new Promise((t,e)=>{const r=document.createElement("script");r.src=i,r.onload=t,r.onerror=e,document.body.appendChild(r)})}function F(i,t){return{type:String,default:t,validator:e=>Object.values(i).includes(e)}}function Jr(i,t){return{type:String,default:t,validator:e=>i.includes(e)}}function W(i){return{type:i,required:!0}}function T(i,t){return{type:i,default:t}}function en(i){const t={};return Object.entries(i).forEach(([e,r])=>{const n=`__${e}`;t[e]={get(){const s=this[n];return s===void 0?r:s},set(s){this[n]=s}}}),t}const Te={enumerable:!0,configurable:!0,get:O.noop,set:O.noop};function Qr(i){return Object.keys(i).forEach(t=>{const e=i[t];let r=!1;typeof e=="function"?(Te.get=e,Te.set=O.noop,r=!0):typeof e=="object"&&typeof e.get=="function"&&(Te.get=e.get,Te.set=e.set,r=!0),r&&(i[t]=Object.defineProperty(i,t,Te))}),i}function tn(i){return Qr(i)}function $e(){return C.createCommentVNode()}function Oe(i,t){const e=i.$options[t];if(e)for(const r of e)r.call(i)}function rn(i,t){for(const e of i)if(e.$options.name===t.name)return e}function nn(i,t){if(!i.default)return;const e=i.default();for(const r of e)if((r==null?void 0:r.type).name===t.name)return r}function ei(i,t){const e={},r={},n={};return Object.keys(i).forEach(s=>{s.startsWith("on")?e[exports.Strings.pascal2kebab(s.substring(2))]=i[s]:r[s]=i[s]}),t&&Object.keys(t).forEach(s=>{s.startsWith("on")&&(n[exports.Strings.pascal2kebab(s.substring(2))]=t[s])}),{binds:r,listeners:e,listenerProps:n}}function Q(i,t){return C.computed(()=>ei(i,t))}function A(){return Function}const sn=()=>{let i,t;function e(n){console.log(n),i=n&&n.type,t=Date.now()}function r(n){((n&&n.type)!==i||Date.now()-(t??0)>1e3)&&e(n)}return{eventLog:e,eventLogLess:r}},Bt="$map",me="onCreate",fe="onDestroy",$=C.defineComponent({inject:[Bt],mounted(){Oe(this,me)},beforeUnmount(){Oe(this,fe)},methods:{recreate(){Oe(this,fe),Oe(this,me)}},render(){return $e()}}),on=C.defineComponent({name:"tg-map",provide(){return{[Bt]:C.computed(()=>this.map)}},inheritAttrs:!1,props:{type:F(q,q.google),center:W(x),centerSyncDelay:T(Number,300),currentCenter:T(x),lastCenter:T(x),zoom:W(Number),infoWindowMode:Jr(Vr),gestureHandling:F(J),minZoom:T(Number),maxZoom:T(Number),mapStyle:T(Object),mapTypeId:F(Wt),mapType:T(Object),hideLogo:T(Boolean),onLoad:A(),"onUpdate:center":A(),"onUpdate:current-center":A(),"onUpdate:last-center":A(),"onUpdate:map-type":A(),"onUpdate:map-type-id":A(),"onUpdate:zoom":A(),onError:A()},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t,i),centerSyncTimeoutId:void 0}},data(){return{map:O.typed(),isDestroyed:!1}},computed:{propsJson(){return exports.Objects.toJsonSafely(this.$props)}},watch:{gestureHandling(i){var t;i&&((t=this.map)==null||t.setGestureHandling(i))},minZoom(i){var t;(t=this.map)==null||t.setMinZoom(i)},maxZoom(i){var t;(t=this.map)==null||t.setMaxZoom(i)},mapStyle(i){var t;(t=this.map)==null||t.setMapStyle(i)},mapTypeId(i){var t;i&&((t=this.map)==null||t.setBuildInMapTypeId(i))},mapType(i){var t;(t=this.map)==null||t.setMapType(i??exports.MapType.NORMAL)}},async mounted(){const i=this.type;try{await Xr(i)}catch(n){this.$emit("error",n);return}if(this.isDestroyed){console.warn(`tg-map(type=${i})已销毁, 不需要继续执行`);return}const t=exports.TgMapFactory.createMap(i,this.$refs.map,{center:this.center,zoom:this.zoom,infoWindowMode:this.infoWindowMode,gestureHandling:this.gestureHandling,minZoom:this.minZoom,maxZoom:this.maxZoom,mapStyle:this.mapStyle,buildInMapTypeId:this.mapTypeId});if(this.map=C.markRaw(t),this.mapType&&t.setMapType(this.mapType),"ready"in this.attrs.listeners&&console.error("地图载入完成的事件已经从ready改为了load, 请手动修改"),ee(this.attrs.listeners,t,["load"]),this.$emit("load",t),C.watch([()=>this.zoom,()=>this.center],([n,s],[a,h])=>{n!==a&&t.setZoom(n),s!==h&&(t.getCenter().equals(s)||t.setCenter(s))}),this.attrs.listenerProps["update:center"]){const n=()=>this.$emit("update:center",t.getCenter());t.addEventListener("center-changed",()=>{this.centerSyncDelay>0?(clearTimeout(this.centerSyncTimeoutId),this.centerSyncTimeoutId=setTimeout(n,this.centerSyncDelay)):n()})}this.attrs.listenerProps["update:current-center"]&&(this.$emit("update:current-center",this.center),t.addEventListener("center-changed",()=>{this.$emit("update:current-center",t.getCenter())})),this.attrs.listenerProps["update:zoom"]&&t.addEventListener("zoom-changed",()=>{this.$emit("update:zoom",t.getZoom())});const e=this.attrs.listenerProps["update:map-type"],r=this.attrs.listenerProps["update:map-type-id"];(e||r)&&t.addEventListener("map-type-changed",()=>{const n=t.getMapType();e&&this.$emit("update:map-type",n),r&&this.$emit("update:map-type-id",n.id)})},unmounted(){this.isDestroyed=!0,this.map&&(this.attrs.listenerProps["update:last-center"]&&this.$emit("update:last-center",this.map.getCenter()),this.attrs.listenerProps["update:center"]&&(clearTimeout(this.centerSyncTimeoutId),this.$emit("update:center",this.map.getCenter())))},methods:{}}),te=(i,t)=>{const e=i.__vccOpts||i;for(const[r,n]of t)e[r]=n;return e};function an(i,t,e,r,n,s){return C.openBlock(),C.createElementBlock("div",C.mergeProps({class:"tg-map"},i.attrs.binds),[C.createElementVNode("div",{ref:"map",class:C.normalizeClass({"tg-map__map":!0,[`tg-map__map--hide-logo-${i.type}`]:i.hideLogo})},null,2),C.createCommentVNode("",!0),i.map?C.renderSlot(i.$slots,"default",{key:1}):C.createCommentVNode("",!0),C.renderSlot(i.$slots,"overlay")],16)}const Ge=te(on,[["render",an]]);function ln(i){if(i==null)return;let t;if(typeof i=="string"){if(t=+i,Number.isNaN(t))return i}else t=i;return`${t}px`}const hn=C.defineComponent({name:"tg-map-widget",props:{left:{type:[Number,String],default:null},top:{type:[Number,String],default:null},right:{type:[Number,String],default:null},bottom:{type:[Number,String],default:null}},computed:{topValue(){return this.top==null&&this.bottom==null?0:this.top}},methods:{dimen:ln}});function cn(i,t,e,r,n,s){return C.openBlock(),C.createElementBlock("div",{class:C.normalizeClass(i.$options.name),style:C.normalizeStyle({left:i.dimen(i.left),top:i.dimen(i.topValue),right:i.dimen(i.right),bottom:i.dimen(i.bottom)})},[C.renderSlot(i.$slots,"default")],6)}const dn=te(hn,[["render",cn]]),un=C.defineComponent({name:"tg-custom-control",mixins:[$],props:{position:F(R,R.RIGHT_BOTTOM)},setup(){return{control:O.lateinit()}},watch:{position(){this.recreate()}},onCreate(){Zt(this.$parent,Ge)||console.warn("请将tg-custom-control放到tg-map中");const{$el:i}=this,t=class extends Cr{onCreateElement(){return i}};this.control=new t(this.position),this.$map.addCustomControl(this.control)},onDestroy(){this.$map.removeCustomControl(this.control)}});function pn(i,t,e,r,n,s){return C.openBlock(),C.createElementBlock("div",{class:C.normalizeClass(i.$options.name)},[C.renderSlot(i.$slots,"default")],2)}const gn=te(un,[["render",pn]]),mn=C.defineComponent({name:"tg-map-type-control",mixins:[$],props:{position:F(R,R.TOP_LEFT),type:F(Ht),mapTypes:T(Array)},setup(){return{control:O.lateinit()}},watch:{position(i){this.control.setPosition(i)},type(){this.recreate()},mapTypes:{handler(){this.recreate()},deep:!0}},onCreate(){this.control=this.$map.createMapTypeControl(this),this.$map.addControl(this.control)},onDestroy(){this.$map.removeControl(this.control)}}),fn=C.defineComponent({name:"tg-scale-control",mixins:[$],props:{position:F(R,R.BOTTOM_RIGHT)},setup(){return{control:O.lateinit()}},watch:{position(i){this.control.setPosition(i)}},onCreate(){this.control=this.$map.createScaleControl(this),this.$map.addControl(this.control)},onDestroy(){this.$map.removeControl(this.control)}});function ti(){var e;const i=(e=C.getCurrentInstance())==null?void 0:e.type;let t=(i==null?void 0:i.name)??(i==null?void 0:i.__name);if(!t){const r=i==null?void 0:i.__file;r&&(t=O.path.basename(r,".vue"))}return t}function It(){const i=C.inject(Bt);let t,e;return i==null&&O.throwError(`<${ti()||"unknown"}>必须作为<tg-map>的子代组件`),{mapRef:i,get map(){return i.value??O.throwError("map尚未初始化")},[me](r){C.onMounted(r),t&&O.throwError(`${me}只能调用一次`),t=r},[fe](r){C.onBeforeUnmount(r),e&&O.throwError(`${fe}只能调用一次`),e=r},recreate(){e==null||e(),t==null||t()}}}const yn=C.defineComponent({name:"tg-street-view-control",props:{position:F(R,R.RIGHT_BOTTOM)},setup(i){let t=O.lateinit();const{map:e,onCreate:r,onDestroy:n}=It();return r(()=>{t=e.createStreetViewControl(i),e.addControl(t)}),n(()=>{e.removeControl(t)}),C.watch(()=>i.position,s=>{t.setPosition(s)}),$e}}),vn=C.defineComponent({name:"tg-zoom-control",props:{position:F(R,R.RIGHT_BOTTOM)},setup(i){let t=O.lateinit();const{map:e,onCreate:r,onDestroy:n}=It();return r(()=>{t=e.createZoomControl(i),e.addControl(t)}),n(()=>{e.removeControl(t)}),C.watch(()=>i.position,s=>{t.setPosition(s)}),$e}}),_n=C.defineComponent({name:"tg-heatmap",props:{maxIntensity:T(Number),gradient:T(Object),opacity:T(Number),radius:T(Number),data:W(Array)},setup(i){const{map:t,onCreate:e,onDestroy:r}=It();let n=O.lateinit();return e(()=>{n=t.createHeatmap(i)}),r(()=>{n.remove()}),C.watch(()=>i.data,s=>n.setData(s)),C.watch([()=>i.maxIntensity,()=>i.gradient,()=>i.opacity,()=>i.radius],()=>n.setOptions(i)),$e}}),Mn=C.defineComponent({name:"tg-marker-clusterer",mixins:[$],props:{gridSize:T(Number),maxZoom:T(Number),minClusterSize:T(Number),averageCenter:T(Boolean),styles:T(Array),stylesIndexCalculator:T(Function),zIndex:T(Number)},setup(){return{clusterer:O.lateinit(),markers:O.typed([])}},watch:{gridSize(){this.recreate()},maxZoom(){this.recreate()},minClusterSize(){this.recreate()},averageCenter(){this.recreate()},styles:{handler(){this.recreate()},deep:!0},stylesIndexCalculator(){this.recreate()},zIndex(){this.recreate()}},onCreate(){this.clusterer=this.$map.createMarkerClusterer(this)},onDestroy(){this.clusterer.clearMarkers()},methods:{isInitiated(){return this.clusterer!=null},onAddMarker(i){this.markers.push(i),this.isInitiated()&&this.clusterer.addMarker(i)},onRemoveMarker(i){this.isInitiated()&&this.clusterer.removeMarker(i),O.Arrays.remove(this.markers,i)}}});function bn(i,t,e,r,n,s){return C.openBlock(),C.createElementBlock("div",{class:C.normalizeClass(i.$options.name)},[C.renderSlot(i.$slots,"default")],2)}const ri=te(Mn,[["render",bn]]),Cn=C.defineComponent({name:"tg-traffic-layer",mixins:[$],setup(){return{layer:O.lateinit()}},watch:{},onCreate(){this.layer=new Or,this.$map.addLayer(this.layer)},onDestroy(){this.$map.removeLayer(this.layer)}}),Tn=C.defineComponent({name:"tg-circle",mixins:[$],inheritAttrs:!1,props:{center:W(x),radius:W(Number),clickable:T(Boolean),editable:T(Boolean),strokeColor:T(String),strokeOpacity:T(Number),strokeWeight:T(Number),visible:T(Boolean),fillColor:T(String),fillOpacity:T(Number),"onUpdate:center":A(),"onUpdate:radius":A()},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t,i),overlay:O.lateinit(),emittedRadius:void 0,emittedCenter:void 0}},watch:{center(i){if(this.emittedCenter!=null){const t=this.emittedCenter;if(this.emittedCenter=void 0,t===C.toRaw(i))return}this.overlay.setCenter(i)},radius(i){if(this.emittedRadius!=null){const t=this.emittedRadius;if(this.emittedRadius=void 0,t===i)return}this.overlay.setRadius(i)},clickable(){this.recreate()},editable(i){this.overlay.setEditable(i)},strokeColor(i){this.overlay.setStrokeColor(i)},strokeOpacity(i){this.overlay.setStrokeOpacity(i)},strokeWeight(i){this.overlay.setStrokeWeight(i)},fillColor(i){this.overlay.setFillColor(i)},fillOpacity(i){this.overlay.setFillOpacity(i)},visible(i){this.overlay.setVisible(i)}},onCreate(){this.overlay=this.$map.createCircle(this),this.$map.addOverlay(this.overlay),ee(this.attrs.listeners,this.overlay),this.attrs.listenerProps["update:center"]&&this.overlay.addEventListener("center-changed",()=>{this.$emit("update:center",this.emittedCenter=this.overlay.getCenter())}),this.attrs.listenerProps["update:radius"]&&this.overlay.addEventListener("radius-changed",()=>{this.$emit("update:radius",this.emittedRadius=this.overlay.getRadius())})},onDestroy(){this.$map.removeOverlay(this.overlay)}});class On extends Fr{constructor(t,e,r,n){super(t,e),this.content=r,this.position=n}onCreate(){return this.content}onDraw(t){const e=t.fromLatLngToOverlayPoint(this.position);this.content.style.left=e.x+"px",this.content.style.top=e.y+"px"}setPosition(t){this.position=t,this.draw()}}const wn=C.defineComponent({name:"tg-element-overlay",mixins:[$],props:{mapPane:F(ue,ue.overlayMouseTarget),position:W(x)},setup(){return{overlay:O.lateinit()}},watch:{position(i){this.overlay.setPosition(i)},mapPane(){this.recreate()}},methods:{content(){return this.$el}},onCreate(){this.overlay=new On(this.$map,this,this.content(),this.position),this.$map.addElementOverlay(this.overlay)},onDestroy(){this.$map.removeElementOverlay(this.overlay)}});function xn(i,t,e,r,n,s){return C.openBlock(),C.createElementBlock("div",C.mergeProps({class:i.$options.name},i.$attrs),[C.renderSlot(i.$slots,"default")],16)}const Pn=te(wn,[["render",xn]]),Ln=C.defineComponent({name:"tg-marker",mixins:[$],inheritAttrs:!1,props:{position:W(x),title:T(String),label:T(Object),icon:T(Object),clickable:T(Boolean),draggable:T(Boolean),crossOnDrag:T(Boolean),cursor:T(String),zIndex:T(Number),visible:T(Boolean),normalizePositionForBaidu:T(Boolean),autoAddToClusterer:T(Boolean,!0),"onUpdate:position":A()},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t,i),marker:O.lateinit(),labelOverlay:O.typed(),info:O.typed(),emittedPosition:void 0,autoAddToClustererWhenCreate:i.autoAddToClusterer}},watch:{position(i){if(this.emittedPosition!=null){const t=this.emittedPosition;if(this.emittedPosition=void 0,t===C.toRaw(i))return}this.marker.setPosition(i)},title(i){this.marker.setTitle(i)},label(i,t){O.deepEqual(i,t)||(i?this.marker.setLabel(i):this.recreate())},icon(i){i?this.marker.setIcon(i):this.recreate()},clickable(i){this.marker instanceof ge?this.recreate():this.marker.setClickable(i)},draggable(i){this.marker.setDraggable(i)},crossOnDrag(){this.recreate()},cursor(){this.recreate()},zIndex(i){this.marker instanceof ge?this.recreate():this.marker.setZIndex(i)},visible(i){this.marker.setVisible(i)},normalizePositionForBaidu(){this.recreate()},autoAddToClusterer(){this.recreate()}},onCreate(){this.marker=this.$map.createMarker(this),this.labelOverlay&&this.marker.attachLabelOverlay(this.labelOverlay.overlay),this.$clusterer()&&this.autoAddToClusterer?this.$clusterer().onAddMarker(this.marker):this.$map.addOverlay(this.marker),this.autoAddToClustererWhenCreate=this.autoAddToClusterer,this.info&&this.info.show&&this.info.overlay.open(this.marker),ee(this.attrs.listeners,this.marker),this.attrs.listenerProps["update:position"]&&this.marker.addEventListener("dragend",i=>{this.$emit("update:position",this.emittedPosition=i.position)})},onDestroy(){this.$clusterer()&&this.autoAddToClustererWhenCreate?this.$clusterer().onRemoveMarker(this.marker):this.$map.removeOverlay(this.marker)},methods:{$clusterer(){return Zt(this.$parent,ri)},onAddLabel(i){this.labelOverlay=i,this.marker&&this.marker.attachLabelOverlay(i.overlay)},onRemoveLabel(i){this.marker.attachLabelOverlay(void 0),this.labelOverlay=void 0},onAddInfo(i){this.info=i,this.marker&&i.show&&i.overlay.open(this.marker)},onRemoveInfo(i){i.overlay.close(),this.info=void 0},onInfoShowChanged(i,t){t?i.overlay.open(this.marker):i.overlay.close()}}});function En(i,t,e,r,n,s){return C.renderSlot(i.$slots,"default")}const St=te(Ln,[["render",En]]),Bn=C.defineComponent({name:"tg-info-box",mixins:[$],inheritAttrs:!1,props:{show:W(Boolean),position:T(x),offset:T(Object),maxWidth:T(Number),borderClass:T(String),zIndex:T(Number),"onUpdate:show":A()},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t,i),overlay:O.lateinit()}},watch:{show(i){this.$marker()?this.$marker().onInfoShowChanged(this,i):i?this.overlay.open():this.overlay.close()},position(i){this.overlay.setPosition(i)},offset(){this.recreate()},maxWidth(i){this.overlay.setMaxWidth(i)},borderClass(){this.recreate()},zIndex(i){this.overlay.setZIndex(i)}},onCreate(){this.overlay=this.$map.createInfoBox(this.getOptions()),this.$marker()?this.$marker().onAddInfo(this):this.show&&this.overlay.open(),this.attrs.listenerProps["update:show"]&&this.overlay.addEventListener("closeclick",()=>{this.$emit("update:show",!1)}),ee(this.attrs.listeners,this.overlay)},onDestroy(){this.$marker()?this.$marker().onRemoveInfo(this):this.overlay.close()},methods:{getOptions(){return{content:this.content(),position:this.position,offset:this.offset,zIndex:this.zIndex,maxWidth:this.maxWidth,borderClass:this.borderClass}},content(){return this.$el},$marker(){return tt(St,this.$parent,Ge)},open(i){this.overlay.open(i)},close(){this.overlay.close()}}});function In(i,t,e,r,n,s){return C.openBlock(),C.createElementBlock("div",C.mergeProps({class:i.$options.name},i.attrs.binds),[C.renderSlot(i.$slots,"default")],16)}const Sn=te(Bn,[["render",In]]),kn=C.defineComponent({name:"tg-info-window",mixins:[$],inheritAttrs:!1,props:{show:W(Boolean),position:T(x),maxWidth:T(Number),offset:T(Object),disableAutoPan:T(Boolean),"onUpdate:show":A()},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t,i),overlay:O.lateinit()}},watch:{show(i){this.$marker()?this.$marker().onInfoShowChanged(this,i):i?this.overlay.open():this.overlay.close()},position(i){this.overlay.setPosition(i)},maxWidth(){this.recreate()},offset(){this.recreate()},disableAutoPan(){this.recreate()}},methods:{content(){return this.$el},$marker(){return tt(St,this.$parent,Ge)},getOptions(){return{content:this.content(),position:this.position,maxWidth:this.maxWidth,offset:this.offset,disableAutoPan:this.disableAutoPan}}},onCreate(){this.overlay=this.$map.createInfoWindow(this.getOptions()),this.$marker()?this.$marker().onAddInfo(this):this.show&&this.overlay.open(),this.overlay.addEventListener("open",()=>{this.$emit("update:show",!0)}),this.overlay.addEventListener("close",()=>{this.$emit("update:show",!1)}),ee(this.attrs.listeners,this.overlay)},onDestroy(){this.$marker()?this.$marker().onRemoveInfo(this):this.overlay.close()}});function An(i,t,e,r,n,s){return C.withDirectives((C.openBlock(),C.createElementBlock("div",C.mergeProps({class:i.$options.name},i.attrs.binds),[C.renderSlot(i.$slots,"default")],16)),[[C.vShow,i.show]])}const Rn=te(kn,[["render",An]]),Dn=C.defineComponent({name:"tg-label",mixins:[$],inheritAttrs:!1,props:{position:T(x),offset:T(Object),zIndex:T(Number),mapPane:F(ue)},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t),overlay:O.lateinit()}},watch:{position(i){this.overlay.setPosition(i)},offset(i){this.overlay.setOffset(i)},zIndex(i){this.overlay.setZIndex(i)},visible(i){this.overlay.setVisible(i)},mapPane(){this.recreate()}},methods:{content(){return this.$el},marker(){var i;return(i=this.$marker())==null?void 0:i.marker},$marker(){return tt(St,this.$parent,Ge)},getOptions(){return{content:this.content(),position:this.position,offset:this.offset,zIndex:this.zIndex,mapPane:this.mapPane}}},onCreate(){this.overlay=this.$map.createLabel(this.getOptions()),this.$marker()?this.$marker().onAddLabel(this):this.$map.addOverlay(this.overlay),ee(this.attrs.listeners,this.overlay)},onDestroy(){this.$marker()?this.$marker().onRemoveLabel(this):this.$map.removeOverlay(this.overlay)}});function zn(i,t,e,r,n,s){return C.openBlock(),C.createElementBlock("div",C.mergeProps({class:i.$options.name},i.attrs.binds),[C.renderSlot(i.$slots,"default")],16)}const $n=te(Dn,[["render",zn]]),Gn=C.defineComponent({name:"tg-polygon",mixins:[$],inheritAttrs:!1,props:{paths:W(Array),clickable:T(Boolean),editable:T(Boolean),strokeColor:T(String),strokeOpacity:T(Number),strokeWeight:T(Number),visible:T(Boolean),fillColor:T(String),fillOpacity:T(Number),"onUpdate:paths":A()},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t,i),overlay:O.lateinit(),emittedPaths:void 0}},watch:{paths:{handler(i){if(this.emittedPaths!=null){const t=this.emittedPaths;if(this.emittedPaths=void 0,t.length===i.length&&t.every((e,r)=>e===C.toRaw(i[r])))return}this.overlay.setPaths(i)},deep:!0},clickable(){this.recreate()},editable(i){this.overlay.setEditable(i)},strokeColor(i){this.overlay.setStrokeColor(i)},strokeOpacity(i){this.overlay.setStrokeOpacity(i)},strokeWeight(i){this.overlay.setStrokeWeight(i)},fillColor(i){this.overlay.setFillColor(i)},fillOpacity(i){this.overlay.setFillOpacity(i)},visible(i){this.overlay.setVisible(i)}},onCreate(){this.overlay=this.$map.createPolygon(this),this.$map.addOverlay(this.overlay),ee(this.attrs.listeners,this.overlay),this.attrs.listenerProps["update:paths"]&&this.overlay.addEventListener("paths-edited",()=>{this.$emit("update:paths",this.emittedPaths=this.overlay.getPaths())})},onDestroy(){this.$map.removeOverlay(this.overlay)}}),Nn=C.defineComponent({name:"tg-polyline",mixins:[$],inheritAttrs:!1,props:{path:W(Array),icons:T(Array),clickable:T(Boolean),editable:T(Boolean),strokeColor:T(String),strokeOpacity:T(Number),strokeWeight:T(Number),visible:T(Boolean),"onUpdate:path":A()},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t,i),overlay:O.lateinit(),emittedPath:void 0}},watch:{path:{handler(i){if(this.emittedPath!=null){const t=this.emittedPath;if(this.emittedPath=void 0,t===C.toRaw(i))return}this.overlay.setPath(i)},deep:!0},icons:{handler(){this.recreate()},deep:!0},clickable(){this.recreate()},editable(i){this.overlay.setEditable(i)},strokeColor(i){this.overlay.setStrokeColor(i)},strokeOpacity(i){this.overlay.setStrokeOpacity(i)},strokeWeight(i){this.overlay.setStrokeWeight(i)},visible(i){this.overlay.setVisible(i)}},onCreate(){this.overlay=this.$map.createPolyline(this),this.$map.addOverlay(this.overlay),ee(this.attrs.listeners,this.overlay),this.attrs.listenerProps["update:path"]&&this.overlay.addEventListener("path-edited",()=>{this.$emit("update:path",this.emittedPath=this.overlay.getPath())})},onDestroy(){this.overlay.remove()}}),Zn=C.defineComponent({name:"tg-rectangle",mixins:[$],inheritAttrs:!1,props:{bounds:W(Object),clickable:T(Boolean),editable:T(Boolean),strokeColor:T(String),strokeOpacity:T(Number),strokeWeight:T(Number),visible:T(Boolean),fillColor:T(String),fillOpacity:T(Number),"onUpdate:bounds":A()},emits:void 0,setup(i,{attrs:t}){return{attrs:Q(t,i),overlay:O.lateinit(),emittedBounds:void 0}},watch:{bounds(i){if(this.emittedBounds!=null){const t=this.emittedBounds;if(this.emittedBounds=void 0,t.equals(i))return}this.overlay.setBounds(i)},clickable(){this.recreate()},editable(i){this.overlay.setEditable(i)},strokeColor(i){this.overlay.setStrokeColor(i)},strokeOpacity(i){this.overlay.setStrokeOpacity(i)},strokeWeight(i){this.overlay.setStrokeWeight(i)},fillColor(i){this.overlay.setFillColor(i)},fillOpacity(i){this.overlay.setFillOpacity(i)},visible(i){this.overlay.setVisible(i)}},onCreate(){this.overlay=this.$map.createRectangle(this),this.$map.addOverlay(this.overlay),ee(this.attrs.listeners,this.overlay),this.attrs.listenerProps["update:bounds"]&&this.overlay.addEventListener("bounds-changed",()=>{this.$emit("update:bounds",this.emittedBounds=this.overlay.getBounds())})},onDestroy(){this.$map.removeOverlay(this.overlay)}}),Wn=["beforeUpdate","updated"],Hn={install(i,t={}){if(t.enable!==!1){const e=C.defineComponent({beforeCreate(){const r=ti()??"",s=(t.nameRegex||/^[A-Z]/).test(r)?a=>{t.hookNames?t.hookNames.includes(a)&&console.debug("[lifecycle]",r,a):Wn.includes(a)||console.debug("[lifecycle]",r,a)}:O.noop;s("beforeCreate"),this.__life_impl=s},created(){this.__life("created")},beforeMount(){this.__life("beforeMount")},mounted(){this.__life("mounted")},beforeUpdate(){this.__life("beforeUpdate")},updated(){this.__life("updated")},beforeUnmount(){this.__life("beforeUnmount")},unmounted(){this.__life("unmounted")},methods:{__life(r){this.__life_impl(r)}},onCreate(){this.__life("onCreate")},onDestroy(){this.__life("onDestroy")}});i.mixin(e)}}},ye=6371009;function jn(i,t,e){return i<t?t:i>e?e:i}function Ae(i,t,e){return i>=t&&i<e?i:Vn(i-t,e-t)+t}function Vn(i,t){return(i%t+t)%t}function ce(i){return Math.log(Math.tan(i*.5+Math.PI/4))}function Fn(i){return 2*Math.atan(Math.exp(i))-Math.PI/2}function Re(i){const t=Math.sin(i*.5);return t*t}function Un(i){return 2*Math.asin(Math.sqrt(i))}function qn(i){return 2*Math.sqrt(i*(1-i))}function Yn(i){const t=i*i;return t/(1+Math.sqrt(1-t))*.5}function Kn(i,t){const e=Math.sqrt(i*(1-i)),r=Math.sqrt(t*(1-t));return 2*(e+r-2*(e*t+r*i))}function Pe(i,t,e){return Re(i-t)+Re(e)*Math.cos(i)*Math.cos(t)}function L(i){return i*Math.PI/180}function oe(i){return i*180/Math.PI}function Xn(i,t){const e=L(i.lat),r=L(i.lng),n=L(t.lat),a=L(t.lng)-r,h=Math.atan2(Math.sin(a)*Math.cos(n),Math.cos(e)*Math.sin(n)-Math.sin(e)*Math.cos(n)*Math.cos(a));return Ae(oe(h),-180,180)}function Jn(i,t,e){t/=ye,e=L(e);const r=L(i.lat),n=L(i.lng),s=Math.cos(t),a=Math.sin(t),h=Math.sin(r),o=Math.cos(r),c=s*h+a*o*Math.cos(e),p=Math.atan2(a*o*Math.sin(e),s-h*c);return{lat:oe(Math.asin(c)),lng:oe(n+p)}}function Qn(i,t,e){e=L(e),t/=ye;const r=Math.cos(t),n=Math.sin(t)*Math.cos(e),s=Math.sin(t)*Math.sin(e),a=Math.sin(L(i.lat)),h=r*r,o=n*n*h+h*h-h*a*a;if(o<0)return null;let c=n*a+Math.sqrt(o);c/=r*r+n*n;const p=(a-n*c)/r;let u=Math.atan2(p,c);if((u<-Math.PI/2||u>Math.PI/2)&&(c=n*a-Math.sqrt(o),c/=r*r+n*n,u=Math.atan2(p,c)),u<-Math.PI/2||u>Math.PI/2)return null;const g=L(i.lng)-Math.atan2(s,r*Math.cos(u)-n*Math.sin(u));return{lat:oe(u),lng:oe(g)}}function es(i,t,e){const r=L(i.lat),n=L(i.lng),s=L(t.lat),a=L(t.lng),h=Math.cos(r),o=Math.cos(s),c=tr(i,t),p=Math.sin(c);if(p<1e-6)return{lat:i.lat+e*(t.lat-i.lat),lng:i.lng+e*(t.lng-i.lng)};const u=Math.sin((1-e)*c)/p,g=Math.sin(e*c)/p,y=u*h*Math.cos(n)+g*o*Math.cos(a),_=u*h*Math.sin(n)+g*o*Math.sin(a),M=u*Math.sin(r)+g*Math.sin(s),b=Math.atan2(M,Math.sqrt(y*y+_*_)),l=Math.atan2(_,y);return{lat:oe(b),lng:oe(l)}}function ii(i,t,e,r){return Un(Pe(i,e,t-r))}function tr(i,t){return ii(L(i.lat),L(i.lng),L(t.lat),L(t.lng))}function we(i,t){return tr(i,t)*ye}function ts(i){if(i.length<2)return 0;let t=0,e=null;for(const r of i){if(e){const n=L(e.lat),s=L(e.lng),a=L(r.lat),h=L(r.lng);t+=ii(n,s,a,h)}e=r}return t*ye}function rs(i){return Math.abs(ni(i))}function ni(i,t=ye){const e=i.length;if(e<3)return 0;let r=0;const n=i[e-1];let s=Math.tan((Math.PI/2-L(n.lat))/2),a=L(n.lng);for(const h of i){const o=Math.tan((Math.PI/2-L(h.lat))/2),c=L(h.lng);r+=is(o,c,s,a),s=o,a=c}return r*(t*t)}function is(i,t,e,r){const n=t-r,s=i*e;return 2*Math.atan2(s*Math.sin(n),1+s*Math.cos(n))}const ns=Object.freeze(Object.defineProperty({__proto__:null,computeAngleBetween:tr,computeArea:rs,computeDistanceBetween:we,computeHeading:Xn,computeLength:ts,computeOffset:Jn,computeOffsetOrigin:Qn,computeSignedArea:ni,interpolate:es},Symbol.toStringTag,{value:"Module"}));function ss(i,t,e,r){return(Math.tan(i)*Math.sin(e-r)+Math.tan(t)*Math.sin(r))/Math.sin(e)}function os(i,t,e,r){return(ce(i)*(e-r)+ce(t)*r)/e}function as(i,t,e,r,n,s){if(n>=0&&n>=e||n<0&&n<e||r<=-Math.PI/2||i<=-Math.PI/2||t<=-Math.PI/2||i>=Math.PI/2||t>=Math.PI/2||e<=-Math.PI)return!1;const a=(i*(e-n)+t*n)/e;return i>=0&&t>=0&&r<a?!1:i<=0&&t<=0&&r>=a||r>=Math.PI/2?!0:s?Math.tan(r)>=ss(i,t,e,n):ce(r)>=os(i,t,e,n)}function ls(i,t,e){return si(i.lat,i.lng,t,e)}function si(i,t,e,r){const n=e.length;if(n===0)return!1;const s=L(i),a=L(t),h=e[n-1];let o=L(h.lat),c=L(h.lng),p=0;for(const u of e){const g=Ae(a-c,-Math.PI,Math.PI);if(s===o&&g===0)return!0;const y=L(u.lat),_=L(u.lng);as(o,y,Ae(_-c,-Math.PI,Math.PI),s,g,r)&&++p,o=y,c=_}return(p&1)!==0}const rr=.1;function hs(i,t,e=!0,r=rr){return oi(i,t,!0,e,r)}function cs(i,t,e=!0,r=rr){return oi(i,t,!1,e,r)}function oi(i,t,e,r,n){return ir(i,t,e,r,n)>=0}function ds(i,t,e,r=rr){return ir(i,t,!1,e,r)}function ir(i,t,e,r,n){const s=t.length;if(s===0)return-1;const a=n/ye,h=Re(a),o=L(i.lat),c=L(i.lng),p=t[e?s-1:0];let u=L(p.lat),g=L(p.lng),y=0;if(r)for(const _ of t){const M=L(_.lat),b=L(_.lng);if(ps(u,g,M,b,o,c,h))return Math.max(0,y-1);u=M,g=b,y++}else{const _=o-a,M=o+a;let b=ce(u);const l=ce(o),d=new Array(3);for(const f of t){const v=L(f.lat),w=ce(v),P=L(f.lng);if(Math.max(u,v)>=_&&Math.min(u,v)<=M){const E=Ae(P-g,-Math.PI,Math.PI),S=Ae(c-g,-Math.PI,Math.PI);d[0]=S,d[1]=S+2*Math.PI,d[2]=S-2*Math.PI;for(const D of d){const I=w-b,j=E*E+I*I,k=j<=0?0:jn((D*E+(l-b)*I)/j,0,1),N=k*E,U=b+k*I,Z=Fn(U);if(Pe(o,Z,D-N)<h)return Math.max(0,y-1)}}u=v,g=P,b=w,y++}}return-1}function us(i,t,e,r,n,s){const a=Math.sin(i),h=Math.cos(e),o=Math.cos(n),c=n-i,p=s-t,u=e-i,g=r-t,y=Math.sin(p)*o,_=Math.sin(g)*h,M=Math.sin(c)+2*a*o*Re(p),b=Math.sin(u)+2*a*h*Re(g),l=(y*y+M*M)*(_*_+b*b);return l<=0?1:(y*b-M*_)/Math.sqrt(l)}function ps(i,t,e,r,n,s,a){const h=Pe(i,n,t-s);if(h<=a)return!0;const o=Pe(e,n,r-s);if(o<=a)return!0;const c=us(i,t,e,r,n,s),p=qn(h),u=Yn(p*c);if(u>a)return!1;const g=Pe(i,e,t-r),y=g+u*(1-2*g);if(h>y||o>y)return!1;if(g<.74)return!0;const _=1-2*u,M=(h-u)/_,b=(o-u)/_;return Kn(M,b)>0}function gs(i,t){const e=i.length;if(e<1)throw new Error("Polyline must have at least 1 point");if(t<=0)throw new Error("Tolerance must be greater than zero");const r=ai(i);let n=null;r&&(n=i[i.length-1],i.pop(),i.push({lat:n.lat+1e-11,lng:n.lng+1e-11}));let s,a=0;const h=[],o=new Array(e).fill(0);o[0]=1,o[e-1]=1;let c,p=0,u;if(e>2){const y=[0,e-1];for(h.push(y);h.length>0;){for(u=h.pop(),c=0,s=u[0]+1;s<u[1];++s)p=li(i[s],i[u[0]],i[u[1]]),p>c&&(c=p,a=s);if(c>t){o[a]=c;const _=[u[0],a];h.push(_);const M=[a,u[1]];h.push(M)}}}r&&(i.pop(),i.push(n)),s=0;const g=[];for(const y of i)o[s]!==0&&g.push(y),s++;return g}function ai(i){const t=i[0],e=i[i.length-1];return t.lat===e.lat&&t.lng===e.lng}function li(i,t,e){if(t.lat===e.lat&&t.lng===e.lng)return we(e,i);const r=L(i.lat),n=L(i.lng),s=L(t.lat),a=L(t.lng),h=L(e.lat),o=L(e.lng),c=Math.cos(s),p=h-s,u=(o-a)*c,g=((r-s)*p+(n-a)*c*u)/(p*p+u*u);if(g<=0)return we(i,t);if(g>=1)return we(i,e);const y={lat:t.lat+g*(e.lat-t.lat),lng:t.lng+g*(e.lng-t.lng)};return we(i,y)}function ms(i){const t=i.length,e=[];let r=0,n=0,s=0;for(;r<t;){let a=1,h=0,o;do o=i.charCodeAt(r++)-63-1,a+=o<<h,h+=5;while(o>=31);n+=(a&1)!==0?~(a>>1):a>>1,a=1,h=0;do o=i.charCodeAt(r++)-63-1,a+=o<<h,h+=5;while(o>=31);s+=(a&1)!==0?~(a>>1):a>>1,e.push({lat:n*1e-5,lng:s*1e-5})}return e}function fs(i){let t=0,e=0,r="";for(const n of i){const s=Math.round(n.lat*1e5),a=Math.round(n.lng*1e5),h=s-t,o=a-e;r+=mr(h),r+=mr(o),t=s,e=a}return r}function mr(i){let t=i<0?~(i<<1):i<<1,e="";for(;t>=32;)e+=String.fromCharCode((32|t&31)+63),t>>=5;return e+=String.fromCharCode(t+63),e}const ys=Object.freeze(Object.defineProperty({__proto__:null,containsLocation:ls,containsLocationLatLng:si,decode:ms,distanceToLine:li,encode:fs,isClosedPolygon:ai,isLocationOnEdge:hs,isLocationOnPath:cs,locationIndexOnEdgeOrPath:ir,locationIndexOnPath:ds,simplify:gs},Symbol.toStringTag,{value:"Module"})),vs=6378137;function Le(i){return i*Math.PI/180}function fr(i){return i*180/Math.PI}function _s(i,t){if(i.lat===t.lat&&i.lng===t.lng)return 0;const e=Le((i.lat+t.lat)/2),r=Le((i.lat-t.lat)/2),n=Le((i.lng-t.lng)/2);let s=Math.sin(r),a=Math.sin(n),h=Math.sin(e);const o=vs,c=1/298.257;s=s*s,a=a*a,h=h*h;const p=s*(1-a)+(1-h)*a,u=(1-s)*(1-a)+h*a,g=Math.atan(Math.sqrt(p/u)),y=Math.sqrt(p*u)/g,_=2*g*o,M=(3*y-1)/2/u,b=(3*y+1)/2/p;return _*(1+c*(M*h*(1-s)-b*(1-h)*s))}function hi(i,t,e){const n=63567523142e-4,s=1/298.257223563,a=Le(t),h=Math.sin(a),o=Math.cos(a),c=(1-s)*Math.tan(Le(i.lat)),p=1/Math.sqrt(1+c*c),u=c*p,g=Math.atan2(c,o),y=p*h,_=1-y*y,M=_*(6378137*6378137-n*n)/(n*n),b=1+M/16384*(4096+M*(-768+M*(320-175*M))),l=M/1024*(256+M*(-128+M*(74-47*M)));let d=0,f=0,v=0,w=e/(n*b),P=2*Math.PI;for(;Math.abs(w-P)>1e-12;){d=Math.cos(2*g+w),f=Math.sin(w),v=Math.cos(w);const N=l*f*(d+l/4*(v*(-1+2*d*d)-l/6*d*(-3+4*f*f)*(-3+4*d*d)));P=w,w=e/(n*b)+N}const E=u*f-p*v*o,S=Math.atan2(u*v+p*f*o,(1-s)*Math.sqrt(y*y+E*E)),D=Math.atan2(f*h,p*v-u*f*o),I=s/16*_*(4+s*(4-3*_)),j=D-(1-I)*s*y*(w+I*f*(d+I*v*(-1+2*d*d)));return{lng:i.lng+fr(j),lat:fr(S)}}const Ms={getDistance:_s,getDestination:hi},bs={install(i,t){qr(t);const e=i.config.optionMergeStrategies;e[me]=e[fe]=(r,n)=>r?[...new Set([].concat(r,n))]:Array.isArray(n)?n:[n]}};exports.AbstractControl=it;exports.AbstractMap=ut;exports.Autocomplete=jt;exports.BaiduAutocomplete=Er;exports.BaiduCircle=mt;exports.BaiduControl=nt;exports.BaiduHeatmap=Ir;exports.BaiduInfoBoxOverlay=Mt;exports.BaiduInfoWindow=vt;exports.BaiduMapTypeControl=st;exports.BaiduMapUrls=Ke;exports.BaiduMarker=ge;exports.BaiduMarkerClusterer=Dr;exports.BaiduOverlay=ze;exports.BaiduPlacesService=Gr;exports.BaiduPolyShape=Tt;exports.BaiduPolygon=xt;exports.BaiduPolyline=Ot;exports.BaiduRectangle=Lt;exports.BaiduScaleControl=ot;exports.BaiduSearchBox=Zr;exports.BaiduStreetViewControl=lt;exports.BaiduZoomControl=ct;exports.BuildInMapType=V;exports.BuildInMapTypeId=Wt;exports.CachedValue=he;exports.ControlPosition=R;exports.CoordType=z;exports.CustomControl=Cr;exports.ElementOverlay=Fr;exports.EmptyControl=Tr;exports.FastFindValues=br;exports.GestureHandlingOptions=J;exports.GoogleAutocomplete=Lr;exports.GoogleCircle=ft;exports.GoogleControl=De;exports.GoogleHeatmap=Br;exports.GoogleInfoBoxOverlay=bt;exports.GoogleInfoWindow=_t;exports.GoogleMapTypeControl=Fe;exports.GoogleMapUrls=Ye;exports.GoogleMarker=Ct;exports.GoogleMarkerClusterer=zr;exports.GoogleOverlay=pt;exports.GooglePlacesService=$r;exports.GooglePolygon=Pt;exports.GooglePolyline=wt;exports.GoogleRectangle=Et;exports.GoogleScaleControl=at;exports.GoogleSearchBox=Nr;exports.GoogleStreetViewControl=ht;exports.GoogleZoomControl=dt;exports.Heatmap=Vt;exports.ImageMapType=Ti;exports.InfoWindow=yt;exports.InfoWindowModeValues=Vr;exports.KeyValue=Gt;exports.LatLng=x;exports.LatLngBounds=K;exports.LifecycleLogPlugin=Hn;exports.MIXIN_HOOK_CREATE=me;exports.MIXIN_HOOK_DESTROY=fe;exports.MIXIN_MAP_NAME=Bt;exports.MapMixin=$;exports.MapPane=ue;exports.MapTypeControlType=Ht;exports.MapUrls=Ft;exports.MapZoom=Wr;exports.MarkerClusterer=qt;exports.Overlay=Xt;exports.PlacesService=Yt;exports.PolyUtil=ys;exports.SearchBox=Kt;exports.SphericalUtil=ns;exports.SphericalUtils=Ms;exports.SymbolPath=Hi;exports.TgCircle=Tn;exports.TgCustomControl=gn;exports.TgElementOverlay=Pn;exports.TgHeatmap=_n;exports.TgInfoBox=Sn;exports.TgInfoWindow=Rn;exports.TgLabel=$n;exports.TgMap=Ge;exports.TgMapType=q;exports.TgMapTypeControl=mn;exports.TgMapWidget=dn;exports.TgMarker=St;exports.TgMarkerClusterer=ri;exports.TgPolygon=Gn;exports.TgPolyline=Nn;exports.TgRectangle=Zn;exports.TgScaleControl=fn;exports.TgStreetViewControl=yn;exports.TgTrafficLayer=Cn;exports.TgZoomControl=vn;exports.TrafficLayer=Or;exports.UnionIcon=ke;exports.callHook=Oe;exports.computedSaveOnThis=en;exports.createAsyncSingleton=Kr;exports.createEmptyVNode=$e;exports.createPropertyObject=Qr;exports.createPropertyObjectTyped=tn;exports.debug=Yi;exports.default=bs;exports.eventProp=A;exports.extractVNodeFromSlotsByComponent=nn;exports.findAncestorComponentByType=tt;exports.findByComponentType=rn;exports.getDestination=hi;exports.getTgMapConfig=er;exports.isComponentByType=Ve;exports.isEntryValueDef=Yr;exports.isInstanceOf=yi;exports.loadCachedMap=Xr;exports.optionalProp=T;exports.requiredProp=W;exports.safeAs=vi;exports.safeAsComponent=Zt;exports.setTgMapConfig=qr;exports.splitAttrs=ei;exports.stringEnumProp=F;exports.stringUnionPropFromValues=Jr;exports.todo=qi;exports.unwrapStringEnumValue=_i;exports.useEventLogMethods=sn;exports.useSplittedAttrs=Q;exports.useTgMapInner=It;
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(".tg-map{height:100%;position:relative}.tg-map__map{width:100%;height:100%}.tg-map__map--hide-logo-google .gm-style a[target=_blank]:has(>div>img){display:none!important}.tg-map__map--hide-logo-google .gm-style>div:last-child>div:last-child>div{display:none}.tg-map__map--hide-logo-baidu div.anchorBL>a[target=_blank]>img{display:none}.tg-map__map--hide-logo-baidu div.BMap_cpyCtrl{display:none}.tg-map-widget{position:absolute}.tg-map>.tg-custom-control{display:none}.tg-map .tg-element-overlay{display:none}.tg-map__map .tg-element-overlay{display:block}.tg-map .tg-info-box{display:none}.tg-map__map .tg-info-box{display:block}.tg-map .tg-label{display:none}.tg-map__map .tg-label{display:block}")),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("tg-commons"),s=require("tg-map-core"),r=require("vue");function c(e,t){return{type:String,default:t,validator:i=>Object.values(e).includes(i)}}function I(e,t){return{type:String,default:t,validator:i=>e.includes(i)}}function m(e){return{type:e,required:!0}}function o(e,t){return{type:e,default:t}}function N(e){const t={};return Object.entries(e).forEach(([i,n])=>{const a=`__${i}`;t[i]={get(){const l=this[a];return l===void 0?n:l},set(l){this[a]=l}}}),t}const b={enumerable:!0,configurable:!0,get:h.noop,set:h.noop};function E(e){return Object.keys(e).forEach(t=>{const i=e[t];let n=!1;typeof i=="function"?(b.get=i,b.set=h.noop,n=!0):typeof i=="object"&&typeof i.get=="function"&&(b.get=i.get,b.set=i.set,n=!0),n&&(e[t]=Object.defineProperty(e,t,b))}),e}function x(e){return E(e)}function $(){return r.createCommentVNode()}function C(e,t){const i=e.$options[t];if(i)for(const n of i)n.call(e)}function z(e,t){for(const i of e)if(i.$options.name===t.name)return i}function D(e,t){if(!e.default)return;const i=e.default();for(const n of i)if((n==null?void 0:n.type).name===t.name)return n}function M(e,t){const i={},n={},a={};return Object.keys(e).forEach(l=>{l.startsWith("on")?i[s.Strings.pascal2kebab(l.substring(2))]=e[l]:n[l]=e[l]}),t&&Object.keys(t).forEach(l=>{l.startsWith("on")&&(a[s.Strings.pascal2kebab(l.substring(2))]=t[l])}),{binds:n,listeners:i,listenerProps:a}}function u(e,t){return r.computed(()=>M(e,t))}function p(){return Function}const V=()=>{let e,t;function i(a){console.log(a),e=a&&a.type,t=Date.now()}function n(a){((a&&a.type)!==e||Date.now()-(t??0)>1e3)&&i(a)}return{eventLog:i,eventLogLess:n}};function k(e,t){return(e==null?void 0:e.$options.name)===t.name}function w(e,t){return k(e,t)?e:void 0}function T(e,t,i){let n=t;for(;n;){if(k(n,e))return n;if(i&&k(n,i))return;n=n.$parent}}const P="$map",v="onCreate",g="onDestroy",d=r.defineComponent({inject:[P],mounted(){C(this,v)},beforeUnmount(){C(this,g)},methods:{recreate(){C(this,g),C(this,v)}},render(){return $()}}),W={type:c(s.TgMapType,s.TgMapType.google),center:m(s.LatLng),centerSyncDelay:o(Number,300),currentCenter:o(s.LatLng),lastCenter:o(s.LatLng),zoom:m(Number),infoWindowMode:I(s.InfoWindowModeValues),gestureHandling:c(s.GestureHandlingOptions),minZoom:o(Number),maxZoom:o(Number),mapStyle:o(Object),mapTypeId:c(s.BuildInMapTypeId),mapType:o(Object),hideLogo:o(Boolean),onLoad:p(),"onUpdate:center":p(),"onUpdate:current-center":p(),"onUpdate:last-center":p(),"onUpdate:map-type":p(),"onUpdate:map-type-id":p(),"onUpdate:zoom":p(),onError:p()},R=r.defineComponent({name:"tg-map",provide(){return{[P]:r.computed(()=>this.map)}},inheritAttrs:!1,props:W,emits:void 0,setup(e,{attrs:t}){return{attrs:u(t,e),centerSyncTimeoutId:void 0}},data(){return{map:h.typed(),isDestroyed:!1}},computed:{propsJson(){return s.Objects.toJsonSafely(this.$props)}},watch:{gestureHandling(e){var t;e&&((t=this.map)==null||t.setGestureHandling(s.unwrapStringEnumValue(e,s.GestureHandlingOptions)))},minZoom(e){var t;(t=this.map)==null||t.setMinZoom(e)},maxZoom(e){var t;(t=this.map)==null||t.setMaxZoom(e)},mapStyle(e){var t;(t=this.map)==null||t.setMapStyle(e)},mapTypeId(e){var t;e&&((t=this.map)==null||t.setBuildInMapTypeId(s.unwrapStringEnumValue(e,s.BuildInMapTypeId)))},mapType(e){var t;(t=this.map)==null||t.setMapType(e??s.MapType.NORMAL)}},async mounted(){const e=s.unwrapStringEnumValue(this.type,s.TgMapType);try{await s.loadCachedMap(e)}catch(a){this.$emit("error",a);return}if(this.isDestroyed){console.warn(`tg-map(type=${e})已销毁, 不需要继续执行`);return}const t=s.TgMapFactory.createMap(e,this.$refs.map,{center:this.center,zoom:this.zoom,infoWindowMode:this.infoWindowMode,gestureHandling:s.unwrapStringEnumValue(this.gestureHandling,s.GestureHandlingOptions),minZoom:this.minZoom,maxZoom:this.maxZoom,mapStyle:this.mapStyle,buildInMapTypeId:s.unwrapStringEnumValue(this.mapTypeId,s.BuildInMapTypeId)});if(this.map=r.markRaw(t),this.mapType&&t.setMapType(this.mapType),"ready"in this.attrs.listeners&&console.error("地图载入完成的事件已经从ready改为了load, 请手动修改"),s.bindEvents(this.attrs.listeners,t,["load"]),this.$emit("load",t),r.watch([()=>this.zoom,()=>this.center],([a,l],[f,A])=>{a!==f&&t.setZoom(a),l!==A&&(t.getCenter().equals(l)||t.setCenter(l))}),this.attrs.listenerProps["update:center"]){const a=()=>this.$emit("update:center",t.getCenter());t.addEventListener("center-changed",()=>{this.centerSyncDelay>0?(clearTimeout(this.centerSyncTimeoutId),this.centerSyncTimeoutId=setTimeout(a,this.centerSyncDelay)):a()})}this.attrs.listenerProps["update:current-center"]&&(this.$emit("update:current-center",this.center),t.addEventListener("center-changed",()=>{this.$emit("update:current-center",t.getCenter())})),this.attrs.listenerProps["update:zoom"]&&t.addEventListener("zoom-changed",()=>{this.$emit("update:zoom",t.getZoom())});const i=this.attrs.listenerProps["update:map-type"],n=this.attrs.listenerProps["update:map-type-id"];(i||n)&&t.addEventListener("map-type-changed",()=>{const a=t.getMapType();i&&this.$emit("update:map-type",a),n&&this.$emit("update:map-type-id",a.id)})},unmounted(){this.isDestroyed=!0,this.map&&(this.attrs.listenerProps["update:last-center"]&&this.$emit("update:last-center",this.map.getCenter()),this.attrs.listenerProps["update:center"]&&(clearTimeout(this.centerSyncTimeoutId),this.$emit("update:center",this.map.getCenter())))},methods:{}}),y=(e,t)=>{const i=e.__vccOpts||e;for(const[n,a]of t)i[n]=a;return i};function U(e,t,i,n,a,l){return r.openBlock(),r.createElementBlock("div",r.mergeProps({class:"tg-map"},e.attrs.binds),[r.createElementVNode("div",{ref:"map",class:r.normalizeClass({"tg-map__map":!0,[`tg-map__map--hide-logo-${e.type}`]:e.hideLogo})},null,2),r.createCommentVNode("",!0),e.map?r.renderSlot(e.$slots,"default",{key:1}):r.createCommentVNode("",!0),r.renderSlot(e.$slots,"overlay")],16)}const _=y(R,[["render",U]]),Z=r.defineComponent({name:"tg-map-widget",props:{left:{type:[Number,String],default:null},top:{type:[Number,String],default:null},right:{type:[Number,String],default:null},bottom:{type:[Number,String],default:null}},computed:{topValue(){return this.top==null&&this.bottom==null?0:this.top}},methods:{dimen:s.dimen}});function j(e,t,i,n,a,l){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(e.$options.name),style:r.normalizeStyle({left:e.dimen(e.left),top:e.dimen(e.topValue),right:e.dimen(e.right),bottom:e.dimen(e.bottom)})},[r.renderSlot(e.$slots,"default")],6)}const H=y(Z,[["render",j]]),F=r.defineComponent({name:"tg-custom-control",mixins:[d],props:{position:c(s.ControlPosition,s.ControlPosition.RIGHT_BOTTOM)},setup(){return{control:h.lateinit()}},watch:{position(){this.recreate()}},onCreate(){w(this.$parent,_)||console.warn("请将tg-custom-control放到tg-map中");const{$el:e}=this,t=class extends s.CustomControl{onCreateElement(){return e}};this.control=new t(s.unwrapStringEnumValue(this.position,s.ControlPosition)),this.$map.addCustomControl(this.control)},onDestroy(){this.$map.removeCustomControl(this.control)}});function q(e,t,i,n,a,l){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(e.$options.name)},[r.renderSlot(e.$slots,"default")],2)}const G=y(F,[["render",q]]),X=r.defineComponent({name:"tg-map-type-control",mixins:[d],props:{position:c(s.ControlPosition,s.ControlPosition.TOP_LEFT),type:c(s.MapTypeControlType),mapTypes:o(Array)},setup(){return{control:h.lateinit()}},watch:{position(e){this.control.setPosition(e)},type(){this.recreate()},mapTypes:{handler(){this.recreate()},deep:!0}},onCreate(){this.control=this.$map.createMapTypeControl(s.unwrapStringEnumValue(this)),this.$map.addControl(this.control)},onDestroy(){this.$map.removeControl(this.control)}}),K=r.defineComponent({name:"tg-scale-control",mixins:[d],props:{position:c(s.ControlPosition,s.ControlPosition.BOTTOM_RIGHT)},setup(){return{control:h.lateinit()}},watch:{position(e){this.control.setPosition(e)}},onCreate(){this.control=this.$map.createScaleControl(s.unwrapStringEnumValue(this)),this.$map.addControl(this.control)},onDestroy(){this.$map.removeControl(this.control)}});function B(){var i;const e=(i=r.getCurrentInstance())==null?void 0:i.type;let t=(e==null?void 0:e.name)??(e==null?void 0:e.__name);if(!t){const n=e==null?void 0:e.__file;n&&(t=h.path.basename(n,".vue"))}return t}function O(){const e=r.inject(P);let t,i;return e==null&&h.throwError(`<${B()||"unknown"}>必须作为<tg-map>的子代组件`),{mapRef:e,get map(){return e.value??h.throwError("map尚未初始化")},[v](n){r.onMounted(n),t&&h.throwError(`${v}只能调用一次`),t=n},[g](n){r.onBeforeUnmount(n),i&&h.throwError(`${g}只能调用一次`),i=n},recreate(){i==null||i(),t==null||t()}}}const J=r.defineComponent({name:"tg-street-view-control",props:{position:c(s.ControlPosition,s.ControlPosition.RIGHT_BOTTOM)},setup(e){let t=h.lateinit();const{map:i,onCreate:n,onDestroy:a}=O();return n(()=>{t=i.createStreetViewControl(s.unwrapStringEnumValue(e)),i.addControl(t)}),a(()=>{i.removeControl(t)}),r.watch(()=>e.position,l=>{t.setPosition(s.unwrapStringEnumValue(l,s.ControlPosition))}),$}}),Y=r.defineComponent({name:"tg-zoom-control",props:{position:c(s.ControlPosition,s.ControlPosition.RIGHT_BOTTOM)},setup(e){let t=h.lateinit();const{map:i,onCreate:n,onDestroy:a}=O();return n(()=>{t=i.createZoomControl(s.unwrapStringEnumValue(e)),i.addControl(t)}),a(()=>{i.removeControl(t)}),r.watch(()=>e.position,l=>{t.setPosition(s.unwrapStringEnumValue(l,s.ControlPosition))}),$}}),Q=r.defineComponent({name:"tg-heatmap",props:{maxIntensity:o(Number),gradient:o(Object),opacity:o(Number),radius:o(Number),data:m(Array)},setup(e){const{map:t,onCreate:i,onDestroy:n}=O();let a=h.lateinit();return i(()=>{a=t.createHeatmap(e)}),n(()=>{a.remove()}),r.watch(()=>e.data,l=>a.setData(l)),r.watch([()=>e.maxIntensity,()=>e.gradient,()=>e.opacity,()=>e.radius],()=>a.setOptions(e)),$}}),ee=r.defineComponent({name:"tg-marker-clusterer",mixins:[d],props:{gridSize:o(Number),maxZoom:o(Number),minClusterSize:o(Number),averageCenter:o(Boolean),styles:o(Array),stylesIndexCalculator:o(Function),zIndex:o(Number)},setup(){return{clusterer:h.lateinit(),markers:h.typed([])}},watch:{gridSize(){this.recreate()},maxZoom(){this.recreate()},minClusterSize(){this.recreate()},averageCenter(){this.recreate()},styles:{handler(){this.recreate()},deep:!0},stylesIndexCalculator(){this.recreate()},zIndex(){this.recreate()}},onCreate(){this.clusterer=this.$map.createMarkerClusterer(this)},onDestroy(){this.clusterer.clearMarkers()},methods:{isInitiated(){return this.clusterer!=null},onAddMarker(e){this.markers.push(e),this.isInitiated()&&this.clusterer.addMarker(e)},onRemoveMarker(e){this.isInitiated()&&this.clusterer.removeMarker(e),h.Arrays.remove(this.markers,e)}}});function te(e,t,i,n,a,l){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(e.$options.name)},[r.renderSlot(e.$slots,"default")],2)}const L=y(ee,[["render",te]]),oe=r.defineComponent({name:"tg-traffic-layer",mixins:[d],setup(){return{layer:h.lateinit()}},watch:{},onCreate(){this.layer=new s.TrafficLayer,this.$map.addLayer(this.layer)},onDestroy(){this.$map.removeLayer(this.layer)}}),re=r.defineComponent({name:"tg-circle",mixins:[d],inheritAttrs:!1,props:{center:m(s.LatLng),radius:m(Number),clickable:o(Boolean),editable:o(Boolean),strokeColor:o(String),strokeOpacity:o(Number),strokeWeight:o(Number),visible:o(Boolean),zIndex:o(Number),fillColor:o(String),fillOpacity:o(Number),"onUpdate:center":p(),"onUpdate:radius":p()},emits:void 0,setup(e,{attrs:t}){return{attrs:u(t,e),overlay:h.lateinit(),emittedRadius:void 0,emittedCenter:void 0}},watch:{center(e){if(this.emittedCenter!=null){const t=this.emittedCenter;if(this.emittedCenter=void 0,t===r.toRaw(e))return}this.overlay.setCenter(e)},radius(e){if(this.emittedRadius!=null){const t=this.emittedRadius;if(this.emittedRadius=void 0,t===e)return}this.overlay.setRadius(e)},clickable(){this.recreate()},editable(e){this.overlay.setEditable(e)},strokeColor(e){this.overlay.setStrokeColor(e)},strokeOpacity(e){this.overlay.setStrokeOpacity(e)},strokeWeight(e){this.overlay.setStrokeWeight(e)},fillColor(e){this.overlay.setFillColor(e)},fillOpacity(e){this.overlay.setFillOpacity(e)},visible(e){this.overlay.setVisible(e)},zIndex(e){this.overlay.setZIndex(e)}},onCreate(){this.overlay=this.$map.createCircle(this),this.$map.addOverlay(this.overlay),s.bindEvents(this.attrs.listeners,this.overlay),this.attrs.listenerProps["update:center"]&&this.overlay.addEventListener("center-changed",()=>{this.$emit("update:center",this.emittedCenter=this.overlay.getCenter())}),this.attrs.listenerProps["update:radius"]&&this.overlay.addEventListener("radius-changed",()=>{this.$emit("update:radius",this.emittedRadius=this.overlay.getRadius())})},onDestroy(){this.$map.removeOverlay(this.overlay)}});class ie extends s.ElementOverlay{constructor(t,i,n,a){super(t,i),this.content=n,this.position=a}onCreate(){return this.content}onDraw(t){const i=t.fromLatLngToOverlayPoint(this.position);this.content.style.left=i.x+"px",this.content.style.top=i.y+"px"}setPosition(t){this.position=t,this.draw()}}const se=r.defineComponent({name:"tg-element-overlay",mixins:[d],props:{mapPane:c(s.MapPane,s.MapPane.overlayMouseTarget),position:m(s.LatLng)},setup(){return{overlay:h.lateinit()}},watch:{position(e){this.overlay.setPosition(e)},mapPane(){this.recreate()}},methods:{content(){return this.$el}},onCreate(){this.overlay=new ie(this.$map,s.unwrapStringEnumValue(this),this.content(),this.position),this.$map.addElementOverlay(this.overlay)},onDestroy(){this.$map.removeElementOverlay(this.overlay)}});function ne(e,t,i,n,a,l){return r.openBlock(),r.createElementBlock("div",r.mergeProps({class:e.$options.name},e.$attrs),[r.renderSlot(e.$slots,"default")],16)}const ae=y(se,[["render",ne]]),le={position:m(s.LatLng),title:o(String),label:o(Object),icon:o(Object),clickable:o(Boolean),draggable:o(Boolean),crossOnDrag:o(Boolean),cursor:o(String),zIndex:o(Number),visible:o(Boolean),normalizePositionForBaidu:o(Boolean),autoAddToClusterer:o(Boolean,!0),"onUpdate:position":p()},he=r.defineComponent({name:"tg-marker",mixins:[d],inheritAttrs:!1,props:le,emits:void 0,setup(e,{attrs:t}){return{attrs:u(t,e),marker:h.lateinit(),labelOverlay:h.typed(),info:h.typed(),emittedPosition:void 0,autoAddToClustererWhenCreate:e.autoAddToClusterer}},watch:{position(e){if(this.emittedPosition!=null){const t=this.emittedPosition;if(this.emittedPosition=void 0,t===r.toRaw(e))return}this.marker.setPosition(e)},title(e){this.marker.setTitle(e)},label(e,t){h.deepEqual(e,t)||(e?this.marker.setLabel(e):this.recreate())},icon(e){e?this.marker.setIcon(e):this.recreate()},clickable(e){this.marker instanceof s.BaiduMarker?this.recreate():this.marker.setClickable(e)},draggable(e){this.marker.setDraggable(e)},crossOnDrag(){this.recreate()},cursor(){this.recreate()},zIndex(e){this.marker instanceof s.BaiduMarker?this.recreate():this.marker.setZIndex(e)},visible(e){this.marker.setVisible(e)},normalizePositionForBaidu(){this.recreate()},autoAddToClusterer(){this.recreate()}},onCreate(){this.marker=this.$map.createMarker(this),this.labelOverlay&&this.marker.attachLabelOverlay(this.labelOverlay.overlay),this.$clusterer()&&this.autoAddToClusterer?this.$clusterer().onAddMarker(this.marker):this.$map.addOverlay(this.marker),this.autoAddToClustererWhenCreate=this.autoAddToClusterer,this.info&&this.info.show&&this.info.overlay.open(this.marker),s.bindEvents(this.attrs.listeners,this.marker),this.attrs.listenerProps["update:position"]&&this.marker.addEventListener("dragend",e=>{this.$emit("update:position",this.emittedPosition=e.position)})},onDestroy(){this.$clusterer()&&this.autoAddToClustererWhenCreate?this.$clusterer().onRemoveMarker(this.marker):this.$map.removeOverlay(this.marker)},methods:{$clusterer(){return w(this.$parent,L)},onAddLabel(e){this.labelOverlay=e,this.marker&&this.marker.attachLabelOverlay(e.overlay)},onRemoveLabel(e){this.marker.attachLabelOverlay(void 0),this.labelOverlay=void 0},onAddInfo(e){this.info=e,this.marker&&e.show&&e.overlay.open(this.marker)},onRemoveInfo(e){e.overlay.close(),this.info=void 0},onInfoShowChanged(e,t){t?e.overlay.open(this.marker):e.overlay.close()}}});function pe(e,t,i,n,a,l){return r.renderSlot(e.$slots,"default")}const S=y(he,[["render",pe]]),de=r.defineComponent({name:"tg-info-box",mixins:[d],inheritAttrs:!1,props:{show:m(Boolean),position:o(s.LatLng),offset:o(Object),maxWidth:o(Number),borderClass:o(String),zIndex:o(Number),"onUpdate:show":p()},emits:void 0,setup(e,{attrs:t}){return{attrs:u(t,e),overlay:h.lateinit()}},watch:{show(e){this.$marker()?this.$marker().onInfoShowChanged(this,e):e?this.overlay.open():this.overlay.close()},position(e){this.overlay.setPosition(e)},offset(){this.recreate()},maxWidth(e){this.overlay.setMaxWidth(e)},borderClass(){this.recreate()},zIndex(e){this.overlay.setZIndex(e)}},onCreate(){this.overlay=this.$map.createInfoBox(this.getOptions()),this.$marker()?this.$marker().onAddInfo(this):this.show&&this.overlay.open(),this.attrs.listenerProps["update:show"]&&this.overlay.addEventListener("closeclick",()=>{this.$emit("update:show",!1)}),s.bindEvents(this.attrs.listeners,this.overlay)},onDestroy(){this.$marker()?this.$marker().onRemoveInfo(this):this.overlay.close()},methods:{getOptions(){return{content:this.content(),position:this.position,offset:this.offset,zIndex:this.zIndex,maxWidth:this.maxWidth,borderClass:this.borderClass}},content(){return this.$el},$marker(){return T(S,this.$parent,_)},open(e){this.overlay.open(e)},close(){this.overlay.close()}}});function me(e,t,i,n,a,l){return r.openBlock(),r.createElementBlock("div",r.mergeProps({class:e.$options.name},e.attrs.binds),[r.renderSlot(e.$slots,"default")],16)}const ce=y(de,[["render",me]]),ue=r.defineComponent({name:"tg-info-window",mixins:[d],inheritAttrs:!1,props:{show:m(Boolean),position:o(s.LatLng),maxWidth:o(Number),offset:o(Object),disableAutoPan:o(Boolean),"onUpdate:show":p()},emits:void 0,setup(e,{attrs:t}){return{attrs:u(t,e),overlay:h.lateinit()}},watch:{show(e){this.$marker()?this.$marker().onInfoShowChanged(this,e):e?this.overlay.open():this.overlay.close()},position(e){this.overlay.setPosition(e)},maxWidth(){this.recreate()},offset(){this.recreate()},disableAutoPan(){this.recreate()}},methods:{content(){return this.$el},$marker(){return T(S,this.$parent,_)},getOptions(){return{content:this.content(),position:this.position,maxWidth:this.maxWidth,offset:this.offset,disableAutoPan:this.disableAutoPan}}},onCreate(){this.overlay=this.$map.createInfoWindow(this.getOptions()),this.$marker()?this.$marker().onAddInfo(this):this.show&&this.overlay.open(),this.overlay.addEventListener("open",()=>{this.$emit("update:show",!0)}),this.overlay.addEventListener("close",()=>{this.$emit("update:show",!1)}),s.bindEvents(this.attrs.listeners,this.overlay)},onDestroy(){this.$marker()?this.$marker().onRemoveInfo(this):this.overlay.close()}});function ye(e,t,i,n,a,l){return r.withDirectives((r.openBlock(),r.createElementBlock("div",r.mergeProps({class:e.$options.name},e.attrs.binds),[r.renderSlot(e.$slots,"default")],16)),[[r.vShow,e.show]])}const fe=y(ue,[["render",ye]]),ve=r.defineComponent({name:"tg-label",mixins:[d],inheritAttrs:!1,props:{position:o(s.LatLng),offset:o(Object),zIndex:o(Number),mapPane:c(s.MapPane)},emits:void 0,setup(e,{attrs:t}){return{attrs:u(t),overlay:h.lateinit()}},watch:{position(e){this.overlay.setPosition(e)},offset(e){this.overlay.setOffset(e)},zIndex(e){this.overlay.setZIndex(e)},visible(e){this.overlay.setVisible(e)},mapPane(){this.recreate()}},methods:{content(){return this.$el},marker(){var e;return(e=this.$marker())==null?void 0:e.marker},$marker(){return T(S,this.$parent,_)},getOptions(){return{content:this.content(),position:this.position,offset:this.offset,zIndex:this.zIndex,mapPane:s.unwrapStringEnumValue(this.mapPane,s.MapPane)}}},onCreate(){this.overlay=this.$map.createLabel(this.getOptions()),this.$marker()?this.$marker().onAddLabel(this):this.$map.addOverlay(this.overlay),s.bindEvents(this.attrs.listeners,this.overlay)},onDestroy(){this.$marker()?this.$marker().onRemoveLabel(this):this.$map.removeOverlay(this.overlay)}});function ge(e,t,i,n,a,l){return r.openBlock(),r.createElementBlock("div",r.mergeProps({class:e.$options.name},e.attrs.binds),[r.renderSlot(e.$slots,"default")],16)}const be=y(ve,[["render",ge]]),Ce={paths:m(Array),clickable:o(Boolean),editable:o(Boolean),strokeColor:o(String),strokeOpacity:o(Number),strokeWeight:o(Number),visible:o(Boolean),zIndex:o(Number),fillColor:o(String),fillOpacity:o(Number),"onUpdate:paths":p()},$e=r.defineComponent({name:"tg-polygon",mixins:[d],inheritAttrs:!1,props:Ce,emits:void 0,setup(e,{attrs:t}){return{attrs:u(t,e),overlay:h.lateinit(),emittedPaths:void 0}},watch:{paths:{handler(e){if(this.emittedPaths!=null){const t=this.emittedPaths;if(this.emittedPaths=void 0,t.length===e.length&&t.every((i,n)=>i===r.toRaw(e[n])))return}this.overlay.setPaths(e)},deep:!0},clickable(){this.recreate()},editable(e){this.overlay.setEditable(e)},strokeColor(e){this.overlay.setStrokeColor(e)},strokeOpacity(e){this.overlay.setStrokeOpacity(e)},strokeWeight(e){this.overlay.setStrokeWeight(e)},fillColor(e){this.overlay.setFillColor(e)},fillOpacity(e){this.overlay.setFillOpacity(e)},visible(e){this.overlay.setVisible(e)},zIndex(e){this.overlay.setZIndex(e)}},onCreate(){this.overlay=this.$map.createPolygon(this),this.$map.addOverlay(this.overlay),s.bindEvents(this.attrs.listeners,this.overlay),this.attrs.listenerProps["update:paths"]&&this.overlay.addEventListener("paths-edited",()=>{this.$emit("update:paths",this.emittedPaths=this.overlay.getPaths())})},onDestroy(){this.$map.removeOverlay(this.overlay)}}),_e=r.defineComponent({name:"tg-polyline",mixins:[d],inheritAttrs:!1,props:{path:m(Array),icons:o(Array),clickable:o(Boolean),editable:o(Boolean),strokeColor:o(String),strokeOpacity:o(Number),strokeWeight:o(Number),visible:o(Boolean),zIndex:o(Number),"onUpdate:path":p()},emits:void 0,setup(e,{attrs:t}){return{attrs:u(t,e),overlay:h.lateinit(),emittedPath:void 0}},watch:{path:{handler(e){if(this.emittedPath!=null){const t=this.emittedPath;if(this.emittedPath=void 0,t===r.toRaw(e))return}this.overlay.setPath(e)},deep:!0},icons:{handler(){this.recreate()},deep:!0},clickable(){this.recreate()},editable(e){this.overlay.setEditable(e)},strokeColor(e){this.overlay.setStrokeColor(e)},strokeOpacity(e){this.overlay.setStrokeOpacity(e)},strokeWeight(e){this.overlay.setStrokeWeight(e)},visible(e){this.overlay.setVisible(e)},zIndex(e){this.overlay.setZIndex(e)}},onCreate(){this.overlay=this.$map.createPolyline(this),this.$map.addOverlay(this.overlay),s.bindEvents(this.attrs.listeners,this.overlay),this.attrs.listenerProps["update:path"]&&this.overlay.addEventListener("path-edited",()=>{this.$emit("update:path",this.emittedPath=this.overlay.getPath())})},onDestroy(){this.overlay.remove()}}),ke=r.defineComponent({name:"tg-rectangle",mixins:[d],inheritAttrs:!1,props:{bounds:m(Object),clickable:o(Boolean),editable:o(Boolean),strokeColor:o(String),strokeOpacity:o(Number),strokeWeight:o(Number),visible:o(Boolean),zIndex:o(Number),fillColor:o(String),fillOpacity:o(Number),"onUpdate:bounds":p()},emits:void 0,setup(e,{attrs:t}){return{attrs:u(t,e),overlay:h.lateinit(),emittedBounds:void 0}},watch:{bounds(e){if(this.emittedBounds!=null){const t=this.emittedBounds;if(this.emittedBounds=void 0,t.equals(e))return}this.overlay.setBounds(e)},clickable(){this.recreate()},editable(e){this.overlay.setEditable(e)},strokeColor(e){this.overlay.setStrokeColor(e)},strokeOpacity(e){this.overlay.setStrokeOpacity(e)},strokeWeight(e){this.overlay.setStrokeWeight(e)},fillColor(e){this.overlay.setFillColor(e)},fillOpacity(e){this.overlay.setFillOpacity(e)},visible(e){this.overlay.setVisible(e)},zIndex(e){this.overlay.setZIndex(e)}},onCreate(){this.overlay=this.$map.createRectangle(this),this.$map.addOverlay(this.overlay),s.bindEvents(this.attrs.listeners,this.overlay),this.attrs.listenerProps["update:bounds"]&&this.overlay.addEventListener("bounds-changed",()=>{this.$emit("update:bounds",this.emittedBounds=this.overlay.getBounds())})},onDestroy(){this.$map.removeOverlay(this.overlay)}}),Te=["beforeUpdate","updated"],Pe={install(e,t={}){if(t.enable!==!1){const i=r.defineComponent({beforeCreate(){const n=B()??"",l=(t.nameRegex||/^[A-Z]/).test(n)?f=>{t.hookNames?t.hookNames.includes(f)&&console.debug("[lifecycle]",n,f):Te.includes(f)||console.debug("[lifecycle]",n,f)}:h.noop;l("beforeCreate"),this.__life_impl=l},created(){this.__life("created")},beforeMount(){this.__life("beforeMount")},mounted(){this.__life("mounted")},beforeUpdate(){this.__life("beforeUpdate")},updated(){this.__life("updated")},beforeUnmount(){this.__life("beforeUnmount")},unmounted(){this.__life("unmounted")},methods:{__life(n){this.__life_impl(n)}},onCreate(){this.__life("onCreate")},onDestroy(){this.__life("onDestroy")}});e.mixin(i)}}},Oe={install(e,t){s.setTgMapConfig(t);const i=e.config.optionMergeStrategies;i[v]=i[g]=(n,a)=>n?[...new Set([].concat(n,a))]:Array.isArray(a)?a:[a]}};exports.LifecycleLogPlugin=Pe;exports.MIXIN_HOOK_CREATE=v;exports.MIXIN_HOOK_DESTROY=g;exports.MIXIN_MAP_NAME=P;exports.MapMixin=d;exports.TgCircle=re;exports.TgCustomControl=G;exports.TgElementOverlay=ae;exports.TgHeatmap=Q;exports.TgInfoBox=ce;exports.TgInfoWindow=fe;exports.TgLabel=be;exports.TgMap=_;exports.TgMapTypeControl=X;exports.TgMapWidget=H;exports.TgMarker=S;exports.TgMarkerClusterer=L;exports.TgPolygon=$e;exports.TgPolyline=_e;exports.TgRectangle=ke;exports.TgScaleControl=K;exports.TgStreetViewControl=J;exports.TgTrafficLayer=oe;exports.TgZoomControl=Y;exports.callHook=C;exports.computedSaveOnThis=N;exports.createEmptyVNode=$;exports.createPropertyObject=E;exports.createPropertyObjectTyped=x;exports.default=Oe;exports.eventProp=p;exports.extractVNodeFromSlotsByComponent=D;exports.findAncestorComponentByType=T;exports.findByComponentType=z;exports.isComponentByType=k;exports.optionalProp=o;exports.requiredProp=m;exports.safeAsComponent=w;exports.splitAttrs=M;exports.stringEnumProp=c;exports.stringUnionPropFromValues=I;exports.useEventLogMethods=V;exports.useSplittedAttrs=u;exports.useTgMapInner=O;Object.keys(s).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>s[e]})});
|
|
18
3
|
//# sourceMappingURL=tg-map.cjs.map
|