UNPKG

maptalks-gl

Version:

All-in-one package for maptalks webgl layers

18 lines (17 loc) 2.54 MB
/*! * maptalks-gl v0.112.1 * LICENSE : MIT * (c) 2016-2025 maptalks.com */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).maptalks=t.maptalks||{})}(this,(function(t){"use strict"; /*! * maptalks v1.4.1 * LICENSE : BSD-3-Clause * (c) 2016-2025 maptalks.org */var e="1.4.1",n="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];function i(){return"undefined"!=typeof globalThis?globalThis:global||self}function o(t){var e=i().maptalksversion;if(e)throw new Error("Disallow duplicate imports of maptalks version "+t+" and "+e);i().maptalksversion=t}var s={isTest:!1,idleLog:!1,idleForceTimeThreshold:48,workerCount:i().MAPTALKS_WORKER_COUNT||0,messagePostRatioPerWorker:.3,maxFPS:0,crsMaxNativeZoom:22};function a(){return Date.now()}function l(t,...e){for(var n=0;n<e.length;n++){var i=e[n];for(var o in i)t[o]=i[o]}return t}function h(t){return null==t}function c(t){return"number"==typeof t&&!isNaN(t)}function u(t){return(0|t)===t}function f(t){return"object"==typeof t&&!!t}function g(t){return!h(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function m(t){return!h(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}var A=Object.prototype.hasOwnProperty;function w(t,e){return A.call(t,e)}var T=Math.PI/180;function M(t){return t*T}function C(t){return t/T}var P={};function I(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!n){var O=navigator.userAgent.toLowerCase(),E=document.documentElement||{style:{}},D="ActiveXObject"in window,N=-1!==O.indexOf("webkit"),H=-1!==O.indexOf("phantom"),U=-1!==O.search("android [23]"),W=-1!==O.indexOf("chrome"),q=-1!==O.indexOf("gecko")&&!N&&!window.opera&&!D,X=/iphone/i.test(O)&&/micromessenger/i.test(O),J="undefined"!=typeof orientation||-1!==O.indexOf("mobile"),Q=!window.PointerEvent&&window.MSPointerEvent,Y=window.PointerEvent&&navigator.pointerEnabled||Q,K=D&&"transition"in E.style,$="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!U,tt="MozPerspective"in E.style,et="OTransition"in E.style,nt=(K||$||tt)&&!et&&!H,rt="undefined"!=typeof window&&m(window.createImageBitmap),it="undefined"!=typeof window&&m(window.ResizeObserver),ot="undefined"!=typeof window&&m(window.btoa),st="undefined"!=typeof window&&m(window.Proxy),at="undefined"!=typeof window&&m(window.requestIdleCallback),ut="undefined"!=typeof CanvasRenderingContext2D&&m(CanvasRenderingContext2D.prototype.roundRect),ft=0;W&&(ft=O.match(/chrome\/([\d.]+)/)[1]);var gt=!H&&(Y||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),vt="undefined"!=typeof window&&"WebGLRenderingContext"in window,xt=I(),bt=!1;try{new OffscreenCanvas(2,2).getContext("2d"),bt=!0}catch(t){bt=!1}var Ct=!1;try{var Ot=Object.defineProperty({},"passive",{get:function(){Ct=!0}});window.addEventListener("testPassive",null,Ot),window.removeEventListener("testPassive",null,Ot)}catch(lE){}(P={IS_NODE:n,isTest:!1,ie:D,ielt9:D&&!document.addEventListener,edge:"msLaunchUri"in navigator&&!("documentMode"in document),webkit:N,gecko:q,android:-1!==O.indexOf("android"),android23:U,chrome:W,chromeVersion:ft,safari:!W&&-1!==O.indexOf("safari"),phantomjs:H,ie3d:K,webkit3d:$,gecko3d:tt,opera12:et,any3d:nt,iosWeixin:X,mobile:J,mobileWebkit:J&&N,mobileWebkit3d:J&&$,mobileOpera:J&&window.opera,mobileGecko:J&&q,touch:!!gt,msPointer:!!Q,pointer:!!Y,retina:xt>1,devicePixelRatio:xt,language:navigator.browserLanguage?navigator.browserLanguage:navigator.language,ie9:D&&9===document.documentMode,ie10:D&&10===document.documentMode,webgl:vt,imageBitMap:rt,roundRect:ut,resizeObserver:it,btoa:ot,decodeImageInWorker:bt,monitorDPRChange:!0,supportsPassive:Ct,proxy:st,requestIdleCallback:at,checkDevicePixelRatio:function(){if("undefined"!=typeof window&&P.monitorDPRChange){var t=I(),e=t!==P.devicePixelRatio;return e&&(P.devicePixelRatio=t),e}return!1}}).roundRect||console.warn("current env the canvas not support roundRect")}var Gt=P;function $t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function ne(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function re(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,ge(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function oe(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return $t(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$t(t,e):void 0}}(t))||e){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ae(t){return ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ae(t)}function he(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,fe(t,e)}function ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ce=function(){return!!t})()}function ue(){ue=function(){return e};var t,e={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function u(t,e,n,i){var s=Object.create((e&&e.prototype instanceof M?e:M).prototype),a=new J(i||[]);return o(s,"_invoke",{value:U(t,n,a)}),s}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=u;var g="suspendedStart",m="suspendedYield",A="executing",w="completed",T={};function M(){}function C(){}function P(){}var I={};c(I,a,(function(){return this}));var O=Object.getPrototypeOf,E=O&&O(O(Q([])));E&&E!==n&&i.call(E,a)&&(I=E);var D=P.prototype=M.prototype=Object.create(I);function N(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function H(t,e){function n(o,s,a,l){var h=f(t[o],t,s);if("throw"!==h.type){var c=h.arg,u=c.value;return u&&"object"==typeof u&&i.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,a,l)}),(function(t){n("throw",t,a,l)})):e.resolve(u).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,l)}))}l(h.arg)}var s;o(this,"_invoke",{value:function(t,i){function o(){return new e((function(e,o){n(t,i,e,o)}))}return s=s?s.then(o,o):o()}})}function U(e,n,i){var o=g;return function(s,a){if(o===A)throw Error("Generator is already running");if(o===w){if("throw"===s)throw a;return{value:t,done:!0}}for(i.method=s,i.arg=a;;){var l=i.delegate;if(l){var h=W(l,i);if(h){if(h===T)continue;return h}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===g)throw o=w,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=A;var c=f(e,n,i);if("normal"===c.type){if(o=i.done?w:m,c.arg===T)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(o=w,i.method="throw",i.arg=c.arg)}}}function W(e,n){var i=n.method,o=e.iterator[i];if(o===t)return n.delegate=null,"throw"===i&&e.iterator.return&&(n.method="return",n.arg=t,W(e,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),T;var s=f(o,e.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,T;var a=s.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,T):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,T)}function q(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function X(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function J(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(q,this),this.reset(!0)}function Q(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,s=function n(){for(;++o<e.length;)if(i.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}throw new TypeError(typeof e+" is not iterable")}return C.prototype=P,o(D,"constructor",{value:P,configurable:!0}),o(P,"constructor",{value:C,configurable:!0}),C.displayName=c(P,h,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===C||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,P):(t.__proto__=P,c(t,h,"GeneratorFunction")),t.prototype=Object.create(D),t},e.awrap=function(t){return{__await:t}},N(H.prototype),c(H.prototype,l,(function(){return this})),e.AsyncIterator=H,e.async=function(t,n,i,o,s){void 0===s&&(s=Promise);var a=new H(u(t,n,i,o),s);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},N(D),c(D,h,"Generator"),c(D,a,(function(){return this})),c(D,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var i in e)n.push(i);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=Q,J.prototype={constructor:J,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(X),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(i,o){return l.type="throw",l.arg=e,n.next=i,o&&(n.method="next",n.arg=t),!!o}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],l=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var h=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(h&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(h){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var s=o;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,T):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),T},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),X(n),T}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var o=i.arg;X(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:Q(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),T}},e}function fe(t,e){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fe(t,e)}function ge(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function pe(t){var e="function"==typeof Map?new Map:void 0;return pe=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(ce())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,e);var o=new(t.bind.apply(t,i));return n&&fe(o,n.prototype),o}(t,arguments,ae(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),fe(n,t)},pe(t)}var me,Ae,ye=function(){function t(t,e,n){if(h(t)||h(e)?h(t.x)||h(t.y)?Array.isArray(t)&&(this.x=+t[0],this.y=+t[1],this.z=t[2]):(this.x=+t.x,this.y=+t.y,this.z=t.z):(this.x=+t,this.y=+e,this.z=n),this._isNaN())throw new Error("Position is NaN")}var e=t.prototype;return e.set=function(t,e,n){return this.x=t,this.y=e,this.z=n||0,this},e._abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e._round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e._ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.distanceTo=function(t){var e=t.x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)},e.mag=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e._floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e._add=function(t,e){return h(t.x)?h(t[0])?(this.x+=t,this.y+=e):(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e._sub=function(t,e){return h(t.x)?h(t[0])?(this.x-=t,this.y-=e):(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e._substract=function(t,e){return c(e)?this._sub(t,e):this._sub(t)},e.substract=function(t,e){return this.sub(t,e)},e._multi=function(t){return this.x*=t,this.y*=t,this},e.div=function(t){return this.multi(1/t)},e._div=function(t){return this._multi(1/t)},e._isNaN=function(){return isNaN(this.x)||isNaN(this.y)||c(this.z)&&isNaN(this.z)},e.isZero=function(){return 0===this.x&&0===this.y},e.toArray=function(){return c(this.z)?[this.x,this.y,this.z]:[this.x,this.y]},e.toJSON=function(){var t={x:this.x,y:this.y};return c(this.z)&&(t.z=this.z),t},t}(),_e=function(t){function e(){return t.apply(this,arguments)||this}he(e,t);var n=e.prototype;return n.closeTo=function(t,e){return e||(e=0),this.x>=t.x-e&&this.x<=t.x+e&&this.y>=t.y-e&&this.y<=t.y+e},n.unit=function(){return this.copy()._unit()},n._unit=function(){return this._div(this.mag()),this},n.perp=function(){return this.copy()._perp()},n._perp=function(){return[this.x,this.y]=[-this.y,this.x],this},n.angleWith=function(t){return this.angleWithSep(t.x,t.y)},n.angleWithSep=function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},n._rotate=function(t){var e=Math.cos(t),n=Math.sin(t),i=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=i,this},n.rotate=function(t){return this.copy()._rotate(t)},n.abs=function(){return new e(Math.abs(this.x),Math.abs(this.y))},n.round=function(){return new e(Math.round(this.x),Math.round(this.y))},n.ceil=function(){return new e(Math.ceil(this.x),Math.ceil(this.y))},n.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y))},n.copy=function(){return new e(this.x,this.y,this.z)},n.toFixed=function(t){return new e(this.x.toFixed(t),this.y.toFixed(t),c(this.z)?this.z.toFixed(t):void 0)},n.add=function(t,n){var i,o;return h(t.x)?h(t[0])?(i=this.x+t,o=this.y+n):(i=this.x+t[0],o=this.y+t[1]):(i=this.x+t.x,o=this.y+t.y),new e(i,o)},n.sub=function(t,n){var i,o;return h(t.x)?h(t[0])?(i=this.x-t,o=this.y-n):(i=this.x-t[0],o=this.y-t[1]):(i=this.x-t.x,o=this.y-t.y),new e(i,o)},n.multi=function(t){return new e(this.x*t,this.y*t)},n.equals=function(t){return t instanceof this.constructor&&(this.x===t.x&&this.y===t.y&&this.z===t.z)},e}(ye);function ve(t){var e="data:image/svg+xml";return t.length>4&&".svg"===t.slice(-4)?1:t.slice(0,18)===e?2:0}function xe(t,e){n&&xe.node?xe.node(t,e):t.src=e[0]}!function(){if(n)return me=function(t){return setTimeout(t,16)},void(Ae=clearTimeout);me=function(t){return requestAnimationFrame(t)},Ae=function(t){return cancelAnimationFrame(t)}}();var be=0;function we(){return be++}var Me=we;function Ee(t){return t&&g(t)?JSON.parse(t):t}function ke(...t){for(var e=t[0],n=1;n<t.length;n++){var i=t[n];if(i&&i.length)for(var o=0,s=i.length;o<s;o++)e.push(i[o])}return e.length}function Re(...t){for(var e=[],n=-1,i=0;i<t.length;i++){var o=t[i];if(o&&o.length)for(var s=0,a=o.length;s<a;s++)e[++n]=o[s]}return e}function Le(t,e){var n=e.indexOf(t);n>-1&&e.splice(n,1)}function Fe(t,e,n){if(!Array.isArray(t))return n?e.call(n,t):e(t);for(var i,o,s=[],a=0,l=t.length;a<l;a++)h(i=t[a])?s.push(null):Array.isArray(i)?s.push(Fe(i,e,n)):(o=n?e.call(n,i):e(i),s.push(o));return s}function He(t,e){return void 0===t?e:t}function Ge(t){return Math.sign?Math.sign(t):0===(t=+t)||isNaN(t)?Number(t):t>0?1:-1}function Ue(t,e,n){return t*(1-n)+e*n}function We(t,e,n){if(t===n||t===e)return t;var i=n-e;return((t-e)%i+i)%i+e}function qe(t,e,n){return Math.min(n,Math.max(e,t))}function Je(t){return Array.isArray(t)&&t.length>0}var Qe=/^([a-z][a-z\d+\-.]*:)?\/\//i;function Ye(t){return Qe.test(t)}var Ke=/^url\((['"])(.+)\1\)$/i,tn=/^url\(([^'"].*[^'"])\)$/i;function nn(t){return g(t)?tn.test(t)?1:Ke.test(t)?2:3:0}function rn(t){var e=nn(t);return 3===e?t:1===e?tn.exec(t)[1]:2===e?Ke.exec(t)[2]:t}var on="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function un(t){if(Gt.btoa)return window.btoa(t);for(var e,n,i=String(t),o="",s=0,a=on;i.charAt(0|s)||(a="=",s%1);o+=a.charAt(63&e>>8-s%1*8)){if((n=i.charCodeAt(s+=3/4))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");e=e<<8|n}return o}function pn(t,e){for(var n=atob(t),i=new ArrayBuffer(n.length),o=new Uint8Array(i),s=0;s<n.length;s++)o[s]=255&n.charCodeAt(s);return new Blob([i],{type:e})}function yn(t,e,n,i){return Math.atan2(i-e,n-t)}var vn="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";function xn(t,e){if(!t&&!e)return!0;if(!t||!e)return!1;for(var n in t)if("center"===n){if(!e[n]||!Tn(t[n][0],e[n][0])||!Tn(t[n][1],e[n][1]))return!1}else if(t[n]!==e[n])return!1;return!0}function Tn(t,e,n){return null==n&&(n=1e-6),t>=e-n&&t<=e+n}function Mn(t=100,e=4,n=null,i=null){t||(t=100),e||(e=4);var o=this,s=this.isVisible();return e*=2,this._flashTimeout&&clearTimeout(this._flashTimeout),this._flashTimeout=setTimeout((function a(){if(0===e)return s?o.show():o.hide(),void(n&&(i?n.call(i):n()));e%2==0?o.hide():o.show(),e--,o._flashTimeout=setTimeout(a,t)}),t),this}function Pn(t=[],e="_pt"){for(var n=[],i=0,o=t.length;i<o;i++){var s=t[i];if(s){s[e]||(s[e]=new _e(0,0));var a=s[e];a.x=0,a.y=0,n.push(a)}else n.push(null)}return n}function On(t,e){e(t.data)}function En(t){if(t&&0===t.indexOf("http://")||0===t.indexOf("https://"))return t;var e=document.createElement("a");return e.href=t,t=e.href,e=null,t}var Ln={cssWidth:"1px",cssHeight:"1px",width:1,height:1};function Dn(t,e=1){var{width:n,height:i}=t;return Ln.cssWidth=n+"px",Ln.cssHeight=i+"px",Ln.width=Math.round(n*e),Ln.height=Math.round(i*e),Ln}var Fn="_maptalks__internal_layer_",Nn=["MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"],Hn=["FeatureCollection","Feature","Point","LineString","Polygon"].concat(Nn),Bn=["markerFile","polygonPatternFile","linePatternFile","markerFillPatternFile","markerLinePatternFile"],zn=[["markerWidth","markerHeight"],[],[null,"lineWidth"],[],[null,"markerLineWidth"]],Gn={lineWidth:1,lineOpacity:1,lineDx:1,lineDy:1,polygonOpacity:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerOpacity:1,markerFillOpacity:1,markerLineWidth:1,markerLineOpacity:1,textSize:1,textOpacity:1,textHaloRadius:1,textWrapWidth:1,textLineSpacing:1,textDx:1,textDy:1},Vn=["lineColor","polygonFill","markerFill","markerLineColor","textFill"],Wn=14,qn=function(){function t(t,e){c(t)&&c(e)?(this.width=t,this.height=e):c(t.width)?(this.width=t.width,this.height=t.height):Array.isArray(t)&&(this.width=t[0],this.height=t[1])}var e=t.prototype;return e.copy=function(){return new t(this.width,this.height)},e.add=function(e,n){var i,o;return e instanceof t?(i=this.width+e.width,o=this.height+e.height):(i=this.width+e,o=this.height+n),new t(i,o)},e.equals=function(t){return this.width===t.width&&this.height===t.height},e.multi=function(e){return new t(this.width*e,this.height*e)},e._multi=function(t){return this.width*=t,this.height*=t,this},e._round=function(){return this.width=Math.round(this.width),this.height=Math.round(this.height),this},e.toPoint=function(){return new _e(this.width,this.height)},e.toArray=function(){return[this.width,this.height]},e.toJSON=function(){return{width:this.width,height:this.height}},t}(),Jn="";function Yn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Kn(t,e,n){if(!t)return t;for(;t.indexOf(e)>-1;)t=t.replace(e,n);return t}var $n=/[\b\t\r\v\f]/gim;function tr(t){return g(t)?t.replace($n,Jn):t}function er(t){return Yn(t).split(/\s+/)}var nr="undefined"!=typeof document?document.createElement("canvas").getContext("2d"):null;function or(t,e){return or.node?or.node(t,e):(nr.font=e,nr.measureText(t).width)}function sr(t,e,n){var i=or(t,e);return new qn(i,n||Wn)}function ar(t,e,n,i){if(!t||0===t.length)return[{text:"",width:0}];var o=h(i)?or(t,e):i,s=o/t.length,a=Math.floor(n/s/2);if(s>=n||a<=0)return[{text:"",width:n}];if(o<=n)return[{text:t,width:o}];for(var l=[],c=t.substring(0,a),u=s*a,f=a,g=t.length;f<g;f++){var m=t[f],A=or(c+m);A>=n?(l.push({text:c,width:u}),c=t.substring(f,a+f),f+=a-1,u=s*a):(c+=m,u=A),f>=g-1&&(u=or(c),l.push({text:c,width:u}))}return l}var lr=["{","}"];function hr(t,e){if(!g(t))return t;var[n,i]=lr;if(-1===t.indexOf(n)&&-1===t.indexOf(i))return t;function o(t){if(!e)return Jn;var n=e[t];return h(n)?Jn:Array.isArray(n)?n.join():n}for(var s=function(t){t+=Jn;for(var[e,n]=lr,i=[],o=!1,s=Jn,a=0,l=t.length;a<l;a++){var h=t[a];o||h!==e||(o=!0),h===e&&o&&(s=Jn),o&&h!==e&&h!==n&&(s+=h),h===n&&s&&(o=!1,i.push(s),s=Jn)}return i}(t),a=0,l=s.length;a<l;a++){var c=s[a];t=Kn(t,""+n+c+i,o(c))}return t}function cr(t,e){c(t)&&(t+="");var n=e.textMaxHeight||0,i=_r(t=t||"",e);return n&&n<i.size.height&&(i.size.height=n),i}function fr(t,e,n){var i=t.width,o=t.height;return new _e("left"===e?-i:"right"===e?0:-i/2,"top"===n?-o:"bottom"===n?0:-o/2)}var gr="sans-serif",mr=14;function yr(t){if(t.textFont)return t.textFont;var e=t.textSize;return h(e)&&(e=mr),(t.textStyle&&"normal"!==t.textStyle?t.textStyle+" ":"")+(t.textWeight&&"normal"!==t.textWeight?t.textWeight+" ":"")+e+"px "+(t.textFaceName&&function(t){for(var e=t.split(","),n=0;n<e.length;n++)e[n].trim&&(e[n]=e[n].trim()),e[n].indexOf(" ")>0&&'"'!==e[n][0]&&"'"!==e[n][0]&&(e[n]='"'+e[n]+'"');return e.join(",")}(t.textFaceName)||gr)}function _r(t,e){var n=yr(e),i=e.textLineSpacing||0,o=sr(t,n,e.textSize),s=o.width,a=o.height,l=e.textWrapCharacter||"\n",h=[],c=e.textWrapWidth;(!c||c>s)&&(c=s),g(t)||(t+="");var u=0;if(l&&t.indexOf(l)>=0)for(var f=t.split(l),m=0,A=f.length;m<A;m++){var w=f[m],T=or(w,n);if(T>c)for(var M=ar(w,n,c,T),C=0,P=M.length;C<P;C++){var I=M[C].width;I>u&&(u=I),h.push({text:M[C].text,size:new qn(I,a)})}else T>u&&(u=T),h.push({text:w,size:new qn(T,a)})}else if(s>c)for(var O=ar(t,n,c,s),E=0;E<O.length;E++){var D=O[E].width;D>u&&(u=D),h.push({text:O[E].text,size:new qn(D,a)})}else s>u&&(u=s),h.push({text:t,size:o});var N=h.length;return{total:N,size:new qn(u,a*N+i*(N-1)),rows:h,rawSize:o}}function vr(t){var e=0,n=t&&t.length||0;if(!n)return e;for(var i=0;i<n;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return e}var br=Object.freeze({__proto__:null,DEFAULT_FONT:gr,DEFAULT_TEXTSIZE:mr,EMPTY_STRING:Jn,describeText:cr,escapeSpecialChars:tr,getAlignPoint:fr,getFont:yr,hashCode:vr,replaceAll:Kn,replaceVariable:hr,splitContent:ar,splitTextToRow:_r,splitWords:er,stringLength:sr,stringWidth:or,trim:Yn}),Ir=n?function(t){return t[0]}:function(t){for(var e=document.documentElement&&document.documentElement.style||{},n=0;n<t.length;n++)if(t[n]in e)return t[n];return!1},Or=Ir(["transform","WebkitTransform","OTransform","MozTransform","msTransform"]),Er=Ir(["transformOrigin","WebkitTransformOrigin","OTransformOrigin","MozTransformOrigin","msTransformOrigin"]),kr=Ir(["transition","WebkitTransition","OTransition","MozTransition","msTransition"]),Rr=Ir(["filter","WebkitFilter","OFilter","MozFilter","msFilter"]);function Lr(t,e){var n=document.createElement(t);return e&&$r(n,e),n}function Dr(t,e,n){var i=Lr(t);return e&&Qr(i,e),n&&n.appendChild(i),i}function Fr(t){if(!t)return this;if(Gt.ielt9||Gt.ie9){var e=Lr("div");e.appendChild(t),e.innerHTML="",e=null}else t.parentNode&&t.parentNode.removeChild(t);return this}function Nr(t,e,n,i){if(!(t&&t.addEventListener&&e&&n))return this;for(var o=function(e){e||(e=window.event),n.call(i||t,e)},s=e.split(" "),a=s.length-1;a>=0;a--){var l=s[a];if(l)t["Z__"+l]||(t["Z__"+l]=[]),zr(t,l,n)>=0&&(console.warn(t,"find '"+l+"' handler:",n," The old listener function will be removed"),Br(t,l,n)),t["Z__"+l].push({callback:o,src:n}),t.addEventListener(l,o,!!Gt.supportsPassive&&{capture:!1,passive:!1})}return this}function Br(t,e,n){function i(e,n){"mousewheel"===e&&Gt.gecko&&(e="DOMMouseScroll"),t.removeEventListener(e,n,!1)}if(!t||!t.removeEventListener||!e)return this;for(var o=e.split(" "),s=o.length-1;s>=0;s--){var a=o[s];if(a){if(!n&&t["Z__"+a]){for(var l=t["Z__"+a],h=0,c=l.length;h<c;h++)i(l[h].callback);return delete t["Z__"+a],this}var u=zr(t,a,n);if(u<0)return this;i(a,t["Z__"+a][u].callback),t["Z__"+a].splice(u,1)}}return this}function zr(t,e,n){if(!t||!t["Z__"+e]||!n)return-1;for(var i=t["Z__"+e],o=0,s=i.length;o<s;o++)if(i[o].src===n)return o;return-1}function Gr(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ur(t){return t._cancelBubble=!0,t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,this}function Wr(t){return t.onselectstart=function(){return!1},t.ondragstart=function(){return!1},t.setAttribute("unselectable","on"),this}function Zr(t,e){return t?(Gt.any3d?ri(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px"),e):null}function qr(t){var e=window.getComputedStyle(t),n=[parseInt(e["padding-left"]),parseInt(e["padding-top"])],i=t.getBoundingClientRect(),o=t.offsetWidth,s=t.offsetHeight;return t.__position=[i.left+n[0],i.top+n[1],o?i.width/o:1,s?i.height/s:1],t.__position}function Jr(t,e){t||(t=window.event);var n=e.__position;n||(n=qr(e));var i=t;return i.touches&&i.touches.length&&(t=i.touches[0]),i.changedTouches&&i.changedTouches.length&&(t=i.changedTouches[0]),new _e((t.clientX-n[0]-e.clientLeft)/n[2],(t.clientY-n[1]-e.clientTop)/n[3])}function Qr(t,e){var n=t.style.cssText;return function(t,e){var n=t.length-e.length;return n>=0&&t.indexOf(e,n)===n}(n,";")||(n+=";"),t.style.cssText=n+e,this}function Yr(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=ei(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)}function Kr(t,e){if(void 0===t.classList||Yr(t,e)){var n=ei(t);$r(t,(n?n+" ":"")+e)}else for(var i=er(e),o=0,s=i.length;o<s;o++)t.classList.add(i[o]);return this}function $r(t,e){return h(t.className.baseVal)?t.className=e:t.className.baseVal=e,this}function ei(t){return h(t.className.baseVal)?t.className:t.className.baseVal}function ri(t,e){var n=e||new _e(0,0);return t.style[Or]=Gt.any3d?"translate3d("+n.x+"px,"+n.y+"px,0px)":"translate("+n.x+"px,"+n.y+"px)",this}function oi(t){return/<[a-z\][\s\S]*>/i.test(t)}function ai(t,e){var n=li(t);g(e)?n.innerHTML=e:n.appendChild(e);var i=new qn(n.clientWidth,n.clientHeight);return Fr(n),i}function li(t){var e=document.createElement(t);return e.style.cssText="position:absolute;left:-10000px;top:-10000px;",document.body.appendChild(e),e}var ci=Nr,ui=Br;function fi(t){return t&&("mousemove"===t||"touchmove"===t)}function di(t,e){var n=a();return!!(t._mousemoveTime&&n-t._mousemoveTime<(e||48))||(t._mousemoveTime=n,!1)}var gi=Object.freeze({__proto__:null,CSSFILTER:Rr,MOUSEMOVE_THROTTLE_TIME:48,TRANSFORM:Or,TRANSFORMORIGIN:Er,TRANSITION:kr,addClass:Kr,addDomEvent:Nr,computeDomPosition:qr,createEl:Lr,createElOn:Dr,getClass:ei,getDomRuler:li,getEventContainerPoint:Jr,hasClass:Yr,isHTML:oi,isMousemoveEventBlocked:di,isMoveEvent:fi,listensDomEvent:zr,measureDom:ai,off:ui,offsetDom:Zr,on:ci,preventDefault:Gr,preventSelection:Wr,removeDomEvent:Br,removeDomNode:Fr,removeTransform:function(t){return t.style[Or]&&(t.style[Or]=""),this},setClass:$r,setOpacity:function(t,e){return t.style.opacity=e,this},setStyle:Qr,setTransform:ri,setTransformMatrix:function(t,e){var n="matrix("+(g(e)?e:e.join())+")";return t.style[Or]!==n&&(t.style[Or]=n),this},stopPropagation:Ur}),pi={jsonp:function(t,e){var n="_maptalks_jsonp_"+we();t.match(/\?/)?t+="&callback="+n:t+="?callback="+n;var i=document.createElement("script");return i.type="text/javascript",i.src=t,window[n]=function(t){e(null,t),document.getElementsByTagName("head")[0].removeChild(i),i=null,delete window[n]},document.getElementsByTagName("head")[0].appendChild(i),this},get:function(t,e,i){if(m(e)){var o=i;i=e,e=o}if(n&&pi.get.node)return pi.get.node(t,i,e);var s=pi._getClient(i);if(s.open("GET",t,!0),e){for(var a in e.headers)s.setRequestHeader(a,e.headers[a]);s.withCredentials="include"===e.credentials,e.responseType&&(s.responseType=e.responseType)}return s.send(null),s},post:function(t,e,i){var o;if(g(t)){if(m(e)){var s=i;i=e,e=s}o=(e=e||{}).postData}else{o=e,t=(e=t).url,i=i}if(n&&pi.post.node)return e.url=t,pi.post.node(e,o,i);var a=pi._getClient(i);if(a.open("POST",e.url,!0),e.headers||(e.headers={}),e.headers["Content-Type"]||(e.headers["Content-Type"]="application/x-www-form-urlencoded"),"setRequestHeader"in a)for(var l in e.headers)e.headers.hasOwnProperty(l)&&a.setRequestHeader(l,e.headers[l]);return g(o)||(o=JSON.stringify(o)),a.send(o),a},_wrapCallback:function(t,e){return function(){4===t.readyState&&(200===t.status?"arraybuffer"===t.responseType?0===t.response.byteLength?e(new Error("http status 200 returned without content.")):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")}):e(null,t.responseText):e(new Error(t.statusText+","+t.status)))}},_getClient:function(t){var e;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return e.onreadystatechange=pi._wrapCallback(e,t),e},getArrayBuffer:function(t,e,n){if(m(e)){var i=n;n=e,e=i}return e||(e={}),e.responseType="arraybuffer",pi.get(t,e,n)},getImage:function(t,e,n){return pi.getArrayBuffer(e,n,(function(e,n){if(e)t.onerror&&t.onerror(e);else if(n){var i=window.URL||window.webkitURL,o=t.onload;t.onload=function(){o&&o(),i.revokeObjectURL(t.src)};var s=new Blob([new Uint8Array(n.data)],{type:n.contentType});t.cacheControl=n.cacheControl,t.expires=n.expires,t.src=n.data.byteLength?i.createObjectURL(s):vn}}))},getJSON:function(t,e,n){}};pi.getJSON=function(t,e,n){if(m(e)){var i=n;n=e,e=i}var o=function(t,e){var i=e?Ee(e):null;n(t,i)};return e&&e.jsonp?pi.jsonp(t,o):pi.get(t,e,o)};var Ai="",yi=/data:image\/.*;base64,/;function _i(t,e={}){for(var n in e){var i=e[n];if(i&&i.target&&(a=n,c(s=t)&&(s+=Ai),c(a)&&(a+=Ai),s&&a&&(s.includes?s.includes(a):s.indexOf(a)>-1))){var{target:o}=i;return t.replace(n,o)}}var s,a;return Ai}var vi,xi={host:Ai,resources:{},proxy:{},origin:{},fromJSON:function(t){try{g(t)&&(t=JSON.parse(t)),f(t)&&l(xi,t)}catch(t){console.error(t)}},toJSON:function(){return{host:xi.host,proxy:l({},xi.proxy||{}),origin:l({},xi.origin||{})}},getResource:function(t){return xi.resources[t]},removeResource:function(t){delete xi.resources[t]},addResource:function(t,e){xi.resources[t]?console.warn(t+" resource Already exists,the "+t+" Cannot be added,the resource name Cannot repeat "):xi.resources[t]=e},updateResource:function(t,e){xi.resources[t]=e},allResource:function(){return xi.resources},loadSprite:function(t={imgUrl:"",jsonUrl:""}){return new Promise((function(e,n){var{imgUrl:i,jsonUrl:o}=t;if(!i||!o)return n(new Error("not find imgUrl/jsonUrl from options")),void console.error(t);function s(t,e,n){t.width=e,t.height=n;var i=t.getContext("2d");return i.clearRect(0,0,e,n),i}function a(i={},o){var a=function(){var t;return Gt.IS_NODE?console.error("Current environment does not support canvas dom"):t=Lr("canvas"),t}();if(a){var l=[];for(var h in i){l.push({name:h,spriteItem:i[h]})}var c=function(){var t;return Gt.decodeImageInWorker&&(t=new OffscreenCanvas(2,2)),t}(),u=t.sourceName||"";l.forEach((function(t){var e,{name:n,spriteItem:i}=t,{x:l,y:h,width:f,height:g}=i;c?(s(c,f,g).drawImage(o,l,h,f,g,0,0,f,g),e=c.transferToImageBitmap()):(s(a,f,g).drawImage(o,l,h,f,g,0,0,f,g),e=a.toDataURL());t.resource=e,xi.addResource(u+n,e)})),e(l)}else n(new Error("can not create canvas"))}pi.getJSON(o,{},(function(t,e){if(t)n(t);else{var o=new Image;o.onload=function(){a(e,o)},o.onerror=function(t){n(t)},pi.getImage(o,i,{})}}))}))},loadSvgs:function(t){return new Promise((function(e,n){var i="",o=[],s="",a="",l="";if(Array.isArray(t)||t instanceof NodeList)o=t;else if(f(t)){i=t.url,o=t.symbols,s=t.fill,a=t.stroke,l=t.sourceName||""}else g(t)&&(i=t);if(i||!o||0!==o.length){var h=[],c=function(t,e){var n=Ti(e);n&&(n.forEach((function(t){s&&(t.fill=s),a&&(t.stroke=a)})),xi.addResource(l+t,n)),h.push({name:t,paths:n,body:e})};if(i&&g(i))fetch(i).then((function(t){return t.json()})).then((function(t){t.forEach((function(t){var{name:e,body:n}=t;c(e,n)})),e(h)})).catch((function(t){console.log(t),n(t)}));else if(o){for(var u=0,m=o.length;u<m;u++){var A=o[u],w=A.id;w&&c(w,"<xml><svg>"+A.innerHTML+"</svg></xml>")}e(h)}else n(new Error("not support svgs params type"))}else n(new Error("not find svgs data"))}))}};function bi(t){if(c(t)&&(t+=Ai),!t)return console.error("resouce path is null,path:",t),t;if(!g(t))return t;if(function(t){return yi.test(t)}(t)||function(t){return 0===t.indexOf("blob:")}(t))return t;if("$"===t[0])return xi.getResource(t.substring(1,1/0))||"";var e=xi.origin||{},n=Ye(t);if(n&&f(e)){var i=_i(t,e);return i||t}var o=xi.proxy||{};if(f(o)){var s=_i(t,o);if(s)return s}var{host:a}=xi;return!n&&a&&g(a)?""+a+t:En(t)}function wi(t,e){return t?t[e]&&t[e].value:null}function Ti(t){var e=(vi||(vi=new DOMParser),vi).parseFromString(t,"text/xml").querySelector("svg");if(!e)return null;for(var n=e.childNodes,i=[],o=e.attributes,s=wi(o,"fill"),a=wi(o,"fill-opacity"),l=wi(o,"stroke"),h=wi(o,"stroke-opacity"),c=wi(o,"stroke-width"),u=0,f=n.length;u<f;u++){var g=n[u],m=g.attributes;if(m){var A=void 0,w="path"===(g.tagName||"").toLowerCase();if(A=w?wi(m,"d"):g){var T=wi(m,"fill")||s,M=wi(m,"stroke")||l,C={path:A};if(T&&(C.fill=T,C["fill-opacity"]=wi(m,"fill-opacity")||a||1),M&&(C.stroke=M,C["stroke-opacity"]=wi(m,"stroke-opacity")||h||1,C["stroke-width"]=wi(m,"stroke-width")||c||1),i.push(C),!w)for(var P in C)"path"!==P&&C.hasOwnProperty(P)&&g.setAttribute(P,C[P])}}}return i}let Mi;const Si={width:100,height:10};let Pi=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),Pi=!0}catch(t){Pi=!1}let Ii=class ColorIn{constructor(t,e={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let n=1/0,i=-1/0;for(let e=0,o=t.length;e<o;e++){const o=t[e][0];n=Math.min(o,n),i=Math.max(o,i)}this.min=n,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},Si,e),this._initImgData()}getImageData(){return this.imgData}_initImgData(){const t=function(){if(!Mi){const{width:t,height:e}=Si;Pi?Mi=new OffscreenCanvas(t,e):(Mi=document.createElement("canvas"),Mi.width=t,Mi.height=e)}return Mi}(),{width:e,height:n}=this.options;t.width=e,t.height=n;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const o=i.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:a}=this;for(let t=0,e=s.length;t<e;t++){const[e,n]=s[t];o.addColorStop((e-this.min)/a,n)}i.fillStyle=o,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t),t=Math.min(t,this.max);let e=Math.round((t-this.min)/this.valueOffset*this.imgData.width);e=Math.min(e,this.imgData.width-1);const n=4*e;return[this.imgData.data[n],this.imgData.data[n+1],this.imgData.data[n+2],this.imgData.data[n+3]]}};var ki;function Ri(t){return null==t}function Di(t){return!Ri(t)}function Fi(t){return""===t}function Hi(t,e){var n,i,o;if(Ki(t)){var s,a=t.stops&&"object"==typeof t.stops[0][0],l=a||Di(t.property),h=a||!l,c=t.type||e||"exponential";if("exponential"===c)s=Ui;else if("interval"===c)s=Gi;else if("categorical"===c)s=zi;else if("identity"===c)s=qi;else if("color-interpolate"===c)s=Zi;else{if("calculate-expression"!==c)throw new Error('Unknown function type "'+c+'"');s=Ji}if(a){var u={},f=[];for(let e=0;e<t.stops.length;e++){var g=t.stops[e];void 0===u[g[0].zoom]&&(u[g[0].zoom]={zoom:g[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),u[g[0].zoom].stops.push([g[0].value,g[1]])}for(let t in u)f.push([u[t].zoom,Hi(u[t])]);n=function(e,n){const i=Ui({stops:f,base:t.base},e)(e,n);return"function"==typeof i?i(e,n):i},i=!1,o=!1}else h?(n=function(e){const n=s(t,e);return"function"==typeof n?n(e):n},i=!0,o=!1):(n=function(e,n){const i=s(t,n?n[t.property]:null);return"function"==typeof i?i(e,n):i},i=!1,o=!0)}else n=function(){return t},i=!0,o=!0;return n.isZoomConstant=o,n.isFeatureConstant=i,n}function zi(t,e){for(let n=0;n<t.stops.length;n++)if(e===t.stops[n][0])return t.stops[n][1];return t.default}function Gi(t,e){for(var n=0;n<t.stops.length&&!(e<t.stops[n][0]);n++);return t.stops[Math.max(n-1,0)][1]}function Ui(t,e){for(var n=Di(t.base)&&!Fi(t.base)?t.base:1,i=0;!(i>=t.stops.length||e<=t.stops[i][0]);)i++;return 0===i?t.stops[i][1]:i===t.stops.length?t.stops[i-1][1]:Qi(e,n,t.stops[i-1][0],t.stops[i][0],t.stops[i-1][1],t.stops[i][1])}"function"==typeof Map&&(ki=new Map);const Wi={width:100,height:1};function Zi(t,e){const n=t.stops;if(n&&n.length>1){let t;if(ki){const e=JSON.stringify(n);if(!ki.has(e)){const t=new Ii(n,Wi);ki.set(e,t)}t=ki.get(e)}else t=new Ii(n,Wi);const[i,o,s,a]=t.getColor(e);return[i/255,o/255,s/255,a/255]}return n&&1===n.length?n[0][1]:null}function qi(t,e){return function(t,e,n){return Di(t)?t:Di(e)?e:Di(n)?n:null}(e,t.default)}function Ji(t,e){const n=String(t.property),i=t.expression,o=e;function s(e){return Ri(e)||Fi(e)||isNaN(e)?t.default:e}if(!Di(e)||Fi(e)||isNaN(e)||e<0)return s(t.default);{const e=function t(e,n,i){const o=Number(i),s=String(n);return Array.isArray(e)?e.map((e=>t(e,s,o))):e===s?o:e}(i,n,o);return s(function e(n){if(!Array.isArray(n)){if("number"==typeof n)return n;throw new Error("Invalid expression format")}{const i=n[0];if(!["+","-","*","/"].includes(i))throw new Error(`Unknown operator: ${i}`);const o=n.slice(1).map((t=>e(t)));switch(i){case"+":return o.reduce(((t,e)=>t+e),0);case"-":return o.reduce(((t,e)=>t-e));case"*":return o.reduce(((t,e)=>t*e),1);case"/":return o.some((t=>0===t))?t.default:o.reduce(((t,e)=>t/e));default:throw new Error(`Unsupported operator: ${i}`)}}}(e))}}function Qi(t,e,n,i,o,s){return"function"==typeof o?function(){var a=o.apply(void 0,arguments),l=s.apply(void 0,arguments);return Qi(t,e,n,i,a,l)}:o.length?function(t,e,n,i,o,s){var a=[];for(let l=0;l<o.length;l++)a[l]=Yi(t,e,n,i,o[l],s[l]);return a}(t,e,n,i,o,s):Yi(t,e,n,i,o,s)}function Yi(t,e,n,i,o,s){var a,l=i-n,h=t-n;return o*(1-(a=1===e?h/l:(Math.pow(e,h)-1)/(Math.pow(e,l)-1)))+s*a}function Ki(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function $i(t){for(const e in t)if(Ki(t[e]))return!0;return!1}function to(t){return io(t,"exponential")}function no(t,e){if(!t)return null;var n=!1;if(Array.isArray(t)){var i,o=[];for(let s=0;s<t.length;s++)(i=no(t[s],e))?(o.push(i),n=!0):o.push(t[s]);return n?o:t}var s,a={__fn_types_loaded:!0},l=[];for(s in t)t.hasOwnProperty(s)&&l.push(s);const h=function(t){Object.defineProperty(a,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=to(this["_"+t])),this["__fn_"+t].apply(this,e())},set:function(e){this["_"+t]=e},configurable:!0,enumerable:!0})};for(let e=0,i=l.length;e<i;e++)Ki(t[s=l[e]])?(n=!0,a["_"+s]=t[s],h(s)):a[s]=t[s];return n?a:t}function ro(t){if(!t||!t.stops)return[];const e=[];for(let n=0,i=t.stops.length;n<i;n++)e.push(t.stops[n][1]);return e}function io(t,e){if(!Ki(t))return function(){return t};let n=!0,i=!0;const o=(t=JSON.parse(JSON.stringify(t))).stops;if(o)for(let t=0;t<o.length;t++)if(Ki(o[t][1])){const s=io(o[t][1],e);n=n&&s.isZoomConstant,i=i&&s.isFeatureConstant,o[t]=[o[t][0],s]}const s=Hi(t,e);return s.isZoomConstant=n&&s.isZoomConstant,s.isFeatureConstant=i&&s.isFeatureConstant,s} /*! Feature Filter by (c) mapbox 2016 and maptalks 2018 www.mapbox.com | www.maptalks.org License: MIT, header required. */const oo=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function so(t){return new Function("f",`var p = (f && f.properties || {}); return ${ao(t)}`)}function ao(t){if(!t)return"true";const e=t[0];if(t.length<=1)return"any"===e?"false":"true";const n="=="===e?co(t[1],t[2],"===",!1):"!="===e?co(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?co(t[1],t[2],e,!0):"any"===e?fo(t.slice(1),"||"):"all"===e?fo(t.slice(1),"&&"):"none"===e?_o(fo(t.slice(1),"||")):"in"===e?mo(t[1],t.slice(2)):"!in"===e?_o(mo(t[1],t.slice(2))):"has"===e?yo(t[1]):"!has"===e?_o(yo(t[1])):"contains"===e?function(t,e,n){const i=lo(t);return void 0!==n?`(${i} + '').indexOf("${e}") === ${n}`:`(${i} + '').indexOf("${e}") >= 0`}(t[1],t[2],t[3]):"true";return`(${n})`}function lo(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function co(t,e,n,i){if("object"==typeof(o=t)&&o&&t.op)return function(t,e,n,i){const o=t.property,s=t.op;let a=lo(o);return"length"!==s?(console.error(`not support ${s} op`),"false"):(a=`((${a}+='').length)`,uo(a,o,e,n,i))}(t,e,n,i);var o;return uo(lo(t),t,e,n,i)}function uo(t,e,n,i,o){const s="$type"===e?oo.indexOf(n):JSON.stringify(n);return(o?`typeof ${t}=== typeof ${s}&&`:"")+t+i+s}function fo(t,e){return t.map(ao).join(e)}function mo(t,e){"$type"===t&&(e=e.map((t=>oo.indexOf(t))));const n=JSON.stringify(e.sort(vo)),i=lo(t);return e.length<=200?`${n}.indexOf(${i}) !== -1`:`function(v, a, i, j) {\n while (i <= j) { var m = (i + j) >> 1;\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\n }\n return false; }(${i}, ${n},0,${e.length-1})`}function yo(t){return"$id"===t?'"id" in f':`${JSON.stringify(t)} in p`}function _o(t){return`!(${t})`}function vo(t,e){return t<e?-1:t>e?1:0}function xo(t){const e=t._toJSON(),n=e.feature;return n.type=oo.indexOf(n.geometry.type),n.subType=e.subType,n}function bo(t){if(!Array.isArray(t))return bo([t]);const e=[];for(let n=0;n<t.length;n++){let i;i=!0===t[n].filter?function(){return!0}:so(t[n].filter),e.push(wo({},t[n],{filter:i}))}return e}function wo(t){for(let e=1;e<arguments.length;e++){const n=arguments[e];for(const e in n)t[e]=n[e]}return t}var Mo=[],Co={};function So(t,e){return no(t,(function(){var t=e.getMap();return function(t,e,n){return t[0]=e,t[1]=n,t}(Mo,t?t.getZoom():12,l({},e.getProperties(),function(t,e,n,i){return t["{bearing}"]=e,t["{pitch}"]=n,t["{zoom}"]=i,t}(Co,t&&t.getBearing()||0,t&&t.getPitch()||0,t?t.getZoom():10)))}))}var Po=Object.freeze({__proto__:null,compileStyle:bo,createFilter:so,getFilterFeature:xo,getFunctionTypeResources:ro,hasFunctionDefinition:$i,interpolated:to,isFeatureFilter:function t(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":case"!has":return 2===e.length&&("string"==typeof e[1]||e[1].property&&e[1].op);case"in":case"!in":return e.length>=2&&("string"==typeof e[1]||e[1].property&&e[1].op);case"==":case"!=":case">":case">=":case"<":case"<=":return 3===e.length&&("string"==typeof e[1]||e[1].property&&e[1].op);case"none":case"any":case"all":for(const n of e.slice(1))if(!t(n)&&"boolean"!=typeof n)return!1;return!0;case"contains":return!0;default:return!1}},isFunctionDefinition:Ki,loadFunctionTypes:no,loadGeoSymbol:So});function Io(t){var e={stroke:{stroke:t.markerLineColor,"stroke-width":t.markerLineWidth,"stroke-opacity":t.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:t.markerFill,"fill-opacity":t.markerFillOpacity}};return 0===e.stroke["stroke-width"]&&(e.stroke["stroke-opacity"]=0),e}function Oo(t,e,n){if(!t.markerPath)return null;var i=1,o=Io(t);c(t.markerOpacity)&&(i=t.markerOpacity),c(t.opacity)&&(i*=t.opacity);var s,a={};if(o){for(var u in o.stroke)o.stroke.hasOwnProperty(u)&&(h(o.stroke[u])||(a[u]=o.stroke[u]));for(var f in o.fill)o.fill.hasOwnProperty(f)&&(h(o.fill[f])||(a[f]=o.fill[f]))}var m,A=t.markerPath;s=g(A)&&"$"===A[0]?xi.getResource(A.substring(1,1/0))||[]:Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];for(var w=[],T=0;T<s.length;T++)(m=l({},m=g(s[T])?{path:s[T]}:s[T],a)).d=m.path,delete m.path,w.push(m);var M=['<svg version="1.1"','xmlns="http://www.w3.org/2000/svg"'];i<1&&M.push('opacity="'+i+'"'),t.markerPathWidth&&t.markerPathHeight&&M.push('viewBox="0 0 '+t.markerPathWidth+" "+t.markerPathHeight+'"'),M.push('preserveAspectRatio="none"'),e&&M.push('width="'+e+'"'),n&&M.push('height="'+n+'"'),M.push("><defs></defs>");for(var C=0;C<w.length;C++)if(w[C].d instanceof Element)M.push(w[C].d.outerHTML);else{var P="<path ";for(var I in w[C])w[C].hasOwnProperty(I)&&(P+=" "+I+'="'+w[C][I]+'"');M.push(P+="></path>")}return M.push("</svg>"),"data:image/svg+xml;base64,"+un(M.join(" "))}function Eo(t,e){if(!t)return[];var n=t;Array.isArray(t)||(n=[t]);for(var i,o,s,a,l=[],h=Bn,c=n.length-1;c>=0;c--)if(t=n[c]){e&&(t=Ro(t));for(var u=0;u<h.length;u++)if(Ki(i=t[h[u]])&&(i=ro(i)),i){Array.isArray(i)||(i=[i]);for(var f=0;f<i.length;f++)"url("===i[f].slice(0,4)&&(i[f]=rn(i[f])),l.push([i[f],t[(o=zn[u])[0]],t[o[1]]])}if("path"===t.markerType&&t.markerPath)if(s=Ki(t.markerWidth)?200:t.markerWidth,a=Ki(t.markerHeight)?200:t.markerHeight,Ki(t.markerPath)){i=ro(t.markerPath);for(var g=t.markerPath,m=0;m<i.length;m++)t.markerPath=i[m],l.push([Oo(t),s,a]);t.markerPath=g}else l.push([Oo(t),s,a])}return l}function Ro(t){if(!t)return null;var e=t;if(n)return e;for(var i,o=Bn,s=0,a=o.length;s<a;s++)(i=e[o[s]])&&(e[o[s]]=Lo(i));return e}function Lo(t){if(Ki(t)&&t.stops){for(var e=t.stops,n=0;n<e.length;n++)e[n][1]=Lo(e[n][1]);return t}return"url("===t.slice(0,4)&&(t=rn(t)),t}function Fo(t){return t&&Gt.decodeImageInWorker&&t instanceof ImageBitmap}function Ho(t){return t&&t.colorStops}function Bo(t){var e=[t.type];if(t.places&&e.push(t.places.join()),t.colorStops){for(var n=[],i=t.colorStops.length-1;i>=0;i--)n.push(t.colorStops[i].join());e.push(n.join(","))}return e.join("_")}function zo(t,e){if(!t)return 1;var n=[];if(Array.isArray(t)){for(var i=0;i<t.length;i++)n.push(zo(t[i],e));return n.sort().join(",")}var o=Object.keys(t).sort().reduce((function(n,i){return e&&0!==i.indexOf(e)||(n[i]=t[i]),n}),{});return vr(JSON.stringify(o))}function jo(t,e){function n(t,e){h(t.opacity)?t.opacity=e:t.opacity*=e}var i;if(Array.isArray(t)){i=[];for(var o=0;o<t.length;o++){var s=l({},t[o]);n(s,e),i.push(s)}}else n(i=l({},t),e);return i}function Go(...t){var e=t[0],n=Array.prototype.slice.call(t,1);if(n&&n.length||(n=[{}]),Array.isArray(e)){for(var i,o,s=[],a=0,c=e.length;a<c;a++){i=e[a],o={};for(var u=0,f=n.length;u<f;u++)Array.isArray(n[u])?h(n[u][a])?l(o,i||{}):l(o,i,n[u][a]):l(o,i,n[u]?n[u]:{});s.push(o)}return s}var g=[{},e];return g.push.apply(g,n),l.apply(this,g)}function Uo(t){if(t.symbol&&(t=[t]),Array.isArray(t))return t;var e=t.$root,n=t.$iconset;if(t=t.style,e||n){e&&"/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),n&&"/"===n[n.length-1]&&(n=n.substring(0,n.length-1));Vo(t,(function(t){return"{$root}"===t?e:"{$iconset}"===t?n:null}))}return t}function Vo(t,e){for(var n=0;n<t.length;n++){var{symbol:i}=t[n];i&&Zo(i,e)}}var Wo=/(\{\$root\}|\{\$iconset\})/g;function Zo(t,e){for(var n in t)t.hasOwnProperty(n)&&"textName"!==n&&(g(t[n])&&t[n].length>2?t[n]=t[n].replace(Wo,e):Ki(t[n])?t[n]=qo(t[n],e):f(t[n])&&Zo(t[n],e))}function qo(t,e){var n=t.default;g(n)&&(t.default=n.replace(Wo,e));var i=t.stops;if(!i)return t;for(var o=0;o<i.length;o++)Array.isArray(i[o])&&(g(i[o][1])?i[o][1]=i[o][1].replace(Wo,e):Ki(i[o][1])&&(i[o][1]=qo(i[o][1],e)));return t}function Xo(t=[]){Array.isArray(t)||(t=[t]);for(var e=t.length,n=0;n<e;n++){var i=t[n];if(i.style){var{lineDasharray:o,lineWidth:s}=i.style;if(s&&c(s)&&s>0&&o&&Array.isArray(o)&&o.length)return!0}}return!1}function Yo(t,e,n,i,o){var s=1/Math.tan(e/2),a=1/(i-o);return t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(o+i)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*o*i*a,t[15]=0,t}function Ko(t,e,n){var i,o,s,a,l,h,c,u,f,g,m,A,w=n[0],T=n[1],M=n[2];return e===t?(t[12]=e[0]*w+e[4]*T+e[8]*M+e[12],t[1