zh-mapbox 0.0.49 → 0.0.53

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/README.md CHANGED
@@ -46,7 +46,7 @@ RegisterMapBoxModel(THREE,GLTFLoader)
46
46
  | **MapLine** | - | (实例)地图绘制线 |
47
47
  | **MapCustom** | - | (实例)地图其他绘制(默认symbol) |
48
48
  | **MapCircle** | - | (实例)地图绘制圆 |
49
- | **MapEvent**-(0.0.24) | layerName:图层名称 | (实例) 自定义事件 |
49
+ | **MapEvent**-(0.0.24) | layerName?:图层名称 | (实例) 自定义事件 |
50
50
  | **MapMarker**(options)-(0.0.24) | options:marker参数 | (实例)绘制marker |
51
51
  | **MapMoreCustom**-(0.0.24) | - | (实例)多图层方法 |
52
52
  | **fitBoundsGeoJson**<br />(geojson:any,<br />options:Camera.options) | geojson<br />options:相机相关参数 | 聚焦到geojson |
@@ -97,6 +97,7 @@ options:{
97
97
  popupClose=false,//关闭时是否调用组件内popupClose()方法,vue组件
98
98
  closeOther=true,//弹窗打开时关闭其他弹窗
99
99
  noCloseLayerName:string[],//不关闭的弹窗名称
100
+ closeClick//点击关闭按钮执行的方法
100
101
  }
