tg-map-vue3 3.7.13 → 3.7.14
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/dist/tg-map.js +1 -1
- package/dist/tg-map.js.map +1 -1
- package/dist/tg-map.umd.cjs +1 -1
- package/dist/tg-map.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/tg-map.umd.cjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
11
11
|
* Released under the MIT License.
|
|
12
|
-
*/function xi(r){return Kr(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}function Ai(r){var t,e;return!(xi(r)===!1||(t=r.constructor,typeof t!="function")||(e=t.prototype,xi(e)===!1)||e.hasOwnProperty("isPrototypeOf")===!1)}a.Objects=void 0,(r=>{function t(u,p){return u.reduce((g,_)=>(g[p(_)]=_,g),{})}r.fromArray=t;function e(u){return u.reduce((p,g)=>(p[g[0]]=g[1],p),{})}r.fromEntries=e;function i(u){return JSON.stringify(u,(p,g)=>typeof g=="object"&&Object.getPrototypeOf(g)!==Object.prototype?g.toString!==Object.prototype.toString?g.toString():`[object ${Object.getPrototypeOf(g).constructor.name}]`:g)}r.toJsonSafely=i;function n(u){Ai(u)&&Object.keys(u).forEach(p=>{u[p]===void 0?delete u[p]:n(u[p])})}r.deleteUndefinedPropertyOnPlainObjectDeeply=n;function s(u,p,g){let _=u[p];return _===void 0&&(_=g(),u[p]=_),_}r.putIfAbsent=s;function l(u,...p){const g=Ri(p),_={};for(const T in u)g(T)||(_[T]=u[T]);return _}r.omit=l;function d(u,...p){const g=Ri(p),_={};for(const T in u)g(T)&&(_[T]=u[T]);return _}r.pick=d;function o(u,p){const g=typeof p=="string"?p.split("."):p;let _=u;for(const T of g){if(_==null)return;_=_[T]}return _}r.get=o;function h(u,p){const g=typeof p=="string"?p.split("."):p,_=o(u,g.slice(0,-1)),T=g[g.length-1];_!=null&&delete _[T]}r.del=h})(a.Objects||(a.Objects={}));function Ri(r){if(r.length<=4)return r.includes.bind(r);{const t=new Set(r);return t.has.bind(t)}}a.Objects.toJsonSafely;const Di=["single","multi"];var X=(r=>(r.auto="auto",r.none="none",r.greedy="greedy",r.cooperative="cooperative",r))(X||{});a.MapOptions=void 0,(r=>{function t(e){a.Objects.deleteUndefinedPropertyOnPlainObjectDeeply(e);const i={center:w.ZERO,zoom:5};return ki(i,e||{},{isMergeableObject:Ai})}r.create=t})(a.MapOptions||(a.MapOptions={}));class Vt{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 st extends Vt{constructor(t,e,i){super(t,e),this.map=i}createDelegate(){return new ne(this.innerOverlay,this.map)}isVisible(){return this.innerOverlay.getVisible()}setVisible(t){this.innerOverlay.setVisible(t)}}class we extends Vt{constructor(t,e,i){super(t,e),this.map=i}createDelegate(){return new he(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 Pt=class extends we{constructor(t,e,i,n){super(t,e,i),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+Pt.OPACITY_DELTA)}setStrokeWeight(t){this.innerOverlay.setStrokeWeight(t)}setFillColor(t){this.innerOverlay.setFillColor(t)}setFillOpacity(t){this.innerOverlay.setFillOpacity(t+Pt.OPACITY_DELTA)}};let V=Pt;m(V,"OPACITY_DELTA",.001);class ot extends st{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 at extends V{constructor(){super(...arguments);m(this,"prevCenter");m(this,"prevRadius");m(this,"isDoingSetCenter",!1);m(this,"isDoingSetRadius",!1);m(this,"eventHubDelegate");m(this,"onRadiusChanged",()=>{var i;const e=this.innerOverlay.getRadius();this.prevRadius!==e&&(this.isDoingSetRadius||(i=this.eventHubDelegate)==null||i.notify({type:"radius-changed",target:this}),this.prevRadius=e)});m(this,"onCenterChanged",()=>{var i;const e=this.innerOverlay.getCenter();this.prevCenter!==e&&(this.isDoingSetCenter||(i=this.eventHubDelegate)==null||i.notify({type:"center-changed",target:this}),this.prevCenter=e)});m(this,"resetEditableTimeoutId")}static create(e){const i=this.coordType,n=new BMap.Circle(e.center.toBaidu(i),e.radius,{enableClicking:e.clickable,enableEditing:!1,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity!=null?e.strokeOpacity+V.OPACITY_DELTA:void 0,strokeWeight:e.strokeWeight,fillColor:e.fillColor,fillOpacity:e.fillOpacity!=null?e.fillOpacity+V.OPACITY_DELTA:void 0}),s=new at(n,i,this,{editable:!!e.editable}).visibleOptionInternal(e.visible);return s.state.editable&&setTimeout(()=>{s.state.editable&&n.enableEditing()},0),s}createDelegate(){return this.eventHubDelegate=new Ve(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 w.fromBaidu(this.innerOverlay.getCenter(),this.coordType)}setRadius(e){this.isDoingSetRadius=!0,this.innerOverlay.setRadius(e),this.isDoingSetRadius=!1}getRadius(){return this.innerOverlay.getRadius()}}class lt extends ot{static create(t){const e=this.coordType,i=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 lt(i,e,this)}setCenter(t){this.coordType=this.map.coordType,this.innerOverlay.setCenter(t.toGoogle(this.coordType))}getCenter(){return w.fromGoogle(this.innerOverlay.getCenter()??ie.LATLNG_ZERO,this.coordType)}setRadius(t){this.innerOverlay.setRadius(t)}getRadius(){return this.innerOverlay.getRadius()}}function $i(){BMap.OverlayV3||(BMap.OverlayV3=BMap.Overlay)}const zi={equals(r,t){return r.lat===t.lat&&r.lng===t.lng}};a.Point=void 0,(r=>{r.ZERO={x:0,y:0}})(a.Point||(a.Point={}));const Vn="";let jt;function Xr(r,t,e,i,n,s){return jt||(jt=Jr()),new jt(r,t,e,i,n,s)}function Jr(){$i();const r=new BMap.Point(0,0);return class extends BMap.OverlayV3{constructor(i,n=r,s=a.Point.ZERO,l,d=654,o=""){super();m(this,"container");m(this,"border");m(this,"inner");m(this,"map");m(this,"marker");this.content=i,this.position=n,this.offset=s;const h="baidu-info-box-container";this.container=document.createElement("div"),this.container.className=h,this.container.style.position="absolute";const u=g=>g.stopPropagation();this.container.onclick=u,this.container.ondblclick=u,this.container.onmousedown=u,this.container.onmousemove=u,this.container.onmousewheel=u,this.border=document.createElement("div"),this.border.className=`${h}__border ${o}`,this.inner=document.createElement("div"),this.inner.className=h+"__inner";const p=document.createElement("span");p.className=h+"__close",p.addEventListener("click",()=>{this.close(),this.dispatchEvent({type:"onclickclose"})}),this.inner.appendChild(i),this.border.appendChild(this.inner),this.border.appendChild(p),this.container.appendChild(this.border),l&&this.setZIndex(l),this.setMaxWidth(d),this.onMarkerPositionChanged=this.onMarkerPositionChanged.bind(this)}initialize(i){return this.map=i,i.getPanes().floatPane.appendChild(this.container),this.container}draw(){if(!this.map)return;const i=this.marker?this.marker.getPosition():this.position,n=this.map.pointToOverlayPixel(i),s=n.x+this.offset.x,l=n.y+this.offset.y;this.container.style.left=`${s}px`,this.container.style.top=`${l}px`}open(i,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()||i.addOverlay(this))}attachMarker(i){i.__info_box__=this,i.addEventListener("dragging",this.onMarkerPositionChanged),i.addEventListener("dragend",this.onMarkerPositionChanged)}detachMarker(i){i.__info_box__=void 0,i.removeEventListener("dragging",this.onMarkerPositionChanged),i.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(i){this.container.style.zIndex=`${i}`}setMaxWidth(i){this.border.style.maxWidth=`${i}px`}setPosition(i){this.marker||(this.position=i,this.draw())}getPosition(){return this.position}setOffset(i){this.offset=i,this.draw()}getOffset(){return this.offset}}}class ht{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 ct extends ht{constructor(t,e,i){super(new he(t,e)),this.inner=t,this.map=e,this.state=i}static create(t){const e=t.position||w.ZERO,i=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 ct(i,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||w.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&&w.fromBaidu(t,this.map.coordType)||this.state.position||w.ZERO}setPosition(t){this.state.position=t,this.inner.isOpen()&&this.open()}}class dt extends ht{constructor(e,i){super(new ne(e,i));m(this,"eventHub",new ni);m(this,"isOpened",!1);this.inner=e,this.map=i,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 i=e.position||w.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:i.toGoogle(this.coordType),disableAutoPan:e.disableAutoPan});return new dt(n,this)}isOpen(){return this.isOpened}addEventListener(e,i){if(e==="open"||e==="close"){this.eventHub.addEventListener(e,i);return}super.addEventListener(e,i)}removeEventListener(e,i){if(e==="open"||e==="close"){this.eventHub.removeEventListener(e,i);return}super.removeEventListener(e,i)}open(e){if(!this.isOpened){if(this.map.mapOptions.infoWindowMode==="single"){const i=this.map.getLatestInfoWindow();i&&i.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 w.fromGoogle(this.inner.getPosition()??ie.LATLNG_ZERO,this.map.coordType)}setPosition(e){this.inner.setPosition(e.toGoogle(this.map.coordType))}}class ut extends we{constructor(t,e,i){super(t,e,i),this.baiduMap=i}static create(t){var n;const e=this.coordType,i=Xr(t.content,(n=t.position)==null?void 0:n.toBaidu(e),t.offset,t.zIndex,t.maxWidth,t.borderClass);return new ut(i,e,this)}open(t){this.innerOverlay.open(this.baiduMap.innerMap,t==null?void 0:t.innerOverlay)}close(){this.innerOverlay.close()}getPosition(){return w.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 pt extends ht{constructor(t,e,i){super(new ne(t,i)),this.inner=t,this.coordType=e,this.map=i}static create(t){var s;const e=this.coordType,i=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&&i.addListener("domready",()=>{var d;const l=(d=t.content.parentElement)==null?void 0:d.parentElement;l&&l.className.includes("gm-style-iw-c")&&!l.className.includes(n)&&(l.className+=` ${n}`)}),new pt(i,e,this)}open(t){this.inner.open(this.map.innerMap,t==null?void 0:t.innerOverlay)}close(){this.inner.close()}getPosition(){return w.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(),i=this.inner.getAnchor();this.inner.close(),this.inner.setOptions({maxWidth:t}),this.inner.open(e,i)}else this.inner.setOptions({maxWidth:t})}setZIndex(t){this.inner.setZIndex(t)}}a.Strings=void 0,(r=>{function t(s,l){if(s!==void 0)return Object.values(l).includes(s)?s:void 0}r.toEnumOrNull=t;function e(s){return s.split(`
|
|
12
|
+
*/function xi(r){return Kr(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}function Ai(r){var t,e;return!(xi(r)===!1||(t=r.constructor,typeof t!="function")||(e=t.prototype,xi(e)===!1)||e.hasOwnProperty("isPrototypeOf")===!1)}a.Objects=void 0,(r=>{function t(u,p){return u.reduce((g,_)=>(g[p(_)]=_,g),{})}r.fromArray=t;function e(u){return u.reduce((p,g)=>(p[g[0]]=g[1],p),{})}r.fromEntries=e;function i(u){return JSON.stringify(u,(p,g)=>typeof g=="object"&&Object.getPrototypeOf(g)!==Object.prototype?g.toString!==Object.prototype.toString?g.toString():`[object ${Object.getPrototypeOf(g).constructor.name}]`:g)}r.toJsonSafely=i;function n(u){Ai(u)&&Object.keys(u).forEach(p=>{u[p]===void 0?delete u[p]:n(u[p])})}r.deleteUndefinedPropertyOnPlainObjectDeeply=n;function s(u,p,g){let _=u[p];return _===void 0&&(_=g(),u[p]=_),_}r.putIfAbsent=s;function l(u,...p){const g=Ri(p),_={};for(const T in u)g(T)||(_[T]=u[T]);return _}r.omit=l;function d(u,...p){const g=Ri(p),_={};for(const T in u)g(T)&&(_[T]=u[T]);return _}r.pick=d;function o(u,p){const g=typeof p=="string"?p.split("."):p;let _=u;for(const T of g){if(_==null)return;_=_[T]}return _}r.get=o;function h(u,p){const g=typeof p=="string"?p.split("."):p,_=o(u,g.slice(0,-1)),T=g[g.length-1];_!=null&&delete _[T]}r.del=h})(a.Objects||(a.Objects={}));function Ri(r){if(r.length<=4)return r.includes.bind(r);{const t=new Set(r);return t.has.bind(t)}}a.Objects.toJsonSafely;const Di=["single","multi"];var X=(r=>(r.auto="auto",r.none="none",r.greedy="greedy",r.cooperative="cooperative",r))(X||{});a.MapOptions=void 0,(r=>{function t(e){a.Objects.deleteUndefinedPropertyOnPlainObjectDeeply(e);const i={center:w.ZERO,zoom:5};return ki(i,e||{},{isMergeableObject:Ai})}r.create=t})(a.MapOptions||(a.MapOptions={}));class Vt{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 st extends Vt{constructor(t,e,i){super(t,e),this.map=i}createDelegate(){return new ne(this.innerOverlay,this.map)}isVisible(){return this.innerOverlay.getVisible()}setVisible(t){this.innerOverlay.setVisible(t)}}class we extends Vt{constructor(t,e,i){super(t,e),this.map=i}createDelegate(){return new he(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 Pt=class extends we{constructor(t,e,i,n){super(t,e,i),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+Pt.OPACITY_DELTA)}setStrokeWeight(t){this.innerOverlay.setStrokeWeight(t)}setFillColor(t){this.innerOverlay.setFillColor(t)}setFillOpacity(t){this.innerOverlay.setFillOpacity(t+Pt.OPACITY_DELTA)}};let V=Pt;m(V,"OPACITY_DELTA",.001);class ot extends st{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 at extends V{constructor(){super(...arguments);m(this,"prevCenter");m(this,"prevRadius");m(this,"isDoingSetCenter",!1);m(this,"isDoingSetRadius",!1);m(this,"eventHubDelegate");m(this,"onRadiusChanged",()=>{var i;const e=this.innerOverlay.getRadius();this.prevRadius!==e&&(this.isDoingSetRadius||(i=this.eventHubDelegate)==null||i.notify({type:"radius-changed",target:this}),this.prevRadius=e)});m(this,"onCenterChanged",()=>{var i;const e=this.innerOverlay.getCenter();this.prevCenter!==e&&(this.isDoingSetCenter||(i=this.eventHubDelegate)==null||i.notify({type:"center-changed",target:this}),this.prevCenter=e)});m(this,"resetEditableTimeoutId")}static create(e){const i=this.coordType,n=new BMap.Circle(e.center.toBaidu(i),e.radius,{enableClicking:e.clickable,enableEditing:!1,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity!=null?e.strokeOpacity+V.OPACITY_DELTA:void 0,strokeWeight:e.strokeWeight,fillColor:e.fillColor,fillOpacity:e.fillOpacity!=null?e.fillOpacity+V.OPACITY_DELTA:void 0}),s=new at(n,i,this,{editable:!!e.editable}).visibleOptionInternal(e.visible);return s.state.editable&&setTimeout(()=>{s.state.editable&&n.enableEditing()},0),s}createDelegate(){return this.eventHubDelegate=new Ve(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 w.fromBaidu(this.innerOverlay.getCenter(),this.coordType)}setRadius(e){this.isDoingSetRadius=!0,this.innerOverlay.setRadius(e),this.isDoingSetRadius=!1}getRadius(){return this.innerOverlay.getRadius()}}class lt extends ot{static create(t){const e=this.coordType,i=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 lt(i,e,this)}setCenter(t){this.coordType=this.map.coordType,this.innerOverlay.setCenter(t.toGoogle(this.coordType))}getCenter(){return w.fromGoogle(this.innerOverlay.getCenter()??ie.LATLNG_ZERO,this.coordType)}setRadius(t){this.innerOverlay.setRadius(t)}getRadius(){return this.innerOverlay.getRadius()}}function $i(){BMap.OverlayV3||(BMap.OverlayV3=BMap.Overlay)}const zi={equals(r,t){return r.lat===t.lat&&r.lng===t.lng}};a.Point=void 0,(r=>{r.ZERO={x:0,y:0}})(a.Point||(a.Point={}));const Vn="";let jt;function Xr(r,t,e,i,n,s){return jt||(jt=Jr()),new jt(r,t,e,i,n,s)}function Jr(){$i();const r=new BMap.Point(0,0);return class extends BMap.OverlayV3{constructor(i,n=r,s=a.Point.ZERO,l,d=654,o=""){super();m(this,"container");m(this,"border");m(this,"inner");m(this,"map");m(this,"marker");this.content=i,this.position=n,this.offset=s;const h="baidu-info-box-container";this.container=document.createElement("div"),this.container.className=h,this.container.style.position="absolute";const u=g=>g.stopPropagation();this.container.onclick=u,this.container.ondblclick=u,this.container.oncontextmenu=u,this.container.onmousedown=u,this.container.onmousemove=u,this.container.onmousewheel=u,this.border=document.createElement("div"),this.border.className=`${h}__border ${o}`,this.inner=document.createElement("div"),this.inner.className=h+"__inner";const p=document.createElement("span");p.className=h+"__close",p.addEventListener("click",()=>{this.close(),this.dispatchEvent({type:"onclickclose"})}),this.inner.appendChild(i),this.border.appendChild(this.inner),this.border.appendChild(p),this.container.appendChild(this.border),l&&this.setZIndex(l),this.setMaxWidth(d),this.onMarkerPositionChanged=this.onMarkerPositionChanged.bind(this)}initialize(i){return this.map=i,i.getPanes().floatPane.appendChild(this.container),this.container}draw(){if(!this.map)return;const i=this.marker?this.marker.getPosition():this.position,n=this.map.pointToOverlayPixel(i),s=n.x+this.offset.x,l=n.y+this.offset.y;this.container.style.left=`${s}px`,this.container.style.top=`${l}px`}open(i,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()||i.addOverlay(this))}attachMarker(i){i.__info_box__=this,i.addEventListener("dragging",this.onMarkerPositionChanged),i.addEventListener("dragend",this.onMarkerPositionChanged)}detachMarker(i){i.__info_box__=void 0,i.removeEventListener("dragging",this.onMarkerPositionChanged),i.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(i){this.container.style.zIndex=`${i}`}setMaxWidth(i){this.border.style.maxWidth=`${i}px`}setPosition(i){this.marker||(this.position=i,this.draw())}getPosition(){return this.position}setOffset(i){this.offset=i,this.draw()}getOffset(){return this.offset}}}class ht{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 ct extends ht{constructor(t,e,i){super(new he(t,e)),this.inner=t,this.map=e,this.state=i}static create(t){const e=t.position||w.ZERO,i=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 ct(i,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||w.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&&w.fromBaidu(t,this.map.coordType)||this.state.position||w.ZERO}setPosition(t){this.state.position=t,this.inner.isOpen()&&this.open()}}class dt extends ht{constructor(e,i){super(new ne(e,i));m(this,"eventHub",new ni);m(this,"isOpened",!1);this.inner=e,this.map=i,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 i=e.position||w.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:i.toGoogle(this.coordType),disableAutoPan:e.disableAutoPan});return new dt(n,this)}isOpen(){return this.isOpened}addEventListener(e,i){if(e==="open"||e==="close"){this.eventHub.addEventListener(e,i);return}super.addEventListener(e,i)}removeEventListener(e,i){if(e==="open"||e==="close"){this.eventHub.removeEventListener(e,i);return}super.removeEventListener(e,i)}open(e){if(!this.isOpened){if(this.map.mapOptions.infoWindowMode==="single"){const i=this.map.getLatestInfoWindow();i&&i.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 w.fromGoogle(this.inner.getPosition()??ie.LATLNG_ZERO,this.map.coordType)}setPosition(e){this.inner.setPosition(e.toGoogle(this.map.coordType))}}class ut extends we{constructor(t,e,i){super(t,e,i),this.baiduMap=i}static create(t){var n;const e=this.coordType,i=Xr(t.content,(n=t.position)==null?void 0:n.toBaidu(e),t.offset,t.zIndex,t.maxWidth,t.borderClass);return new ut(i,e,this)}open(t){this.innerOverlay.open(this.baiduMap.innerMap,t==null?void 0:t.innerOverlay)}close(){this.innerOverlay.close()}getPosition(){return w.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 pt extends ht{constructor(t,e,i){super(new ne(t,i)),this.inner=t,this.coordType=e,this.map=i}static create(t){var s;const e=this.coordType,i=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&&i.addListener("domready",()=>{var d;const l=(d=t.content.parentElement)==null?void 0:d.parentElement;l&&l.className.includes("gm-style-iw-c")&&!l.className.includes(n)&&(l.className+=` ${n}`)}),new pt(i,e,this)}open(t){this.inner.open(this.map.innerMap,t==null?void 0:t.innerOverlay)}close(){this.inner.close()}getPosition(){return w.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(),i=this.inner.getAnchor();this.inner.close(),this.inner.setOptions({maxWidth:t}),this.inner.open(e,i)}else this.inner.setOptions({maxWidth:t})}setZIndex(t){this.inner.setZIndex(t)}}a.Strings=void 0,(r=>{function t(s,l){if(s!==void 0)return Object.values(l).includes(s)?s:void 0}r.toEnumOrNull=t;function e(s){return s.split(`
|
|
13
13
|
`).map(l=>l.trim()).join(`
|
|
14
14
|
`)}r.trimIndent=e;function i(s){return s.replace(/([^A-Z]?)([A-Z])/g,(l,d,o)=>d?`${d}-${o.toLowerCase()}`:o.toLowerCase())}r.pascal2kebab=i;function n(s){return/^-?\d+$/.test(s)}r.isInt=n})(a.Strings||(a.Strings={}));const Gi={basename(r,t){const e=r.endsWith("/")?r.slice(0,-1):r,i=e.lastIndexOf("/"),n=i>=0?e.substring(i+1):e;return t&&n.endsWith(t)?n.slice(0,-t.length):n}},jn="";var ue=(r=>(r.map="map",r.overlay="overlay",r.overlayMouseTarget="overlayMouseTarget",r.float="float",r))(ue||{});a.MapPanes=void 0,(r=>{function t(i,n){switch(i){case"float":return n.floatPane;case"overlayMouseTarget":return n.overlayMouseTarget;case"overlay":return n.overlayLayer;case"map":return n.mapPane;default:Ge(i)}}r.toGoogle=t;function e(i,n){switch(i){case"float":return n.floatPane;case"overlayMouseTarget":return n.markerMouseTarget;case"overlay":return n.markerPane;case"map":return n.mapPane;default:Ge(i)}}r.toBaidu=e})(a.MapPanes||(a.MapPanes={}));class Ni{constructor(t,e){m(this,"baidu");m(this,"google");m(this,"projection");m(this,"element",void 0);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;$i();class e extends BMap.OverlayV3{initialize(s){var o;const l=t.create(),d=s.getPanes();return(o=a.MapPanes.toBaidu(t.mapPane,d))==null||o.appendChild(l),l}draw(){t.draw()}}this.baidu=new e;const i=t.map.innerMap;this.projection={fromLatLngToOverlayPoint(n){return i.pointToOverlayPixel(n.toBaidu(t.map.coordType))},fromOverlayPointToLatLng(n){return w.fromBaidu(i.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()??I("onAdd回调中一定会有panes");a.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(i){return t.google.getProjection().fromLatLngToDivPixel(i.toGoogle(t.map.coordType))??a.Point.ZERO},fromOverlayPointToLatLng(i){return w.fromGoogle(t.google.getProjection().fromDivPixelToLatLng(new google.maps.Point(i.x,i.y))??ie.LATLNG_ZERO,t.map.coordType)}}}return this.google}}let Ft;function Qr(r,t,e,i,n){return Ft||(Ft=en()),new Ft(r,t,e,i,n)}function en(){return class extends google.maps.OverlayView{constructor(e,i,n,s=ue.overlayMouseTarget,l){super();m(this,"container");this.position=i,this.offset=n,this._mapPane=s,this.container=document.createElement("div"),this.container.className="label-container",this.container.style.position="absolute",l&&this.setZIndex(l),this.container.addEventListener("click",()=>{google.maps.event.trigger(this,"click")}),this.setElement(e)}setZIndex(e){this.container.style.zIndex=`${e}`}setElement(e){const i=this.container.firstChild;i!==e&&(i?this.container.replaceChild(i,e):this.container.appendChild(e))}onAdd(){const e=this.getPanes()??I("onAdd回调中一定能够获取panes");a.MapPanes.toGoogle(this._mapPane,e).appendChild(this.container)}draw(){var e,i;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+(((i=this.offset)==null?void 0:i.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;(r=>{function t(i){return typeof i=="string"?i:i.outerHTML}r.toString=t;function e(i){if(typeof i=="string"){const n=document.createElement("div");return n.innerHTML=i,n}return i}r.toElement=e})(pe||(pe={}));class Ut extends we{constructor(e,i,n,s){super(e,i,n);m(this,"icon");m(this,"iconAnchor");m(this,"content",void 0);m(this,"contentObserver");this.setContentInternal(s,!0)}static create(e){var l;const i=this.coordType,n=new BMap.Label(pe.toString(e.content),{position:(l=e.position)==null?void 0:l.toBaidu(i),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 Ut(n,i,this,e.content);return n.__label__=s,s}setContentInternal(e,i=!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})),i||this.innerOverlay.setContent(pe.toString(e)),this.content=e)}setZIndex(e){this.innerOverlay.setZIndex(e)}getPosition(){return w.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 i=0,n=0;return this.iconAnchor&&(i=this.iconAnchor.width,n=this.iconAnchor.height),{x:e.width-i,y:e.height-n}}setOffset(e){let i=0,n=0;this.iconAnchor&&(i=this.iconAnchor.width,n=this.iconAnchor.height),this.innerOverlay.setOffset(new BMap.Size(e.x+i,e.y+n))}setContent(e){this.setContentInternal(e)}attachIcon(e){var d;let i;if(e instanceof BMap.Icon)i=e.anchor;else if(e)if(e.anchor)i=e.anchor;else{const o=((d=e.__icon__)==null?void 0:d.baiduLabelOffset)??{x:0,y:0};i={width:e.style.anchor.width+o.x,height:e.style.anchor.height+o.y},process.env.NODE_ENV!=="production"&&setTimeout(()=>{var p,g;if(re(e.__icon__,`${e}必须是由'SymbolIcon.toBaidu()'创建的`),!e.anchor){console.log("BaiduLabelOverlay.attachIcon","Bmap.Symbol.anchor尚未计算完成");return}const h=e.anchor.width-e.style.anchor.width,u=e.anchor.height-e.style.anchor.height;if(o.x!==h||o.y!==u){const _=[(p=e.__icon__.anchor)==null?void 0:p.x,(g=e.__icon__.anchor)==null?void 0:g.y,e.__icon__.rotation,e.__icon__.scale,e.__icon__.strokeWeight].map(T=>T??"").join(",");console.warn("BaiduLabelOverlay.attachIcon",e.__icon__,a.Strings.trimIndent(`
|
|
15
15
|
为了保证Label的位置正确, 请将SymbolIcon(${_})中baiduLabelOffset的值改写成:
|