zh-mapbox 0.0.76 → 0.0.86

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/index.d.ts CHANGED
@@ -124,4 +124,204 @@ export declare function getPositionType(position: any[]): string;
124
124
  * 获取数组维度
125
125
  * @param arr
126
126
  */
127
- export declare function getArrayDepth(arr: any[]): number;
127
+ export declare function getArrayDepth(arr: any[]): number;
128
+
129
+ export declare function mergeGeoJson(...args: any): any;
130
+
131
+ declare module 'mapbox-gl' {
132
+ interface Map {
133
+ /**
134
+ * 获取所有图层和源
135
+ * @param defaultSource
136
+ * @param save
137
+ */
138
+ getAllLayerAndSource(defaultSource?: string[], save?: boolean): { layers: any[], sources: any[] };
139
+
140
+ /**
141
+ * 删除所有自定义图层
142
+ */
143
+ removeAllCustomLayer(): void;
144
+
145
+ /**
146
+ * 删除所有图层和源
147
+ * @param defaultSource
148
+ */
149
+ removeAllLayerAndSource(defaultSource?: string[]): { layers: any[], sources: any[] };
150
+
151
+ /**
152
+ * 移除指定所有事件
153
+ * @param events
154
+ */
155
+ removeEvents(events?: string[]): void;
156
+
157
+ /**
158
+ * 移除弹出框
159
+ * @param type 'tooltip'|'popup
160
+ */
161
+ removePopup(type?: string): void;
162
+
163
+ /**
164
+ * 查找自定义图层
165
+ * @param type 查找图层类型
166
+ * @param defaultSource
167
+ */
168
+ findCustomLayer(type: string | string[], defaultSource?: string[]): any[];
169
+
170
+ /**
171
+ * 地图提示框
172
+ * @param layerName
173
+ * @param options
174
+ * @constructor
175
+ */
176
+ MapTooltip(layerName: string | string[], options?: any): any;
177
+
178
+ /**
179
+ * 地图弹出框
180
+ * @param layerName
181
+ * @param options
182
+ * @constructor
183
+ */
184
+ MapPopup(layerName: string | string[], options?: any): any;
185
+
186
+ /**
187
+ * 绘制线
188
+ * @constructor
189
+ */
190
+ MapLine(): any;
191
+
192
+ /**
193
+ * 绘制自定义 默认symbol
194
+ * @constructor
195
+ */
196
+ MapCustom(): any;
197
+
198
+ /**
199
+ * 聚焦到geojson
200
+ * @param geojson
201
+ * @param options
202
+ */
203
+ fitBoundsGeoJson(geojson: any, options?: any): void;
204
+
205
+ /**
206
+ * 聚焦到四至
207
+ * @param position
208
+ * @param options
209
+ */
210
+ fitBoundsPosition(position: any, options?: any): void;
211
+
212
+ /**
213
+ * 获取反选遮罩
214
+ * @param geojson
215
+ * @param options
216
+ */
217
+ getInvertMask(geojson: any, options?: any): any;
218
+
219
+ /**
220
+ * 加载多张图片
221
+ * @param urls
222
+ */
223
+ loadImages(urls: object): Promise<any>;
224
+
225
+ /**
226
+ * 加载并添加多张图片
227
+ * @param urls
228
+ */
229
+ loadAddImages(urls: object): Promise<any>;
230
+
231
+ /**
232
+ * 绘制圆形 实质通过fill绘制
233
+ * @constructor
234
+ */
235
+ MapCircle(): any;
236
+
237
+ /**
238
+ * 自定义地图事件
239
+ * @param layerName
240
+ * @constructor
241
+ */
242
+ MapEvent(layerName?: string | string[]): any;
243
+
244
+ /**
245
+ * 添加多个图层
246
+ * @constructor
247
+ */
248
+ MapMoreCustom(): any;
249
+
250
+ /**
251
+ * 移除图层和源
252
+ * @param options
253
+ */
254
+ removeLayerSource(options: any): void;
255
+
256
+ /**
257
+ * 移除图层及事件
258
+ * @param events
259
+ * @param clear
260
+ */
261
+ removeLayerEvent(events: object, clear?: boolean): void;
262
+
263
+ /**
264
+ * 绘制marker
265
+ * @param options
266
+ * @constructor
267
+ */
268
+ MapMarker(options?: any): any;
269
+
270
+ /**
271
+ * 查找自定义图标
272
+ */
273
+ findCustomIcon(): any;
274
+
275
+ /**
276
+ * 获取自定义图层 type:’custom‘
277
+ */
278
+ getCustomLayer(): any[];
279
+
280
+ /**
281
+ * 获取图层层级
282
+ * @param id
283
+ */
284
+ getLayerIndex(id: string): any;
285
+
286
+ /**
287
+ * 根据层级 及 前后间隔数获取id
288
+ * @param index
289
+ * @param after
290
+ */
291
+ getLayerId(index: number, after?: number): string;
292
+
293
+ /**
294
+ * 获取最小层级id
295
+ */
296
+ getMinLayerId(): string;
297
+
298
+ /**
299
+ * 获取最大层级id
300
+ */
301
+ getMaxLayerId(): string;
302
+
303
+ /**
304
+ * 获取所有层级id
305
+ */
306
+ getAllLayerId(): string[];
307
+
308
+ /**
309
+ * 获取所有层级
310
+ */
311
+ getAllLayer(): any[];
312
+
313
+ /**
314
+ * 获取所有线图层
315
+ */
316
+ getLineLayer(): any[];
317
+
318
+ /**
319
+ * 动态蚂蚁路径
320
+ * @param id
321
+ * @param options
322
+ * @constructor
323
+ */
324
+ AnimateLine(id: string, options?: any): any;
325
+ }
326
+ }
327
+
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 n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},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,n={},o=Object.keys(e),i=0;i<o.length;i++)r=o[i],0<=t.indexOf(r)||(n[r]=e[r]);return n}function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}e.r(t),e.d(t,{MapLayer:()=>F,RegisterMapBoxMethod:()=>function(e,t){if(e&&e.Map){J=e,-1===(window.mapboxgl=J).Map.prototype._setupPainter.toString().indexOf("webgl2")&&(a=J.Map.prototype._setupPainter,J.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=[],c={},p=[];return{getAllLayerAndSource:function(e,t){void 0===e&&(e=a),void 0===t&&(t=!0);for(var r,n=this.getStyle(),i=n.layers,s=n.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(o(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:o(s[f])}),t||this.removeSource(f)),h++}return l},removeAllCustomLayer:function(){var e=this;u.forEach((function(t){e.getLayer(t.layer.id)&&e.removeLayer(t.layer.id)}))},removeAllLayerAndSource:function(e){return void 0===e&&(e=a),this.removeAllCustomLayer(),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,n=[],o=0;o<r.length;)"background"===r[o].type||t.includes(r[o].source)||n.push(r[o]),o++;if(e){if("string"==typeof e)return n.filter((function(t){return t.type===e}));if(Array.isArray(e)&&0<e.length)return n.filter((function(t){return e.includes(t.type)}))}return n},MapTooltip:function(e,t){return new f(this,e,t)},MapPopup:function(e,t){return new d(this,e,t)},addLayer:function(e,t){var r;return this._lazyInitEmptyStyle(),"custom"===e.type&&u.push({layer:e,beforeId:t}),t?-1!==(r=p.findIndex((function(e){return e.id===t})))&&p.splice(r,0,{type:e.type,id:e.id}):p.push({type:e.type,id:e.id}),this.style.addLayer(e,t),this.fire("layerdata",n({},e,{add:!0})),this._update(!0)},removeLayer:function(e){var t=this.style.getLayer(e),r=u.findIndex((function(t){return t.layer.id===e}));return-1!==r&&u.splice(r,1),r=p.findIndex((function(t){return t.id===e})),-1!==r&&p.splice(r,1),this.style.removeLayer(e),this.fire("layerdata",n({},t,{add:!1})),this._update(!0)},moveLayer:function(e,t){var r=p.findIndex((function(t){return t.id===e})),n=p.findIndex((function(e){return e.id===t}));return-1!==r&&-1!==n&&(r=p.splice(r,1)[0],n<0?n=0:p.length<n&&(n=p.length),p.splice(n,0,r)),this.style.moveLayer(e,t),this._update(!0)},MapLine:function(){return new g(this)},MapCustom:function(){return new v(this)},fitBoundsGeoJson:function(e,t){e&&(e=[[(e=x(e)).bbox[0],e.bbox[1]],[e.bbox[2],e.bbox[3]]],this.fitBoundsPosition(e,t))},fitBoundsPosition:function(e,t){var o,i,a,s;Array.isArray(e)&&0!==(null==e?void 0:e.length)&&(o=void 0===(o=(t=null!=t?t:{}).padding)?40:o,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,z),this.fitBounds(e,n({linear:!1,padding:o,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,n({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(n){var o={};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,q),t.loadImage(a,u(i,s))):l.layer&&l.layer.render&&"function"==typeof l.layer.render&&u(i,l.config||{})(null,l.layer))}else n(o);function u(t,r){return function(i,a){o[t]={data:r,url:i?null:a},Object.keys(o).length===Object.keys(e).length&&n(o)}}}))},loadAddImages:function(e){var t=this;return new Promise((function(r){t.loadImages(e).then((function(e){for(var o in e){var i=e[o],a=n({},null==i?void 0:i.data,{type:"custom"});t.hasImage(o)||t.addImage(o,i.url,a)}r()}))}))},MapCircle:function(){return new T(this)},MapEvent:function(e){return new j(this,e)},MapMoreCustom:function(){return new B(this)},removeLayerSource:function(e){function t(e){r.getSource(e)&&(r.removeLayer(e),r.removeSource(e))}var r=this,n=e.name,o=null!=(o=e.sources)?o:[];e=null!=(e=e.layers)?e:[],Array.isArray(n)&&0<n.length?n.forEach((function(e){t(e)})):"string"==typeof n&&t(n),0<(null==o?void 0:o.length)&&0<(null==e?void 0:e.length)&&(e.forEach((function(e){r.getLayer(e)&&r.removeLayer(e)})),o.forEach((function(e){r.getSource(e)&&r.removeSource(e)})))},removeLayerEvent:function(e,t){if(void 0===t&&(t=!0),"object"==typeof e&&null!=e)if(Object.keys(e).includes("destroy")&&"function"==typeof e.destroy)e.destroy();else for(var r in e)e[r]&&e[r].destroy&&"function"==typeof e[r].destroy&&(e[r].destroy(),t)&&(e[r]=null)},MapMarker:function(e){return new G(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},getCustomLayer:function(){var e=this,t=[];return u.map((function(r){e.getLayer(r.layer.id)&&t.push(r.layer)})),t},setStyle:function(e,t,r){var n=this,o=(null!=t&&t.save&&(o=void 0===(o=(null!=t?t:{}).source)?[]:o,c=this.findCustomIcon(),o=Array.isArray(o)&&0!==o.length?new Set([].concat(o,["composite","mapbox://mapbox.satellite"])):["composite","mapbox://mapbox.satellite"],l=this.getAllLayerAndSource(o)),s.call(this,e,t));return null!=t&&t.save&&this.once("style.load",(function(t){var o,i=[];for(o in c)i.push(o),n.style.imageManager.images[o]=c[o];var a=[];l.sources.map((function(e){var t=l.layers.filter((function(t){return t.source===e.name}));a.push({name:e.name,source:e.source,layer:t})})),a.map((function(e){n.getSource(e.name)||n.addSource(e.name,e.source),e.layer.map((function(e){n.getLayer(e.id)||n.addLayer(e)}))})),u.forEach((function(e){n.getLayer(e.layer.id)||n.addLayer(e.layer,e.beforeId)})),r&&"function"==typeof r&&r({style:e,images:i,layerSource:l})})),o},getLayerIndex:function(e){if(e){var t=p.findIndex((function(t){return t.id===e}));if(-1!==t)return t}return 0===p.length?0:p.length-1},getLayerId:function(e,t){return e+=t=void 0===t?0:t,t=Number(e),isNaN(t)||e<0&&p.length<=e?"":p[e].id},getMinLayerId:function(){var e;return null!=(e=p[0].id)?e:""},getMaxLayerId:function(){var e;return null!=(e=p[p.length-1].id)?e:""},getAllLayerId:function(){return p.map((function(e){return e.id}))},getAllLayer:function(){return p},getLineLayer:function(){return p.map((function(e,t){return"line"!==e.type?null:{index:t,id:e.id}})).filter(Boolean)},AnimateLine:function(e,t){return new D(this,e,t)}}}(l,t);for(s in new Event("layerdata"),u)l.prototype[s]=u[s];var c,p=J.Style,h=function(e){var t=e.prototype.addImage,r=e.prototype.updateImage,n=e.prototype._loadSprite,o=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,o=this;void 0===t&&(t=!1),n.call(this,e),t&&(r=this._availableImages.length,this.map.on("data",(function e(t){var n=o._availableImages.length;if("style"===t.dataType&&n!==r&&r<n){for(var i=o._availableImages.slice(r),a=0;a<i.length;a++)o.imageManager.images[i[a]].type="custom";o.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 n=o.call(this,e,t,r);if(0<n.length)for(var i=0;i<n.length;i++){var a=s[n[i].layer.id];n[i].layer.interactive=null==a||a}return n.filter((function(e){return e.layer.interactive}))}}}(p);for(c in h)p.prototype[c]=h[c];var y=(e=J.Popup).prototype.setDOMContent;e.prototype._closeClick=function(){},e.prototype.setDOMContent=function(e){return e=y.call(this,e),this._closeButton&&this._closeButton.addEventListener("click",this._closeClick),e}}},RegisterMapBoxModel:()=>function(e,t){if(J&&e&&t){(U=e).GLTFLoader=t,window.THREE=U;var r,n=J.Map,o={initGLTF:function(e,t,r){return new m(e,t,r)}};for(r in o)n.prototype[r]=o[r]}},getSymbolRipple:()=>function(e){var t,r=void 0===(t=(e=null!=e?e:{}).size)?30:t,n=void 0===(t=e.duration)?1e3:t,o=void 0===(t=e.color)?"#f00":t,i=e.custom,a=c(o,!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:n,color:o,context:u}):(e=performance.now()%n/n,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:()=>c,isGeoJSON:()=>i,isNumber:()=>p,judgeSizeLngLat:()=>s,object2Geojson:()=>function(e,t,r){var n=o(e);if(!Array.isArray(n))return null;e={type:"FeatureCollection"};for(var i=[],a=function(e){var o=n[e],a=function(e,t){if(t){var r;if("string"==typeof t)return 1===(r=t.split(".").filter(Boolean)).length?[l(e[r[0]])]:u(e,r);if(Array.isArray(t)){if(2===t.length)return[[e[t[0]],e[t[1]]].filter(Boolean)];if(3===t.length&&t[2])return u(e,r=t[2].split(".").filter(Boolean),[t[0],t[1]])}}return[]}(o,t);0<a.length&&a.map((function(t){var a,s=function(e){if(Array.isArray(e)){var t=function e(t){return Array.isArray(t)?Array.isArray(t[0])?1+e(t[0]):1:0}(e=e.filter(Boolean));if(0!==t)switch(t){case 1:return"Point";case 2:return"LineString";case 3:var r=(n=e[0])[0],n=n[n.length-1];return r[0]===n[0]&&r[1]===n[1]?"Polygon":"MultiLineString";case 4:return"MultiPolygon";default:return null}}return null}(t);s&&0<t.length&&((a={type:"Feature"}).properties=o,(s={type:s}).coordinates=t,a.geometry=s,r&&r.key&&"string"==typeof r.key&&(r.alias&&"string"==typeof r.alias?a[r.alias]=n[e][r.key]:a[r.key]=n[e][r.key]),i.push(a))}))},s=0;s<n.length;s++)a(s);return e.features=i,e},resversalGeojson:()=>function(e,t){if(void 0===t&&(t=!0),i(e)){for(var r={type:"FeatureCollection",features:[]},o=e.features,l=0;l<o.length;l++){var u,c=o[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(n({type:"Feature",geometry:y,properties:c.properties},p))}return r}return null},reversalLngLat:()=>a});var o=function e(t){var r,n,o="object"!=(o=typeof(r=t))?o:Object.prototype.toString.call(r).replace(/^\[object (\S+)\]$/,"$1");if("Array"===o)n=[];else{if("Object"!==o)return t;n={}}if("Array"===o)for(var i=0,a=t.length;i<a;i++)n.push(e(t[i]));else if("Object"===o)for(var s in t)n[s]=e(t[s]);return n};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))?p(e[0])?s(e,t):function e(t){for(var r=[],n=0;n<t.length;n++){var o=t[n];p(o[0])?r.push(s(o)):r.push(e(o))}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){return"string"==typeof e?JSON.parse(e):e}function u(e,t,r){var n=[],i=2===(r=void 0===r?[]:r).length;return function e(t,a){var s;t&&a.length&&(s=a.shift(),t.hasOwnProperty(s))&&(t=t[s],Array.isArray(t)?0!==a.length||i?t.forEach((function(t){i?n.push([t[r[0]],t[r[1]]]):e(t,o(a))})):(s=l(t),n.push(s)):"object"==typeof t?0===a.length?n.push(i?[t[r[0]],t[r[1]]]:t):e(t,a):0===a.length&&(s=l(t),n.push(s)))}(e,t),n}function c(e,t){void 0===t&&(t=!1);var r,n,o=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,r,n){return t+t+r+r+n+n}));return(o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o))?(r=parseInt(o[1],16),n=parseInt(o[2],16),o=parseInt(o[3],16),t?[r,n,o,1]:"rgba("+r+","+n+","+o+",1)"):e}function p(e){return"number"==typeof e||!("string"!=typeof e||!e||e.includes(" ")||isNaN(Number(e)))}var h=["customName"],f=function(){function e(e,t,o){var i=this;this._mouseEnter=function(e){var t,r,n;"Map"===e.originalEvent.target.ariaLabel&&(r=e.point,e=e.lngLat,t=(r=null!=(r=i.map.queryRenderedFeatures(r)[0])?r:{}).properties,n=r.geometry,r.source,r=r.layer,i.layerName.includes(r.id)?(r=n.coordinates,n=[e.lng,e.lat],0<(null==(e=n="mouseenter"===i.mouseType?0<r.length&&Array.isArray(r[0])?r[0]:r:n)?void 0:e.length)&&i.popup.setLngLat(n).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!=o?o:{}).customName)&&t,e=r(e,h),t=t?"":"commonTooltip ",null!=o&&o.className&&(t+=o.className),this.popup=new mapboxgl.Popup(n({},e,{className:t,closeButton:null!=(e=null==o?void 0:o.closeButton)&&e,closeOnClick:null!=(t=null==o?void 0:o.closeOnClick)&&t,anchor:null!=(e=null==o?void 0:o.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}(),y=["destroyComponent","customClick","popupClose","closeOther","noCloseLayerName","customName","offset","closeClick"],d=function(){function e(e,t,o){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,n,o,a,s,l;"Map"===e.originalEvent.target.ariaLabel&&(i._closeOtherPopup(),t=e.point,e=e.lngLat,r=(o=null!=(o=(s=i.map.queryRenderedFeatures(t))[0])?o:{}).properties,n=o.geometry,o.source,o=o.layer,i.layerName.includes(o.id))&&(i.customClick||(o=n.coordinates,l=n.type,a=(s=null!=(s=i.componentCallBack({properties:r,lngLat:e,coordinates:o,feature:s[0]}))?s:{}).component,s=s.instance,l="Point"===l?o: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:n,point:t})},this.map=e,this.popup=null,"string"==typeof t?this.layerName=[t]:Array.isArray(t)&&(this.layerName=t),void 0!==(t=(e=o||{}).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,h=e.closeClick;e=r(e,y),c=c?"":"commonPopup ",null!=o&&o.className&&(c+=o.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(n({},e,{offset:p,className:c,closeButton:null!=(o=null==e?void 0:e.closeButton)&&o,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})),h&&"function"==typeof h&&(this.popup._closeClick=h),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,n){e&&(this._closeOtherPopup(),(r=(null!=r?r:{}).offset)&&this.popup.setOffset(r),this.popup.setLngLat(e).setDOMContent(t).addTo(this.map),n)&&"function"==typeof n&&n()},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}(),m=function(){function e(e,t,r){var n=this,o=(this.clickEvent=function(e){var t=new THREE.Vector2,r=n.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(n.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(n.scene.children,!0),n.callback&&0<r.length&&(t=r[0],e=n.findProperties(t.object),n.callback(e))},this.findProperties=function(e){var t={},r=null;return"Scene"!==e.type&&(r=(e.lngLat?(t=e.properties,e):(t=(e=n.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===(o=t.scale)?1:o),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=o,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:o*this.modelAsMercatorCoordinate.meterInMercatorCoordinateUnits()}}var t=e.prototype;return t.onAdd=function(e,t){var r,n,o=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&&(n=this.AmbientLight.color||16777215,r=this.AmbientLight.intensity||.5,n=new THREE.AmbientLight(n,r),this.scene.add(n)),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(),o.scene.add(t)})),this.PointLight&&Array.isArray(this.PointLight)&&this.PointLight.forEach((function(e){var t=e.color||16777215,r=e.intensity||1,n=e.distance||0,i=e.decay||2;e=e.position||[0,0,0],(t=new THREE.PointLight(t,r,n,i)).position.set(e[0],e[1],e[2]).normalize(),o.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=o.properties,e.scene.children[t].lngLat=o.lngLat;o.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),n=(new THREE.Matrix4).makeRotationAxis(new THREE.Vector3(0,1,0),this.modelTransform.rotateY),o=(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(n).multiply(o),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}(),g=function(){function e(e){this.map=e,this.sourceName=[],this.sourceType="geojson"}var t=e.prototype;return t.draw=function(e,t,r){if(e&&this.map)return"vector"===e.type?(this.sourceName=[t],this.sourceType="vector",this._addSourceLayer(t,e,r),this.sourceName):"FeatureCollection"===e.type||Array.isArray(e.features)?(this.sourceName=[t],this._addSourceLayer(t,e,r),r.lineConfig?[].concat(this.sourceName,[this.lineName]):this.sourceName):void 0},t.destroy=function(){this._clearSource()},t.visible=function(e){var t,r=this;"boolean"==typeof e&&null!=(t=this.sourceName)&&t.forEach((function(t){r.map.getLayer(t)&&r.map.setLayoutProperty(t,"visibility",e?"visible":"none")}))},t._addSourceLayer=function(e,t,r){"vector"===this.sourceType?this.map.addSource(e,n({},t,r.sourceConfig)):this.map.addSource(e,n({type:"geojson",data:t},r.sourceConfig)),t=r.beforeId||null,this.map.addLayer(n({id:e,type:"line",source:e},r.layerConfig),t),r.lineConfig&&(this.lineName=e+"-highlight",this.map.addLayer(n({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}(),v=function(){function e(e){this.map=e,this.sourceName=[],this.type="symbol",this.sourceType="geojson"}var t=e.prototype;return t.draw=function(e,t,r){if(e&&this.map){if("vector"===e.type)return this.sourceType="vector",this._addSourceLayer(t,e,r),this.sourceName=[t],this.sourceName;var n;if("FeatureCollection"===e.type||Array.isArray(e.features)){this.type=null!=(n=r.type)?n:"symbol";var o=r.sliceNum;if(!o||o<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+=o){var s={type:"FeatureCollection",features:[]},l=e.features.slice(a,o);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.visible=function(e){var t,r=this;"boolean"==typeof e&&null!=(t=this.sourceName)&&t.forEach((function(t){r.map.getLayer(t)&&r.map.setLayoutProperty(t,"visibility",e?"visible":"none")}))},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){"vector"===this.sourceType?this.map.addSource(e,n({},t,r.sourceConfig)):this.map.addSource(e,n({type:"geojson",data:t},r.sourceConfig)),t=r.beforeId||null,this.map.addLayer(n({id:e,type:this.type,source:e},r.layerConfig),t)},e}(),b=6371008.8,L={centimeters:100*b,centimetres:100*b,degrees:b/111325,feet:3.28084*b,inches:39.37*b,kilometers:b/1e3,kilometres:b/1e3,meters:b,metres:b,miles:b/1609.344,millimeters:1e3*b,millimetres:1e3*b,nauticalmiles:b/1852,radians:1,yards:1.0936*b};function A(e,t,r){var n={type:"Feature"};return 0!==(r=void 0===r?{}:r).id&&!r.id||(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function E(e,t,r){void 0===r&&(r={});for(var n=0,o=e;n<o.length;n++){var i=o[n];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 A({type:"Polygon",coordinates:e},t,r)}function w(e,t){var r=L[t=void 0===t?"kilometers":t];if(r)return e/r;throw new Error(t+" units is invalid")}function C(e){return e%(2*Math.PI)*180/Math.PI}function N(e){return e%360*Math.PI/180}function S(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function M(e,t,r){if(null!==e)for(var n,o,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,A=!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(n=0;n<b.length;n++){if(!1===t(b[n],a,p,m,g))return!1;a++,"MultiPoint"===L&&m++}"LineString"===L&&m++;break;case"Polygon":case"MultiLineString":for(n=0;n<b.length;n++){for(o=0;o<b[n].length-A;o++){if(!1===t(b[n][o],a,p,m,g))return!1;a++}"MultiLineString"===L&&m++,"Polygon"===L&&g++}"Polygon"===L&&m++;break;case"MultiPolygon":for(n=0;n<b.length;n++){for(o=g=0;o<b[n].length;o++){for(i=0;i<b[n][o].length-A;i++){if(!1===t(b[n][o][i],a,p,m,g))return!1;a++}g++}m++}break;case"GeometryCollection":for(n=0;n<v.geometries.length;n++)if(!1===M(v.geometries[n],t,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}function k(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 P=k.default=k,x=function(e){e=P(e);var t=void 0,r=(void 0===t&&(t={}),Number(e[0])),n=Number(e[1]),o=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,n];return E([[a,[o,n],[o,i],[r,i],a]],t.properties,{bbox:e,id:t.id})};function I(e,t,r,n){void 0===n&&(n={});var o=N((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=N(e[1]),r=N(r),t=w(t,n.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(S(e[0])&&S(e[1]))return A({type:"Point",coordinates:e},t,r);throw new Error("coordinates must contain numbers")}([C(o+Math.atan2(Math.sin(r)*Math.sin(t)*Math.cos(e),Math.cos(t)-Math.sin(e)*Math.sin(i))),C(i)],n.properties)}const _=function(e,t,r){for(var n=(r=void 0===r?{}:r).steps||64,o=r.properties||(!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{}),i=[],a=0;a<n;a++)i.push(I(e,t,-360*a/n,r).geometry.coordinates);return i.push(i[0]),E([i],o)};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 n,o=null!=r?r:{},i=void 0===(n=o.radius)?0:n,a=void 0===(n=o.steps)?64:n,s=o.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=_(m,h,f),s?(d=!1,d=0<(d=(d="string"==typeof s||d)?u[c].properties[s]:s)?d:0,m=_(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,n({type:"geojson",data:t},r.sourceConfig)),t=(null!=r?r:{}).beforeId,this.map.addLayer(n({id:e,type:"fill",source:e},r.layerConfig),t),r.lineConfig&&(this.lineName=e+"-line",this.map.addLayer(n({id:this.lineName,type:"line",source:e},r.lineConfig),t))},t.destroy=function(){this._clearSource()},t.visible=function(e){var t,r=this;"boolean"==typeof e&&null!=(t=this.sourceName)&&t.forEach((function(t){r.map.getLayer(t)&&r.map.setLayoutProperty(t,"visibility",e?"visible":"none")}))},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}(),j=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 n,o=function(t){var n,o;r.event.push(t),0<(null==(o=r.name)?void 0:o.length)?null!=(o=r.name)&&o.forEach((function(n){function o(r){"Map"===r.originalEvent.target.ariaLabel&&e[t](r)}var i;r[t]=o,null!=(i=r.map)&&i.on(t,n,o)})):(r[t]=o=function(r){"Map"===r.originalEvent.target.ariaLabel&&e[t](r)},null!=(n=r.map)&&n.on(t,o))};for(n in e)o(n)}},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 n,o;r.event.includes(e)&&(o=r[e],null!=(n=r.map))&&n.off(e,t,o)}))})):0<(null==(t=this.name)?void 0:t.length)?null!=(t=this.name)&&t.forEach((function(e){r.event.forEach((function(t){var n,o=r[t];null!=(n=r.map)&&n.off(t,e,o)}))})):this.event.forEach((function(e){var t,n=r[e];null!=(t=r.map)&&t.off(e,n)}))},e}(),R=["id","type"],O=["id","type","beforeId"],B=function(){function e(e){this.map=e,this.sourceName=[]}var t=e.prototype;return t.draw=function(e,t){var o,a,s,l,u=this;return i(e)?(o=(a=null!=(a=t.sourceConfig)?a:{}).id,l=void 0===(l=a.type)?"geojson":l,a=r(a,R),s=o,this.map.addSource(o,n({type:l,data:e},a)),l=null!=(o=t.layerConfig)?o:{},e=[],Array.isArray(l)?e=l:"object"==typeof l&&e.push(l),e.forEach((function(e){var t=e.id,o=e.type,i=e.beforeId;e=r(e,O),u.map.addLayer(n({id:t,type:o,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))))},t.visible=function(e){var t,r=this;"boolean"==typeof e&&null!=(t=this.sourceName)&&t.forEach((function(t){r.map.getLayer(t)&&r.map.setLayoutProperty(t,"visibility",e?"visible":"none")}))},e}(),F=function(){function e(t,r,o){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=n({},i,r)),this.name=t,this.layers=i,this.prop=null!=o?o:{},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 H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var G=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,o=null!=(r=this.options)?r:{},a=function(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){var r;if(e)return"string"==typeof e?H(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)?H(e,t):void 0}(e)))return n&&(e=n),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=o,t&&"function"==typeof t&&1===(null==(l=t({lngLat:u.geometry.coordinates,properties:u.properties}))?void 0:l.nodeType)&&(s=n({},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(o){e[o]&&"function"==typeof e[o]&&t.markers[r].on(o,(function(i){e[o](n({},i,{properties:t.properties[r]}))}))}))}(r)},t.destroy=function(){for(var e=0;e<this.markers.length;e++)this.markers[e].remove();this.markers=[]},t.visible=function(e){var t;"boolean"==typeof e&&null!=(t=this.markers)&&t.forEach((function(t){t.getElement().style.display=e?"block":"none"}))},e}(),D=function(){function e(e,t,r){var n;r=null!=(n=r)?n:{},this.map=e,this.name=t,this.dash=Array.isArray(r.dash)?r.dash:[[0,4,3],[.5,4,2.5],[1,4,2],[1.5,4,1.5],[2,4,1],[2.5,4,.5],[3,4,0],[0,.5,3,3.5],[0,1,3,3],[0,1.5,3,2.5],[0,2,3,2],[0,2.5,3,1.5],[0,3,3,1],[0,3.5,3,.5]],this.step=null!=(n=r.step)?n:50,this.animateId=null}var t=e.prototype;return t.animate=function(){var e,t=this;this.name&&this.map.getLayer(this.name)&&function r(n){(n=parseInt(n/t.step%t.dash.length))!==e&&(t.map.setPaintProperty(t.name,"line-dasharray",t.dash[e]),e=n),t.animateId=requestAnimationFrame(r)}(e=0)},t.destroy=function(){this.animateId&&(cancelAnimationFrame(this.animateId),this.animateId=null)},e}(),z=["padding","animate","maxZoom","essential"],q=["url"],J=null,U=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 n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},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,n={},o=Object.keys(e),i=0;i<o.length;i++)r=o[i],0<=t.indexOf(r)||(n[r]=e[r]);return n}function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}e.r(t),e.d(t,{MapLayer:()=>F,RegisterMapBoxMethod:()=>function(e,t){if(e&&e.Map){q=e,-1===(window.mapboxgl=q).Map.prototype._setupPainter.toString().indexOf("webgl2")&&(a=q.Map.prototype._setupPainter,q.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=[],c={},p=[];return{getAllLayerAndSource:function(e,t){void 0===e&&(e=a),void 0===t&&(t=!0);for(var r,n=this.getStyle(),i=n.layers,s=n.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(o(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:o(s[f])}),t||this.removeSource(f)),h++}return l},removeAllCustomLayer:function(){var e=this;u.forEach((function(t){e.getLayer(t.layer.id)&&e.removeLayer(t.layer.id)}))},removeAllLayerAndSource:function(e){return void 0===e&&(e=a),this.removeAllCustomLayer(),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,n=[],o=0;o<r.length;)"background"===r[o].type||t.includes(r[o].source)||n.push(r[o]),o++;if(e){if("string"==typeof e)return n.filter((function(t){return t.type===e}));if(Array.isArray(e)&&0<e.length)return n.filter((function(t){return e.includes(t.type)}))}return n},MapTooltip:function(e,t){return new f(this,e,t)},MapPopup:function(e,t){return new d(this,e,t)},addLayer:function(e,t){var r;return this._lazyInitEmptyStyle(),"custom"===e.type&&u.push({layer:e,beforeId:t}),t?-1!==(r=p.findIndex((function(e){return e.id===t})))&&p.splice(r,0,{type:e.type,id:e.id}):p.push({type:e.type,id:e.id}),this.style.addLayer(e,t),this.fire("layerdata",n({},e,{add:!0})),this._update(!0)},removeLayer:function(e){var t=this.style.getLayer(e),r=u.findIndex((function(t){return t.layer.id===e}));return-1!==r&&u.splice(r,1),r=p.findIndex((function(t){return t.id===e})),-1!==r&&p.splice(r,1),this.style.removeLayer(e),this.fire("layerdata",n({},t,{add:!1})),this._update(!0)},moveLayer:function(e,t){var r=p.findIndex((function(t){return t.id===e})),n=p.findIndex((function(e){return e.id===t}));return-1!==r&&-1!==n&&(r=p.splice(r,1)[0],n<0?n=0:p.length<n&&(n=p.length),p.splice(n,0,r)),this.style.moveLayer(e,t),this._update(!0)},MapLine:function(){return new g(this)},MapCustom:function(){return new v(this)},fitBoundsGeoJson:function(e,t){e&&(e=[[(e=x(e)).bbox[0],e.bbox[1]],[e.bbox[2],e.bbox[3]]],this.fitBoundsPosition(e,t))},fitBoundsPosition:function(e,t){var o,i,a,s;Array.isArray(e)&&0!==(null==e?void 0:e.length)&&(o=void 0===(o=(t=null!=t?t:{}).padding)?40:o,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,z),this.fitBounds(e,n({linear:!1,padding:o,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,n({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(n){var o={};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,J),t.loadImage(a,u(i,s))):l.layer&&l.layer.render&&"function"==typeof l.layer.render&&u(i,l.config||{})(null,l.layer))}else n(o);function u(t,r){return function(i,a){o[t]={data:r,url:i?null:a},Object.keys(o).length===Object.keys(e).length&&n(o)}}}))},loadAddImages:function(e){var t=this;return new Promise((function(r){t.loadImages(e).then((function(e){for(var o in e){var i=e[o],a=n({},null==i?void 0:i.data,{type:"custom"});t.hasImage(o)||t.addImage(o,i.url,a)}r()}))}))},MapCircle:function(){return new T(this)},MapEvent:function(e){return new j(this,e)},MapMoreCustom:function(){return new B(this)},removeLayerSource:function(e){function t(e){r.getSource(e)&&(r.removeLayer(e),r.removeSource(e))}var r=this,n=e.name,o=null!=(o=e.sources)?o:[];e=null!=(e=e.layers)?e:[],Array.isArray(n)&&0<n.length?n.forEach((function(e){t(e)})):"string"==typeof n&&t(n),0<(null==o?void 0:o.length)&&0<(null==e?void 0:e.length)&&(e.forEach((function(e){r.getLayer(e)&&r.removeLayer(e)})),o.forEach((function(e){r.getSource(e)&&r.removeSource(e)})))},removeLayerEvent:function(e,t){if(void 0===t&&(t=!0),"object"==typeof e&&null!=e)if(Object.keys(e).includes("destroy")&&"function"==typeof e.destroy)e.destroy();else for(var r in e)e[r]&&e[r].destroy&&"function"==typeof e[r].destroy&&(e[r].destroy(),t)&&(e[r]=null)},MapMarker:function(e){return new G(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},getCustomLayer:function(){var e=this,t=[];return u.map((function(r){e.getLayer(r.layer.id)&&t.push(r.layer)})),t},setStyle:function(e,t,r){var n,o,i,a=this;return null!=t&&t.save&&(i=(o=null!=t?t:{}).source,o=void 0!==(o=o.custom)&&o,i=null!=(n=i=void 0===i?[]:i)?n:[],c=this.findCustomIcon(),Array.isArray(i)&&0!==i.length?o||(i=Array.from(new Set([].concat(i,["composite","mapbox://mapbox.satellite"])))):i=["composite","mapbox://mapbox.satellite"],l=this.getAllLayerAndSource(i),this.once("style.load",(function(n){var o,i=[];for(o in c)i.push(o),a.style.imageManager.images[o]=c[o];var s=[];l.sources.map((function(e){var t=l.layers.filter((function(t){return t.source===e.name}));s.push({name:e.name,source:e.source,layer:t})})),null!=t&&t.log&&console.log(s),s.map((function(e){a.getSource(e.name)||a.addSource(e.name,e.source),e.layer.map((function(e){a.getLayer(e.id)||a.addLayer(e)}))})),u.forEach((function(e){a.getLayer(e.layer.id)||a.addLayer(e.layer,e.beforeId)})),r&&"function"==typeof r&&r({style:e,images:i,layerSource:l})}))),s.call(this,e,t)},getLayerIndex:function(e){if(e){var t=p.findIndex((function(t){return t.id===e}));if(-1!==t)return t}return 0===p.length?0:p.length-1},getLayerId:function(e,t){return e+=t=void 0===t?0:t,t=Number(e),isNaN(t)||e<0&&p.length<=e?"":p[e].id},getMinLayerId:function(){var e;return null!=(e=p[0].id)?e:""},getMaxLayerId:function(){var e;return null!=(e=p[p.length-1].id)?e:""},getAllLayerId:function(){return p.map((function(e){return e.id}))},getAllLayer:function(){return p},getLineLayer:function(){return p.map((function(e,t){return"line"!==e.type?null:{index:t,id:e.id}})).filter(Boolean)},AnimateLine:function(e,t){return new D(this,e,t)}}}(l,t);for(s in new Event("layerdata"),u)l.prototype[s]=u[s];var c,p=q.Style,h=function(e){var t=e.prototype.addImage,r=e.prototype.updateImage,n=e.prototype._loadSprite,o=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,o=this;void 0===t&&(t=!1),n.call(this,e),t&&(r=this._availableImages.length,this.map.on("data",(function e(t){var n=o._availableImages.length;if("style"===t.dataType&&n!==r&&r<n){for(var i=o._availableImages.slice(r),a=0;a<i.length;a++)o.imageManager.images[i[a]].type="custom";o.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 n=o.call(this,e,t,r);if(0<n.length)for(var i=0;i<n.length;i++){var a=s[n[i].layer.id];n[i].layer.interactive=null==a||a}return n.filter((function(e){return e.layer.interactive}))}}}(p);for(c in h)p.prototype[c]=h[c];var y=(e=q.Popup).prototype.setDOMContent;e.prototype._closeClick=function(){},e.prototype.setDOMContent=function(e){return e=y.call(this,e),this._closeButton&&this._closeButton.addEventListener("click",this._closeClick),e}}},RegisterMapBoxModel:()=>function(e,t){if(q&&e&&t){(U=e).GLTFLoader=t,window.THREE=U;var r,n=q.Map,o={initGLTF:function(e,t,r){return new m(e,t,r)}};for(r in o)n.prototype[r]=o[r]}},getSymbolRipple:()=>function(e){var t,r=void 0===(t=(e=null!=e?e:{}).size)?30:t,n=void 0===(t=e.duration)?1e3:t,o=void 0===(t=e.color)?"#f00":t,i=e.custom,a=c(o,!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:n,color:o,context:u}):(e=performance.now()%n/n,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:()=>c,isGeoJSON:()=>i,isNumber:()=>p,judgeSizeLngLat:()=>s,mergeGeoJson:()=>function(){for(var e={type:"FeatureCollection",features:[]},t=[],r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];for(var a=0;a<n.length;a++)Array.isArray(n[a])?t.push.apply(t,n[a]):n[a]&&"object"==typeof n[a]&&t.push(n[a]);for(var s,l=0;l<t.length;l++){var u=t[l];i(u)&&(u=u.features,(s=e.features).push.apply(s,u))}return e},object2Geojson:()=>function(e,t,r){var n=o(e);if(!Array.isArray(n))return null;e={type:"FeatureCollection"};for(var i=[],a=function(e){var o=n[e],a=function(e,t){if(t){var r;if("string"==typeof t)return 1===(r=t.split(".").filter(Boolean)).length?[l(e[r[0]])]:u(e,r);if(Array.isArray(t)){if(2===t.length)return[[e[t[0]],e[t[1]]].filter(Boolean)];if(3===t.length&&t[2])return u(e,r=t[2].split(".").filter(Boolean),[t[0],t[1]])}}return[]}(o,t);0<a.length&&a.map((function(t){var a=function(e){if(Array.isArray(e)){var t=function e(t){return Array.isArray(t)?Array.isArray(t[0])?1+e(t[0]):1:0}(e=e.filter(Boolean));if(0!==t)switch(t){case 1:return"Point";case 2:return"LineString";case 3:var r=(n=e[0])[0],n=n[n.length-1];return r[0]===n[0]&&r[1]===n[1]?"Polygon":"MultiLineString";case 4:return"MultiPolygon";default:return null}}else if(e&&"object"==typeof e&&["Point","LineString","Polygon","MultiLineString","MultiPolygon"].includes(e.type))return"type";return null}(t),s=!1;(s=!(!a||!("type"===a||0<t.length))||s)&&((s={type:"Feature"}).properties=o,s.geometry="type"===a?t:{type:a,coordinates:t},r&&r.key&&"string"==typeof r.key&&(r.alias&&"string"==typeof r.alias?s[r.alias]=n[e][r.key]:s[r.key]=n[e][r.key]),i.push(s))}))},s=0;s<n.length;s++)a(s);return e.features=i,e},resversalGeojson:()=>function(e,t){if(void 0===t&&(t=!0),i(e)){for(var r={type:"FeatureCollection",features:[]},o=e.features,l=0;l<o.length;l++){var u,c=o[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(n({type:"Feature",geometry:y,properties:c.properties},p))}return r}return null},reversalLngLat:()=>a});var o=function e(t){var r,n,o="object"!=(o=typeof(r=t))?o:Object.prototype.toString.call(r).replace(/^\[object (\S+)\]$/,"$1");if("Array"===o)n=[];else{if("Object"!==o)return t;n={}}if("Array"===o)for(var i=0,a=t.length;i<a;i++)n.push(e(t[i]));else if("Object"===o)for(var s in t)n[s]=e(t[s]);return n};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))?p(e[0])?s(e,t):function e(t){for(var r=[],n=0;n<t.length;n++){var o=t[n];p(o[0])?r.push(s(o)):r.push(e(o))}return r}(e):[]}function s(e,t){void 0===t&&(t=!0);var r=Number(e[0]);return e=Number(e[1]),t&&r<e?[e,r]:[r,e]}function l(e){return"string"==typeof e?JSON.parse(e):e}function u(e,t,r){var n=[],i=2===(r=void 0===r?[]:r).length;return function e(t,a){var s;t&&a.length&&(s=a.shift(),t.hasOwnProperty(s))&&(t=t[s],Array.isArray(t)?0!==a.length||i?t.forEach((function(t){i?n.push([t[r[0]],t[r[1]]]):e(t,o(a))})):(s=l(t),n.push(s)):"object"==typeof t?0===a.length?n.push(i?[t[r[0]],t[r[1]]]:t):e(t,a):0===a.length&&(s=l(t),n.push(s)))}(e,t),n}function c(e,t){void 0===t&&(t=!1);var r,n,o=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,r,n){return t+t+r+r+n+n}));return(o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o))?(r=parseInt(o[1],16),n=parseInt(o[2],16),o=parseInt(o[3],16),t?[r,n,o,1]:"rgba("+r+","+n+","+o+",1)"):e}function p(e){return"number"==typeof e||!("string"!=typeof e||!e||e.includes(" ")||isNaN(Number(e)))}var h=["customName"],f=function(){function e(e,t,o){var i=this;this._mouseEnter=function(e){var t,r,n;"Map"===e.originalEvent.target.ariaLabel&&(r=e.point,e=e.lngLat,t=(r=null!=(r=i.map.queryRenderedFeatures(r)[0])?r:{}).properties,n=r.geometry,r.source,r=r.layer,i.layerName.includes(r.id)?(r=n.coordinates,n=[e.lng,e.lat],0<(null==(e=n="mouseenter"===i.mouseType?0<r.length&&Array.isArray(r[0])?r[0]:r:n)?void 0:e.length)&&i.popup.setLngLat(n).setHTML(i.htmlCallBack(t,n)).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!=o?o:{}).customName)&&t,e=r(e,h),t=t?"":"commonTooltip ",null!=o&&o.className&&(t+=o.className),this.popup=new mapboxgl.Popup(n({},e,{className:t,closeButton:null!=(e=null==o?void 0:o.closeButton)&&e,closeOnClick:null!=(t=null==o?void 0:o.closeOnClick)&&t,anchor:null!=(e=null==o?void 0:o.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}(),y=["destroyComponent","customClick","popupClose","closeOther","noCloseLayerName","customName","offset","closeClick"],d=function(){function e(e,t,o){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,n,o,a,s,l;"Map"===e.originalEvent.target.ariaLabel&&(i._closeOtherPopup(),t=e.point,e=e.lngLat,r=(o=null!=(o=(s=i.map.queryRenderedFeatures(t))[0])?o:{}).properties,n=o.geometry,o.source,o=o.layer,i.layerName.includes(o.id))&&(i.customClick||(o=n.coordinates,l=n.type,a=(s=null!=(a=null==(a=i.componentCallBack)?void 0:a.call(i,{properties:r,lngLat:e,coordinates:o,feature:s[0]}))?a:{}).component,s=s.instance,l="Point"===l?o: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:n,point:t})},this.map=e,this.popup=null,"string"==typeof t?this.layerName=[t]:Array.isArray(t)&&(this.layerName=t),void 0!==(t=(e=o||{}).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,h=e.closeClick;e=r(e,y),c=c?"":"commonPopup ",null!=o&&o.className&&(c+=o.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(n({},e,{offset:p,className:c,closeButton:null!=(o=null==e?void 0:e.closeButton)&&o,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})),h&&"function"==typeof h&&(this.popup._closeClick=h),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,n){e&&(this._closeOtherPopup(),(r=(null!=r?r:{}).offset)&&this.popup.setOffset(r),this.popup.setLngLat(e).setDOMContent(t).addTo(this.map),n)&&"function"==typeof n&&n()},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}(),m=function(){function e(e,t,r){var n=this,o=(this.clickEvent=function(e){var t=new THREE.Vector2,r=n.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(n.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(n.scene.children,!0),n.callback&&0<r.length&&(t=r[0],e=n.findProperties(t.object),n.callback(e))},this.findProperties=function(e){var t={},r=null;return"Scene"!==e.type&&(r=(e.lngLat?(t=e.properties,e):(t=(e=n.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===(o=t.scale)?1:o),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=o,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:o*this.modelAsMercatorCoordinate.meterInMercatorCoordinateUnits()}}var t=e.prototype;return t.onAdd=function(e,t){var r,n,o=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&&(n=this.AmbientLight.color||16777215,r=this.AmbientLight.intensity||.5,n=new THREE.AmbientLight(n,r),this.scene.add(n)),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(),o.scene.add(t)})),this.PointLight&&Array.isArray(this.PointLight)&&this.PointLight.forEach((function(e){var t=e.color||16777215,r=e.intensity||1,n=e.distance||0,i=e.decay||2;e=e.position||[0,0,0],(t=new THREE.PointLight(t,r,n,i)).position.set(e[0],e[1],e[2]).normalize(),o.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=o.properties,e.scene.children[t].lngLat=o.lngLat;o.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),n=(new THREE.Matrix4).makeRotationAxis(new THREE.Vector3(0,1,0),this.modelTransform.rotateY),o=(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(n).multiply(o),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}(),g=function(){function e(e){this.map=e,this.sourceName=[],this.sourceType="geojson"}var t=e.prototype;return t.draw=function(e,t,r){if(e&&this.map)return"vector"===e.type?(this.sourceName=[t],this.sourceType="vector",this._addSourceLayer(t,e,r),this.sourceName):"FeatureCollection"===e.type||Array.isArray(e.features)?(this.sourceName=[t],this._addSourceLayer(t,e,r),r.lineConfig?[].concat(this.sourceName,[this.lineName]):this.sourceName):void 0},t.destroy=function(){this._clearSource()},t.visible=function(e){var t,r=this;"boolean"==typeof e&&null!=(t=this.sourceName)&&t.forEach((function(t){r.map.getLayer(t)&&r.map.setLayoutProperty(t,"visibility",e?"visible":"none")}))},t._addSourceLayer=function(e,t,r){"vector"===this.sourceType?this.map.addSource(e,n({},t,r.sourceConfig)):this.map.addSource(e,n({type:"geojson",data:t},r.sourceConfig)),t=r.beforeId||null,this.map.addLayer(n({id:e,type:"line",source:e},r.layerConfig),t),r.lineConfig&&(this.lineName=e+"-highlight",this.map.addLayer(n({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}(),v=function(){function e(e){this.map=e,this.sourceName=[],this.type="symbol",this.sourceType="geojson"}var t=e.prototype;return t.draw=function(e,t,r){if(e&&this.map){if("vector"===e.type)return this.sourceType="vector",this._addSourceLayer(t,e,r),this.sourceName=[t],this.sourceName;var n;if("FeatureCollection"===e.type||Array.isArray(e.features)){this.type=null!=(n=r.type)?n:"symbol";var o=r.sliceNum;if(!o||o<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+=o){var s={type:"FeatureCollection",features:[]},l=e.features.slice(a,o);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.visible=function(e){var t,r=this;"boolean"==typeof e&&null!=(t=this.sourceName)&&t.forEach((function(t){r.map.getLayer(t)&&r.map.setLayoutProperty(t,"visibility",e?"visible":"none")}))},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){"vector"===this.sourceType?this.map.addSource(e,n({},t,r.sourceConfig)):this.map.addSource(e,n({type:"geojson",data:t},r.sourceConfig)),t=r.beforeId||null,this.map.addLayer(n({id:e,type:this.type,source:e},r.layerConfig),t)},e}(),b=6371008.8,L={centimeters:100*b,centimetres:100*b,degrees:b/111325,feet:3.28084*b,inches:39.37*b,kilometers:b/1e3,kilometres:b/1e3,meters:b,metres:b,miles:b/1609.344,millimeters:1e3*b,millimetres:1e3*b,nauticalmiles:b/1852,radians:1,yards:1.0936*b};function A(e,t,r){var n={type:"Feature"};return 0!==(r=void 0===r?{}:r).id&&!r.id||(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function E(e,t,r){void 0===r&&(r={});for(var n=0,o=e;n<o.length;n++){var i=o[n];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 A({type:"Polygon",coordinates:e},t,r)}function w(e,t){var r=L[t=void 0===t?"kilometers":t];if(r)return e/r;throw new Error(t+" units is invalid")}function C(e){return e%(2*Math.PI)*180/Math.PI}function N(e){return e%360*Math.PI/180}function S(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function M(e,t,r){if(null!==e)for(var n,o,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,A=!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(n=0;n<b.length;n++){if(!1===t(b[n],a,p,m,g))return!1;a++,"MultiPoint"===L&&m++}"LineString"===L&&m++;break;case"Polygon":case"MultiLineString":for(n=0;n<b.length;n++){for(o=0;o<b[n].length-A;o++){if(!1===t(b[n][o],a,p,m,g))return!1;a++}"MultiLineString"===L&&m++,"Polygon"===L&&g++}"Polygon"===L&&m++;break;case"MultiPolygon":for(n=0;n<b.length;n++){for(o=g=0;o<b[n].length;o++){for(i=0;i<b[n][o].length-A;i++){if(!1===t(b[n][o][i],a,p,m,g))return!1;a++}g++}m++}break;case"GeometryCollection":for(n=0;n<v.geometries.length;n++)if(!1===M(v.geometries[n],t,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}function k(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 P=k.default=k,x=function(e){e=P(e);var t=void 0,r=(void 0===t&&(t={}),Number(e[0])),n=Number(e[1]),o=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,n];return E([[a,[o,n],[o,i],[r,i],a]],t.properties,{bbox:e,id:t.id})};function I(e,t,r,n){void 0===n&&(n={});var o=N((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=N(e[1]),r=N(r),t=w(t,n.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(S(e[0])&&S(e[1]))return A({type:"Point",coordinates:e},t,r);throw new Error("coordinates must contain numbers")}([C(o+Math.atan2(Math.sin(r)*Math.sin(t)*Math.cos(e),Math.cos(t)-Math.sin(e)*Math.sin(i))),C(i)],n.properties)}const _=function(e,t,r){for(var n=(r=void 0===r?{}:r).steps||64,o=r.properties||(!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{}),i=[],a=0;a<n;a++)i.push(I(e,t,-360*a/n,r).geometry.coordinates);return i.push(i[0]),E([i],o)};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 n,o=null!=r?r:{},i=void 0===(n=o.radius)?0:n,a=void 0===(n=o.steps)?64:n,s=o.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=_(m,h,f),s?(d=!1,d=0<(d=(d="string"==typeof s||d)?u[c].properties[s]:s)?d:0,m=_(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,n({type:"geojson",data:t},r.sourceConfig)),t=(null!=r?r:{}).beforeId,this.map.addLayer(n({id:e,type:"fill",source:e},r.layerConfig),t),r.lineConfig&&(this.lineName=e+"-line",this.map.addLayer(n({id:this.lineName,type:"line",source:e},r.lineConfig),t))},t.destroy=function(){this._clearSource()},t.visible=function(e){var t,r=this;"boolean"==typeof e&&null!=(t=this.sourceName)&&t.forEach((function(t){r.map.getLayer(t)&&r.map.setLayoutProperty(t,"visibility",e?"visible":"none")}))},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}(),j=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 n,o=function(t){var n,o;r.event.push(t),0<(null==(o=r.name)?void 0:o.length)?null!=(o=r.name)&&o.forEach((function(n){function o(r){var n;"Map"===(null==r||null==(n=r.originalEvent)||null==(n=n.target)?void 0:n.ariaLabel)&&e[t](r)}var i;r[t]=o,null!=(i=r.map)&&i.on(t,n,o)})):(r[t]=o=function(r){var n;"Map"===(null==r||null==(n=r.originalEvent)||null==(n=n.target)?void 0:n.ariaLabel)&&e[t](r)},null!=(n=r.map)&&n.on(t,o))};for(n in e)o(n)}},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 n,o;r.event.includes(e)&&(o=r[e],null!=(n=r.map))&&n.off(e,t,o)}))})):0<(null==(t=this.name)?void 0:t.length)?null!=(t=this.name)&&t.forEach((function(e){r.event.forEach((function(t){var n,o=r[t];null!=(n=r.map)&&n.off(t,e,o)}))})):this.event.forEach((function(e){var t,n=r[e];null!=(t=r.map)&&t.off(e,n)}))},e}(),R=["id","type"],O=["id","type","beforeId"],B=function(){function e(e){this.map=e,this.sourceName=[]}var t=e.prototype;return t.draw=function(e,t){var o,a,s,l,u=this;return i(e)?(o=(a=null!=(a=t.sourceConfig)?a:{}).id,l=void 0===(l=a.type)?"geojson":l,a=r(a,R),s=o,this.map.addSource(o,n({type:l,data:e},a)),l=null!=(o=t.layerConfig)?o:{},e=[],Array.isArray(l)?e=l:"object"==typeof l&&e.push(l),e.forEach((function(e){var t=e.id,o=e.type,i=e.beforeId;e=r(e,O),u.map.addLayer(n({id:t,type:o,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))))},t.visible=function(e){var t,r=this;"boolean"==typeof e&&null!=(t=this.sourceName)&&t.forEach((function(t){r.map.getLayer(t)&&r.map.setLayoutProperty(t,"visibility",e?"visible":"none")}))},e}(),F=function(){function e(t,r,o){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=n({},i,r)),this.name=t,this.layers=i,this.prop=null!=o?o:{},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 H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var G=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,o=null!=(r=this.options)?r:{},a=0,s=function(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){var r;if(e)return"string"==typeof e?H(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)?H(e,t):void 0}(e)))return n&&(e=n),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);!(c=s()).done;){var l,u,c=c.value;"Point"===c.geometry.type&&(l=o,t&&"function"==typeof t&&1===(null==(u=t({lngLat:c.geometry.coordinates,properties:c.properties,index:a}))?void 0:u.nodeType)&&(l=n({},l,{element:u})),u=new mapboxgl.Marker(l).setLngLat(c.geometry.coordinates).addTo(this.map),this.markers.push(u),this.properties.push(c.properties),a++)}},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(o){e[o]&&"function"==typeof e[o]&&t.markers[r].on(o,(function(i){e[o](n({},i,{properties:t.properties[r]}))}))}))}(r)},t.destroy=function(){for(var e=0;e<this.markers.length;e++)this.markers[e].remove();this.markers=[]},t.visible=function(e){var t;"boolean"==typeof e&&null!=(t=this.markers)&&t.forEach((function(t){t.getElement().style.display=e?"block":"none"}))},e}(),D=function(){function e(e,t,r){var n;r=null!=(n=r)?n:{},this.map=e,this.name=t,this.dash=Array.isArray(r.dash)?r.dash:[[0,4,3],[.5,4,2.5],[1,4,2],[1.5,4,1.5],[2,4,1],[2.5,4,.5],[3,4,0],[0,.5,3,3.5],[0,1,3,3],[0,1.5,3,2.5],[0,2,3,2],[0,2.5,3,1.5],[0,3,3,1],[0,3.5,3,.5]],this.step=null!=(n=r.step)?n:50,this.animateId=null}var t=e.prototype;return t.animate=function(){var e,t=this;this.name&&this.map.getLayer(this.name)&&function r(n){(n=parseInt(n/t.step%t.dash.length))!==e&&(t.map.setPaintProperty(t.name,"line-dasharray",t.dash[e]),e=n),t.animateId=requestAnimationFrame(r)}(e=0)},t.destroy=function(){this.animateId&&(cancelAnimationFrame(this.animateId),this.animateId=null)},e}(),z=["padding","animate","maxZoom","essential"],J=["url"],q=null,U=null;return t})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zh-mapbox",
3
- "version": "0.0.76",
3
+ "version": "0.0.86",
4
4
  "description": "mapbox的常用方法",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",