101
102
  ```
102
103
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("zMapUtil",[],t):"object"==typeof exports?exports.zMapUtil=t():e.zMapUtil=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(null==e)return{};for(var r,o={},n=Object.keys(e),i=0;i<n.length;i++)r=n[i],0<=t.indexOf(r)||(o[r]=e[r]);return o}function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}e.r(t),e.d(t,{MapLayer:()=>O,RegisterMapBoxMethod:()=>function(e,t){if(e&&e.Map){z=e,-1===(window.mapboxgl=z).Map.prototype._setupPainter.toString().indexOf("webgl2")&&(a=z.Map.prototype._setupPainter,z.Map.prototype._setupPainter=function(){var e=this._canvas.getContext;this._canvas.getContext=function(t,r){return e.apply(this,["webgl2",r])||e.apply(this,["webgl",r])||e.apply(this,["experimental-webgl",r])},a.apply(this),this._canvas.getContext=e});var a,s,l=e.Map,u=function(e,t){var a=[];t&&Array.isArray(t)&&0<t.length&&t.every((function(e){return"string"==typeof e}))&&(a=t);var s=e.prototype.setStyle,l={layers:[],sources:[]},u={};return{getAllLayerAndSource:function(e,t){void 0===e&&(e=a),void 0===t&&(t=!0);for(var r,o=this.getStyle(),i=o.layers,s=o.sources,l={layers:[],sources:[]},u=0;u<i.length;)"background"===i[u].type||e.includes(i[u].source)||(r=i[u].id,this.getLayer(r)&&(l.layers.push(n(i[u])),t||this.removeLayer(r))),u++;var c,p=[];for(c in s)p.push(c);for(var h=0;h<p.length;){var f=p[h];e.includes(f)||this.isSourceLoaded(f)&&(l.sources.push({name:f,source:n(s[f])}),t||this.removeSource(f)),h++}return l},removeAllLayerAndSource:function(e){return void 0===e&&(e=a),this.getAllLayerAndSource(e,!1)},removeEvents:function(e){var t=this;void 0===e&&(e=["click","mousemove","mouseout"]),Array.isArray(e)&&e.forEach((function(e){e in t._listeners&&(t._listeners[e]=[])}))},removePopup:function(e){e&&"string"==typeof e?["tooltip","popup"].includes(e)&&this._popups.forEach((function(t){t.options.type===e&&t.remove()})):this._popups.forEach((function(e){e.remove()}))},findCustomLayer:function(e,t){void 0===t&&(t=a);for(var r=this.getStyle().layers,o=[],n=0;n<r.length;)"background"===r[n].type||t.includes(r[n].source)||o.push(r[n]),n++;if(e){if("string"==typeof e)return o.filter((function(t){return t.type===e}));if(Array.isArray(e)&&0<e.length)return o.filter((function(t){return e.includes(t.type)}))}return o},MapTooltip:function(e,t){return new p(this,e,t)},MapPopup:function(e,t){return new f(this,e,t)},addLayer:function(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this.fire("layerdata",o({},e,{add:!0})),this._update(!0)},removeLayer:function(e){var t=this.style.getLayer(e);return this.style.removeLayer(e),this.fire("layerdata",o({},t,{add:!1})),this._update(!0)},MapLine:function(){return new d(this)},MapCustom:function(){return new m(this)},fitBoundsGeoJson:function(e,t){e&&(e=[[(e=k(e)).bbox[0],e.bbox[1]],[e.bbox[2],e.bbox[3]]],this.fitBoundsPosition(e,t))},fitBoundsPosition:function(e,t){var n,i,a,s;Array.isArray(e)&&0!==(null==e?void 0:e.length)&&(n=void 0===(n=(t=null!=t?t:{}).padding)?40:n,i=void 0===(i=t.animate)||i,a=void 0===(a=t.maxZoom)?15:a,s=void 0===(s=t.essential)||s,t=r(t,B),this.fitBounds(e,o({linear:!1,padding:n,animate:i,essential:s,maxZoom:a},t)))},getInvertMask:function(e,t){var r;if(i(e)&&0!==(e=null!=(e=e.features[0].geometry.coordinates)?e:[]).length)return r=[],e.forEach((function(e){r.push(e[0])})),t=(e=null!=t?t:{}).id,e=void 0===(e=e.layerConfig)?{paint:{"fill-color":"rgba(0,0,0,0.8)"},layout:{visibility:"visible"}}:e,o({id:void 0===t?"mask":t,type:"fill",source:{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(r)}}}},e)},loadImages:function(e){var t=this;return new Promise((function(o){var n={};if(e&&0!==Object.keys(e).length)for(var i in e){var a,s,l=e[i];"string"==typeof l?t.loadImage(l,u(i)):"object"==typeof l&&(l.url?(a=l.url,s=r(l,G),t.loadImage(a,u(i,s))):l.layer&&l.layer.render&&"function"==typeof l.layer.render&&u(i,l.config||{})(null,l.layer))}else o(n);function u(t,r){return function(i,a){n[t]={data:r,url:i?null:a},Object.keys(n).length===Object.keys(e).length&&o(n)}}}))},loadAddImages:function(e){var t=this;return new Promise((function(r){t.loadImages(e).then((function(e){for(var n in e){var i=e[n],a=o({},null==i?void 0:i.data,{type:"custom"});t.hasImage(n)||t.addImage(n,i.url,a)}r()}))}))},MapCircle:function(){return new T(this)},MapEvent:function(e){return new _(this,e)},MapMoreCustom:function(){return new I(this)},removeLayerSource:function(e){function t(e){r.getSource(e)&&(r.removeLayer(e),r.removeSource(e))}var r=this,o=e.name,n=null!=(n=e.sources)?n:[];e=null!=(e=e.layers)?e:[],Array.isArray(o)&&0<o.length?o.forEach((function(e){t(e)})):"string"==typeof o&&t(o),0<(null==n?void 0:n.length)&&0<(null==e?void 0:e.length)&&(e.forEach((function(e){r.getLayer(e)&&r.removeLayer(e)})),n.forEach((function(e){r.getSource(e)&&r.removeSource(e)})))},removeLayerEvent:function(e){if("object"==typeof e)for(var t in e)e[t]&&e[t].destroy&&"function"==typeof e[t].destroy&&(e[t].destroy(),e[t]=null)},MapMarker:function(e){return new H(this,e)},findCustomIcon:function(){var e,t=this.style.imageManager.images,r={};for(e in t)"custom"===t[e].type&&(r[e]=t[e]);return r},setStyle:function(e,t,r){var o=this,n=(null!=t&&t.save&&(n=void 0===(n=(null!=t?t:{}).source)?[]:n,u=this.findCustomIcon(),n=Array.isArray(n)&&0!==n.length?new Set([].concat(n,["composite","mapbox://mapbox.satellite"])):["composite","mapbox://mapbox.satellite"],l=this.getAllLayerAndSource(n)),s.call(this,e,t));return null!=t&&t.save&&this.once("style.load",(function(t){var n,i=[];for(n in u)i.push(n),o.style.imageManager.images[n]=u[n];l.sources.forEach((function(e){o.getSource(e.name)||o.addSource(e.name,e.source)})),l.layers.forEach((function(e){o.getLayer(e.id)||o.addLayer(e)})),r&&"function"==typeof r&&r({style:e,images:i,layerSource:l})})),n}}}(l,t);for(s in new Event("layerdata"),u)l.prototype[s]=u[s];var c,h=z.Style,y=function(e){var t=e.prototype.addImage,r=e.prototype.updateImage,o=e.prototype._loadSprite,n=e.prototype.queryRenderedFeatures,i=e.prototype.addLayer,a=e.prototype.removeLayer,s={};return{addImage:function(e,r){return r.type="custom",t.call(this,e,r),this},updateImage:function(e,t){t.type="custom",r.call(this,e,t)},_loadSprite:function(e,t){var r,n=this;void 0===t&&(t=!1),o.call(this,e),t&&(r=this._availableImages.length,this.map.on("data",(function e(t){var o=n._availableImages.length;if("style"===t.dataType&&o!==r&&r<o){for(var i=n._availableImages.slice(r),a=0;a<i.length;a++)n.imageManager.images[i[a]].type="custom";n.map.off("data",e)}})))},loadSprite:function(e){this._loadSprite(e,!0)},addLayer:function(e,t){var r=e.interactive;s[e.id]=void 0===r||r,i.call(this,e,t)},removeLayer:function(e){s[e]&&delete s[e],a.call(this,e)},queryRenderedFeatures:function(e,t,r){var o=n.call(this,e,t,r);if(0<o.length)for(var i=0;i<o.length;i++){var a=s[o[i].layer.id];o[i].layer.interactive=null==a||a}return o.filter((function(e){return e.layer.interactive}))}}}(h);for(c in y)h.prototype[c]=y[c]}},RegisterMapBoxModel:()=>function(e,t){if(z&&e&&t){(D=e).GLTFLoader=t,window.THREE=D;var r,o=z.Map,n={initGLTF:function(e,t,r){return new y(e,t,r)}};for(r in n)o.prototype[r]=n[r]}},getSymbolRipple:()=>function(e){var t,r=void 0===(t=(e=null!=e?e:{}).size)?30:t,o=void 0===(t=e.duration)?1e3:t,n=void 0===(t=e.color)?"#f00":t,i=e.custom,a=l(n,!0),s=!1;return i&&"function"==typeof i&&(s=!0),{width:r,height:r,data:new Uint8Array(r*r*4),onAdd:function(e){this.map=e,(e=document.createElement("canvas")).width=this.width,e.height=this.height,this.context=e.getContext("2d")},render:function(){var e,t,l,u=this.context;return s?u=i({width:this.width,height:this.height,duration:o,color:n,context:u}):(e=performance.now()%o/o,t=r/2*.2,l=r/2*e,u.clearRect(0,0,this.width,this.height),u.beginPath(),u.arc(this.width/2,this.height/2,l,0,2*Math.PI),u.strokeStyle="rgba("+a[0]+","+a[1]+","+a[2]+","+(1-e+.1)+")",u.lineWidth=2,u.stroke(),u.fillStyle="rgba("+a[0]+","+a[1]+","+a[2]+","+(1-e)+")",u.fill(),u.beginPath(),u.arc(this.width/2,this.height/2,t,0,2*Math.PI),u.fillStyle="rgba("+a[0]+","+a[1]+","+a[2]+","+(1-e)+")",u.lineWidth=2+4*(1-e),u.fill()),this.data=u.getImageData(0,0,this.width,this.height).data,this.map.triggerRepaint(),!0}}},hexToRgba:()=>l,isGeoJSON:()=>i,isNumber:()=>u,judgeSizeLngLat:()=>s,object2Geojson:()=>function(e,t,r){var o=n(e);if(!Array.isArray(o))return null;if(!t||Array.isArray(t)&&2!==t.length)return null;for(var i=Array.isArray(t),a=(e={type:"FeatureCollection"},[]),s=0;s<o.length;s++){var l=i?[o[s][t[0]],o[s][t[1]]]:o[s][t];if(l){i||"string"!=typeof o[s][t]||(l=JSON.parse(o[s][t]));var c={type:"Feature"};if(c.properties=o[s],"object"==typeof l&&l.type)c.geometry=l;else{if(!Array.isArray(l))continue;var p,h="Point",f=(u(l[0])?h="Point":u(l[0][0])?h="LineString":u(l[0][0][0])?(f=(p=l[0])[0],p=p[p.length-1],h=f[0]===p[0]&&f[1]===p[1]?"Polygon":"MultiLineString"):u(l[0][0][0][0])&&(h="MultiPolygon"),r&&r.key&&"string"==typeof r.key&&(r.alias&&"string"==typeof r.alias?c[r.alias]=o[s][r.key]:c[r.key]=o[s][r.key]),{type:h});f.coordinates=l,c.geometry=f}a.push(c)}}return e.features=a,e},resversalGeojson:()=>function(e,t){if(void 0===t&&(t=!0),i(e)){for(var r={type:"FeatureCollection",features:[]},n=e.features,l=0;l<n.length;l++){var u,c=n[l],p={};for(u in c)"geometry"!==u&&"properties"!==u&&"type"!==u&&(p[u]=c[u]);var h=c.geometry.coordinates,f=c.geometry.type,y={type:f,coordinates:null};y.coordinates=("Point"===f?s:a)(h,t),r.features.push(o({type:"Feature",geometry:y,properties:c.properties},p))}return r}return null},reversalLngLat:()=>a});var n=function e(t){var r,o,n="object"!=(n=typeof(r=t))?n:Object.prototype.toString.call(r).replace(/^\[object (\S+)\]$/,"$1");if("Array"===n)o=[];else{if("Object"!==n)return t;o={}}if("Array"===n)for(var i=0,a=t.length;i<a;i++)o.push(e(t[i]));else if("Object"===n)for(var s in t)o[s]=e(t[s]);return o};function i(e){return"object"==typeof e&&null!==e&&!("FeatureCollection"===e.type&&!Array.isArray(e.features))}function a(e,t){return void 0===t&&(t=!0),e&&("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e))?u(e[0])?s(e,t):function e(t){for(var r=[],o=0;o<t.length;o++){var n=t[o];u(n[0])?r.push(s(n)):r.push(e(n))}return r}(e):[]}function s(e,t){return(t=void 0===t||t)&&e[0]<e[1]?[e[1],e[0]]:e}function l(e,t){void 0===t&&(t=!1);var r,o,n=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,r,o){return t+t+r+r+o+o}));return(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n))?(r=parseInt(n[1],16),o=parseInt(n[2],16),n=parseInt(n[3],16),t?[r,o,n,1]:"rgba("+r+","+o+","+n+",1)"):e}function u(e){return"number"==typeof e||!("string"!=typeof e||!e||e.includes(" ")||isNaN(Number(e)))}var c=["customName"],p=function(){function e(e,t,n){var i=this;this._mouseEnter=function(e){var t,r,o;"Map"===e.originalEvent.target.ariaLabel&&(r=e.point,e=e.lngLat,t=(r=null!=(r=i.map.queryRenderedFeatures(r)[0])?r:{}).properties,o=r.geometry,r.source,r=r.layer,i.layerName.includes(r.id)?(r=o.coordinates,o=[e.lng,e.lat],0<(null==(e=o="mouseenter"===i.mouseType?0<r.length&&Array.isArray(r[0])?r[0]:r:o)?void 0:e.length)&&i.popup.setLngLat(o).setHTML(i.htmlCallBack(t)).addTo(i.map)):null!=(r=i.popup)&&r.remove())},this._mouseLeave=function(){i.popup.remove()},this.map=e,"string"==typeof t?this.layerName=[t]:Array.isArray(t)&&(this.layerName=t),t=void 0!==(t=(e=null!=n?n:{}).customName)&&t,e=r(e,c),t=t?"":"commonTooltip ",null!=n&&n.className&&(t+=n.className),this.popup=new mapboxgl.Popup(o({},e,{className:t,closeButton:null!=(e=null==n?void 0:n.closeButton)&&e,closeOnClick:null!=(t=null==n?void 0:n.closeOnClick)&&t,anchor:null!=(e=null==n?void 0:n.anchor)?e:"left",type:"tooltip"}))}var t=e.prototype;return t.show=function(e,t){var r=this;"function"==typeof(this.htmlCallBack=e)&&(this.mouseType="mouseenter","move"===t&&(this.mouseType="mousemove"),0<(null==(e=this.layerName)?void 0:e.length))&&this.layerName.forEach((function(e){r.map.on(r.mouseType,e,r._mouseEnter).on("mouseleave",e,r._mouseLeave)}))},t.destroy=function(){var e,t=this;null!=(e=this.popup)&&e.remove(),null!=(e=this.layerName)&&e.forEach((function(e){t.map.off(t.mouseType,e,t._mouseEnter).off("mouseleave",e,t._mouseLeave)}))},e}(),h=["destroyComponent","customClick","popupClose","closeOther","noCloseLayerName","customName","offset"],f=function(){function e(e,t,n){var i=this,a=(this._closeOtherPopup=function(){var e;i.closeOther&&null!=(e=i.map)&&null!=(e=e._popups)&&e.forEach((function(e){var t;"popup"===e.options.type&&(Array.isArray(i.noCloseLayerName)&&0<i.noCloseLayerName.length?(t=e.options.sourceName.join("|"),new RegExp(t).test(i.noCloseLayerName)&&null!=e&&null!=(t=e._onClose)&&t.call(e)):null!=e&&null!=(t=e._onClose)&&t.call(e))}))},this._click=function(e){var t,r,o,n,a,s,l;"Map"===e.originalEvent.target.ariaLabel&&(i._closeOtherPopup(),t=e.point,e=e.lngLat,r=(n=null!=(n=(s=i.map.queryRenderedFeatures(t))[0])?n:{}).properties,o=n.geometry,n.source,n=n.layer,i.layerName.includes(n.id))&&(i.customClick||(n=o.coordinates,l=o.type,a=(s=null!=(s=i.componentCallBack({properties:r,lngLat:e,coordinates:n,feature:s[0]}))?s:{}).component,s=s.instance,l="Point"===l?n:e,i.vueInstance=s,a&&(i.popup.setOffset(i.offset),i.popup.setLngLat(l).setDOMContent(a).addTo(i.map))),"function"==typeof i.callBack)&&i.callBack({lngLat:e,properties:r,geometry:o,point:t})},this.map=e,this.popup=null,"string"==typeof t?this.layerName=[t]:Array.isArray(t)&&(this.layerName=t),void 0!==(t=(e=n||{}).destroyComponent)&&t),s=(t=void 0!==(t=e.customClick)&&t,void 0!==(s=e.popupClose)&&s),l=void 0===(l=e.closeOther)||l,u=void 0===(u=e.noCloseLayerName)?[]:u,c=void 0!==(c=e.customName)&&c,p=void 0===(p=e.offset)?[0,0]:p;e=r(e,h),c=c?"":"commonPopup ",null!=n&&n.className&&(c+=n.className),this.noCloseLayerName=u,this.noCloseLayerName=[],this.customClick=t,this.popupCloseSign=s,this.closeOther=l,this.offset=p="number"==typeof p?[p,p]:p,this.vueInstance=null,this.closeCallback=null,this.customClick||(this.popup=new mapboxgl.Popup(o({},e,{offset:p,className:c,closeButton:null!=(n=null==e?void 0:e.closeButton)&&n,closeOnClick:null!=(u=null==e?void 0:e.closeOnClick)&&u,anchor:null!=(t=null==e?void 0:e.anchor)?t:"bottom",focusAfterOpen:null!=(s=null==e?void 0:e.focusAfterOpen)&&s,type:"popup",sourceName:this.layerName})),null!=(l=this.popup)&&l.on("close",(function(e){"function"==typeof i.closeCallback&&i.closeCallback(e),i.popupCloseSign&&null!=(e=i.vueInstance)&&e.popupClose&&"function"==typeof i.vueInstance.popupClose&&i.vueInstance.popupClose(),i.vueInstance&&a&&null!=(e=i.vueInstance)&&e.$destroy()})))}var t=e.prototype;return t.show=function(e,t){var r=this;this.componentCallBack=e,this.callBack=t,0<(null==(e=this.layerName)?void 0:e.length)&&this.layerName.forEach((function(e){r.map.on("click",e,r._click)}))},t.showPosition=function(e,t,r,o){e&&(this._closeOtherPopup(),(r=(null!=r?r:{}).offset)&&this.popup.setOffset(r),this.popup.setLngLat(e).setDOMContent(t).addTo(this.map),o)&&"function"==typeof o&&o()},t.close=function(){var e;null!=(e=this.popup)&&e._onClose()},t.closeBack=function(e){this.closeCallback=e},t.destroy=function(){var e,t=this;null!=(e=this.popup)&&e.remove(),null!=(e=this.layerName)&&e.forEach((function(e){t.map.off("click",e,t._click)}))},e}(),y=function(){function e(e,t,r){var o=this,n=(this.clickEvent=function(e){var t=new THREE.Vector2,r=o.map.getCanvas();t.x=(e.clientX-r.getBoundingClientRect().left)/r.offsetWidth*2-1,t.y=-(e.clientY-r.getBoundingClientRect().top)/r.offsetHeight*2+1,e=(new THREE.Matrix4).getInverse(o.camera.projectionMatrix),r=(new THREE.Vector3).applyMatrix4(e),t=new THREE.Vector3(t.x,t.y,1).applyMatrix4(e).clone().sub(r).normalize(),(e=new THREE.Raycaster).set(r,t),r=e.intersectObjects(o.scene.children,!0),o.callback&&0<r.length&&(t=r[0],e=o.findProperties(t.object),o.callback(e))},this.findProperties=function(e){var t={},r=null;return"Scene"!==e.type&&(r=(e.lngLat?(t=e.properties,e):(t=(e=o.findProperties(e.parent)).properties,e)).lngLat),{properties:t,lngLat:r}},this.id="3d-"+e,this.type="custom",this.renderingMode="3d","function"==typeof r&&(this.callback=r),e=t.lngLat,r=t.url,void 0===(n=t.scale)?1:n),i=void 0===(i=t.height)?0:i,a=void 0===(a=t.rotate)?[Math.PI/2,0,0]:a,s=void 0===(s=t.properties)?{}:s,l=void 0===(l=t.AmbientLight)?{show:!0,color:16777215,intensity:.5}:l,u=void 0===(u=t.DirectionalLight)?[]:u,c=void 0===(c=t.PointLight)?[]:c;t=void 0!==(t=t.click)&&t,this.lngLat=e,this.url=r,this.scale=n,this.height=i,this.rotate=a,this.properties=s,this.AmbientLight=l,this.DirectionalLight=u,this.PointLight=c,this.click=t,this.modelAsMercatorCoordinate=mapboxgl.MercatorCoordinate.fromLngLat(e,i),this.modelTransform={translateX:this.modelAsMercatorCoordinate.x,translateY:this.modelAsMercatorCoordinate.y,translateZ:this.modelAsMercatorCoordinate.z,rotateX:a[0],rotateY:a[1],rotateZ:a[2],scale:n*this.modelAsMercatorCoordinate.meterInMercatorCoordinateUnits()}}var t=e.prototype;return t.onAdd=function(e,t){var r,o,n=this;this.map=e,e=this.map.getCanvas(),this.camera=new THREE.PerspectiveCamera(50,e.innerWidth/e.innerHeight,.1,1e4),this.scene=new THREE.Scene,this.AmbientLight&&this.AmbientLight.show&&(o=this.AmbientLight.color||16777215,r=this.AmbientLight.intensity||.5,o=new THREE.AmbientLight(o,r),this.scene.add(o)),this.DirectionalLight&&Array.isArray(this.DirectionalLight)&&this.DirectionalLight.forEach((function(e){var t=e.color||16777215,r=e.intensity||1;e=e.position||[0,0,0],(t=new THREE.DirectionalLight(t,r)).position.set(e[0],e[1],e[2]).normalize(),n.scene.add(t)})),this.PointLight&&Array.isArray(this.PointLight)&&this.PointLight.forEach((function(e){var t=e.color||16777215,r=e.intensity||1,o=e.distance||0,i=e.decay||2;e=e.position||[0,0,0],(t=new THREE.PointLight(t,r,o,i)).position.set(e[0],e[1],e[2]).normalize(),n.scene.add(t)})),(new THREE.GLTFLoader).load(this.url,(function(e){for(var t=0;t<e.scene.children.length;t++)e.scene.children[t].properties=n.properties,e.scene.children[t].lngLat=n.lngLat;n.scene.add(e.scene)})),this.renderer=new THREE.WebGLRenderer({canvas:e,context:t,antialias:!0}),this.renderer.autoClear=!1,this.click&&this.renderer.domElement.addEventListener("click",this.clickEvent)},t.render=function(e,t){var r=(new THREE.Matrix4).makeRotationAxis(new THREE.Vector3(1,0,0),this.modelTransform.rotateX),o=(new THREE.Matrix4).makeRotationAxis(new THREE.Vector3(0,1,0),this.modelTransform.rotateY),n=(new THREE.Matrix4).makeRotationAxis(new THREE.Vector3(0,0,1),this.modelTransform.rotateZ),i=(new THREE.Matrix4).fromArray(t);r=(new THREE.Matrix4).makeTranslation(this.modelTransform.translateX,this.modelTransform.translateY,this.modelTransform.translateZ).scale(new THREE.Vector3(this.modelTransform.scale,-this.modelTransform.scale,this.modelTransform.scale)).multiply(r).multiply(o).multiply(n),this.camera.projectionMatrix.elements=t,this.camera.projectionMatrix=i.multiply(r),this.renderer.state.reset(),this.renderer.render(this.scene,this.camera),this.map.triggerRepaint()},t.onRemove=function(){this.click&&this.renderer.domElement.removeEventListener("click",this.clickEvent),this.renderer&&(this.renderer.dispose(),this.renderer=null),this.scene&&(this.scene.clear(),this.scene=null)},e}(),d=function(){function e(e){this.map=e,this.sourceName=[]}var t=e.prototype;return t.draw=function(e,t,r){if(e&&this.map&&("FeatureCollection"===e.type||Array.isArray(e.features)))return this.sourceName=[t],this._addSourceLayer(t,e,r),r.lineConfig?[].concat(this.sourceName,[this.lineName]):this.sourceName},t.destroy=function(){this._clearSource()},t._addSourceLayer=function(e,t,r){this.map.addSource(e,o({type:"geojson",data:t},r.sourceConfig)),t=r.beforeId||null,this.map.addLayer(o({id:e,type:"line",source:e},r.layerConfig),t),r.lineConfig&&(this.lineName=e+"-highlight",this.map.addLayer(o({id:this.lineName,type:"line",source:e},r.lineConfig)))},t._clearSource=function(){var e,t=this;null!=(e=this.sourceName)&&e.forEach((function(e){t.map.getSource(e)&&(t.map.removeLayer(e),t.lineName&&t.map.removeLayer(e+"-highlight"),t.map.removeSource(e))}))},e}(),m=function(){function e(e){this.map=e,this.sourceName=[],this.type="symbol"}var t=e.prototype;return t.draw=function(e,t,r){var o;if(e&&this.map&&("FeatureCollection"===e.type||Array.isArray(e.features))){this.type=null!=(o=r.type)?o:"symbol";var n=r.sliceNum;if(!n||n<1e3)this.sourceName=[t],this._clearSource(),this._addSourceLayer(t,e,r);else{this._clearSource();for(var i=0,a=0;a<e.features.length;a+=n){var s={type:"FeatureCollection",features:[]},l=e.features.slice(a,n);s.features=[].concat(l),l=t+"-"+i,this.sourceName.push(l),this._addSourceLayer(l,s,r),i++}}return this.sourceName}},t.destroy=function(){this._clearSource()},t._clearSource=function(){var e,t=this;null!=(e=this.sourceName)&&e.forEach((function(e){t.map.getSource(e)&&(t.map.removeLayer(e),t.map.removeSource(e))}))},t._addSourceLayer=function(e,t,r){this.map.addSource(e,o({type:"geojson",data:t},r.sourceConfig)),t=r.beforeId||null,this.map.addLayer(o({id:e,type:this.type,source:e},r.layerConfig),t)},e}(),g=6371008.8,v={centimeters:100*g,centimetres:100*g,degrees:g/111325,feet:3.28084*g,inches:39.37*g,kilometers:g/1e3,kilometres:g/1e3,meters:g,metres:g,miles:g/1609.344,millimeters:1e3*g,millimetres:1e3*g,nauticalmiles:g/1852,radians:1,yards:1.0936*g};function b(e,t,r){var o={type:"Feature"};return 0!==(r=void 0===r?{}:r).id&&!r.id||(o.id=r.id),r.bbox&&(o.bbox=r.bbox),o.properties=t||{},o.geometry=e,o}function L(e,t,r){void 0===r&&(r={});for(var o=0,n=e;o<n.length;o++){var i=n[o];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<i[i.length-1].length;a++)if(i[i.length-1][a]!==i[0][a])throw new Error("First and last Position are not equivalent.")}return b({type:"Polygon",coordinates:e},t,r)}function E(e,t){var r=v[t=void 0===t?"kilometers":t];if(r)return e/r;throw new Error(t+" units is invalid")}function w(e){return e%(2*Math.PI)*180/Math.PI}function A(e){return e%360*Math.PI/180}function C(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function S(e,t,r){if(null!==e)for(var o,n,i,a=0,s=e.type,l="FeatureCollection"===s,u="Feature"===s,c=l?e.features.length:1,p=0;p<c;p++)for(var h,f,y=(f=!!(h=l?e.features[p].geometry:u?e.geometry:e)&&"GeometryCollection"===h.type)?h.geometries.length:1,d=0;d<y;d++){var m=0,g=0,v=f?h.geometries[d]:h;if(null!==v){var b=v.coordinates,L=v.type,E=!r||"Polygon"!==L&&"MultiPolygon"!==L?0:1;switch(L){case null:break;case"Point":if(!1===t(b,a,p,m,g))return!1;a++,m++;break;case"LineString":case"MultiPoint":for(o=0;o<b.length;o++){if(!1===t(b[o],a,p,m,g))return!1;a++,"MultiPoint"===L&&m++}"LineString"===L&&m++;break;case"Polygon":case"MultiLineString":for(o=0;o<b.length;o++){for(n=0;n<b[o].length-E;n++){if(!1===t(b[o][n],a,p,m,g))return!1;a++}"MultiLineString"===L&&m++,"Polygon"===L&&g++}"Polygon"===L&&m++;break;case"MultiPolygon":for(o=0;o<b.length;o++){for(n=g=0;n<b[o].length;n++){for(i=0;i<b[o][n].length-E;i++){if(!1===t(b[o][n][i],a,p,m,g))return!1;a++}g++}m++}break;case"GeometryCollection":for(o=0;o<v.geometries.length;o++)if(!1===S(v.geometries[o],t,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}function M(e){var t=[1/0,1/0,-1/0,-1/0];return S(e,(function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])})),t}const N=M.default=M,k=function(e){e=N(e);var t=void 0,r=(void 0===t&&(t={}),Number(e[0])),o=Number(e[1]),n=Number(e[2]),i=Number(e[3]);if(6===e.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var a=[r,o];return L([[a,[n,o],[n,i],[r,i],a]],t.properties,{bbox:e,id:t.id})};function P(e,t,r,o){void 0===o&&(o={});var n=A((e=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&2<=e.length&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}(e))[0]),i=(e=A(e[1]),r=A(r),t=E(t,o.units),Math.asin(Math.sin(e)*Math.cos(t)+Math.cos(e)*Math.sin(t)*Math.cos(r)));return function(e,t,r){if(void 0===r&&(r={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(C(e[0])&&C(e[1]))return b({type:"Point",coordinates:e},t,r);throw new Error("coordinates must contain numbers")}([w(n+Math.atan2(Math.sin(r)*Math.sin(t)*Math.cos(e),Math.cos(t)-Math.sin(e)*Math.sin(i))),w(i)],o.properties)}const x=function(e,t,r){for(var o=(r=void 0===r?{}:r).steps||64,n=r.properties||(!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{}),i=[],a=0;a<o;a++)i.push(P(e,t,-360*a/o,r).geometry.coordinates);return i.push(i[0]),L([i],n)};var T=function(){function e(e){this.map=e,this.sourceName=[],this.lineName=""}var t=e.prototype;return t.draw=function(e,t,r){if(e){this.sourceName=[t];var o,n=null!=r?r:{},i=void 0===(o=n.radius)?0:o,a=void 0===(o=n.steps)?64:o,s=n.endRadius,l=[];if("object"==typeof e){if("FeatureCollection"!==e.type&&!Array.isArray(e.features))return;for(var u=e.features,c=0;c<u.length;c++){var p,h,f,y,d,m=u[c].geometry.coordinates;"number"==typeof m[0]&&"number"==typeof m[1]&&(m[0]<m[1]&&(p=[m[1],m[0]],m[0]=p[0],m[1]=p[1]),p=!1,h=0<(h=(p="string"==typeof i||p)?u[c].properties[i]:i)?h:0,f={steps:a,units:"kilometers",properties:u[c].properties},y=x(m,h,f),s?(d=!1,d=0<(d=(d="string"==typeof s||d)?u[c].properties[s]:s)?d:0,m=x(m,s,f),l.push(h===d?y:h<d?this._getRingJson(m.geometry.coordinates[0],y.geometry.coordinates[0],y.properties):this._getRingJson(y.geometry.coordinates[0],m.geometry.coordinates[0],y.properties))):l.push(y))}}return this._addSourceLayer(t,{type:"FeatureCollection",features:l},r),r.lineConfig?[].concat(this.sourceName,[this.lineName]):this.sourceName}},t._getRingJson=function(e,t,r){return{type:"Feature",geometry:{coordinates:[e,t],type:"Polygon"},properties:r}},t._addSourceLayer=function(e,t,r){this.map.addSource(e,o({type:"geojson",data:t},r.sourceConfig)),t=(null!=r?r:{}).beforeId,this.map.addLayer(o({id:e,type:"fill",source:e},r.layerConfig),t),r.lineConfig&&(this.lineName=e+"-line",this.map.addLayer(o({id:this.lineName,type:"line",source:e},r.lineConfig),t))},t.destroy=function(){this._clearSource()},t._clearSource=function(){var e,t=this;null!=(e=this.sourceName)&&e.forEach((function(e){t.map.getSource(e)&&(t.map.removeLayer(e),t.lineName&&t.map.removeLayer(e+"-line"),t.map.removeSource(e))}))},e}(),_=function(){function e(e,t){this.map=e,"string"==typeof t?this.name=[t]:Array.isArray(t)&&t.every((function(e){return"string"==typeof e}))&&(this.name=t),this.event=[]}var t=e.prototype;return t.add=function(e){var t,r=this;if(0===(null==(t=this.event)?void 0:t.length)&&e&&"object"==typeof e){var o,n=function(t){var o;r.event.push(t),null!=(o=r.name)&&o.forEach((function(o){function n(r){"Map"===r.originalEvent.target.ariaLabel&&e[t](r)}var i;r[t]=n,null!=(i=r.map)&&i.on(t,o,n)}))};for(o in e)n(o)}},t.destroy=function(e){var t,r=this;e&&Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))?null!=(t=this.name)&&t.forEach((function(t){e.forEach((function(e){var o,n;r.event.includes(e)&&(n=r[e],null!=(o=r.map))&&o.off(e,t,n)}))})):null!=(t=this.name)&&t.forEach((function(e){r.event.forEach((function(t){var o,n=r[t];null!=(o=r.map)&&o.off(t,e,n)}))}))},e}(),j=["id","type"],R=["id","type","beforeId"],I=function(){function e(e){this.map=e,this.sourceName=[]}var t=e.prototype;return t.draw=function(e,t){var n,a,s,l,u=this;return i(e)?(n=(a=null!=(a=t.sourceConfig)?a:{}).id,l=void 0===(l=a.type)?"geojson":l,a=r(a,j),s=n,this.map.addSource(n,o({type:l,data:e},a)),l=null!=(n=t.layerConfig)?n:{},e=[],Array.isArray(l)?e=l:"object"==typeof l&&e.push(l),e.forEach((function(e){var t=e.id,n=e.type,i=e.beforeId;e=r(e,R),u.map.addLayer(o({id:t,type:n,source:s},e),i)})),this.sourceName=[s].concat(e.map((function(e){return e.id}))).filter(Boolean),this.sourceName=Array.from(new Set(this.sourceName)),this.sourceName):[]},t.destroy=function(){var e,t,r=this;0<(null==(t=this.sourceName)?void 0:t.length)&&(1===this.sourceName.length?this.map.getSource(this.sourceName[0])&&(this.map.removeLayer(this.sourceName[0]),this.map.removeSource(this.sourceName[0])):(e=(t=this.sourceName)[0],t=t.slice(1),this.map.getSource(e)&&(t.forEach((function(e){r.map.removeLayer(e)})),this.map.removeSource(e))))},e}(),O=function(){function e(t,r,n){if((this instanceof e?this.constructor:void 0)!==e)throw new Error("MapLayer is a constructor and should be called with the new keyword");var i={layer:null,tooltip:null,popup:null};return r&&"object"==typeof r&&(i=o({},i,r)),this.name=t,this.layers=i,this.prop=null!=n?n:{},new Proxy(this,{deleteProperty:function(e,t){return(e!==this||"layers"!==t&&"name"!==t)&&(delete e[t],!0)},set:function(e,t,r){return(e!==this||"layers"!==t&&"name"!==t)&&(e[t]=r,!0)}})}var t=e.prototype;return t.addLayer=function(e){if(e&&"object"==typeof e)for(var t in e)this.layers[t]=e[t]},t.addProp=function(e){if(e&&"object"==typeof e)for(var t in e)this.prop[t]=e[t]},e}();function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var H=function(){function e(e,t){this.map=e,this.markers=[],this.options=t,this.properties=[]}var t=e.prototype;return t.draw=function(e,t){if(i(e))for(var r,n=null!=(r=this.options)?r:{},a=function(e,t){var r,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(o)return(o=o.call(e)).next.bind(o);if(Array.isArray(e)||(o=function(e,t){var r;if(e)return"string"==typeof e?F(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?F(e,t):void 0}(e)))return o&&(e=o),r=0,function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.features);!(u=a()).done;){var s,l,u=u.value;"Point"===u.geometry.type&&(s=n,t&&"function"==typeof t&&1===(null==(l=t({lngLat:u.geometry.coordinates,properties:u.properties}))?void 0:l.nodeType)&&(s=o({},s,{element:l})),l=new mapboxgl.Marker(s).setLngLat(u.geometry.coordinates).addTo(this.map),this.markers.push(l),this.properties.push(u.properties))}},t.addEvent=function(e){var t=this;if(e&&"object"==typeof e)for(var r=0;r<this.markers.length;r++)!function(r){["dragstart","drag","dragend"].forEach((function(n){e[n]&&"function"==typeof e[n]&&t.markers[r].on(n,(function(i){e[n](o({},i,{properties:t.properties[r]}))}))}))}(r)},t.destroy=function(){for(var e=0;e<this.markers.length;e++)this.markers[e].remove();this.markers=[]},e}(),B=["padding","animate","maxZoom","essential"],G=["url"],z=null,D=null;return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("zMapUtil",[],t):"object"==typeof exports?exports.zMapUtil=t():e.zMapUtil=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(null==e)return{};for(var r,o={},n=Object.keys(e),i=0;i<n.length;i++)r=n[i],0<=t.indexOf(r)||(o[r]=e[r]);return o}function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}e.r(t),e.d(t,{MapLayer:()=>O,RegisterMapBoxMethod:()=>function(e,t){if(e&&e.Map){D=e,-1===(window.mapboxgl=D).Map.prototype._setupPainter.toString().indexOf("webgl2")&&(a=D.Map.prototype._setupPainter,D.Map.prototype._setupPainter=function(){var e=this._canvas.getContext;this._canvas.getContext=function(t,r){return e.apply(this,["webgl2",r])||e.apply(this,["webgl",r])||e.apply(this,["experimental-webgl",r])},a.apply(this),this._canvas.getContext=e});var a,s,l=e.Map,u=function(e,t){var a=[];t&&Array.isArray(t)&&0<t.length&&t.every((function(e){return"string"==typeof e}))&&(a=t);var s=e.prototype.setStyle,l={layers:[],sources:[]},u={};return{getAllLayerAndSource:function(e,t){void 0===e&&(e=a),void 0===t&&(t=!0);for(var r,o=this.getStyle(),i=o.layers,s=o.sources,l={layers:[],sources:[]},u=0;u<i.length;)"background"===i[u].type||e.includes(i[u].source)||(r=i[u].id,this.getLayer(r)&&(l.layers.push(n(i[u])),t||this.removeLayer(r))),u++;var c,p=[];for(c in s)p.push(c);for(var h=0;h<p.length;){var f=p[h];e.includes(f)||this.isSourceLoaded(f)&&(l.sources.push({name:f,source:n(s[f])}),t||this.removeSource(f)),h++}return l},removeAllLayerAndSource:function(e){return void 0===e&&(e=a),this.getAllLayerAndSource(e,!1)},removeEvents:function(e){var t=this;void 0===e&&(e=["click","mousemove","mouseout"]),Array.isArray(e)&&e.forEach((function(e){e in t._listeners&&(t._listeners[e]=[])}))},removePopup:function(e){e&&"string"==typeof e?["tooltip","popup"].includes(e)&&this._popups.forEach((function(t){t.options.type===e&&t.remove()})):this._popups.forEach((function(e){e.remove()}))},findCustomLayer:function(e,t){void 0===t&&(t=a);for(var r=this.getStyle().layers,o=[],n=0;n<r.length;)"background"===r[n].type||t.includes(r[n].source)||o.push(r[n]),n++;if(e){if("string"==typeof e)return o.filter((function(t){return t.type===e}));if(Array.isArray(e)&&0<e.length)return o.filter((function(t){return e.includes(t.type)}))}return o},MapTooltip:function(e,t){return new p(this,e,t)},MapPopup:function(e,t){return new f(this,e,t)},addLayer:function(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this.fire("layerdata",o({},e,{add:!0})),this._update(!0)},removeLayer:function(e){var t=this.style.getLayer(e);return this.style.removeLayer(e),this.fire("layerdata",o({},t,{add:!1})),this._update(!0)},MapLine:function(){return new d(this)},MapCustom:function(){return new m(this)},fitBoundsGeoJson:function(e,t){e&&(e=[[(e=N(e)).bbox[0],e.bbox[1]],[e.bbox[2],e.bbox[3]]],this.fitBoundsPosition(e,t))},fitBoundsPosition:function(e,t){var n,i,a,s;Array.isArray(e)&&0!==(null==e?void 0:e.length)&&(n=void 0===(n=(t=null!=t?t:{}).padding)?40:n,i=void 0===(i=t.animate)||i,a=void 0===(a=t.maxZoom)?15:a,s=void 0===(s=t.essential)||s,t=r(t,H),this.fitBounds(e,o({linear:!1,padding:n,animate:i,essential:s,maxZoom:a},t)))},getInvertMask:function(e,t){var r;if(i(e)&&0!==(e=null!=(e=e.features[0].geometry.coordinates)?e:[]).length)return r=[],e.forEach((function(e){r.push(e[0])})),t=(e=null!=t?t:{}).id,e=void 0===(e=e.layerConfig)?{paint:{"fill-color":"rgba(0,0,0,0.8)"},layout:{visibility:"visible"}}:e,o({id:void 0===t?"mask":t,type:"fill",source:{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(r)}}}},e)},loadImages:function(e){var t=this;return new Promise((function(o){var n={};if(e&&0!==Object.keys(e).length)for(var i in e){var a,s,l=e[i];"string"==typeof l?t.loadImage(l,u(i)):"object"==typeof l&&(l.url?(a=l.url,s=r(l,G),t.loadImage(a,u(i,s))):l.layer&&l.layer.render&&"function"==typeof l.layer.render&&u(i,l.config||{})(null,l.layer))}else o(n);function u(t,r){return function(i,a){n[t]={data:r,url:i?null:a},Object.keys(n).length===Object.keys(e).length&&o(n)}}}))},loadAddImages:function(e){var t=this;return new Promise((function(r){t.loadImages(e).then((function(e){for(var n in e){var i=e[n],a=o({},null==i?void 0:i.data,{type:"custom"});t.hasImage(n)||t.addImage(n,i.url,a)}r()}))}))},MapCircle:function(){return new _(this)},MapEvent:function(e){return new T(this,e)},MapMoreCustom:function(){return new I(this)},removeLayerSource:function(e){function t(e){r.getSource(e)&&(r.removeLayer(e),r.removeSource(e))}var r=this,o=e.name,n=null!=(n=e.sources)?n:[];e=null!=(e=e.layers)?e:[],Array.isArray(o)&&0<o.length?o.forEach((function(e){t(e)})):"string"==typeof o&&t(o),0<(null==n?void 0:n.length)&&0<(null==e?void 0:e.length)&&(e.forEach((function(e){r.getLayer(e)&&r.removeLayer(e)})),n.forEach((function(e){r.getSource(e)&&r.removeSource(e)})))},removeLayerEvent:function(e){if("object"==typeof e)for(var t in e)e[t]&&e[t].destroy&&"function"==typeof e[t].destroy&&(e[t].destroy(),e[t]=null)},MapMarker:function(e){return new F(this,e)},findCustomIcon:function(){var e,t=this.style.imageManager.images,r={};for(e in t)"custom"===t[e].type&&(r[e]=t[e]);return r},setStyle:function(e,t,r){var o=this,n=(null!=t&&t.save&&(n=void 0===(n=(null!=t?t:{}).source)?[]:n,u=this.findCustomIcon(),n=Array.isArray(n)&&0!==n.length?new Set([].concat(n,["composite","mapbox://mapbox.satellite"])):["composite","mapbox://mapbox.satellite"],l=this.getAllLayerAndSource(n)),s.call(this,e,t));return null!=t&&t.save&&this.once("style.load",(function(t){var n,i=[];for(n in u)i.push(n),o.style.imageManager.images[n]=u[n];l.sources.forEach((function(e){o.getSource(e.name)||o.addSource(e.name,e.source)})),l.layers.forEach((function(e){o.getLayer(e.id)||o.addLayer(e)})),r&&"function"==typeof r&&r({style:e,images:i,layerSource:l})})),n}}}(l,t);for(s in new Event("layerdata"),u)l.prototype[s]=u[s];var c,h=D.Style,y=function(e){var t=e.prototype.addImage,r=e.prototype.updateImage,o=e.prototype._loadSprite,n=e.prototype.queryRenderedFeatures,i=e.prototype.addLayer,a=e.prototype.removeLayer,s={};return{addImage:function(e,r){return r.type="custom",t.call(this,e,r),this},updateImage:function(e,t){t.type="custom",r.call(this,e,t)},_loadSprite:function(e,t){var r,n=this;void 0===t&&(t=!1),o.call(this,e),t&&(r=this._availableImages.length,this.map.on("data",(function e(t){var o=n._availableImages.length;if("style"===t.dataType&&o!==r&&r<o){for(var i=n._availableImages.slice(r),a=0;a<i.length;a++)n.imageManager.images[i[a]].type="custom";n.map.off("data",e)}})))},loadSprite:function(e){this._loadSprite(e,!0)},addLayer:function(e,t){var r=e.interactive;s[e.id]=void 0===r||r,i.call(this,e,t)},removeLayer:function(e){s[e]&&delete s[e],a.call(this,e)},queryRenderedFeatures:function(e,t,r){var o=n.call(this,e,t,r);if(0<o.length)for(var i=0;i<o.length;i++){var a=s[o[i].layer.id];o[i].layer.interactive=null==a||a}return o.filter((function(e){return e.layer.interactive}))}}}(h);for(c in y)h.prototype[c]=y[c];var g=(e=D.Popup).prototype.setDOMContent;e.prototype._closeClick=function(){},e.prototype.setDOMContent=function(e){return e=g.call(this,e),this._closeButton&&this._closeButton.addEventListener("click",this._closeClick),e}}},RegisterMapBoxModel:()=>function(e,t){if(D&&e&&t){(z=e).GLTFLoader=t,window.THREE=z;var r,o=D.Map,n={initGLTF:function(e,t,r){return new y(e,t,r)}};for(r in n)o.prototype[r]=n[r]}},getSymbolRipple:()=>function(e){var t,r=void 0===(t=(e=null!=e?e:{}).size)?30:t,o=void 0===(t=e.duration)?1e3:t,n=void 0===(t=e.color)?"#f00":t,i=e.custom,a=l(n,!0),s=!1;return i&&"function"==typeof i&&(s=!0),{width:r,height:r,data:new Uint8Array(r*r*4),onAdd:function(e){this.map=e,(e=document.createElement("canvas")).width=this.width,e.height=this.height,this.context=e.getContext("2d")},render:function(){var e,t,l,u=this.context;return s?u=i({width:this.width,height:this.height,duration:o,color:n,context:u}):(e=performance.now()%o/o,t=r/2*.2,l=r/2*e,u.clearRect(0,0,this.width,this.height),u.beginPath(),u.arc(this.width/2,this.height/2,l,0,2*Math.PI),u.strokeStyle="rgba("+a[0]+","+a[1]+","+a[2]+","+(1-e+.1)+")",u.lineWidth=2,u.stroke(),u.fillStyle="rgba("+a[0]+","+a[1]+","+a[2]+","+(1-e)+")",u.fill(),u.beginPath(),u.arc(this.width/2,this.height/2,t,0,2*Math.PI),u.fillStyle="rgba("+a[0]+","+a[1]+","+a[2]+","+(1-e)+")",u.lineWidth=2+4*(1-e),u.fill()),this.data=u.getImageData(0,0,this.width,this.height).data,this.map.triggerRepaint(),!0}}},hexToRgba:()=>l,isGeoJSON:()=>i,isNumber:()=>u,judgeSizeLngLat:()=>s,object2Geojson:()=>function(e,t,r){var o=n(e);if(!Array.isArray(o))return null;if(!t||Array.isArray(t)&&2!==t.length)return null;for(var i=Array.isArray(t),a=(e={type:"FeatureCollection"},[]),s=0;s<o.length;s++){var l=i?[o[s][t[0]],o[s][t[1]]]:o[s][t];if(l){i||"string"!=typeof o[s][t]||(l=JSON.parse(o[s][t]));var c={type:"Feature"};if(c.properties=o[s],"object"==typeof l&&l.type)c.geometry=l;else{if(!Array.isArray(l))continue;var p,h="Point";if(0===l.filter(Boolean).length)continue;u(l[0])?h="Point":u(l[0][0])?h="LineString":u(l[0][0][0])?(f=(p=l[0])[0],p=p[p.length-1],h=f[0]===p[0]&&f[1]===p[1]?"Polygon":"MultiLineString"):u(l[0][0][0][0])&&(h="MultiPolygon"),r&&r.key&&"string"==typeof r.key&&(r.alias&&"string"==typeof r.alias?c[r.alias]=o[s][r.key]:c[r.key]=o[s][r.key]);var f={type:h};f.coordinates=l,c.geometry=f}a.push(c)}}return e.features=a,e},resversalGeojson:()=>function(e,t){if(void 0===t&&(t=!0),i(e)){for(var r={type:"FeatureCollection",features:[]},n=e.features,l=0;l<n.length;l++){var u,c=n[l],p={};for(u in c)"geometry"!==u&&"properties"!==u&&"type"!==u&&(p[u]=c[u]);var h=c.geometry.coordinates,f=c.geometry.type,y={type:f,coordinates:null};y.coordinates=("Point"===f?s:a)(h,t),r.features.push(o({type:"Feature",geometry:y,properties:c.properties},p))}return r}return null},reversalLngLat:()=>a});var n=function e(t){var r,o,n="object"!=(n=typeof(r=t))?n:Object.prototype.toString.call(r).replace(/^\[object (\S+)\]$/,"$1");if("Array"===n)o=[];else{if("Object"!==n)return t;o={}}if("Array"===n)for(var i=0,a=t.length;i<a;i++)o.push(e(t[i]));else if("Object"===n)for(var s in t)o[s]=e(t[s]);return o};function i(e){return"object"==typeof e&&null!==e&&!("FeatureCollection"===e.type&&!Array.isArray(e.features))}function a(e,t){return void 0===t&&(t=!0),e&&("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e))?u(e[0])?s(e,t):function e(t){for(var r=[],o=0;o<t.length;o++){var n=t[o];u(n[0])?r.push(s(n)):r.push(e(n))}return r}(e):[]}function s(e,t){return(t=void 0===t||t)&&e[0]<e[1]?[e[1],e[0]]:e}function l(e,t){void 0===t&&(t=!1);var r,o,n=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,r,o){return t+t+r+r+o+o}));return(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n))?(r=parseInt(n[1],16),o=parseInt(n[2],16),n=parseInt(n[3],16),t?[r,o,n,1]:"rgba("+r+","+o+","+n+",1)"):e}function u(e){return"number"==typeof e||!("string"!=typeof e||!e||e.includes(" ")||isNaN(Number(e)))}var c=["customName"],p=function(){function e(e,t,n){var i=this;this._mouseEnter=function(e){var t,r,o;"Map"===e.originalEvent.target.ariaLabel&&(r=e.point,e=e.lngLat,t=(r=null!=(r=i.map.queryRenderedFeatures(r)[0])?r:{}).properties,o=r.geometry,r.source,r=r.layer,i.layerName.includes(r.id)?(r=o.coordinates,o=[e.lng,e.lat],0<(null==(e=o="mouseenter"===i.mouseType?0<r.length&&Array.isArray(r[0])?r[0]:r:o)?void 0:e.length)&&i.popup.setLngLat(o).setHTML(i.htmlCallBack(t)).addTo(i.map)):null!=(r=i.popup)&&r.remove())},this._mouseLeave=function(){i.popup.remove()},this.map=e,"string"==typeof t?this.layerName=[t]:Array.isArray(t)&&(this.layerName=t),t=void 0!==(t=(e=null!=n?n:{}).customName)&&t,e=r(e,c),t=t?"":"commonTooltip ",null!=n&&n.className&&(t+=n.className),this.popup=new mapboxgl.Popup(o({},e,{className:t,closeButton:null!=(e=null==n?void 0:n.closeButton)&&e,closeOnClick:null!=(t=null==n?void 0:n.closeOnClick)&&t,anchor:null!=(e=null==n?void 0:n.anchor)?e:"left",type:"tooltip"}))}var t=e.prototype;return t.show=function(e,t){var r=this;"function"==typeof(this.htmlCallBack=e)&&(this.mouseType="mouseenter","move"===t&&(this.mouseType="mousemove"),0<(null==(e=this.layerName)?void 0:e.length))&&this.layerName.forEach((function(e){r.map.on(r.mouseType,e,r._mouseEnter).on("mouseleave",e,r._mouseLeave)}))},t.destroy=function(){var e,t=this;null!=(e=this.popup)&&e.remove(),null!=(e=this.layerName)&&e.forEach((function(e){t.map.off(t.mouseType,e,t._mouseEnter).off("mouseleave",e,t._mouseLeave)}))},e}(),h=["destroyComponent","customClick","popupClose","closeOther","noCloseLayerName","customName","offset","closeClick"],f=function(){function e(e,t,n){var i=this,a=(this._closeOtherPopup=function(){var e;i.closeOther&&null!=(e=i.map)&&null!=(e=e._popups)&&e.forEach((function(e){var t;"popup"===e.options.type&&(Array.isArray(i.noCloseLayerName)&&0<i.noCloseLayerName.length?(t=e.options.sourceName.join("|"),new RegExp(t).test(i.noCloseLayerName)&&null!=e&&null!=(t=e._onClose)&&t.call(e)):null!=e&&null!=(t=e._onClose)&&t.call(e))}))},this._click=function(e){var t,r,o,n,a,s,l;"Map"===e.originalEvent.target.ariaLabel&&(i._closeOtherPopup(),t=e.point,e=e.lngLat,r=(n=null!=(n=(s=i.map.queryRenderedFeatures(t))[0])?n:{}).properties,o=n.geometry,n.source,n=n.layer,i.layerName.includes(n.id))&&(i.customClick||(n=o.coordinates,l=o.type,a=(s=null!=(s=i.componentCallBack({properties:r,lngLat:e,coordinates:n,feature:s[0]}))?s:{}).component,s=s.instance,l="Point"===l?n:e,i.vueInstance=s,a&&(i.popup.setOffset(i.offset),i.popup.setLngLat(l).setDOMContent(a).addTo(i.map))),"function"==typeof i.callBack)&&i.callBack({lngLat:e,properties:r,geometry:o,point:t})},this.map=e,this.popup=null,"string"==typeof t?this.layerName=[t]:Array.isArray(t)&&(this.layerName=t),void 0!==(t=(e=n||{}).destroyComponent)&&t),s=(t=void 0!==(t=e.customClick)&&t,void 0!==(s=e.popupClose)&&s),l=void 0===(l=e.closeOther)||l,u=void 0===(u=e.noCloseLayerName)?[]:u,c=void 0!==(c=e.customName)&&c,p=void 0===(p=e.offset)?[0,0]:p,f=e.closeClick;e=r(e,h),c=c?"":"commonPopup ",null!=n&&n.className&&(c+=n.className),this.noCloseLayerName=u,this.noCloseLayerName=[],this.customClick=t,this.popupCloseSign=s,this.closeOther=l,this.offset=p="number"==typeof p?[p,p]:p,this.vueInstance=null,this.closeCallback=null,this.customClick||(this.popup=new mapboxgl.Popup(o({},e,{offset:p,className:c,closeButton:null!=(n=null==e?void 0:e.closeButton)&&n,closeOnClick:null!=(u=null==e?void 0:e.closeOnClick)&&u,anchor:null!=(t=null==e?void 0:e.anchor)?t:"bottom",focusAfterOpen:null!=(s=null==e?void 0:e.focusAfterOpen)&&s,type:"popup",sourceName:this.layerName})),f&&"function"==typeof f&&(this.popup._closeClick=f),null!=(l=this.popup)&&l.on("close",(function(e){"function"==typeof i.closeCallback&&i.closeCallback(e),i.popupCloseSign&&null!=(e=i.vueInstance)&&e.popupClose&&"function"==typeof i.vueInstance.popupClose&&i.vueInstance.popupClose(),i.vueInstance&&a&&null!=(e=i.vueInstance)&&e.$destroy()})))}var t=e.prototype;return t.show=function(e,t){var r=this;this.componentCallBack=e,this.callBack=t,0<(null==(e=this.layerName)?void 0:e.length)&&this.layerName.forEach((function(e){r.map.on("click",e,r._click)}))},t.showPosition=function(e,t,r,o){e&&(this._closeOtherPopup(),(r=(null!=r?r:{}).offset)&&this.popup.setOffset(r),this.popup.setLngLat(e).setDOMContent(t).addTo(this.map),o)&&"function"==typeof o&&o()},t.close=function(){var e;null!=(e=this.popup)&&e._onClose()},t.closeBack=function(e){this.closeCallback=e},t.destroy=function(){var e,t=this;null!=(e=this.popup)&&e.remove(),null!=(e=this.layerName)&&e.forEach((function(e){t.map.off("click",e,t._click)}))},e}(),y=function(){function e(e,t,r){var o=this,n=(this.clickEvent=function(e){var t=new THREE.Vector2,r=o.map.getCanvas();t.x=(e.clientX-r.getBoundingClientRect().left)/r.offsetWidth*2-1,t.y=-(e.clientY-r.getBoundingClientRect().top)/r.offsetHeight*2+1,e=(new THREE.Matrix4).getInverse(o.camera.projectionMatrix),r=(new THREE.Vector3).applyMatrix4(e),t=new THREE.Vector3(t.x,t.y,1).applyMatrix4(e).clone().sub(r).normalize(),(e=new THREE.Raycaster).set(r,t),r=e.intersectObjects(o.scene.children,!0),o.callback&&0<r.length&&(t=r[0],e=o.findProperties(t.object),o.callback(e))},this.findProperties=function(e){var t={},r=null;return"Scene"!==e.type&&(r=(e.lngLat?(t=e.properties,e):(t=(e=o.findProperties(e.parent)).properties,e)).lngLat),{properties:t,lngLat:r}},this.id="3d-"+e,this.type="custom",this.renderingMode="3d","function"==typeof r&&(this.callback=r),e=t.lngLat,r=t.url,void 0===(n=t.scale)?1:n),i=void 0===(i=t.height)?0:i,a=void 0===(a=t.rotate)?[Math.PI/2,0,0]:a,s=void 0===(s=t.properties)?{}:s,l=void 0===(l=t.AmbientLight)?{show:!0,color:16777215,intensity:.5}:l,u=void 0===(u=t.DirectionalLight)?[]:u,c=void 0===(c=t.PointLight)?[]:c;t=void 0!==(t=t.click)&&t,this.lngLat=e,this.url=r,this.scale=n,this.height=i,this.rotate=a,this.properties=s,this.AmbientLight=l,this.DirectionalLight=u,this.PointLight=c,this.click=t,this.modelAsMercatorCoordinate=mapboxgl.MercatorCoordinate.fromLngLat(e,i),this.modelTransform={translateX:this.modelAsMercatorCoordinate.x,translateY:this.modelAsMercatorCoordinate.y,translateZ:this.modelAsMercatorCoordinate.z,rotateX:a[0],rotateY:a[1],rotateZ:a[2],scale:n*this.modelAsMercatorCoordinate.meterInMercatorCoordinateUnits()}}var t=e.prototype;return t.onAdd=function(e,t){var r,o,n=this;this.map=e,e=this.map.getCanvas(),this.camera=new THREE.PerspectiveCamera(50,e.innerWidth/e.innerHeight,.1,1e4),this.scene=new THREE.Scene,this.AmbientLight&&this.AmbientLight.show&&(o=this.AmbientLight.color||16777215,r=this.AmbientLight.intensity||.5,o=new THREE.AmbientLight(o,r),this.scene.add(o)),this.DirectionalLight&&Array.isArray(this.DirectionalLight)&&this.DirectionalLight.forEach((function(e){var t=e.color||16777215,r=e.intensity||1;e=e.position||[0,0,0],(t=new THREE.DirectionalLight(t,r)).position.set(e[0],e[1],e[2]).normalize(),n.scene.add(t)})),this.PointLight&&Array.isArray(this.PointLight)&&this.PointLight.forEach((function(e){var t=e.color||16777215,r=e.intensity||1,o=e.distance||0,i=e.decay||2;e=e.position||[0,0,0],(t=new THREE.PointLight(t,r,o,i)).position.set(e[0],e[1],e[2]).normalize(),n.scene.add(t)})),(new THREE.GLTFLoader).load(this.url,(function(e){for(var t=0;t<e.scene.children.length;t++)e.scene.children[t].properties=n.properties,e.scene.children[t].lngLat=n.lngLat;n.scene.add(e.scene)})),this.renderer=new THREE.WebGLRenderer({canvas:e,context:t,antialias:!0}),this.renderer.autoClear=!1,this.click&&this.renderer.domElement.addEventListener("click",this.clickEvent)},t.render=function(e,t){var r=(new THREE.Matrix4).makeRotationAxis(new THREE.Vector3(1,0,0),this.modelTransform.rotateX),o=(new THREE.Matrix4).makeRotationAxis(new THREE.Vector3(0,1,0),this.modelTransform.rotateY),n=(new THREE.Matrix4).makeRotationAxis(new THREE.Vector3(0,0,1),this.modelTransform.rotateZ),i=(new THREE.Matrix4).fromArray(t);r=(new THREE.Matrix4).makeTranslation(this.modelTransform.translateX,this.modelTransform.translateY,this.modelTransform.translateZ).scale(new THREE.Vector3(this.modelTransform.scale,-this.modelTransform.scale,this.modelTransform.scale)).multiply(r).multiply(o).multiply(n),this.camera.projectionMatrix.elements=t,this.camera.projectionMatrix=i.multiply(r),this.renderer.state.reset(),this.renderer.render(this.scene,this.camera),this.map.triggerRepaint()},t.onRemove=function(){this.click&&this.renderer.domElement.removeEventListener("click",this.clickEvent),this.renderer&&(this.renderer.dispose(),this.renderer=null),this.scene&&(this.scene.clear(),this.scene=null)},e}(),d=function(){function e(e){this.map=e,this.sourceName=[]}var t=e.prototype;return t.draw=function(e,t,r){if(e&&this.map&&("FeatureCollection"===e.type||Array.isArray(e.features)))return this.sourceName=[t],this._addSourceLayer(t,e,r),r.lineConfig?[].concat(this.sourceName,[this.lineName]):this.sourceName},t.destroy=function(){this._clearSource()},t._addSourceLayer=function(e,t,r){this.map.addSource(e,o({type:"geojson",data:t},r.sourceConfig)),t=r.beforeId||null,this.map.addLayer(o({id:e,type:"line",source:e},r.layerConfig),t),r.lineConfig&&(this.lineName=e+"-highlight",this.map.addLayer(o({id:this.lineName,type:"line",source:e},r.lineConfig)))},t._clearSource=function(){var e,t=this;null!=(e=this.sourceName)&&e.forEach((function(e){t.map.getSource(e)&&(t.map.removeLayer(e),t.lineName&&t.map.removeLayer(e+"-highlight"),t.map.removeSource(e))}))},e}(),m=function(){function e(e){this.map=e,this.sourceName=[],this.type="symbol"}var t=e.prototype;return t.draw=function(e,t,r){var o;if(e&&this.map&&("FeatureCollection"===e.type||Array.isArray(e.features))){this.type=null!=(o=r.type)?o:"symbol";var n=r.sliceNum;if(!n||n<1e3)this.sourceName=[t],this._clearSource(),this._addSourceLayer(t,e,r);else{this._clearSource();for(var i=0,a=0;a<e.features.length;a+=n){var s={type:"FeatureCollection",features:[]},l=e.features.slice(a,n);s.features=[].concat(l),l=t+"-"+i,this.sourceName.push(l),this._addSourceLayer(l,s,r),i++}}return this.sourceName}},t.destroy=function(){this._clearSource()},t._clearSource=function(){var e,t=this;null!=(e=this.sourceName)&&e.forEach((function(e){t.map.getSource(e)&&(t.map.removeLayer(e),t.map.removeSource(e))}))},t._addSourceLayer=function(e,t,r){this.map.addSource(e,o({type:"geojson",data:t},r.sourceConfig)),t=r.beforeId||null,this.map.addLayer(o({id:e,type:this.type,source:e},r.layerConfig),t)},e}(),g=6371008.8,v={centimeters:100*g,centimetres:100*g,degrees:g/111325,feet:3.28084*g,inches:39.37*g,kilometers:g/1e3,kilometres:g/1e3,meters:g,metres:g,miles:g/1609.344,millimeters:1e3*g,millimetres:1e3*g,nauticalmiles:g/1852,radians:1,yards:1.0936*g};function b(e,t,r){var o={type:"Feature"};return 0!==(r=void 0===r?{}:r).id&&!r.id||(o.id=r.id),r.bbox&&(o.bbox=r.bbox),o.properties=t||{},o.geometry=e,o}function L(e,t,r){void 0===r&&(r={});for(var o=0,n=e;o<n.length;o++){var i=n[o];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<i[i.length-1].length;a++)if(i[i.length-1][a]!==i[0][a])throw new Error("First and last Position are not equivalent.")}return b({type:"Polygon",coordinates:e},t,r)}function E(e,t){var r=v[t=void 0===t?"kilometers":t];if(r)return e/r;throw new Error(t+" units is invalid")}function w(e){return e%(2*Math.PI)*180/Math.PI}function A(e){return e%360*Math.PI/180}function C(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function M(e,t,r){if(null!==e)for(var o,n,i,a=0,s=e.type,l="FeatureCollection"===s,u="Feature"===s,c=l?e.features.length:1,p=0;p<c;p++)for(var h,f,y=(f=!!(h=l?e.features[p].geometry:u?e.geometry:e)&&"GeometryCollection"===h.type)?h.geometries.length:1,d=0;d<y;d++){var m=0,g=0,v=f?h.geometries[d]:h;if(null!==v){var b=v.coordinates,L=v.type,E=!r||"Polygon"!==L&&"MultiPolygon"!==L?0:1;switch(L){case null:break;case"Point":if(!1===t(b,a,p,m,g))return!1;a++,m++;break;case"LineString":case"MultiPoint":for(o=0;o<b.length;o++){if(!1===t(b[o],a,p,m,g))return!1;a++,"MultiPoint"===L&&m++}"LineString"===L&&m++;break;case"Polygon":case"MultiLineString":for(o=0;o<b.length;o++){for(n=0;n<b[o].length-E;n++){if(!1===t(b[o][n],a,p,m,g))return!1;a++}"MultiLineString"===L&&m++,"Polygon"===L&&g++}"Polygon"===L&&m++;break;case"MultiPolygon":for(o=0;o<b.length;o++){for(n=g=0;n<b[o].length;n++){for(i=0;i<b[o][n].length-E;i++){if(!1===t(b[o][n][i],a,p,m,g))return!1;a++}g++}m++}break;case"GeometryCollection":for(o=0;o<v.geometries.length;o++)if(!1===M(v.geometries[o],t,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}function S(e){var t=[1/0,1/0,-1/0,-1/0];return M(e,(function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])})),t}const k=S.default=S,N=function(e){e=k(e);var t=void 0,r=(void 0===t&&(t={}),Number(e[0])),o=Number(e[1]),n=Number(e[2]),i=Number(e[3]);if(6===e.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var a=[r,o];return L([[a,[n,o],[n,i],[r,i],a]],t.properties,{bbox:e,id:t.id})};function P(e,t,r,o){void 0===o&&(o={});var n=A((e=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&2<=e.length&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}(e))[0]),i=(e=A(e[1]),r=A(r),t=E(t,o.units),Math.asin(Math.sin(e)*Math.cos(t)+Math.cos(e)*Math.sin(t)*Math.cos(r)));return function(e,t,r){if(void 0===r&&(r={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(C(e[0])&&C(e[1]))return b({type:"Point",coordinates:e},t,r);throw new Error("coordinates must contain numbers")}([w(n+Math.atan2(Math.sin(r)*Math.sin(t)*Math.cos(e),Math.cos(t)-Math.sin(e)*Math.sin(i))),w(i)],o.properties)}const x=function(e,t,r){for(var o=(r=void 0===r?{}:r).steps||64,n=r.properties||(!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{}),i=[],a=0;a<o;a++)i.push(P(e,t,-360*a/o,r).geometry.coordinates);return i.push(i[0]),L([i],n)};var _=function(){function e(e){this.map=e,this.sourceName=[],this.lineName=""}var t=e.prototype;return t.draw=function(e,t,r){if(e){this.sourceName=[t];var o,n=null!=r?r:{},i=void 0===(o=n.radius)?0:o,a=void 0===(o=n.steps)?64:o,s=n.endRadius,l=[];if("object"==typeof e){if("FeatureCollection"!==e.type&&!Array.isArray(e.features))return;for(var u=e.features,c=0;c<u.length;c++){var p,h,f,y,d,m=u[c].geometry.coordinates;"number"==typeof m[0]&&"number"==typeof m[1]&&(m[0]<m[1]&&(p=[m[1],m[0]],m[0]=p[0],m[1]=p[1]),p=!1,h=0<(h=(p="string"==typeof i||p)?u[c].properties[i]:i)?h:0,f={steps:a,units:"kilometers",properties:u[c].properties},y=x(m,h,f),s?(d=!1,d=0<(d=(d="string"==typeof s||d)?u[c].properties[s]:s)?d:0,m=x(m,s,f),l.push(h===d?y:h<d?this._getRingJson(m.geometry.coordinates[0],y.geometry.coordinates[0],y.properties):this._getRingJson(y.geometry.coordinates[0],m.geometry.coordinates[0],y.properties))):l.push(y))}}return this._addSourceLayer(t,{type:"FeatureCollection",features:l},r),r.lineConfig?[].concat(this.sourceName,[this.lineName]):this.sourceName}},t._getRingJson=function(e,t,r){return{type:"Feature",geometry:{coordinates:[e,t],type:"Polygon"},properties:r}},t._addSourceLayer=function(e,t,r){this.map.addSource(e,o({type:"geojson",data:t},r.sourceConfig)),t=(null!=r?r:{}).beforeId,this.map.addLayer(o({id:e,type:"fill",source:e},r.layerConfig),t),r.lineConfig&&(this.lineName=e+"-line",this.map.addLayer(o({id:this.lineName,type:"line",source:e},r.lineConfig),t))},t.destroy=function(){this._clearSource()},t._clearSource=function(){var e,t=this;null!=(e=this.sourceName)&&e.forEach((function(e){t.map.getSource(e)&&(t.map.removeLayer(e),t.lineName&&t.map.removeLayer(e+"-line"),t.map.removeSource(e))}))},e}(),T=function(){function e(e,t){this.map=e,this.name=[],"string"==typeof t?this.name=[t]:Array.isArray(t)&&t.every((function(e){return"string"==typeof e}))&&(this.name=t),this.event=[]}var t=e.prototype;return t.add=function(e){var t,r=this;if(0===(null==(t=this.event)?void 0:t.length)&&e&&"object"==typeof e){var o,n=function(t){var o,n;r.event.push(t),0<(null==(n=r.name)?void 0:n.length)?null!=(n=r.name)&&n.forEach((function(o){function n(r){"Map"===r.originalEvent.target.ariaLabel&&e[t](r)}var i;r[t]=n,null!=(i=r.map)&&i.on(t,o,n)})):(r[t]=n=function(r){"Map"===r.originalEvent.target.ariaLabel&&e[t](r)},null!=(o=r.map)&&o.on(t,n))};for(o in e)n(o)}},t.destroy=function(e){var t,r=this;e&&Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))?null!=(t=this.name)&&t.forEach((function(t){e.forEach((function(e){var o,n;r.event.includes(e)&&(n=r[e],null!=(o=r.map))&&o.off(e,t,n)}))})):0<(null==(t=this.name)?void 0:t.length)?null!=(t=this.name)&&t.forEach((function(e){r.event.forEach((function(t){var o,n=r[t];null!=(o=r.map)&&o.off(t,e,n)}))})):this.event.forEach((function(e){var t,o=r[e];null!=(t=r.map)&&t.off(e,o)}))},e}(),j=["id","type"],R=["id","type","beforeId"],I=function(){function e(e){this.map=e,this.sourceName=[]}var t=e.prototype;return t.draw=function(e,t){var n,a,s,l,u=this;return i(e)?(n=(a=null!=(a=t.sourceConfig)?a:{}).id,l=void 0===(l=a.type)?"geojson":l,a=r(a,j),s=n,this.map.addSource(n,o({type:l,data:e},a)),l=null!=(n=t.layerConfig)?n:{},e=[],Array.isArray(l)?e=l:"object"==typeof l&&e.push(l),e.forEach((function(e){var t=e.id,n=e.type,i=e.beforeId;e=r(e,R),u.map.addLayer(o({id:t,type:n,source:s},e),i)})),this.sourceName=[s].concat(e.map((function(e){return e.id}))).filter(Boolean),this.sourceName=Array.from(new Set(this.sourceName)),this.sourceName):[]},t.destroy=function(){var e,t,r=this;0<(null==(t=this.sourceName)?void 0:t.length)&&(1===this.sourceName.length?this.map.getSource(this.sourceName[0])&&(this.map.removeLayer(this.sourceName[0]),this.map.removeSource(this.sourceName[0])):(e=(t=this.sourceName)[0],t=t.slice(1),this.map.getSource(e)&&(t.forEach((function(e){r.map.removeLayer(e)})),this.map.removeSource(e))))},e}(),O=function(){function e(t,r,n){if((this instanceof e?this.constructor:void 0)!==e)throw new Error("MapLayer is a constructor and should be called with the new keyword");var i={layer:null,tooltip:null,popup:null};return r&&"object"==typeof r&&(i=o({},i,r)),this.name=t,this.layers=i,this.prop=null!=n?n:{},new Proxy(this,{deleteProperty:function(e,t){return(e!==this||"layers"!==t&&"name"!==t)&&(delete e[t],!0)},set:function(e,t,r){return(e!==this||"layers"!==t&&"name"!==t)&&(e[t]=r,!0)}})}var t=e.prototype;return t.addLayer=function(e){if(e&&"object"==typeof e)for(var t in e)this.layers[t]=e[t]},t.addProp=function(e){if(e&&"object"==typeof e)for(var t in e)this.prop[t]=e[t]},e}();function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var F=function(){function e(e,t){this.map=e,this.markers=[],this.options=t,this.properties=[]}var t=e.prototype;return t.draw=function(e,t){if(i(e))for(var r,n=null!=(r=this.options)?r:{},a=function(e,t){var r,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(o)return(o=o.call(e)).next.bind(o);if(Array.isArray(e)||(o=function(e,t){var r;if(e)return"string"==typeof e?B(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(e,t):void 0}(e)))return o&&(e=o),r=0,function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.features);!(u=a()).done;){var s,l,u=u.value;"Point"===u.geometry.type&&(s=n,t&&"function"==typeof t&&1===(null==(l=t({lngLat:u.geometry.coordinates,properties:u.properties}))?void 0:l.nodeType)&&(s=o({},s,{element:l})),l=new mapboxgl.Marker(s).setLngLat(u.geometry.coordinates).addTo(this.map),this.markers.push(l),this.properties.push(u.properties))}},t.addEvent=function(e){var t=this;if(e&&"object"==typeof e)for(var r=0;r<this.markers.length;r++)!function(r){["dragstart","drag","dragend"].forEach((function(n){e[n]&&"function"==typeof e[n]&&t.markers[r].on(n,(function(i){e[n](o({},i,{properties:t.properties[r]}))}))}))}(r)},t.destroy=function(){for(var e=0;e<this.markers.length;e++)this.markers[e].remove();this.markers=[]},e}(),H=["padding","animate","maxZoom","essential"],G=["url"],D=null,z=null;return t})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zh-mapbox",
3
- "version": "0.0.49",
3
+ "version": "0.0.53",
4
4
  "description": "mapbox的常用方法",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",