@mapgis/webclient-mapboxgl-plugin 17.6.0 → 17.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){var t={};function i(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(r,a,function(t){return e[t]}.bind(null,a));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=3)}([function(e,t){e.exports=function(){try{return window.MapGISCommon}catch(e){return{}}}()},function(e,t){e.exports=mapboxgl},function(e,t,i){e.exports=function(){"use strict";Object.freeze=function(e){return e};var e=Object.create||function(){function e(){}return function(t){return e.prototype=t,new e}}(),t=/\{ *([\w_-]+) *\}/g,i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=3.141592653589793,a=6378245,n=.006693421622965943,s=3e3*r/180;function o(e,t,i){var a=r/180*t,n=Math.pow(2,i);return[parseInt((e+180)/360*n),parseInt((1-Math.asinh(Math.tan(a))/r)/2*n)]}function l(e,t){if(i(e)){var r=e[0];t=e[1],e=r}e instanceof Object&&(r=e.lng,t=e.lat,e=r);var a,n,o,l,c,h,p=(a=e-.0065,n=t-.006,o=Math.sqrt(a*a+n*n)-2e-5*Math.sin(n*s),l=Math.atan2(n,a)-3e-6*Math.cos(a*s),c=o*Math.cos(l),h=o*Math.sin(l),{lng:c,lat:h});return u(p.lng,p.lat)}function c(e,t){if(i(e)){var r=e[0];t=e[1],e=r}e instanceof Object&&(r=e.lng,t=e.lat,e=r);var a,n,o,l,c,u,p=h(e,t);return a=p.lng,n=p.lat,o=Math.sqrt(a*a+n*n)+2e-5*Math.sin(n*s),l=Math.atan2(n,a)+3e-6*Math.cos(a*s),c=o*Math.cos(l)+.0065,u=o*Math.sin(l)+.006,{lng:c,lat:u}}function h(e,t){if(i(e)){var s=e[0];t=e[1],e=s}e instanceof Object&&(s=e.lng,t=e.lat,e=s);var o=p(e-105,t-35),l=d(e-105,t-35),c=t/180*r,h=Math.sin(c);h=1-n*h*h;var u=Math.sqrt(h);return o=180*o/(a*(1-n)/(h*u)*r),{lng:e+(l=180*l/(a/u*Math.cos(c)*r)),lat:t+o}}function u(e,t){if(i(e)){var s=e[0];t=e[1],e=s}e instanceof Object&&(s=e.lng,t=e.lat,e=s);var o=function(e,t){var i=p(e-105,t-35),s=d(e-105,t-35),o=t/180*r,l=Math.sin(o);l=1-n*l*l;var c=Math.sqrt(l);return i=180*i/(a*(1-n)/(l*c)*r),s=180*s/(a/c*Math.cos(o)*r),{lng:e+s,lat:t+i}}(e,t);return{lng:2*e-o.lng,lat:2*t-o.lat}}function p(e,t){var i=2*e-100+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*r)+20*Math.sin(2*e*r))/3,i+=2*(20*Math.sin(t*r)+40*Math.sin(t/3*r))/3,i+=2*(160*Math.sin(t/12*r)+320*Math.sin(t*r/30))/3}function d(e,t){var i=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*r)+20*Math.sin(2*e*r))/3,i+=2*(20*Math.sin(e*r)+40*Math.sin(e/3*r))/3,i+=2*(150*Math.sin(e/12*r)+300*Math.sin(e/30*r))/3}function y(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function m(e){return"string"==typeof e}var f=void 0,g=null;function v(e,t){isNaN(e)&&(e=Ib(e),e=isNaN(e)?0:e),m(e)&&(e=parseFloat(e)),isNaN(t)&&(t=Ib(t),t=isNaN(t)?0:t),m(t)&&(t=parseFloat(t)),this.lng=e,this.lat=t}function b(e,t){this.x=e||0,this.y=t||0,this.x=this.x,this.y=this.y}function _(){}function S(){}v.TL=function(e){return e&&180>=e.lng&&-180<=e.lng&&74>=e.lat&&-74<=e.lat},v.prototype.lb=function(e){return e&&this.lat==e.lat&&this.lng==e.lng},b.prototype.lb=function(e){return e&&e.x==this.x&&e.y==this.y},_.prototype.nh=function(){aa("lngLatToPoint方法未实现")},_.prototype.wi=function(){aa("pointToLngLat方法未实现")},S.prototype=new _,y(S,{$O:6370996.81,lG:[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],Au:[75,60,45,30,15,0],fP:[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],iG:[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],Z1:function(e,t){return e&&t&&(e=this.Fb(e))?(i=this.Tk(e.lng),r=this.Tk(e.lat),(t=this.Fb(t))?this.Pe(i,this.Tk(t.lng),r,this.Tk(t.lat)):0):0;var i,r},Vo:function(e,t){return e&&t?(e.lng=this.JD(e.lng,-180,180),e.lat=this.ND(e.lat,-74,74),t.lng=this.JD(t.lng,-180,180),t.lat=this.ND(t.lat,-74,74),this.Pe(this.Tk(e.lng),this.Tk(t.lng),this.Tk(e.lat),this.Tk(t.lat))):0},Fb:function(e){if(e===g||e===f)return new v(0,0);var t,i;t=new v(Math.abs(e.lng),Math.abs(e.lat));for(var r=0;r<this.lG.length;r++)if(t.lat>=this.lG[r]){i=this.fP[r];break}return new v((e=this.gK(e,i)).lng.toFixed(6),e.lat.toFixed(6))},Eb:function(e){if(e===g||e===f||180<e.lng||-180>e.lng||90<e.lat||-90>e.lat)return new v(0,0);var t,i;e.lng=this.JD(e.lng,-180,180),e.lat=this.ND(e.lat,-74,74),t=new v(e.lng,e.lat);for(var r=0;r<this.Au.length;r++)if(t.lat>=this.Au[r]){i=this.iG[r];break}if(!i)for(r=0;r<this.Au.length;r++)if(t.lat<=-this.Au[r]){i=this.iG[r];break}return new v((e=this.gK(e,i)).lng.toFixed(2),e.lat.toFixed(2))},gK:function(e,t){if(e&&t){var i=t[0]+t[1]*Math.abs(e.lng),r=Math.abs(e.lat)/t[9];return r=t[2]+t[3]*r+t[4]*r*r+t[5]*r*r*r+t[6]*r*r*r*r+t[7]*r*r*r*r*r+t[8]*r*r*r*r*r*r,new v(i*=0>e.lng?-1:1,r*=0>e.lat?-1:1)}},Pe:function(e,t,i,r){return this.$O*Math.acos(Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos(t-e))},Tk:function(e){return Math.PI*e/180},Z3:function(e){return 180*e/Math.PI},ND:function(e,t,i){return t!=g&&(e=Math.max(e,t)),i!=g&&(e=Math.min(e,i)),e},JD:function(e,t,i){for(;e>i;)e-=i-t;for(;e<t;)e+=i-t;return e}}),y(S.prototype,{Jm:function(e){return S.Eb(e)},nh:function(e){return new b((e=S.Eb(e)).lng,e.lat)},qh:function(e){return S.Fb(e)},wi:function(e){return e=new v(e.x,e.y),S.Fb(e)},fc:function(e,t,i,r,a){if(e)return e=this.Jm(e,a),t=this.Lc(t),new b(Math.round((e.lng-i.lng)/t+r.width/2),Math.round((i.lat-e.lat)/t+r.height/2))},zb:function(e,t,i,r,a){if(e)return t=this.Lc(t),this.qh(new v(i.lng+t*(e.x-r.width/2),i.lat-t*(e.y-r.height/2)),a)},Lc:function(e){return Math.pow(2,18-e)}});var w=S.prototype;!function(e,t){for(var i in t)e[i]=t[i]}(w,{lngLatToPoint:w.nh,pointToLngLat:w.wi});let x={Point:v,Pixel:b,MercatorProjection:S};class L{constructor(e,t){this.levelMax=e,this.levelMin=t,this.projection=new x.MercatorProjection}_getRetain(e){return Math.pow(2,e-18)}getResolution(e,t){return Math.pow(2,18-t)*Math.cos(e)}lnglatToPoint(e,t){let i=new x.Point(e,t),r=this.projection.lngLatToPoint(i);return{pointX:r.x,pointY:r.y}}pointToLnglat(e,t){let i=new x.Pixel(e,t),r=this.projection.pointToLngLat(i);return{lng:r.lng,lat:r.lat}}_lngToTileX(e,t){let i=this.lnglatToPoint(e,0);return Math.floor(i.pointX*this._getRetain(t)/256)}_latToTileY(e,t){let i=this.lnglatToPoint(0,e);return Math.floor(i.pointY*this._getRetain(t)/256)}lnglatToTile(e,t,i){return[this._lngToTileX(e,i),this._latToTileY(t,i)]}_lngToPixelX(e,t){let i=this._lngToTileX(e,t),r=this.lnglatToPoint(e,0);return Math.floor(r.pointX*this._getRetain(t)-256*i)}_latToPixelY(e,t){let i=this._latToTileY(e,t),r=this.lnglatToPoint(0,e);return Math.floor(r.pointY*this._getRetain(t)-256*i)}lnglatToPixel(e,t,i){return{pixelX:this._lngToPixelX(e,i),pixelY:this._latToPixelY(t,i)}}_pixelXToLng(e,t,i){let r=(256*t+e)/this._getRetain(i);return this.pointToLnglat(r,0).lng}_pixelYToLat(e,t,i){let r=(256*t+e)/this._getRetain(i);return this.pointToLnglat(0,r).lat}pixelToLnglat(e,t,i,r,a){let n=(256*i+e)/this._getRetain(a),s=(256*r+t)/this._getRetain(a),o=this.pointToLnglat(n,s);return[o.lng,o.lat]}}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(e){"@babel/helpers - typeof";return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(e){var t=function(e,t){if("object"!=T(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==T(t)?t:t+""}function P(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,V(r.key),r)}}function k(e,t,i){return t&&P(e.prototype,t),i&&P(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t){return(C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,a,n,s,o=[],l=!0,c=!1;try{if(n=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(r=n.call(i)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?j(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var A,z=1e-6,R="undefined"!=typeof Float32Array?Float32Array:Array;function D(e,t){var i,r,a,n,s,o,l,c=(i=[],a=e,n=(r=t)[0],s=r[1],o=r[2],l=r[3],i[0]=a[0]*n+a[4]*s+a[8]*o+a[12]*l,i[1]=a[1]*n+a[5]*s+a[9]*o+a[13]*l,i[2]=a[2]*n+a[6]*s+a[10]*o+a[14]*l,i[3]=a[3]*n+a[7]*s+a[11]*o+a[15]*l,i);return function(e,t,i){e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i}(c,c,1/c[3]),c}function G(e,t,i){var r=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],u=t[8],p=t[9],d=t[10],y=t[11],m=t[12],f=t[13],g=t[14],v=t[15],b=i[0],_=i[1],S=i[2],w=i[3];return e[0]=b*r+_*o+S*u+w*m,e[1]=b*a+_*l+S*p+w*f,e[2]=b*n+_*c+S*d+w*g,e[3]=b*s+_*h+S*y+w*v,b=i[4],_=i[5],S=i[6],w=i[7],e[4]=b*r+_*o+S*u+w*m,e[5]=b*a+_*l+S*p+w*f,e[6]=b*n+_*c+S*d+w*g,e[7]=b*s+_*h+S*y+w*v,b=i[8],_=i[9],S=i[10],w=i[11],e[8]=b*r+_*o+S*u+w*m,e[9]=b*a+_*l+S*p+w*f,e[10]=b*n+_*c+S*d+w*g,e[11]=b*s+_*h+S*y+w*v,b=i[12],_=i[13],S=i[14],w=i[15],e[12]=b*r+_*o+S*u+w*m,e[13]=b*a+_*l+S*p+w*f,e[14]=b*n+_*c+S*d+w*g,e[15]=b*s+_*h+S*y+w*v,e}function N(e,t,i){var r,a,n,s,o,l,c,h,u,p,d,y,m=i[0],f=i[1],g=i[2];return t===e?(e[12]=t[0]*m+t[4]*f+t[8]*g+t[12],e[13]=t[1]*m+t[5]*f+t[9]*g+t[13],e[14]=t[2]*m+t[6]*f+t[10]*g+t[14],e[15]=t[3]*m+t[7]*f+t[11]*g+t[15]):(r=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],u=t[8],p=t[9],d=t[10],y=t[11],e[0]=r,e[1]=a,e[2]=n,e[3]=s,e[4]=o,e[5]=l,e[6]=c,e[7]=h,e[8]=u,e[9]=p,e[10]=d,e[11]=y,e[12]=r*m+o*f+u*g+t[12],e[13]=a*m+l*f+p*g+t[13],e[14]=n*m+c*f+d*g+t[14],e[15]=s*m+h*f+y*g+t[15]),e}function F(e,t,i){var r=i[0],a=i[1],n=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),A=new R(4),R!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0,A[3]=0);var B=function(e,t,i,r,a){var n,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(n=1/(r-a),e[10]=(a+r)*n,e[14]=2*a*r*n):(e[10]=-1,e[14]=-2*r),e};function U(e,t){var i=e[0],r=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],y=e[12],m=e[13],f=e[14],g=e[15],v=t[0],b=t[1],_=t[2],S=t[3],w=t[4],x=t[5],L=t[6],M=t[7],T=t[8],V=t[9],P=t[10],k=t[11],O=t[12],E=t[13],C=t[14],j=t[15];return Math.abs(i-v)<=z*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(r-b)<=z*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(a-_)<=z*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(n-S)<=z*Math.max(1,Math.abs(n),Math.abs(S))&&Math.abs(s-w)<=z*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(o-x)<=z*Math.max(1,Math.abs(o),Math.abs(x))&&Math.abs(l-L)<=z*Math.max(1,Math.abs(l),Math.abs(L))&&Math.abs(c-M)<=z*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(h-T)<=z*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(u-V)<=z*Math.max(1,Math.abs(u),Math.abs(V))&&Math.abs(p-P)<=z*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(d-k)<=z*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(y-O)<=z*Math.max(1,Math.abs(y),Math.abs(O))&&Math.abs(m-E)<=z*Math.max(1,Math.abs(m),Math.abs(E))&&Math.abs(f-C)<=z*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(g-j)<=z*Math.max(1,Math.abs(g),Math.abs(j))}function Z(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function $(e,t){if(!e)throw new Error(t||"viewport-mercator-project: assertion failed.")}!function(){var e;e=new R(2),R!=Float32Array&&(e[0]=0,e[1]=0)}(),function(){var e;e=new R(3),R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0)}();var q=Math.PI,K=q/4,W=q/180,J=180/q,X=512,Y=4003e4,H=1.5;function Q(e){return Math.pow(2,e)}function ee(e,t){var i=I(e,2),r=i[0],a=i[1];$(Number.isFinite(r)&&Number.isFinite(t)),$(Number.isFinite(a)&&a>=-90&&a<=90,"invalid latitude");var n=a*W;return[(t*=X)*(r*W+q)/(2*q),t*(q-Math.log(Math.tan(K+.5*n)))/(2*q)]}function te(e,t){var i=I(e,2),r=i[0],a=i[1],n=r/(t*=X)*(2*q)-q,s=2*(Math.atan(Math.exp(q-a/t*(2*q)))-K);return[n*J,s*J]}function ie(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=I(e,3),a=r[0],n=r[1],s=r[2];if($(Number.isFinite(a)&&Number.isFinite(n),"invalid pixel coordinate"),Number.isFinite(s))return D(t,[a,n,s,1]);var o=D(t,[a,n,0,1]),l=D(t,[a,n,1,1]),c=o[2],h=l[2];return function(e,t,i,r){var a=t[0],n=t[1];return e[0]=a+r*(i[0]-a),e[1]=n+r*(i[1]-n),e}([],o,l,c===h?0:((i||0)-c)/(h-c))}var re=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],ae=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.width,r=t.height,a=t.viewMatrix,n=void 0===a?re:a,s=t.projectionMatrix,o=void 0===s?re:s;M(this,e),this.width=i||1,this.height=r||1,this.scale=1,this.pixelsPerMeter=1,this.viewMatrix=n,this.projectionMatrix=o;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];G(l,l,this.projectionMatrix),G(l,l,this.viewMatrix),this.viewProjectionMatrix=l;var c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];F(c,c,[this.width/2,-this.height/2,1]),N(c,c,[1,-1,0]),G(c,c,this.viewProjectionMatrix);var h,u,p,d,y,m,f,g,v,b,_,S,w,x,L,T,V,P,k,O,E,C,j,I,A,z,R,D,B,U,Z,$=(h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],p=(u=c)[0],(Z=(k=p*(g=u[5])-(d=u[1])*(f=u[4]))*(U=(w=u[10])*(P=u[15])-(x=u[11])*(V=u[14]))-(O=p*(v=u[6])-(y=u[2])*f)*(B=(S=u[9])*P-x*(T=u[13]))+(E=p*(b=u[7])-(m=u[3])*f)*(D=S*V-w*T)+(C=d*v-y*g)*(R=(_=u[8])*P-x*(L=u[12]))-(j=d*b-m*g)*(z=_*V-w*L)+(I=y*b-m*v)*(A=_*T-S*L))?(Z=1/Z,h[0]=(g*U-v*B+b*D)*Z,h[1]=(y*B-d*U-m*D)*Z,h[2]=(T*I-V*j+P*C)*Z,h[3]=(w*j-S*I-x*C)*Z,h[4]=(v*R-f*U-b*z)*Z,h[5]=(p*U-y*R+m*z)*Z,h[6]=(V*E-L*I-P*O)*Z,h[7]=(_*I-w*E+x*O)*Z,h[8]=(f*B-g*R+b*A)*Z,h[9]=(d*R-p*B-m*A)*Z,h[10]=(L*j-T*E+P*k)*Z,h[11]=(S*E-_*j-x*k)*Z,h[12]=(g*z-f*D-v*A)*Z,h[13]=(p*D-d*z+y*A)*Z,h[14]=(T*O-L*C-V*k)*Z,h[15]=(_*C-S*O+w*k)*Z,h):null);if(!$)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=c,this.pixelUnprojectionMatrix=$,this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}return k(e,[{key:"equals",value:function(t){return t instanceof e&&t.width===this.width&&t.height===this.height&&U(t.projectionMatrix,this.projectionMatrix)&&U(t.viewMatrix,this.viewMatrix)}},{key:"project",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).topLeft,i=void 0===t||t,r=function(e,t){var i=I(e,3),r=i[0],a=i[1],n=i[2],s=void 0===n?0:n;return $(Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(s)),D(t,[r,a,s,1])}(this.projectPosition(e),this.pixelProjectionMatrix),a=I(r,2),n=a[0],s=a[1],o=i?s:this.height-s;return 2===e.length?[n,o]:[n,o,r[2]]}},{key:"unproject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.topLeft,r=void 0===i||i,a=t.targetZ,n=I(e,3),s=n[0],o=n[1],l=n[2],c=r?o:this.height-o,h=a&&a*this.pixelsPerMeter,u=ie([s,c,l],this.pixelUnprojectionMatrix,h),p=I(this.unprojectPosition(u),3),d=p[0],y=p[1],m=p[2];return Number.isFinite(l)?[d,y,m]:Number.isFinite(a)?[d,y,a]:[d,y]}},{key:"projectPosition",value:function(e){var t=I(this.projectFlat(e),2);return[t[0],t[1],(e[2]||0)*this.pixelsPerMeter]}},{key:"unprojectPosition",value:function(e){var t=I(this.unprojectFlat(e),2);return[t[0],t[1],(e[2]||0)/this.pixelsPerMeter]}},{key:"projectFlat",value:function(e){return arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scale,e}},{key:"unprojectFlat",value:function(e){return arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scale,e}}]),e}(),ne=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.width,a=i.height,n=i.latitude,s=void 0===n?0:n,o=i.longitude,l=void 0===o?0:o,c=i.zoom,h=void 0===c?0:c,u=i.pitch,p=void 0===u?0:u,d=i.bearing,y=void 0===d?0:d,m=i.altitude,f=void 0===m?1.5:m,g=i.nearZMultiplier,v=i.farZMultiplier;M(this,t),r=r||1,a=a||1;var b=Q(h);f=Math.max(.75,f);var _=ee([l,s],b);_[2]=0;var S=function(e){var t=e.width,i=e.height,r=e.pitch,a=function(e){var t=e.width,i=e.height,r=e.altitude,a=void 0===r?H:r,n=e.pitch,s=void 0===n?0:n,o=e.nearZMultiplier,l=void 0===o?1:o,c=e.farZMultiplier,h=void 0===c?1:c,u=s*W,p=Math.atan(.5/a),d=Math.sin(p)*a/Math.sin(Math.PI/2-u-p),y=Math.cos(Math.PI/2-u)*d+a;return{fov:2*Math.atan(i/2/a),aspect:t/i,focalDistance:a,near:l,far:y*h}}({width:t,height:i,altitude:e.altitude,pitch:r,nearZMultiplier:e.nearZMultiplier,farZMultiplier:e.farZMultiplier}),n=a.fov,s=a.aspect,o=a.near,l=a.far;return B([],n,s,o,l)}({width:r,height:a,pitch:p,bearing:y,altitude:f,nearZMultiplier:g||1/a,farZMultiplier:v||1.01}),w=function(e){var t,i,r,a,n,s,o,l,c,h,u,p,d,y=e.height,m=e.pitch,f=e.bearing,g=e.altitude,v=e.center,b=void 0===v?null:v,_=e.flipY,S=void 0!==_&&_,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return N(w,w,[0,0,-g]),F(w,w,[1,1,1/y]),t=w,i=w,r=-m*W,a=Math.sin(r),n=Math.cos(r),s=i[4],o=i[5],l=i[6],c=i[7],h=i[8],u=i[9],p=i[10],d=i[11],i!==t&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[4]=s*n+h*a,t[5]=o*n+u*a,t[6]=l*n+p*a,t[7]=c*n+d*a,t[8]=h*n-s*a,t[9]=u*n-o*a,t[10]=p*n-l*a,t[11]=d*n-c*a,function(e,t,i){var r=Math.sin(i),a=Math.cos(i),n=t[0],s=t[1],o=t[2],l=t[3],c=t[4],h=t[5],u=t[6],p=t[7];t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a+c*r,e[1]=s*a+h*r,e[2]=o*a+u*r,e[3]=l*a+p*r,e[4]=c*a-n*r,e[5]=h*a-s*r,e[6]=u*a-o*r,e[7]=p*a-l*r}(w,w,f*W),S&&F(w,w,[1,-1,1]),b&&N(w,w,function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}([],b)),w}({height:a,center:_,pitch:p,bearing:y,altitude:f,flipY:!0});return(e=function(e,t){if(t&&("object"==T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}(this,E(t).call(this,{width:r,height:a,viewMatrix:w,projectionMatrix:S}))).latitude=s,e.longitude=l,e.zoom=h,e.pitch=p,e.bearing=y,e.altitude=f,e.scale=b,e.center=_,e.pixelsPerMeter=function(e){var t=e.latitude,i=e.longitude,r=e.zoom,a=e.scale,n=e.highPrecision,s=void 0!==n&&n;a=void 0!==a?a:Q(r),$(Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(a));var o={},l=X*a,c=Math.cos(t*W),h=l/360,u=h/c,p=l/Y/c;if(o.pixelsPerMeter=[p,-p,p],o.metersPerPixel=[1/p,-1/p,1/p],o.pixelsPerDegree=[h,-u,p],o.degreesPerPixel=[1/h,-1/u,1/p],s){var d=W*Math.tan(t*W)/c,y=h*d/2,m=l/Y*d,f=m/u*p;o.pixelsPerDegree2=[0,-y,m],o.pixelsPerMeter2=[f,0,f]}return o}(O(O(e))).pixelsPerMeter[2],Object.freeze(O(O(e))),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&C(e,t)}(t,ae),k(t,[{key:"projectFlat",value:function(e){return ee(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scale)}},{key:"unprojectFlat",value:function(e){return te(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scale)}},{key:"getMapCenterByLngLatPosition",value:function(e){var t,i,r=e.lngLat,a=ie(e.pos,this.pixelUnprojectionMatrix),n=Z([],ee(r,this.scale),((t=[])[0]=-(i=a)[0],t[1]=-i[1],t));return te(Z([],this.center,n),this.scale)}},{key:"getLocationAtPoint",value:function(e){var t=e.lngLat,i=e.pos;return this.getMapCenterByLngLatPosition({lngLat:t,pos:i})}},{key:"fitBounds",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.width,a=this.height,n=function(e){var t=e.width,i=e.height,r=e.bounds,a=e.minExtent,n=void 0===a?0:a,s=e.maxZoom,o=void 0===s?24:s,l=e.padding,c=void 0===l?0:l,h=e.offset,u=void 0===h?[0,0]:h,p=I(r,2),d=I(p[0],2),y=d[0],m=d[1],f=I(p[1],2),g=f[0],v=f[1];Number.isFinite(c)?c={top:c,bottom:c,left:c,right:c}:$(Number.isFinite(c.top)&&Number.isFinite(c.bottom)&&Number.isFinite(c.left)&&Number.isFinite(c.right));var b=new ne({width:t,height:i,longitude:0,latitude:0,zoom:0}),_=b.project([y,v]),S=b.project([g,m]),w=[Math.max(Math.abs(S[0]-_[0]),n),Math.max(Math.abs(S[1]-_[1]),n)],x=[t-c.left-c.right-2*Math.abs(u[0]),i-c.top-c.bottom-2*Math.abs(u[1])];$(x[0]>0&&x[1]>0);var L=x[0]/w[0],M=x[1]/w[1],T=(c.right-c.left)/2/L,V=(c.bottom-c.top)/2/M,P=[(S[0]+_[0])/2+T,(S[1]+_[1])/2+V],k=b.unproject(P),O=b.zoom+Math.log2(Math.abs(Math.min(L,M)));return{longitude:k[0],latitude:k[1],zoom:Math.min(O,o)}}(Object.assign({width:r,height:a,bounds:e},i));return new t({width:r,height:a,longitude:n.longitude,latitude:n.latitude,zoom:n.zoom})}}]),t}();class se{constructor(t,i,r){r=r||{},this.id=t,this.type="custom",this.renderingMode="2d",this.url=i,this.options={subdomains:null,visible:void 0===r.visible||r.visible,opacity:void 0!==r.opacity?r.opacity:1,minZoom:3,maxZoom:18,tileType:"xyz"},function(t,i){for(var r in t.hasOwnProperty("options")||(t.options=t.options?e(t.options):{}),i)t.options[r]=i[r]||t.options[r];t.options}(this,r),this.program,this.showTiles=[],this.tileCache={},this.gridCache={},this.matrix,this.map,this.isLayerShow,this.transformBaidu=new L}onAdd(e,t){this.map=e,this.isEPSG4326="EPSG:4326"===e.crs.getEpsgCode();var i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,"uniform mat4 u_custom_matrix;uniform vec4 u_center_pos;attribute vec4 a_Pos_Piexl;attribute vec2 a_TextCoord_Piexl;varying vec2 v_TextCoord;vec2 translateRelativeToEye(vec2 high, vec2 low) { vec2 highDiff = high - vec2(u_center_pos.x, u_center_pos.z); vec2 lowDiff = low - vec2(u_center_pos.y, u_center_pos.w); return highDiff + lowDiff;}void main() { vec2 eye_offset = translateRelativeToEye(vec2(a_Pos_Piexl.x, a_Pos_Piexl.z), vec2(a_Pos_Piexl.y, a_Pos_Piexl.w)); gl_Position = u_custom_matrix * vec4(eye_offset, 0.0, 1.0); v_TextCoord = a_TextCoord_Piexl;}"),t.compileShader(i);var r=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(r,"precision mediump float;uniform sampler2D u_Sampler; varying vec2 v_TextCoord; uniform vec2 u_viewport_size;uniform float u_opacity;void main() { vec4 color = texture2D(u_Sampler, v_TextCoord); color *= u_opacity; gl_FragColor = color;}"),t.compileShader(r),this.program=t.createProgram(),t.attachShader(this.program,i),t.attachShader(this.program,r),t.linkProgram(this.program),this.a_Pos_Piexl=t.getAttribLocation(this.program,"a_Pos_Piexl"),this.a_TileZoomScale=t.getAttribLocation(this.program,"a_TileZoomScale"),this.a_TextCoord_Piexl=t.getAttribLocation(this.program,"a_TextCoord_Piexl"),this.isLayerShow=!0,e.on("move",()=>{this.isLayerShow&&this.update(t,e)}),this.update(t,e),this.map=e}update(e,t){if(this.options.visible){var i,r,a,n=t.getCenter(),s=t.getBounds();if("xyz"===this.options.tileType){i=parseInt(t.getZoom()+1.4);var l=h(s.getNorthWest()),u=h(s.getSouthEast());r=o(l.lng,l.lat,i),a=o(u.lng,u.lat,i)}else if("bd09"===this.options.tileType){i=parseInt(t.getZoom()+1.8);var p=c(s.getSouthWest()),d=c(s.getNorthEast());r=this.transformBaidu.lnglatToTile(p.lng,p.lat,i),a=this.transformBaidu.lnglatToTile(d.lng,d.lat,i)}for(var y=[],m=r[0];m<=a[0];m++)for(var f=r[1];f<=a[1];f++){var g={x:m,y:f,z:i};i<this.options.minZoom||i>this.options.maxZoom||(y.push(g),this.addGridCache(g,0,0),m===a[0]&&this.addGridCache(g,1,0),f===a[1]&&this.addGridCache(g,0,1),m===a[0]&&f===a[1]&&this.addGridCache(g,1,1))}if("xyz"===this.options.tileType)var v=o(n.lng,n.lat,i);else"bd09"===this.options.tileType&&(v=this.transformBaidu.lnglatToTile(n.lng,n.lat,i));for(var g of(y.sort((e,t)=>this.tileDistance(e,v)-this.tileDistance(t,v)),this.showTiles=[],y))if(this.tileCache[this.createTileKey(g)])this.showTiles.push(this.tileCache[this.createTileKey(g)]);else{var b=this.createTile(e,g);this.showTiles.push(b),this.tileCache[this.createTileKey(g)]=b}}}addGridCache(e,t,i){var a=this.createTileKey(e.x+t,e.y+i,e.z);this.gridCache[a]||("xyz"===this.options.tileType?this.gridCache[a]=u(function(e,t,i){let a=Math.pow(2,i);return[e/a*360-180,180*Math.atan(Math.sinh(r*(1-2*t/a)))/r]}(e.x+t,e.y+i,e.z)):"bd09"===this.options.tileType&&(this.gridCache[a]=l(this.transformBaidu.pixelToLnglat(0,0,e.x+t,e.y+i,e.z))))}tileDistance(e,t){return Math.sqrt(Math.pow(e.x-t[0],2)+Math.pow(e.y-t[1],2))}createTileKey(e,t,i){return e instanceof Object?e.z+"/"+e.x+"/"+e.y:i+"/"+e+"/"+t}createTile(e,i){var r,a,n,s,o,l,c=(r=this.url,a={s:this.options.subdomains[Math.abs(i.x+i.y)%this.options.subdomains.length],x:i.x,y:i.y,z:i.z},r.replace(t,function(e,t){var i=a[t];if(void 0===i)throw new Error("No value provided for variable "+e);return"function"==typeof i&&(i=i(a)),i})),h={xyz:i};"xyz"===this.options.tileType?(n=this.gridCache[this.createTileKey(i)],s=this.gridCache[this.createTileKey(i.x+1,i.y,i.z)],o=this.gridCache[this.createTileKey(i.x,i.y+1,i.z)],l=this.gridCache[this.createTileKey(i.x+1,i.y+1,i.z)]):"bd09"===this.options.tileType&&(n=this.gridCache[this.createTileKey(i.x,i.y+1,i.z)],s=this.gridCache[this.createTileKey(i.x+1,i.y+1,i.z)],o=this.gridCache[this.createTileKey(i)],l=this.gridCache[this.createTileKey(i.x+1,i.y,i.z)]);var u=new Float32Array([n.lng,n.lat,0,1,o.lng,o.lat,0,0,s.lng,s.lat,1,1,l.lng,l.lat,1,0]),p=u.BYTES_PER_ELEMENT,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,u,e.STATIC_DRAW),h.buffer=d,h.PosParam={size:2,stride:4*p,offset:0},h.TextCoordParam={size:2,stride:4*p,offset:2*p};const y=this._convertMectorPoints(n),m=this._convertMectorPoints(s),f=this._convertMectorPoints(o),g=this._convertMectorPoints(l),v=new Float32Array([Math.fround(y[0]),y[0]-Math.fround(y[0]),Math.fround(y[1]),y[1]-Math.fround(y[1]),0,1,Math.fround(f[0]),f[0]-Math.fround(f[0]),Math.fround(f[1]),f[1]-Math.fround(f[1]),0,0,Math.fround(m[0]),m[0]-Math.fround(m[0]),Math.fround(m[1]),m[1]-Math.fround(m[1]),1,1,Math.fround(g[0]),g[0]-Math.fround(g[0]),Math.fround(g[1]),g[1]-Math.fround(g[1]),1,0]);p=v.BYTES_PER_ELEMENT;var b=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,b),e.bufferData(e.ARRAY_BUFFER,v,e.STATIC_DRAW),h.bufferPixel=b,h.PosPiexelsParam={size:4,stride:6*p,offset:0},h.TextPiexelsCoordParam={size:2,stride:6*p,offset:4*p};var _=new Image;return _.onload=(()=>{h.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,h.texture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,_),h.isLoad=!0,this.map.triggerRepaint()}),_.crossOrigin=!0,_.src=c,h}_convertMectorPoints(e){const t=this.map.transform.locationCoordinate(e);return[t.x,t.y,0,1]}render(e,t){if(!(this.map.getZoom()<this.options.minZoom||this.map.getZoom()>this.options.maxZoom)&&this.options.visible)for(var i of(this.matrix=t,e.useProgram(this.program),this.showTiles))if(i.isLoad){e.bindTexture(e.TEXTURE_2D,i.texture),e.activeTexture(e.TEXTURE0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.MIRRORED_REPEAT);var r=e.getUniformLocation(this.program,"u_Sampler");e.uniform1i(r,0),e.bindBuffer(e.ARRAY_BUFFER,i.bufferPixel),e.vertexAttribPointer(this.a_Pos_Piexl,i.PosPiexelsParam.size,e.FLOAT,!1,i.PosPiexelsParam.stride,i.PosPiexelsParam.offset),e.enableVertexAttribArray(this.a_Pos_Piexl),e.vertexAttribPointer(this.a_TextCoord_Piexl,i.TextPiexelsCoordParam.size,e.FLOAT,!1,i.TextPiexelsCoordParam.stride,i.TextPiexelsCoordParam.offset),e.enableVertexAttribArray(this.a_TextCoord_Piexl),this.setVertex(e,t),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,0,4)}}setVertex(e,t){this.map.getZoom(),this.map.getBearing(),this.map.getPitch();const i=this.map.getCenter();this.map.painter,this.map.transform;const r=this._convertMectorPoints(i),a=t.slice();a[12]+=a[0]*r[0]+a[4]*r[1],a[13]+=a[1]*r[0]+a[5]*r[1],a[14]+=a[2]*r[0]+a[6]*r[1],a[15]+=a[3]*r[0]+a[7]*r[1];let n={u_custom_matrix:a,u_center_pos:new Float32Array([Math.fround(r[0]),r[0]-Math.fround(r[0]),Math.fround(r[1]),r[1]-Math.fround(r[1])]),u_opacity:this.options.opacity};e.uniformMatrix4fv(e.getUniformLocation(this.program,"u_custom_matrix"),!1,n.u_custom_matrix),e.uniform4fv(e.getUniformLocation(this.program,"u_center_pos"),n.u_center_pos),e.uniform1f(e.getUniformLocation(this.program,"u_opacity"),n.u_opacity)}setOpacity(e){this.options.opacity=e,this._requestRender()}setVisible(e){e&&!this.options.visible&&this.map?(this.options.visible=e,this.update(this.map.painter.context.gl,this.map)):this.options.visible=e,this._requestRender()}_requestRender(){var e=this.map;e&&e._update()}onRemove(e,t){this.isLayerShow=!1}}function oe(e,t,i){var r,a=i||{},n=oe.providers,s=t.split("."),o=s[0],l=s[1],c=s[2],h=n[o][l][c],u=n[o].Subdomains,p=n[o][l].minzoom,d=n[o][l].maxzoom,y=n[o].tileType;if("Custom"===o&&(h=a.url?a.url:h,p=a.minzoom?a.minzoom:0,d=a.maxzoom?a.maxzoom:20),"TianDiTu"===o||"OSM"===o){var m=a.key||n[o].key,f=[];for(var g of u)f.push(h.replace("{s}",g).replace("{key}",m));r={id:e,type:"raster",source:{type:"raster",tiles:f,tileSize:256,minzoom:p,maxzoom:d}}}else r=new se(e,h,{subdomains:u,minZoom:p,maxZoom:d,tileType:y});return r}return oe.providers={TianDiTu:{Normal:{Map:"http://t{s}.tianditu.com/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cva_w&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:18},Normal4326:{Map:"http://t{s}.tianditu.com/DataServer?T=vec_c&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cva_c&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:18},Satellite:{Map:"http://t{s}.tianditu.com/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cia_w&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:18},Satellite4326:{Map:"http://t{s}.tianditu.com/DataServer?T=img_c&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cia_c&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:18},Terrain:{Map:"http://t{s}.tianditu.com/DataServer?T=ter_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cta_w&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:14},Subdomains:["0","1","2","3","4","5","6","7"],key:""},GaoDe:{Normal:{Map:"http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",minzoom:3,maxzoom:18},Normal_NoTag:{Map:"https://wprd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&scl=1<ype=11&x={x}&y={y}&z={z}",minzoom:3,maxzoom:18},Satellite:{Map:"http://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",Annotion:"http://webst0{s}.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}",minzoom:3,maxzoom:18},Subdomains:["1","2","3","4"]},Baidu:{Normal:{Map:"//online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1"},Satellite:{Map:"//shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46",Annotion:"//online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=sl&v=020"},Subdomains:"0123456789",tileType:"bd09"},Geoq:{Normal:{Map:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}",PurplishBlue:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}",Gray:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}",Warm:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}",minzoom:3,maxzoom:16},Subdomains:[]},OSM:{Normal:{Map:"//{s}.tile.osm.org/{z}/{x}/{y}.png",minzoom:0,maxzoom:18},Subdomains:["a","b","c"]},Custom:{WMTS:{URL:"custom/{z}/{x}/{y}.png",minzoom:0,maxzoom:20},TMS:{URL:"custom/{z}/{x}/{y}.png",minzoom:0,maxzoom:20},Subdomains:["0","1","2","3"]}},oe}()},function(e,t,i){"use strict";i.r(t);var r=i(0),a=i(1),n=i.n(a),s=i(2),o=i.n(s);function l(e){const t=e._getLayerViewVisible();e.innerLayer&&e.innerLayer.implementation&&e.innerLayer.implementation.type&&"custom"===e.innerLayer.implementation.type&&e.innerLayer.implementation.setVisible?e.innerLayer.implementation.setVisible(t):e.innerView.setLayoutProperty(e.innerLayer.id,"visibility",t?"visible":"none")}function c(e){e.innerLayer.id&&e.innerView.removeLayer(e.innerLayer.id),e.innerLayer.source&&e.innerView.removeSource(e.innerLayer.source)}function h(e){const t=e._getOpacity();e.innerLayer&&e.innerLayer.implementation&&e.innerLayer.implementation.type&&"custom"===e.innerLayer.implementation.type&&e.innerLayer.implementation.setOpacity?e.innerLayer.implementation.setOpacity(t):e.innerView.setPaintProperty(e.innerLayer.id,"raster-opacity",t)}function u(e,t,i,r,a,n,s){let o,l=[e];return e&&e.includes("{s}")&&Array.isArray(r)&&(l=r.map(t=>e.replace("{s}",t))),o="image"===i?{url:e,rebaseRequestUrl(e,t){const i=this.map.getCRS().projection.project(this.map.getBounds()._sw),r=this.map.getCRS().projection.project(this.map.getBounds()._ne),a=[...i,...r].toString(),[n,s]=t.imageSize;return(e.split("?").length>1?e.split("?")[1].split("&"):e.split("&")).forEach(t=>{t.includes("size=")&&(e=e.replace(t,`size=${n},${s}`)),t.includes("w=")?e=e.replace(t,`w=${n}`):t.includes("width=")&&(e=e.replace(t,`width=${n}`)),t.includes("h=")&&!t.includes("width=")?e=e.replace(t,`h=${s}`):t.includes("height=")&&(e=e.replace(t,`height=${s}`)),t.includes("bbox=")&&(e=e.replace(t,`bbox=${a}`))}),e},requestParams:a,type:"image-map",clippingArea:n}:{type:"raster",tiles:l,requestParams:a,tileSize:t,clippingArea:n,decryptOptions:s}}function p(e,t,i,a){return{id:e,type:"raster",source:t,paint:{"raster-opacity":Object(r.isNull)(a)?i.opacity:a._getOpacity()},layout:{visibility:(Object(r.isNull)(a)?i.visible:a._getLayerViewVisible())?"visible":"none"}}}function d(e,t){let i,r;if(t.getProj||t.projectGeometry){const a=t;i=class extends e.Projection{constructor(e,t){super();const i=t||{};if(t.def)this._wkt=i.def;else if(e){const t=/^(EPSG|epsg)(:)?\d+$/,i=/\d+$/,r=e.match(i);if(t.test(e)&&r){this._wkid=parseInt(r[0]);const e=a.getEPSGByWKID(this._wkid);e&&(this._wkt=e.strProject)}}else this._wkt=a.getEPSGByWKID(3857).strProject;this._wkt&&(this._proj=a.getProj(e||function(){let e="";for(let t=1;t<=32;t++)e+=Math.floor(16*Math.random()).toString(16),8!==t&&12!==t&&16!==t&&20!==t||(e+="-");return e}(),this._wkt))}project(e){let t,i;Array.isArray(e)?(t=e[0],i=e[1]):(t=e.lng,i=e.lat);const r=[t,i];let n;return[(n=a.isCustomWKID(this._wkid)?a.projectPoints({points:[r],originWKID:4326,targetWKID:this._wkid})[0]:this._proj.forward(r))[0],n[1]]}unproject(e){let t,i;Array.isArray(e)?(t=e[0],i=e[1]):(t=e.x,i=e.y);const r=[t,i];let n;return[(n=a.isCustomWKID(this._wkid)?a.projectPoints({points:[r],originWKID:this._wkid,targetWKID:4326})[0]:this._proj.inverse([t,i]))[0],n[1]]}},r=class extends e.CRS{_parseParams(e){this._crsType="proj4",this.epsgCode=e[0],this.code=this.epsgCode,this.def=e[1];const t=e[2]||{};this._parseOptions(t)}_parseOptions(e){if(super._parseOptions(e),this._resolutions=e.resolutions,Array.isArray(this._resolutions)){const e={};this._resolutions.forEach((t,i)=>{e[i]=t}),this._resolutions=e}if(!this._resolutions)throw new Error("自定义坐标系时,未设置分辨率数组");if(!this.origin)throw new Error("自定义坐标系时,未设置原点");this.tileSize=e.tileSize||256}_setProjection(){this.projection=new i(this.getEpsgCode(),{origin:this.origin,def:this.def})}}}else{const a=t;i=class extends e.Projection{constructor(e,t){super();const i=(t||{}).def;if(!i)throw new Error("自定义参考系必须指定参数系信息def");if(this._def=i,!a)throw new Error("proj4对象不存在,自定义投影必须引入proj4对象");const r=this._isProj4Obj(e);this._proj=r?e:this._projFromCodeDef(e,i)}project(e){let t,i;return Array.isArray(e)?(t=e[0],i=e[1]):(t=e.lng,i=e.lat),this._proj.forward([t,i])}unproject(e){let t,i;return Array.isArray(e)?(t=e[0],i=e[1]):(t=e.x,i=e.y),this._proj.inverse([t,i])}_projFromCodeDef(e,t){if(t)a.defs(e,t);else if(void 0===a.defs[e]){const t=e.split(":");if(t.length>3&&(e=`${t[t.length-3]}:${t[t.length-1]}`),void 0===a.defs[e])throw`No projection definition for code ${e}`}return a(e)}_isProj4Obj(e){return void 0!==e.inverse&&void 0!==e.forward}},r=class extends e.CRS{_parseParams(e){this._crsType="proj4",this.epsgCode=e[0],this.code=this.epsgCode,this.def=e[1];const t=e[2]||{};this._parseOptions(t)}_parseOptions(e){if(super._parseOptions(e),this._resolutions=e.resolutions,Array.isArray(this._resolutions)){const e={};this._resolutions.forEach((t,i)=>{e[i]=t}),this._resolutions=e}if(!this._resolutions)throw new Error("自定义坐标系时,未设置分辨率数组");if(!this.origin)throw new Error("自定义坐标系时,未设置原点");this.tileSize=e.tileSize||256}_setProjection(){this.projection=new i(this.getEpsgCode(),{origin:this.origin,def:this.def})}}}return e.Proj||(e.Proj={}),e.Proj.CRS=r,e.Proj.Projection=i,r}var y=d(n.a,r.Projection);const m="== != > < >= <= array at boolean case coalesce collator format image in interpolate interpolate-hcl interpolate-lab\nlength let literal match number number-format object step string to-boolean to-color to-number to-string var within";class f{static isMapboxExpression(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&m.indexOf(e[0])>-1}static convertLineStyle(e,t){switch(e){case"dash":case"esriSLSDash":return t?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return t?[4,3,1,3]:[3,4,0,4];case"dot":case"esriSLSDot":return t?[1,3]:[0,4];case"long-dash":case"esriSLSLongDash":return t?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return t?[8,3,1,3]:[7,4,0,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return t?[8,3,1,3,1,3]:[7,4,0,4,0,4];case"short-dash":case"esriSLSShortDash":return t?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return t?[4,1,1,1]:[3,2,0,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return t?[4,1,1,1,1,1]:[3,2,0,2,0,2];case"short-dot":case"esriSLSShortDot":return t?[1,1]:[0,2];case"solid":case"esriSLSSolid":case"none":default:return}}static convertToGeoJSON(e){let t=e;const i=t.geometry,a=i.spatialReference;return"4326"!==String(a.wkid)&&((t=e.clone()).geometry=r.Projection.project(i,new r.SpatialReference("EPSG:4326"))),e.additional&&e.additional.arc3&&(e.geometry=Object(r.editGeometryByArc3)(e.geometry,e.additional)),t.toGeoJSON()}static convertLngLatGeometry(e){return e&&e.spatialReference?e.spatialReference.isGeographic?e:r.Projection.project(e,new r.SpatialReference("EPSG:4326")):e}static convertClippingArea(e){if(!e)return e;let t=null;switch(e.type){case r.GeometryType.polygon:case r.GeometryType.multiPolygon:t=f.convertLngLatGeometry(e).toGeoJSON();break;case r.GeometryType.circle:t=f.convertLngLatGeometry(e).toPolygon().toGeoJSON();break;case r.GeometryType.extent:t=f.convertLngLatGeometry(e).toPolygon().toGeoJSON();break}return t}static applyVisibleAndOpacityToColor(e,t,i){const a=r.Color.fromColor(e).clone(),n=i*(t?1:0);return a.alpha*=n,a}static createCRSByLayer(e){e&&e.spatialReference||r.Log.error("计算crsOptions错误");const t=r.TileInfoUtil.getTileInfoByLayer(e),i=e.spatialReference,a=t.origin.coordinates,n=e.extent,s={},o={};t.lods.map(e=>e.clone()).forEach(e=>{s[e.level]=e.resolution,o[e.level]=e.levelValue});const l=`EPSG:${i.wkid}`,c=i.wkt;return new y(l,c,{levelValues:o,resolutions:s,origin:[a[0],a[1]],tileSize:t.getTileSize(),bounds:[n.xmin,n.ymin,n.xmax,n.ymax],unit:i.isGeographic?"degree":void 0})}}var g=f;class v{}v.addIGSTileLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=v.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},v.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,a=`source_${e.id}`,n=`layer_${e.id}`;let s={tokenKey:e.tokenKey,tokenValue:e.tokenValue};const o=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGSTileLayerV1","IGSTileLayerV2"]),l=r.ServerUtil.getTile(o,s);let c=l.url;const h=r.UrlUtil.getStringFromObject(l.queryParameters);h&&(c+=`?${h}`);const d={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(d.data=l.queryParameters);const y=u(c,e.tileSize,null,null,d,g.convertClippingArea(e.clippingArea),e.decryptOptions),m=p(n,a,e,i),[f,v]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo);y.minzoom=f,y.maxzoom=v,y.crs=g.createCRSByLayer(e);const b={};return b[a]=y,{sources:b,layers:[m]}},v.setVisible=function(e){l(e)},v.setOpacity=function(e){h(e)},v.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=v.addIGSTileLayer(e,{})},v.removeLayer=function(e){c(e)};var b=v;class _{}_.addArcGISTileLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=_.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},_.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,{extensionOptions:a={}}=e,n=`source_${e.id}`,s=`layer_${e.id}`;let o={tokenKey:e.tokenKey,tokenValue:e.tokenValue};o=Object.assign(o,a);const l=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["ArcGISVectorTileLayer","IGS-ArcGISVectorTileLayer"]),c=r.ServerUtil.getTile(l,o);let h=c.url;const d=r.UrlUtil.getStringFromObject(c.queryParameters);d&&(h+=`?${d}`);const y={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(y.data=c.queryParameters);const m=u(h,e.tileSize,null,null,y,t.clippingArea);m.crs=g.createCRSByLayer(e);const f=p(s,n,e,i),v={};return v[n]=m,{sources:v,layers:[f]}},_.setVisible=function(e){l(e)},_.setOpacity=function(e){h(e)},_.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=_.addArcGISTileLayer(e,{})},_.removeLayer=function(e){c(e)};var S=_;class w{}w.addArcGISMapImageLayer=function(e){const t=e.layer,i=e.innerView,r={};r.layerView=e;const a=w.getSourcesAndStyleLayers(t,r);ae(a,i);const n=i.getLayer(a.layers[0].id);return n.sourceID=n.source,n},w.getSourcesAndStyleLayers=function(e,t){t=t||{};const{layerView:i={}}=t,{extensionOptions:a={}}=e,{view:n}=i,s=`source_${e.id}`,o=`layer_${e.id}`;let l={layers:e.layers,format:e.imageFormat,transparent:e.imageTransparency,size:`${e.imageWidth},${e.imageHeight}`,tokenKey:e.tokenKey,tokenValue:e.tokenValue};if(n){!e.spatialReference.equals(n.spatialReference)&&(l.imageSR=n.spatialReference)}l=Object.assign(l,a);const c=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGS-ArcGISMapImageLayer","ArcGISMapImageLayer"]),h=r.ServerUtil.getImage(c,l);let d=h.url;const y=r.UrlUtil.getStringFromObject(h.queryParameters);y&&(d+=`?${y}`);const m={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(m.data=h.queryParameters);const f=u(d,e.imageWidth,e.renderMode,void 0,m),g=p(o,s,e,i),v={};return v[s]=f,{sources:v,layers:[g]}},w.setVisible=function(e){l(e)},w.setOpacity=function(e){h(e)},w.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=w.addArcGISMapImageLayer(e,{})},w.removeLayer=function(e){c(e)};var x=w;class L{}L.addWMTSLayer=function(e,t){const i=e.layer,r=e.innerView;(t=t||{}).layerView=e;const a=L.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},L.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,{extensionOptions:a={},activeLayer:n}=e,s=`source_${e.id}`,o=`layer_${e.id}`;let l={version:e.version,layer:n.identifier,style:n.styleId,tileMatrixSet:n.tileMatrixSetId,format:n.format,tokenKey:e.tokenKey,tokenValue:e.tokenValue};l=Object.assign(l,a);const c=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["WMTSLayerV1","WMTSLayerV2"]),h=r.ServerUtil.getTile(c,l);let d=h.url;const y=r.UrlUtil.getStringFromObject(h.queryParameters);y&&(d+=`?${y}`);const m={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(m.data=h.queryParameters);const f=e.getCurrentTileInfo(),v=u(d,f.size[0],null,null,m,t.clippingArea),b=p(o,s,e,i),[_,S]=r.TileInfoUtil.getLevelRangeByTileInfo(f);v.minzoom=_,v.maxzoom=S,v.crs=g.createCRSByLayer(e);const w={};return w[s]=v,{sources:w,layers:[b]}},L.setVisible=function(e){l(e)},L.setOpacity=function(e){h(e)},L.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=L.addWMTSLayer(e,{})},L.removeLayer=function(e){c(e)};var M=L;class T{}T.addWMSLayer=function(e,t){const i=e.layer,r=e.innerView;(t=t||{}).layerView=e;const a=T.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},T.getSourcesAndStyleLayers=function(e,t){t=t||{};const{layerView:i={}}=t,{extensionOptions:a={}}=e,{view:n}=i,s=`source_${e.id}`,o=`layer_${e.id}`;let l={version:e.version,layers:e.layers,styles:e.styles,width:e.imageWidth,height:e.imageHeight,format:e.imageFormat,transparent:e.imageTransparency,srs:e.spatialReference,crs:e.spatialReference,queryParameters:{}};if(l.queryParameters[e.tokenKey]=e.tokenValue,n){!e.spatialReference.equals(n.spatialReference)&&(l.srs=n.spatialReference,l.crs=n.spatialReference)}l=Object.assign(l,a);const c=r.ServerUtil.getImage(e.url,l);let h=c.url;const d=r.UrlUtil.getStringFromObject(c.queryParameters);d&&(h+=`?${d}`);const y={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(y.data=c.queryParameters);const m=u(h,e.imageWidth,e.renderMode,null,y,t.clippingArea),f=p(o,s,e,i),g={};return g[s]=m,{sources:g,layers:[f]}},T.setVisible=function(e){l(e)},T.setOpacity=function(e){h(e)},T.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=T.addWMSLayer(e,{})},T.removeLayer=function(e){c(e)};var V=T;class P{}P.addWebTileLayer=function(e,t){const i=e.layer,r=e.innerView;(t=t||{}).layerView=e;const a=P.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},P.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,{extensionOptions:a={}}=e,[n,s]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo),l=e.spatialReference&&e.spatialReference.wkid?Number(e.spatialReference.wkid):void 0;let c=Object(r.formatWebTileUrl)(e.url),h={};Object(r.defined)(e.tokenKey)&&Object(r.defined)(e.tokenValue)&&(h[e.tokenKey]=e.tokenValue),h=Object.assign(h,a);const d={method:e.httpMethod,headers:e.headers,data:h};if("GET"!==e.httpMethod){const e=r.UrlUtil.getBaseUrlAndParams(c);c=e.baseUrl,d.data=Object.assign(e.params,h)}if(l===r.CustomWKID.bd09mc||l===r.CustomWKID.gcj02mc)return function(e,t){const i=e.spatialReference&&e.spatialReference.wkid?Number(e.spatialReference.wkid):void 0;let a;const n=`source_${e.id}`,s=t.layerView,l={opacity:Object(r.isNull)(s)?e.opacity:s._getOpacity(),visible:Object(r.isNull)(s)?e.visible:s._getLayerViewVisible(),minZoom:t.minZoom,maxZoom:t.maxZoom};return i===r.CustomWKID.bd09mc?(o.a.providers.Baidu[n]={Map:e.url,Subdomains:e.subDomains.toString()},a=o()(n,`Baidu.${n}.Map`,l)):i===r.CustomWKID.gcj02mc&&(o.a.providers.GaoDe[n]={Map:e.url,Subdomains:e.subDomains.toString()},a=o()(n,`GaoDe.${n}.Map`,l)),{sources:{},layers:[a]}}(e,Object.assign({minzoom:n,maxzoom:s},t));const y=`source_${e.id}`,m=`layer_${e.id}`,f=u(c,e.tileSize,null,e.subDomains,d,t.clippingArea);f.minzoom=n,f.maxzoom=s,f.crs=g.createCRSByLayer(e),"tms"===e.tileSliceType&&(f.scheme="tms");const v=p(m,y,e,i),b={};return b[y]=f,{sources:b,layers:[v]}},P.setVisible=function(e){l(e)},P.setOpacity=function(e){h(e)},P.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=P.addWebTileLayer(e,{})},P.removeLayer=function(e){c(e)};var k=P;const O=2e3;var E=class{constructor(e){this.innerView=e,this.cacheImageDetla={},this.imageCount=0}getIconScale(e,t,i){if(this.cacheImageDetla[e]){const{width:r,height:a}=this.cacheImageDetla[e];return r&&a?Math.max(t/(r||1),i/(a||1)):.001}return.001}hasImageCacheDetla(e){return!!this.cacheImageDetla[e]&&this.cacheImageDetla[e].keyObjects}loadImage(e,t,i){i=i||{};const r=this.innerView;return new Promise(a=>{r.loadImage(t,(t,n)=>{r.hasImage(e)?r.removeImage(e):this.imageCount++,t&&(i.notLoaded=!0,console.error("mapboxgl引擎loadImage方法加载图片资源加载失败"));const s=n||new Image(1,1),o={};i.pfsScale&&i.pfsSize&&(o.pixelRatio=Math.max(s.width,s.height)/i.pfsSize/i.pfsScale),r.addImage(e,s,o),a({id:e,width:s.width,height:s.height,keyObjects:i})})})}updateImage(e,t,i){i=i||{};const r=this.innerView;if(!e||!t)return Promise.resolve(null);if(this._shouldUpdateImage(e,t,i))return this.cacheImageDetla[e]={imageSource:t,totalUpdateCount:1},this.loadImage(e,t,i).then(t=>{if(this.cacheImageDetla[e])return this.cacheImageDetla[e].width=t.width,this.cacheImageDetla[e].height=t.height,this.cacheImageDetla[e].keyObjects=i,this.cacheImageDetla[e]});if(this.cacheImageDetla[e]&&this.cacheImageDetla[e].totalUpdateCount++,this.imageCount>O){const e=Object.entries(this.cacheImageDetla).sort((e,t)=>e[1].totalUpdateCount-t[1].totalUpdateCount);for(let t=0;t<e.length;t++){const[i,a]=e[t];t<Math.floor(e.length/2)?(r.hasImage(i)&&(r.removeImage(i),this.imageCount--),delete this.cacheImageDetla[i]):a.totalUpdateCount=1}}return Promise.resolve(null)}_shouldUpdateImage(e,t,i){const r=this.cacheImageDetla[e];return!r||r&&(r.imageSource!==t||JSON.stringify(r.keyObjects)!==JSON.stringify(i))}};function C(e,t,i,r){for(;t.findIndex(e=>i.some(t=>t===e))>-1;){r.index+=1;const a=`calc_${r.index}`,n=t.findIndex(e=>i.some(t=>t===e)),s=e[t[n-1]]||(r.isNum?parseFloat(t[n-1]):t[n-1]),o=e[t[n+1]]||(r.isNum?parseFloat(t[n+1]):t[n+1]);e[a]=[t[n],s,o],r.key=a,r.expression=t.splice(n-1,3,a)}}function j(e,t,i){if(e)return i?["to-number",["get",e]]:["get",e];const r=function(e,t){try{let i=e;const r=i.replace(/\s/g,"").match(/\$feature\.[^+-/*%>=<]+/g);if(!r||0===r.length)return null;const a={},n={index:0,key:null,isNum:t};r.forEach(e=>{n.index+=1;const r=`calc_${n.index}`;n.key=r,a[r]=t?["to-number",["get",e.split(".")[1]]]:["get",e.split(".")[1]],i=i.replace(e,`${r}`)});const s=i.match(/>=|<=|==|\+|-|\*|\/|>|<|=/);s&&s.length>0&&s.forEach(e=>{i=i.replace(e,` ${e} `)});const o=i.split(" ").filter(e=>""!==e);if(C(a,o,["*","/","%"],n),C(a,o,["+","-"],n),C(a,o,["<","<=",">",">="],n),C(a,o,["=="],n),n.key)return a[n.key]}catch(e){}}(t,i);return r||["get","undefined"]}function I(e,t,i,a,n,s){let o="";switch(s=s||{},e.type){case r.SymbolType.simpleLine:e instanceof r.SimpleLineSymbol||(e=new r.SimpleLineSymbol),function(e,t,i,a,n,s){const o=r.Color.fromColor(i.color);e["line-color"]=o.toCssRGBAString(),e["line-opacity"]=n,e["line-width"]=i.width,t["line-cap"]=i.cap,t["line-miter-limit"]=i.miterLimit,t["line-join"]=i.join;const l=g.convertLineStyle(i.style,"butt"===i.cap);l&&(e["line-dasharray"]=l),t.visibility=a?"visible":"none"}(t,i,e,a,n),o="line";break;case r.SymbolType.simpleFill:e instanceof r.SimpleFillSymbol||(e=new r.SimpleFillSymbol),function(e,t,i,a,n,s){const o=r.Color.fromColor(i.color),l=r.Color.fromColor(i.outline.color);if("solid"!==i.style&&i.style){if(!s.imageSourceManager)throw new Error("mapboxgl转换图标符号时,未传入图片资源管理类");e["fill-pattern"]=i.id}else e["fill-color"]=o.toCssRGBAString();e["fill-opacity"]=n,e["fill-outline-color"]=l.toCssRGBAString(),t.visibility=a?"visible":"none"}(t,i,e,a,n,s),o="fill";break;case r.SymbolType.simpleMarker:e instanceof r.SimpleMarkerSymbol||(e=new r.SimpleMarkerSymbol),function(e,t,i,a,n,s){const o=i.xoffset,l=i.yoffset;e["circle-translate"]=[parseFloat(o),parseFloat(l)];const c=r.Color.fromColor(i.color);e["circle-opacity"]=n,e["circle-color"]=c.toCssRGBAString();const h=r.Color.fromColor(i.outline.color);e["circle-stroke-color"]=h.toCssRGBAString(),e["circle-stroke-opacity"]=n,e["circle-stroke-width"]=i.outline.width,e["circle-radius"]=i.size/2,t.visibility=a?"visible":"none"}(t,i,e,a,n),o="circle";break;case r.SymbolType.text:e instanceof r.TextSymbol||(e=new r.TextSymbol),function(e,t,i,a,n,s){const o=r.Color.fromColor(i.color),l=r.Color.fromColor(i.haloColor);switch(e["text-color"]=o.toCssRGBAString(),e["text-opacity"]=n,e["text-halo-color"]=l.toCssRGBAString(),e["text-halo-width"]=i.haloSize,t["text-field"]=i.text||"",t.visibility=a?"visible":"none",t["text-allow-overlap"]=!0,t["text-font"]=[i.font.family],t["text-size"]=i.font.size,t["text-justify"]=i.horizontalAlignment,t["text-letter-spacing"]=i.kerning?.1:0,t["text-rotate"]=i.rotated&&0!==i.angle?i.angle:0,t["text-offset"]=[i.xoffset/i.font.size,-i.yoffset/i.font.size],t["text-line-height"]=i.lineHeight?1.2:0,t["text-max-width"]=Object(r.defaultValue)(i.lineWidth,192)/i.font.size,t["text-anchor"]="center",i.verticalAlignment){case"top":switch(i.horizontalAlignment){case"left":t["text-anchor"]="top-left";break;case"right":t["text-anchor"]="top-right";break;default:t["text-anchor"]="top"}break;case"bottom":switch(i.horizontalAlignment){case"left":t["text-anchor"]="bottom-left";break;case"right":t["text-anchor"]="bottom-right";break;default:t["text-anchor"]="bottom"}break;default:switch(i.horizontalAlignment){case"left":t["text-anchor"]="left";break;case"right":t["text-anchor"]="right";break;default:t["text-anchor"]="center"}}}(t,i,e,a,n),o="symbol";break;case r.SymbolType.pictureMarker:e instanceof r.PictureMarkerSymbol||(e=new r.PictureMarkerSymbol),function(e,t,i,a,n,s){const o=(s=s||{}).imageSourceManager;if(!o)throw new Error("mapboxgl转换图标符号时,未传入图片资源管理类");const l=r.Color.fromColor(i.color);e["icon-color"]=l.toCssRGBAString(),e["icon-opacity"]=n,t["icon-allow-overlap"]=!0,t["icon-rotate"]=i.angle,t["icon-image"]=i.id,t["icon-offset"]=[i.xoffset,i.yoffset],t["icon-size"]=o.getIconScale(i.id,i.width,i.height),t.visibility=a?"visible":"none"}(t,i,e,a,n,s),o="symbol";break;case r.SymbolType.pictureFill:e instanceof r.PictureFillSymbol||(e=new r.PictureFillSymbol),function(e,t,i,a,n,s){if(!(s=s||{}).imageSourceManager)throw new Error("mapboxgl转换图片填充符号时,未传入图片资源管理类");const o=r.Color.fromColor(i.outline.color);e["fill-pattern"]=i.id,e["fill-opacity"]=n,e["fill-translate"]=[i.xoffset,i.yoffset],e["fill-outline-color"]=o.toCssRGBAString(),t.visibility=a?"visible":"none"}(t,i,e,a,n,s),o="fill"}return o}function A(e,t,i,a,n,s){const o=[],l=function(e,t){(t=Object(r.defaultValue)(t,{})).opacity=Object(r.defaultValue)(t.opacity,1);const i=e.clusterInfos,a=e.defaultSymbol,n={"circle-color":["step",["get","point_count"]],"circle-opacity":["step",["get","point_count"]],"circle-radius":["step",["get","point_count"]],"circle-stroke-color":["step",["get","point_count"]],"circle-stroke-opacity":["step",["get","point_count"]],"circle-stroke-width":["step",["get","point_count"]]};for(let e=0;e<i.length;e++){const a=r.Color.fromColor(i[e].symbol.color);n["circle-color"].push(a.toCssRGBAString()),n["circle-color"].push(i[e].maxValue),n["circle-opacity"].push(a.alpha*t.opacity),n["circle-opacity"].push(i[e].maxValue),n["circle-radius"].push(i[e].symbol.size),n["circle-radius"].push(i[e].maxValue);const s=r.Symbol.fromJSON(i[e].symbol.outline);n["circle-stroke-color"].push(s.color.toCssRGBAString()),n["circle-stroke-color"].push(i[e].maxValue),n["circle-stroke-opacity"].push(s.color.alpha*t.opacity),n["circle-stroke-opacity"].push(i[e].maxValue),n["circle-stroke-width"].push(s.width),n["circle-stroke-width"].push(i[e].maxValue)}const s=r.Color.fromColor(a.color);n["circle-color"].push(s.toCssRGBAString()),n["circle-opacity"].push(1),n["circle-radius"].push(a.size);const o=r.Symbol.fromJSON(a.outline);return n["circle-stroke-color"].push(o.color.toCssRGBAString()),n["circle-stroke-opacity"].push(1),n["circle-stroke-width"].push(o.width),n}(t,{opacity:n});o.push({id:`${e}_cluster`,type:"circle",source:e,filter:["has","point_count"],paint:l,layout:{visibility:a?"visible":"none"}});const c=function(e){const t=e.clusterInfos,i=e.defaultLabelSymbol;let a="宋体";for(let e=0;e<t.length;e++){const i=r.Symbol.fromJSON(t[e].labelSymbol);i&&i.font&&i.font.family&&(a=i.font.family)}!a&&i&&i.font&&i.font.family&&(a=i.font.family);const n={"text-field":"{point_count}","text-font":[a,a],"text-size":["step",["get","point_count"]]};for(let e=0;e<t.length;e++){const i=r.Symbol.fromJSON(t[e].labelSymbol);n["text-size"].push(i.font.size),n["text-size"].push(t[e].maxValue)}let s=30;return i&&i.font&&i.font.size&&(s=i.font.size),n["text-size"].push(s),n}(t);c.visibility=a?"visible":"none";const h=function(e,t){(t=Object(r.defaultValue)(t,{})).opacity=Object(r.defaultValue)(t.opacity,1);const i=e.clusterInfos,a={"text-opacity":1};for(let e=0;e<i.length;e++){const n=r.Symbol.fromJSON(i[e].labelSymbol);a["text-opacity"]=n.color.alpha*t.opacity}return a}(t,{opacity:n,visible:a});return o.push({id:`${e}_cluster_count`,type:"symbol",source:e,filter:["has","point_count"],layout:c,paint:h}),t.defaultSymbol&&o.push({id:`${e}_unclustered_point`,type:"circle",source:e,filter:["!",["has","point_count"]],paint:function(e,t){(t=Object(r.defaultValue)(t,{})).opacity=Object(r.defaultValue)(t.opacity,1);const i=e.defaultSymbol,a=r.Color.fromColor(i.color),n=r.Symbol.fromJSON(i.outline),s=r.Color.fromColor(n.color);return{"circle-opacity":a.alpha*t.opacity,"circle-color":a.toCssRGBAString(),"circle-radius":i.size,"circle-stroke-width":n.width,"circle-stroke-color":s.toCssRGBAString(),"circle-stroke-opacity":s.alpha*t.opacity}}(t,{visible:a,opacity:n}),layout:{visibility:a?"visible":"none"}}),o}function z(e,t,i,r,a,n){const s=[];if(!t)return;const o=j(t.field,t.valueExpression);return[{visible:t.defaultVisible,symbol:t.defaultSymbol,value:null}].concat(t.uniqueValueInfos).forEach(i=>{const l=i.visible,c=i.value,h=i.symbol;if(!h)return;const u={},p={},d=I(h,u,p,r&&l,a,n);let y=["==",o,c];if(t.defaultSymbol&&h.id===t.defaultSymbol.id){const e=t.uniqueValueInfos.map(e=>e.value);0===e.length?y=null:(y=["match",o],e.forEach(e=>{y.push(e,!1)}),y.push(!0))}if(d){const t={id:h.id,type:d,paint:u,layout:p,source:e};y&&(t.filter=y),s.push(t)}}),s}function R(e,t,i,a,n,s){const o=[];if(!t)return;let l=j(t.field,t.valueExpression,!0);l=function(e,t){let i=e;t=t||{};const{normalizationField:a,normalizationTotal:n,normalizationType:s}=t;switch(s){case r.NormalizationType.field:i=["/",i,["to-number",["get",a]]];break;case r.NormalizationType.log:i=["log10",e];break;case r.NormalizationType.percentOfTotal:i=["*",i,1/n,100]}return i}(l,{normalizationField:t.normalizationField,normalizationTotal:t.normalizationTotal,normalizationType:t.normalizationType});const c=t.classBreakInfos.map(e=>e);let h;c.sort((e,t)=>e.maxValue-t.maxValue);const u=[];return c.forEach(e=>{const{minValue:t,maxValue:i}=e;if(t>i)throw new Error("分段专题图分段信息错误,最大值小于最小值");if(void 0===h)h=i;else{if(t<h)throw new Error("分段专题图分段信息错误,相邻分段值重叠");t!==h&&u.push(["all",[">=",l,h],["<",l,t]])}}),0!==c.length&&(u.unshift(["<",l,c[0].minValue]),u.push([">=",l,c[c.length-1].maxValue])),[{visible:t.defaultVisible,symbol:t.defaultSymbol,maxValue:NaN,minValue:NaN}].concat(c).forEach(i=>{const r=i.visible,c=i.maxValue,h=i.minValue,p=i.symbol;if(!p)return;const d={},y={},m=I(p,d,y,a&&r,n,s);let f=["all",[">=",l,h],["<",l,c]];if(t.defaultSymbol&&p.id===t.defaultSymbol.id&&(f=0===u.length?null:["any"].concat(u)),m){const t={id:p.id,type:m,paint:d,layout:y,source:e};f&&(t.filter=f),o.push(t)}}),o}function D(e,t,i,a,n,s){if(!(s=s||{}).featureSet)throw new Error("随机专题图要素数据集参数未传入");return z(e,function(e,t){const i=t.features,a=[];for(let e=0;e<i.length;e++){let t;switch(i[e].geometry.type){case r.GeometryType.polygon:case r.GeometryType.multiPolygon:case r.GeometryType.extent:case r.GeometryType.circle:default:t={value:i[e].id,symbol:new r.SimpleFillSymbol({id:i[e].id,color:new r.Color(parseInt(255*Math.random()),parseInt(255*Math.random()),parseInt(255*Math.random()),1)})};break;case r.GeometryType.lineString:case r.GeometryType.multiLineString:t={value:i[e].id,symbol:new r.SimpleLineSymbol({id:i[e].id,color:new r.Color(parseInt(255*Math.random()),parseInt(255*Math.random()),parseInt(255*Math.random()),1),width:3})};break;case r.GeometryType.point:case r.GeometryType.multiPoint:t={value:i[e].id,symbol:new r.SimpleMarkerSymbol({id:i[e].id,color:new r.Color(parseInt(255*Math.random()),parseInt(255*Math.random()),parseInt(255*Math.random()),1)})}}a.push(t)}return new r.UniqueValueRenderer({field:"id",uniqueValueInfos:a})}(0,s.featureSet),0,a,n,s)}function G(e,t,i,a,n,s){let o=[];if(s=s||{},!t||!i)return o;switch(t.type){case r.RendererType.simple:o=function(e,t,i,r,a,n){const s=[];if(!t||!t.symbol)return;const o={},l={},c=I(t.symbol,o,l,r,a,n);return c&&s.push({id:t.symbol.id,type:c,paint:o,layout:l,source:e}),s}(e,t,0,a,n,s);break;case r.RendererType.classBreak:o=R(e,t,0,a,n,s);break;case r.RendererType.uniqueValue:o=z(e,t,0,a,n,s);break;case r.RendererType.rank:o=function(e,t,i,a,n,s){const o=[];if(!t||!t.symbol)return;const l=s.imageSourceManager;if(!l)throw new Error("mapboxgl转换图片填充符号时,未传入图片资源管理类");const c={},h={},u=t.symbol,p=I(u,c,h,a,n,s);if(p){const i={id:u.id,type:p,paint:c,layout:h,source:e},{minSize:a,maxSize:n,maxDataValue:s,minDataValue:d,field:y,valueExpression:m}=t;if(void 0===s||void 0===d)throw new Error("mapboxgl上等级符号渲染器必须设置maxDataValue,minDataValue最大最小数据值");const f=j(y,m,!0);switch(u.type){case r.SymbolType.pictureMarker:i.layout["icon-size"]=["interpolate",["linear"],f,d,l.getIconScale(u.id,a,a),s,l.getIconScale(u.id,n,n)];break;case r.SymbolType.text:i.layout["text-size"]=["interpolate",["linear"],f,d,a,s,n];break;case r.SymbolType.simpleMarker:i.paint["circle-radius"]=["interpolate",["linear"],f,d,a/2,s,n/2]}o.push(i)}return o}(e,t,0,a,n,s);break;case r.RendererType.random:o=D(e,0,0,a,n,s);break;case r.RendererType.cluster:o=A(e,t,0,a,n);break;default:r.Log.error("未定义的Renderer类型")}return o}function N(e,t){const i=e.map(e=>{if(e){if(e.type===r.SymbolType.pictureFill){const i=Math.max(e.xscale,e.yscale),r=Math.max(e.width,e.height);return t.updateImage(e.id,e.url,{pfsSize:r,pfsScale:i})}if(e.type===r.SymbolType.pictureMarker)return t.updateImage(e.id,e.url);if(e.type===r.SymbolType.simpleFill&&"solid"!==e.style){const i=Object(r.createSimpleFillSymbolCanvas)(e,{lineWidth:1}).toDataURL(),a=e.color;return t.updateImage(e.id,i,{pattern:e.style,color:a.toCssRGBAString()})}return null}}).filter(e=>e);return Object(r.allSettled)(i)}var F=class{constructor(e){e=Object(r.defaultValue)(e,{}),this.id=e.id,this.sourceId=e.sourceId,this.featureCollection=e.featureCollection,this.layerId=e.layerId,this.renderType=e.renderType,this.mapboxglStyleType=e.mapboxglStyleType,this.highPerformanceLayer=e.highPerformanceLayer,this._sourceDirty=!0,this._styleLayerDirty=!0}setDirty(e){this._sourceDirty=e,this._styleLayerDirty=e}getDirty(){return this._sourceDirty||this._styleLayerDirty}setSourceDirty(e){this._sourceDirty=e}getSourceDirty(){return this._sourceDirty}setStyleLayerDirty(e){this._styleLayerDirty=e}getStyleLayerDirty(){return this._styleLayerDirty}};function B(e,t,i,r){r=r||{},t[e.sourceId]={type:"geojson",data:{type:"FeatureCollection",features:[]}},i.push({id:e.layerId,source:e.sourceId,type:e.mapboxglStyleType})}var U=class{constructor(e){e=Object(r.defaultValue)(e,{}),this.id=e.id||Object(r.getGUID)(),this._opacity=Object(r.defaultValue)(e.opacity,1),this._visible=Object(r.defaultValue)(e.visible,!0),this.highPerformance=Object(r.defaultValue)(e.highPerformance,!1),this._isLoaded=!1,this.metaIds=["fill","line","circle","text","icon","fill-picture"],this._sourceMetaDatas={},this.metaIds.forEach(e=>{this._sourceMetaDatas[e]=this._createSourceMetaData(this.id,e,e,!0)})}_createSourceMetaData(e,t,i,r){const a={};a.sourceId=`${e}_${t}`,a.featureCollection=[],a.layerId=`${e}_${t}_layer`,a.renderType=i,a.id=t,a.highPerformanceLayer=r;let n=i;return"text"!==n&&"icon"!==n||(n="symbol"),"fill-picture"===n&&(n="fill"),a.mapboxglStyleType=n,new F(a)}onAdd(e){if(!e)return;this._map=e;const t=this;return this._imageSourceManager=new E(e),new Promise(i=>{let r;const a=()=>{t._isLoaded||(ae(t._getSourcesAndLayers(),e),t._isLoaded=!0,t._refreshSourceAndLayers()),i(this),r&&clearInterval(r)};e.loaded()?a():(e.once("load",a),r=setInterval(()=>{e.loaded()&&a()},16))})}_getSourcesAndLayers(){const e={},t=[];return this.metaIds.forEach(i=>{B(this._sourceMetaDatas[i],e,t)}),{sources:e,layers:t}}onRemove(e){e&&this._isLoaded&&this.metaIds.forEach(t=>{const i=this._sourceMetaDatas[t];e.style.getLayer(i.layerId)&&e.removeLayer(i.layerId),e.getSource(i.sourceId)&&e.removeSource(i.sourceId)})}getStyleLayerIds(){const e=[];return this.metaIds.forEach(t=>{const i=this._sourceMetaDatas[t];e.push(i.layerId)}),e}add(e){this._map&&this._isLoaded&&N((Array.isArray(e)?e:[e]).map(e=>e.symbol),this._imageSourceManager).then(()=>{Array.isArray(e)?e.forEach(e=>{this._updateGraphicToCollection(e)}):this._updateGraphicToCollection(e),this._refreshSourceAndLayers()})}update(e,t){if(!this._map||!this._isLoaded)return;if(!e)return;const i=Array.isArray(e)?e:[e];N(i.map(e=>e.symbol),this._imageSourceManager).then(()=>{for(let e=0;e<i.length;e++){const r=i[e],a=t[e]||{},n=this._updateGraphicToCollection(r);n&&(a.geometryUpdated&&n.setSourceDirty(!0),(a.symbolUpdated||a.visibleUpdated)&&n.setStyleLayerDirty(!0))}this._refreshSourceAndLayers()})}_removeGraphicsToCollection(e){const t=Object.values(this._sourceMetaDatas);for(let i=0;i<t.length;i++){const r=t[i],{featureCollection:a}=r,n=[];for(let t=0;t<a.length;t++){const i=a[t];e.indexOf(i)>-1&&n.push(t)}n.length>0&&(r.featureCollection=a.filter((e,t)=>-1===n.indexOf(t)),r.setSourceDirty(!0))}}_updateGraphicToCollection(e){let t;if(e&&e instanceof r.Feature){if(e.geometry&&e.symbol){if(!this.highPerformance){const i=this._getRenderTypeBySymbol(e.symbol);if(this._sourceMetaDatas[e.id]){(t=this._sourceMetaDatas[e.id]).isRefreshStyleLayer=t.renderType!==i,"fill-picture"===t.renderType&&"fill-picture"===i&&this._map.getLayer(t.layerId).getPaintProperty("fill-pattern")!==e.symbol.id&&(t.isRefreshStyleLayer=!0);const r=this._createSourceMetaData(this.id,e.id,i,!1);t.renderType=r.renderType,t.mapboxglStyleType=r.mapboxglStyleType}else{(t=this._createSourceMetaData(this.id,e.id,i,!1)).featureCollection.push(e),this._sourceMetaDatas[e.id]=t;const r={};B(t,r,[]);const a=Object.entries(r);for(let e=0;e<a.length;e++){const t=a[e];this._map.addSource(t[0],t[1])}this.metaIds.unshift(e.id)}return t}switch(e.geometry.type){case r.GeometryType.multiPoint:case r.GeometryType.point:t=this._dividePointGraphic(e);break;case r.GeometryType.multiLineString:case r.GeometryType.lineString:t=this._dividePolylineGraphic(e);break;case r.GeometryType.extent:case r.GeometryType.circle:case r.GeometryType.multiPolygon:case r.GeometryType.polygon:t=this._dividePolygonGraphic(e)}return t}r.Log.warning("要素几何信息缺失,无法绘制要素:",e)}}remove(e){this._map&&this._isLoaded&&e&&(Array.isArray(e)?this._removeGraphicsToCollection(e):this._removeGraphicsToCollection([e]),this._removeSourceMetaData(this._map,this._sourceMetaDatas[e.id]),this._refreshSourceAndLayers())}removeAll(){if(!this._map||!this._isLoaded)return;const e=Object.values(this._sourceMetaDatas);for(let t=0;t<e.length;t++){const i=e[t];i.featureCollection=[],i.setDirty(!0),this._removeSourceMetaData(this._map,i)}this._refreshSourceAndLayers()}_removeSourceMetaData(e,t){if(!this.highPerformance&&t&&!t.highPerformanceLayer){e.style.getLayer(t.layerId)&&e.removeLayer(t.layerId),delete this._sourceMetaDatas[t.id],e.getSource(t.sourceId)&&e.removeSource(t.sourceId);const i=this.metaIds.indexOf(t.id);i>-1&&this.metaIds.splice(i,1)}}_refreshSourceAndLayers(){const e=Object.keys(this._sourceMetaDatas);if(!e.some(e=>this._sourceMetaDatas[e].getDirty()))return!1;if(!this._map)return!1;const t=this._map;return e.forEach(e=>{const i=this._sourceMetaDatas[e];if(i.getStyleLayerDirty()&&(this.setSourceMetaDataStyle(i,!0),i.setStyleLayerDirty(!1)),i.getSourceDirty()){const{sourceId:e,featureCollection:r}=i;t.getSource(e).setData({type:"FeatureCollection",features:r.map(function(e){return g.convertToGeoJSON(e)})}),i.setSourceDirty(!1)}}),t._update(!0),!0}setSourceMetaDataStyle(e,t){const i={},r={},a={},{renderType:n}=e,s=this._map,o=this;i.type=e.mapboxglStyleType,i.id=e.layerId,i.paint=r,i.layout=a,i.source=e.sourceId;const l=function(){const t=s.style,i=e.layerId;o._updateStyleLayers(t,i,r,a)};if(this.highPerformance){switch(n){case"circle":this._setCircleStyle(e,r,a);break;case"line":this._setLineStyle(e,r,a);break;case"fill":this._setFillStyle(e,r,a);break;case"text":this._setTextStyle(e,r,a);break;case"icon":this._setIconStyle(e,r,a);break;case"fill-picture":this._setFillPictureStyle(e,r,a)}l()}else if(Array.isArray(e.featureCollection)&&e.featureCollection.length>0){const t=e.featureCollection[0];I(t.symbol,r,a,this._visible&&t.visible,this._opacity,{imageSourceManager:this._imageSourceManager});let n=!1,o=`${this.id}_fill_layer`;if(s.style.hasLayer(e.layerId)){if(e.isRefreshStyleLayer){const t=this._map.style._order,i=t.indexOf(e.layerId);i>-1&&t.length>i+1&&(o=t[i+1]),s.removeLayer(e.layerId),e.isRefreshStyleLayer=!1,n=!0}}else n=!0;n?s.addLayer(i,o):l()}return i}_updateStyleLayers(e,t,i,r){const a=Object.entries(i),n=Object.entries(r);for(let i=0;i<a.length;i++)e.setPaintProperty(t,a[i][0],a[i][1]);for(let i=0;i<n.length;i++)e.setLayoutProperty(t,n[i][0],n[i][1])}_setCircleStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._opacity,o=this._visible,l={"circle-color":{values:[],def:"#000000"},"circle-opacity":{values:[],def:1},"circle-stroke-color":{values:[],def:"#000000"},"circle-stroke-opacity":{values:[],def:1},"circle-stroke-width":{values:[],def:0},"circle-radius":{values:[],def:5}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.SimpleMarkerSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.SimpleMarkerSymbol({id:i.id}));const a=g.applyVisibleAndOpacityToColor(i.color,o&&e.visible,s);l["circle-color"].values.push(t,a.toCssRGBString()),l["circle-opacity"].values.push(t,a.alpha);const n=g.applyVisibleAndOpacityToColor(i.outline.color,o&&e.visible,s);l["circle-stroke-color"].values.push(t,n.toCssRGBString()),l["circle-stroke-opacity"].values.push(t,n.alpha),l["circle-stroke-width"].values.push(t,i.outline.width),l["circle-radius"].values.push(t,i.size/2)}),this._setLayoutAndPaintCaches(a,l,{},t,i)}_setLineStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._opacity,o=this._visible,l={"line-color":{values:[],def:"#000000"},"line-width":{values:[],def:1},"line-opacity":{values:[],def:1}},c={"line-join":{values:[],def:"round"}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.SimpleLineSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.SimpleLineSymbol({id:i.id}));const a=g.applyVisibleAndOpacityToColor(i.color,o&&e.visible,s);l["line-color"].values.push(t,a.toCssRGBString()),l["line-opacity"].values.push(t,a.alpha),l["line-width"].values.push(t,i.width),c["line-join"].values.push(t,i.join)}),this._setLayoutAndPaintCaches(a,l,c,t,i)}_setFillStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._opacity,o=this._visible,l={"fill-color":{values:[],def:"#ffffff"},"fill-opacity":{values:[],def:.25},"fill-outline-color":{values:[],def:"#000000"}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.SimpleFillSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.SimpleFillSymbol({id:i.id}));const a=g.applyVisibleAndOpacityToColor(i.color,o&&e.visible,s),n=g.applyVisibleAndOpacityToColor(i.outline.color,o&&e.visible,s);l["fill-color"].values.push(t,a.toCssRGBString()),l["fill-opacity"].values.push(t,a.alpha),l["fill-outline-color"].values.push(t,n.toCssRGBAString())}),this._setLayoutAndPaintCaches(a,l,{},t,i)}_setTextStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._opacity,o=this._visible,l={"text-color":{values:[],def:"#000000"},"text-opacity":{values:[],def:1},"text-halo-color":{values:[],def:"#000000"},"text-halo-width":{values:[],def:0}},c={"text-field":{values:[],def:""},"text-size":{values:[],def:12},"text-justify":{values:[],def:"center"},"text-letter-spacing":{values:[],def:0},"text-rotate":{values:[],def:0}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.TextSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.TextSymbol({id:i.id}));const a=g.applyVisibleAndOpacityToColor(i.color,o&&e.visible,s),n=g.applyVisibleAndOpacityToColor(i.haloColor,o&&e.visible,s);l["text-color"].values.push(t,a.toCssRGBString()),l["text-opacity"].values.push(t,a.alpha),l["text-halo-color"].values.push(t,n.toCssRGBAString()),l["text-halo-width"].values.push(t,i.haloSize),c["text-field"].values.push(t,i.text),c["text-allow-overlap"]=!1,c["text-font"]=[i.font.family,"微软雅黑"],c["text-size"].values.push(t,i.font.size),c["text-justify"].values.push(t,i.horizontalAlignment),c["text-letter-spacing"].values.push(t,i.kerning?.1:0),c["text-rotate"].values.push(t,i.rotated&&0!==i.angle?i.angle:0)}),this._setLayoutAndPaintCaches(a,l,c,t,i,["text-allow-overlap","text-font"])}_setIconStyle(e,t,i){const a=this._imageSourceManager,{layerId:n,featureCollection:s}=e,o=this._opacity,l=this._visible,c={"icon-color":{values:[],def:"#000000"},"icon-opacity":{values:[],def:1}},h={"icon-size":{values:[],def:.001},"icon-rotate":{values:[],def:0},"icon-image":{values:[],def:"marker-15"}},u=[];s.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.PictureMarkerSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.PictureMarkerSymbol({id:i.id}));const n=g.applyVisibleAndOpacityToColor(i.color,l&&e.visible,o);c["icon-color"].values.push(t,n.toCssRGBString()),c["icon-opacity"].values.push(t,n.alpha),h["icon-allow-overlap"]=!1;const s=i.id;h["icon-size"].values.push(t,a.getIconScale(s,i.width,i.height)),h["icon-image"].values.push(t,s),h["icon-rotate"].values.push(t,i.angle),u.push({url:i.url,id:i.id,featureId:t,width:i.width,height:i.height})}),this._setLayoutAndPaintCaches(n,c,h,t,i,["icon-allow-overlap"]),u.forEach(t=>{a.updateImage(t.id,t.url).then(i=>{if(!i)return;const r=a.innerView,n=r.getLayer(e.layerId);if(!n)return;const s=n.getLayoutProperty("icon-size"),o=s.indexOf(t.featureId);o<=-1||o+1>=s.length||(s[o+1]=a.getIconScale(t.id,t.width,t.height),r.setLayoutProperty(e.layerId,"icon-size",s))})})}_setFillPictureStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._imageSourceManager,o=this._opacity,l=this._visible,c={"fill-opacity":{values:[],def:.25},"fill-pattern":{values:[],def:""},"fill-outline-color":{values:[],def:"#000000"}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.PictureFillSymbol||i instanceof r.SimpleFillSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.PictureFillSymbol({id:i.id}));const a=i.type===r.SymbolType.pictureFill,n=g.applyVisibleAndOpacityToColor(i.color,l&&e.visible,o),h=g.applyVisibleAndOpacityToColor(i.outline.color,l&&e.visible,o);if(c["fill-opacity"].values.push(t,n.alpha),c["fill-outline-color"].values.push(t,h.toCssRGBAString()),c["fill-pattern"].values.push(t,i.id),a){const e=Math.max(i.xscale,i.yscale),t=Math.max(i.width,i.height);s.updateImage(i.id,i.url,{pfsSize:t,pfsScale:e})}else{const e=Object(r.createSimpleFillSymbolCanvas)(i,{lineWidth:1}).toDataURL();s.updateImage(i.id,e,{pattern:i.style,color:n.toCssRGBAString()})}}),this._setLayoutAndPaintCaches(a,c,{},t,i)}_setLayoutAndPaintCaches(e,t,i,r,a,n){n||(n=[]);for(const e in t)if(n.findIndex(t=>t===e)>-1)r[e]=t[e];else if(t[e].values.length>0){let i=[];i.push("match"),i.push(["get","id"]),(i=i.concat(t[e].values)).push(t[e].def),r[e]=i}else r[e]=t[e].def;for(const e in i)if(n.findIndex(t=>t===e)>-1)a[e]=i[e];else if(i[e].values.length>0){let t=[];t.push("match"),t.push(["get","id"]),(t=t.concat(i[e].values)).push(i[e].def),a[e]=t}else a[e]=i[e].def}_dividePointGraphic(e){const{symbol:t}=e;let i=!1,a=this._sourceMetaDatas.circle;switch(t.type){case r.SymbolType.simpleMarker:i=this._replaceSourceLayer(e,"circle"),a=this._sourceMetaDatas.circle;break;case r.SymbolType.text:i=this._replaceSourceLayer(e,"text"),a=this._sourceMetaDatas.text;break;case r.SymbolType.pictureMarker:i=this._replaceSourceLayer(e,"icon"),a=this._sourceMetaDatas.icon}if(!i){const{featureCollection:t}=a;t.push(e),a.setDirty(!0)}return a}_replaceSourceLayer(e,t){const i=this.metaIds,r=this._hasGraphicInCollection(i,e);if(r){if(r.renderType===t)return!0;this._removeGraphicsToCollection([e])}return!1}_dividePolylineGraphic(e){const t=this._hasGraphicInCollection(["line"],e),i=this._sourceMetaDatas.line;if(!t){const{featureCollection:t}=i;t.push(e),i.setDirty(!0)}return i}_dividePolygonGraphic(e){let t=!1;const{symbol:i}=e;let a=this._sourceMetaDatas.fill,n=i.type;switch(n===r.SymbolType.simpleFill&&"solid"!==i.style&&(n=r.SymbolType.pictureFill),n){case r.SymbolType.simpleMarker:t=this._replaceSourceLayer(e,"circle"),a=this._sourceMetaDatas.circle;break;case r.SymbolType.text:t=this._replaceSourceLayer(e,"text"),a=this._sourceMetaDatas.text;break;case r.SymbolType.pictureMarker:t=this._replaceSourceLayer(e,"icon"),a=this._sourceMetaDatas.icon;break;case r.SymbolType.pictureFill:t=this._replaceSourceLayer(e,"fill-picture"),a=this._sourceMetaDatas["fill-picture"];break;case r.SymbolType.simpleFill:t=this._replaceSourceLayer(e,"fill"),a=this._sourceMetaDatas.fill}if(!t){const{featureCollection:t}=a;t.push(e),a.setDirty(!0)}return a}_hasGraphicInCollection(e,t){const i=Array.isArray(e)?e:[e];let r;for(let e=0;e<i.length;e++){const a=this._sourceMetaDatas[i[e]];if(!a)break;const{featureCollection:n}=a;if(n.indexOf(t)>-1){r=a;break}}return r}set opacity(e){this._opacity!==e&&(this._opacity=e,this._updatePaintAndLayoutStyles())}get opacity(){return this._opacity}set visible(e){this._visible!==e&&(this._visible=e,this._updatePaintAndLayoutStyles())}get visible(){return this._visible}_updatePaintAndLayoutStyles(){const e=Object.values(this._sourceMetaDatas);for(let t=0;t<e.length;t++)e[t].setStyleLayerDirty(!0);this._refreshSourceAndLayers()}_getBottomLayer(){return this._sourceMetaDatas[this.metaIds[0]]}_getRenderTypeBySymbol(e){let t="circle";switch(e.type){case r.SymbolType.simpleMarker:t="circle";break;case r.SymbolType.simpleLine:t="line";break;case r.SymbolType.simpleFill:t="fill","solid"!==e.style&&(t="fill-picture");break;case r.SymbolType.text:t="text";break;case r.SymbolType.pictureMarker:t="icon";break;case r.SymbolType.pictureFill:t="fill-picture"}return t}};function Z(e,t){const i=(t=t||{}).featureSet,a=t.mapboxglMap;if(!i||!a)throw new Error("featureSet或mapboxglMap对象缺失");const n=e.renderer,s={type:"geojson",data:i.toGeoJSON()};n instanceof r.ClusterRenderer&&(s.cluster=!0,s.clusterRadius=n.radius),Z.imageSourceManager||(Z.imageSourceManager=new E(a));const o={};o[e.id]=s;const l={featureSet:i,imageSourceManager:Z.imageSourceManager,updateState:null},c=e.opacity,h=e.visible;return{sources:o,layers:G(e.id,n,e.geometryType,h,c,l)}}function $(e,t){const i=(t=t||{}).mapboxglMap;if(!i)throw new Error("featureSet或mapboxglMap对象缺失");$.imageSourceManager||($.imageSourceManager=new E(i));const r=new U({id:e.id,opacity:e.opacity,visible:e.visible});r._imageSourceManager=$.imageSourceManager,e.graphics.forEach(e=>{r._updateGraphicToCollection(e)});const a={},n=[];return Object.entries(r._sourceMetaDatas).forEach(e=>{const t=e[1],{featureCollection:i,sourceId:s}=t;if(i.length<=0)return;a[s]={type:"geojson",data:{type:"FeatureCollection",features:i.map(function(e){return g.convertToGeoJSON(e)})}};const o=r.setSourceMetaDataStyle(t,!1);n.push(o)}),{layers:n,sources:a}}const q=window.mapv||{},{baiduMapLayer:K,DataSet:W}=q,J=K?K.__proto__:Function;var X=class extends J{constructor(e,t,i,r){super(e,t,i),J&&(this.map=e,this.dataSet=t,i=i||{},this.init(i),this.argCheck(i),this.initDevicePixelRatio(),this.canvasLayer=r,this.stopAniamation=!1,this.animation=i.animation,this.mousemoveEvent=this.mousemoveEvent.bind(this),this.bindEvent())}initDevicePixelRatio(){this.devicePixelRatio=window.devicePixelRatio||1}clickEvent(e){const t=e.point;super.clickEvent(t,e)}mousemoveEvent(e){const t=e.point;super.mousemoveEvent(t,e)}addAnimatorEvent(){}animatorMovestartEvent(){const e=this.options.animation;this.isEnabledTime()&&this.animator&&(this.steps.step=e.stepsRange.start)}animatorMoveendEvent(){this.isEnabledTime()&&this.animator}bindEvent(){const e=this.map;this.options.methods&&(this.options.methods.click&&e.on("click",this.clickEvent),this.options.methods.mousemove&&e.on("mousemove",this.mousemoveEvent))}unbindEvent(){const e=this.map;this.options.methods&&(this.options.methods.click&&e.off("click",this.clickEvent),this.options.methods.mousemove&&e.off("mousemove",this.mousemoveEvent))}getContext(){return this.canvasLayer.canvas.getContext(this.context)}init(e){const t=this;t.options=e,this.initDataRange(e),this.context=t.options.context||"2d",t.options.zIndex&&this.canvasLayer&&this.canvasLayer.setZIndex(t.options.zIndex),this.initAnimator()}_canvasUpdate(e){const t=this.map;if(!this.canvasLayer||this.stopAniamation||this.canvasLayer.disposeFlag)return;const i=this,r=i.options.animation,a=this.getContext();if(i.isEnabledTime()){if(void 0===e)return void this.clear(a);"2d"===this.context&&(a.save(),a.globalCompositeOperation="destination-out",a.fillStyle="rgba(0, 0, 0, .1)",a.fillRect(0,0,a.canvas.width,a.canvas.height),a.restore())}else this.clear(a);if("2d"===this.context)for(const e in i.options)a[e]=i.options[e];else a.clear(a.COLOR_BUFFER_BIT);if(i.options.minZoom&&t.getZoom()<i.options.minZoom||i.options.maxZoom&&t.getZoom()>i.options.maxZoom)return;const s={transferCoordinate(e){const i=t.project(new n.a.LngLat(e[0],e[1]));return[i.x,i.y]}};void 0!==e&&(s.filter=function(t){const i=r.trails||10;return!!(e&&t.time>e-i&&t.time<e)});const o=i.dataSet.get(s);this.processData(o),"m"==i.options.unit&&i.options.size,i.options._size=i.options.size;const l=t.project(new n.a.LngLat(0,0));this.drawContext(a,new W(o),i.options,l),i.options.updateCallback&&i.options.updateCallback(e)}updateData(e,t){let i=e;i&&i.get&&(i=i.get()),void 0!=i&&this.dataSet.set(i),super.update({options:t})}addData(e,t){let i=e;e&&e.get&&(i=e.get()),this.dataSet.add(i),this.update({options:t})}getData(){return this.dataSet}removeData(e){if(!this.dataSet)return;const t=this.dataSet.get({filter:t=>null==e||"function"!=typeof e||!e(t)});this.dataSet.set(t),this.update({options:null})}clearData(){this.dataSet&&this.dataSet.clear(),this.update({options:null})}draw(){this.canvasLayer.draw()}clear(e){e&&e.clearRect&&e.clearRect(0,0,e.canvas.width,e.canvas.height)}};var Y=class{constructor(e,t,i){i=i||{},this.map=e,this.layerID=i.layerID,delete i.layerID,this.mapvBaseLayer=new X(e,t,i,this),this.mapVOptions=i,this.initDevicePixelRatio(),this.canvas=this._createCanvas(),this.render=this.render.bind(this),this.bindEvent(),this.mapContainer=e.getCanvasContainer(),this.mapContainer.appendChild(this.canvas),this._reset()}initDevicePixelRatio(){this.devicePixelRatio=window.devicePixelRatio||1}bindEvent(){const e=this.map;this.innerMoveStart=this.moveStartEvent.bind(this),this.innerMoveEnd=this.moveEndEvent.bind(this),this.innnerZoomStart=this.zoomStartEvent.bind(this),this.innnerZoomEnd=this.zoomEndEvent.bind(this),this.innnerRotateStart=this.rotateStartEvent.bind(this),this.innnerRotateEnd=this.rotateEndEvent.bind(this),this.innerResize=this.resizeEvent.bind(this),this.innerRemove=this.removeEvent.bind(this),e.on("resize",this.innerResize),e.on("zoomstart",this.innnerZoomStart),e.on("zoomend",this.innnerZoomEnd),e.on("rotatestart",this.innnerRotateStart),e.on("rotateend",this.innnerRotateEnd),e.on("movestart",this.innerMoveStart),e.on("moveend",this.innerMoveEnd),this.map.on("remove",this.innerRemove)}unbindEvent(){const e=this.map;e.off("resize",this.innerResize),e.off("zoomstart",this.innnerZoomStart),e.off("zoomend",this.innnerZoomEnd),e.off("rotatestart",this.innnerRotateStart),e.off("rotateend",this.innnerRotateEnd),e.off("movestart",this.innerMoveStart),e.off("moveend",this.innerMoveEnd)}moveStartEvent(){this.mapvBaseLayer.animatorMovestartEvent(),this._unvisiable()}moveEndEvent(){this.mapvBaseLayer.animatorMoveendEvent(),this._reset(),this._visiable()}zoomStartEvent(){this._unvisiable()}zoomEndEvent(){this._unvisiable()}rotateStartEvent(){this.mapvBaseLayer.animatorMovestartEvent(),this._unvisiable()}rotateEndEvent(){this.mapvBaseLayer.animatorMoveendEvent(),this._reset(),this._visiable()}resizeEvent(){this._reset(),this._visiable()}removeEvent(){this.mapContainer.removeChild(this.canvas)}addData(e,t){this.mapvBaseLayer.addData(e,t)}updateData(e,t){this.mapvBaseLayer.updateData(e,t)}getData(){return this.mapvBaseLayer&&(this.dataSet=this.mapvBaseLayer.getData()),this.dataSet}removeData(e){this.mapvBaseLayer&&this.mapvBaseLayer.removeData(e)}removeAllData(){this.mapvBaseLayer.clearData()}_visiable(){return this.canvas.style.display="block",this}_unvisiable(){return this.canvas.style.display="none",this}_createCanvas(){const e=document.createElement("canvas"),t=this.devicePixelRatio;return e.id=this.layerID,e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.width=parseInt(this.map.getCanvas().style.width)*t,e.height=parseInt(this.map.getCanvas().style.height)*t,this.mapVOptions.context&&"2d"!=this.mapVOptions.context||e.getContext("2d").scale(t,t),e.style.width=this.map.getCanvas().style.width,e.style.height=this.map.getCanvas().style.height,e}_reset(){null!=this.canvas&&(this.resizeCanvas(),this.fixPosition(),this.onResize(),this.render())}draw(){return this._reset()}show(){this._visiable()}hide(){this._unvisiable()}update(e){void 0!=e&&this.updateData(e.data,e.options)}resizeCanvas(){if(this.mapContainer.style.perspective=`${this.map.transform.cameraToCenterDistance}px`,void 0==this.canvas||null==this.canvas)return;const e=this.canvas,t=this.devicePixelRatio;e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.width=parseInt(this.map.getCanvas().style.width)*t,e.height=parseInt(this.map.getCanvas().style.height)*t,this.mapVOptions.context&&"2d"!=this.mapVOptions.context||e.getContext("2d").scale(t,t)}fixPosition(){}onResize(){}originPosition(){this.originPitch=this.map.getPitch(),this.originBearing=this.map.getBearing();const e=this.map.project(new n.a.LngLat(0,0));this.originX=e.x,this.originY=e.y}render(){void 0!=this.mapvBaseLayer&&this.mapvBaseLayer._canvasUpdate()}moveTo(e,t){const i=document.getElementById(this.layerID);if(t=void 0===t||t){const t=document.getElementById(e);return void(i&&t&&t.parentNode.insertBefore(i,t))}const r=document.getElementById(e);if(i){if(r.nextSibling)return void r.parentNode.insertBefore(i,r.nextSibling);r.parentNode.appendChild(i)}}remove(){this.removeAllData(),this.unbindEvent(),this.mapContainer.removeChild(this.canvas),this.disposeFlag=!0}destroy(){this.removeAllData(),this.unbindEvent(),this.mapContainer.removeChild(this.canvas),this.disposeFlag=!0}};const H=window.echarts;function Q(e,t){this._MapboxGLMap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}Q.prototype.dimensions=["lng","lat"],Q.prototype.setMapOffset=function(e){this._mapOffset=e},Q.prototype.getBMap=function(){return this._MapboxGLMap},Q.prototype.dataToPoint=function(e){const t=this._MapboxGLMap.project(e),i=this._mapOffset;return[t.x-i[0],t.y-i[1]]},Q.prototype.pointToData=function(e){const t=this._mapOffset;return[(e=this._MapboxGLMap.project([e[0]+t[0],e[1]+t[1]])).lng,e.lat]},Q.prototype.getViewRect=function(){const e=this._api;return new H.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},Q.prototype.getRoamTransform=function(){return H.matrix.create()},Q.prototype.prepareCustoms=function(e){const t=H.util,i=this.getViewRect();return{coordSys:{type:"mapboxgl",x:i.x,y:i.y,width:i.width,height:i.height},api:{coord:t.bind(this.dataToPoint,this),size:t.bind(function(e,i){return i=i||[0,0],t.map([0,1],function(t){const r=i[t],a=e[t]/2,n=[],s=[];return n[t]=r-a,s[t]=r+a,n[1-t]=s[1-t]=i[1-t],Math.abs(this.dataToPoint(n)[t]-this.dataToPoint(s)[t])},this)},this)}}},Q.dimensions=Q.prototype.dimensions,Q.create=function(e,t){let i;e.eachComponent("mapboxgl",function(e){t.getZr().painter.getViewportRoot();const r=H.mapboxglMap;(i=new Q(r,t)).setMapOffset(e.__mapOffset||[0,0]),e.coordinateSystem=i}),e.eachSeries(function(e){"mapboxgl"===e.get("coordinateSystem")&&(e.coordinateSystem=i)})};var ee=Q;const te=window.echarts;var ie=class{constructor(e,t){return t=t||{},this.map=e,this.options=t,this.layerId=t.layerId||"echartlayerdefaultid",this.layerClass=t.classId||"echartlayerdefaultclass",this.initDevicePixelRatio(),this.mapContainer=e.getCanvasContainer(),this.canvas=this._createCanvas(),this.mapContainer.appendChild(this.canvas),this.mapContainer.style.perspective=`${this.map.transform.cameraToCenterDistance}px`,this.chart=te.init(this.canvas),this.visible=!0,this.initEcharts(),this._resizeCanvas(),this}initDevicePixelRatio(){this.devicePixelRatio=window.devicePixelRatio||1}initEcharts(){return te.mapboxglMap=this.map,te.registerCoordinateSystem("mapboxgl",ee),te.extendComponentModel({type:"mapboxgl",getBMap(){return this.__mapboxgl},defaultOption:{roam:!1}}),te.registerAction({type:"MapboxGLRoma",event:"MapboxGLRoma",update:"updateLayout"},function(e,t){}),this}_createCanvas(){const e=document.createElement("div");return e.id=this.layerId,e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.width=parseInt(this.map.getCanvas().style.width),e.height=parseInt(this.map.getCanvas().style.height),e.style.width=this.map.getCanvas().style.width,e.style.height=this.map.getCanvas().style.height,e.setAttribute("id",this.layerId),e.setAttribute("class",this.layerClass),e}_resizeCanvas(){const e=this;window.onresize=function(){const t=e.canvas,i=e.map;t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.width=i.getCanvas().style.width,t.style.height=i.getCanvas().style.height,t.width=parseInt(i.getCanvas().style.width),t.height=parseInt(i.getCanvas().style.height),e.chart.resize()}}addTo(e){const t=this;return te.extendComponentView({type:"mapboxgl",render(e,i,r){let a=!0;const n=te.mapboxglMap,s=r.getZr().painter.getViewportRoot(),o=e.coordinateSystem,l=function(i,n){if(a||!t.visible)return;const l=document.getElementsByClassName("mapboxgl-map")[0],c=[-parseInt(l.style.left,10)||0,-parseInt(l.style.top,10)||0];s.style.left=`${c[0]}px`,s.style.top=`${c[1]}px`,o.setMapOffset(c),e.__mapOffset=c,r.dispatchAction({type:"MapboxGLRoma"})};function c(){!a&&t.visible&&r.dispatchAction({type:"MapboxGLRoma"})}n.off("move",this._oldMoveHandler),n.off("zoomend",this._oldZoomEndHandler),n.on("move",l),n.on("zoomend",c),this._oldMoveHandler=l,this._oldZoomEndHandler=c,e.get("roam"),a=!1}}),this.chart.setOption(this.options),this}_visible(){this.visible=!0,this.canvas.style.visibility="visible"}_unvisible(){this.visible=!1,this.canvas.style.visibility="hidden"}show(){this._visible()}hide(){this._unvisible()}remove(){const e=this;return this.map._listeners.move.forEach(function(t){"moveHandler"===t.name&&e.map.off("move",t)}),this.map._listeners.move.forEach(function(t){"zoomEndHandler"===t.name&&e.map.off("zoomend",t)}),this.chart.clear(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.map=void 0,this}update(e){this.chart.setOption(e)}};function re(e,t){t=t||{};let i={sources:{},layers:[]};switch(e.type){case r.LayerType.IGSMapImage:i=oe.getSourcesAndStyleLayers(e);break;case r.LayerType.IGSTile:i=b.getSourcesAndStyleLayers(e);break;case r.LayerType.ArcGISVectorTile:case r.LayerType.IGSVectorTile:i=ce.getSourcesAndStyleLayers(e);break;case r.LayerType.ArcGISTile:i=S.getSourcesAndStyleLayers(e);break;case r.LayerType.ArcGISMapImage:i=x.getSourcesAndStyleLayers(e);break;case r.LayerType.WMTS:i=M.getSourcesAndStyleLayers(e);break;case r.LayerType.WMS:i=V.getSourcesAndStyleLayers(e);break;case r.LayerType.webTile:i=k.getSourcesAndStyleLayers(e);break;case r.LayerType.IGSFeature:case r.LayerType.GeoJSON:case r.LayerType.WFS:i=Z(e,t);break;case r.LayerType.graphics:i=$(e,t);break;case r.LayerType.IGSImage:i=de.getSourcesAndStyleLayers(e);break;case r.LayerType.IGSImageTile:i=ue.getSourcesAndStyleLayers(e);break;default:r.Log.error("未支持的图层类型")}return i}function ae(e,t){const{sources:i,layers:r}=e,a=Object.entries(i);for(let e=0;e<a.length;e++){const i=a[e];t.addSource(i[0],i[1])}for(let e=0;e<r.length;e++)t.addLayer(r[e]);return!0}function ne(e){return g.createCRSByLayer(e)}class se{}se.addIGSMapImageLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=se.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},se.getSourcesAndStyleLayers=function(e,t){t=t||{};const{layerView:i={}}=t,{extensionOptions:a={}}=e,{view:n}=i,s=`source_${e.id}`,o=`layer_${e.id}`;let l={layers:e.layers,format:e.imageFormat,size:`${e.imageWidth},${e.imageHeight}`,clientId:e.clientId,isAntialiasing:e.isAntialiasing,layerFilters:e.getFilters(),transparent:e.imageTransparent,tokenKey:e.tokenKey,tokenValue:e.tokenValue};if(n){!e.spatialReference.equals(n.spatialReference)&&(l.projectionSrs=n.spatialReference)}const c=Object(r.getIGSDynamicLayer)(e);c.length>0&&(l.dynamicLayers=c),l=Object.assign(l,a);const h=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGSMapImageLayerV1","IGSMapImageLayerV1Wrong","IGSMapImageLayerV2"]),d=r.ServerUtil.getImage(h,l);let y=d.url;const m=r.UrlUtil.getStringFromObject(d.queryParameters);m&&(y+=`?${m}`);const f={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(f.data=d.queryParameters);const g=u(y,e.imageWidth,e.renderMode,null,f,t.clippingArea),v=p(o,s,e,i),b={};return b[s]=g,{sources:b,layers:[v]}},se.initAllRequestParams=function(e){const t={};return(e=Object(r.defaultValue)(e,{})).hasOwnProperty("layers")&&(t.layers=e.layers),e.hasOwnProperty("imageTransparent")&&(t.imageTransparent=e.imageTransparent),e.hasOwnProperty("isAntialiasing")&&null!==e.isAntialiasing&&void 0!==e.isAntialiasing&&(t.isAntialiasing=e.isAntialiasing),e.hasOwnProperty("tokenKey")&&e.hasOwnProperty("tokenValue")&&e.tokenValue&&(t[e.tokenKey]=e.tokenValue),"2.0"===e.igsVersion?(t.size=`${e.width},${e.height}`,t.format=e.format,t.f="image",e.hasOwnProperty("styles")&&(t.layerStyles=e.styles),e.hasOwnProperty("filters")&&e.filters&&(t.layerFilters=e.filters),e.hasOwnProperty("dynamicLayers")&&(t.dynamicLayers=JSON.stringify(e.dynamicLayers)),e.hasOwnProperty("projectionSrs")&&(t.projectionSrs=e.projectionSrs),e.hasOwnProperty("clientId")&&(t.clientId=e.clientId)):(t.w=e.width,t.h=e.height,t.f="png",e.hasOwnProperty("styles")&&t.push(`style=${e.styles}`),e.hasOwnProperty("filters")&&e.filters&&(t.filters=e.filters),e.hasOwnProperty("clientId")&&(t.guid=e.clientId)),t},se.initLayerUrl=function(e,t,i){let a;a="2.0"===t.igsVersion?`${e}/image`:`${e}`;let n,s=se.initAllRequestParams(t);if("POST"===t.httpMethod)s.bbox="0,0,0,0",n={url:a,data:s=Object.assign(s,i),method:t.httpMethod};else{a+="?bbox={bbox}";for(const e in s){a+=`&${e}=${s[e]}`}const e=r.UrlUtil.getStringFromObject(i);e&&(a+=`&${e}`),n={url:a,method:t.httpMethod}}return t.headers&&(n.headers=t.headers),n},se.setVisible=function(e){l(e)},se.setOpacity=function(e){h(e)},se.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=se.addIGSMapImageLayer(e,{})},se.removeLayer=function(e){c(e)};var oe=se;class le{}le.addIGSVectorTileLayer=function(e,t){t=Object(r.defaultValue)(t,{});const{innerView:i,layer:a}=e,s=i.getStyle();let o=r.UrlUtil.getBaseUrlAndParams(a.url).params;Object(r.defined)(a.tokenKey)&&Object(r.defined)(a.tokenValue)&&(o[a.tokenKey]=a.tokenValue),e.queryParameters=o;const l=new n.a.RequestManager(function(e){const t=r.UrlUtil.getBaseUrlAndParams(e);t.params=Object.assign(t.params,o);let i=r.UrlUtil.getStringFromObject(t.params);return i&&(e+=`?${i}`),{url:e,method:"GET",headers:a.headers}});s.glyphs&&s.glyphs!==n.a.Style.DEFAULT_GLYPH_URL||(i.style.glyphManager.requestManager=l,i.style.glyphManager.setURL(a.style.glyphs),i.style.stylesheet.glyphs=a.style.glyphs),s.sprite||(i.style._loadSprite(a.style.sprite,l),i.style.stylesheet.sprite=a.style.sprite),le.addSourcesAndLayers(e,t.callback)},le.getStyle=function(e,t){const{innerView:i}=e,r=setInterval(()=>{i.isStyleLoaded()&&(clearInterval(r),t&&t instanceof Function&&t(i.getStyle()))},30)},le.setVisible=function(e,t){const{layer:i,innerView:r}=e,{layers:a}=i.style;a.forEach(e=>{r.setLayoutProperty(e.id,"visibility",t?"visible":"none")})},le.setOpacity=function(e,t){const{layer:i,innerView:r}=e,{layers:a}=i.style;a.forEach(e=>{const a=i._getBackupProperties(e.id,"opacities");a&&Object.keys(a).forEach(i=>{r.setPaintProperty(e.id,i,a[i]*t)})})},le.initLayerUrl=function(e,t){return"1.0"===t.igsVersion?(e+="/{z}/{y}/{x}",t.tokenKey&&t.tokenValue&&(e+=`?${t.tokenKey}=${t.tokenValue}`)):(e=`${e}/tileImage/{z}/{y}/{x}?f=image`,t.tokenKey&&t.tokenValue&&(e+=`&${t.tokenKey}=${t.tokenValue}`)),e},le.removeLayer=function(e){const t=e.layer.style.layers,i=e.layer.style.sources,r=e.innerView;for(let e=0;e<t.length;e++)r.getLayer(t[e].id)&&r.removeLayer(t[e].id);Object.keys(i).forEach(e=>{r.getSource(e)&&r.removeSource(e)})},le.setPaintProperties=function(e,t,i){const{innerView:r}=e;r.getLayer(t)&&i instanceof Object&&Object.keys(i).forEach(e=>{r.setPaintProperty(t,e,i[e])})},le.setLayoutProperties=function(e,t,i){const{innerView:r}=e;r.getLayer(t)&&i instanceof Object&&Object.keys(i).forEach(e=>{r.setLayoutProperty(t,e,i[e])})},le.updateStyleLayer=function(e,t,i){const{opacity:r=1,visible:a=!0}=i;t.forEach(t=>{if(t.paint){Object.keys(t.paint).forEach(i=>{if(/opacity$/.test(i)&&(t.paint[i]*=r),e){e.style.getLayer(t.id)&&e.style.setPaintProperty(t.id,i,t.paint[i])}})}if(t.layout){Object.keys(t.layout).forEach(i=>{if(/visibility$/.test(i)&&(t.layout[i]=a&&"visible"===t.layout[i]?"visible":"none"),e){e.style.getLayer(t.id)&&e.style.setLayoutProperty(t.id,i,t.layout[i])}})}}),e&&e._update&&e._update(!0)},le.addSourcesAndLayers=function(e,t){const{layer:i}=e,r=le.getSourcesAndStyleLayers(i,{layerView:e}),{sources:a,layers:n}=r;Object.keys(a).forEach(t=>{a[t].decryptOptions=i.decryptOptions,le._addSource(e,t,a[t])});for(let t=0;t<n.length;t++)le._addLayer(e,n[t].id,n[t]);t&&t instanceof Function&&t(this._getInnerLayers(e))},le._createStyleLayers=function(e,t){const i=(t=t||{}).layerView,r=JSON.parse(JSON.stringify(e.style.layers)),a=i?i._getLayerViewVisible():e.visible,n=i?i._getOpacity():e.opacity;return this.updateStyleLayer(null,r,{opacity:n,visible:a}),r},le._createSources=function(e,t){let i=r.UrlUtil.getBaseUrlAndParams(e.url).params;Object(r.defined)(e.tokenKey)&&Object(r.defined)(e.tokenValue)&&(i[e.tokenKey]=e.tokenValue);const a=e.style.sources,n=g.createCRSByLayer(e),s=g.convertClippingArea(e.clippingArea),o={};return Object.keys(a).forEach(t=>{const l=a[t];l.clippingArea=s,l.crs=n;const[c,h]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo);l.minzoom=c,l.maxzoom=h,l.requestParams={headers:e.headers,data:i},o[t]=l}),o},le.getSourcesAndStyleLayers=function(e,t){return{sources:this._createSources(e,t),layers:this._createStyleLayers(e,t)}},le._addLayer=function(e,t,i){e.innerView.getLayer(t)||e.innerView.addLayer(i)},le._addSource=function(e,t,i){e.innerView.getSource(t)||e.innerView.addSource(t,i)},le._getInnerLayers=function(e){const t=e.layer.style.layers,i=[];for(let r=0;r<t.length;r++)i.push(e.innerView.getLayer(t[r].id));return i};var ce=le;class he{}he.addIGSImageryTileLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=he.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},he.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,a=`source_${e.id}`,n=`layer_${e.id}`;let s={tokenKey:e.tokenKey,tokenValue:e.tokenValue};const o=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGSImageryTileLayerV2"]),l=r.ServerUtil.getTile(o,s);let c=l.url;const h=r.UrlUtil.getStringFromObject(l.queryParameters);h&&(c+=`?${h}`);const d={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(d.data=l.queryParameters);const y=u(c,e.tileInfo.getTileSize(),null,null,d,t.clippingArea),m=p(n,a,e,i),[f,v]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo);y.minzoom=f,y.maxzoom=v,y.crs=g.createCRSByLayer(e);const b={};return b[a]=y,{sources:b,layers:[m]}},he.initLayerUrl=function(e,t){return e=`${e}/tileImage/{z}/{y}/{x}?f=image`,t.tokenKey&&t.tokenValue&&(e+=`&${t.tokenKey}=${t.tokenValue}`),e},he.setVisible=function(e){l(e)},he.setOpacity=function(e){h(e)},he.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=he.addIGSTileLayer(e,{})},he.removeLayer=function(e){c(e)};var ue=he;class pe{}pe.addIGSImageryLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=pe.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},pe.getSourcesAndStyleLayers=function(e,t){t=t||{};const{extensionOptions:i={}}=e,a=`source_${e.id}`,n=`layer_${e.id}`,s=t.layerView;let o=Object.assign({imageWidth:e.imageWidth,imageHeight:e.imageHeight,imageFormat:e.format,tokenKey:e.tokenKey,tokenValue:e.tokenValue,tokenAttachType:e.tokenAttachType,httpMethod:e.httpMethod,renderMode:e.renderMode,interpolation:e.interpolation,renderingRule:e.rasterFunction,bandIds:e.bandIds},t);if(s&&s.view){!e.spatialReference.equals(s.view.spatialReference)&&(o.imageSR=s.view.spatialReference)}o=Object.assign(o,i);const l=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGSImageryLayerV2"]),c=r.ServerUtil.getImage(l,o);let h=c.url;const d=r.UrlUtil.getStringFromObject(c.queryParameters);d&&(h+=`?${d}`);const y={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(y.data=c.queryParameters);const m=u(h,e.imageWidth,e.renderMode,null,y,t.clippingArea),f=p(n,a,e,s),g={};return g[a]=m,{sources:g,layers:[f]}},pe.setVisible=function(e){l(e)},pe.setOpacity=function(e){h(e)},pe.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=pe.addIGSImageryLayer(e,{})},pe.removeLayer=function(e){c(e)};var de=pe;var ye=class extends r.Evented{constructor(e){super(e),this.view=Object(r.defaultValue)(e.view,null),this.location=Object(r.defaultValue)(e.location,""),this.title=Object(r.defaultValue)(e.title,""),this.content=Object(r.defaultValue)(e.content,""),this.alignment=Object(r.defaultValue)(e.alignment,"bottom-center"),this.defaultButtons=Object(r.defaultValue)(e.defaultButtons,["toggle","close","zoom"]),this._popup=void 0,this._initPopup(),this._initDefaultClass()}_initPopup(){this._customPopup(),this.view._innerView.closePopupOnClick=!1}_initDefaultClass(){let e=!1;const t=document.head.getElementsByTagName("style");if(t)for(let i=0;i<t.length;i++)if(t[i].innerHTML.indexOf("styleDomString")>-1){e=!0;break}if(!e){const e=document.createElement("style");e.innerHTML="\n .zondy-popup__container{\n background-color: #fff;\n padding:0;\n border-radius: 10px;\n }\n .zondy-popup__tip-default{\n background-color: #fff;\n }\n .zondy-popup__header-default{\n padding: 8px;\n font-size: 18px;\n font-weight: 600;\n line-height: 20px;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n white-space: nowrap;\n }\n .zondy-popup__content-default{\n padding: 8px;\n }\n .zondy-popup__footer-default{\n }\n .zondy-popup__footer-division{\n border-top: 1px solid;\n }\n .zondy-popup__toggle-default,.zondy-popup__close-default{\n display: inline-block;width: 30px;text-align: center;\n }\n ",document.querySelector("head").append(e)}}_customPopup(){}open(e){this._popup?(this.close(),this._popup=void 0,this.openPopup(e)):this.openPopup(e)}openPopup(e){if(this.view=Object(r.defaultValue)(e.view,this.view),this.location=Object(r.defaultValue)(e.location,this.location),this.location.spatialReference.isGeographic?this._location=this.location:this._location=r.Projection.project(this.location,new r.SpatialReference({wkid:4326})),this.title=Object(r.defaultValue)(e.title,this.title),this.content=Object(r.defaultValue)(e.content,this.content),this.alignment=Object(r.defaultValue)(e.alignment,this.alignment),this.defaultButtons=Object(r.defaultValue)(e.defaultButtons,this.defaultButtons),!this.view._innerView)return void r.Log.info("没有视图引擎!");const t=this._contentUI(this.title,this.content);this._popup=new n.a.Popup({closeOnClick:!1,closeButton:!1,maxWidth:"1900px"}).setLngLat(this._location.coordinates).setDOMContent(t).addTo(this.view._innerView),this._popup.toggleClassName("highlighted");const i=this._popup._container.getElementsByClassName("mapboxgl-popup-content");for(let e=0;e<i.length;e++)i[e].style.padding="0",i[e].style.borderRadius="10px"}_contentUI(e,t){const i=this;let r=void 0;const a=function(e){const t=document.createElement("div");return t.innerHTML=e,t.childNodes};(r=document.createElement("div")).setAttribute("id",`${this.id}-popup-default`);const n=document.createElement("div");n.setAttribute("class","zondy-popup__header-default zondy-popup__header"),n.setAttribute("style","display: flex;");const s=a('<div class="zondy-popup__toggle-default zondy-popup__toggle">\n <svg aria-hidden="true" class="svg" fill="currentColor" height="16px" width="16px" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M5 13.793l7-7 7 7v1.414l-7-7-7 7z"></path></svg>\n </div>')[0],o=a('<div class="zondy-popup__close-default zondy-popup__close">\n <svg aria-hidden="true" class="svg" fill="currentColor" height="16px" width="16px" viewBox="0 0 16 16" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M3.98 11.303L7.281 8 3.98 4.697l.707-.707L7.99 7.293l.01-.01.01.01 3.304-3.303.707.707L8.718 8l3.303 3.303-.707.707L8.01 8.707l-.01.01-.01-.01-3.304 3.303z"></path></svg>\n </div>')[0];if(e||""===e){const t=a('<div style="flex: 1;"></div>')[0];if(n.appendChild(t),"object"==typeof e?e instanceof Node?t.appendChild(e):e instanceof NodeList&&e.forEach(e=>{t.appendChild(e)}):t.innerHTML=e,this.defaultButtons.indexOf("toggle")>-1){n.appendChild(s);let e=!0;s.onclick=function(){e=!e,document.getElementById(`${i.id}-popup-default`).querySelector(".zondy-popup__content-default").style.display=e?"block":"none"}}this.defaultButtons.indexOf("close")>-1&&(n.appendChild(o),o.onclick=(()=>{this.close()}))}const l=document.createElement("div");if(l.setAttribute("class","zondy-popup__content-default zondy-popup__content"),t)if("object"==typeof t){if(t instanceof Node)l.appendChild(t);else if(t instanceof NodeList)for(let e=0;e<t.length;e++)l.appendChild(t[e]),e--}else l.innerHTML=t;const c=document.createElement("div");c.setAttribute("class","zondy-popup__footer-default zondy-popup__footer");const h=a('<div class="zondy-popup__zoom" style="display: inline-block;width: 36px;height: 36px;line-height: 36px;text-align: center;">\n <svg class="svg" fill="currentColor" height="16px" width="16px" viewBox="0 0 16 16" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M9 7H7v2H6V7H4V6h2V4h1v2h2zm6.805 7.861l-.943.942a.665.665 0 0 1-.943 0l-3.067-3.067a.667.667 0 0 1 0-.943l.129-.13-1.108-1.107A5.279 5.279 0 1 1 11.8 6.5a5.251 5.251 0 0 1-1.237 3.366l1.108 1.108.124-.124a.668.668 0 0 1 .943 0l3.067 3.068a.666.666 0 0 1 0 .943zM10.8 6.5a4.3 4.3 0 1 0-4.3 4.3 4.304 4.304 0 0 0 4.3-4.3zm4.062 7.89l-2.595-2.598-.473.473 2.597 2.595z"></path></svg>\n </div>')[0];return this.defaultButtons.indexOf("zoom")>-1&&(c.appendChild(h),h.onclick=function(){i.view.flyTo({zoom:i.view._zoom+1,center:i.location})}),c.childNodes.length>0&&c.setAttribute("class","zondy-popup__footer-division zondy-popup__footer-default zondy-popup__footer"),r.appendChild(n),r.appendChild(l),r.appendChild(c),r}_getOffset(){}_getOffsetByAlignment(e,t,i){let r=0,a=0;switch(e){case"top-left":r=t/2,a=i;break;case"top-center":a=i;break;case"top-right":r=-t/2,a=i;break;case"bottom-left":r=t/2;break;case"auto":case"bottom-center":break;case"bottom-right":r=-t/2}return{x:r,y:a}}close(){this.view._innerView&&this._popup.remove()}destroy(){}};var me=class{constructor(e){e=Object(r.defaultValue)(e,{}),this.view=Object(r.defaultValue)(e.view,null),this.format=Object(r.defaultValue)(e.format,r.PictureFormat.PNG),this.filename=Object(r.defaultValue)(e.filename,"screenshotFile"),this.width=Object(r.defaultValue)(e.width,void 0),this.height=Object(r.defaultValue)(e.height,void 0),this.x=Object(r.defaultValue)(e.x,0),this.y=Object(r.defaultValue)(e.y,0),this.isDownload=Object(r.defaultValue)(e.isDownload,!0)}_addView(){const e=this,t=this.view._innerView.getCanvas();let i=null;this.format===r.PictureFormat.PNG?i=t.toDataURL():this.format===r.PictureFormat.JPEG?i=t.toDataURL("image/jpeg"):"svg"===this.format&&(i=t.toDataURL());const a=document.createElement("canvas");a.width=this.width,a.height=this.height;const n=a.getContext("2d"),s=function(e,t){const i=document.createElement("a");i.href=e,i.download=t,document.body.appendChild(i),i.click()};return new Promise(t=>{if(this.width&&this.height){const o=new Image;o.src=i,o.onload=function(){n.drawImage(o,e.x,e.y,e.width,e.height,0,0,e.width,e.height);let i=null;e.format===r.PictureFormat.PNG?i=a.toDataURL():e.format===r.PictureFormat.JPEG?i=a.toDataURL("image/jpeg"):"svg"===e.format&&(i=a.toDataURL()),e.isDownload&&s(i,e.filename),t({dataUrl:i})}}else e.isDownload&&s(i,this.filename),t({dataUrl:i})})}_removeView(){}};var fe=class extends r.LayerView{onAdd(){const e=this.layer;return this.innerLayer=oe.addIGSMapImageLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return oe.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":oe.setVisible(this);break;case"opacity":oe.setOpacity(this);break;case"sublayerVisible":case"refresh":oe.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var ge=class extends r.LayerView{onAdd(){const{layer:e}=this;return this.innerLayer=b.addIGSTileLayer(this),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return b.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":b.setVisible(this);break;case"opacity":b.setOpacity(this);break;case"refresh":b.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var ve=class extends r.LayerView{onAdd(){const e=this.layer,t=this._getLayerViewVisible();return this.innerLayer=V.addWMSLayer(this,{visible:t,clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return V.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":V.setVisible(this,i);break;case"opacity":V.setOpacity(this);break;case"refresh":case"sublayerVisible":V.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var be=class extends r.LayerView{onAdd(){const e=this.layer;return this.innerLayer=M.addWMTSLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return M.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":M.setVisible(this);break;case"opacity":M.setOpacity(this);break;case"refresh":M.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var _e=class extends r.BaseGraphicsLayerView{onAdd(e){const t=this.layer,i=this.innerView,r=this,a=t.extensionOptions||{},n=Object.assign({id:t.id,opacity:this._getOpacity(),visible:this._getLayerViewVisible()},a);return r.innerLayer=new U(n),r.innerLayer.onAdd(i).then(()=>{const e=t.graphics.items||[];return r.innerLayer.commonLayerId=t.id,r._addFeature(r.innerLayer,e),Promise.resolve(this)})}onRemove(e){return this.innerLayer.onRemove(this.innerView),this.innerLayer=null,Promise.resolve(this)}onUpdate(e){this.layer;const t=this.innerLayer;return e.updateContent&&t&&e.updateContent.forEach(e=>{if(e&&"property"===e.operationType)switch(e.name){case"opacity":t.opacity=this._getOpacity();break;case"scaleVisible":case"minScale":case"maxScale":case"visible":{const i=this._getLayerViewVisible("scaleVisible"===e.name);t.visible=i;break}}if(e&&"method"===e.operationType)switch(e.name){case"add":{const i=e.params;this._addFeature(t,i[0]);break}case"remove":{const i=e.params;this._removeFeature(t,i[0]);break}case"addMany":{let i=e.params[0];i instanceof r.FeatureSet&&(i=i.features),this._addFeature(t,i);break}case"removeMany":{const i=e.params[0];this._removeFeature(t,i);break}case"removeAll":t.removeAll();break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}),Promise.resolve(this)}_addFeature(e,t){const i=Array.isArray(t)?t:[t];i.forEach(()=>{t.geometry&&!t.geometry.spatialReference&&(t.geometry.spatialReference=this.layer.spatialReference)}),this.render.drawFeature(e,i)}_removeFeature(e,t){const i=Array.isArray(t)?t:[t];this.render.clearFeature(e,i)}};var Se=class extends r.FeatureRender{drawFeature(e,t){e&&e.add(t)}updateFeature(e,t,i){e&&e.update(t,i)}clearFeature(e,t){e&&e.remove(t)}clear(e){e&&e.removeAll()}};var we=class extends r.LayerView{onAdd(){return this._layerViewVisible=this._getLayerViewVisible(),ce.addIGSVectorTileLayer(this,{callback:e=>{for(let t=0;t<e.length;t++)e[t].commonLayerId=this.layer.id;this.innerLayer=e}}),Promise.resolve(this)}onRemove(){return ce.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t],{params:r}=i;if(i)switch(i.name){case"setPaintProperties":ce.setPaintProperties(this,r[0],r[1]);break;case"setLayoutProperties":ce.setLayoutProperties(this,r[0],r[1]);break;case"sublayerUpdate":this._updateStyle(this.innerView,JSON.parse(JSON.stringify(r[0])));break;case"opacity":case"setStyleLayer":case"deleteStyleLayer":case"refresh":this._updateStyle(this.innerView,JSON.parse(JSON.stringify(this.layer.style.layers)));break;case"scaleVisible":case"minScale":case"maxScale":case"visible":const e=this._getLayerViewVisible("scaleVisible"===i.name);this._layerViewVisible!==e&&(this._updateStyle(this.innerView,JSON.parse(JSON.stringify(this.layer.style.layers))),this._layerViewVisible=e);break;case"clippingArea":{const e=i.params[0],t=this.innerView,r=this.layer.style.sources;r&&Object.entries(r).forEach(i=>{const r=i[0],a=t.getSource(r);a&&"vector"===a.type&&a.setClippingArea&&a.setClippingArea(g.convertClippingArea(e))});break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}_updateStyle(e,t){const i=this._getOpacity(),r=this._getLayerViewVisible();ce.updateStyleLayer(e,t,{opacity:i,visible:r})}};var xe=class extends r.BaseRendererLayerView{constructor(e){super(e),this.styleLayers=[]}onAdd(e){const t=this.layer.renderer;this.renderType=t.type,this.sourceIds=[],this.initialized=!1,this._imageSourceManager=this._imageSourceManager?this._imageSourceManager:new E(this.innerView);const i=this._addInnerLayer();return i.then(()=>{this.initialized=!0,this._updateState()}),i}onRemove(e){return super.onRemove(e),this._removeStyleLayers(),this._removeSources(),Promise.resolve(this)}onUpdate(e){const t=this;return e.updateContent&&e.updateContent.forEach(e=>{if(e&&"property"===e.operationType)switch(e.name){case"opacity":t._updateState();break;case"scaleVisible":case"minScale":case"maxScale":case"visible":t._updateState();break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}if(e&&"method"===e.operationType)switch(e.name){case"refresh":this._updateState()}}),Promise.resolve(this)}_requestMapboxglFrameUpdate(e){this.innerView&&this.innerView._update(e)}_processData(){return new Promise(e=>{})}_addInnerLayer(){return this._processData().then(e=>{const t=this.layer,i=this.innerView;this.featureSet=e;const r=t.renderer;return this._initInnerLayer(t,i,e,r)})}_initInnerLayer(e,t,i,r){const a=this;return new Promise(e=>{let i;const r=()=>{a._addSources(),e(a),i&&clearInterval(i)};t.loaded()?r():(t.once("load",r),i=setInterval(()=>{t.loaded()&&r()},16))})}_rendererChangeAction(e){e&&this._updateState()}_updateState(e){const{innerView:t,layer:i}=this;if(!t||!this.styleLayers||!this.initialized)return;e||(e=i.renderer);const a=this._getOpacity(),n=this._getLayerViewVisible(),s=t.style;N(function(e){const t=[];if(!e)return t;switch(e.type){case r.RendererType.simple:t.push(e.symbol);break;case r.RendererType.classBreak:t.push(e.defaultSymbol),e.classBreakInfos.forEach(e=>{t.push(e.symbol)});break;case r.RendererType.uniqueValue:t.push(e.defaultSymbol),e.uniqueValueInfos.forEach(e=>{t.push(e.symbol)});break;case r.RendererType.rank:t.push(e.symbol);break;case r.RendererType.random:break;case r.RendererType.cluster:t.push(e.defaultSymbol),e.clusterInfos.forEach(e=>{t.push(e.symbol)});break;default:r.Log.error("未定义的Renderer类型")}return t}(e),this._imageSourceManager).then(()=>{const r=this.styleLayers,o={featureSet:this.featureSet,imageSourceManager:this._imageSourceManager},l=G(i.id,e,i.geometryType,n,a,o);if(0===l.length)throw new Error("创建样式图层列表失败,请检查Renderer的类型是否支持!");let c=!1;if(e.type===this.renderType&&0!==this.styleLayers.length||(c=!0,"cluster"!==e.type&&"cluster"!==this.renderType||this._triggerSourceClusterChange("cluster"===e.type)),r.length>0&&!c){const e=r.length===l.length,t=r.every(e=>l.findIndex(t=>t&&e&&t.id===e.id&&t.type===e.type)>-1);e&&t||(c=!0)}if(c){let t=null;if(r.length>0){const e=s._order.indexOf(r[r.length-1].id);e>-1&&e+1<s._order.length&&(t=s._order[e+1])}return this._removeStyleLayers(),this._addStyleLayers(l,t),void(this.renderType=e.type)}this._updateStyleLayers(t,r,l)})}_updateStyleLayers(e,t,i){const r=e.style;let a=!1;for(let e=0;e<t.length;e++)for(let n=0;n<i.length;n++){const s=t[e],o=i[n];s.id===o.id&&r.hasLayer(o.id)&&JSON.stringify(s)!==JSON.stringify(o)&&(o.paint&&Object.keys(o.paint).forEach(e=>{r.setPaintProperty(o.id,e,o.paint[e])}),o.layout&&Object.keys(o.layout).forEach(e=>{r.setLayoutProperty(o.id,e,o.layout[e])}),o.filter&&r.setFilter(o.id,o.filter),a=!0)}a&&(this._requestMapboxglFrameUpdate(!0),this.styleLayers=i)}_convertSourceData(e){const t={type:"FeatureCollection",features:[]};return e.features.forEach(e=>{Object(r.defined)(e.geometry)?t.features.push(g.convertToGeoJSON(e)):r.Log.warning("要素几何信息缺失,无法绘制要素:",e)}),t}_addStyleLayers(e,t){const{innerView:i}=this;i._lazyInitEmptyStyle(),e.forEach(e=>{i.style.addLayer(e,t)}),this.styleLayers=e,this._requestMapboxglFrameUpdate(!0)}_removeStyleLayers(){const e=this.innerView;for(let t=0;t<this.styleLayers.length;t++){const i=this.styleLayers[t].id;if(e.style.hasLayer(i)){if(e.overlayLayersManager[i])return e._removeLayer(e.overlayLayersManager[i]),delete e.overlayLayersManager[i],this;e.style.removeLayer(i)}}this._requestMapboxglFrameUpdate(!0),this.styleLayers=[]}_addSources(){const e=this.layer,t=e.renderer,i={type:"geojson",data:this._convertSourceData(this.featureSet)};t instanceof r.ClusterRenderer&&(i.cluster=!0,i.clusterRadius=t.radius),this.innerView.addSource(e.id,i),this.sourceIds.push(e.id)}_removeSources(){for(let e=0;e<this.sourceIds.length;e++)this.innerView.removeSource(this.sourceIds[e]);this.sourceIds=[]}_triggerSourceClusterChange(e){const t=this.innerView,i=this.layer,r=t.getSource(i.id);if(!r)return;const a=r.workerOptions||{};a.cluster=e;const n=a.superclusterOptions||{};e&&(n.radius=16*i.renderer.radius),r.setData(this._convertSourceData(this.featureSet))}getStyleLayerIds(){return this.styleLayers.map(e=>e.id)}};class Le{}Le.addIGSVectorLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=Le.getSourcesAndStyleLayers(i,t);ae(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},Le.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,a=r.EPSG.find(e=>e.id===i.view.spatialReference.wkid);let n={igsVersion:e._igsVersion,tokenKey:e.tokenKey,tokenValue:e.tokenValue,gdbps:[e.gdbp],filters:e.definitionExpression?`0:${e.definitionExpression}`:"",headers:e.headers,projectionSrs:Object(r.getProjectionSrs)(i.view.spatialReference),proj:a?a.name:""};const{extensionOptions:s={}}=e;n=Object.assign(n,s);const o=`source_${e.id}`,l=`layer_${e.id}`,c=Le.initLayerUrl(e.url,n),h=u(c.url,256,null,null,c,t.clippingArea),d=p(l,o,e,i),[y,m]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo);h.minzoom=y,h.maxzoom=m;const f={};return f[o]=h,{sources:f,layers:[d]}},Le.initLayerUrl=function(e,t,i){i=Object(r.defaultValue)(i,[]);const a=t.igsVersion,n=Object(r.getBaseUrl)(e);let s=`${n}/igs/rest/mrms/layers`;"2.0"===a&&(s=`${n}/igs/rest/services/system/ResourceServer/tempData/image`);const o=Le.initAllRequestParams(t);let l;if("POST"===t.httpMethod)o.bbox="0,0,0,0",i instanceof Array&&i.forEach(e=>{Object(r.defined)(e.key)&&Object(r.defined)(e.value)&&(o[e.key]=e.value)}),l={url:s,data:o,method:t.httpMethod};else{s+="?bbox={bbox}";for(const e in o){s+=`&${e}=${o[e]}`}l={url:s,method:t.httpMethod}}return t.headers&&(l.headers=t.headers),l},Le.initAllRequestParams=function(e){const t={};if("1.0"===e.igsVersion){const i=e.f||"png";t.f=i,e.gdbps&&(t.gdbps=e.gdbps),t.w=256,t.h=256,e.filters&&(t.filters=e.filters),e.style&&(t.style=JSON.stringify(e.style)),e.proj&&(t.proj=e.proj);const a=e.guid||Object(r.getGUID)();t.guid=a,void 0!==e.isAntialiasing&&null!==e.isAntialiasing&&(t.isAntialiasing=e.isAntialiasing),e.tokenKey&&e.tokenValue&&(t[e.tokenKey]=e.tokenValue)}else{const i=e.f||"image";t.f=i,e.gdbps&&(t.urls=e.gdbps),t.size="256,256",e.projectionSrs&&(t.projectionSrs=`${e.projectionSrs}`);const a=e.clientId||Object(r.getGUID)();t.clientId=a,void 0!==e.isAntialiasing&&null!==e.isAntialiasing&&(t.isAntialiasing=e.isAntialiasing),e.tokenKey&&e.tokenValue&&(t[e.tokenKey]=e.tokenValue)}return t},Le.setVisible=function(e){l(e)},Le.setOpacity=function(e){h(e)},Le.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=Le.addIGSVectorLayer(e,{})},Le.removeLayer=function(e){c(e)};var Me=Le;var Te=class extends xe{_processData(){return this.layer._reloadFeatures()}onAdd(e){const t=this,i=this.layer;return"server"===i.renderMode?(this.innerLayer=Me.addIGSVectorLayer(this,{}),this.innerLayer.commonLayerId=i.id,Promise.resolve(t)):super.onAdd(e)}onUpdate(e){if("server"===this.layer.renderMode){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":Me.setVisible(this,i);break;case"opacity":Me.setOpacity(this);break;case"refresh":Me.refresh(this);break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}return super.onUpdate(e)}onRemove(e){const t=this;return"server"===this.layer.renderMode?(this.innerView.removeLayer(this.innerLayer.id),Promise.resolve(t)):super.onRemove(e)}};var Ve=class extends xe{_processData(){const e=this.layer;return Promise.resolve(e._source)}};var Pe=class extends xe{_processData(){return this.layer.queryFeatures().then(e=>e)}};var ke=class extends r.LayerView{onAdd(){const e=this.layer,t=this._getLayerViewVisible();return this.innerLayer=k.addWebTileLayer(this,{visible:t,clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return k.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":k.setVisible(this,i);break;case"opacity":k.setOpacity(this);break;case"sublayerVisible":case"refresh":k.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r?r.setClippingArea(g.convertClippingArea(e)):this.innerLayer.implementation&&this.innerLayer.implementation.type&&"custom"===this.innerLayer.implementation.type&&this.innerLayer.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Oe=class extends r.GroupLayerView{};class Ee{}Ee.addEchartsLayer=function(e,t){const{extensionOptions:i={}}=e;let a=Object.assign(e.echartsOptions,i);a=Object(r.deleteNullValue)(a);const n=new ie(t,a).addTo(t);return n.id=e.id,n},Ee.removeLayer=function(e){e.remove()};var Ce=Ee;var je=class extends r.LayerView{onAdd(e){const t=this.layer,i=this.innerView;return this.innerLayer=Ce.addEchartsLayer(t,i),this.innerLayer.commonLayerId=t.commonLayerId,this._getLayerViewVisible()?this.innerLayer.show():this.innerLayer.hide(),Promise.resolve(this)}onRemove(e){return Ce.removeLayer(this.innerLayer),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":this._getLayerViewVisible("scaleVisible"===i.name)?this.innerLayer.show():this.innerLayer.hide();break;case"opacity":this.innerLayer.setOpacity(this._getOpacity());break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};class Ie{}Ie.addMapVLayer=function(e,t){const{extensionOptions:i={}}=e;let a=Object.assign(e.mapVOptions,i);a=Object(r.deleteNullValue)(a);const n=new Y(t,e.data,a);return n.id=e.id,n},Ie.removeLayer=function(e){e.remove()};var Ae=Ie;var ze=class extends r.LayerView{onAdd(e){const t=this.layer,i=this.innerView;return this.innerLayer=Ae.addMapVLayer(t,i),this.innerLayer.commonLayerId=t.id,this._getLayerViewVisible()?this.innerLayer.show():this.innerLayer.hide(),Promise.resolve(this)}onRemove(e){return Ae.removeLayer(this.innerLayer),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":this._getLayerViewVisible("scaleVisible"===i.name)?this.innerLayer.show():this.innerLayer.hide();break;case"opacity":this.innerLayer.setOpacity(this._getOpacity());break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Re=class extends r.LayerView{onAdd(){const e=this.layer;return this.innerLayer=x.addArcGISMapImageLayer(this),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return x.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":x.setVisible(this,i);break;case"opacity":x.setOpacity(this);break;case"sublayerVisible":case"refresh":x.refresh(this);break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var De=class extends r.LayerView{onAdd(){const{layer:e}=this;return this.innerLayer=S.addArcGISTileLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return S.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":S.setVisible(this);break;case"opacity":S.setOpacity(this);break;case"refresh":S.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Ge=class extends r.LayerView{onAdd(){const{layer:e}=this;return this.innerLayer=de.addIGSImageryLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return de.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(!this.innerLayer)return Promise.resolve(this);if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":de.setVisible(this,i);break;case"opacity":de.setOpacity(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"refresh":case"bandIds":case"interpolation":case"rasterFunction":de.refresh(this);break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Ne=class extends r.LayerView{onAdd(){const{layer:e}=this;return this.innerLayer=ue.addIGSImageryTileLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return ue.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":ue.setVisible(this);break;case"opacity":ue.setOpacity(this);break;case"refresh":ue.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};class Fe{}Fe.getMouseEvent=function(e,t,i){let a=void 0;return{mapPoint:a=t._spatialReference.isGeographic?new r.Point({coordinates:[e.lngLat.lng,e.lngLat.lat]}):r.Projection.project(new r.Point({coordinates:[e.lngLat.lng,e.lngLat.lat]}),new r.SpatialReference(t.crs.code)),x:e.point.x,y:e.point.y,button:e.originalEvent.button,buttons:e.originalEvent.buttons,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,innerViewerEvent:e,type:i}},Fe.getKeyEvent=function(e,t,i){const r={key:e.originalEvent.key,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,innerViewerEvent:e,type:i};return"key-down"===i&&(r.repeat=e.originalEvent.repeat),r},Fe.getViewChangeEvent=function(e,t,i){const r={event:e,innerViewerEvent:e,target:t,type:i};return r.mapView=t,r.scale=t._scale,r.zoom=t._zoom,r.center=t.center,r.extent=t._extent,r},Fe.getDragEvent=function(e,t,i,r,a){return{x:e.originalEvent.layerX,y:e.originalEvent.layerY,button:void 0!==a?a:e.originalEvent.button,buttons:e.originalEvent.buttons,cancelable:e.originalEvent.cancelable,origin:i,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,action:r,innerViewerEvent:e,type:"drag"}},Fe.getKeyEvent=function(e,t,i){const r={key:e.key,stopPropagation:e.stopPropagation,timeStamp:e.timeStamp,native:e,type:i};return"key-down"===i&&(r.repeat=e.repeat),r};var Be=Fe;class Ue extends r.MapView{constructor(e){if(super(e),e=Object(r.defaultValue)(e,{}),this._options=e,this._center=Object(r.isNull)(e.center)?void 0:r.Point.fromJSON(e.center),this._center&&Array.isArray(this._center)&&this._center.length>1&&(this._center=new r.Point({coordinates:[this._center[0],this._center[1]]})),this._extent=Object(r.isNull)(e.extent)?void 0:r.Extent.fromJSON(e.extent),this.width=void 0,this.height=void 0,this._zoom=Object(r.defaultValue)(e.zoom,void 0),this._scale=Object(r.defaultValue)(e.scale,void 0),this.maxScale=Object(r.defaultValue)(e.maxScale,void 0),this.minScale=Object(r.defaultValue)(e.minScale,void 0),this.minZoom=Object(r.defaultValue)(e.minZoom,void 0),this.maxZoom=Object(r.defaultValue)(e.maxZoom,void 0),this.popup=Object(r.defaultValue)(e.popup,void 0),this._referenceLayer=void 0,this.spatialReferenceLocked=Object(r.defaultValue)(e.spatialReferenceLocked,!1),this.stationary=!0,e.fullExtent){let t=r.Extent.fromJSON(e.fullExtent.toJSON());t.spatialReference.isGeographic||(t=r.Projection.project(t,new r.SpatialReference({wkid:4326}))),this._initFullExtent=t}this._fullExtent=this._initFullExtent,this._mapExtent=null,this._fireLoaded=!1,this._initView(!0,this._options)}_initView(e,t){const i=this;let a;if(n.a.accessToken="pk.eyJ1IjoiemtidWQiLCJhIjoiY2w5OGF2NXIyMzQ5bjNub2luem85Y2Z4OCJ9.uX09XQPOX5E7sOohws2l_Q",e&&t){let e;a={center:e=Object(r.isNull)(t.center)&&Object(r.isNull)(t.extent)?new r.Point({coordinates:[0,0]}):Object(r.isNull)(t.center)?void 0:r.Point.fromJSON(t.center),scale:t.scale,zoom:Object(r.isNull)(t.scale)&&Object(r.isNull)(t.zoom)?0:t.zoom,target:Object(r.isNull)(t.extent)?void 0:r.Extent.fromJSON(t.extent)},this.minScale=Object(r.defaultValue)(t.minScale,void 0),this.maxScale=Object(r.defaultValue)(t.maxScale,void 0),this.minZoom=Object(r.defaultValue)(t.minZoom,void 0),this.maxZoom=Object(r.defaultValue)(t.maxZoom,void 0)}else this._zoom=void 0,this._extent=void 0,a={center:this._center,scale:this._scale};let{center:s,zoom:o,extent:l}=this._getValidGoToParams(a);Object(r.isNull)(s)||Object(r.isNull)(o)?Object(r.isNull)(l)||(this._extent=l):(this._center=s,this._zoom=o);let c=void 0;if(e&&!Object(r.isNull)(this._extent)){const e=r.Projection.project(this._extent,new r.SpatialReference({wkid:4326}));c=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}const h={crs:this.crs,container:this._viewId,style:{version:8,sources:{},layers:[{id:Object(r.getGUID)(),type:"background",paint:{"background-color":"rgba(255, 255, 255,1)"}}]},bounds:c,preserveDrawingBuffer:!0};return Object(r.isNull)(this._zoom)||(h.zoom=this._zoom),Object(r.isNull)(this._center)||Object(r.isNull)(this._center.coordinates)||(h.center=this._center.coordinates),Object.keys(this.extensionOptions).forEach(e=>{"crs"!==e&&"container"!==e&&("object"==typeof this.extensionOptions[e]&&"object"==typeof h[e]?h[e]=Object.assign(h[e],this.extensionOptions[e]):h[e]=this.extensionOptions[e])}),this._innerView=new n.a.Map(h),this.engineType=r.EngineType.mapboxgl,this._initViewEvent(),this._initSize(),this._initScaleLimit(),this._initPopup(),this._initCursor(),this._updateMaxBounds(),new Promise(t=>{function a(e,a){e._zoomEndHandler(),e._fireLoaded||(e.fire(r.ViewEventType.loaded,{}),e._fireLoaded=!0),t(i)}i._innerView.loaded()?Promise.resolve().then(()=>{a(this,e)}):i._innerView.once("load",()=>{a(this,e)})})}_initScaleLimit(){if(Object(r.isNull)(this._options.minScale))if(Object(r.isNull)(this._options.minZoom)){const e=this._innerView.getMinZoom();isFinite(e)?(this.minScale=this._getScaleByZoom(e),this.minZoom=e):(this.minScale=void 0,this.minZoom=void 0)}else this.minZoom=this._options.minZoom,this.minScale=this._getScaleByZoom(this.minZoom),this._innerView.setMinZoom(this.minZoom);else if(this.minScale>0){const e=this._getZoomByScale(this.minScale);void 0!==e&&this._innerView.setMinZoom(e),this.minZoom=e}else this.minZoom=void 0,this.minScale=0,this._innerView.setMinZoom(void 0);if(void 0!==this._options.maxScale)if(this.maxScale>0){const e=this._getZoomByScale(this.maxScale);void 0!==e&&this._innerView.setMaxZoom(e),this.maxZoom=e}else this.maxScale<=0&&(this.maxZoom=void 0,this.maxScale=0,this._innerView.setMaxZoom(void 0));else if(Object(r.isNull)(this._options.maxZoom)){let e=this._innerView.getMaxZoom();const t=((this.crs||{}).options||{}).lods;t&&Array.isArray(t)&&e>=t.length-1&&(e=t.length-1,this._innerView.setMaxZoom(e)),isFinite(e)?(this.maxScale=this._getScaleByZoom(e),this.maxZoom=e):(this.maxScale=void 0,this.maxZoom=void 0)}else this.maxZoom=this._options.maxZoom,this.maxScale=this._getScaleByZoom(this.maxZoom),this._innerView.setMaxZoom(this.maxZoom);!this._scale||this._scale<=0?this._scale=this.minScale:this._scale>this.minScale?this._scale=this.minScale:this._scale<this.maxScale&&(this._scale=this.maxScale)}_createCrsObject(e){if(!(e.spatialReference&&e.origin&&e.lods&&e.extent))return;let t;if(e.spatialReference.wkid){const i=r.Projection.getEPSGByWKID(e.spatialReference.wkid);i&&(t=i.strProject)}else e.spatialReference.wkt&&(t=e.spatialReference.wkt);const i=[e.extent.xmin,e.extent.ymin,e.extent.xmax,e.extent.ymax],a=`EPSG:${e.spatialReference.wkid}`,n=t,s={},o={};e.lods.forEach(e=>{s[e.level]=e.resolution,o[e.level]=e.levelValue});const l=new y(a,n,{levelValues:o,resolutions:s,origin:e.origin,tileSize:e.tileSize,bounds:i,unit:e.spatialReference.isGeographic?"degree":void 0});return l.options=e,l}_reCreateView(e){return this._innerView&&(this._innerView._animatingZoom=!1,this._innerView.remove()),e?this._initView(!0,this._options):this._initView(!1)}_isEqualBounds(e,t){let i=!0;if(e&&t&&Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(const r in e)if(e[r]!==t[r]){i=!1;break}}else i=!!(!e&&!t||Array.isArray(e)&&0===e.length&&Array.isArray(t)&&0===t.length);return i}_initViewEvent(){const e=this;this._clickStore=null,this._dragParams={isDrag:!1,origin:null,action:"",button:null},this._innerView.on("click",t=>{e._clickStore=setTimeout(function(){e._clickStore&&e.fire(r.ViewEventType.click,Be.getMouseEvent(t,e))},300),e.fire(r.ViewEventType.immediateClick,Be.getMouseEvent(t,e))}),this._innerView.on("contextmenu",t=>{e._clickStore=setTimeout(function(){e._clickStore&&e.fire(r.ViewEventType.click,Be.getMouseEvent(t,e))},300),e.fire(r.ViewEventType.immediateClick,Be.getMouseEvent(t,e))}),this._innerView.on("dblclick",t=>{e._clickStore&&(clearTimeout(this._clickStore),e._clickStore=null),e.fire(r.ViewEventType.doubleClick,Be.getMouseEvent(t,e))}),this._innerView.on("mousedown",t=>{e.fire(r.ViewEventType.pointerDown,Be.getMouseEvent(t,e)),this._dragParams.isDrag||(this._dragParams.origin={x:t.originalEvent.layerX,y:t.originalEvent.layerY},this._dragParams.button=t.originalEvent.button,this._dragParams.action="mouse-down",this._dragParams.isDrag=!1)}),this._innerView.on("mouseup",t=>{e.fire(r.ViewEventType.pointerUp,Be.getMouseEvent(t,e)),e._dragParams.isDrag&&"update"===this._dragParams.action&&(this._dragParams.action="end",e.fire(r.ViewEventType.drag,Be.getDragEvent(t,e,e._dragParams.origin,this._dragParams.action))),e._dragParams={isDrag:!1,origin:null,action:"",button:null}}),this._innerView.on("mousemove",t=>{e.fire(r.ViewEventType.pointerMove,Be.getMouseEvent(t,e)),e._dragParams.isDrag?(e.fire(r.ViewEventType.drag,Be.getDragEvent(t,e,e._dragParams.origin,e._dragParams.action,e._dragParams.button)),e._dragParams.action="update"):"mouse-down"===this._dragParams.action&&(this._dragParams.action="start",e._dragParams.isDrag=!0)}),this._innerView.on("dragstart",t=>{""===this._dragParams.action&&t.originalEvent&&(this._dragParams.origin={x:t.originalEvent.layerX,y:t.originalEvent.layerY},this._dragParams.action="start",e.fire(r.ViewEventType.drag,Be.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)))}),this._innerView.on("drag",t=>{"start"!==e._dragParams.action&&"update"!==e._dragParams.action||(this._dragParams.action="update",e.fire(r.ViewEventType.drag,Be.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)))}),this._innerView.on("dragend",t=>{"start"!==e._dragParams.action&&"update"!==e._dragParams.action||(this._dragParams.action="end",e.fire(r.ViewEventType.drag,Be.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)),e._dragParams={origin:null,action:"",button:null})}),this._innerView.on("rotatestart",t=>{""===this._dragParams.action&&t.originalEvent&&(this._dragParams.origin={x:t.originalEvent.layerX,y:t.originalEvent.layerY},this._dragParams.action="start",e.fire(r.ViewEventType.drag,Be.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)))}),this._innerView.on("rotate",t=>{"start"!==e._dragParams.action&&"update"!==e._dragParams.action||(this._dragParams.action="update",e.fire(r.ViewEventType.drag,Be.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)))}),this._innerView.on("rotateend",t=>{"start"!==e._dragParams.action&&"update"!==e._dragParams.action||(this._dragParams.action="end",e.fire(r.ViewEventType.drag,Be.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)),e._dragParams={origin:null,action:"",button:null})}),this._innerView.on("movestart",()=>{e.stationary=!1}),this._innerView.on("zoom",t=>{e.fire(r.ViewEventType.zoom,{zoom:t.target._zoom,event:t})}),this._innerView.on("zoomend",t=>{e._zoomEndHandler(),e.fire(r.ViewEventType.viewChange,Be.getViewChangeEvent(t,e))}),this._innerView.on("moveend",t=>{e._moveEndHandler(),e.fire(r.ViewEventType.viewChange,Be.getViewChangeEvent(t,e)),e.stationary=!0}),this._innerView.on("resize",t=>{const i=Number(e.width),a=Number(e.height);e._initSize(),this._updateMaxBounds(),e.fire(r.ViewEventType.resize,{oldWidth:i,oldHeight:a,width:e.width,height:e.height})}),this._listenKey()}_mapActionControl(e,t){this._innerView&&("drag-pan"===e?t?this._innerView.dragPan.enable():this._innerView.dragPan.disable():"double-click-zoom"===e?t?this._innerView.doubleClickZoom.enable():this._innerView.doubleClickZoom.disable():"drag-rotate"===e&&(t?this._innerView.dragRotate.enable():this._innerView.dragRotate.disable()))}_listenKey(){const e=this,t=this._innerView._canvas;t.setAttribute("tabIndex","-1"),t.onclick=(()=>{t.focus()}),t.addEventListener("keydown",t=>{e.fire(r.ViewEventType.keyDown,Be.getKeyEvent(t,e))}),t.addEventListener("keyup",t=>{e.fire(r.ViewEventType.keyUp,Be.getKeyEvent(t,e))})}_initSize(){const e=this._innerView.getCanvas(),t=e.style?e.style.width:e.width,i=e.style?e.style.height:e.height;this.width=Number(t.toString().replace("px","")),this.height=Number(i.toString().replace("px",""))}_updateMaxBounds(){const e=this._getMaxBounds();this._innerView.setMaxBounds(e)}_setCursor(e){this._innerView&&(e&&null!==e?(this._innerView._container.style.cursor=e,this._innerView.getCanvasContainer().style.cursor=e):(this._innerView._container.style.removeProperty("cursor"),this._innerView.getCanvasContainer().style.removeProperty("cursor")),this._cursor=e)}_zoomEndHandler(){this.getExtent(),this.getZoom(),this.getScale(),this.getCenter(),this._updateLayerViewScaleVisible()}getSize(){return{width:this.width,height:this.height}}_moveEndHandler(){this.getCenter(),this.getExtent()}_createLayerViewObj(e){let t=null;return e&&e.autoAddTo2D&&(t=function(e,t){let i=null;switch(t.type){case r.LayerType.IGSMapImage:i=new fe({view:e,layer:t});break;case r.LayerType.IGSTile:i=new ge({view:e,layer:t});break;case r.LayerType.WMS:i=new ve({view:e,layer:t});break;case r.LayerType.WMTS:i=new be({view:e,layer:t});break;case r.LayerType.graphics:i=new _e({view:e,layer:t,render:new Se});break;case r.LayerType.IGSVectorTile:case r.LayerType.ArcGISVectorTile:i=new we({view:e,layer:t});break;case r.LayerType.IGSFeature:i=new Te({view:e,layer:t});break;case r.LayerType.GeoJSON:i=new Ve({view:e,layer:t});break;case r.LayerType.WFS:i=new Pe({view:e,layer:t});break;case r.LayerType.webTile:i=new ke({view:e,layer:t});break;case r.LayerType.group:i=new Oe({view:e,layer:t});break;case r.LayerType.ECharts:i=new je({view:e,layer:t});break;case r.LayerType.MapV:i=new ze({view:e,layer:t});break;case r.LayerType.ArcGISMapImage:i=new Re({view:e,layer:t});break;case r.LayerType.ArcGISTile:i=new De({view:e,layer:t});break;case r.LayerType.IGSImage:i=new Ge({view:e,layer:t});break;case r.LayerType.IGSImageTile:i=new Ne({view:e,layer:t})}return i}(this,e)),t}_initPopup(){this.popup=new ye({view:this})}hitTest(e){if(!this._innerView)return;const t=[],i=this._getInnerStyleLayerIds();return this._innerView.queryRenderedFeatures([e.x,e.y],{layers:i}).forEach(i=>{if(!i.properties||void 0===i.properties.id||!i.layer||!i.layer.id)return;const a=i.source.split("_")[0],n=i.properties.id;let s=this.getLayer(a);if(!s&&this._graphicsLayers&&this._graphicsLayers.allLayers&&this._graphicsLayers.allLayers.items&&(s=this._graphicsLayers.allLayers.items.find(e=>e.id===a)),!s)return;let o=null;if(s.type===r.LayerType.IGSFeature||s.type===r.LayerType.GeoJSON||s.type===r.LayerType.WFS){const e=this._getLayerView(s);e.featureSet&&e.featureSet.features&&(o=e.featureSet.features.filter(e=>{if(e.id===n)return e}))}else if(s.type===r.LayerType.graphics&&s.graphics){o=s.graphics.filter(e=>{if(e.id===n)return e}).items}const l={graphic:o&&o.length>0?o[0]:null,layer:s,mapPoint:this.toMap(e),type:"graphic"};t.push(l)}),t}_getInnerStyleLayerIds(){let e=[];return this._map.allLayers.items.concat(this._graphicsLayers.allLayers.items).forEach(t=>{if(t.type===r.LayerType.IGSFeature||t.type===r.LayerType.GeoJSON){const i=this._getLayerView(t);i&&(e=e.concat(i.getStyleLayerIds()))}else if(t.type===r.LayerType.graphics){const i=this.getInnerLayer(t);i&&i.getStyleLayerIds&&(e=e.concat(i.getStyleLayerIds()))}}),e}toMap(e){if(!e)return;const t=this._innerView.unproject([e.x,e.y]);let i=new r.Point({coordinates:[t.lng,t.lat]});return this._spatialReference&&!this._spatialReference.isGeographic?i=r.Projection.project(i,this._spatialReference):i.spatialReference=this._spatialReference,i}toScreen(e){let t=r.Geometry.fromJSON(e);return t.spatialReference.isGeographic||(t=r.Projection.project(t,new r.SpatialReference({wkid:4326}))),this._innerView.project([t.coordinates[0],t.coordinates[1]])}takeScreenshot(e){e.view=this;let t=null;return this._screenshot?t=this._screenshot._addView():(this._screenshot=new me(e),t=this._screenshot._addView()),t}flyTo(e,t={animate:!0}){e=Object(r.defaultValue)(e,{});const i=Object(r.defaultValue)(e.zoom,1),a=this._getFlyToCenter(e),n=this._getFlyToExtent(e);if(this._innerView){const e=this._innerView.transform;e.resetZoomScale=!1,a?(this._center=a,this._scale=this._getScaleByZoom(i),this._zoom=void 0,this._innerView.flyTo({center:[a.coordinates[0],a.coordinates[1]],zoom:i})):n&&(this._center=void 0,this._scale=void 0,this._zoom=void 0,this._extent=n,this._innerView.fitBounds([[n.xmin,n.ymin],[n.xmax,n.ymax]],t)),e.resetZoomScale=!0}}goTo(e={},t={}){let i=new Promise(e=>{e(!1)});if(this._innerView){let{center:a,zoom:n,extent:s}=this._getValidGoToParams(e,t);Object(r.isNull)(a)||(this._center=a),Object(r.isNull)(n)||(this._scale=this._getScaleByZoom(n),this._zoom=void 0),Object(r.isNull)(e.scale)||(this._scale=e.scale),Object(r.isNull)(s)||(this._center=void 0,this._scale=void 0,this._zoom=void 0,this._extent=s);const o={animate:!0,duration:200};Object(r.isNull)(t)||(Object(r.isNull)(t.animate)||(o.animate=t.animate),Object(r.isNull)(t.duration)||(o.duration=t.duration));const l=this._innerView.transform;if(l.resetZoomScale=!1,Object(r.isNull)(a)||Object(r.isNull)(n)){if(!Object(r.isNull)(s)){let e=s.xmin,t=s.xmax,r=s.ymin,a=s.ymax;this._fullExtent&&(e<this._fullExtent.xmin&&(e=this._fullExtent.xmin),t>this._fullExtent.xmax&&(t=this._fullExtent.xmax),r<this._fullExtent.ymin&&(r=this._fullExtent.ymin),a>this._fullExtent.ymax&&(a=this._fullExtent.ymax)),isFinite(e)&&isFinite(t)&&isFinite(r)&&isFinite(a)&&(i=new Promise(e=>{this._innerView.fitBounds([[s.xmin,s.ymin],[s.xmax,s.ymax]],o),this._innerView.once("moveend",()=>{e(!0)})}))}}else{let e=a.coordinates[1],t=a.coordinates[0];if(this._fullExtent&&((e>this._fullExtent.ymax||e<this._fullExtent.ymin)&&(e=(this._fullExtent.ymax+this._fullExtent.ymin)/2),(t>this._fullExtent.xmax||t<this._fullExtent.xmin)&&(t=(this._fullExtent.xmax+this._fullExtent.xmin)/2)),isFinite(e)&&isFinite(t)){let r=!1;const s=this._innerView.getCenter();if(n===this._zoom&&e===s.lat&&t===s.lng&&(r=!0),!r){const e={center:[a.coordinates[0],a.coordinates[1]],zoom:n};Object.assign(e,o),i=new Promise(t=>{this._innerView.flyTo(e),this._innerView.once("moveend",()=>{t(!0)})})}}}l.resetZoomScale=!0}return i}getCenter(){if(Object(r.isNull)(this._innerView))return;const e=this._innerView.getCenter();let t=new r.Point({coordinates:[e.lng,e.lat]});this._center=t;const i=this._spatialReference;return i.isGeographic||(t=r.Projection.project(t,i)),t}setCenter(e){this._innerView&&(Array.isArray(e)&&e.length>1?(this._center=new r.Point({coordinates:[e[0],e[1]],spatialReference:this._spatialReference}),this.flyTo({zoom:this._zoom,center:this._center})):e instanceof r.Point&&(this._center=e,this.flyTo({zoom:this._zoom,center:this._center})))}getZoom(){if(!Object(r.isNull)(this._innerView))return this._zoom=this._innerView.getZoom(),this._zoom}setZoom(e){this._innerView&&(this._zoom=e,this.flyTo({zoom:e,center:this._center}))}getExtent(){if(!this._innerView)return;const e=this._innerView.getBounds();if(!e||!e._sw||!e._ne)return;let t=new r.Extent({xmin:e._sw.lng,ymin:e._sw.lat,xmax:e._ne.lng,ymax:e._ne.lat});const i=this._spatialReference;return i.isGeographic||(t=r.Projection.project(t,i)),this._extent=t,t}setExtent(e){this._innerView&&(this._extent=e,this.flyTo({extent:e}))}getScale(){const e=this._getScaleByZoom(this._zoom);return this._scale=e,e}_getScaleByZoom(e){let t;if(this.crs&&this.crs.options&&this.crs.options.lods&&!Object(r.isNull)(e))if(e<0)t=0;else if(e%1==0){t=this.crs.options.lods[e].scale}else{const i=Math.floor(e),r=Math.ceil(e),a=this.crs.options.lods[i],n=this.crs.options.lods[r];t=void 0===a&&void 0===n?0:void 0===a?n.scale:void 0===n?a.scale:Math.pow(2,i)*a.scale/Math.pow(2,e)}return t}_initScale(e){this._scale&&this._scale>0&&(this._zoom=this._getZoomByScale(e))}_getZoomByScale(e){let t=void 0;if(this.crs&&this.crs.options&&this.crs.options.lods){let i=-1;for(let r=0;r<this.crs.options.lods.length;r++){const a=this.crs.options.lods[r],n=this.crs.options.lods[r-1];if(a.scale<=0)break;if(i<0&&(i=r),r===i){if(a.scale>0&&e>=a.scale){t=a.level;break}}else{if(e>=a.scale&&e<=n.scale&&n.scale!==a.scale){t=Math.log2(a.scale*Math.pow(2,a.level)/e);break}if(r===this.crs.options.lods.length-1&&a.scale>0&&e<=a.scale){t=a.level;break}}}}return t}setScale(e){if(!this._innerView)return;const t=this._getZoomByScale(e);t&&this.flyTo({center:this._center,zoom:t})}_getMaxBounds(){if(this._fullExtent){const e=[[this._fullExtent.xmin,this._fullExtent.ymin],[this._fullExtent.xmax,this._fullExtent.ymax]];if(this._innerView)try{const t=Math.max(this._innerView.transform.width,200),i=Math.max(this._innerView.transform.height,200)/t,r=this._innerView.transform,a=r.project({lng:e[0][0],lat:e[1][1]}),n=r.project({lng:e[1][0],lat:e[0][1]}),s=r.project({lng:(e[0][0]+e[1][0])/2,lat:(e[0][1]+e[1][1])/2}),o=n.x-a.x,l=n.y-a.y,c=Math.max(o,l)/2,h=s.x-c,u=s.y-c*i,p=s.x+c,d=s.y+c*i,y=r.unproject({x:h,y:u}),m=r.unproject({x:p,y:d});isFinite(y.lng)&&!isNaN(y.lng)&&(e[0][0]=Math.min(y.lng,e[0][0])),isFinite(m.lat)&&!isNaN(m.lat)&&(e[0][1]=Math.min(m.lat,e[0][1])),isFinite(m.lng)&&!isNaN(m.lng)&&(e[1][0]=Math.max(m.lng,e[1][0])),isFinite(y.lat)&&!isNaN(y.lat)&&(e[1][1]=Math.max(y.lat,e[1][1]))}catch(e){}return e}return null}_isEqualCrs(e,t){let i=!1;if(!e||!t)return i;let a=void 0;e.code.split(":").length>1&&(a=e.code.split(":")[1]);const n=new r.SpatialReference({wkid:a,wkt:e.def});let s=void 0;t.code.split(":").length>1&&(s=t.code.split(":")[1]);const o=new r.SpatialReference({wkid:s,wkt:t.def});return n.equals(o)&&t.options&&e.options&&Object(r.compareObject)(t.options._resolutions,e.options_resolutions)&&Object(r.compareObject)(t.origin,e.origin)&&Object(r.compareObject)(t.extent,e.extent)&&(i=!0),i}_moveLayerView(e,t){let i,r;if(e instanceof _e){i=[];const{_sourceMetaDatas:t}=e.innerLayer;Object.keys(t).forEach(e=>{i.push(t[e].layerId)})}else if(e instanceof xe)i=e.styleLayers.map(e=>e.id);else if(e instanceof we){const t=e.innerLayer||[];i=t.map(e=>e.id)}else i=e.innerLayer.id;if(t instanceof _e){const e=t.innerLayer._getBottomLayer();r=e.layerId}else if(t instanceof xe)t.styleLayers.length>0&&(r=t.styleLayers[0].id);else if(t instanceof we){const e=t.innerLayer||[];e.length>0&&(r=e[0].id)}else r=t.innerLayer.id;e instanceof _e||e instanceof xe||e instanceof we?i.forEach(t=>{e.innerView.moveLayer(t,r)}):e.innerView.moveLayer(i,r)}toJSON(){let e=super.toJSON();return e=Object.assign(e,{extent:Object(r.toJSON)(this._extent,r.Extent),width:this.width,height:this.height,spatialReferenceLocked:this.spatialReferenceLocked})}_getValidGoToParams(e,t){let i,a,n;if(Object(r.isNull)(e.center)&&Object(r.isNull)(e.zoom)&&Object(r.isNull)(e.scale)||(i=Object(r.isNull)(e.center)?this._center:this._getFlyToCenter({center:e.center}),Object(r.isNull)(i)||(a=!Object(r.isNull)(e.scale)&&e.scale>0?this._getZoomByScale(e.scale):Object(r.isNull)(e.zoom)?this._zoom:e.zoom)),!Object(r.isNull)(e.target)||!Object(r.isNull)(e.layer)&&!Object(r.isNull)(e.layer.extent)){const t=this._getTargetExtent(e.target||e.layer.extent);t.xmin!==t.xmax&&t.ymin!==t.ymax?n=t:i=this._getFlyToCenter({center:new r.Point({coordinates:[t.xmin,t.ymin]})})}return{center:i,zoom:a,extent:n}}}Object.defineProperties(Ue.prototype,{scale:{get(){return this.getScale()},set(e){this.setScale(e)}},zoom:{get(){return this.getZoom()},set(e){this.setZoom(e)}},extent:{get(){return this.getExtent()},set(e){this.setExtent(e)}},center:{get(){return this.getCenter()},set(e){this.setCenter(e)}},spatialReference:{get(){return this._spatialReference},set(e){}},rotation:{get(){return this._rotation},set(e){this._rotation=e,this._innerView&&this._innerView.setBearing(e)}}}),Ue.fromJSON=function(e){return e=Object(r.defaultValue)(e,{}),new Ue(e)};var Ze=Ue;var $e=class extends r.SketchEditor{constructor(e){super(e)}start(e,t){super.start(e,t)}startCustomDrawTool(e){super.startCustomDrawTool(e)}stop(){super.stop()}remove(){super.remove()}update(e,t){super.updateFeature(e,t)}addVertex(e,t){super.addVertex(e,t)}updateVertex(e,t){super.updateVertex(e,t)}removeVertex(e){super.removeVertex(e)}getSketchDataType(){super.getSketchDataType()}setSketchStyle(e){super.setSketchStyle(e)}getSketchStyle(){return super.getSketchStyle()}getGeometry(){return super.getGeometry()}union(e){return super.union(e)}split(e,t){return super.split(e,t)}drawPolylineToPolygon(e){super.drawPolylineToPolygon(e)}undo(){return super.undo()}redo(){return super.redo()}canUndo(){return super.canUndo()}canRedo(){return super.canRedo()}_hitTestSketchEvent(){const e=this,t=t=>{if(!t||!t.x||!t.y)return;if(e._drawTool&&e._drawTool._editMode===r.SketchEditMode.drawing)return;const i=e._getGraphicsLayer(e._layer),a=e._getGraphicsLayer(e._sketchInnerLayer);if(!i&&!a)return;let n=void 0;const s=e.view.hitTest({x:t.x,y:t.y});if(s&&Array.isArray(s)&&(n=s[0]),n&&(i&&i.id===n.layer.id||a&&a.id===n.layer.id)){const i=this._getCurDrawTool(n.layer.id,n.graphic.id);if(!i||i===e._drawTool&&"drawn"!==i.state)return;this._bindEditMouseEvent(i,t)}};this._hitTestSketchHandler||(this.view.on(r.ViewEventType.mouseDown,t),this._hitTestSketchHandler=t)}_getCurDrawTool(e,t){const i=this;let a=i._drawTool?i._drawTool._getDrawToolByFeatureId(t):void 0;if(!a&&(!i._drawTool||i._drawTool.sketchStage.entityGraphic&&"drawn"===i._drawTool.state)){const n=i.view.getLayer(e).graphics.filter(e=>e.id===t);if(n&&n.items.length>0?n.items[0]:void 0){const e=n.items[0];i._drawTool&&(i._drawTool._clearEditGraphics(i._drawTool._editMode),i._drawTool.fire("selected",{isSelected:!1},i),i._drawTool.view.off(r.ViewEventType.immediateClick,i._drawTool._mapClickEvent),i._drawTool._fireRemoveSelectEvent(i._drawTool.sketchStage.entityGraphic)),this._addFeatureToSketchEditor(e),i._undoRedoManager.reset(),i._drawTools=[i._drawTool],a=i._drawTool}}return a}_bindEditMouseEvent(e,t){const i=this;if(0===e.editOption._hitTestMode){const a=()=>{if(i._editable&&(Object(r.isNull)(i._drawTool)||i._drawTool._editMode!==r.SketchEditMode.drawing)){if(!Object(r.isNull)(e)&&Object(r.isNull)(e._parent)&&e._editMode===r.SketchEditMode.none){i.fire("selected",{isSelected:!0,selectedDrawTool:i._drawTool,selectedGeometry:i._drawTool.sketchStage.entityGraphic.geometry},i);const e=new r.SketchEditorEvent({type:r.SketchEditorEventType.update,target:i,toolEventInfo:null,state:r.SketchEditorState.start,feature:i._drawTool.sketchStage.entityGraphic,geometry:i._drawTool.sketchStage.entityGraphic.geometry});i.fire(r.SketchEditorEventType.update,e)}e._isAddTip&&e._updateTipText(e._tipText.editGraphic,e._sketchInnerLayer,t),e.hitTestFeature(e.sketchStage.entityGraphic,t),i.view.off(r.ViewEventType.mouseUp,a)}};i.view.on(r.ViewEventType.mouseUp,a)}else{if(!i._editable)return;if(void 0!==i._drawTool&&null!==i._drawTool&&i._drawTool._editMode===r.SketchEditMode.drawing)return;e._parent&&e._parent._isAddTip&&e._parent._updateTipText(e._parent._tipText.editVertex,e._parent._sketchInnerLayer),e.hitTestFeature(e.sketchStage.entityGraphic,t)}}_removeHitTestSketchEvent(){this.view.off(r.ViewEventType.mouseDown,this._hitTestSketchHandler)}_getCenterCoordinate(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}};i.d(t,"MapViewMapboxgl",function(){return Ze}),i.d(t,"MapView",function(){return Ze}),i.d(t,"SketchEditorMapboxgl",function(){return $e}),i.d(t,"SketchEditor",function(){return $e}),i.d(t,"mapboxCustomCRS",function(){return d}),i.d(t,"initializeOptions",function(){return re}),i.d(t,"addStyleToMapboxglMap",function(){return ae}),i.d(t,"MapVLayer",function(){return Y}),i.d(t,"EchartsLayer",function(){return ie}),i.d(t,"initializeCRS",function(){return ne}),i.d(t,"Popup",function(){return ye}),i.d(t,"Screenshot",function(){return me}),r.Zondy.mapboxCustomCRS=d,r.zondy.mapboxgl={},r.zondy.mapboxgl.VERSION="17.6.0",r.zondy.mapboxgl.MapView=Ze,r.zondy.mapboxgl.layer={},r.zondy.mapboxgl.layer.MapVLayer=Y,r.zondy.mapboxgl.layer.EchartsLayer=ie,r.zondy.mapboxgl.tool={},r.zondy.mapboxgl.tool.sketch={},r.zondy.mapboxgl.tool.sketch.SketchEditor=$e,r.zondy.mapboxgl.tool.Screenshot=me,r.zondy.mapboxgl.widget={},r.zondy.mapboxgl.widget.Popup=ye,r.zondy.mapboxgl.util={},r.zondy.mapboxgl.util.initializeOptions=re,r.zondy.mapboxgl.util.addStyleToMapboxglMap=ae,r.zondy.mapboxgl.util.initializeCRS=ne,r.zondy.mapboxgl.util.mapboxCustomCRS=d,r.Zondy.PluginVersion=r.zondy.mapboxgl.VERSION,r.Zondy.mapboxCustomCRS=d}]);
|
|
1
|
+
!function(e){var t={};function i(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(r,a,function(t){return e[t]}.bind(null,a));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=3)}([function(e,t){e.exports=function(){try{return window.MapGISCommon}catch(e){return{}}}()},function(e,t){e.exports=mapboxgl},function(e,t,i){e.exports=function(){"use strict";Object.freeze=function(e){return e};var e=Object.create||function(){function e(){}return function(t){return e.prototype=t,new e}}(),t=/\{ *([\w_-]+) *\}/g,i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=3.141592653589793,a=6378245,n=.006693421622965943,s=3e3*r/180;function o(e,t,i){var a=r/180*t,n=Math.pow(2,i);return[parseInt((e+180)/360*n),parseInt((1-Math.asinh(Math.tan(a))/r)/2*n)]}function l(e,t){if(i(e)){var r=e[0];t=e[1],e=r}e instanceof Object&&(r=e.lng,t=e.lat,e=r);var a,n,o,l,c,h,p=(a=e-.0065,n=t-.006,o=Math.sqrt(a*a+n*n)-2e-5*Math.sin(n*s),l=Math.atan2(n,a)-3e-6*Math.cos(a*s),c=o*Math.cos(l),h=o*Math.sin(l),{lng:c,lat:h});return u(p.lng,p.lat)}function c(e,t){if(i(e)){var r=e[0];t=e[1],e=r}e instanceof Object&&(r=e.lng,t=e.lat,e=r);var a,n,o,l,c,u,p=h(e,t);return a=p.lng,n=p.lat,o=Math.sqrt(a*a+n*n)+2e-5*Math.sin(n*s),l=Math.atan2(n,a)+3e-6*Math.cos(a*s),c=o*Math.cos(l)+.0065,u=o*Math.sin(l)+.006,{lng:c,lat:u}}function h(e,t){if(i(e)){var s=e[0];t=e[1],e=s}e instanceof Object&&(s=e.lng,t=e.lat,e=s);var o=p(e-105,t-35),l=d(e-105,t-35),c=t/180*r,h=Math.sin(c);h=1-n*h*h;var u=Math.sqrt(h);return o=180*o/(a*(1-n)/(h*u)*r),{lng:e+(l=180*l/(a/u*Math.cos(c)*r)),lat:t+o}}function u(e,t){if(i(e)){var s=e[0];t=e[1],e=s}e instanceof Object&&(s=e.lng,t=e.lat,e=s);var o=function(e,t){var i=p(e-105,t-35),s=d(e-105,t-35),o=t/180*r,l=Math.sin(o);l=1-n*l*l;var c=Math.sqrt(l);return i=180*i/(a*(1-n)/(l*c)*r),s=180*s/(a/c*Math.cos(o)*r),{lng:e+s,lat:t+i}}(e,t);return{lng:2*e-o.lng,lat:2*t-o.lat}}function p(e,t){var i=2*e-100+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*r)+20*Math.sin(2*e*r))/3,i+=2*(20*Math.sin(t*r)+40*Math.sin(t/3*r))/3,i+=2*(160*Math.sin(t/12*r)+320*Math.sin(t*r/30))/3}function d(e,t){var i=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*r)+20*Math.sin(2*e*r))/3,i+=2*(20*Math.sin(e*r)+40*Math.sin(e/3*r))/3,i+=2*(150*Math.sin(e/12*r)+300*Math.sin(e/30*r))/3}function y(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function m(e){return"string"==typeof e}var f=void 0,g=null;function v(e,t){isNaN(e)&&(e=Ib(e),e=isNaN(e)?0:e),m(e)&&(e=parseFloat(e)),isNaN(t)&&(t=Ib(t),t=isNaN(t)?0:t),m(t)&&(t=parseFloat(t)),this.lng=e,this.lat=t}function b(e,t){this.x=e||0,this.y=t||0,this.x=this.x,this.y=this.y}function _(){}function S(){}v.TL=function(e){return e&&180>=e.lng&&-180<=e.lng&&74>=e.lat&&-74<=e.lat},v.prototype.lb=function(e){return e&&this.lat==e.lat&&this.lng==e.lng},b.prototype.lb=function(e){return e&&e.x==this.x&&e.y==this.y},_.prototype.nh=function(){aa("lngLatToPoint方法未实现")},_.prototype.wi=function(){aa("pointToLngLat方法未实现")},S.prototype=new _,y(S,{$O:6370996.81,lG:[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],Au:[75,60,45,30,15,0],fP:[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],iG:[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],Z1:function(e,t){return e&&t&&(e=this.Fb(e))?(i=this.Tk(e.lng),r=this.Tk(e.lat),(t=this.Fb(t))?this.Pe(i,this.Tk(t.lng),r,this.Tk(t.lat)):0):0;var i,r},Vo:function(e,t){return e&&t?(e.lng=this.JD(e.lng,-180,180),e.lat=this.ND(e.lat,-74,74),t.lng=this.JD(t.lng,-180,180),t.lat=this.ND(t.lat,-74,74),this.Pe(this.Tk(e.lng),this.Tk(t.lng),this.Tk(e.lat),this.Tk(t.lat))):0},Fb:function(e){if(e===g||e===f)return new v(0,0);var t,i;t=new v(Math.abs(e.lng),Math.abs(e.lat));for(var r=0;r<this.lG.length;r++)if(t.lat>=this.lG[r]){i=this.fP[r];break}return new v((e=this.gK(e,i)).lng.toFixed(6),e.lat.toFixed(6))},Eb:function(e){if(e===g||e===f||180<e.lng||-180>e.lng||90<e.lat||-90>e.lat)return new v(0,0);var t,i;e.lng=this.JD(e.lng,-180,180),e.lat=this.ND(e.lat,-74,74),t=new v(e.lng,e.lat);for(var r=0;r<this.Au.length;r++)if(t.lat>=this.Au[r]){i=this.iG[r];break}if(!i)for(r=0;r<this.Au.length;r++)if(t.lat<=-this.Au[r]){i=this.iG[r];break}return new v((e=this.gK(e,i)).lng.toFixed(2),e.lat.toFixed(2))},gK:function(e,t){if(e&&t){var i=t[0]+t[1]*Math.abs(e.lng),r=Math.abs(e.lat)/t[9];return r=t[2]+t[3]*r+t[4]*r*r+t[5]*r*r*r+t[6]*r*r*r*r+t[7]*r*r*r*r*r+t[8]*r*r*r*r*r*r,new v(i*=0>e.lng?-1:1,r*=0>e.lat?-1:1)}},Pe:function(e,t,i,r){return this.$O*Math.acos(Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos(t-e))},Tk:function(e){return Math.PI*e/180},Z3:function(e){return 180*e/Math.PI},ND:function(e,t,i){return t!=g&&(e=Math.max(e,t)),i!=g&&(e=Math.min(e,i)),e},JD:function(e,t,i){for(;e>i;)e-=i-t;for(;e<t;)e+=i-t;return e}}),y(S.prototype,{Jm:function(e){return S.Eb(e)},nh:function(e){return new b((e=S.Eb(e)).lng,e.lat)},qh:function(e){return S.Fb(e)},wi:function(e){return e=new v(e.x,e.y),S.Fb(e)},fc:function(e,t,i,r,a){if(e)return e=this.Jm(e,a),t=this.Lc(t),new b(Math.round((e.lng-i.lng)/t+r.width/2),Math.round((i.lat-e.lat)/t+r.height/2))},zb:function(e,t,i,r,a){if(e)return t=this.Lc(t),this.qh(new v(i.lng+t*(e.x-r.width/2),i.lat-t*(e.y-r.height/2)),a)},Lc:function(e){return Math.pow(2,18-e)}});var x=S.prototype;!function(e,t){for(var i in t)e[i]=t[i]}(x,{lngLatToPoint:x.nh,pointToLngLat:x.wi});let w={Point:v,Pixel:b,MercatorProjection:S};class L{constructor(e,t){this.levelMax=e,this.levelMin=t,this.projection=new w.MercatorProjection}_getRetain(e){return Math.pow(2,e-18)}getResolution(e,t){return Math.pow(2,18-t)*Math.cos(e)}lnglatToPoint(e,t){let i=new w.Point(e,t),r=this.projection.lngLatToPoint(i);return{pointX:r.x,pointY:r.y}}pointToLnglat(e,t){let i=new w.Pixel(e,t),r=this.projection.pointToLngLat(i);return{lng:r.lng,lat:r.lat}}_lngToTileX(e,t){let i=this.lnglatToPoint(e,0);return Math.floor(i.pointX*this._getRetain(t)/256)}_latToTileY(e,t){let i=this.lnglatToPoint(0,e);return Math.floor(i.pointY*this._getRetain(t)/256)}lnglatToTile(e,t,i){return[this._lngToTileX(e,i),this._latToTileY(t,i)]}_lngToPixelX(e,t){let i=this._lngToTileX(e,t),r=this.lnglatToPoint(e,0);return Math.floor(r.pointX*this._getRetain(t)-256*i)}_latToPixelY(e,t){let i=this._latToTileY(e,t),r=this.lnglatToPoint(0,e);return Math.floor(r.pointY*this._getRetain(t)-256*i)}lnglatToPixel(e,t,i){return{pixelX:this._lngToPixelX(e,i),pixelY:this._latToPixelY(t,i)}}_pixelXToLng(e,t,i){let r=(256*t+e)/this._getRetain(i);return this.pointToLnglat(r,0).lng}_pixelYToLat(e,t,i){let r=(256*t+e)/this._getRetain(i);return this.pointToLnglat(0,r).lat}pixelToLnglat(e,t,i,r,a){let n=(256*i+e)/this._getRetain(a),s=(256*r+t)/this._getRetain(a),o=this.pointToLnglat(n,s);return[o.lng,o.lat]}}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(e){"@babel/helpers - typeof";return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(e){var t=function(e,t){if("object"!=T(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==T(t)?t:t+""}function P(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,V(r.key),r)}}function k(e,t,i){return t&&P(e.prototype,t),i&&P(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t){return(C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,a,n,s,o=[],l=!0,c=!1;try{if(n=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(r=n.call(i)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?j(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var A,z=1e-6,R="undefined"!=typeof Float32Array?Float32Array:Array;function D(e,t){var i,r,a,n,s,o,l,c=(i=[],a=e,n=(r=t)[0],s=r[1],o=r[2],l=r[3],i[0]=a[0]*n+a[4]*s+a[8]*o+a[12]*l,i[1]=a[1]*n+a[5]*s+a[9]*o+a[13]*l,i[2]=a[2]*n+a[6]*s+a[10]*o+a[14]*l,i[3]=a[3]*n+a[7]*s+a[11]*o+a[15]*l,i);return function(e,t,i){e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i}(c,c,1/c[3]),c}function G(e,t,i){var r=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],u=t[8],p=t[9],d=t[10],y=t[11],m=t[12],f=t[13],g=t[14],v=t[15],b=i[0],_=i[1],S=i[2],x=i[3];return e[0]=b*r+_*o+S*u+x*m,e[1]=b*a+_*l+S*p+x*f,e[2]=b*n+_*c+S*d+x*g,e[3]=b*s+_*h+S*y+x*v,b=i[4],_=i[5],S=i[6],x=i[7],e[4]=b*r+_*o+S*u+x*m,e[5]=b*a+_*l+S*p+x*f,e[6]=b*n+_*c+S*d+x*g,e[7]=b*s+_*h+S*y+x*v,b=i[8],_=i[9],S=i[10],x=i[11],e[8]=b*r+_*o+S*u+x*m,e[9]=b*a+_*l+S*p+x*f,e[10]=b*n+_*c+S*d+x*g,e[11]=b*s+_*h+S*y+x*v,b=i[12],_=i[13],S=i[14],x=i[15],e[12]=b*r+_*o+S*u+x*m,e[13]=b*a+_*l+S*p+x*f,e[14]=b*n+_*c+S*d+x*g,e[15]=b*s+_*h+S*y+x*v,e}function N(e,t,i){var r,a,n,s,o,l,c,h,u,p,d,y,m=i[0],f=i[1],g=i[2];return t===e?(e[12]=t[0]*m+t[4]*f+t[8]*g+t[12],e[13]=t[1]*m+t[5]*f+t[9]*g+t[13],e[14]=t[2]*m+t[6]*f+t[10]*g+t[14],e[15]=t[3]*m+t[7]*f+t[11]*g+t[15]):(r=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],u=t[8],p=t[9],d=t[10],y=t[11],e[0]=r,e[1]=a,e[2]=n,e[3]=s,e[4]=o,e[5]=l,e[6]=c,e[7]=h,e[8]=u,e[9]=p,e[10]=d,e[11]=y,e[12]=r*m+o*f+u*g+t[12],e[13]=a*m+l*f+p*g+t[13],e[14]=n*m+c*f+d*g+t[14],e[15]=s*m+h*f+y*g+t[15]),e}function F(e,t,i){var r=i[0],a=i[1],n=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),A=new R(4),R!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0,A[3]=0);var B=function(e,t,i,r,a){var n,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(n=1/(r-a),e[10]=(a+r)*n,e[14]=2*a*r*n):(e[10]=-1,e[14]=-2*r),e};function U(e,t){var i=e[0],r=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],y=e[12],m=e[13],f=e[14],g=e[15],v=t[0],b=t[1],_=t[2],S=t[3],x=t[4],w=t[5],L=t[6],M=t[7],T=t[8],V=t[9],P=t[10],k=t[11],O=t[12],E=t[13],C=t[14],j=t[15];return Math.abs(i-v)<=z*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(r-b)<=z*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(a-_)<=z*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(n-S)<=z*Math.max(1,Math.abs(n),Math.abs(S))&&Math.abs(s-x)<=z*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(o-w)<=z*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(l-L)<=z*Math.max(1,Math.abs(l),Math.abs(L))&&Math.abs(c-M)<=z*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(h-T)<=z*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(u-V)<=z*Math.max(1,Math.abs(u),Math.abs(V))&&Math.abs(p-P)<=z*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(d-k)<=z*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(y-O)<=z*Math.max(1,Math.abs(y),Math.abs(O))&&Math.abs(m-E)<=z*Math.max(1,Math.abs(m),Math.abs(E))&&Math.abs(f-C)<=z*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(g-j)<=z*Math.max(1,Math.abs(g),Math.abs(j))}function Z(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function $(e,t){if(!e)throw new Error(t||"viewport-mercator-project: assertion failed.")}!function(){var e;e=new R(2),R!=Float32Array&&(e[0]=0,e[1]=0)}(),function(){var e;e=new R(3),R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0)}();var q=Math.PI,K=q/4,W=q/180,J=180/q,X=512,Y=4003e4,H=1.5;function Q(e){return Math.pow(2,e)}function ee(e,t){var i=I(e,2),r=i[0],a=i[1];$(Number.isFinite(r)&&Number.isFinite(t)),$(Number.isFinite(a)&&a>=-90&&a<=90,"invalid latitude");var n=a*W;return[(t*=X)*(r*W+q)/(2*q),t*(q-Math.log(Math.tan(K+.5*n)))/(2*q)]}function te(e,t){var i=I(e,2),r=i[0],a=i[1],n=r/(t*=X)*(2*q)-q,s=2*(Math.atan(Math.exp(q-a/t*(2*q)))-K);return[n*J,s*J]}function ie(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=I(e,3),a=r[0],n=r[1],s=r[2];if($(Number.isFinite(a)&&Number.isFinite(n),"invalid pixel coordinate"),Number.isFinite(s))return D(t,[a,n,s,1]);var o=D(t,[a,n,0,1]),l=D(t,[a,n,1,1]),c=o[2],h=l[2];return function(e,t,i,r){var a=t[0],n=t[1];return e[0]=a+r*(i[0]-a),e[1]=n+r*(i[1]-n),e}([],o,l,c===h?0:((i||0)-c)/(h-c))}var re=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],ae=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.width,r=t.height,a=t.viewMatrix,n=void 0===a?re:a,s=t.projectionMatrix,o=void 0===s?re:s;M(this,e),this.width=i||1,this.height=r||1,this.scale=1,this.pixelsPerMeter=1,this.viewMatrix=n,this.projectionMatrix=o;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];G(l,l,this.projectionMatrix),G(l,l,this.viewMatrix),this.viewProjectionMatrix=l;var c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];F(c,c,[this.width/2,-this.height/2,1]),N(c,c,[1,-1,0]),G(c,c,this.viewProjectionMatrix);var h,u,p,d,y,m,f,g,v,b,_,S,x,w,L,T,V,P,k,O,E,C,j,I,A,z,R,D,B,U,Z,$=(h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],p=(u=c)[0],(Z=(k=p*(g=u[5])-(d=u[1])*(f=u[4]))*(U=(x=u[10])*(P=u[15])-(w=u[11])*(V=u[14]))-(O=p*(v=u[6])-(y=u[2])*f)*(B=(S=u[9])*P-w*(T=u[13]))+(E=p*(b=u[7])-(m=u[3])*f)*(D=S*V-x*T)+(C=d*v-y*g)*(R=(_=u[8])*P-w*(L=u[12]))-(j=d*b-m*g)*(z=_*V-x*L)+(I=y*b-m*v)*(A=_*T-S*L))?(Z=1/Z,h[0]=(g*U-v*B+b*D)*Z,h[1]=(y*B-d*U-m*D)*Z,h[2]=(T*I-V*j+P*C)*Z,h[3]=(x*j-S*I-w*C)*Z,h[4]=(v*R-f*U-b*z)*Z,h[5]=(p*U-y*R+m*z)*Z,h[6]=(V*E-L*I-P*O)*Z,h[7]=(_*I-x*E+w*O)*Z,h[8]=(f*B-g*R+b*A)*Z,h[9]=(d*R-p*B-m*A)*Z,h[10]=(L*j-T*E+P*k)*Z,h[11]=(S*E-_*j-w*k)*Z,h[12]=(g*z-f*D-v*A)*Z,h[13]=(p*D-d*z+y*A)*Z,h[14]=(T*O-L*C-V*k)*Z,h[15]=(_*C-S*O+x*k)*Z,h):null);if(!$)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=c,this.pixelUnprojectionMatrix=$,this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}return k(e,[{key:"equals",value:function(t){return t instanceof e&&t.width===this.width&&t.height===this.height&&U(t.projectionMatrix,this.projectionMatrix)&&U(t.viewMatrix,this.viewMatrix)}},{key:"project",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).topLeft,i=void 0===t||t,r=function(e,t){var i=I(e,3),r=i[0],a=i[1],n=i[2],s=void 0===n?0:n;return $(Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(s)),D(t,[r,a,s,1])}(this.projectPosition(e),this.pixelProjectionMatrix),a=I(r,2),n=a[0],s=a[1],o=i?s:this.height-s;return 2===e.length?[n,o]:[n,o,r[2]]}},{key:"unproject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.topLeft,r=void 0===i||i,a=t.targetZ,n=I(e,3),s=n[0],o=n[1],l=n[2],c=r?o:this.height-o,h=a&&a*this.pixelsPerMeter,u=ie([s,c,l],this.pixelUnprojectionMatrix,h),p=I(this.unprojectPosition(u),3),d=p[0],y=p[1],m=p[2];return Number.isFinite(l)?[d,y,m]:Number.isFinite(a)?[d,y,a]:[d,y]}},{key:"projectPosition",value:function(e){var t=I(this.projectFlat(e),2);return[t[0],t[1],(e[2]||0)*this.pixelsPerMeter]}},{key:"unprojectPosition",value:function(e){var t=I(this.unprojectFlat(e),2);return[t[0],t[1],(e[2]||0)/this.pixelsPerMeter]}},{key:"projectFlat",value:function(e){return arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scale,e}},{key:"unprojectFlat",value:function(e){return arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scale,e}}]),e}(),ne=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.width,a=i.height,n=i.latitude,s=void 0===n?0:n,o=i.longitude,l=void 0===o?0:o,c=i.zoom,h=void 0===c?0:c,u=i.pitch,p=void 0===u?0:u,d=i.bearing,y=void 0===d?0:d,m=i.altitude,f=void 0===m?1.5:m,g=i.nearZMultiplier,v=i.farZMultiplier;M(this,t),r=r||1,a=a||1;var b=Q(h);f=Math.max(.75,f);var _=ee([l,s],b);_[2]=0;var S=function(e){var t=e.width,i=e.height,r=e.pitch,a=function(e){var t=e.width,i=e.height,r=e.altitude,a=void 0===r?H:r,n=e.pitch,s=void 0===n?0:n,o=e.nearZMultiplier,l=void 0===o?1:o,c=e.farZMultiplier,h=void 0===c?1:c,u=s*W,p=Math.atan(.5/a),d=Math.sin(p)*a/Math.sin(Math.PI/2-u-p),y=Math.cos(Math.PI/2-u)*d+a;return{fov:2*Math.atan(i/2/a),aspect:t/i,focalDistance:a,near:l,far:y*h}}({width:t,height:i,altitude:e.altitude,pitch:r,nearZMultiplier:e.nearZMultiplier,farZMultiplier:e.farZMultiplier}),n=a.fov,s=a.aspect,o=a.near,l=a.far;return B([],n,s,o,l)}({width:r,height:a,pitch:p,bearing:y,altitude:f,nearZMultiplier:g||1/a,farZMultiplier:v||1.01}),x=function(e){var t,i,r,a,n,s,o,l,c,h,u,p,d,y=e.height,m=e.pitch,f=e.bearing,g=e.altitude,v=e.center,b=void 0===v?null:v,_=e.flipY,S=void 0!==_&&_,x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return N(x,x,[0,0,-g]),F(x,x,[1,1,1/y]),t=x,i=x,r=-m*W,a=Math.sin(r),n=Math.cos(r),s=i[4],o=i[5],l=i[6],c=i[7],h=i[8],u=i[9],p=i[10],d=i[11],i!==t&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[4]=s*n+h*a,t[5]=o*n+u*a,t[6]=l*n+p*a,t[7]=c*n+d*a,t[8]=h*n-s*a,t[9]=u*n-o*a,t[10]=p*n-l*a,t[11]=d*n-c*a,function(e,t,i){var r=Math.sin(i),a=Math.cos(i),n=t[0],s=t[1],o=t[2],l=t[3],c=t[4],h=t[5],u=t[6],p=t[7];t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a+c*r,e[1]=s*a+h*r,e[2]=o*a+u*r,e[3]=l*a+p*r,e[4]=c*a-n*r,e[5]=h*a-s*r,e[6]=u*a-o*r,e[7]=p*a-l*r}(x,x,f*W),S&&F(x,x,[1,-1,1]),b&&N(x,x,function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}([],b)),x}({height:a,center:_,pitch:p,bearing:y,altitude:f,flipY:!0});return(e=function(e,t){if(t&&("object"==T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}(this,E(t).call(this,{width:r,height:a,viewMatrix:x,projectionMatrix:S}))).latitude=s,e.longitude=l,e.zoom=h,e.pitch=p,e.bearing=y,e.altitude=f,e.scale=b,e.center=_,e.pixelsPerMeter=function(e){var t=e.latitude,i=e.longitude,r=e.zoom,a=e.scale,n=e.highPrecision,s=void 0!==n&&n;a=void 0!==a?a:Q(r),$(Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(a));var o={},l=X*a,c=Math.cos(t*W),h=l/360,u=h/c,p=l/Y/c;if(o.pixelsPerMeter=[p,-p,p],o.metersPerPixel=[1/p,-1/p,1/p],o.pixelsPerDegree=[h,-u,p],o.degreesPerPixel=[1/h,-1/u,1/p],s){var d=W*Math.tan(t*W)/c,y=h*d/2,m=l/Y*d,f=m/u*p;o.pixelsPerDegree2=[0,-y,m],o.pixelsPerMeter2=[f,0,f]}return o}(O(O(e))).pixelsPerMeter[2],Object.freeze(O(O(e))),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&C(e,t)}(t,ae),k(t,[{key:"projectFlat",value:function(e){return ee(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scale)}},{key:"unprojectFlat",value:function(e){return te(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scale)}},{key:"getMapCenterByLngLatPosition",value:function(e){var t,i,r=e.lngLat,a=ie(e.pos,this.pixelUnprojectionMatrix),n=Z([],ee(r,this.scale),((t=[])[0]=-(i=a)[0],t[1]=-i[1],t));return te(Z([],this.center,n),this.scale)}},{key:"getLocationAtPoint",value:function(e){var t=e.lngLat,i=e.pos;return this.getMapCenterByLngLatPosition({lngLat:t,pos:i})}},{key:"fitBounds",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.width,a=this.height,n=function(e){var t=e.width,i=e.height,r=e.bounds,a=e.minExtent,n=void 0===a?0:a,s=e.maxZoom,o=void 0===s?24:s,l=e.padding,c=void 0===l?0:l,h=e.offset,u=void 0===h?[0,0]:h,p=I(r,2),d=I(p[0],2),y=d[0],m=d[1],f=I(p[1],2),g=f[0],v=f[1];Number.isFinite(c)?c={top:c,bottom:c,left:c,right:c}:$(Number.isFinite(c.top)&&Number.isFinite(c.bottom)&&Number.isFinite(c.left)&&Number.isFinite(c.right));var b=new ne({width:t,height:i,longitude:0,latitude:0,zoom:0}),_=b.project([y,v]),S=b.project([g,m]),x=[Math.max(Math.abs(S[0]-_[0]),n),Math.max(Math.abs(S[1]-_[1]),n)],w=[t-c.left-c.right-2*Math.abs(u[0]),i-c.top-c.bottom-2*Math.abs(u[1])];$(w[0]>0&&w[1]>0);var L=w[0]/x[0],M=w[1]/x[1],T=(c.right-c.left)/2/L,V=(c.bottom-c.top)/2/M,P=[(S[0]+_[0])/2+T,(S[1]+_[1])/2+V],k=b.unproject(P),O=b.zoom+Math.log2(Math.abs(Math.min(L,M)));return{longitude:k[0],latitude:k[1],zoom:Math.min(O,o)}}(Object.assign({width:r,height:a,bounds:e},i));return new t({width:r,height:a,longitude:n.longitude,latitude:n.latitude,zoom:n.zoom})}}]),t}();class se{constructor(t,i,r){r=r||{},this.id=t,this.type="custom",this.renderingMode="2d",this.url=i,this.options={subdomains:null,visible:void 0===r.visible||r.visible,opacity:void 0!==r.opacity?r.opacity:1,minZoom:3,maxZoom:18,tileType:"xyz"},function(t,i){for(var r in t.hasOwnProperty("options")||(t.options=t.options?e(t.options):{}),i)t.options[r]=i[r]||t.options[r];t.options}(this,r),this.program,this.showTiles=[],this.tileCache={},this.gridCache={},this.matrix,this.map,this.isLayerShow,this.transformBaidu=new L}onAdd(e,t){this.map=e,this.isEPSG4326="EPSG:4326"===e.crs.getEpsgCode();var i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,"uniform mat4 u_custom_matrix;uniform vec4 u_center_pos;attribute vec4 a_Pos_Piexl;attribute vec2 a_TextCoord_Piexl;varying vec2 v_TextCoord;vec2 translateRelativeToEye(vec2 high, vec2 low) { vec2 highDiff = high - vec2(u_center_pos.x, u_center_pos.z); vec2 lowDiff = low - vec2(u_center_pos.y, u_center_pos.w); return highDiff + lowDiff;}void main() { vec2 eye_offset = translateRelativeToEye(vec2(a_Pos_Piexl.x, a_Pos_Piexl.z), vec2(a_Pos_Piexl.y, a_Pos_Piexl.w)); gl_Position = u_custom_matrix * vec4(eye_offset, 0.0, 1.0); v_TextCoord = a_TextCoord_Piexl;}"),t.compileShader(i);var r=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(r,"precision mediump float;uniform sampler2D u_Sampler; varying vec2 v_TextCoord; uniform vec2 u_viewport_size;uniform float u_opacity;void main() { vec4 color = texture2D(u_Sampler, v_TextCoord); color *= u_opacity; gl_FragColor = color;}"),t.compileShader(r),this.program=t.createProgram(),t.attachShader(this.program,i),t.attachShader(this.program,r),t.linkProgram(this.program),this.a_Pos_Piexl=t.getAttribLocation(this.program,"a_Pos_Piexl"),this.a_TileZoomScale=t.getAttribLocation(this.program,"a_TileZoomScale"),this.a_TextCoord_Piexl=t.getAttribLocation(this.program,"a_TextCoord_Piexl"),this.isLayerShow=!0,e.on("move",()=>{this.isLayerShow&&this.update(t,e)}),this.update(t,e),this.map=e}update(e,t){if(this.options.visible){var i,r,a,n=t.getCenter(),s=t.getBounds();if("xyz"===this.options.tileType){i=parseInt(t.getZoom()+1.4);var l=h(s.getNorthWest()),u=h(s.getSouthEast());r=o(l.lng,l.lat,i),a=o(u.lng,u.lat,i)}else if("bd09"===this.options.tileType){i=parseInt(t.getZoom()+1.8);var p=c(s.getSouthWest()),d=c(s.getNorthEast());r=this.transformBaidu.lnglatToTile(p.lng,p.lat,i),a=this.transformBaidu.lnglatToTile(d.lng,d.lat,i)}for(var y=[],m=r[0];m<=a[0];m++)for(var f=r[1];f<=a[1];f++){var g={x:m,y:f,z:i};i<this.options.minZoom||i>this.options.maxZoom||(y.push(g),this.addGridCache(g,0,0),m===a[0]&&this.addGridCache(g,1,0),f===a[1]&&this.addGridCache(g,0,1),m===a[0]&&f===a[1]&&this.addGridCache(g,1,1))}if("xyz"===this.options.tileType)var v=o(n.lng,n.lat,i);else"bd09"===this.options.tileType&&(v=this.transformBaidu.lnglatToTile(n.lng,n.lat,i));for(var g of(y.sort((e,t)=>this.tileDistance(e,v)-this.tileDistance(t,v)),this.showTiles=[],y))if(this.tileCache[this.createTileKey(g)])this.showTiles.push(this.tileCache[this.createTileKey(g)]);else{var b=this.createTile(e,g);this.showTiles.push(b),this.tileCache[this.createTileKey(g)]=b}}}addGridCache(e,t,i){var a=this.createTileKey(e.x+t,e.y+i,e.z);this.gridCache[a]||("xyz"===this.options.tileType?this.gridCache[a]=u(function(e,t,i){let a=Math.pow(2,i);return[e/a*360-180,180*Math.atan(Math.sinh(r*(1-2*t/a)))/r]}(e.x+t,e.y+i,e.z)):"bd09"===this.options.tileType&&(this.gridCache[a]=l(this.transformBaidu.pixelToLnglat(0,0,e.x+t,e.y+i,e.z))))}tileDistance(e,t){return Math.sqrt(Math.pow(e.x-t[0],2)+Math.pow(e.y-t[1],2))}createTileKey(e,t,i){return e instanceof Object?e.z+"/"+e.x+"/"+e.y:i+"/"+e+"/"+t}createTile(e,i){var r,a,n,s,o,l,c=(r=this.url,a={s:this.options.subdomains[Math.abs(i.x+i.y)%this.options.subdomains.length],x:i.x,y:i.y,z:i.z},r.replace(t,function(e,t){var i=a[t];if(void 0===i)throw new Error("No value provided for variable "+e);return"function"==typeof i&&(i=i(a)),i})),h={xyz:i};"xyz"===this.options.tileType?(n=this.gridCache[this.createTileKey(i)],s=this.gridCache[this.createTileKey(i.x+1,i.y,i.z)],o=this.gridCache[this.createTileKey(i.x,i.y+1,i.z)],l=this.gridCache[this.createTileKey(i.x+1,i.y+1,i.z)]):"bd09"===this.options.tileType&&(n=this.gridCache[this.createTileKey(i.x,i.y+1,i.z)],s=this.gridCache[this.createTileKey(i.x+1,i.y+1,i.z)],o=this.gridCache[this.createTileKey(i)],l=this.gridCache[this.createTileKey(i.x+1,i.y,i.z)]);var u=new Float32Array([n.lng,n.lat,0,1,o.lng,o.lat,0,0,s.lng,s.lat,1,1,l.lng,l.lat,1,0]),p=u.BYTES_PER_ELEMENT,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,u,e.STATIC_DRAW),h.buffer=d,h.PosParam={size:2,stride:4*p,offset:0},h.TextCoordParam={size:2,stride:4*p,offset:2*p};const y=this._convertMectorPoints(n),m=this._convertMectorPoints(s),f=this._convertMectorPoints(o),g=this._convertMectorPoints(l),v=new Float32Array([Math.fround(y[0]),y[0]-Math.fround(y[0]),Math.fround(y[1]),y[1]-Math.fround(y[1]),0,1,Math.fround(f[0]),f[0]-Math.fround(f[0]),Math.fround(f[1]),f[1]-Math.fround(f[1]),0,0,Math.fround(m[0]),m[0]-Math.fround(m[0]),Math.fround(m[1]),m[1]-Math.fround(m[1]),1,1,Math.fround(g[0]),g[0]-Math.fround(g[0]),Math.fround(g[1]),g[1]-Math.fround(g[1]),1,0]);p=v.BYTES_PER_ELEMENT;var b=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,b),e.bufferData(e.ARRAY_BUFFER,v,e.STATIC_DRAW),h.bufferPixel=b,h.PosPiexelsParam={size:4,stride:6*p,offset:0},h.TextPiexelsCoordParam={size:2,stride:6*p,offset:4*p};var _=new Image;return _.onload=(()=>{h.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,h.texture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,_),h.isLoad=!0,this.map.triggerRepaint()}),_.crossOrigin=!0,_.src=c,h}_convertMectorPoints(e){const t=this.map.transform.locationCoordinate(e);return[t.x,t.y,0,1]}render(e,t){if(!(this.map.getZoom()<this.options.minZoom||this.map.getZoom()>this.options.maxZoom)&&this.options.visible)for(var i of(this.matrix=t,e.useProgram(this.program),this.showTiles))if(i.isLoad){e.bindTexture(e.TEXTURE_2D,i.texture),e.activeTexture(e.TEXTURE0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.MIRRORED_REPEAT);var r=e.getUniformLocation(this.program,"u_Sampler");e.uniform1i(r,0),e.bindBuffer(e.ARRAY_BUFFER,i.bufferPixel),e.vertexAttribPointer(this.a_Pos_Piexl,i.PosPiexelsParam.size,e.FLOAT,!1,i.PosPiexelsParam.stride,i.PosPiexelsParam.offset),e.enableVertexAttribArray(this.a_Pos_Piexl),e.vertexAttribPointer(this.a_TextCoord_Piexl,i.TextPiexelsCoordParam.size,e.FLOAT,!1,i.TextPiexelsCoordParam.stride,i.TextPiexelsCoordParam.offset),e.enableVertexAttribArray(this.a_TextCoord_Piexl),this.setVertex(e,t),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,0,4)}}setVertex(e,t){this.map.getZoom(),this.map.getBearing(),this.map.getPitch();const i=this.map.getCenter();this.map.painter,this.map.transform;const r=this._convertMectorPoints(i),a=t.slice();a[12]+=a[0]*r[0]+a[4]*r[1],a[13]+=a[1]*r[0]+a[5]*r[1],a[14]+=a[2]*r[0]+a[6]*r[1],a[15]+=a[3]*r[0]+a[7]*r[1];let n={u_custom_matrix:a,u_center_pos:new Float32Array([Math.fround(r[0]),r[0]-Math.fround(r[0]),Math.fround(r[1]),r[1]-Math.fround(r[1])]),u_opacity:this.options.opacity};e.uniformMatrix4fv(e.getUniformLocation(this.program,"u_custom_matrix"),!1,n.u_custom_matrix),e.uniform4fv(e.getUniformLocation(this.program,"u_center_pos"),n.u_center_pos),e.uniform1f(e.getUniformLocation(this.program,"u_opacity"),n.u_opacity)}setOpacity(e){this.options.opacity=e,this._requestRender()}setVisible(e){e&&!this.options.visible&&this.map?(this.options.visible=e,this.update(this.map.painter.context.gl,this.map)):this.options.visible=e,this._requestRender()}_requestRender(){var e=this.map;e&&e._update()}onRemove(e,t){this.isLayerShow=!1}}function oe(e,t,i){var r,a=i||{},n=oe.providers,s=t.split("."),o=s[0],l=s[1],c=s[2],h=n[o][l][c],u=n[o].Subdomains,p=n[o][l].minzoom,d=n[o][l].maxzoom,y=n[o].tileType;if("Custom"===o&&(h=a.url?a.url:h,p=a.minzoom?a.minzoom:0,d=a.maxzoom?a.maxzoom:20),"TianDiTu"===o||"OSM"===o){var m=a.key||n[o].key,f=[];for(var g of u)f.push(h.replace("{s}",g).replace("{key}",m));r={id:e,type:"raster",source:{type:"raster",tiles:f,tileSize:256,minzoom:p,maxzoom:d}}}else r=new se(e,h,{subdomains:u,minZoom:p,maxZoom:d,tileType:y});return r}return oe.providers={TianDiTu:{Normal:{Map:"http://t{s}.tianditu.com/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cva_w&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:18},Normal4326:{Map:"http://t{s}.tianditu.com/DataServer?T=vec_c&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cva_c&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:18},Satellite:{Map:"http://t{s}.tianditu.com/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cia_w&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:18},Satellite4326:{Map:"http://t{s}.tianditu.com/DataServer?T=img_c&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cia_c&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:18},Terrain:{Map:"http://t{s}.tianditu.com/DataServer?T=ter_w&X={x}&Y={y}&L={z}&tk={key}",Annotion:"http://t{s}.tianditu.com/DataServer?T=cta_w&X={x}&Y={y}&L={z}&tk={key}",minzoom:0,maxzoom:14},Subdomains:["0","1","2","3","4","5","6","7"],key:""},GaoDe:{Normal:{Map:"http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",minzoom:3,maxzoom:18},Normal_NoTag:{Map:"https://wprd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&scl=1<ype=11&x={x}&y={y}&z={z}",minzoom:3,maxzoom:18},Satellite:{Map:"http://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",Annotion:"http://webst0{s}.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}",minzoom:3,maxzoom:18},Subdomains:["1","2","3","4"]},Baidu:{Normal:{Map:"//online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1"},Satellite:{Map:"//shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46",Annotion:"//online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=sl&v=020"},Subdomains:"0123456789",tileType:"bd09"},Geoq:{Normal:{Map:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}",PurplishBlue:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}",Gray:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}",Warm:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}",minzoom:3,maxzoom:16},Subdomains:[]},OSM:{Normal:{Map:"//{s}.tile.osm.org/{z}/{x}/{y}.png",minzoom:0,maxzoom:18},Subdomains:["a","b","c"]},Custom:{WMTS:{URL:"custom/{z}/{x}/{y}.png",minzoom:0,maxzoom:20},TMS:{URL:"custom/{z}/{x}/{y}.png",minzoom:0,maxzoom:20},Subdomains:["0","1","2","3"]}},oe}()},function(e,t,i){"use strict";i.r(t);var r=i(0),a=i(1),n=i.n(a),s=i(2),o=i.n(s);function l(e){const t=e._getLayerViewVisible();e.innerLayer&&e.innerLayer.implementation&&e.innerLayer.implementation.type&&"custom"===e.innerLayer.implementation.type&&e.innerLayer.implementation.setVisible?e.innerLayer.implementation.setVisible(t):e.innerView.setLayoutProperty(e.innerLayer.id,"visibility",t?"visible":"none")}function c(e){e.innerLayer.id&&e.innerView.removeLayer(e.innerLayer.id),e.innerLayer.source&&e.innerView.removeSource(e.innerLayer.source)}function h(e){const t=e._getOpacity();e.innerLayer&&e.innerLayer.implementation&&e.innerLayer.implementation.type&&"custom"===e.innerLayer.implementation.type&&e.innerLayer.implementation.setOpacity?e.innerLayer.implementation.setOpacity(t):e.innerView.setPaintProperty(e.innerLayer.id,"raster-opacity",t)}function u(e,t,i,a,n,s,o,l){let c,h,u=[e];if(e&&e.includes("{s}")&&Array.isArray(a)&&(u=a.map(t=>e.replace("{s}",t))),l){const e=t||256,i=Math.max(l.xmax-l.xmin,l.ymax-l.ymin)/e,a=Object(r.getExtendExtentByPixel)(l,{extendPixel:100,resolution:i,outSpatialReference:new r.SpatialReference({wkid:4326})});h=[a.xmin,a.ymin,a.xmax,a.ymax]}return c="image"===i?{url:e,rebaseRequestUrl(e,t){const i=this.map.getCRS().projection.project(this.map.getBounds()._sw),r=this.map.getCRS().projection.project(this.map.getBounds()._ne),a=[...i,...r].toString(),[n,s]=t.imageSize;return(e.split("?").length>1?e.split("?")[1].split("&"):e.split("&")).forEach(t=>{t.includes("size=")&&(e=e.replace(t,`size=${n},${s}`)),t.includes("w=")?e=e.replace(t,`w=${n}`):t.includes("width=")&&(e=e.replace(t,`width=${n}`)),t.includes("h=")&&!t.includes("width=")?e=e.replace(t,`h=${s}`):t.includes("height=")&&(e=e.replace(t,`height=${s}`)),t.includes("bbox=")&&(e=e.replace(t,`bbox=${a}`))}),e},requestParams:n,type:"image-map",clippingArea:s}:{type:"raster",tiles:u,requestParams:n,tileSize:t,clippingArea:s,decryptOptions:o},h&&(c.bounds=h),c}function p(e,t,i,a){return{id:e,type:"raster",source:t,paint:{"raster-opacity":Object(r.isNull)(a)?i.opacity:a._getOpacity()},layout:{visibility:(Object(r.isNull)(a)?i.visible:a._getLayerViewVisible())?"visible":"none"}}}function d(e,t){let i,r;if(t.getProj||t.projectGeometry){const a=t;i=class extends e.Projection{constructor(e,t){super();const i=t||{};if(t.def)this._wkt=i.def;else if(e){const t=/^(EPSG|epsg)(:)?\d+$/,i=/\d+$/,r=e.match(i);if(t.test(e)&&r){this._wkid=parseInt(r[0]);const e=a.getEPSGByWKID(this._wkid);e&&(this._wkt=e.strProject)}}else this._wkt=a.getEPSGByWKID(3857).strProject;this._wkt&&(this._proj=a.getProj(e||function(){let e="";for(let t=1;t<=32;t++)e+=Math.floor(16*Math.random()).toString(16),8!==t&&12!==t&&16!==t&&20!==t||(e+="-");return e}(),this._wkt))}project(e){let t,i;Array.isArray(e)?(t=e[0],i=e[1]):(t=e.lng,i=e.lat);const r=[t,i];let n;return[(n=a.isCustomWKID(this._wkid)?a.projectPoints({points:[r],originWKID:4326,targetWKID:this._wkid})[0]:this._proj.forward(r))[0],n[1]]}unproject(e){let t,i;Array.isArray(e)?(t=e[0],i=e[1]):(t=e.x,i=e.y);const r=[t,i];let n;return[(n=a.isCustomWKID(this._wkid)?a.projectPoints({points:[r],originWKID:this._wkid,targetWKID:4326})[0]:this._proj.inverse([t,i]))[0],n[1]]}},r=class extends e.CRS{_parseParams(e){this._crsType="proj4",this.epsgCode=e[0],this.code=this.epsgCode,this.def=e[1];const t=e[2]||{};this._parseOptions(t)}_parseOptions(e){if(super._parseOptions(e),this._resolutions=e.resolutions,Array.isArray(this._resolutions)){const e={};this._resolutions.forEach((t,i)=>{e[i]=t}),this._resolutions=e}if(!this._resolutions)throw new Error("自定义坐标系时,未设置分辨率数组");if(!this.origin)throw new Error("自定义坐标系时,未设置原点");this.tileSize=e.tileSize||256}_setProjection(){this.projection=new i(this.getEpsgCode(),{origin:this.origin,def:this.def})}}}else{const a=t;i=class extends e.Projection{constructor(e,t){super();const i=(t||{}).def;if(!i)throw new Error("自定义参考系必须指定参数系信息def");if(this._def=i,!a)throw new Error("proj4对象不存在,自定义投影必须引入proj4对象");const r=this._isProj4Obj(e);this._proj=r?e:this._projFromCodeDef(e,i)}project(e){let t,i;return Array.isArray(e)?(t=e[0],i=e[1]):(t=e.lng,i=e.lat),this._proj.forward([t,i])}unproject(e){let t,i;return Array.isArray(e)?(t=e[0],i=e[1]):(t=e.x,i=e.y),this._proj.inverse([t,i])}_projFromCodeDef(e,t){if(t)a.defs(e,t);else if(void 0===a.defs[e]){const t=e.split(":");if(t.length>3&&(e=`${t[t.length-3]}:${t[t.length-1]}`),void 0===a.defs[e])throw`No projection definition for code ${e}`}return a(e)}_isProj4Obj(e){return void 0!==e.inverse&&void 0!==e.forward}},r=class extends e.CRS{_parseParams(e){this._crsType="proj4",this.epsgCode=e[0],this.code=this.epsgCode,this.def=e[1];const t=e[2]||{};this._parseOptions(t)}_parseOptions(e){if(super._parseOptions(e),this._resolutions=e.resolutions,Array.isArray(this._resolutions)){const e={};this._resolutions.forEach((t,i)=>{e[i]=t}),this._resolutions=e}if(!this._resolutions)throw new Error("自定义坐标系时,未设置分辨率数组");if(!this.origin)throw new Error("自定义坐标系时,未设置原点");this.tileSize=e.tileSize||256}_setProjection(){this.projection=new i(this.getEpsgCode(),{origin:this.origin,def:this.def})}}}return e.Proj||(e.Proj={}),e.Proj.CRS=r,e.Proj.Projection=i,r}var y=d(n.a,r.Projection);const m="== != > < >= <= array at boolean case coalesce collator format image in interpolate interpolate-hcl interpolate-lab\nlength let literal match number number-format object step string to-boolean to-color to-number to-string var within";class f{static isMapboxExpression(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&m.indexOf(e[0])>-1}static convertLineStyle(e,t){switch(e){case"dash":case"esriSLSDash":return t?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return t?[4,3,1,3]:[3,4,0,4];case"dot":case"esriSLSDot":return t?[1,3]:[0,4];case"long-dash":case"esriSLSLongDash":return t?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return t?[8,3,1,3]:[7,4,0,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return t?[8,3,1,3,1,3]:[7,4,0,4,0,4];case"short-dash":case"esriSLSShortDash":return t?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return t?[4,1,1,1]:[3,2,0,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return t?[4,1,1,1,1,1]:[3,2,0,2,0,2];case"short-dot":case"esriSLSShortDot":return t?[1,1]:[0,2];case"solid":case"esriSLSSolid":case"none":default:return}}static convertToGeoJSON(e){let t=e;const i=t.geometry,a=i.spatialReference;return"4326"!==String(a.wkid)&&((t=e.clone()).geometry=r.Projection.project(i,new r.SpatialReference("EPSG:4326"))),e.additional&&e.additional.arc3&&(e.geometry=Object(r.editGeometryByArc3)(e.geometry,e.additional)),t.toGeoJSON()}static convertLngLatGeometry(e){return e&&e.spatialReference?e.spatialReference.isGeographic?e:r.Projection.project(e,new r.SpatialReference("EPSG:4326")):e}static convertClippingArea(e){if(!e)return e;let t=null;switch(e.type){case r.GeometryType.polygon:case r.GeometryType.multiPolygon:t=f.convertLngLatGeometry(e).toGeoJSON();break;case r.GeometryType.circle:t=f.convertLngLatGeometry(e).toPolygon().toGeoJSON();break;case r.GeometryType.extent:t=f.convertLngLatGeometry(e).toPolygon().toGeoJSON();break}return t}static applyVisibleAndOpacityToColor(e,t,i){const a=r.Color.fromColor(e).clone(),n=i*(t?1:0);return a.alpha*=n,a}static createCRSByLayer(e){e&&e.spatialReference||r.Log.error("计算crsOptions错误");const t=r.TileInfoUtil.getTileInfoByLayer(e),i=e.spatialReference,a=t.origin.coordinates,n=e.extent,s={},o={};t.lods.map(e=>e.clone()).forEach(e=>{s[e.level]=e.resolution,o[e.level]=e.levelValue});const l=`EPSG:${i.wkid}`,c=i.wkt;return new y(l,c,{levelValues:o,resolutions:s,origin:[a[0],a[1]],tileSize:t.getTileSize(),bounds:[n.xmin,n.ymin,n.xmax,n.ymax],unit:i.isGeographic?"degree":void 0})}}var g=f;class v{}v.addIGSTileLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=v.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},v.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,a=`source_${e.id}`,n=`layer_${e.id}`;let s={tokenKey:e.tokenKey,tokenValue:e.tokenValue};const o=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGSTileLayerV1","IGSTileLayerV2"]),l=r.ServerUtil.getTile(o,s);let c=l.url;const h=r.UrlUtil.getStringFromObject(l.queryParameters);h&&(c+=`?${h}`);const d={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(d.data=l.queryParameters);const y=u(c,e.tileSize,null,null,d,g.convertClippingArea(e.clippingArea),e.decryptOptions),m=p(n,a,e,i),[f,v]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo);y.minzoom=f,y.maxzoom=v,y.crs=g.createCRSByLayer(e);const b={};return b[a]=y,{sources:b,layers:[m]}},v.setVisible=function(e){l(e)},v.setOpacity=function(e){h(e)},v.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=v.addIGSTileLayer(e,{})},v.removeLayer=function(e){c(e)};var b=v;class _{}_.addArcGISTileLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=_.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},_.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,{extensionOptions:a={}}=e,n=`source_${e.id}`,s=`layer_${e.id}`;let o={tokenKey:e.tokenKey,tokenValue:e.tokenValue};o=Object.assign(o,a);const l=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["ArcGISVectorTileLayer","IGS-ArcGISVectorTileLayer"]),c=r.ServerUtil.getTile(l,o);let h=c.url;const d=r.UrlUtil.getStringFromObject(c.queryParameters);d&&(h+=`?${d}`);const y={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(y.data=c.queryParameters);const m=u(h,e.tileSize,null,null,y,t.clippingArea);m.crs=g.createCRSByLayer(e);const f=p(s,n,e,i),v={};return v[n]=m,{sources:v,layers:[f]}},_.setVisible=function(e){l(e)},_.setOpacity=function(e){h(e)},_.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=_.addArcGISTileLayer(e,{})},_.removeLayer=function(e){c(e)};var S=_;class x{}x.addArcGISMapImageLayer=function(e){const t=e.layer,i=e.innerView,r={};r.layerView=e;const a=x.getSourcesAndStyleLayers(t,r);ne(a,i);const n=i.getLayer(a.layers[0].id);return n.sourceID=n.source,n},x.getSourcesAndStyleLayers=function(e,t){t=t||{};const{layerView:i={}}=t,{extensionOptions:a={}}=e,{view:n}=i,s=`source_${e.id}`,o=`layer_${e.id}`;let l={layers:e.layers,format:e.imageFormat,transparent:e.imageTransparency,size:`${e.imageWidth},${e.imageHeight}`,tokenKey:e.tokenKey,tokenValue:e.tokenValue};if(n){!e.spatialReference.equals(n.spatialReference)&&(l.imageSR=n.spatialReference)}l=Object.assign(l,a);const c=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGS-ArcGISMapImageLayer","ArcGISMapImageLayer"]),h=r.ServerUtil.getImage(c,l);let d=h.url;const y=r.UrlUtil.getStringFromObject(h.queryParameters);y&&(d+=`?${y}`);const m={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(m.data=h.queryParameters);const f=u(d,e.imageWidth,e.renderMode,void 0,m),g=p(o,s,e,i),v={};return v[s]=f,{sources:v,layers:[g]}},x.setVisible=function(e){l(e)},x.setOpacity=function(e){h(e)},x.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=x.addArcGISMapImageLayer(e,{})},x.removeLayer=function(e){c(e)};var w=x;class L{}L.addWMTSLayer=function(e,t){const i=e.layer,r=e.innerView;(t=t||{}).layerView=e;const a=L.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},L.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,{extensionOptions:a={},activeLayer:n}=e,s=`source_${e.id}`,o=`layer_${e.id}`;let l={version:e.version,layer:n.identifier,style:n.styleId,tileMatrixSet:n.tileMatrixSetId,format:n.format,tokenKey:e.tokenKey,tokenValue:e.tokenValue};l=Object.assign(l,a);const c=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["WMTSLayerV1","WMTSLayerV2"]),h=r.ServerUtil.getTile(c,l);let d=h.url;const y=r.UrlUtil.getStringFromObject(h.queryParameters);y&&(d+=`?${y}`);const m={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(m.data=h.queryParameters);const f=e.getCurrentTileInfo(),v=u(d,f.size[0],null,null,m,t.clippingArea),b=p(o,s,e,i),[_,S]=r.TileInfoUtil.getLevelRangeByTileInfo(f);v.minzoom=_,v.maxzoom=S,v.crs=g.createCRSByLayer(e);const x={};return x[s]=v,{sources:x,layers:[b]}},L.setVisible=function(e){l(e)},L.setOpacity=function(e){h(e)},L.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=L.addWMTSLayer(e,{})},L.removeLayer=function(e){c(e)};var M=L;class T{}T.addWMSLayer=function(e,t){const i=e.layer,r=e.innerView;(t=t||{}).layerView=e;const a=T.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},T.getSourcesAndStyleLayers=function(e,t){t=t||{};const{layerView:i={}}=t,{extensionOptions:a={}}=e,{view:n}=i,s=`source_${e.id}`,o=`layer_${e.id}`;let l={version:e.version,layers:e.layers,styles:e.styles,width:e.imageWidth,height:e.imageHeight,format:e.imageFormat,transparent:e.imageTransparency,srs:e.spatialReference,crs:e.spatialReference,queryParameters:{}};if(l.queryParameters[e.tokenKey]=e.tokenValue,n){!e.spatialReference.equals(n.spatialReference)&&(l.srs=n.spatialReference,l.crs=n.spatialReference)}l=Object.assign(l,a);const c=r.ServerUtil.getImage(e.url,l);let h=c.url;const d=r.UrlUtil.getStringFromObject(c.queryParameters);d&&(h+=`?${d}`);const y={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(y.data=c.queryParameters);const m=u(h,e.imageWidth,e.renderMode,null,y,t.clippingArea),f=p(o,s,e,i),g={};return g[s]=m,{sources:g,layers:[f]}},T.setVisible=function(e){l(e)},T.setOpacity=function(e){h(e)},T.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=T.addWMSLayer(e,{})},T.removeLayer=function(e){c(e)};var V=T;class P{}P.addWebTileLayer=function(e,t){const i=e.layer,r=e.innerView;(t=t||{}).layerView=e;const a=P.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},P.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,{extensionOptions:a={}}=e,[n,s]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo),l=e.spatialReference&&e.spatialReference.wkid?Number(e.spatialReference.wkid):void 0;let c=Object(r.formatWebTileUrl)(e.url),h={};Object(r.defined)(e.tokenKey)&&Object(r.defined)(e.tokenValue)&&(h[e.tokenKey]=e.tokenValue),h=Object.assign(h,a);const d={method:e.httpMethod,headers:e.headers,data:h};if("GET"!==e.httpMethod){const e=r.UrlUtil.getBaseUrlAndParams(c);c=e.baseUrl,d.data=Object.assign(e.params,h)}if(l===r.CustomWKID.bd09mc||l===r.CustomWKID.gcj02mc)return function(e,t){const i=e.spatialReference&&e.spatialReference.wkid?Number(e.spatialReference.wkid):void 0;let a;const n=`source_${e.id}`,s=t.layerView,l={opacity:Object(r.isNull)(s)?e.opacity:s._getOpacity(),visible:Object(r.isNull)(s)?e.visible:s._getLayerViewVisible(),minZoom:t.minZoom,maxZoom:t.maxZoom};return i===r.CustomWKID.bd09mc?(o.a.providers.Baidu[n]={Map:e.url,Subdomains:e.subDomains.toString()},a=o()(n,`Baidu.${n}.Map`,l)):i===r.CustomWKID.gcj02mc&&(o.a.providers.GaoDe[n]={Map:e.url,Subdomains:e.subDomains.toString()},a=o()(n,`GaoDe.${n}.Map`,l)),{sources:{},layers:[a]}}(e,Object.assign({minzoom:n,maxzoom:s},t));const y=`source_${e.id}`,m=`layer_${e.id}`,f=u(c,e.tileSize,null,e.subDomains,d,t.clippingArea);f.minzoom=n,f.maxzoom=s,f.crs=g.createCRSByLayer(e),"tms"===e.tileSliceType&&(f.scheme="tms");const v=p(m,y,e,i),b={};return b[y]=f,{sources:b,layers:[v]}},P.setVisible=function(e){l(e)},P.setOpacity=function(e){h(e)},P.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=P.addWebTileLayer(e,{})},P.removeLayer=function(e){c(e)};var k=P;const O=2e3;var E=class{constructor(e){this.innerView=e,this.cacheImageDetla={},this.imageCount=0}getIconScale(e,t,i){if(this.cacheImageDetla[e]){const{width:r,height:a}=this.cacheImageDetla[e];return r&&a?Math.max(t/(r||1),i/(a||1)):.001}return.001}hasImageCacheDetla(e){return!!this.cacheImageDetla[e]&&this.cacheImageDetla[e].keyObjects}loadImage(e,t,i){i=i||{};const r=this.innerView;return new Promise(a=>{r.loadImage(t,(t,n)=>{r.hasImage(e)?r.removeImage(e):this.imageCount++,t&&(i.notLoaded=!0,console.error("mapboxgl引擎loadImage方法加载图片资源加载失败"));const s=n||new Image(1,1),o={};i.pfsScale&&i.pfsSize&&(o.pixelRatio=Math.max(s.width,s.height)/i.pfsSize/i.pfsScale),r.addImage(e,s,o),a({id:e,width:s.width,height:s.height,keyObjects:i})})})}updateImage(e,t,i){i=i||{};const r=this.innerView;if(!e||!t)return Promise.resolve(null);if(this._shouldUpdateImage(e,t,i))return this.cacheImageDetla[e]={imageSource:t,totalUpdateCount:1},this.loadImage(e,t,i).then(t=>{if(this.cacheImageDetla[e])return this.cacheImageDetla[e].width=t.width,this.cacheImageDetla[e].height=t.height,this.cacheImageDetla[e].keyObjects=i,this.cacheImageDetla[e]});if(this.cacheImageDetla[e]&&this.cacheImageDetla[e].totalUpdateCount++,this.imageCount>O){const e=Object.entries(this.cacheImageDetla).sort((e,t)=>e[1].totalUpdateCount-t[1].totalUpdateCount);for(let t=0;t<e.length;t++){const[i,a]=e[t];t<Math.floor(e.length/2)?(r.hasImage(i)&&(r.removeImage(i),this.imageCount--),delete this.cacheImageDetla[i]):a.totalUpdateCount=1}}return Promise.resolve(null)}_shouldUpdateImage(e,t,i){const r=this.cacheImageDetla[e];return!r||r&&(r.imageSource!==t||JSON.stringify(r.keyObjects)!==JSON.stringify(i))}};function C(e,t,i,r){for(;t.findIndex(e=>i.some(t=>t===e))>-1;){r.index+=1;const a=`calc_${r.index}`,n=t.findIndex(e=>i.some(t=>t===e)),s=e[t[n-1]]||(r.isNum?parseFloat(t[n-1]):t[n-1]),o=e[t[n+1]]||(r.isNum?parseFloat(t[n+1]):t[n+1]);e[a]=[t[n],s,o],r.key=a,r.expression=t.splice(n-1,3,a)}}function j(e,t,i){if(e)return i?["to-number",["get",e]]:["get",e];const r=function(e,t){try{let i=e;const r=i.replace(/\s/g,"").match(/\$feature\.[^+-/*%>=<]+/g);if(!r||0===r.length)return null;const a={},n={index:0,key:null,isNum:t};r.forEach(e=>{n.index+=1;const r=`calc_${n.index}`;n.key=r,a[r]=t?["to-number",["get",e.split(".")[1]]]:["get",e.split(".")[1]],i=i.replace(e,`${r}`)});const s=i.match(/>=|<=|==|\+|-|\*|\/|>|<|=/);s&&s.length>0&&s.forEach(e=>{i=i.replace(e,` ${e} `)});const o=i.split(" ").filter(e=>""!==e);if(C(a,o,["*","/","%"],n),C(a,o,["+","-"],n),C(a,o,["<","<=",">",">="],n),C(a,o,["=="],n),n.key)return a[n.key]}catch(e){}}(t,i);return r||["get","undefined"]}function I(e,t,i,a,n,s){let o="";switch(s=s||{},e.type){case r.SymbolType.simpleLine:e instanceof r.SimpleLineSymbol||(e=new r.SimpleLineSymbol),function(e,t,i,a,n,s){const o=r.Color.fromColor(i.color);e["line-color"]=o.toCssRGBAString(),e["line-opacity"]=n,e["line-width"]=i.width,t["line-cap"]=i.cap,t["line-miter-limit"]=i.miterLimit,t["line-join"]=i.join;const l=g.convertLineStyle(i.style,"butt"===i.cap);l&&(e["line-dasharray"]=l),t.visibility=a?"visible":"none"}(t,i,e,a,n),o="line";break;case r.SymbolType.simpleFill:e instanceof r.SimpleFillSymbol||(e=new r.SimpleFillSymbol),function(e,t,i,a,n,s){const o=r.Color.fromColor(i.color),l=r.Color.fromColor(i.outline.color);if("solid"!==i.style&&i.style){if(!s.imageSourceManager)throw new Error("mapboxgl转换图标符号时,未传入图片资源管理类");e["fill-pattern"]=i.id}else e["fill-color"]=o.toCssRGBAString();e["fill-opacity"]=n,e["fill-outline-color"]=l.toCssRGBAString(),t.visibility=a?"visible":"none"}(t,i,e,a,n,s),o="fill";break;case r.SymbolType.simpleMarker:e instanceof r.SimpleMarkerSymbol||(e=new r.SimpleMarkerSymbol),function(e,t,i,a,n,s){const o=i.xoffset,l=i.yoffset;e["circle-translate"]=[parseFloat(o),parseFloat(l)];const c=r.Color.fromColor(i.color);e["circle-opacity"]=n,e["circle-color"]=c.toCssRGBAString();const h=r.Color.fromColor(i.outline.color);e["circle-stroke-color"]=h.toCssRGBAString(),e["circle-stroke-opacity"]=n,e["circle-stroke-width"]=i.outline.width,e["circle-radius"]=i.size/2,t.visibility=a?"visible":"none"}(t,i,e,a,n),o="circle";break;case r.SymbolType.text:e instanceof r.TextSymbol||(e=new r.TextSymbol),function(e,t,i,a,n,s){const o=r.Color.fromColor(i.color),l=r.Color.fromColor(i.haloColor);switch(e["text-color"]=o.toCssRGBAString(),e["text-opacity"]=n,e["text-halo-color"]=l.toCssRGBAString(),e["text-halo-width"]=i.haloSize,t["text-field"]=i.text||"",t.visibility=a?"visible":"none",t["text-allow-overlap"]=!0,t["text-font"]=[i.font.family],t["text-size"]=i.font.size,t["text-justify"]=i.horizontalAlignment,t["text-letter-spacing"]=i.kerning?.1:0,t["text-rotate"]=i.rotated&&0!==i.angle?i.angle:0,t["text-offset"]=[i.xoffset/i.font.size,-i.yoffset/i.font.size],t["text-line-height"]=i.lineHeight?1.2:0,t["text-max-width"]=Object(r.defaultValue)(i.lineWidth,192)/i.font.size,t["text-anchor"]="center",i.verticalAlignment){case"top":switch(i.horizontalAlignment){case"left":t["text-anchor"]="top-left";break;case"right":t["text-anchor"]="top-right";break;default:t["text-anchor"]="top"}break;case"bottom":switch(i.horizontalAlignment){case"left":t["text-anchor"]="bottom-left";break;case"right":t["text-anchor"]="bottom-right";break;default:t["text-anchor"]="bottom"}break;default:switch(i.horizontalAlignment){case"left":t["text-anchor"]="left";break;case"right":t["text-anchor"]="right";break;default:t["text-anchor"]="center"}}}(t,i,e,a,n),o="symbol";break;case r.SymbolType.pictureMarker:e instanceof r.PictureMarkerSymbol||(e=new r.PictureMarkerSymbol),function(e,t,i,a,n,s){const o=(s=s||{}).imageSourceManager;if(!o)throw new Error("mapboxgl转换图标符号时,未传入图片资源管理类");const l=r.Color.fromColor(i.color);e["icon-color"]=l.toCssRGBAString(),e["icon-opacity"]=n,t["icon-allow-overlap"]=!0,t["icon-rotate"]=i.angle,t["icon-image"]=i.id,t["icon-offset"]=[i.xoffset,i.yoffset],t["icon-size"]=o.getIconScale(i.id,i.width,i.height),t.visibility=a?"visible":"none"}(t,i,e,a,n,s),o="symbol";break;case r.SymbolType.pictureFill:e instanceof r.PictureFillSymbol||(e=new r.PictureFillSymbol),function(e,t,i,a,n,s){if(!(s=s||{}).imageSourceManager)throw new Error("mapboxgl转换图片填充符号时,未传入图片资源管理类");const o=r.Color.fromColor(i.outline.color);e["fill-pattern"]=i.id,e["fill-opacity"]=n,e["fill-translate"]=[i.xoffset,i.yoffset],e["fill-outline-color"]=o.toCssRGBAString(),t.visibility=a?"visible":"none"}(t,i,e,a,n,s),o="fill"}return o}function A(e,t,i,a,n,s){const o=[],l=function(e,t){(t=Object(r.defaultValue)(t,{})).opacity=Object(r.defaultValue)(t.opacity,1);const i=e.clusterInfos,a=e.defaultSymbol,n={"circle-color":["step",["get","point_count"]],"circle-opacity":["step",["get","point_count"]],"circle-radius":["step",["get","point_count"]],"circle-stroke-color":["step",["get","point_count"]],"circle-stroke-opacity":["step",["get","point_count"]],"circle-stroke-width":["step",["get","point_count"]]};for(let e=0;e<i.length;e++){const a=r.Color.fromColor(i[e].symbol.color);n["circle-color"].push(a.toCssRGBAString()),n["circle-color"].push(i[e].maxValue),n["circle-opacity"].push(a.alpha*t.opacity),n["circle-opacity"].push(i[e].maxValue),n["circle-radius"].push(i[e].symbol.size),n["circle-radius"].push(i[e].maxValue);const s=r.Symbol.fromJSON(i[e].symbol.outline);n["circle-stroke-color"].push(s.color.toCssRGBAString()),n["circle-stroke-color"].push(i[e].maxValue),n["circle-stroke-opacity"].push(s.color.alpha*t.opacity),n["circle-stroke-opacity"].push(i[e].maxValue),n["circle-stroke-width"].push(s.width),n["circle-stroke-width"].push(i[e].maxValue)}const s=r.Color.fromColor(a.color);n["circle-color"].push(s.toCssRGBAString()),n["circle-opacity"].push(1),n["circle-radius"].push(a.size);const o=r.Symbol.fromJSON(a.outline);return n["circle-stroke-color"].push(o.color.toCssRGBAString()),n["circle-stroke-opacity"].push(1),n["circle-stroke-width"].push(o.width),n}(t,{opacity:n});o.push({id:`${e}_cluster`,type:"circle",source:e,filter:["has","point_count"],paint:l,layout:{visibility:a?"visible":"none"}});const c=function(e){const t=e.clusterInfos,i=e.defaultLabelSymbol;let a="宋体";for(let e=0;e<t.length;e++){const i=r.Symbol.fromJSON(t[e].labelSymbol);i&&i.font&&i.font.family&&(a=i.font.family)}!a&&i&&i.font&&i.font.family&&(a=i.font.family);const n={"text-field":"{point_count}","text-font":[a,a],"text-size":["step",["get","point_count"]]};for(let e=0;e<t.length;e++){const i=r.Symbol.fromJSON(t[e].labelSymbol);n["text-size"].push(i.font.size),n["text-size"].push(t[e].maxValue)}let s=30;return i&&i.font&&i.font.size&&(s=i.font.size),n["text-size"].push(s),n}(t);c.visibility=a?"visible":"none";const h=function(e,t){(t=Object(r.defaultValue)(t,{})).opacity=Object(r.defaultValue)(t.opacity,1);const i=e.clusterInfos,a={"text-opacity":1};for(let e=0;e<i.length;e++){const n=r.Symbol.fromJSON(i[e].labelSymbol);a["text-opacity"]=n.color.alpha*t.opacity}return a}(t,{opacity:n,visible:a});return o.push({id:`${e}_cluster_count`,type:"symbol",source:e,filter:["has","point_count"],layout:c,paint:h}),t.defaultSymbol&&o.push({id:`${e}_unclustered_point`,type:"circle",source:e,filter:["!",["has","point_count"]],paint:function(e,t){(t=Object(r.defaultValue)(t,{})).opacity=Object(r.defaultValue)(t.opacity,1);const i=e.defaultSymbol,a=r.Color.fromColor(i.color),n=r.Symbol.fromJSON(i.outline),s=r.Color.fromColor(n.color);return{"circle-opacity":a.alpha*t.opacity,"circle-color":a.toCssRGBAString(),"circle-radius":i.size,"circle-stroke-width":n.width,"circle-stroke-color":s.toCssRGBAString(),"circle-stroke-opacity":s.alpha*t.opacity}}(t,{visible:a,opacity:n}),layout:{visibility:a?"visible":"none"}}),o}function z(e,t,i,r,a,n){const s=[];if(!t)return;const o=j(t.field,t.valueExpression);return[{visible:t.defaultVisible,symbol:t.defaultSymbol,value:null}].concat(t.uniqueValueInfos).forEach(i=>{const l=i.visible,c=i.value,h=i.symbol;if(!h)return;const u={},p={},d=I(h,u,p,r&&l,a,n);let y=["==",o,c];if(t.defaultSymbol&&h.id===t.defaultSymbol.id){const e=t.uniqueValueInfos.map(e=>e.value);0===e.length?y=null:(y=["match",o],e.forEach(e=>{y.push(e,!1)}),y.push(!0))}if(d){const t={id:h.id,type:d,paint:u,layout:p,source:e};y&&(t.filter=y),s.push(t)}}),s}function R(e){let t;const{info:i,visible:r,opacity:a,convertSymbolOptions:n,isLast:s,expression:o,renderer:l,classBreakSpace:c,sourceId:h}=e,u=i.visible,p=i.maxValue,d=i.minValue,y=i.symbol;if(!y)return;const m={},f={},g=I(y,m,f,r&&u,a,n);let v;if(v=s?["all",[">=",o,d],["<=",o,p]]:["all",[">=",o,d],["<",o,p]],l.defaultSymbol&&y.id===l.defaultSymbol.id&&(v=0===c.length?null:["any"].concat(c)),g){const e={id:y.id,type:g,paint:m,layout:f,source:h};v&&(e.filter=v),t=e}return t}function D(e,t,i,a,n,s){const o=[];if(!t)return;let l=j(t.field,t.valueExpression,!0);l=function(e,t){let i=e;t=t||{};const{normalizationField:a,normalizationTotal:n,normalizationType:s}=t;switch(s){case r.NormalizationType.field:i=["/",i,["to-number",["get",a]]];break;case r.NormalizationType.log:i=["log10",e];break;case r.NormalizationType.percentOfTotal:i=["*",i,1/n,100]}return i}(l,{normalizationField:t.normalizationField,normalizationTotal:t.normalizationTotal,normalizationType:t.normalizationType});const c=t.classBreakInfos.map(e=>e);let h;c.sort((e,t)=>e.maxValue-t.maxValue);const u=[];c.forEach(e=>{const{minValue:t,maxValue:i}=e;if(t>i)throw new Error("分段专题图分段信息错误,最大值小于最小值");if(void 0===h)h=i;else{if(t<h)throw new Error("分段专题图分段信息错误,相邻分段值重叠");t!==h&&u.push(["all",[">=",l,h],["<",l,t]])}}),0!==c.length&&(u.unshift(["<",l,c[0].minValue]),u.push([">=",l,c[c.length-1].maxValue]));const p=[{visible:t.defaultVisible,symbol:t.defaultSymbol,maxValue:NaN,minValue:NaN}].concat(c);for(let i=0;i<p.length-1;i++){const r=R({info:p[i],visible:a,opacity:n,expression:l,renderer:t,classBreakSpace:u,sourceId:e,convertSymbolOptions:s});r&&o.push(r)}if(p.length>=1){const i=R({info:p[p.length-1],visible:a,opacity:n,expression:l,renderer:t,classBreakSpace:u,sourceId:e,convertSymbolOptions:s,isLast:!0});i&&o.push(i)}return o}function G(e,t,i,a,n,s){if(!(s=s||{}).featureSet)throw new Error("随机专题图要素数据集参数未传入");return z(e,function(e,t){const i=t.features,a=[];for(let e=0;e<i.length;e++){let t;switch(i[e].geometry.type){case r.GeometryType.polygon:case r.GeometryType.multiPolygon:case r.GeometryType.extent:case r.GeometryType.circle:default:t={value:i[e].id,symbol:new r.SimpleFillSymbol({id:i[e].id,color:new r.Color(parseInt(255*Math.random()),parseInt(255*Math.random()),parseInt(255*Math.random()),1)})};break;case r.GeometryType.lineString:case r.GeometryType.multiLineString:t={value:i[e].id,symbol:new r.SimpleLineSymbol({id:i[e].id,color:new r.Color(parseInt(255*Math.random()),parseInt(255*Math.random()),parseInt(255*Math.random()),1),width:3})};break;case r.GeometryType.point:case r.GeometryType.multiPoint:t={value:i[e].id,symbol:new r.SimpleMarkerSymbol({id:i[e].id,color:new r.Color(parseInt(255*Math.random()),parseInt(255*Math.random()),parseInt(255*Math.random()),1)})}}a.push(t)}return new r.UniqueValueRenderer({field:"id",uniqueValueInfos:a})}(0,s.featureSet),0,a,n,s)}function N(e,t,i,a,n,s){let o=[];if(s=s||{},!t||!i)return o;switch(t.type){case r.RendererType.simple:o=function(e,t,i,r,a,n){const s=[];if(!t||!t.symbol)return;const o={},l={},c=I(t.symbol,o,l,r,a,n);return c&&s.push({id:t.symbol.id,type:c,paint:o,layout:l,source:e}),s}(e,t,0,a,n,s);break;case r.RendererType.classBreak:o=D(e,t,0,a,n,s);break;case r.RendererType.uniqueValue:o=z(e,t,0,a,n,s);break;case r.RendererType.rank:o=function(e,t,i,a,n,s){const o=[];if(!t||!t.symbol)return;const l=s.imageSourceManager;if(!l)throw new Error("mapboxgl转换图片填充符号时,未传入图片资源管理类");const c={},h={},u=t.symbol,p=I(u,c,h,a,n,s);if(p){const i={id:u.id,type:p,paint:c,layout:h,source:e},{minSize:a,maxSize:n,maxDataValue:s,minDataValue:d,field:y,valueExpression:m}=t;if(void 0===s||void 0===d)throw new Error("mapboxgl上等级符号渲染器必须设置maxDataValue,minDataValue最大最小数据值");const f=j(y,m,!0);switch(u.type){case r.SymbolType.pictureMarker:i.layout["icon-size"]=["interpolate",["linear"],f,d,l.getIconScale(u.id,a,a),s,l.getIconScale(u.id,n,n)];break;case r.SymbolType.text:i.layout["text-size"]=["interpolate",["linear"],f,d,a,s,n];break;case r.SymbolType.simpleMarker:i.paint["circle-radius"]=["interpolate",["linear"],f,d,a/2,s,n/2]}o.push(i)}return o}(e,t,0,a,n,s);break;case r.RendererType.random:o=G(e,0,0,a,n,s);break;case r.RendererType.cluster:o=A(e,t,0,a,n);break;default:r.Log.error("未定义的Renderer类型")}return o}function F(e,t){const i=e.map(e=>{if(e){if(e.type===r.SymbolType.pictureFill){const i=Math.max(e.xscale,e.yscale),r=Math.max(e.width,e.height);return t.updateImage(e.id,e.url,{pfsSize:r,pfsScale:i})}if(e.type===r.SymbolType.pictureMarker)return t.updateImage(e.id,e.url);if(e.type===r.SymbolType.simpleFill&&"solid"!==e.style){const i=Object(r.createSimpleFillSymbolCanvas)(e,{lineWidth:1}).toDataURL(),a=e.color;return t.updateImage(e.id,i,{pattern:e.style,color:a.toCssRGBAString()})}return null}}).filter(e=>e);return Object(r.allSettled)(i)}var B=class{constructor(e){e=Object(r.defaultValue)(e,{}),this.id=e.id,this.sourceId=e.sourceId,this.featureCollection=e.featureCollection,this.layerId=e.layerId,this.renderType=e.renderType,this.mapboxglStyleType=e.mapboxglStyleType,this.highPerformanceLayer=e.highPerformanceLayer,this._sourceDirty=!0,this._styleLayerDirty=!0}setDirty(e){this._sourceDirty=e,this._styleLayerDirty=e}getDirty(){return this._sourceDirty||this._styleLayerDirty}setSourceDirty(e){this._sourceDirty=e}getSourceDirty(){return this._sourceDirty}setStyleLayerDirty(e){this._styleLayerDirty=e}getStyleLayerDirty(){return this._styleLayerDirty}};function U(e,t,i,r){r=r||{},t[e.sourceId]={type:"geojson",data:{type:"FeatureCollection",features:[]}},i.push({id:e.layerId,source:e.sourceId,type:e.mapboxglStyleType})}var Z=class{constructor(e){e=Object(r.defaultValue)(e,{}),this.id=e.id||Object(r.getGUID)(),this._opacity=Object(r.defaultValue)(e.opacity,1),this._visible=Object(r.defaultValue)(e.visible,!0),this.highPerformance=Object(r.defaultValue)(e.highPerformance,!1),this._isLoaded=!1,this.metaIds=["fill","line","circle","text","icon","fill-picture"],this._sourceMetaDatas={},this.metaIds.forEach(e=>{this._sourceMetaDatas[e]=this._createSourceMetaData(this.id,e,e,!0)})}_createSourceMetaData(e,t,i,r){const a={};a.sourceId=`${e}_${t}`,a.featureCollection=[],a.layerId=`${e}_${t}_layer`,a.renderType=i,a.id=t,a.highPerformanceLayer=r;let n=i;return"text"!==n&&"icon"!==n||(n="symbol"),"fill-picture"===n&&(n="fill"),a.mapboxglStyleType=n,new B(a)}onAdd(e){if(!e)return;this._map=e;const t=this;return this._imageSourceManager=new E(e),new Promise(i=>{let r;const a=()=>{t._isLoaded||(ne(t._getSourcesAndLayers(),e),t._isLoaded=!0,t._refreshSourceAndLayers()),i(this),r&&clearInterval(r)};e.loaded()?a():(e.once("load",a),r=setInterval(()=>{e.loaded()&&a()},16))})}_getSourcesAndLayers(){const e={},t=[];return this.metaIds.forEach(i=>{U(this._sourceMetaDatas[i],e,t)}),{sources:e,layers:t}}onRemove(e){e&&this._isLoaded&&this.metaIds.forEach(t=>{const i=this._sourceMetaDatas[t];e.style.getLayer(i.layerId)&&e.removeLayer(i.layerId),e.getSource(i.sourceId)&&e.removeSource(i.sourceId)})}getStyleLayerIds(){const e=[];return this.metaIds.forEach(t=>{const i=this._sourceMetaDatas[t];e.push(i.layerId)}),e}add(e){this._map&&this._isLoaded&&F((Array.isArray(e)?e:[e]).map(e=>e.symbol),this._imageSourceManager).then(()=>{Array.isArray(e)?e.forEach(e=>{this._updateGraphicToCollection(e)}):this._updateGraphicToCollection(e),this._refreshSourceAndLayers()})}update(e,t){if(!this._map||!this._isLoaded)return;if(!e)return;const i=Array.isArray(e)?e:[e];F(i.map(e=>e.symbol),this._imageSourceManager).then(()=>{for(let e=0;e<i.length;e++){const r=i[e],a=t[e]||{},n=this._updateGraphicToCollection(r);n&&(a.geometryUpdated&&n.setSourceDirty(!0),(a.symbolUpdated||a.visibleUpdated)&&n.setStyleLayerDirty(!0))}this._refreshSourceAndLayers()})}_removeGraphicsToCollection(e){const t=Object.values(this._sourceMetaDatas);for(let i=0;i<t.length;i++){const r=t[i],{featureCollection:a}=r,n=[];for(let t=0;t<a.length;t++){const i=a[t];e.indexOf(i)>-1&&n.push(t)}n.length>0&&(r.featureCollection=a.filter((e,t)=>-1===n.indexOf(t)),r.setSourceDirty(!0))}}_updateGraphicToCollection(e){let t;if(e&&e instanceof r.Feature){if(e.geometry&&e.symbol){if(!this.highPerformance){const i=this._getRenderTypeBySymbol(e.symbol);if(this._sourceMetaDatas[e.id]){(t=this._sourceMetaDatas[e.id]).isRefreshStyleLayer=t.renderType!==i,"fill-picture"===t.renderType&&"fill-picture"===i&&this._map.getLayer(t.layerId).getPaintProperty("fill-pattern")!==e.symbol.id&&(t.isRefreshStyleLayer=!0);const r=this._createSourceMetaData(this.id,e.id,i,!1);t.renderType=r.renderType,t.mapboxglStyleType=r.mapboxglStyleType}else{(t=this._createSourceMetaData(this.id,e.id,i,!1)).featureCollection.push(e),this._sourceMetaDatas[e.id]=t;const r={};U(t,r,[]);const a=Object.entries(r);for(let e=0;e<a.length;e++){const t=a[e];this._map.addSource(t[0],t[1])}this.metaIds.unshift(e.id)}return t}switch(e.geometry.type){case r.GeometryType.multiPoint:case r.GeometryType.point:t=this._dividePointGraphic(e);break;case r.GeometryType.multiLineString:case r.GeometryType.lineString:t=this._dividePolylineGraphic(e);break;case r.GeometryType.extent:case r.GeometryType.circle:case r.GeometryType.multiPolygon:case r.GeometryType.polygon:t=this._dividePolygonGraphic(e)}return t}r.Log.warning("要素几何信息缺失,无法绘制要素:",e)}}remove(e){this._map&&this._isLoaded&&e&&(Array.isArray(e)?this._removeGraphicsToCollection(e):this._removeGraphicsToCollection([e]),this._removeSourceMetaData(this._map,this._sourceMetaDatas[e.id]),this._refreshSourceAndLayers())}removeAll(){if(!this._map||!this._isLoaded)return;const e=Object.values(this._sourceMetaDatas);for(let t=0;t<e.length;t++){const i=e[t];i.featureCollection=[],i.setDirty(!0),this._removeSourceMetaData(this._map,i)}this._refreshSourceAndLayers()}_removeSourceMetaData(e,t){if(!this.highPerformance&&t&&!t.highPerformanceLayer){e.style.getLayer(t.layerId)&&e.removeLayer(t.layerId),delete this._sourceMetaDatas[t.id],e.getSource(t.sourceId)&&e.removeSource(t.sourceId);const i=this.metaIds.indexOf(t.id);i>-1&&this.metaIds.splice(i,1)}}_refreshSourceAndLayers(){const e=Object.keys(this._sourceMetaDatas);if(!e.some(e=>this._sourceMetaDatas[e].getDirty()))return!1;if(!this._map)return!1;const t=this._map;return e.forEach(e=>{const i=this._sourceMetaDatas[e];if(i.getStyleLayerDirty()&&(this.setSourceMetaDataStyle(i,!0),i.setStyleLayerDirty(!1)),i.getSourceDirty()){const{sourceId:e,featureCollection:r}=i;t.getSource(e).setData({type:"FeatureCollection",features:r.map(function(e){return g.convertToGeoJSON(e)})}),i.setSourceDirty(!1)}}),t._update(!0),!0}setSourceMetaDataStyle(e,t){const i={},r={},a={},{renderType:n}=e,s=this._map,o=this;i.type=e.mapboxglStyleType,i.id=e.layerId,i.paint=r,i.layout=a,i.source=e.sourceId;const l=function(){const t=s.style,i=e.layerId;o._updateStyleLayers(t,i,r,a)};if(this.highPerformance){switch(n){case"circle":this._setCircleStyle(e,r,a);break;case"line":this._setLineStyle(e,r,a);break;case"fill":this._setFillStyle(e,r,a);break;case"text":this._setTextStyle(e,r,a);break;case"icon":this._setIconStyle(e,r,a);break;case"fill-picture":this._setFillPictureStyle(e,r,a)}l()}else if(Array.isArray(e.featureCollection)&&e.featureCollection.length>0){const t=e.featureCollection[0];I(t.symbol,r,a,this._visible&&t.visible,this._opacity,{imageSourceManager:this._imageSourceManager});let n=!1,o=`${this.id}_fill_layer`;if(s.style.hasLayer(e.layerId)){if(e.isRefreshStyleLayer){const t=this._map.style._order,i=t.indexOf(e.layerId);i>-1&&t.length>i+1&&(o=t[i+1]),s.removeLayer(e.layerId),e.isRefreshStyleLayer=!1,n=!0}}else n=!0;n?s.addLayer(i,o):l()}return i}_updateStyleLayers(e,t,i,r){const a=Object.entries(i),n=Object.entries(r);for(let i=0;i<a.length;i++)e.setPaintProperty(t,a[i][0],a[i][1]);for(let i=0;i<n.length;i++)e.setLayoutProperty(t,n[i][0],n[i][1])}_setCircleStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._opacity,o=this._visible,l={"circle-color":{values:[],def:"#000000"},"circle-opacity":{values:[],def:1},"circle-stroke-color":{values:[],def:"#000000"},"circle-stroke-opacity":{values:[],def:1},"circle-stroke-width":{values:[],def:0},"circle-radius":{values:[],def:5}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.SimpleMarkerSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.SimpleMarkerSymbol({id:i.id}));const a=g.applyVisibleAndOpacityToColor(i.color,o&&e.visible,s);l["circle-color"].values.push(t,a.toCssRGBString()),l["circle-opacity"].values.push(t,a.alpha);const n=g.applyVisibleAndOpacityToColor(i.outline.color,o&&e.visible,s);l["circle-stroke-color"].values.push(t,n.toCssRGBString()),l["circle-stroke-opacity"].values.push(t,n.alpha),l["circle-stroke-width"].values.push(t,i.outline.width),l["circle-radius"].values.push(t,i.size/2)}),this._setLayoutAndPaintCaches(a,l,{},t,i)}_setLineStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._opacity,o=this._visible,l={"line-color":{values:[],def:"#000000"},"line-width":{values:[],def:1},"line-opacity":{values:[],def:1}},c={"line-join":{values:[],def:"round"}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.SimpleLineSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.SimpleLineSymbol({id:i.id}));const a=g.applyVisibleAndOpacityToColor(i.color,o&&e.visible,s);l["line-color"].values.push(t,a.toCssRGBString()),l["line-opacity"].values.push(t,a.alpha),l["line-width"].values.push(t,i.width),c["line-join"].values.push(t,i.join)}),this._setLayoutAndPaintCaches(a,l,c,t,i)}_setFillStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._opacity,o=this._visible,l={"fill-color":{values:[],def:"#ffffff"},"fill-opacity":{values:[],def:.25},"fill-outline-color":{values:[],def:"#000000"}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.SimpleFillSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.SimpleFillSymbol({id:i.id}));const a=g.applyVisibleAndOpacityToColor(i.color,o&&e.visible,s),n=g.applyVisibleAndOpacityToColor(i.outline.color,o&&e.visible,s);l["fill-color"].values.push(t,a.toCssRGBString()),l["fill-opacity"].values.push(t,a.alpha),l["fill-outline-color"].values.push(t,n.toCssRGBAString())}),this._setLayoutAndPaintCaches(a,l,{},t,i)}_setTextStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._opacity,o=this._visible,l={"text-color":{values:[],def:"#000000"},"text-opacity":{values:[],def:1},"text-halo-color":{values:[],def:"#000000"},"text-halo-width":{values:[],def:0}},c={"text-field":{values:[],def:""},"text-size":{values:[],def:12},"text-justify":{values:[],def:"center"},"text-letter-spacing":{values:[],def:0},"text-rotate":{values:[],def:0}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.TextSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.TextSymbol({id:i.id}));const a=g.applyVisibleAndOpacityToColor(i.color,o&&e.visible,s),n=g.applyVisibleAndOpacityToColor(i.haloColor,o&&e.visible,s);l["text-color"].values.push(t,a.toCssRGBString()),l["text-opacity"].values.push(t,a.alpha),l["text-halo-color"].values.push(t,n.toCssRGBAString()),l["text-halo-width"].values.push(t,i.haloSize),c["text-field"].values.push(t,i.text),c["text-allow-overlap"]=!1,c["text-font"]=[i.font.family,"微软雅黑"],c["text-size"].values.push(t,i.font.size),c["text-justify"].values.push(t,i.horizontalAlignment),c["text-letter-spacing"].values.push(t,i.kerning?.1:0),c["text-rotate"].values.push(t,i.rotated&&0!==i.angle?i.angle:0)}),this._setLayoutAndPaintCaches(a,l,c,t,i,["text-allow-overlap","text-font"])}_setIconStyle(e,t,i){const a=this._imageSourceManager,{layerId:n,featureCollection:s}=e,o=this._opacity,l=this._visible,c={"icon-color":{values:[],def:"#000000"},"icon-opacity":{values:[],def:1}},h={"icon-size":{values:[],def:.001},"icon-rotate":{values:[],def:0},"icon-image":{values:[],def:"marker-15"}},u=[];s.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.PictureMarkerSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.PictureMarkerSymbol({id:i.id}));const n=g.applyVisibleAndOpacityToColor(i.color,l&&e.visible,o);c["icon-color"].values.push(t,n.toCssRGBString()),c["icon-opacity"].values.push(t,n.alpha),h["icon-allow-overlap"]=!1;const s=i.id;h["icon-size"].values.push(t,a.getIconScale(s,i.width,i.height)),h["icon-image"].values.push(t,s),h["icon-rotate"].values.push(t,i.angle),u.push({url:i.url,id:i.id,featureId:t,width:i.width,height:i.height})}),this._setLayoutAndPaintCaches(n,c,h,t,i,["icon-allow-overlap"]),u.forEach(t=>{a.updateImage(t.id,t.url).then(i=>{if(!i)return;const r=a.innerView,n=r.getLayer(e.layerId);if(!n)return;const s=n.getLayoutProperty("icon-size"),o=s.indexOf(t.featureId);o<=-1||o+1>=s.length||(s[o+1]=a.getIconScale(t.id,t.width,t.height),r.setLayoutProperty(e.layerId,"icon-size",s))})})}_setFillPictureStyle(e,t,i){const{layerId:a,featureCollection:n}=e,s=this._imageSourceManager,o=this._opacity,l=this._visible,c={"fill-opacity":{values:[],def:.25},"fill-pattern":{values:[],def:""},"fill-outline-color":{values:[],def:"#000000"}};n.forEach(e=>{const{id:t}=e;let i=e.symbol;i instanceof r.PictureFillSymbol||i instanceof r.SimpleFillSymbol||(r.Log.info(`不支持类型为${i.type}的符号!`),i=new r.PictureFillSymbol({id:i.id}));const a=i.type===r.SymbolType.pictureFill,n=g.applyVisibleAndOpacityToColor(i.color,l&&e.visible,o),h=g.applyVisibleAndOpacityToColor(i.outline.color,l&&e.visible,o);if(c["fill-opacity"].values.push(t,n.alpha),c["fill-outline-color"].values.push(t,h.toCssRGBAString()),c["fill-pattern"].values.push(t,i.id),a){const e=Math.max(i.xscale,i.yscale),t=Math.max(i.width,i.height);s.updateImage(i.id,i.url,{pfsSize:t,pfsScale:e})}else{const e=Object(r.createSimpleFillSymbolCanvas)(i,{lineWidth:1}).toDataURL();s.updateImage(i.id,e,{pattern:i.style,color:n.toCssRGBAString()})}}),this._setLayoutAndPaintCaches(a,c,{},t,i)}_setLayoutAndPaintCaches(e,t,i,r,a,n){n||(n=[]);for(const e in t)if(n.findIndex(t=>t===e)>-1)r[e]=t[e];else if(t[e].values.length>0){let i=[];i.push("match"),i.push(["get","id"]),(i=i.concat(t[e].values)).push(t[e].def),r[e]=i}else r[e]=t[e].def;for(const e in i)if(n.findIndex(t=>t===e)>-1)a[e]=i[e];else if(i[e].values.length>0){let t=[];t.push("match"),t.push(["get","id"]),(t=t.concat(i[e].values)).push(i[e].def),a[e]=t}else a[e]=i[e].def}_dividePointGraphic(e){const{symbol:t}=e;let i=!1,a=this._sourceMetaDatas.circle;switch(t.type){case r.SymbolType.simpleMarker:i=this._replaceSourceLayer(e,"circle"),a=this._sourceMetaDatas.circle;break;case r.SymbolType.text:i=this._replaceSourceLayer(e,"text"),a=this._sourceMetaDatas.text;break;case r.SymbolType.pictureMarker:i=this._replaceSourceLayer(e,"icon"),a=this._sourceMetaDatas.icon}if(!i){const{featureCollection:t}=a;t.push(e),a.setDirty(!0)}return a}_replaceSourceLayer(e,t){const i=this.metaIds,r=this._hasGraphicInCollection(i,e);if(r){if(r.renderType===t)return!0;this._removeGraphicsToCollection([e])}return!1}_dividePolylineGraphic(e){const t=this._hasGraphicInCollection(["line"],e),i=this._sourceMetaDatas.line;if(!t){const{featureCollection:t}=i;t.push(e),i.setDirty(!0)}return i}_dividePolygonGraphic(e){let t=!1;const{symbol:i}=e;let a=this._sourceMetaDatas.fill,n=i.type;switch(n===r.SymbolType.simpleFill&&"solid"!==i.style&&(n=r.SymbolType.pictureFill),n){case r.SymbolType.simpleMarker:t=this._replaceSourceLayer(e,"circle"),a=this._sourceMetaDatas.circle;break;case r.SymbolType.text:t=this._replaceSourceLayer(e,"text"),a=this._sourceMetaDatas.text;break;case r.SymbolType.pictureMarker:t=this._replaceSourceLayer(e,"icon"),a=this._sourceMetaDatas.icon;break;case r.SymbolType.pictureFill:t=this._replaceSourceLayer(e,"fill-picture"),a=this._sourceMetaDatas["fill-picture"];break;case r.SymbolType.simpleFill:t=this._replaceSourceLayer(e,"fill"),a=this._sourceMetaDatas.fill}if(!t){const{featureCollection:t}=a;t.push(e),a.setDirty(!0)}return a}_hasGraphicInCollection(e,t){const i=Array.isArray(e)?e:[e];let r;for(let e=0;e<i.length;e++){const a=this._sourceMetaDatas[i[e]];if(!a)break;const{featureCollection:n}=a;if(n.indexOf(t)>-1){r=a;break}}return r}set opacity(e){this._opacity!==e&&(this._opacity=e,this._updatePaintAndLayoutStyles())}get opacity(){return this._opacity}set visible(e){this._visible!==e&&(this._visible=e,this._updatePaintAndLayoutStyles())}get visible(){return this._visible}_updatePaintAndLayoutStyles(){const e=Object.values(this._sourceMetaDatas);for(let t=0;t<e.length;t++)e[t].setStyleLayerDirty(!0);this._refreshSourceAndLayers()}_getBottomLayer(){return this._sourceMetaDatas[this.metaIds[0]]}_getRenderTypeBySymbol(e){let t="circle";switch(e.type){case r.SymbolType.simpleMarker:t="circle";break;case r.SymbolType.simpleLine:t="line";break;case r.SymbolType.simpleFill:t="fill","solid"!==e.style&&(t="fill-picture");break;case r.SymbolType.text:t="text";break;case r.SymbolType.pictureMarker:t="icon";break;case r.SymbolType.pictureFill:t="fill-picture"}return t}};function $(e,t){const i=(t=t||{}).featureSet,a=t.mapboxglMap;if(!i||!a)throw new Error("featureSet或mapboxglMap对象缺失");const n=e.renderer,s={type:"geojson",data:i.toGeoJSON()};n instanceof r.ClusterRenderer&&(s.cluster=!0,s.clusterRadius=n.radius),$.imageSourceManager||($.imageSourceManager=new E(a));const o={};o[e.id]=s;const l={featureSet:i,imageSourceManager:$.imageSourceManager,updateState:null},c=e.opacity,h=e.visible;return{sources:o,layers:N(e.id,n,e.geometryType,h,c,l)}}function q(e,t){const i=(t=t||{}).mapboxglMap;if(!i)throw new Error("featureSet或mapboxglMap对象缺失");q.imageSourceManager||(q.imageSourceManager=new E(i));const r=new Z({id:e.id,opacity:e.opacity,visible:e.visible});r._imageSourceManager=q.imageSourceManager,e.graphics.forEach(e=>{r._updateGraphicToCollection(e)});const a={},n=[];return Object.entries(r._sourceMetaDatas).forEach(e=>{const t=e[1],{featureCollection:i,sourceId:s}=t;if(i.length<=0)return;a[s]={type:"geojson",data:{type:"FeatureCollection",features:i.map(function(e){return g.convertToGeoJSON(e)})}};const o=r.setSourceMetaDataStyle(t,!1);n.push(o)}),{layers:n,sources:a}}const K=window.mapv||{},{baiduMapLayer:W,DataSet:J}=K,X=W?W.__proto__:Function;var Y=class extends X{constructor(e,t,i,r){super(e,t,i),X&&(this.map=e,this.dataSet=t,i=i||{},this.init(i),this.argCheck(i),this.initDevicePixelRatio(),this.canvasLayer=r,this.stopAniamation=!1,this.animation=i.animation,this.mousemoveEvent=this.mousemoveEvent.bind(this),this.bindEvent())}initDevicePixelRatio(){this.devicePixelRatio=window.devicePixelRatio||1}clickEvent(e){const t=e.point;super.clickEvent(t,e)}mousemoveEvent(e){const t=e.point;super.mousemoveEvent(t,e)}addAnimatorEvent(){}animatorMovestartEvent(){const e=this.options.animation;this.isEnabledTime()&&this.animator&&(this.steps.step=e.stepsRange.start)}animatorMoveendEvent(){this.isEnabledTime()&&this.animator}bindEvent(){const e=this.map;this.options.methods&&(this.options.methods.click&&e.on("click",this.clickEvent),this.options.methods.mousemove&&e.on("mousemove",this.mousemoveEvent))}unbindEvent(){const e=this.map;this.options.methods&&(this.options.methods.click&&e.off("click",this.clickEvent),this.options.methods.mousemove&&e.off("mousemove",this.mousemoveEvent))}getContext(){return this.canvasLayer.canvas.getContext(this.context)}init(e){const t=this;t.options=e,this.initDataRange(e),this.context=t.options.context||"2d",t.options.zIndex&&this.canvasLayer&&this.canvasLayer.setZIndex(t.options.zIndex),this.initAnimator()}_canvasUpdate(e){const t=this.map;if(!this.canvasLayer||this.stopAniamation||this.canvasLayer.disposeFlag)return;const i=this,r=i.options.animation,a=this.getContext();if(i.isEnabledTime()){if(void 0===e)return void this.clear(a);"2d"===this.context&&(a.save(),a.globalCompositeOperation="destination-out",a.fillStyle="rgba(0, 0, 0, .1)",a.fillRect(0,0,a.canvas.width,a.canvas.height),a.restore())}else this.clear(a);if("2d"===this.context)for(const e in i.options)a[e]=i.options[e];else a.clear(a.COLOR_BUFFER_BIT);if(i.options.minZoom&&t.getZoom()<i.options.minZoom||i.options.maxZoom&&t.getZoom()>i.options.maxZoom)return;const s={transferCoordinate(e){const i=t.project(new n.a.LngLat(e[0],e[1]));return[i.x,i.y]}};void 0!==e&&(s.filter=function(t){const i=r.trails||10;return!!(e&&t.time>e-i&&t.time<e)});const o=i.dataSet.get(s);this.processData(o),"m"==i.options.unit&&i.options.size,i.options._size=i.options.size;const l=t.project(new n.a.LngLat(0,0));this.drawContext(a,new J(o),i.options,l),i.options.updateCallback&&i.options.updateCallback(e)}updateData(e,t){let i=e;i&&i.get&&(i=i.get()),void 0!=i&&this.dataSet.set(i),super.update({options:t})}addData(e,t){let i=e;e&&e.get&&(i=e.get()),this.dataSet.add(i),this.update({options:t})}getData(){return this.dataSet}removeData(e){if(!this.dataSet)return;const t=this.dataSet.get({filter:t=>null==e||"function"!=typeof e||!e(t)});this.dataSet.set(t),this.update({options:null})}clearData(){this.dataSet&&this.dataSet.clear(),this.update({options:null})}draw(){this.canvasLayer.draw()}clear(e){e&&e.clearRect&&e.clearRect(0,0,e.canvas.width,e.canvas.height)}};var H=class{constructor(e,t,i){i=i||{},this.map=e,this.layerID=i.layerID,delete i.layerID,this.mapvBaseLayer=new Y(e,t,i,this),this.mapVOptions=i,this.initDevicePixelRatio(),this.canvas=this._createCanvas(),this.render=this.render.bind(this),this.bindEvent(),this.mapContainer=e.getCanvasContainer(),this.mapContainer.appendChild(this.canvas),this._reset()}initDevicePixelRatio(){this.devicePixelRatio=window.devicePixelRatio||1}bindEvent(){const e=this.map;this.innerMoveStart=this.moveStartEvent.bind(this),this.innerMoveEnd=this.moveEndEvent.bind(this),this.innnerZoomStart=this.zoomStartEvent.bind(this),this.innnerZoomEnd=this.zoomEndEvent.bind(this),this.innnerRotateStart=this.rotateStartEvent.bind(this),this.innnerRotateEnd=this.rotateEndEvent.bind(this),this.innerResize=this.resizeEvent.bind(this),this.innerRemove=this.removeEvent.bind(this),e.on("resize",this.innerResize),e.on("zoomstart",this.innnerZoomStart),e.on("zoomend",this.innnerZoomEnd),e.on("rotatestart",this.innnerRotateStart),e.on("rotateend",this.innnerRotateEnd),e.on("movestart",this.innerMoveStart),e.on("moveend",this.innerMoveEnd),this.map.on("remove",this.innerRemove)}unbindEvent(){const e=this.map;e.off("resize",this.innerResize),e.off("zoomstart",this.innnerZoomStart),e.off("zoomend",this.innnerZoomEnd),e.off("rotatestart",this.innnerRotateStart),e.off("rotateend",this.innnerRotateEnd),e.off("movestart",this.innerMoveStart),e.off("moveend",this.innerMoveEnd)}moveStartEvent(){this.mapvBaseLayer.animatorMovestartEvent(),this._unvisiable()}moveEndEvent(){this.mapvBaseLayer.animatorMoveendEvent(),this._reset(),this._visiable()}zoomStartEvent(){this._unvisiable()}zoomEndEvent(){this._unvisiable()}rotateStartEvent(){this.mapvBaseLayer.animatorMovestartEvent(),this._unvisiable()}rotateEndEvent(){this.mapvBaseLayer.animatorMoveendEvent(),this._reset(),this._visiable()}resizeEvent(){this._reset(),this._visiable()}removeEvent(){this.mapContainer.removeChild(this.canvas)}addData(e,t){this.mapvBaseLayer.addData(e,t)}updateData(e,t){this.mapvBaseLayer.updateData(e,t)}getData(){return this.mapvBaseLayer&&(this.dataSet=this.mapvBaseLayer.getData()),this.dataSet}removeData(e){this.mapvBaseLayer&&this.mapvBaseLayer.removeData(e)}removeAllData(){this.mapvBaseLayer.clearData()}_visiable(){return this.canvas.style.display="block",this}_unvisiable(){return this.canvas.style.display="none",this}_createCanvas(){const e=document.createElement("canvas"),t=this.devicePixelRatio;return e.id=this.layerID,e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.width=parseInt(this.map.getCanvas().style.width)*t,e.height=parseInt(this.map.getCanvas().style.height)*t,this.mapVOptions.context&&"2d"!=this.mapVOptions.context||e.getContext("2d").scale(t,t),e.style.width=this.map.getCanvas().style.width,e.style.height=this.map.getCanvas().style.height,e}_reset(){null!=this.canvas&&(this.resizeCanvas(),this.fixPosition(),this.onResize(),this.render())}draw(){return this._reset()}show(){this._visiable()}hide(){this._unvisiable()}update(e){void 0!=e&&this.updateData(e.data,e.options)}resizeCanvas(){if(this.mapContainer.style.perspective=`${this.map.transform.cameraToCenterDistance}px`,void 0==this.canvas||null==this.canvas)return;const e=this.canvas,t=this.devicePixelRatio;e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.width=parseInt(this.map.getCanvas().style.width)*t,e.height=parseInt(this.map.getCanvas().style.height)*t,this.mapVOptions.context&&"2d"!=this.mapVOptions.context||e.getContext("2d").scale(t,t)}fixPosition(){}onResize(){}originPosition(){this.originPitch=this.map.getPitch(),this.originBearing=this.map.getBearing();const e=this.map.project(new n.a.LngLat(0,0));this.originX=e.x,this.originY=e.y}render(){void 0!=this.mapvBaseLayer&&this.mapvBaseLayer._canvasUpdate()}moveTo(e,t){const i=document.getElementById(this.layerID);if(t=void 0===t||t){const t=document.getElementById(e);return void(i&&t&&t.parentNode.insertBefore(i,t))}const r=document.getElementById(e);if(i){if(r.nextSibling)return void r.parentNode.insertBefore(i,r.nextSibling);r.parentNode.appendChild(i)}}remove(){this.removeAllData(),this.unbindEvent(),this.mapContainer.removeChild(this.canvas),this.disposeFlag=!0}destroy(){this.removeAllData(),this.unbindEvent(),this.mapContainer.removeChild(this.canvas),this.disposeFlag=!0}};const Q=window.echarts;function ee(e,t){this._MapboxGLMap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}ee.prototype.dimensions=["lng","lat"],ee.prototype.setMapOffset=function(e){this._mapOffset=e},ee.prototype.getBMap=function(){return this._MapboxGLMap},ee.prototype.dataToPoint=function(e){const t=this._MapboxGLMap.project(e),i=this._mapOffset;return[t.x-i[0],t.y-i[1]]},ee.prototype.pointToData=function(e){const t=this._mapOffset;return[(e=this._MapboxGLMap.project([e[0]+t[0],e[1]+t[1]])).lng,e.lat]},ee.prototype.getViewRect=function(){const e=this._api;return new Q.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},ee.prototype.getRoamTransform=function(){return Q.matrix.create()},ee.prototype.prepareCustoms=function(e){const t=Q.util,i=this.getViewRect();return{coordSys:{type:"mapboxgl",x:i.x,y:i.y,width:i.width,height:i.height},api:{coord:t.bind(this.dataToPoint,this),size:t.bind(function(e,i){return i=i||[0,0],t.map([0,1],function(t){const r=i[t],a=e[t]/2,n=[],s=[];return n[t]=r-a,s[t]=r+a,n[1-t]=s[1-t]=i[1-t],Math.abs(this.dataToPoint(n)[t]-this.dataToPoint(s)[t])},this)},this)}}},ee.dimensions=ee.prototype.dimensions,ee.create=function(e,t){let i;e.eachComponent("mapboxgl",function(e){t.getZr().painter.getViewportRoot();const r=Q.mapboxglMap;(i=new ee(r,t)).setMapOffset(e.__mapOffset||[0,0]),e.coordinateSystem=i}),e.eachSeries(function(e){"mapboxgl"===e.get("coordinateSystem")&&(e.coordinateSystem=i)})};var te=ee;const ie=window.echarts;var re=class{constructor(e,t){return t=t||{},this.map=e,this.options=t,this.layerId=t.layerId||"echartlayerdefaultid",this.layerClass=t.classId||"echartlayerdefaultclass",this.initDevicePixelRatio(),this.mapContainer=e.getCanvasContainer(),this.canvas=this._createCanvas(),this.mapContainer.appendChild(this.canvas),this.mapContainer.style.perspective=`${this.map.transform.cameraToCenterDistance}px`,this.chart=ie.init(this.canvas),this.visible=!0,this.initEcharts(),this._resizeCanvas(),this}initDevicePixelRatio(){this.devicePixelRatio=window.devicePixelRatio||1}initEcharts(){return ie.mapboxglMap=this.map,ie.registerCoordinateSystem("mapboxgl",te),ie.extendComponentModel({type:"mapboxgl",getBMap(){return this.__mapboxgl},defaultOption:{roam:!1}}),ie.registerAction({type:"MapboxGLRoma",event:"MapboxGLRoma",update:"updateLayout"},function(e,t){}),this}_createCanvas(){const e=document.createElement("div");return e.id=this.layerId,e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.width=parseInt(this.map.getCanvas().style.width),e.height=parseInt(this.map.getCanvas().style.height),e.style.width=this.map.getCanvas().style.width,e.style.height=this.map.getCanvas().style.height,e.setAttribute("id",this.layerId),e.setAttribute("class",this.layerClass),e}_resizeCanvas(){const e=this;window.onresize=function(){const t=e.canvas,i=e.map;t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.width=i.getCanvas().style.width,t.style.height=i.getCanvas().style.height,t.width=parseInt(i.getCanvas().style.width),t.height=parseInt(i.getCanvas().style.height),e.chart.resize()}}addTo(e){const t=this;return ie.extendComponentView({type:"mapboxgl",render(e,i,r){let a=!0;const n=ie.mapboxglMap,s=r.getZr().painter.getViewportRoot(),o=e.coordinateSystem,l=function(i,n){if(a||!t.visible)return;const l=document.getElementsByClassName("mapboxgl-map")[0],c=[-parseInt(l.style.left,10)||0,-parseInt(l.style.top,10)||0];s.style.left=`${c[0]}px`,s.style.top=`${c[1]}px`,o.setMapOffset(c),e.__mapOffset=c,r.dispatchAction({type:"MapboxGLRoma"})};function c(){!a&&t.visible&&r.dispatchAction({type:"MapboxGLRoma"})}n.off("move",this._oldMoveHandler),n.off("zoomend",this._oldZoomEndHandler),n.on("move",l),n.on("zoomend",c),this._oldMoveHandler=l,this._oldZoomEndHandler=c,e.get("roam"),a=!1}}),this.chart.setOption(this.options),this}_visible(){this.visible=!0,this.canvas.style.visibility="visible"}_unvisible(){this.visible=!1,this.canvas.style.visibility="hidden"}show(){this._visible()}hide(){this._unvisible()}remove(){const e=this;return this.map._listeners.move.forEach(function(t){"moveHandler"===t.name&&e.map.off("move",t)}),this.map._listeners.move.forEach(function(t){"zoomEndHandler"===t.name&&e.map.off("zoomend",t)}),this.chart.clear(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.map=void 0,this}update(e){this.chart.setOption(e)}};function ae(e,t){t=t||{};let i={sources:{},layers:[]};switch(e.type){case r.LayerType.IGSMapImage:i=le.getSourcesAndStyleLayers(e);break;case r.LayerType.IGSTile:i=b.getSourcesAndStyleLayers(e);break;case r.LayerType.ArcGISVectorTile:case r.LayerType.IGSVectorTile:i=he.getSourcesAndStyleLayers(e);break;case r.LayerType.ArcGISTile:i=S.getSourcesAndStyleLayers(e);break;case r.LayerType.ArcGISMapImage:i=w.getSourcesAndStyleLayers(e);break;case r.LayerType.WMTS:i=M.getSourcesAndStyleLayers(e);break;case r.LayerType.WMS:i=V.getSourcesAndStyleLayers(e);break;case r.LayerType.webTile:i=k.getSourcesAndStyleLayers(e);break;case r.LayerType.IGSFeature:case r.LayerType.GeoJSON:case r.LayerType.WFS:i=$(e,t);break;case r.LayerType.graphics:i=q(e,t);break;case r.LayerType.IGSImage:i=ye.getSourcesAndStyleLayers(e);break;case r.LayerType.IGSImageTile:i=pe.getSourcesAndStyleLayers(e);break;default:r.Log.error("未支持的图层类型")}return i}function ne(e,t){const{sources:i,layers:r}=e,a=Object.entries(i);for(let e=0;e<a.length;e++){const i=a[e];t.addSource(i[0],i[1])}for(let e=0;e<r.length;e++)t.addLayer(r[e]);return!0}function se(e){return g.createCRSByLayer(e)}class oe{}oe.addIGSMapImageLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=oe.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},oe.getSourcesAndStyleLayers=function(e,t){t=t||{};const{layerView:i={}}=t,{extensionOptions:a={}}=e,{view:n}=i,s=`source_${e.id}`,o=`layer_${e.id}`;let l={layers:e.layers,format:e.imageFormat,size:`${e.imageWidth},${e.imageHeight}`,clientId:e.clientId,isAntialiasing:e.isAntialiasing,layerFilters:e.getFilters(),transparent:e.imageTransparent,tokenKey:e.tokenKey,tokenValue:e.tokenValue};if(n){!e.spatialReference.equals(n.spatialReference)&&(l.projectionSrs=n.spatialReference)}const c=Object(r.getIGSDynamicLayer)(e);c.length>0&&(l.dynamicLayers=c),l=Object.assign(l,a);const h=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGSMapImageLayerV1","IGSMapImageLayerV1Wrong","IGSMapImageLayerV2"]),d=r.ServerUtil.getImage(h,l);let y=d.url;const m=r.UrlUtil.getStringFromObject(d.queryParameters);m&&(y+=`?${m}`);const f={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(f.data=d.queryParameters);const g=u(y,e.imageWidth,e.renderMode,null,f,t.clippingArea,void 0,e.extent),v=p(o,s,e,i),b={};return b[s]=g,{sources:b,layers:[v]}},oe.initAllRequestParams=function(e){const t={};return(e=Object(r.defaultValue)(e,{})).hasOwnProperty("layers")&&(t.layers=e.layers),e.hasOwnProperty("imageTransparent")&&(t.imageTransparent=e.imageTransparent),e.hasOwnProperty("isAntialiasing")&&null!==e.isAntialiasing&&void 0!==e.isAntialiasing&&(t.isAntialiasing=e.isAntialiasing),e.hasOwnProperty("tokenKey")&&e.hasOwnProperty("tokenValue")&&e.tokenValue&&(t[e.tokenKey]=e.tokenValue),"2.0"===e.igsVersion?(t.size=`${e.width},${e.height}`,t.format=e.format,t.f="image",e.hasOwnProperty("styles")&&(t.layerStyles=e.styles),e.hasOwnProperty("filters")&&e.filters&&(t.layerFilters=e.filters),e.hasOwnProperty("dynamicLayers")&&(t.dynamicLayers=JSON.stringify(e.dynamicLayers)),e.hasOwnProperty("projectionSrs")&&(t.projectionSrs=e.projectionSrs),e.hasOwnProperty("clientId")&&(t.clientId=e.clientId)):(t.w=e.width,t.h=e.height,t.f="png",e.hasOwnProperty("styles")&&t.push(`style=${e.styles}`),e.hasOwnProperty("filters")&&e.filters&&(t.filters=e.filters),e.hasOwnProperty("clientId")&&(t.guid=e.clientId)),t},oe.initLayerUrl=function(e,t,i){let a;a="2.0"===t.igsVersion?`${e}/image`:`${e}`;let n,s=oe.initAllRequestParams(t);if("POST"===t.httpMethod)s.bbox="0,0,0,0",n={url:a,data:s=Object.assign(s,i),method:t.httpMethod};else{a+="?bbox={bbox}";for(const e in s){a+=`&${e}=${s[e]}`}const e=r.UrlUtil.getStringFromObject(i);e&&(a+=`&${e}`),n={url:a,method:t.httpMethod}}return t.headers&&(n.headers=t.headers),n},oe.setVisible=function(e){l(e)},oe.setOpacity=function(e){h(e)},oe.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=oe.addIGSMapImageLayer(e,{})},oe.removeLayer=function(e){c(e)};var le=oe;class ce{}ce.addIGSVectorTileLayer=function(e,t){t=Object(r.defaultValue)(t,{});const{innerView:i,layer:a}=e,s=i.getStyle();let o=r.UrlUtil.getBaseUrlAndParams(a.url).params;Object(r.defined)(a.tokenKey)&&Object(r.defined)(a.tokenValue)&&(o[a.tokenKey]=a.tokenValue),e.queryParameters=o;const l=new n.a.RequestManager(function(e){const t=r.UrlUtil.getBaseUrlAndParams(e);t.params=Object.assign(t.params,o);let i=r.UrlUtil.getStringFromObject(t.params);return i&&(e+=`?${i}`),{url:e,method:"GET",headers:a.headers}});s.glyphs&&s.glyphs!==n.a.Style.DEFAULT_GLYPH_URL||(i.style.glyphManager.requestManager=l,i.style.glyphManager.setURL(a.style.glyphs),i.style.stylesheet.glyphs=a.style.glyphs),s.sprite||(i.style._loadSprite(a.style.sprite,l),i.style.stylesheet.sprite=a.style.sprite),ce.addSourcesAndLayers(e,t.callback)},ce.getStyle=function(e,t){const{innerView:i}=e,r=setInterval(()=>{i.isStyleLoaded()&&(clearInterval(r),t&&t instanceof Function&&t(i.getStyle()))},30)},ce.setVisible=function(e,t){const{layer:i,innerView:r}=e,{layers:a}=i.style;a.forEach(e=>{r.setLayoutProperty(e.id,"visibility",t?"visible":"none")})},ce.setOpacity=function(e,t){const{layer:i,innerView:r}=e,{layers:a}=i.style;a.forEach(e=>{const a=i._getBackupProperties(e.id,"opacities");a&&Object.keys(a).forEach(i=>{r.setPaintProperty(e.id,i,a[i]*t)})})},ce.initLayerUrl=function(e,t){return"1.0"===t.igsVersion?(e+="/{z}/{y}/{x}",t.tokenKey&&t.tokenValue&&(e+=`?${t.tokenKey}=${t.tokenValue}`)):(e=`${e}/tileImage/{z}/{y}/{x}?f=image`,t.tokenKey&&t.tokenValue&&(e+=`&${t.tokenKey}=${t.tokenValue}`)),e},ce.removeLayer=function(e){const t=e.layer.style.layers,i=e.layer.style.sources,r=e.innerView;for(let e=0;e<t.length;e++)r.getLayer(t[e].id)&&r.removeLayer(t[e].id);Object.keys(i).forEach(e=>{r.getSource(e)&&r.removeSource(e)})},ce.setPaintProperties=function(e,t,i){const{innerView:r}=e;r.getLayer(t)&&i instanceof Object&&Object.keys(i).forEach(e=>{r.setPaintProperty(t,e,i[e])})},ce.setLayoutProperties=function(e,t,i){const{innerView:r}=e;r.getLayer(t)&&i instanceof Object&&Object.keys(i).forEach(e=>{r.setLayoutProperty(t,e,i[e])})},ce.updateStyleLayer=function(e,t,i){const{opacity:r=1,visible:a=!0}=i;t.forEach(t=>{if(t.paint){Object.keys(t.paint).forEach(i=>{if(/opacity$/.test(i)&&(t.paint[i]*=r),e){e.style.getLayer(t.id)&&e.style.setPaintProperty(t.id,i,t.paint[i])}})}if(t.layout){Object.keys(t.layout).forEach(i=>{if(/visibility$/.test(i)&&(t.layout[i]=a&&"visible"===t.layout[i]?"visible":"none"),e){e.style.getLayer(t.id)&&e.style.setLayoutProperty(t.id,i,t.layout[i])}})}}),e&&e._update&&e._update(!0)},ce.addSourcesAndLayers=function(e,t){const{layer:i}=e,r=ce.getSourcesAndStyleLayers(i,{layerView:e}),{sources:a,layers:n}=r;Object.keys(a).forEach(t=>{a[t].decryptOptions=i.decryptOptions,ce._addSource(e,t,a[t])});for(let t=0;t<n.length;t++)ce._addLayer(e,n[t].id,n[t]);t&&t instanceof Function&&t(this._getInnerLayers(e))},ce._createStyleLayers=function(e,t){const i=(t=t||{}).layerView,r=JSON.parse(JSON.stringify(e.style.layers)),a=i?i._getLayerViewVisible():e.visible,n=i?i._getOpacity():e.opacity;return this.updateStyleLayer(null,r,{opacity:n,visible:a}),r},ce._createSources=function(e,t){let i=r.UrlUtil.getBaseUrlAndParams(e.url).params;Object(r.defined)(e.tokenKey)&&Object(r.defined)(e.tokenValue)&&(i[e.tokenKey]=e.tokenValue);const a=e.style.sources,n=g.createCRSByLayer(e),s=g.convertClippingArea(e.clippingArea),o={};return Object.keys(a).forEach(t=>{const l=a[t];l.clippingArea=s,l.crs=n;const[c,h]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo);if(l.minzoom=c,l.maxzoom=h,l.requestParams={headers:e.headers,data:i},o[t]=l,l.bound){const t=new r.Extent({xmin:l.bound[0],ymin:l.bound[1],xmax:l.bound[2],ymax:l.bound[3]}),i=e.tileWidth||256,a=Math.max(t.xmax-t.xmin,t.ymax-t.ymin)/i,n=Object(r.getExtendExtentByPixel)(t,{extendPixel:100,resolution:a,outSpatialReference:new r.SpatialReference({wkid:4326})}),s=[n.xmin,n.ymin,n.xmax,n.ymax];s&&(l.bounds=s)}}),o},ce.getSourcesAndStyleLayers=function(e,t){return{sources:this._createSources(e,t),layers:this._createStyleLayers(e,t)}},ce._addLayer=function(e,t,i){e.innerView.getLayer(t)||e.innerView.addLayer(i)},ce._addSource=function(e,t,i){e.innerView.getSource(t)||e.innerView.addSource(t,i)},ce._getInnerLayers=function(e){const t=e.layer.style.layers,i=[];for(let r=0;r<t.length;r++)i.push(e.innerView.getLayer(t[r].id));return i};var he=ce;class ue{}ue.addIGSImageryTileLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=ue.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},ue.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,a=`source_${e.id}`,n=`layer_${e.id}`;let s={tokenKey:e.tokenKey,tokenValue:e.tokenValue};const o=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGSImageryTileLayerV2"]),l=r.ServerUtil.getTile(o,s);let c=l.url;const h=r.UrlUtil.getStringFromObject(l.queryParameters);h&&(c+=`?${h}`);const d={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(d.data=l.queryParameters);const y=u(c,e.tileInfo.getTileSize(),null,null,d,t.clippingArea),m=p(n,a,e,i),[f,v]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo);y.minzoom=f,y.maxzoom=v,y.crs=g.createCRSByLayer(e);const b={};return b[a]=y,{sources:b,layers:[m]}},ue.initLayerUrl=function(e,t){return e=`${e}/tileImage/{z}/{y}/{x}?f=image`,t.tokenKey&&t.tokenValue&&(e+=`&${t.tokenKey}=${t.tokenValue}`),e},ue.setVisible=function(e){l(e)},ue.setOpacity=function(e){h(e)},ue.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=ue.addIGSTileLayer(e,{})},ue.removeLayer=function(e){c(e)};var pe=ue;class de{}de.addIGSImageryLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=de.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},de.getSourcesAndStyleLayers=function(e,t){t=t||{};const{extensionOptions:i={}}=e,a=`source_${e.id}`,n=`layer_${e.id}`,s=t.layerView;let o=Object.assign({imageWidth:e.imageWidth,imageHeight:e.imageHeight,imageFormat:e.format,tokenKey:e.tokenKey,tokenValue:e.tokenValue,tokenAttachType:e.tokenAttachType,httpMethod:e.httpMethod,renderMode:e.renderMode,interpolation:e.interpolation,renderingRule:e.rasterFunction,bandIds:e.bandIds},t);if(s&&s.view){!e.spatialReference.equals(s.view.spatialReference)&&(o.imageSR=s.view.spatialReference)}o=Object.assign(o,i);const l=r.LayerBaseUrlRegExp.matchStringByRegExpNames(e.url,["IGSImageryLayerV2"]),c=r.ServerUtil.getImage(l,o);let h=c.url;const d=r.UrlUtil.getStringFromObject(c.queryParameters);d&&(h+=`?${d}`);const y={method:e.httpMethod,headers:e.headers};"GET"!==e.httpMethod&&(y.data=c.queryParameters);const m=u(h,e.imageWidth,e.renderMode,null,y,t.clippingArea),f=p(n,a,e,s),g={};return g[a]=m,{sources:g,layers:[f]}},de.setVisible=function(e){l(e)},de.setOpacity=function(e){h(e)},de.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=de.addIGSImageryLayer(e,{})},de.removeLayer=function(e){c(e)};var ye=de;var me=class extends r.Evented{constructor(e){super(e),this.view=Object(r.defaultValue)(e.view,null),this.location=Object(r.defaultValue)(e.location,""),this.title=Object(r.defaultValue)(e.title,""),this.content=Object(r.defaultValue)(e.content,""),this.alignment=Object(r.defaultValue)(e.alignment,"bottom-center"),this.defaultButtons=Object(r.defaultValue)(e.defaultButtons,["toggle","close","zoom"]),this._popup=void 0,this._initPopup(),this._initDefaultClass()}_initPopup(){this._customPopup(),this.view._innerView.closePopupOnClick=!1}_initDefaultClass(){let e=!1;const t=document.head.getElementsByTagName("style");if(t)for(let i=0;i<t.length;i++)if(t[i].innerHTML.indexOf("styleDomString")>-1){e=!0;break}if(!e){const e=document.createElement("style");e.innerHTML="\n .zondy-popup__container{\n background-color: #fff;\n padding:0;\n border-radius: 10px;\n }\n .zondy-popup__tip-default{\n background-color: #fff;\n }\n .zondy-popup__header-default{\n padding: 8px;\n font-size: 18px;\n font-weight: 600;\n line-height: 20px;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n white-space: nowrap;\n }\n .zondy-popup__content-default{\n padding: 8px;\n }\n .zondy-popup__footer-default{\n }\n .zondy-popup__footer-division{\n border-top: 1px solid;\n }\n .zondy-popup__toggle-default,.zondy-popup__close-default{\n display: inline-block;width: 30px;text-align: center;\n }\n ",document.querySelector("head").append(e)}}_customPopup(){}open(e){this._popup?(this.close(),this._popup=void 0,this.openPopup(e)):this.openPopup(e)}openPopup(e){if(this.view=Object(r.defaultValue)(e.view,this.view),this.location=Object(r.defaultValue)(e.location,this.location),this.location.spatialReference.isGeographic?this._location=this.location:this._location=r.Projection.project(this.location,new r.SpatialReference({wkid:4326})),this.title=Object(r.defaultValue)(e.title,this.title),this.content=Object(r.defaultValue)(e.content,this.content),this.alignment=Object(r.defaultValue)(e.alignment,this.alignment),this.defaultButtons=Object(r.defaultValue)(e.defaultButtons,this.defaultButtons),!this.view._innerView)return void r.Log.info("没有视图引擎!");const t=this._contentUI(this.title,this.content);this._popup=new n.a.Popup({closeOnClick:!1,closeButton:!1,maxWidth:"1900px"}).setLngLat(this._location.coordinates).setDOMContent(t).addTo(this.view._innerView),this._popup.toggleClassName("highlighted");const i=this._popup._container.getElementsByClassName("mapboxgl-popup-content");for(let e=0;e<i.length;e++)i[e].style.padding="0",i[e].style.borderRadius="10px"}_contentUI(e,t){const i=this;let r=void 0;const a=function(e){const t=document.createElement("div");return t.innerHTML=e,t.childNodes};(r=document.createElement("div")).setAttribute("id",`${this.id}-popup-default`);const n=document.createElement("div");n.setAttribute("class","zondy-popup__header-default zondy-popup__header"),n.setAttribute("style","display: flex;");const s=a('<div class="zondy-popup__toggle-default zondy-popup__toggle">\n <svg aria-hidden="true" class="svg" fill="currentColor" height="16px" width="16px" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M5 13.793l7-7 7 7v1.414l-7-7-7 7z"></path></svg>\n </div>')[0],o=a('<div class="zondy-popup__close-default zondy-popup__close">\n <svg aria-hidden="true" class="svg" fill="currentColor" height="16px" width="16px" viewBox="0 0 16 16" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M3.98 11.303L7.281 8 3.98 4.697l.707-.707L7.99 7.293l.01-.01.01.01 3.304-3.303.707.707L8.718 8l3.303 3.303-.707.707L8.01 8.707l-.01.01-.01-.01-3.304 3.303z"></path></svg>\n </div>')[0];if(e||""===e){const t=a('<div style="flex: 1;"></div>')[0];if(n.appendChild(t),"object"==typeof e?e instanceof Node?t.appendChild(e):e instanceof NodeList&&e.forEach(e=>{t.appendChild(e)}):t.innerHTML=e,this.defaultButtons.indexOf("toggle")>-1){n.appendChild(s);let e=!0;s.onclick=function(){e=!e,document.getElementById(`${i.id}-popup-default`).querySelector(".zondy-popup__content-default").style.display=e?"block":"none"}}this.defaultButtons.indexOf("close")>-1&&(n.appendChild(o),o.onclick=(()=>{this.close()}))}const l=document.createElement("div");if(l.setAttribute("class","zondy-popup__content-default zondy-popup__content"),t)if("object"==typeof t){if(t instanceof Node)l.appendChild(t);else if(t instanceof NodeList)for(let e=0;e<t.length;e++)l.appendChild(t[e]),e--}else l.innerHTML=t;const c=document.createElement("div");c.setAttribute("class","zondy-popup__footer-default zondy-popup__footer");const h=a('<div class="zondy-popup__zoom" style="display: inline-block;width: 36px;height: 36px;line-height: 36px;text-align: center;">\n <svg class="svg" fill="currentColor" height="16px" width="16px" viewBox="0 0 16 16" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M9 7H7v2H6V7H4V6h2V4h1v2h2zm6.805 7.861l-.943.942a.665.665 0 0 1-.943 0l-3.067-3.067a.667.667 0 0 1 0-.943l.129-.13-1.108-1.107A5.279 5.279 0 1 1 11.8 6.5a5.251 5.251 0 0 1-1.237 3.366l1.108 1.108.124-.124a.668.668 0 0 1 .943 0l3.067 3.068a.666.666 0 0 1 0 .943zM10.8 6.5a4.3 4.3 0 1 0-4.3 4.3 4.304 4.304 0 0 0 4.3-4.3zm4.062 7.89l-2.595-2.598-.473.473 2.597 2.595z"></path></svg>\n </div>')[0];return this.defaultButtons.indexOf("zoom")>-1&&(c.appendChild(h),h.onclick=function(){i.view.flyTo({zoom:i.view._zoom+1,center:i.location})}),c.childNodes.length>0&&c.setAttribute("class","zondy-popup__footer-division zondy-popup__footer-default zondy-popup__footer"),r.appendChild(n),r.appendChild(l),r.appendChild(c),r}_getOffset(){}_getOffsetByAlignment(e,t,i){let r=0,a=0;switch(e){case"top-left":r=t/2,a=i;break;case"top-center":a=i;break;case"top-right":r=-t/2,a=i;break;case"bottom-left":r=t/2;break;case"auto":case"bottom-center":break;case"bottom-right":r=-t/2}return{x:r,y:a}}close(){this.view._innerView&&this._popup.remove()}destroy(){}};var fe=class{constructor(e){e=Object(r.defaultValue)(e,{}),this.view=Object(r.defaultValue)(e.view,null),this.format=Object(r.defaultValue)(e.format,r.PictureFormat.PNG),this.filename=Object(r.defaultValue)(e.filename,"screenshotFile"),this.width=Object(r.defaultValue)(e.width,void 0),this.height=Object(r.defaultValue)(e.height,void 0),this.x=Object(r.defaultValue)(e.x,0),this.y=Object(r.defaultValue)(e.y,0),this.isDownload=Object(r.defaultValue)(e.isDownload,!0)}_addView(){const e=this,t=this.view._innerView.getCanvas();let i=null;this.format===r.PictureFormat.PNG?i=t.toDataURL():this.format===r.PictureFormat.JPEG?i=t.toDataURL("image/jpeg"):"svg"===this.format&&(i=t.toDataURL());const a=document.createElement("canvas");a.width=this.width,a.height=this.height;const n=a.getContext("2d"),s=function(e,t){const i=document.createElement("a");i.href=e,i.download=t,document.body.appendChild(i),i.click()};return new Promise(t=>{if(this.width&&this.height){const o=new Image;o.src=i,o.onload=function(){n.drawImage(o,e.x,e.y,e.width,e.height,0,0,e.width,e.height);let i=null;e.format===r.PictureFormat.PNG?i=a.toDataURL():e.format===r.PictureFormat.JPEG?i=a.toDataURL("image/jpeg"):"svg"===e.format&&(i=a.toDataURL()),e.isDownload&&s(i,e.filename),t({dataUrl:i})}}else e.isDownload&&s(i,this.filename),t({dataUrl:i})})}_removeView(){}};var ge=class extends r.LayerView{onAdd(){const e=this.layer;return this.innerLayer=le.addIGSMapImageLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return le.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":le.setVisible(this);break;case"opacity":le.setOpacity(this);break;case"sublayerVisible":case"refresh":le.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var ve=class extends r.LayerView{onAdd(){const{layer:e}=this;return this.innerLayer=b.addIGSTileLayer(this),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return b.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":b.setVisible(this);break;case"opacity":b.setOpacity(this);break;case"refresh":b.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var be=class extends r.LayerView{onAdd(){const e=this.layer,t=this._getLayerViewVisible();return this.innerLayer=V.addWMSLayer(this,{visible:t,clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return V.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":V.setVisible(this,i);break;case"opacity":V.setOpacity(this);break;case"refresh":case"sublayerVisible":V.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var _e=class extends r.LayerView{onAdd(){const e=this.layer;return this.innerLayer=M.addWMTSLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return M.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":M.setVisible(this);break;case"opacity":M.setOpacity(this);break;case"refresh":M.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Se=class extends r.BaseGraphicsLayerView{onAdd(e){const t=this.layer,i=this.innerView,r=this,a=t.extensionOptions||{},n=Object.assign({id:t.id,opacity:this._getOpacity(),visible:this._getLayerViewVisible()},a);return r.innerLayer=new Z(n),r.innerLayer.onAdd(i).then(()=>{const e=t.graphics.items||[];return r.innerLayer.commonLayerId=t.id,r._addFeature(r.innerLayer,e),Promise.resolve(this)})}onRemove(e){return this.innerLayer.onRemove(this.innerView),this.innerLayer=null,Promise.resolve(this)}onUpdate(e){this.layer;const t=this.innerLayer;return e.updateContent&&t&&e.updateContent.forEach(e=>{if(e&&"property"===e.operationType)switch(e.name){case"opacity":t.opacity=this._getOpacity();break;case"scaleVisible":case"minScale":case"maxScale":case"visible":{const i=this._getLayerViewVisible("scaleVisible"===e.name);t.visible=i;break}}if(e&&"method"===e.operationType)switch(e.name){case"add":{const i=e.params;this._addFeature(t,i[0]);break}case"remove":{const i=e.params;this._removeFeature(t,i[0]);break}case"addMany":{let i=e.params[0];i instanceof r.FeatureSet&&(i=i.features),this._addFeature(t,i);break}case"removeMany":{const i=e.params[0];this._removeFeature(t,i);break}case"removeAll":t.removeAll();break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}),Promise.resolve(this)}_addFeature(e,t){const i=Array.isArray(t)?t:[t];i.forEach(()=>{t.geometry&&!t.geometry.spatialReference&&(t.geometry.spatialReference=this.layer.spatialReference)}),this.render.drawFeature(e,i)}_removeFeature(e,t){const i=Array.isArray(t)?t:[t];this.render.clearFeature(e,i)}};var xe=class extends r.FeatureRender{drawFeature(e,t){e&&e.add(t)}updateFeature(e,t,i){e&&e.update(t,i)}clearFeature(e,t){e&&e.remove(t)}clear(e){e&&e.removeAll()}};var we=class extends r.LayerView{onAdd(){return this._layerViewVisible=this._getLayerViewVisible(),he.addIGSVectorTileLayer(this,{callback:e=>{for(let t=0;t<e.length;t++)e[t].commonLayerId=this.layer.id;this.innerLayer=e}}),Promise.resolve(this)}onRemove(){return he.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t],{params:r}=i;if(i)switch(i.name){case"setPaintProperties":he.setPaintProperties(this,r[0],r[1]);break;case"setLayoutProperties":he.setLayoutProperties(this,r[0],r[1]);break;case"sublayerUpdate":this._updateStyle(this.innerView,JSON.parse(JSON.stringify(r[0])));break;case"opacity":case"setStyleLayer":case"deleteStyleLayer":case"refresh":this._updateStyle(this.innerView,JSON.parse(JSON.stringify(this.layer.style.layers)));break;case"scaleVisible":case"minScale":case"maxScale":case"visible":const e=this._getLayerViewVisible("scaleVisible"===i.name);this._layerViewVisible!==e&&(this._updateStyle(this.innerView,JSON.parse(JSON.stringify(this.layer.style.layers))),this._layerViewVisible=e);break;case"clippingArea":{const e=i.params[0],t=this.innerView,r=this.layer.style.sources;r&&Object.entries(r).forEach(i=>{const r=i[0],a=t.getSource(r);a&&"vector"===a.type&&a.setClippingArea&&a.setClippingArea(g.convertClippingArea(e))});break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}_updateStyle(e,t){const i=this._getOpacity(),r=this._getLayerViewVisible();he.updateStyleLayer(e,t,{opacity:i,visible:r})}};var Le=class extends r.BaseRendererLayerView{constructor(e){super(e),this.styleLayers=[]}onAdd(e){const t=this.layer.renderer;this.renderType=t.type,this.sourceIds=[],this.initialized=!1,this._imageSourceManager=this._imageSourceManager?this._imageSourceManager:new E(this.innerView);const i=this._addInnerLayer();return i.then(()=>{this.initialized=!0,this._updateState()}),i}onRemove(e){return super.onRemove(e),this._removeStyleLayers(),this._removeSources(),Promise.resolve(this)}onUpdate(e){const t=this;return e.updateContent&&e.updateContent.forEach(e=>{if(e&&"property"===e.operationType)switch(e.name){case"opacity":t._updateState();break;case"scaleVisible":case"minScale":case"maxScale":case"visible":t._updateState();break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}if(e&&"method"===e.operationType)switch(e.name){case"refresh":this._updateState()}}),Promise.resolve(this)}_requestMapboxglFrameUpdate(e){this.innerView&&this.innerView._update(e)}_processData(){return new Promise(e=>{})}_addInnerLayer(){return this._processData().then(e=>{const t=this.layer,i=this.innerView;this.featureSet=e;const r=t.renderer;return this._initInnerLayer(t,i,e,r)})}_initInnerLayer(e,t,i,r){const a=this;return new Promise(e=>{let i;const r=()=>{a._addSources(),e(a),i&&clearInterval(i)};t.loaded()?r():(t.once("load",r),i=setInterval(()=>{t.loaded()&&r()},16))})}_rendererChangeAction(e){e&&this._updateState()}_updateState(e){const{innerView:t,layer:i}=this;if(!t||!this.styleLayers||!this.initialized)return;e||(e=i.renderer);const a=this._getOpacity(),n=this._getLayerViewVisible(),s=t.style;F(function(e){const t=[];if(!e)return t;switch(e.type){case r.RendererType.simple:t.push(e.symbol);break;case r.RendererType.classBreak:t.push(e.defaultSymbol),e.classBreakInfos.forEach(e=>{t.push(e.symbol)});break;case r.RendererType.uniqueValue:t.push(e.defaultSymbol),e.uniqueValueInfos.forEach(e=>{t.push(e.symbol)});break;case r.RendererType.rank:t.push(e.symbol);break;case r.RendererType.random:break;case r.RendererType.cluster:t.push(e.defaultSymbol),e.clusterInfos.forEach(e=>{t.push(e.symbol)});break;default:r.Log.error("未定义的Renderer类型")}return t}(e),this._imageSourceManager).then(()=>{const r=this.styleLayers,o={featureSet:this.featureSet,imageSourceManager:this._imageSourceManager},l=N(i.id,e,i.geometryType,n,a,o);if(0===l.length)throw new Error("创建样式图层列表失败,请检查Renderer的类型是否支持!");let c=!1;if(e.type===this.renderType&&0!==this.styleLayers.length||(c=!0,"cluster"!==e.type&&"cluster"!==this.renderType||this._triggerSourceClusterChange("cluster"===e.type)),r.length>0&&!c){const e=r.length===l.length,t=r.every(e=>l.findIndex(t=>t&&e&&t.id===e.id&&t.type===e.type)>-1);e&&t||(c=!0)}if(c){let t=null;if(r.length>0){const e=s._order.indexOf(r[r.length-1].id);e>-1&&e+1<s._order.length&&(t=s._order[e+1])}return this._removeStyleLayers(),this._addStyleLayers(l,t),void(this.renderType=e.type)}this._updateStyleLayers(t,r,l)})}_updateStyleLayers(e,t,i){const r=e.style;let a=!1;for(let e=0;e<t.length;e++)for(let n=0;n<i.length;n++){const s=t[e],o=i[n];s.id===o.id&&r.hasLayer(o.id)&&JSON.stringify(s)!==JSON.stringify(o)&&(o.paint&&Object.keys(o.paint).forEach(e=>{r.setPaintProperty(o.id,e,o.paint[e])}),o.layout&&Object.keys(o.layout).forEach(e=>{r.setLayoutProperty(o.id,e,o.layout[e])}),o.filter&&r.setFilter(o.id,o.filter),a=!0)}a&&(this._requestMapboxglFrameUpdate(!0),this.styleLayers=i)}_convertSourceData(e){const t={type:"FeatureCollection",features:[]};return e.features.forEach(e=>{Object(r.defined)(e.geometry)?t.features.push(g.convertToGeoJSON(e)):r.Log.warning("要素几何信息缺失,无法绘制要素:",e)}),t}_addStyleLayers(e,t){const{innerView:i}=this;i._lazyInitEmptyStyle(),e.forEach(e=>{i.style.addLayer(e,t)}),this.styleLayers=e,this._requestMapboxglFrameUpdate(!0)}_removeStyleLayers(){const e=this.innerView;for(let t=0;t<this.styleLayers.length;t++){const i=this.styleLayers[t].id;if(e.style.hasLayer(i)){if(e.overlayLayersManager[i])return e._removeLayer(e.overlayLayersManager[i]),delete e.overlayLayersManager[i],this;e.style.removeLayer(i)}}this._requestMapboxglFrameUpdate(!0),this.styleLayers=[]}_addSources(){const e=this.layer,t=e.renderer,i={type:"geojson",data:this._convertSourceData(this.featureSet)};t instanceof r.ClusterRenderer&&(i.cluster=!0,i.clusterRadius=t.radius),this.innerView.addSource(e.id,i),this.sourceIds.push(e.id)}_removeSources(){for(let e=0;e<this.sourceIds.length;e++)this.innerView.removeSource(this.sourceIds[e]);this.sourceIds=[]}_triggerSourceClusterChange(e){const t=this.innerView,i=this.layer,r=t.getSource(i.id);if(!r)return;const a=r.workerOptions||{};a.cluster=e;const n=a.superclusterOptions||{};e&&(n.radius=16*i.renderer.radius),r.setData(this._convertSourceData(this.featureSet))}getStyleLayerIds(){return this.styleLayers.map(e=>e.id)}};class Me{}Me.addIGSVectorLayer=function(e,t){t=t||{};const i=e.layer,r=e.innerView;t.layerView=e;const a=Me.getSourcesAndStyleLayers(i,t);ne(a,r);const n=r.getLayer(a.layers[0].id);return n.sourceID=n.source,n},Me.getSourcesAndStyleLayers=function(e,t){const i=(t=t||{}).layerView,a=r.EPSG.find(e=>e.id===i.view.spatialReference.wkid);let n={igsVersion:e._igsVersion,tokenKey:e.tokenKey,tokenValue:e.tokenValue,gdbps:[e.gdbp],filters:e.definitionExpression?`0:${e.definitionExpression}`:"",headers:e.headers,projectionSrs:Object(r.getProjectionSrs)(i.view.spatialReference),proj:a?a.name:""};const{extensionOptions:s={}}=e;n=Object.assign(n,s);const o=`source_${e.id}`,l=`layer_${e.id}`,c=Me.initLayerUrl(e.url,n),h=u(c.url,256,null,null,c,t.clippingArea),d=p(l,o,e,i),[y,m]=r.TileInfoUtil.getLevelRangeByTileInfo(e.tileInfo);h.minzoom=y,h.maxzoom=m;const f={};return f[o]=h,{sources:f,layers:[d]}},Me.initLayerUrl=function(e,t,i){i=Object(r.defaultValue)(i,[]);const a=t.igsVersion,n=Object(r.getBaseUrl)(e);let s=`${n}/igs/rest/mrms/layers`;"2.0"===a&&(s=`${n}/igs/rest/services/system/ResourceServer/tempData/image`);const o=Me.initAllRequestParams(t);let l;if("POST"===t.httpMethod)o.bbox="0,0,0,0",i instanceof Array&&i.forEach(e=>{Object(r.defined)(e.key)&&Object(r.defined)(e.value)&&(o[e.key]=e.value)}),l={url:s,data:o,method:t.httpMethod};else{s+="?bbox={bbox}";for(const e in o){s+=`&${e}=${o[e]}`}l={url:s,method:t.httpMethod}}return t.headers&&(l.headers=t.headers),l},Me.initAllRequestParams=function(e){const t={};if("1.0"===e.igsVersion){const i=e.f||"png";t.f=i,e.gdbps&&(t.gdbps=e.gdbps),t.w=256,t.h=256,e.filters&&(t.filters=e.filters),e.style&&(t.style=JSON.stringify(e.style)),e.proj&&(t.proj=e.proj);const a=e.guid||Object(r.getGUID)();t.guid=a,void 0!==e.isAntialiasing&&null!==e.isAntialiasing&&(t.isAntialiasing=e.isAntialiasing),e.tokenKey&&e.tokenValue&&(t[e.tokenKey]=e.tokenValue)}else{const i=e.f||"image";t.f=i,e.gdbps&&(t.urls=e.gdbps),t.size="256,256",e.projectionSrs&&(t.projectionSrs=`${e.projectionSrs}`);const a=e.clientId||Object(r.getGUID)();t.clientId=a,void 0!==e.isAntialiasing&&null!==e.isAntialiasing&&(t.isAntialiasing=e.isAntialiasing),e.tokenKey&&e.tokenValue&&(t[e.tokenKey]=e.tokenValue)}return t},Me.setVisible=function(e){l(e)},Me.setOpacity=function(e){h(e)},Me.refresh=function(e){e.innerView.removeLayer(e.innerLayer.id),e.innerView.removeSource(e.innerLayer.sourceID),e.innerLayer=Me.addIGSVectorLayer(e,{})},Me.removeLayer=function(e){c(e)};var Te=Me;var Ve=class extends Le{_processData(){return this.layer._reloadFeatures()}onAdd(e){const t=this,i=this.layer;return"server"===i.renderMode?(this.innerLayer=Te.addIGSVectorLayer(this,{}),this.innerLayer.commonLayerId=i.id,Promise.resolve(t)):super.onAdd(e)}onUpdate(e){if("server"===this.layer.renderMode){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":Te.setVisible(this,i);break;case"opacity":Te.setOpacity(this);break;case"refresh":Te.refresh(this);break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}return super.onUpdate(e)}onRemove(e){const t=this;return"server"===this.layer.renderMode?(this.innerView.removeLayer(this.innerLayer.id),Promise.resolve(t)):super.onRemove(e)}};var Pe=class extends Le{_processData(){const e=this.layer;return Promise.resolve(e._source)}};var ke=class extends Le{_processData(){return this.layer.queryFeatures().then(e=>e)}};var Oe=class extends r.LayerView{onAdd(){const e=this.layer,t=this._getLayerViewVisible();return this.innerLayer=k.addWebTileLayer(this,{visible:t,clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return k.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":k.setVisible(this,i);break;case"opacity":k.setOpacity(this);break;case"sublayerVisible":case"refresh":k.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r?r.setClippingArea(g.convertClippingArea(e)):this.innerLayer.implementation&&this.innerLayer.implementation.type&&"custom"===this.innerLayer.implementation.type&&this.innerLayer.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Ee=class extends r.GroupLayerView{};class Ce{}Ce.addEchartsLayer=function(e,t){const{extensionOptions:i={}}=e;let a=Object.assign(e.echartsOptions,i);a=Object(r.deleteNullValue)(a);const n=new re(t,a).addTo(t);return n.id=e.id,n},Ce.removeLayer=function(e){e.remove()};var je=Ce;var Ie=class extends r.LayerView{onAdd(e){const t=this.layer,i=this.innerView;return this.innerLayer=je.addEchartsLayer(t,i),this.innerLayer.commonLayerId=t.commonLayerId,this._getLayerViewVisible()?this.innerLayer.show():this.innerLayer.hide(),Promise.resolve(this)}onRemove(e){return je.removeLayer(this.innerLayer),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":this._getLayerViewVisible("scaleVisible"===i.name)?this.innerLayer.show():this.innerLayer.hide();break;case"opacity":this.innerLayer.setOpacity(this._getOpacity());break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};class Ae{}Ae.addMapVLayer=function(e,t){const{extensionOptions:i={}}=e;let a=Object.assign(e.mapVOptions,i);a=Object(r.deleteNullValue)(a);const n=new H(t,e.data,a);return n.id=e.id,n},Ae.removeLayer=function(e){e.remove()};var ze=Ae;var Re=class extends r.LayerView{onAdd(e){const t=this.layer,i=this.innerView;return this.innerLayer=ze.addMapVLayer(t,i),this.innerLayer.commonLayerId=t.id,this._getLayerViewVisible()?this.innerLayer.show():this.innerLayer.hide(),Promise.resolve(this)}onRemove(e){return ze.removeLayer(this.innerLayer),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":this._getLayerViewVisible("scaleVisible"===i.name)?this.innerLayer.show():this.innerLayer.hide();break;case"opacity":this.innerLayer.setOpacity(this._getOpacity());break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var De=class extends r.LayerView{onAdd(){const e=this.layer;return this.innerLayer=w.addArcGISMapImageLayer(this),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return w.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":w.setVisible(this,i);break;case"opacity":w.setOpacity(this);break;case"sublayerVisible":case"refresh":w.refresh(this);break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Ge=class extends r.LayerView{onAdd(){const{layer:e}=this;return this.innerLayer=S.addArcGISTileLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return S.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":S.setVisible(this);break;case"opacity":S.setOpacity(this);break;case"refresh":S.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Ne=class extends r.LayerView{onAdd(){const{layer:e}=this;return this.innerLayer=ye.addIGSImageryLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return ye.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(!this.innerLayer)return Promise.resolve(this);if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":ye.setVisible(this,i);break;case"opacity":ye.setOpacity(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"refresh":case"bandIds":case"interpolation":case"rasterFunction":ye.refresh(this);break;case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};var Fe=class extends r.LayerView{onAdd(){const{layer:e}=this;return this.innerLayer=pe.addIGSImageryTileLayer(this,{clippingArea:g.convertClippingArea(e.clippingArea)}),this.innerLayer.commonLayerId=e.id,Promise.resolve(this)}onRemove(){return pe.removeLayer(this),Promise.resolve(this)}onUpdate(e){if(e.updateContent)for(let t=0;t<e.updateContent.length;t++){const i=e.updateContent[t];if(i)switch(i.name){case"scaleVisible":case"minScale":case"maxScale":case"visible":pe.setVisible(this);break;case"opacity":pe.setOpacity(this);break;case"refresh":pe.refresh(this);break;case"clippingArea":{const e=i.params[0],t=this.innerLayer.source,r=this.innerView.getSource(t);r&&r.setClippingArea(g.convertClippingArea(e));break}case"extensionOptions":if(this.innerLayer){const e=this.layer.extensionOptions||{};Object.entries(e).forEach(([e,t])=>{this.innerLayer[e]=t})}}}return Promise.resolve(this)}};class Be{}Be.getMouseEvent=function(e,t,i){let a=void 0;return{mapPoint:a=t._spatialReference.isGeographic?new r.Point({coordinates:[e.lngLat.lng,e.lngLat.lat]}):r.Projection.project(new r.Point({coordinates:[e.lngLat.lng,e.lngLat.lat]}),new r.SpatialReference(t.crs.code)),x:e.point.x,y:e.point.y,button:e.originalEvent.button,buttons:e.originalEvent.buttons,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,innerViewerEvent:e,type:i}},Be.getKeyEvent=function(e,t,i){const r={key:e.originalEvent.key,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,innerViewerEvent:e,type:i};return"key-down"===i&&(r.repeat=e.originalEvent.repeat),r},Be.getViewChangeEvent=function(e,t,i){const r={event:e,innerViewerEvent:e,target:t,type:i};return r.mapView=t,r.scale=t._scale,r.zoom=t._zoom,r.center=t.center,r.extent=t._extent,r},Be.getDragEvent=function(e,t,i,r,a){return{x:e.originalEvent.layerX,y:e.originalEvent.layerY,button:void 0!==a?a:e.originalEvent.button,buttons:e.originalEvent.buttons,cancelable:e.originalEvent.cancelable,origin:i,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,action:r,innerViewerEvent:e,type:"drag"}},Be.getKeyEvent=function(e,t,i){const r={key:e.key,stopPropagation:e.stopPropagation,timeStamp:e.timeStamp,native:e,type:i};return"key-down"===i&&(r.repeat=e.repeat),r};var Ue=Be;class Ze extends r.MapView{constructor(e){if(super(e),e=Object(r.defaultValue)(e,{}),this._options=e,this._center=Object(r.isNull)(e.center)?void 0:r.Point.fromJSON(e.center),this._center&&Array.isArray(this._center)&&this._center.length>1&&(this._center=new r.Point({coordinates:[this._center[0],this._center[1]]})),this._extent=Object(r.isNull)(e.extent)?void 0:r.Extent.fromJSON(e.extent),this.width=void 0,this.height=void 0,this._zoom=Object(r.defaultValue)(e.zoom,void 0),this._scale=Object(r.defaultValue)(e.scale,void 0),this.maxScale=Object(r.defaultValue)(e.maxScale,void 0),this.minScale=Object(r.defaultValue)(e.minScale,void 0),this.minZoom=Object(r.defaultValue)(e.minZoom,void 0),this.maxZoom=Object(r.defaultValue)(e.maxZoom,void 0),this.popup=Object(r.defaultValue)(e.popup,void 0),this._referenceLayer=void 0,this.spatialReferenceLocked=Object(r.defaultValue)(e.spatialReferenceLocked,!1),this.stationary=!0,e.fullExtent){let t=r.Extent.fromJSON(e.fullExtent.toJSON());t.spatialReference.isGeographic||(t=r.Projection.project(t,new r.SpatialReference({wkid:4326}))),this._initFullExtent=t}this._fullExtent=this._initFullExtent,this._mapExtent=null,this._fireLoaded=!1,this._initView(!0,this._options)}_initView(e,t){const i=this;let a;if(n.a.accessToken="pk.eyJ1IjoiemtidWQiLCJhIjoiY2w5OGF2NXIyMzQ5bjNub2luem85Y2Z4OCJ9.uX09XQPOX5E7sOohws2l_Q",e&&t){let e;a={center:e=Object(r.isNull)(t.center)&&Object(r.isNull)(t.extent)?new r.Point({coordinates:[0,0]}):Object(r.isNull)(t.center)?void 0:r.Point.fromJSON(t.center),scale:t.scale,zoom:Object(r.isNull)(t.scale)&&Object(r.isNull)(t.zoom)?0:t.zoom,target:Object(r.isNull)(t.extent)?void 0:r.Extent.fromJSON(t.extent)},this.minScale=Object(r.defaultValue)(t.minScale,void 0),this.maxScale=Object(r.defaultValue)(t.maxScale,void 0),this.minZoom=Object(r.defaultValue)(t.minZoom,void 0),this.maxZoom=Object(r.defaultValue)(t.maxZoom,void 0)}else this._zoom=void 0,this._extent=void 0,a={center:this._center,scale:this._scale};let{center:s,zoom:o,extent:l}=this._getValidGoToParams(a);Object(r.isNull)(s)||Object(r.isNull)(o)?Object(r.isNull)(l)||(this._extent=l):(this._center=s,this._zoom=o);let c=void 0;if(e&&!Object(r.isNull)(this._extent)){const e=r.Projection.project(this._extent,new r.SpatialReference({wkid:4326}));c=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}const h={crs:this.crs,container:this._viewId,style:{version:8,sources:{},layers:[{id:Object(r.getGUID)(),type:"background",paint:{"background-color":"rgba(255, 255, 255,1)"}}]},bounds:c,preserveDrawingBuffer:!0};return Object(r.isNull)(this._zoom)||(h.zoom=this._zoom),Object(r.isNull)(this._center)||Object(r.isNull)(this._center.coordinates)||(h.center=this._center.coordinates),Object.keys(this.extensionOptions).forEach(e=>{"crs"!==e&&"container"!==e&&("object"==typeof this.extensionOptions[e]&&"object"==typeof h[e]?h[e]=Object.assign(h[e],this.extensionOptions[e]):h[e]=this.extensionOptions[e])}),this._innerView=new n.a.Map(h),this.engineType=r.EngineType.mapboxgl,this._initViewEvent(),this._initSize(),this._initScaleLimit(),this._initPopup(),this._initCursor(),this._updateMaxBounds(),new Promise(t=>{function a(e,a){e._zoomEndHandler(),e._fireLoaded||(e.fire(r.ViewEventType.loaded,{}),e._fireLoaded=!0),t(i)}i._innerView.loaded()?Promise.resolve().then(()=>{a(this,e)}):i._innerView.once("load",()=>{a(this,e)})})}_initScaleLimit(){if(Object(r.isNull)(this._options.minScale))if(Object(r.isNull)(this._options.minZoom)){const e=this._innerView.getMinZoom();isFinite(e)?(this.minScale=this._getScaleByZoom(e),this.minZoom=e):(this.minScale=void 0,this.minZoom=void 0)}else this.minZoom=this._options.minZoom,this.minScale=this._getScaleByZoom(this.minZoom),this._innerView.setMinZoom(this.minZoom);else if(this.minScale>0){const e=this._getZoomByScale(this.minScale);void 0!==e&&this._innerView.setMinZoom(e),this.minZoom=e}else this.minZoom=void 0,this.minScale=0,this._innerView.setMinZoom(void 0);if(void 0!==this._options.maxScale)if(this.maxScale>0){const e=this._getZoomByScale(this.maxScale);void 0!==e&&this._innerView.setMaxZoom(e),this.maxZoom=e}else this.maxScale<=0&&(this.maxZoom=void 0,this.maxScale=0,this._innerView.setMaxZoom(void 0));else if(Object(r.isNull)(this._options.maxZoom)){let e=this._innerView.getMaxZoom();const t=((this.crs||{}).options||{}).lods;t&&Array.isArray(t)&&e>=t.length-1&&(e=t.length-1,this._innerView.setMaxZoom(e)),isFinite(e)?(this.maxScale=this._getScaleByZoom(e),this.maxZoom=e):(this.maxScale=void 0,this.maxZoom=void 0)}else this.maxZoom=this._options.maxZoom,this.maxScale=this._getScaleByZoom(this.maxZoom),this._innerView.setMaxZoom(this.maxZoom);!this._scale||this._scale<=0?this._scale=this.minScale:this._scale>this.minScale?this._scale=this.minScale:this._scale<this.maxScale&&(this._scale=this.maxScale)}_createCrsObject(e){if(!(e.spatialReference&&e.origin&&e.lods&&e.extent))return;let t;if(e.spatialReference.wkid){const i=r.Projection.getEPSGByWKID(e.spatialReference.wkid);i&&(t=i.strProject)}else e.spatialReference.wkt&&(t=e.spatialReference.wkt);const i=[e.extent.xmin,e.extent.ymin,e.extent.xmax,e.extent.ymax],a=`EPSG:${e.spatialReference.wkid}`,n=t,s={},o={};e.lods.forEach(e=>{s[e.level]=e.resolution,o[e.level]=e.levelValue});const l=new y(a,n,{levelValues:o,resolutions:s,origin:e.origin,tileSize:e.tileSize,bounds:i,unit:e.spatialReference.isGeographic?"degree":void 0});return l.options=e,l}_reCreateView(e){return this._innerView&&(this._innerView._animatingZoom=!1,this._innerView.remove()),e?this._initView(!0,this._options):this._initView(!1)}_isEqualBounds(e,t){let i=!0;if(e&&t&&Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(const r in e)if(e[r]!==t[r]){i=!1;break}}else i=!!(!e&&!t||Array.isArray(e)&&0===e.length&&Array.isArray(t)&&0===t.length);return i}_initViewEvent(){const e=this;this._clickStore=null,this._dragParams={isDrag:!1,origin:null,action:"",button:null},this._innerView.on("click",t=>{e._clickStore=setTimeout(function(){e._clickStore&&e.fire(r.ViewEventType.click,Ue.getMouseEvent(t,e))},300),e.fire(r.ViewEventType.immediateClick,Ue.getMouseEvent(t,e))}),this._innerView.on("contextmenu",t=>{e._clickStore=setTimeout(function(){e._clickStore&&e.fire(r.ViewEventType.click,Ue.getMouseEvent(t,e))},300),e.fire(r.ViewEventType.immediateClick,Ue.getMouseEvent(t,e))}),this._innerView.on("dblclick",t=>{e._clickStore&&(clearTimeout(this._clickStore),e._clickStore=null),e.fire(r.ViewEventType.doubleClick,Ue.getMouseEvent(t,e))}),this._innerView.on("mousedown",t=>{e.fire(r.ViewEventType.pointerDown,Ue.getMouseEvent(t,e)),this._dragParams.isDrag||(this._dragParams.origin={x:t.originalEvent.layerX,y:t.originalEvent.layerY},this._dragParams.button=t.originalEvent.button,this._dragParams.action="mouse-down",this._dragParams.isDrag=!1)}),this._innerView.on("mouseup",t=>{e.fire(r.ViewEventType.pointerUp,Ue.getMouseEvent(t,e)),e._dragParams.isDrag&&"update"===this._dragParams.action&&(this._dragParams.action="end",e.fire(r.ViewEventType.drag,Ue.getDragEvent(t,e,e._dragParams.origin,this._dragParams.action))),e._dragParams={isDrag:!1,origin:null,action:"",button:null}}),this._innerView.on("mousemove",t=>{e.fire(r.ViewEventType.pointerMove,Ue.getMouseEvent(t,e)),e._dragParams.isDrag?(e.fire(r.ViewEventType.drag,Ue.getDragEvent(t,e,e._dragParams.origin,e._dragParams.action,e._dragParams.button)),e._dragParams.action="update"):"mouse-down"===this._dragParams.action&&(this._dragParams.action="start",e._dragParams.isDrag=!0)}),this._innerView.on("dragstart",t=>{""===this._dragParams.action&&t.originalEvent&&(this._dragParams.origin={x:t.originalEvent.layerX,y:t.originalEvent.layerY},this._dragParams.action="start",e.fire(r.ViewEventType.drag,Ue.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)))}),this._innerView.on("drag",t=>{"start"!==e._dragParams.action&&"update"!==e._dragParams.action||(this._dragParams.action="update",e.fire(r.ViewEventType.drag,Ue.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)))}),this._innerView.on("dragend",t=>{"start"!==e._dragParams.action&&"update"!==e._dragParams.action||(this._dragParams.action="end",e.fire(r.ViewEventType.drag,Ue.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)),e._dragParams={origin:null,action:"",button:null})}),this._innerView.on("rotatestart",t=>{""===this._dragParams.action&&t.originalEvent&&(this._dragParams.origin={x:t.originalEvent.layerX,y:t.originalEvent.layerY},this._dragParams.action="start",e.fire(r.ViewEventType.drag,Ue.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)))}),this._innerView.on("rotate",t=>{"start"!==e._dragParams.action&&"update"!==e._dragParams.action||(this._dragParams.action="update",e.fire(r.ViewEventType.drag,Ue.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)))}),this._innerView.on("rotateend",t=>{"start"!==e._dragParams.action&&"update"!==e._dragParams.action||(this._dragParams.action="end",e.fire(r.ViewEventType.drag,Ue.getDragEvent(t,e,this._dragParams.origin,this._dragParams.action)),e._dragParams={origin:null,action:"",button:null})}),this._innerView.on("movestart",()=>{e.stationary=!1}),this._innerView.on("zoom",t=>{e.fire(r.ViewEventType.zoom,{zoom:t.target._zoom,event:t})}),this._innerView.on("zoomend",t=>{e._zoomEndHandler(),e.fire(r.ViewEventType.viewChange,Ue.getViewChangeEvent(t,e))}),this._innerView.on("moveend",t=>{e._moveEndHandler(),e.fire(r.ViewEventType.viewChange,Ue.getViewChangeEvent(t,e)),e.stationary=!0}),this._innerView.on("resize",t=>{const i=Number(e.width),a=Number(e.height);e._initSize(),this._updateMaxBounds(),e.fire(r.ViewEventType.resize,{oldWidth:i,oldHeight:a,width:e.width,height:e.height})}),this._listenKey()}_mapActionControl(e,t){this._innerView&&("drag-pan"===e?t?this._innerView.dragPan.enable():this._innerView.dragPan.disable():"double-click-zoom"===e?t?this._innerView.doubleClickZoom.enable():this._innerView.doubleClickZoom.disable():"drag-rotate"===e&&(t?this._innerView.dragRotate.enable():this._innerView.dragRotate.disable()))}_listenKey(){const e=this,t=this._innerView._canvas;t.setAttribute("tabIndex","-1"),t.onclick=(()=>{t.focus()}),t.addEventListener("keydown",t=>{e.fire(r.ViewEventType.keyDown,Ue.getKeyEvent(t,e))}),t.addEventListener("keyup",t=>{e.fire(r.ViewEventType.keyUp,Ue.getKeyEvent(t,e))})}_initSize(){const e=this._innerView.getCanvas(),t=e.style?e.style.width:e.width,i=e.style?e.style.height:e.height;this.width=Number(t.toString().replace("px","")),this.height=Number(i.toString().replace("px",""))}_updateMaxBounds(){const e=this._getMaxBounds();this._innerView.setMaxBounds(e)}_setCursor(e){this._innerView&&(e&&null!==e?(this._innerView._container.style.cursor=e,this._innerView.getCanvasContainer().style.cursor=e):(this._innerView._container.style.removeProperty("cursor"),this._innerView.getCanvasContainer().style.removeProperty("cursor")),this._cursor=e)}_zoomEndHandler(){this.getExtent(),this.getZoom(),this.getScale(),this.getCenter(),this._updateLayerViewScaleVisible()}getSize(){return{width:this.width,height:this.height}}_moveEndHandler(){this.getCenter(),this.getExtent()}_createLayerViewObj(e){let t=null;return e&&e.autoAddTo2D&&(t=function(e,t){let i=null;switch(t.type){case r.LayerType.IGSMapImage:i=new ge({view:e,layer:t});break;case r.LayerType.IGSTile:i=new ve({view:e,layer:t});break;case r.LayerType.WMS:i=new be({view:e,layer:t});break;case r.LayerType.WMTS:i=new _e({view:e,layer:t});break;case r.LayerType.graphics:i=new Se({view:e,layer:t,render:new xe});break;case r.LayerType.IGSVectorTile:case r.LayerType.ArcGISVectorTile:i=new we({view:e,layer:t});break;case r.LayerType.IGSFeature:i=new Ve({view:e,layer:t});break;case r.LayerType.GeoJSON:i=new Pe({view:e,layer:t});break;case r.LayerType.WFS:i=new ke({view:e,layer:t});break;case r.LayerType.webTile:i=new Oe({view:e,layer:t});break;case r.LayerType.group:i=new Ee({view:e,layer:t});break;case r.LayerType.ECharts:i=new Ie({view:e,layer:t});break;case r.LayerType.MapV:i=new Re({view:e,layer:t});break;case r.LayerType.ArcGISMapImage:i=new De({view:e,layer:t});break;case r.LayerType.ArcGISTile:i=new Ge({view:e,layer:t});break;case r.LayerType.IGSImage:i=new Ne({view:e,layer:t});break;case r.LayerType.IGSImageTile:i=new Fe({view:e,layer:t})}return i}(this,e)),t}_initPopup(){this.popup=new me({view:this})}hitTest(e){if(!this._innerView)return;const t=[],i=this._getInnerStyleLayerIds();return this._innerView.queryRenderedFeatures([e.x,e.y],{layers:i}).forEach(i=>{if(!i.properties||void 0===i.properties.id||!i.layer||!i.layer.id)return;const a=i.source.split("_")[0],n=i.properties.id;let s=this.getLayer(a);if(!s&&this._graphicsLayers&&this._graphicsLayers.allLayers&&this._graphicsLayers.allLayers.items&&(s=this._graphicsLayers.allLayers.items.find(e=>e.id===a)),!s)return;let o=null;if(s.type===r.LayerType.IGSFeature||s.type===r.LayerType.GeoJSON||s.type===r.LayerType.WFS){const e=this._getLayerView(s);e.featureSet&&e.featureSet.features&&(o=e.featureSet.features.filter(e=>{if(e.id===n)return e}))}else if(s.type===r.LayerType.graphics&&s.graphics){o=s.graphics.filter(e=>{if(e.id===n)return e}).items}const l={graphic:o&&o.length>0?o[0]:null,layer:s,mapPoint:this.toMap(e),type:"graphic"};t.push(l)}),t}_getInnerStyleLayerIds(){let e=[];return this._map.allLayers.items.concat(this._graphicsLayers.allLayers.items).forEach(t=>{if(t.type===r.LayerType.IGSFeature||t.type===r.LayerType.GeoJSON){const i=this._getLayerView(t);i&&(e=e.concat(i.getStyleLayerIds()))}else if(t.type===r.LayerType.graphics){const i=this.getInnerLayer(t);i&&i.getStyleLayerIds&&(e=e.concat(i.getStyleLayerIds()))}}),e}toMap(e){if(!e)return;const t=this._innerView.unproject([e.x,e.y]);let i=new r.Point({coordinates:[t.lng,t.lat]});return this._spatialReference&&!this._spatialReference.isGeographic?i=r.Projection.project(i,this._spatialReference):i.spatialReference=this._spatialReference,i}toScreen(e){let t=r.Geometry.fromJSON(e);return t.spatialReference.isGeographic||(t=r.Projection.project(t,new r.SpatialReference({wkid:4326}))),this._innerView.project([t.coordinates[0],t.coordinates[1]])}takeScreenshot(e){e.view=this;let t=null;return this._screenshot?t=this._screenshot._addView():(this._screenshot=new fe(e),t=this._screenshot._addView()),t}flyTo(e,t={animate:!0}){e=Object(r.defaultValue)(e,{});const i=Object(r.defaultValue)(e.zoom,1),a=this._getFlyToCenter(e),n=this._getFlyToExtent(e);if(this._innerView){const e=this._innerView.transform;e.resetZoomScale=!1,a?(this._center=a,this._scale=this._getScaleByZoom(i),this._zoom=void 0,this._innerView.flyTo({center:[a.coordinates[0],a.coordinates[1]],zoom:i})):n&&(this._center=void 0,this._scale=void 0,this._zoom=void 0,this._extent=n,this._innerView.fitBounds([[n.xmin,n.ymin],[n.xmax,n.ymax]],t)),e.resetZoomScale=!0}}goTo(e={},t={}){let i=new Promise(e=>{e(!1)});if(this._innerView){let{center:a,zoom:n,extent:s}=this._getValidGoToParams(e,t);Object(r.isNull)(a)||(this._center=a),Object(r.isNull)(n)||(this._scale=this._getScaleByZoom(n),this._zoom=void 0),Object(r.isNull)(e.scale)||(this._scale=e.scale),Object(r.isNull)(s)||(this._center=void 0,this._scale=void 0,this._zoom=void 0,this._extent=s);const o={animate:!0,duration:200};Object(r.isNull)(t)||(Object(r.isNull)(t.animate)||(o.animate=t.animate),Object(r.isNull)(t.duration)||(o.duration=t.duration));const l=this._innerView.transform;if(l.resetZoomScale=!1,Object(r.isNull)(a)||Object(r.isNull)(n)){if(!Object(r.isNull)(s)){let e=s.xmin,t=s.xmax,r=s.ymin,a=s.ymax;this._fullExtent&&(e<this._fullExtent.xmin&&(e=this._fullExtent.xmin),t>this._fullExtent.xmax&&(t=this._fullExtent.xmax),r<this._fullExtent.ymin&&(r=this._fullExtent.ymin),a>this._fullExtent.ymax&&(a=this._fullExtent.ymax)),isFinite(e)&&isFinite(t)&&isFinite(r)&&isFinite(a)&&(i=new Promise(e=>{this._innerView.fitBounds([[s.xmin,s.ymin],[s.xmax,s.ymax]],o),this._innerView.once("moveend",()=>{e(!0)})}))}}else{let e=a.coordinates[1],t=a.coordinates[0];if(this._fullExtent&&((e>this._fullExtent.ymax||e<this._fullExtent.ymin)&&(e=(this._fullExtent.ymax+this._fullExtent.ymin)/2),(t>this._fullExtent.xmax||t<this._fullExtent.xmin)&&(t=(this._fullExtent.xmax+this._fullExtent.xmin)/2)),isFinite(e)&&isFinite(t)){let r=!1;const s=this._innerView.getCenter();if(n===this._zoom&&e===s.lat&&t===s.lng&&(r=!0),!r){const e={center:[a.coordinates[0],a.coordinates[1]],zoom:n};Object.assign(e,o),i=new Promise(t=>{this._innerView.flyTo(e),this._innerView.once("moveend",()=>{t(!0)})})}}}l.resetZoomScale=!0}return i}getCenter(){if(Object(r.isNull)(this._innerView))return;const e=this._innerView.getCenter();let t=new r.Point({coordinates:[e.lng,e.lat]});this._center=t;const i=this._spatialReference;return i.isGeographic||(t=r.Projection.project(t,i)),t}setCenter(e){this._innerView&&(Array.isArray(e)&&e.length>1?(this._center=new r.Point({coordinates:[e[0],e[1]],spatialReference:this._spatialReference}),this.flyTo({zoom:this._zoom,center:this._center})):e instanceof r.Point&&(this._center=e,this.flyTo({zoom:this._zoom,center:this._center})))}getZoom(){if(!Object(r.isNull)(this._innerView))return this._zoom=this._innerView.getZoom(),this._zoom}setZoom(e){this._innerView&&(this._zoom=e,this.flyTo({zoom:e,center:this._center}))}getExtent(){if(!this._innerView)return;const e=this._innerView.getBounds();if(!e||!e._sw||!e._ne)return;let t=new r.Extent({xmin:e._sw.lng,ymin:e._sw.lat,xmax:e._ne.lng,ymax:e._ne.lat});const i=this._spatialReference;return i.isGeographic||(t=r.Projection.project(t,i)),this._extent=t,t}setExtent(e){this._innerView&&(this._extent=e,this.flyTo({extent:e}))}getScale(){const e=this._getScaleByZoom(this._zoom);return this._scale=e,e}_getScaleByZoom(e){let t;if(this.crs&&this.crs.options&&this.crs.options.lods&&!Object(r.isNull)(e))if(e<0)t=0;else if(e%1==0){t=this.crs.options.lods[e].scale}else{const i=Math.floor(e),r=Math.ceil(e),a=this.crs.options.lods[i],n=this.crs.options.lods[r];t=void 0===a&&void 0===n?0:void 0===a?n.scale:void 0===n?a.scale:Math.pow(2,i)*a.scale/Math.pow(2,e)}return t}_initScale(e){this._scale&&this._scale>0&&(this._zoom=this._getZoomByScale(e))}_getZoomByScale(e){let t=void 0;if(this.crs&&this.crs.options&&this.crs.options.lods){let i=-1;for(let r=0;r<this.crs.options.lods.length;r++){const a=this.crs.options.lods[r],n=this.crs.options.lods[r-1];if(a.scale<=0)break;if(i<0&&(i=r),r===i){if(a.scale>0&&e>=a.scale){t=a.level;break}}else{if(e>=a.scale&&e<=n.scale&&n.scale!==a.scale){t=Math.log2(a.scale*Math.pow(2,a.level)/e);break}if(r===this.crs.options.lods.length-1&&a.scale>0&&e<=a.scale){t=a.level;break}}}}return t}setScale(e){if(!this._innerView)return;const t=this._getZoomByScale(e);t&&this.flyTo({center:this._center,zoom:t})}_getMaxBounds(){if(this._fullExtent){const e=[[this._fullExtent.xmin,this._fullExtent.ymin],[this._fullExtent.xmax,this._fullExtent.ymax]];if(this._innerView)try{const t=Math.max(this._innerView.transform.width,200),i=Math.max(this._innerView.transform.height,200)/t,r=this._innerView.transform,a=r.project({lng:e[0][0],lat:e[1][1]}),n=r.project({lng:e[1][0],lat:e[0][1]}),s=r.project({lng:(e[0][0]+e[1][0])/2,lat:(e[0][1]+e[1][1])/2}),o=n.x-a.x,l=n.y-a.y,c=Math.max(o,l)/2,h=s.x-c,u=s.y-c*i,p=s.x+c,d=s.y+c*i,y=r.unproject({x:h,y:u}),m=r.unproject({x:p,y:d});isFinite(y.lng)&&!isNaN(y.lng)&&(e[0][0]=Math.min(y.lng,e[0][0])),isFinite(m.lat)&&!isNaN(m.lat)&&(e[0][1]=Math.min(m.lat,e[0][1])),isFinite(m.lng)&&!isNaN(m.lng)&&(e[1][0]=Math.max(m.lng,e[1][0])),isFinite(y.lat)&&!isNaN(y.lat)&&(e[1][1]=Math.max(y.lat,e[1][1]))}catch(e){}return e}return null}_isEqualCrs(e,t){let i=!1;if(!e||!t)return i;let a=void 0;e.code.split(":").length>1&&(a=e.code.split(":")[1]);const n=new r.SpatialReference({wkid:a,wkt:e.def});let s=void 0;t.code.split(":").length>1&&(s=t.code.split(":")[1]);const o=new r.SpatialReference({wkid:s,wkt:t.def});return n.equals(o)&&t.options&&e.options&&Object(r.compareObject)(t.options._resolutions,e.options_resolutions)&&Object(r.compareObject)(t.origin,e.origin)&&Object(r.compareObject)(t.extent,e.extent)&&(i=!0),i}_moveLayerView(e,t){let i,r;if(e instanceof Se){i=[];const{_sourceMetaDatas:t}=e.innerLayer;Object.keys(t).forEach(e=>{i.push(t[e].layerId)})}else if(e instanceof Le)i=e.styleLayers.map(e=>e.id);else if(e instanceof we){const t=e.innerLayer||[];i=t.map(e=>e.id)}else i=e.innerLayer.id;if(t instanceof Se){const e=t.innerLayer._getBottomLayer();r=e.layerId}else if(t instanceof Le)t.styleLayers.length>0&&(r=t.styleLayers[0].id);else if(t instanceof we){const e=t.innerLayer||[];e.length>0&&(r=e[0].id)}else r=t.innerLayer.id;e instanceof Se||e instanceof Le||e instanceof we?i.forEach(t=>{e.innerView.moveLayer(t,r)}):e.innerView.moveLayer(i,r)}toJSON(){let e=super.toJSON();return e=Object.assign(e,{extent:Object(r.toJSON)(this._extent,r.Extent),width:this.width,height:this.height,spatialReferenceLocked:this.spatialReferenceLocked})}_getValidGoToParams(e,t){let i,a,n;if(Object(r.isNull)(e.center)&&Object(r.isNull)(e.zoom)&&Object(r.isNull)(e.scale)||(i=Object(r.isNull)(e.center)?this._center:this._getFlyToCenter({center:e.center}),Object(r.isNull)(i)||(a=!Object(r.isNull)(e.scale)&&e.scale>0?this._getZoomByScale(e.scale):Object(r.isNull)(e.zoom)?this._zoom:e.zoom)),!Object(r.isNull)(e.target)||!Object(r.isNull)(e.layer)&&!Object(r.isNull)(e.layer.extent)){const t=this._getTargetExtent(e.target||e.layer.extent);t.xmin!==t.xmax&&t.ymin!==t.ymax?n=t:i=this._getFlyToCenter({center:new r.Point({coordinates:[t.xmin,t.ymin]})})}return{center:i,zoom:a,extent:n}}}Object.defineProperties(Ze.prototype,{scale:{get(){return this.getScale()},set(e){this.setScale(e)}},zoom:{get(){return this.getZoom()},set(e){this.setZoom(e)}},extent:{get(){return this.getExtent()},set(e){this.setExtent(e)}},center:{get(){return this.getCenter()},set(e){this.setCenter(e)}},spatialReference:{get(){return this._spatialReference},set(e){}},rotation:{get(){return this._rotation},set(e){this._rotation=e,this._innerView&&this._innerView.setBearing(e)}}}),Ze.fromJSON=function(e){return e=Object(r.defaultValue)(e,{}),new Ze(e)};var $e=Ze;var qe=class extends r.SketchEditor{constructor(e){super(e)}start(e,t){super.start(e,t)}startCustomDrawTool(e){super.startCustomDrawTool(e)}stop(){super.stop()}remove(){super.remove()}update(e,t){super.updateFeature(e,t)}addVertex(e,t){super.addVertex(e,t)}updateVertex(e,t){super.updateVertex(e,t)}removeVertex(e){super.removeVertex(e)}getSketchDataType(){super.getSketchDataType()}setSketchStyle(e){super.setSketchStyle(e)}getSketchStyle(){return super.getSketchStyle()}getGeometry(){return super.getGeometry()}union(e){return super.union(e)}split(e,t){return super.split(e,t)}drawPolylineToPolygon(e){super.drawPolylineToPolygon(e)}undo(){return super.undo()}redo(){return super.redo()}canUndo(){return super.canUndo()}canRedo(){return super.canRedo()}_hitTestSketchEvent(){const e=this,t=t=>{if(!t||!t.x||!t.y)return;if(e._drawTool&&e._drawTool._editMode===r.SketchEditMode.drawing)return;const i=e._getGraphicsLayer(e._layer),a=e._getGraphicsLayer(e._sketchInnerLayer);if(!i&&!a)return;let n=void 0;const s=e.view.hitTest({x:t.x,y:t.y});if(s&&Array.isArray(s)&&(n=s[0]),n&&(i&&i.id===n.layer.id||a&&a.id===n.layer.id)){const i=this._getCurDrawTool(n.layer.id,n.graphic.id);if(!i||i===e._drawTool&&"drawn"!==i.state)return;this._bindEditMouseEvent(i,t)}};this._hitTestSketchHandler||(this.view.on(r.ViewEventType.mouseDown,t),this._hitTestSketchHandler=t)}_getCurDrawTool(e,t){const i=this;let a=i._drawTool?i._drawTool._getDrawToolByFeatureId(t):void 0;if(!a&&(!i._drawTool||i._drawTool.sketchStage.entityGraphic&&"drawn"===i._drawTool.state)){const n=i.view.getLayer(e).graphics.filter(e=>e.id===t);if(n&&n.items.length>0?n.items[0]:void 0){const e=n.items[0];i._drawTool&&(i._drawTool._clearEditGraphics(i._drawTool._editMode),i._drawTool.fire("selected",{isSelected:!1},i),i._drawTool.view.off(r.ViewEventType.immediateClick,i._drawTool._mapClickEvent),i._drawTool._fireRemoveSelectEvent(i._drawTool.sketchStage.entityGraphic)),this._addFeatureToSketchEditor(e),i._undoRedoManager.reset(),i._drawTools=[i._drawTool],a=i._drawTool}}return a}_bindEditMouseEvent(e,t){const i=this;if(0===e.editOption._hitTestMode){const a=()=>{if(i._editable&&(Object(r.isNull)(i._drawTool)||i._drawTool._editMode!==r.SketchEditMode.drawing)){if(!Object(r.isNull)(e)&&Object(r.isNull)(e._parent)&&e._editMode===r.SketchEditMode.none){i.fire("selected",{isSelected:!0,selectedDrawTool:i._drawTool,selectedGeometry:i._drawTool.sketchStage.entityGraphic.geometry},i);const e=new r.SketchEditorEvent({type:r.SketchEditorEventType.update,target:i,toolEventInfo:null,state:r.SketchEditorState.start,feature:i._drawTool.sketchStage.entityGraphic,geometry:i._drawTool.sketchStage.entityGraphic.geometry});i.fire(r.SketchEditorEventType.update,e)}e._isAddTip&&e._updateTipText(e._tipText.editGraphic,e._sketchInnerLayer,t),e.hitTestFeature(e.sketchStage.entityGraphic,t),i.view.off(r.ViewEventType.mouseUp,a)}};i.view.on(r.ViewEventType.mouseUp,a)}else{if(!i._editable)return;if(void 0!==i._drawTool&&null!==i._drawTool&&i._drawTool._editMode===r.SketchEditMode.drawing)return;e._parent&&e._parent._isAddTip&&e._parent._updateTipText(e._parent._tipText.editVertex,e._parent._sketchInnerLayer),e.hitTestFeature(e.sketchStage.entityGraphic,t)}}_removeHitTestSketchEvent(){this.view.off(r.ViewEventType.mouseDown,this._hitTestSketchHandler)}_getCenterCoordinate(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}};i.d(t,"MapViewMapboxgl",function(){return $e}),i.d(t,"MapView",function(){return $e}),i.d(t,"SketchEditorMapboxgl",function(){return qe}),i.d(t,"SketchEditor",function(){return qe}),i.d(t,"mapboxCustomCRS",function(){return d}),i.d(t,"initializeOptions",function(){return ae}),i.d(t,"addStyleToMapboxglMap",function(){return ne}),i.d(t,"MapVLayer",function(){return H}),i.d(t,"EchartsLayer",function(){return re}),i.d(t,"initializeCRS",function(){return se}),i.d(t,"Popup",function(){return me}),i.d(t,"Screenshot",function(){return fe}),r.Zondy.mapboxCustomCRS=d,r.zondy.mapboxgl={},r.zondy.mapboxgl.VERSION="17.6.1",r.zondy.mapboxgl.MapView=$e,r.zondy.mapboxgl.layer={},r.zondy.mapboxgl.layer.MapVLayer=H,r.zondy.mapboxgl.layer.EchartsLayer=re,r.zondy.mapboxgl.tool={},r.zondy.mapboxgl.tool.sketch={},r.zondy.mapboxgl.tool.sketch.SketchEditor=qe,r.zondy.mapboxgl.tool.Screenshot=fe,r.zondy.mapboxgl.widget={},r.zondy.mapboxgl.widget.Popup=me,r.zondy.mapboxgl.util={},r.zondy.mapboxgl.util.initializeOptions=ae,r.zondy.mapboxgl.util.addStyleToMapboxglMap=ne,r.zondy.mapboxgl.util.initializeCRS=se,r.zondy.mapboxgl.util.mapboxCustomCRS=d,r.Zondy.PluginVersion=r.zondy.mapboxgl.VERSION,r.Zondy.mapboxCustomCRS=d}]);
|