!function t(e,n,i){function r(a,s){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};e[a][0].call(u.exports,(function(t){return r(e[a][1][t]||t)}),u,u.exports,t,e,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;ac/r*i?t/i:c/r:"contain"===s?c>t/i*r?t/i:c/r:1,l?n.style.transform="scale("+e+")":(n.style.width=i*e+"px",n.style.height=r*e+"px"),n.style.left=t!==i*e?u*a+"px":"0px",n.style.top=c!==r*e?d*o+"px":"0px"):setTimeout(h,30)}n.style.position="absolute",n.parentElement.style.overflow="hidden",l&&(n.style.transformOrigin="left top"),-1===["relative","absolute","fixed"].indexOf(window.getComputedStyle(n.parentElement,null).getPropertyValue("position"))&&(n.parentElement.style.position="relative"),c(),u(),h(),this.update=h,this.setWidth=function(t){i=Number(t)},this.setHeight=function(t){r=Number(t)},this.setValign=function(t){o=t,c()},this.setHalign=function(t){a=t,u()},this.setFit=function(t){s=t},this.getWidth=function(){return Number(i)},this.getHeight=function(){return Number(r)},this.getCurrentWidth=function(){return e*i},this.getCurrentHeight=function(){return e*r},this.getValign=function(){return o},this.getHalign=function(){return a},this.getFit=function(){return s},this.getScale=function(){return e}}},{}],3:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i(t.d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e){return te?1:t>=e?0:NaN}function n(t){var n;return 1===t.length&&(n=t,t=function(t,i){return e(n(t),i)}),{left:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i>>1;t(e[o],n)<0?i=o+1:r=o}return i},right:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i>>1;t(e[o],n)>0?r=o:i=o+1}return i}}}var i=n(e),r=i.right,o=i.left;function a(t,e){return[t,e]}function s(t){return null===t?NaN:+t}function l(t,e){var n,i,r=t.length,o=0,a=-1,l=0,c=0;if(null==e)for(;++a1)return c/(o-1)}function c(t,e){var n=l(t,e);return n?Math.sqrt(n):n}function u(t,e){var n,i,r,o=t.length,a=-1;if(null==e){for(;++a=n)for(i=r=n;++an&&(i=n),r=n)for(i=r=n;++an&&(i=n),r=0?(o>=_?10:o>=v?5:o>=y?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=_?10:o>=v?5:o>=y?2:1)}function b(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;return o>=_?r*=10:o>=v?r*=5:o>=y&&(r*=2),e=1)return+n(t[i-1],i-1,t);var i,r=(i-1)*e,o=Math.floor(r),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(r-o)}}function C(t,e){var n,i,r=t.length,o=-1;if(null==e){for(;++o=n)for(i=n;++on&&(i=n)}else for(;++o=n)for(i=n;++on&&(i=n);return i}function S(t){if(!(r=t.length))return[];for(var e=-1,n=C(t,k),i=new Array(n);++et?1:e>=t?0:NaN},t.deviation=c,t.extent=u,t.histogram=function(){var t=m,e=u,n=w;function i(i){var o,a,s=i.length,l=new Array(s);for(o=0;oh;)d.pop(),--f;var p,m=new Array(f+1);for(o=0;o<=f;++o)(p=m[o]=[]).x0=o>0?d[o-1]:u,p.x1=o=n)for(i=n;++oi&&(i=n)}else for(;++o=n)for(i=n;++oi&&(i=n);return i},t.mean=function(t,e){var n,i=t.length,r=i,o=-1,a=0;if(null==e)for(;++o=0;)for(e=(i=t[r]).length;--e>=0;)n[--a]=i[e];return n},t.min=C,t.pairs=function(t,e){null==e&&(e=a);for(var n=0,i=t.length-1,r=t[0],o=new Array(i<0?0:i);n0)return[t];if((i=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(r=Math.ceil(e-t+1));++sMath.abs(t[1]-Q[1])?O=!0:E=!0),Q=t,M=!0,c(),ot()}function ot(){var t;switch(X=Q[0]-J[0],W=Q[1]-J[1],L){case h:case u:N&&(X=Math.max(q-e,Math.min(G-m,X)),i=e+X,y=m+X),$&&(W=Math.max(Z-a,Math.min(H-S,W)),s=a+W,k=S+W);break;case d:N<0?(X=Math.max(q-e,Math.min(G-e,X)),i=e+X,y=m):N>0&&(X=Math.max(q-m,Math.min(G-m,X)),i=e,y=m+X),$<0?(W=Math.max(Z-a,Math.min(H-a,W)),s=a+W,k=S):$>0&&(W=Math.max(Z-S,Math.min(H-S,W)),s=a,k=S+W);break;case f:N&&(i=Math.max(q,Math.min(G,e-X*N)),y=Math.max(q,Math.min(G,m+X*N))),$&&(s=Math.max(Z,Math.min(H,a-W*$)),k=Math.max(Z,Math.min(H,S+W*$)))}y0&&(e=i-X),$<0?S=k-W:$>0&&(a=s-W),L=h,nt.attr("cursor",x.selection),ot());break;default:return}c()}function lt(){switch(r.event.keyCode){case 16:Y&&(E=O=Y=!1,ot());break;case 18:L===f&&(N<0?m=y:N>0&&(e=i),$<0?S=k:$>0&&(a=s),L=d,ot());break;case 32:L===h&&(r.event.altKey?(N&&(m=y-X*N,e=i+X*N),$&&(S=k-W*$,a=s+W*$),L=f):(N<0?m=y:N>0&&(e=i),$<0?S=k:$>0&&(a=s),L=d),nt.attr("cursor",x[R]),ot());break;default:return}c()}}function j(){B(this,arguments).moved()}function U(){B(this,arguments).ended()}function V(){var e=this.__brush||{selection:null};return e.extent=m(y.apply(this,arguments)),e.dim=t,e}return L.move=function(e,n){e.selection?e.on("start.brush",(function(){B(this,arguments).beforestart().start()})).on("interrupt.brush end.brush",(function(){B(this,arguments).end()})).tween("brush",(function(){var e=this,r=e.__brush,o=B(e,arguments),a=r.selection,s=t.input("function"==typeof n?n.apply(this,arguments):n,r.extent),l=i.interpolate(a,s);function c(t){r.selection=1===t&&null===s?null:l(t),F.call(e),o.brush()}return null!==a&&null!==s?c:c(1)})):e.each((function(){var e=this,i=arguments,r=e.__brush,a=t.input("function"==typeof n?n.apply(e,i):n,r.extent),s=B(e,i).beforestart();o.interrupt(e),r.selection=null===a?null:a,F.call(e),s.start().brush().end()}))},L.clear=function(t){L.move(t,null)},N.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting?(this.starting=!1,this.emit("start")):this.emit("brush"),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(e){r.customEvent(new s(L,e,t.output(this.state.selection)),z.apply,z,[e,this.that,this.args])}},L.extent=function(t){return arguments.length?(y="function"==typeof t?t:a(m(t)),L):y},L.filter=function(t){return arguments.length?(I="function"==typeof t?t:a(!!t),L):I},L.touchable=function(t){return arguments.length?(O="function"==typeof t?t:a(!!t),L):O},L.handleSize=function(t){return arguments.length?(R=+t,L):R},L.keyModifiers=function(t){return arguments.length?(D=!!t,L):D},L.on=function(){var t=z.on.apply(z,arguments);return t===z?L:t},L}t.brush=function(){return I(y)},t.brushSelection=function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},t.brushX=function(){return I(_)},t.brushY=function(){return I(v)},Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-dispatch":10,"d3-drag":11,"d3-interpolate":19,"d3-selection":26,"d3-transition":31}],6:[function(t,e,n){!function(i,r){"object"==typeof n&&void 0!==e?r(n,t("d3-array"),t("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-path"],r):r(i.d3=i.d3||{},i.d3,i.d3)}(this,(function(t,e,n){"use strict";var i=Math.cos,r=Math.sin,o=Math.PI,a=o/2,s=2*o,l=Math.max;function c(t){return function(e,n){return t(e.source.value+e.target.value,n.source.value+n.target.value)}}var u=Array.prototype.slice;function h(t){return function(){return t}}function d(t){return t.source}function f(t){return t.target}function p(t){return t.radius}function m(t){return t.startAngle}function g(t){return t.endAngle}t.chord=function(){var t=0,n=null,i=null,r=null;function o(o){var a,c,u,h,d,f,p=o.length,m=[],g=e.range(p),_=[],v=[],y=v.groups=new Array(p),x=new Array(p*p);for(a=0,d=-1;++d=l.length)return null!=t&&i.sort(t),null!=e?e(i):i;for(var s,c,h,d=-1,f=i.length,p=l[r++],m=n(),g=o();++dl.length)return n;var r,o=c[i-1];return null!=e&&i>=l.length?r=n.entries():(r=[],n.each((function(e,n){r.push({key:n,values:t(e,i)})}))),null!=o?r.sort((function(t,e){return o(t.key,e.key)})):r}(u(t,0,o,a),0)},key:function(t){return l.push(t),s},sortKeys:function(t){return c[l.length-1]=t,s},sortValues:function(e){return t=e,s},rollup:function(t){return e=t,s}}},t.set=c,t.map=n,t.keys=function(t){var e=[];for(var n in t)e.push(n);return e},t.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e},t.entries=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e},Object.defineProperty(t,"__esModule",{value:!0})}))},{}],8:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function n(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function i(){}var r="\\s*([+-]?\\d+)\\s*",o="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",s=/^#([0-9a-f]{3,8})$/,l=new RegExp("^rgb\\("+[r,r,r]+"\\)$"),c=new RegExp("^rgb\\("+[a,a,a]+"\\)$"),u=new RegExp("^rgba\\("+[r,r,r,o]+"\\)$"),h=new RegExp("^rgba\\("+[a,a,a,o]+"\\)$"),d=new RegExp("^hsl\\("+[o,a,a]+"\\)$"),f=new RegExp("^hsla\\("+[o,a,a,o]+"\\)$"),p={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function m(){return this.rgb().formatHex()}function g(){return this.rgb().formatRgb()}function _(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=s.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?v(e):3===n?new w(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?y(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?y(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=l.exec(t))?new w(e[1],e[2],e[3],1):(e=c.exec(t))?new w(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=u.exec(t))?y(e[1],e[2],e[3],e[4]):(e=h.exec(t))?y(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=d.exec(t))?k(e[1],e[2]/100,e[3]/100,1):(e=f.exec(t))?k(e[1],e[2]/100,e[3]/100,e[4]):p.hasOwnProperty(t)?v(p[t]):"transparent"===t?new w(NaN,NaN,NaN,0):null}function v(t){return new w(t>>16&255,t>>8&255,255&t,1)}function y(t,e,n,i){return i<=0&&(t=e=n=NaN),new w(t,e,n,i)}function x(t){return t instanceof i||(t=_(t)),t?new w((t=t.rgb()).r,t.g,t.b,t.opacity):new w}function b(t,e,n,i){return 1===arguments.length?x(t):new w(t,e,n,null==i?1:i)}function w(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function T(){return"#"+S(this.r)+S(this.g)+S(this.b)}function C(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function S(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function k(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new A(t,e,n,i)}function M(t){if(t instanceof A)return new A(t.h,t.s,t.l,t.opacity);if(t instanceof i||(t=_(t)),!t)return new A;if(t instanceof A)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),a=Math.max(e,n,r),s=NaN,l=a-o,c=(a+o)/2;return l?(s=e===a?(n-r)/l+6*(n0&&c<1?0:s,new A(s,l,c,t.opacity)}function E(t,e,n,i){return 1===arguments.length?M(t):new A(t,e,n,null==i?1:i)}function A(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function P(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}e(i,_,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:m,formatHex:m,formatHsl:function(){return M(this).formatHsl()},formatRgb:g,toString:g}),e(w,b,n(i,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:T,formatHex:T,formatRgb:C,toString:C})),e(A,E,n(i,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new A(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new A(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new w(P(t>=240?t-240:t+120,r,i),P(t,r,i),P(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var I=Math.PI/180,O=180/Math.PI,D=6/29,z=3*D*D;function R(t){if(t instanceof F)return new F(t.l,t.a,t.b,t.opacity);if(t instanceof q)return Z(t);t instanceof w||(t=x(t));var e,n,i=j(t.r),r=j(t.g),o=j(t.b),a=B((.2225045*i+.7168786*r+.0606169*o)/1);return i===r&&r===o?e=n=a:(e=B((.4360747*i+.3850649*r+.1430804*o)/.96422),n=B((.0139322*i+.0971045*r+.7141733*o)/.82521)),new F(116*a-16,500*(e-a),200*(a-n),t.opacity)}function L(t,e,n,i){return 1===arguments.length?R(t):new F(t,e,n,null==i?1:i)}function F(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function B(t){return t>.008856451679035631?Math.pow(t,1/3):t/z+4/29}function N(t){return t>D?t*t*t:z*(t-4/29)}function $(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function j(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function U(t){if(t instanceof q)return new q(t.h,t.c,t.l,t.opacity);if(t instanceof F||(t=R(t)),0===t.a&&0===t.b)return new q(NaN,0i!=p>i&&n<(f-u)*(i-h)/(p-h)+u&&(r=-r)}return r}function s(t,e,n){var i,r,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(r=t[i=+(t[0]===e[0])],o=n[i],a=e[i],r<=o&&o<=a||a<=o&&o<=r)}function l(){}var c=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function u(){var t=1,a=1,s=e.thresholdSturges,u=p;function h(t){var n=s(t);if(Array.isArray(n))n=n.slice().sort(i);else{var r=e.extent(t),o=r[0],a=r[1];n=e.tickStep(o,a,n),n=e.range(Math.floor(o/n)*n,Math.floor(a/n)*n,n)}return n.map((function(e){return d(t,e)}))}function d(e,n){var i=[],r=[];return function(e,n,i){var r,o,s,l,u,h,d=new Array,p=new Array;r=o=-1,l=e[0]>=n,c[l<<1].forEach(m);for(;++r=n,c[s|l<<1].forEach(m);c[l<<0].forEach(m);for(;++o=n,u=e[o*t]>=n,c[l<<1|u<<2].forEach(m);++r=n,h=u,u=e[o*t+r+1]>=n,c[s|l<<1|u<<2|h<<3].forEach(m);c[l|u<<3].forEach(m)}r=-1,u=e[o*t]>=n,c[u<<2].forEach(m);for(;++r=n,c[u<<2|h<<3].forEach(m);function m(t){var e,n,a=[t[0][0]+r,t[0][1]+o],s=[t[1][0]+r,t[1][1]+o],l=f(a),c=f(s);(e=p[l])?(n=d[c])?(delete p[e.end],delete d[n.start],e===n?(e.ring.push(s),i(e.ring)):d[e.start]=p[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete p[e.end],e.ring.push(s),p[e.end=c]=e):(e=d[c])?(n=p[l])?(delete d[e.start],delete p[n.end],e===n?(e.ring.push(s),i(e.ring)):d[n.start]=p[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(a),d[e.start=l]=e):d[l]=p[c]={start:l,end:c,ring:[a,s]}}c[u<<3].forEach(m)}(e,n,(function(t){u(t,e,n),function(t){for(var e=0,n=t.length,i=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e0?i.push([t]):r.push(t)})),r.forEach((function(t){for(var e,n=0,r=i.length;n0&&o0&&s0&&i>0))throw new Error("invalid size");return t=n,a=i,h},h.thresholds=function(t){return arguments.length?(s="function"==typeof t?t:Array.isArray(t)?r(n.call(t)):r(t),h):s},h.smooth=function(t){return arguments.length?(u=t?p:l,h):u===p},h}function h(t,e,n){for(var i=t.width,r=t.height,o=1+(n<<1),a=0;a=n&&(s>=o&&(l-=t.data[s-o+a*i]),e.data[s-n+a*i]=l/Math.min(s+1,i-1+o-s,o))}function d(t,e,n){for(var i=t.width,r=t.height,o=1+(n<<1),a=0;a=n&&(s>=o&&(l-=t.data[a+(s-o)*i]),e.data[a+(s-n)*i]=l/Math.min(s+1,r-1+o-s,o))}function f(t){return t[0]}function p(t){return t[1]}function m(){return 1}t.contours=u,t.contourDensity=function(){var t=f,i=p,o=m,a=960,s=500,l=20,c=2,g=3*l,_=a+2*g>>c,v=s+2*g>>c,y=r(20);function x(n){var r=new Float32Array(_*v),a=new Float32Array(_*v);n.forEach((function(e,n,a){var s=+t(e,n,a)+g>>c,l=+i(e,n,a)+g>>c,u=+o(e,n,a);s>=0&&s<_&&l>=0&&l>c),d({width:_,height:v,data:a},{width:_,height:v,data:r},l>>c),h({width:_,height:v,data:r},{width:_,height:v,data:a},l>>c),d({width:_,height:v,data:a},{width:_,height:v,data:r},l>>c),h({width:_,height:v,data:r},{width:_,height:v,data:a},l>>c),d({width:_,height:v,data:a},{width:_,height:v,data:r},l>>c);var s=y(r);if(!Array.isArray(s)){var f=e.max(r);s=e.tickStep(0,f,s),(s=e.range(0,Math.floor(f/s)*s,s)).shift()}return u().thresholds(s).size([_,v])(r).map(b)}function b(t){return t.value*=Math.pow(2,-2*c),t.coordinates.forEach(w),t}function w(t){t.forEach(T)}function T(t){t.forEach(C)}function C(t){t[0]=t[0]*Math.pow(2,c)-g,t[1]=t[1]*Math.pow(2,c)-g}function S(){return _=a+2*(g=3*l)>>c,v=s+2*g>>c,x}return x.x=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),x):t},x.y=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),x):i},x.weight=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),x):o},x.size=function(t){if(!arguments.length)return[a,s];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);if(!(e>=0||e>=0))throw new Error("invalid size");return a=e,s=n,S()},x.cellSize=function(t){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return c=Math.floor(Math.log(t)/Math.LN2),S()},x.thresholds=function(t){return arguments.length?(y="function"==typeof t?t:Array.isArray(t)?r(n.call(t)):r(t),x):y},x.bandwidth=function(t){if(!arguments.length)return Math.sqrt(l*(l+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return l=Math.round((Math.sqrt(4*t*t+1)-1)/2),S()},x},Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-array":3}],10:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e={value:function(){}};function n(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function o(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),o=0;oT}x.mouse("drag")}function M(){n.select(n.event.view).on("mousemove.drag mouseup.drag",null),a(n.event.view,p),r(),x.mouse("end")}function E(){if(g.apply(this,arguments)){var t,e,r=n.event.changedTouches,o=_.apply(this,arguments),a=r.length;for(t=0;t9999?"+"+o(e,6):o(e,4))+"-"+o(t.getUTCMonth()+1,2)+"-"+o(t.getUTCDate(),2)+(a?"T"+o(n,2)+":"+o(i,2)+":"+o(r,2)+"."+o(a,3)+"Z":r?"T"+o(n,2)+":"+o(i,2)+":"+o(r,2)+"Z":i||n?"T"+o(n,2)+":"+o(i,2)+"Z":"")}function s(t){var o=new RegExp('["'+t+"\n\r]"),s=t.charCodeAt(0);function l(t,i){var r,o=[],a=t.length,l=0,c=0,u=a<=0,h=!1;function d(){if(u)return n;if(h)return h=!1,e;var i,r,o=l;if(34===t.charCodeAt(o)){for(;l++=a?u=!0:10===(r=t.charCodeAt(l++))?h=!0:13===r&&(h=!0,10===t.charCodeAt(l)&&++l),t.slice(o+1,i-1).replace(/""/g,'"')}for(;ld+c||if+c||ou.index){var h=d-s.x-s.vx,g=f-s.y-s.vy,_=h*h+g*g;_t.r&&(t.r=t[e].r)}function d(){if(n){var e,r,o=n.length;for(i=new Array(o),e=0;e=c)){(t.data!==n||t.next)&&(0===h&&(p+=(h=a())*h),0===d&&(p+=(d=a())*d),p1?(null==n?u.remove(t):u.set(t,_(n)),e):u.get(t)},find:function(e,n,i){var r,o,a,s,l,c=0,u=t.length;for(null==i?i=1/0:i*=i,c=0;c1?(d.on(t,n),e):d.on(t)}}},t.forceX=function(t){var e,n,i,r=o(.1);function a(t){for(var r,o=0,a=e.length;o1?i[0]+i.slice(2):i,+t.slice(n+1)]}function n(t){return(t=e(Math.abs(t)))?t[1]:NaN}var i,r=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function o(t){if(!(e=r.exec(t)))throw new Error("invalid format: "+t);var e;return new a({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function a(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function s(t,n){var i=e(t,n);if(!i)return t+"";var r=i[0],o=i[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}o.prototype=a.prototype,a.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var l={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return s(100*t,e)},r:s,s:function(t,n){var r=e(t,n);if(!r)return t+"";var o=r[0],a=r[1],s=a-(i=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,l=o.length;return s===l?o:s>l?o+new Array(s-l+1).join("0"):s>0?o.slice(0,s)+"."+o.slice(s):"0."+new Array(1-s).join("0")+e(t,Math.max(0,n+s-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function c(t){return t}var u,h=Array.prototype.map,d=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function f(t){var e,r,a=void 0===t.grouping||void 0===t.thousands?c:(e=h.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>n&&(s=Math.max(1,n-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>n));)s=e[a=(a+1)%e.length];return o.reverse().join(r)}),s=void 0===t.currency?"":t.currency[0]+"",u=void 0===t.currency?"":t.currency[1]+"",f=void 0===t.decimal?".":t.decimal+"",p=void 0===t.numerals?c:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(h.call(t.numerals,String)),m=void 0===t.percent?"%":t.percent+"",g=void 0===t.minus?"-":t.minus+"",_=void 0===t.nan?"NaN":t.nan+"";function v(t){var e=(t=o(t)).fill,n=t.align,r=t.sign,c=t.symbol,h=t.zero,v=t.width,y=t.comma,x=t.precision,b=t.trim,w=t.type;"n"===w?(y=!0,w="g"):l[w]||(void 0===x&&(x=12),b=!0,w="g"),(h||"0"===e&&"="===n)&&(h=!0,e="0",n="=");var T="$"===c?s:"#"===c&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",C="$"===c?u:/[%p]/.test(w)?m:"",S=l[w],k=/[defgprs%]/.test(w);function M(t){var o,s,l,c=T,u=C;if("c"===w)u=S(t)+u,t="";else{var m=(t=+t)<0||1/t<0;if(t=isNaN(t)?_:S(Math.abs(t),x),b&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),m&&0==+t&&"+"!==r&&(m=!1),c=(m?"("===r?r:g:"-"===r||"("===r?"":r)+c,u=("s"===w?d[8+i/3]:"")+u+(m&&"("===r?")":""),k)for(o=-1,s=t.length;++o(l=t.charCodeAt(o))||l>57){u=(46===l?f+t.slice(o+1):t.slice(o))+u,t=t.slice(0,o);break}}y&&!h&&(t=a(t,1/0));var M=c.length+t.length+u.length,E=M>1)+c+t+u+E.slice(M);break;default:t=E+c+t+u}return p(t)}return x=void 0===x?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x)),M.toString=function(){return t+""},M}return{format:v,formatPrefix:function(t,e){var i=v(((t=o(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(n(e)/3))),a=Math.pow(10,-r),s=d[8+r/3];return function(t){return i(a*t)+s}}}}function p(e){return u=f(e),t.format=u.format,t.formatPrefix=u.formatPrefix,u}p({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),t.FormatSpecifier=a,t.formatDefaultLocale=p,t.formatLocale=f,t.formatSpecifier=o,t.precisionFixed=function(t){return Math.max(0,-n(Math.abs(t)))},t.precisionPrefix=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(n(e)/3)))-n(Math.abs(t)))},t.precisionRound=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,n(e)-n(t))+1},Object.defineProperty(t,"__esModule",{value:!0})}))},{}],17:[function(t,e,n){!function(i,r){"object"==typeof n&&void 0!==e?r(n,t("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],r):r((i=i||self).d3=i.d3||{},i.d3)}(this,(function(t,e){"use strict";function n(){return new i}function i(){this.reset()}i.prototype={constructor:i,reset:function(){this.s=this.t=0},add:function(t){o(r,t,this.t),o(this,r.s,this.s),this.s?this.t+=r.t:this.s=r.t},valueOf:function(){return this.s}};var r=new i;function o(t,e,n){var i=t.s=e+n,r=i-e,o=i-r;t.t=e-o+(n-r)}var a=1e-6,s=Math.PI,l=s/2,c=s/4,u=2*s,h=180/s,d=s/180,f=Math.abs,p=Math.atan,m=Math.atan2,g=Math.cos,_=Math.ceil,v=Math.exp,y=Math.log,x=Math.pow,b=Math.sin,w=Math.sign||function(t){return t>0?1:t<0?-1:0},T=Math.sqrt,C=Math.tan;function S(t){return t>1?0:t<-1?s:Math.acos(t)}function k(t){return t>1?l:t<-1?-l:Math.asin(t)}function M(t){return(t=b(t/2))*t}function E(){}function A(t,e){t&&I.hasOwnProperty(t.type)&&I[t.type](t,e)}var P={Feature:function(t,e){A(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,r=n.length;++i=0?1:-1,r=i*n,o=g(e=(e*=d)/2+c),a=b(e),s=N*a,l=B*o+s*g(r),u=s*i*b(r);$.add(m(u,l)),F=t,B=o,N=a}function H(t){return[m(t[1],t[0]),k(t[2])]}function X(t){var e=t[0],n=t[1],i=g(n);return[i*g(e),i*b(e),b(n)]}function W(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Y(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function K(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function J(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Q(t){var e=T(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var tt,et,nt,it,rt,ot,at,st,lt,ct,ut,ht,dt,ft,pt,mt,gt,_t,vt,yt,xt,bt,wt,Tt,Ct,St,kt=n(),Mt={point:Et,lineStart:Pt,lineEnd:It,polygonStart:function(){Mt.point=Ot,Mt.lineStart=Dt,Mt.lineEnd=zt,kt.reset(),U.polygonStart()},polygonEnd:function(){U.polygonEnd(),Mt.point=Et,Mt.lineStart=Pt,Mt.lineEnd=It,$<0?(tt=-(nt=180),et=-(it=90)):kt>a?it=90:kt<-a&&(et=-90),ct[0]=tt,ct[1]=nt},sphere:function(){tt=-(nt=180),et=-(it=90)}};function Et(t,e){lt.push(ct=[tt=t,nt=t]),eit&&(it=e)}function At(t,e){var n=X([t*d,e*d]);if(st){var i=Y(st,n),r=Y([i[1],-i[0],0],i);Q(r),r=H(r);var o,a=t-rt,s=a>0?1:-1,l=r[0]*h*s,c=f(a)>180;c^(s*rtit&&(it=o):c^(s*rt<(l=(l+360)%360-180)&&lit&&(it=e)),c?tRt(tt,nt)&&(nt=t):Rt(t,nt)>Rt(tt,nt)&&(tt=t):nt>=tt?(tnt&&(nt=t)):t>rt?Rt(tt,t)>Rt(tt,nt)&&(nt=t):Rt(t,nt)>Rt(tt,nt)&&(tt=t)}else lt.push(ct=[tt=t,nt=t]);eit&&(it=e),st=n,rt=t}function Pt(){Mt.point=At}function It(){ct[0]=tt,ct[1]=nt,Mt.point=Et,st=null}function Ot(t,e){if(st){var n=t-rt;kt.add(f(n)>180?n+(n>0?360:-360):n)}else ot=t,at=e;U.point(t,e),At(t,e)}function Dt(){U.lineStart()}function zt(){Ot(ot,at),U.lineEnd(),f(kt)>a&&(tt=-(nt=180)),ct[0]=tt,ct[1]=nt,st=null}function Rt(t,e){return(e-=t)<0?e+360:e}function Lt(t,e){return t[0]-e[0]}function Ft(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:es?t+Math.round(-t/u)*u:t,e]}function Jt(t,e,n){return(t%=u)?e||n?Yt(te(t),ee(e,n)):te(t):e||n?ee(e,n):Kt}function Qt(t){return function(e,n){return[(e+=t)>s?e-u:e<-s?e+u:e,n]}}function te(t){var e=Qt(t);return e.invert=Qt(-t),e}function ee(t,e){var n=g(t),i=b(t),r=g(e),o=b(e);function a(t,e){var a=g(e),s=g(t)*a,l=b(t)*a,c=b(e),u=c*n+s*i;return[m(l*r-u*o,s*n-c*i),k(u*r+l*o)]}return a.invert=function(t,e){var a=g(e),s=g(t)*a,l=b(t)*a,c=b(e),u=c*r-l*o;return[m(l*r+c*o,s*n+u*i),k(u*n-s*i)]},a}function ne(t){function e(e){return(e=t(e[0]*d,e[1]*d))[0]*=h,e[1]*=h,e}return t=Jt(t[0]*d,t[1]*d,t.length>2?t[2]*d:0),e.invert=function(e){return(e=t.invert(e[0]*d,e[1]*d))[0]*=h,e[1]*=h,e},e}function ie(t,e,n,i,r,o){if(n){var a=g(e),s=b(e),l=i*n;null==r?(r=e+i*u,o=e-l/2):(r=re(a,r),o=re(a,o),(i>0?ro)&&(r+=i*u));for(var c,h=r;i>0?h>o:h1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function ae(t,e){return f(t[0]-e[0])=0;--o)r.point((h=u[o])[0],h[1]);else i(f.x,f.p.x,-1,r);f=f.p}u=(f=f.o).z,p=!p}while(!f.v);r.lineEnd()}}}function ce(t){if(e=t.length){for(var e,n,i=0,r=t[0];++i=0?1:-1,z=D*O,R=z>s,L=T*P;if(ue.add(m(L*D*b(z),C*I+L*g(z))),h+=R?O+D*u:O,R^x>=n^E>=n){var F=Y(X(y),X(M));Q(F);var B=Y(o,F);Q(B);var N=(R^O>=0?-1:1)*k(B[2]);(i>N||i===N&&(F[0]||F[1]))&&(d+=R^O>=0?1:-1)}}return(h<-a||h0){for(d||(o.polygonStart(),d=!0),o.lineStart(),t=0;t1&&2&r&&c.push(c.pop().concat(c.shift())),s.push(c.filter(pe))}return f}}function pe(t){return t.length>1}function me(t,e){return((t=t.x)[0]<0?t[1]-l-a:l-t[1])-((e=e.x)[0]<0?e[1]-l-a:l-e[1])}var ge=fe((function(){return!0}),(function(t){var e,n=NaN,i=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,c){var u=o>0?s:-s,h=f(o-n);f(h-s)0?l:-l),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(u,i),t.point(o,i),e=0):r!==u&&h>=s&&(f(n-r)a?p((b(e)*(o=g(i))*b(n)-b(i)*(r=g(e))*b(t))/(r*o*s)):(e+i)/2}(n,i,o,c),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(u,i),e=0),t.point(n=o,i=c),r=u},lineEnd:function(){t.lineEnd(),n=i=NaN},clean:function(){return 2-e}}}),(function(t,e,n,i){var r;if(null==t)r=n*l,i.point(-s,r),i.point(0,r),i.point(s,r),i.point(s,0),i.point(s,-r),i.point(0,-r),i.point(-s,-r),i.point(-s,0),i.point(-s,r);else if(f(t[0]-e[0])>a){var o=t[0]0,r=f(e)>a;function o(t,n){return g(t)*g(n)>e}function l(t,n,i){var r=[1,0,0],o=Y(X(t),X(n)),l=W(o,o),c=o[0],u=l-c*c;if(!u)return!i&&t;var h=e*l/u,d=-e*c/u,p=Y(r,o),m=J(r,h);K(m,J(o,d));var g=p,_=W(m,g),v=W(g,g),y=_*_-v*(W(m,m)-1);if(!(y<0)){var x=T(y),b=J(g,(-_-x)/v);if(K(b,m),b=H(b),!i)return b;var w,C=t[0],S=n[0],k=t[1],M=n[1];S0^b[1]<(f(b[0]-C)s^(C<=b[0]&&b[0]<=S)){var P=J(g,(-_+x)/v);return K(P,m),[b,H(P)]}}}function c(e,n){var r=i?t:s-t,o=0;return e<-r?o|=1:e>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return fe(o,(function(t){var e,n,a,u,h;return{lineStart:function(){u=a=!1,h=1},point:function(d,f){var p,m=[d,f],g=o(d,f),_=i?g?0:c(d,f):g?c(d+(d<0?s:-s),f):0;if(!e&&(u=a=g)&&t.lineStart(),g!==a&&(!(p=l(e,m))||ae(e,p)||ae(m,p))&&(m[2]=1),g!==a)h=0,g?(t.lineStart(),p=l(m,e),t.point(p[0],p[1])):(p=l(e,m),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(r&&e&&i^g){var v;_&n||!(v=l(m,e,!0))||(h=0,i?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!g||e&&ae(e,m)||t.point(m[0],m[1]),e=m,a=g,n=_},lineEnd:function(){a&&t.lineEnd(),e=null},clean:function(){return h|(u&&a)<<1}}}),(function(e,i,r,o){ie(o,t,n,r,e,i)}),i?[0,-t]:[-s,t-s])}function ve(t,n,i,r){function o(e,o){return t<=e&&e<=i&&n<=o&&o<=r}function s(e,o,a,s){var c=0,h=0;if(null==e||(c=l(e,a))!==(h=l(o,a))||u(e,o)<0^a>0)do{s.point(0===c||3===c?t:i,c>1?r:n)}while((c=(c+a+4)%4)!==h);else s.point(o[0],o[1])}function l(e,r){return f(e[0]-t)0?0:3:f(e[0]-i)0?2:1:f(e[1]-n)0?1:0:r>0?3:2}function c(t,e){return u(t.x,e.x)}function u(t,e){var n=l(t,1),i=l(e,1);return n!==i?n-i:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var l,u,h,d,f,p,m,g,_,v,y,x=a,b=oe(),w={point:T,lineStart:function(){w.point=C,u&&u.push(h=[]);v=!0,_=!1,m=g=NaN},lineEnd:function(){l&&(C(d,f),p&&_&&b.rejoin(),l.push(b.result()));w.point=T,_&&x.lineEnd()},polygonStart:function(){x=b,l=[],u=[],y=!0},polygonEnd:function(){var n=function(){for(var e=0,n=0,i=u.length;nr&&(d-o)*(r-a)>(f-a)*(t-o)&&++e:f<=r&&(d-o)*(r-a)<(f-a)*(t-o)&&--e;return e}(),i=y&&n,o=(l=e.merge(l)).length;(i||o)&&(a.polygonStart(),i&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),o&&le(l,c,n,s,a),a.polygonEnd());x=a,l=u=h=null}};function T(t,e){o(t,e)&&x.point(t,e)}function C(e,a){var s=o(e,a);if(u&&h.push([e,a]),v)d=e,f=a,p=s,v=!1,s&&(x.lineStart(),x.point(e,a));else if(s&&_)x.point(e,a);else{var l=[m=Math.max(-1e9,Math.min(1e9,m)),g=Math.max(-1e9,Math.min(1e9,g))],c=[e=Math.max(-1e9,Math.min(1e9,e)),a=Math.max(-1e9,Math.min(1e9,a))];!function(t,e,n,i,r,o){var a,s=t[0],l=t[1],c=0,u=1,h=e[0]-s,d=e[1]-l;if(a=n-s,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>u)return;a>c&&(c=a)}if(a=r-s,h||!(a<0)){if(a/=h,h<0){if(a>u)return;a>c&&(c=a)}else if(h>0){if(a0)){if(a/=d,d<0){if(a0){if(a>u)return;a>c&&(c=a)}if(a=o-l,d||!(a<0)){if(a/=d,d<0){if(a>u)return;a>c&&(c=a)}else if(d>0){if(a0&&(t[0]=s+c*h,t[1]=l+c*d),u<1&&(e[0]=s+u*h,e[1]=l+u*d),!0}}}}}(l,c,t,n,i,r)?s&&(x.lineStart(),x.point(e,a),y=!1):(_||(x.lineStart(),x.point(l[0],l[1])),x.point(c[0],c[1]),s||x.lineEnd(),y=!1)}m=e,g=a,_=s}return w}}var ye,xe,be,we=n(),Te={sphere:E,point:E,lineStart:function(){Te.point=Se,Te.lineEnd=Ce},lineEnd:E,polygonStart:E,polygonEnd:E};function Ce(){Te.point=Te.lineEnd=E}function Se(t,e){ye=t*=d,xe=b(e*=d),be=g(e),Te.point=ke}function ke(t,e){t*=d;var n=b(e*=d),i=g(e),r=f(t-ye),o=g(r),a=i*b(r),s=be*n-xe*i*o,l=xe*n+be*i*o;we.add(m(T(a*a+s*s),l)),ye=t,xe=n,be=i}function Me(t){return we.reset(),z(t,Te),+we}var Ee=[null,null],Ae={type:"LineString",coordinates:Ee};function Pe(t,e){return Ee[0]=t,Ee[1]=e,Me(Ae)}var Ie={Feature:function(t,e){return De(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,r=n.length;++i0&&(r=Pe(t[o],t[o-1]))>0&&n<=r&&i<=r&&(n+i-r)*(1-Math.pow((n-i)/r,2))<1e-12*r)return!0;n=i}return!1}function Le(t,e){return!!de(t.map(Fe),Be(e))}function Fe(t){return(t=t.map(Be)).pop(),t}function Be(t){return[t[0]*d,t[1]*d]}function Ne(t,n,i){var r=e.range(t,n-a,i).concat(n);return function(t){return r.map((function(e){return[t,e]}))}}function $e(t,n,i){var r=e.range(t,n-a,i).concat(n);return function(t){return r.map((function(e){return[e,t]}))}}function je(){var t,n,i,r,o,s,l,c,u,h,d,p,m=10,g=m,v=90,y=360,x=2.5;function b(){return{type:"MultiLineString",coordinates:w()}}function w(){return e.range(_(r/v)*v,i,v).map(d).concat(e.range(_(c/y)*y,l,y).map(p)).concat(e.range(_(n/m)*m,t,m).filter((function(t){return f(t%v)>a})).map(u)).concat(e.range(_(s/g)*g,o,g).filter((function(t){return f(t%y)>a})).map(h))}return b.lines=function(){return w().map((function(t){return{type:"LineString",coordinates:t}}))},b.outline=function(){return{type:"Polygon",coordinates:[d(r).concat(p(l).slice(1),d(i).reverse().slice(1),p(c).reverse().slice(1))]}},b.extent=function(t){return arguments.length?b.extentMajor(t).extentMinor(t):b.extentMinor()},b.extentMajor=function(t){return arguments.length?(r=+t[0][0],i=+t[1][0],c=+t[0][1],l=+t[1][1],r>i&&(t=r,r=i,i=t),c>l&&(t=c,c=l,l=t),b.precision(x)):[[r,c],[i,l]]},b.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],s=+e[0][1],o=+e[1][1],n>t&&(e=n,n=t,t=e),s>o&&(e=s,s=o,o=e),b.precision(x)):[[n,s],[t,o]]},b.step=function(t){return arguments.length?b.stepMajor(t).stepMinor(t):b.stepMinor()},b.stepMajor=function(t){return arguments.length?(v=+t[0],y=+t[1],b):[v,y]},b.stepMinor=function(t){return arguments.length?(m=+t[0],g=+t[1],b):[m,g]},b.precision=function(e){return arguments.length?(x=+e,u=Ne(s,o,90),h=$e(n,t,x),d=Ne(c,l,90),p=$e(r,i,x),b):x},b.extentMajor([[-180,-90+a],[180,90-a]]).extentMinor([[-180,-80-a],[180,80+a]])}function Ue(t){return t}var Ve,qe,Ze,Ge,He=n(),Xe=n(),We={point:E,lineStart:E,lineEnd:E,polygonStart:function(){We.lineStart=Ye,We.lineEnd=Qe},polygonEnd:function(){We.lineStart=We.lineEnd=We.point=E,He.add(f(Xe)),Xe.reset()},result:function(){var t=He/2;return He.reset(),t}};function Ye(){We.point=Ke}function Ke(t,e){We.point=Je,Ve=Ze=t,qe=Ge=e}function Je(t,e){Xe.add(Ge*t-Ze*e),Ze=t,Ge=e}function Qe(){Je(Ve,qe)}var tn=1/0,en=tn,nn=-tn,rn=nn,on={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E,result:function(){var t=[[tn,en],[nn,rn]];return nn=rn=-(en=tn=1/0),t}};var an,sn,ln,cn,un=0,hn=0,dn=0,fn=0,pn=0,mn=0,gn=0,_n=0,vn=0,yn={point:xn,lineStart:bn,lineEnd:Cn,polygonStart:function(){yn.lineStart=Sn,yn.lineEnd=kn},polygonEnd:function(){yn.point=xn,yn.lineStart=bn,yn.lineEnd=Cn},result:function(){var t=vn?[gn/vn,_n/vn]:mn?[fn/mn,pn/mn]:dn?[un/dn,hn/dn]:[NaN,NaN];return un=hn=dn=fn=pn=mn=gn=_n=vn=0,t}};function xn(t,e){un+=t,hn+=e,++dn}function bn(){yn.point=wn}function wn(t,e){yn.point=Tn,xn(ln=t,cn=e)}function Tn(t,e){var n=t-ln,i=e-cn,r=T(n*n+i*i);fn+=r*(ln+t)/2,pn+=r*(cn+e)/2,mn+=r,xn(ln=t,cn=e)}function Cn(){yn.point=xn}function Sn(){yn.point=Mn}function kn(){En(an,sn)}function Mn(t,e){yn.point=En,xn(an=ln=t,sn=cn=e)}function En(t,e){var n=t-ln,i=e-cn,r=T(n*n+i*i);fn+=r*(ln+t)/2,pn+=r*(cn+e)/2,mn+=r,gn+=(r=cn*t-ln*e)*(ln+t),_n+=r*(cn+e),vn+=3*r,xn(ln=t,cn=e)}function An(t){this._context=t}An.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,u)}},result:E};var Pn,In,On,Dn,zn,Rn=n(),Ln={point:E,lineStart:function(){Ln.point=Fn},lineEnd:function(){Pn&&Bn(In,On),Ln.point=E},polygonStart:function(){Pn=!0},polygonEnd:function(){Pn=null},result:function(){var t=+Rn;return Rn.reset(),t}};function Fn(t,e){Ln.point=Bn,In=Dn=t,On=zn=e}function Bn(t,e){Dn-=t,zn-=e,Rn.add(T(Dn*Dn+zn*zn)),Dn=t,zn=e}function Nn(){this._string=[]}function $n(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function jn(t){return function(e){var n=new Un;for(var i in t)n[i]=t[i];return n.stream=e,n}}function Un(){}function Vn(t,e,n){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=i&&t.clipExtent(null),z(n,t.stream(on)),e(on.result()),null!=i&&t.clipExtent(i),t}function qn(t,e,n){return Vn(t,(function(n){var i=e[1][0]-e[0][0],r=e[1][1]-e[0][1],o=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),a=+e[0][0]+(i-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(r-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])}),n)}function Zn(t,e,n){return qn(t,[[0,0],e],n)}function Gn(t,e,n){return Vn(t,(function(n){var i=+e,r=i/(n[1][0]-n[0][0]),o=(i-r*(n[1][0]+n[0][0]))/2,a=-r*n[0][1];t.scale(150*r).translate([o,a])}),n)}function Hn(t,e,n){return Vn(t,(function(n){var i=+e,r=i/(n[1][1]-n[0][1]),o=-r*n[0][0],a=(i-r*(n[1][1]+n[0][1]))/2;t.scale(150*r).translate([o,a])}),n)}Nn.prototype={_radius:4.5,_circle:$n(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=$n(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Un.prototype={constructor:Un,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Xn=g(30*d);function Wn(t,e){return+e?function(t,e){function n(i,r,o,s,l,c,u,h,d,p,g,_,v,y){var x=u-i,b=h-r,w=x*x+b*b;if(w>4*e&&v--){var C=s+p,S=l+g,M=c+_,E=T(C*C+S*S+M*M),A=k(M/=E),P=f(f(M)-1)e||f((x*z+b*R)/w-.5)>.3||s*p+l*g+c*_2?t[2]%360*d:0,O()):[v*h,y*h,x*h]},P.angle=function(t){return arguments.length?(b=t%360*d,O()):b*h},P.reflectX=function(t){return arguments.length?(w=t?-1:1,O()):w<0},P.reflectY=function(t){return arguments.length?(C=t?-1:1,O()):C<0},P.precision=function(t){return arguments.length?(a=Wn(s,A=t*t),D()):T(A)},P.fitExtent=function(t,e){return qn(P,t,e)},P.fitSize=function(t,e){return Zn(P,t,e)},P.fitWidth=function(t,e){return Gn(P,t,e)},P.fitHeight=function(t,e){return Hn(P,t,e)},function(){return e=t.apply(this,arguments),P.invert=e.invert&&I,O()}}function ei(t){var e=0,n=s/3,i=ti(t),r=i(e,n);return r.parallels=function(t){return arguments.length?i(e=t[0]*d,n=t[1]*d):[e*h,n*h]},r}function ni(t,e){var n=b(t),i=(n+b(e))/2;if(f(i)0?e<-l+a&&(e=-l+a):e>l-a&&(e=l-a);var n=r/x(hi(e),i);return[n*b(i*t),r-n*g(i*t)]}return o.invert=function(t,e){var n=r-e,o=w(i)*T(t*t+n*n),a=m(t,f(n))*w(n);return n*i<0&&(a-=s*w(t)*w(n)),[a/i,2*p(x(r/o,1/i))-l]},o}function fi(t,e){return[t,e]}function pi(t,e){var n=g(t),i=t===e?b(t):(n-g(e))/(e-t),r=n/i+t;if(f(i)a&&--r>0);return[t/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},Ti.invert=ai(k),Ci.invert=ai((function(t){return 2*p(t)})),Si.invert=function(t,e){return[-e,2*p(v(t))-l]},t.geoAlbers=ri,t.geoAlbersUsa=function(){var t,e,n,i,r,o,s=ri(),l=ii().rotate([154,0]).center([-2,58.5]).parallels([55,65]),c=ii().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(t,e){o=[t,e]}};function h(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(i.point(e,a),o)||(r.point(e,a),o)}function d(){return t=e=null,h}return h.invert=function(t){var e=s.scale(),n=s.translate(),i=(t[0]-n[0])/e,r=(t[1]-n[1])/e;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?l:r>=.166&&r<.234&&i>=-.214&&i<-.115?c:s).invert(t)},h.stream=function(n){return t&&e===n?t:(i=[s.stream(e=n),l.stream(n),c.stream(n)],r=i.length,t={point:function(t,e){for(var n=-1;++nRt(i[0],i[1])&&(i[1]=r[1]),Rt(r[0],i[1])>Rt(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(a=-1/0,e=0,i=o[n=o.length-1];e<=n;i=r,++e)r=o[e],(s=Rt(i[1],r[0]))>a&&(a=s,tt=r[0],nt=i[1])}return lt=ct=null,tt===1/0||et===1/0?[[NaN,NaN],[NaN,NaN]]:[[tt,et],[nt,it]]},t.geoCentroid=function(t){ut=ht=dt=ft=pt=mt=gt=_t=vt=yt=xt=0,z(t,Bt);var e=vt,n=yt,i=xt,r=e*e+n*n+i*i;return r<1e-12&&(e=mt,n=gt,i=_t,ht2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=Si,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-array":3}],18:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e){return t.parent===e.parent?1:2}function n(t,e){return t+e.x}function i(t,e){return Math.max(t,e.y)}function r(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function o(t,e){var n,i,r,o,s,u=new c(t),h=+t.value&&(u.value=t.value),d=[u];for(null==e&&(e=a);n=d.pop();)if(h&&(n.value=+n.data.value),(r=e(n.data))&&(s=r.length))for(n.children=new Array(s),o=s-1;o>=0;--o)d.push(i=n.children[o]=new c(r[o])),i.parent=n,i.depth=n.depth+1;return u.eachBefore(l)}function a(t){return t.children}function s(t){t.data=t.data.data}function l(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function c(t){this.data=t,this.depth=this.height=0,this.parent=null}c.prototype=o.prototype={constructor:c,count:function(){return this.eachAfter(r)},each:function(t){var e,n,i,r,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(i=0,r=n.length;i=0;--n)r.push(e[n]);return this},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;t=n.pop(),e=i.pop();for(;t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return o(this).eachBefore(s)}};var u=Array.prototype.slice;function h(t){for(var e,n,i=0,r=(t=function(t){for(var e,n,i=t.length;i;)n=Math.random()*i--|0,e=t[i],t[i]=t[n],t[n]=e;return t}(u.call(t))).length,o=[];i0&&n*n>i*i+r*r}function m(t,e){for(var n=0;n(a*=a)?(i=(c+a-r)/(2*c),o=Math.sqrt(Math.max(0,a/c-i*i)),n.x=t.x-i*s-o*l,n.y=t.y-i*l+o*s):(i=(c+r-a)/(2*c),o=Math.sqrt(Math.max(0,r/c-i*i)),n.x=e.x+i*s-o*l,n.y=e.y+i*l+o*s)):(n.x=e.x+n.r,n.y=e.y)}function x(t,e){var n=t.r+e.r-1e-6,i=e.x-t.x,r=e.y-t.y;return n>0&&n*n>i*i+r*r}function b(t){var e=t._,n=t.next._,i=e.r+n.r,r=(e.x*n.r+n.x*e.r)/i,o=(e.y*n.r+n.y*e.r)/i;return r*r+o*o}function w(t){this._=t,this.next=null,this.previous=null}function T(t){if(!(r=t.length))return 0;var e,n,i,r,o,a,s,l,c,u,d;if((e=t[0]).x=0,e.y=0,!(r>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(r>2))return e.r+n.r;y(n,e,i=t[2]),e=new w(e),n=new w(n),i=new w(i),e.next=i.previous=n,n.next=e.previous=i,i.next=n.previous=e;t:for(s=3;sd&&(d=s),g=u*u*m,(f=Math.max(d/g,g/h))>p){u-=s;break}p=f}_.push(a={value:u,dice:l1?e:1)},n}(Z);var X=function t(e){function n(t,n,i,r,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,l,c,u,h=-1,d=a.length,f=t.value;++h1?e:1)},n}(Z);t.cluster=function(){var t=e,r=1,o=1,a=!1;function s(e){var s,l=0;e.eachAfter((function(e){var r=e.children;r?(e.x=function(t){return t.reduce(n,0)/t.length}(r),e.y=function(t){return 1+t.reduce(i,0)}(r)):(e.x=s?l+=t(e,s):0,e.y=0,s=e)}));var c=function(t){for(var e;e=t.children;)t=e[0];return t}(e),u=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(e),h=c.x-t(c,u)/2,d=u.x+t(u,c)/2;return e.eachAfter(a?function(t){t.x=(t.x-e.x)*r,t.y=(e.y-t.y)*o}:function(t){t.x=(t.x-h)/(d-h)*r,t.y=(1-(e.y?t.y/e.y:1))*o})}return s.separation=function(e){return arguments.length?(t=e,s):t},s.size=function(t){return arguments.length?(a=!1,r=+t[0],o=+t[1],s):a?null:[r,o]},s.nodeSize=function(t){return arguments.length?(a=!0,r=+t[0],o=+t[1],s):a?[r,o]:null},s},t.hierarchy=o,t.pack=function(){var t=null,e=1,n=1,i=k;function r(r){return r.x=e/2,r.y=n/2,t?r.eachBefore(A(t)).eachAfter(P(i,.5)).eachBefore(I(1)):r.eachBefore(A(E)).eachAfter(P(k,1)).eachAfter(P(i,r.r/Math.min(e,n))).eachBefore(I(Math.min(e,n)/(2*r.r))),r}return r.radius=function(e){return arguments.length?(t=C(e),r):t},r.size=function(t){return arguments.length?(e=+t[0],n=+t[1],r):[e,n]},r.padding=function(t){return arguments.length?(i="function"==typeof t?t:M(+t),r):i},r},t.packEnclose=h,t.packSiblings=function(t){return T(t),t},t.partition=function(){var t=1,e=1,n=0,i=!1;function r(r){var o=r.height+1;return r.x0=r.y0=n,r.x1=t,r.y1=e/o,r.eachBefore(function(t,e){return function(i){i.children&&D(i,i.x0,t*(i.depth+1)/e,i.x1,t*(i.depth+2)/e);var r=i.x0,o=i.y0,a=i.x1-n,s=i.y1-n;a0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=S(e),n):t},n.parentId=function(t){return arguments.length?(e=S(t),n):e},n},t.tree=function(){var t=B,e=1,n=1,i=null;function r(r){var l=function(t){for(var e,n,i,r,o,a=new V(t,0),s=[a];e=s.pop();)if(i=e._.children)for(e.children=new Array(o=i.length),r=o-1;r>=0;--r)s.push(n=e.children[r]=new V(i[r],r)),n.parent=e;return(a.parent=new V(null,0)).children=[a],a}(r);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),i)r.eachBefore(s);else{var c=r,u=r,h=r;r.eachBefore((function(t){t.xu.x&&(u=t),t.depth>h.depth&&(h=t)}));var d=c===u?1:t(c,u)/2,f=d-c.x,p=e/(u.x+d+f),m=n/(h.depth||1);r.eachBefore((function(t){t.x=(t.x+f)*p,t.y=t.depth*m}))}return r}function o(e){var n=e.children,i=e.parent.children,r=e.i?i[e.i-1]:null;if(n){!function(t){for(var e,n=0,i=0,r=t.children,o=r.length;--o>=0;)(e=r[o]).z+=n,e.m+=n,n+=e.s+(i+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;r?(e.z=r.z+t(e._,r._),e.m=e.z-o):e.z=o}else r&&(e.z=r.z+t(e._,r._));e.parent.A=function(e,n,i){if(n){for(var r,o=e,a=e,s=n,l=o.parent.children[0],c=o.m,u=a.m,h=s.m,d=l.m;s=$(s),o=N(o),s&&o;)l=N(l),(a=$(a)).a=e,(r=s.z+h-o.z-c+t(s._,o._))>0&&(j(U(s,e,i),e,r),c+=r,u+=r),h+=s.m,c+=o.m,d+=l.m,u+=a.m;s&&!$(a)&&(a.t=s,a.m+=h-u),o&&!N(l)&&(l.t=o,l.m+=c-d,i=e)}return i}(e,r,e.parent.A||i[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return r.separation=function(e){return arguments.length?(t=e,r):t},r.size=function(t){return arguments.length?(i=!1,e=+t[0],n=+t[1],r):i?null:[e,n]},r.nodeSize=function(t){return arguments.length?(i=!0,e=+t[0],n=+t[1],r):i?[e,n]:null},r},t.treemap=function(){var t=H,e=!1,n=1,i=1,r=[0],o=k,a=k,s=k,l=k,c=k;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=i,t.eachBefore(h),r=[0],e&&t.eachBefore(O),t}function h(e){var n=r[e.depth],i=e.x0+n,u=e.y0+n,h=e.x1-n,d=e.y1-n;h=n-1){var u=s[e];return u.x0=r,u.y0=o,u.x1=a,void(u.y1=l)}var h=c[e],d=i/2+h,f=e+1,p=n-1;for(;f>>1;c[m]l-o){var v=(r*_+a*g)/i;t(e,f,g,r,o,v,l),t(f,n,_,v,o,a,l)}else{var y=(o*_+l*g)/i;t(e,f,g,r,o,a,y),t(f,n,_,r,y,a,l)}}(0,l,t.value,e,n,i,r)},t.treemapDice=D,t.treemapResquarify=X,t.treemapSlice=q,t.treemapSliceDice=function(t,e,n,i,r){(1&t.depth?q:D)(t,e,n,i,r)},t.treemapSquarify=H,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],19:[function(t,e,n){!function(i,r){"object"==typeof n&&void 0!==e?r(n,t("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-color"],r):r((i=i||self).d3=i.d3||{},i.d3)}(this,(function(t,e){"use strict";function n(t,e,n,i,r){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*i+a*r)/6}function i(t){var e=t.length-1;return function(i){var r=i<=0?i=0:i>=1?(i=1,e-1):Math.floor(i*e),o=t[r],a=t[r+1],s=r>0?t[r-1]:2*o-a,l=r180||n<-180?n-360*Math.round(n/360):n):o(isNaN(t)?e:t)}function l(t){return 1==(t=+t)?c:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):o(isNaN(e)?n:e)}}function c(t,e){var n=e-t;return n?a(t,n):o(isNaN(t)?e:t)}var u=function t(n){var i=l(n);function r(t,n){var r=i((t=e.rgb(t)).r,(n=e.rgb(n)).r),o=i(t.g,n.g),a=i(t.b,n.b),s=c(t.opacity,n.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=a(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function h(t){return function(n){var i,r,o=n.length,a=new Array(o),s=new Array(o),l=new Array(o);for(i=0;io&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:v(n,i)})),o=b.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:v(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:v(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(o.skewX,a.skewX,s,l),function(t,e,n,i,o,a){if(t!==n||e!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:v(t,n)},{i:s-2,x:v(e,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,i=l.length;++n1e-6)if(Math.abs(h*l-c*u)>1e-6&&o){var f=i-a,p=r-s,m=l*l+c*c,g=f*f+p*p,_=Math.sqrt(m),v=Math.sqrt(d),y=o*Math.tan((e-Math.acos((m+d-g)/(2*_*v)))/2),x=y/v,b=y/_;Math.abs(x-1)>1e-6&&(this._+="L"+(t+x*u)+","+(n+x*h)),this._+="A"+o+","+o+",0,0,"+ +(h*f>u*p)+","+(this._x1=t+b*l)+","+(this._y1=n+b*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,r,o,a,s,l){t=+t,r=+r,l=!!l;var c=(o=+o)*Math.cos(a),u=o*Math.sin(a),h=t+c,d=r+u,f=1^l,p=l?a-s:s-a;if(o<0)throw new Error("negative radius: "+o);null===this._x1?this._+="M"+h+","+d:(Math.abs(this._x1-h)>1e-6||Math.abs(this._y1-d)>1e-6)&&(this._+="L"+h+","+d),o&&(p<0&&(p=p%n+n),p>i?this._+="A"+o+","+o+",0,1,"+f+","+(t-c)+","+(r-u)+"A"+o+","+o+",0,1,"+f+","+(this._x1=h)+","+(this._y1=d):p>1e-6&&(this._+="A"+o+","+o+",0,"+ +(p>=e)+","+f+","+(this._x1=t+o*Math.cos(s))+","+(this._y1=r+o*Math.sin(s))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}},t.path=o,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],21:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e){return t[0]-e[0]||t[1]-e[1]}function n(t){for(var e,n,i,r=t.length,o=[0,1],a=2,s=2;s1&&(e=t[o[a-2]],n=t[o[a-1]],i=t[s],(n[0]-e[0])*(i[1]-e[1])-(n[1]-e[1])*(i[0]-e[0])<=0);)--a;o[a++]=s}return o.slice(0,a)}t.polygonArea=function(t){for(var e,n=-1,i=t.length,r=t[i-1],o=0;++ns!=c>s&&a<(l-n)*(s-i)/(c-i)+n&&(u=!u),l=n,c=i;return u},t.polygonHull=function(t){if((r=t.length)<3)return null;var i,r,o=new Array(r),a=new Array(r);for(i=0;i=0;--i)h.push(t[o[s[i]][2]]);for(i=+c;i=(o=(m+_)/2))?m=o:_=o,(u=n>=(a=(g+v)/2))?g=a:v=a,r=f,!(f=f[h=u<<1|c]))return r[h]=p,t;if(s=+t._x.call(null,f.data),l=+t._y.call(null,f.data),e===s&&n===l)return p.next=f,r?r[h]=p:t._root=p,t;do{r=r?r[h]=new Array(4):t._root=new Array(4),(c=e>=(o=(m+_)/2))?m=o:_=o,(u=n>=(a=(g+v)/2))?g=a:v=a}while((h=u<<1|c)==(d=(l>=a)<<1|s>=o));return r[d]=f,r[h]=p,t}function n(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r}function i(t){return t[0]}function r(t){return t[1]}function o(t,e,n){var o=new a(null==e?i:e,null==n?r:n,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function a(t,e,n,i,r,o){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function s(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var l=o.prototype=a.prototype;l.copy=function(){var t,e,n=new a(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=s(i),n;for(t=[{source:i,target:n._root=new Array(4)}];i=t.pop();)for(var r=0;r<4;++r)(e=i.source[r])&&(e.length?t.push({source:e,target:i.target[r]=new Array(4)}):i.target[r]=s(e));return n},l.add=function(t){var n=+this._x.call(null,t),i=+this._y.call(null,t);return e(this.cover(n,i),n,i,t)},l.addAll=function(t){var n,i,r,o,a=t.length,s=new Array(a),l=new Array(a),c=1/0,u=1/0,h=-1/0,d=-1/0;for(i=0;ih&&(h=r),od&&(d=o));if(c>h||u>d)return this;for(this.cover(c,u).cover(h,d),i=0;it||t>=r||i>e||e>=o;)switch(s=(ef||(a=c.y0)>p||(s=c.x1)=v)<<1|t>=_)&&(c=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=c)}else{var y=t-+this._x.call(null,g.data),x=e-+this._y.call(null,g.data),b=y*y+x*x;if(b=(s=(p+g)/2))?p=s:g=s,(u=a>=(l=(m+_)/2))?m=l:_=l,e=f,!(f=f[h=u<<1|c]))return this;if(!f.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,d=h)}for(;f.data!==t;)if(i=f,!(f=f.next))return this;return(r=f.next)&&delete f.next,i?(r?i.next=r:delete i.next,this):e?(r?e[h]=r:delete e[h],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(n?n[d]=f:this._root=f),this):(this._root=r,this)},l.removeAll=function(t){for(var e=0,n=t.length;e1);return t+n*o*Math.sqrt(-2*Math.log(r)/r)}}return n.source=t,n}(e),r=function t(e){function n(){var t=i.source(e).apply(this,arguments);return function(){return Math.exp(t())}}return n.source=t,n}(e),o=function t(e){function n(t){return function(){for(var n=0,i=0;i1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return vt.h=360*t-100,vt.s=1.5-1.5*e,vt.l=.8-.9*e,vt+""},t.interpolateRdBu=C,t.interpolateRdGy=k,t.interpolateRdPu=X,t.interpolateRdYlBu=E,t.interpolateRdYlGn=P,t.interpolateReds=dt,t.interpolateSinebow=function(t){var e;return t=(.5-t)*Math.PI,yt.r=255*(e=Math.sin(t))*e,yt.g=255*(e=Math.sin(t+xt))*e,yt.b=255*(e=Math.sin(t+bt))*e,yt+""},t.interpolateSpectral=O,t.interpolateTurbo=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"},t.interpolateViridis=Tt,t.interpolateWarm=gt,t.interpolateYlGn=J,t.interpolateYlGnBu=Y,t.interpolateYlOrBr=tt,t.interpolateYlOrRd=nt,t.schemeAccent=o,t.schemeBlues=it,t.schemeBrBG=m,t.schemeBuGn=D,t.schemeBuPu=R,t.schemeCategory10=r,t.schemeDark2=a,t.schemeGnBu=F,t.schemeGreens=ot,t.schemeGreys=st,t.schemeOrRd=N,t.schemeOranges=ft,t.schemePRGn=_,t.schemePaired=s,t.schemePastel1=l,t.schemePastel2=c,t.schemePiYG=y,t.schemePuBu=V,t.schemePuBuGn=j,t.schemePuOr=b,t.schemePuRd=Z,t.schemePurples=ct,t.schemeRdBu=T,t.schemeRdGy=S,t.schemeRdPu=H,t.schemeRdYlBu=M,t.schemeRdYlGn=A,t.schemeReds=ht,t.schemeSet1=u,t.schemeSet2=h,t.schemeSet3=d,t.schemeSpectral=I,t.schemeTableau10=f,t.schemeYlGn=K,t.schemeYlGnBu=W,t.schemeYlOrBr=Q,t.schemeYlOrRd=et,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-color":8,"d3-interpolate":19}],25:[function(t,e,n){!function(i,r){"object"==typeof n&&void 0!==e?r(n,t("d3-collection"),t("d3-array"),t("d3-interpolate"),t("d3-format"),t("d3-time"),t("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-collection","d3-array","d3-interpolate","d3-format","d3-time","d3-time-format"],r):r(i.d3=i.d3||{},i.d3,i.d3,i.d3,i.d3,i.d3,i.d3)}(this,(function(t,e,n,i,r,o,a){"use strict";function s(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function l(t,e){switch(arguments.length){case 0:break;case 1:this.interpolator(t);break;default:this.interpolator(e).domain(t)}return this}var c=Array.prototype,u=c.map,h=c.slice,d={name:"implicit"};function f(){var t=e.map(),n=[],i=[],r=d;function o(e){var o=e+"",a=t.get(o);if(!a){if(r!==d)return r;t.set(o,a=n.push(e))}return i[(a-1)%i.length]}return o.domain=function(i){if(!arguments.length)return n.slice();n=[],t=e.map();for(var r,a,s=-1,l=i.length;++si&&(e=n,n=i,i=e),function(t){return Math.max(n,Math.min(i,t))}}function b(t,e,n){var i=t[0],r=t[1],o=e[0],a=e[1];return r2?w:b,o=a=null,p}function p(e){return isNaN(e=+e)?n:(o||(o=r(s.map(t),l,c)))(t(d(e)))}return p.invert=function(n){return d(e((a||(a=r(l,s.map(t),i.interpolateNumber)))(n)))},p.domain=function(t){return arguments.length?(s=u.call(t,g),d===v||(d=x(s)),f()):s.slice()},p.range=function(t){return arguments.length?(l=h.call(t),f()):l.slice()},p.rangeRound=function(t){return l=h.call(t),c=i.interpolateRound,f()},p.clamp=function(t){return arguments.length?(d=t?x(s):v,p):d!==v},p.interpolate=function(t){return arguments.length?(c=t,f()):c},p.unknown=function(t){return arguments.length?(n=t,p):n},function(n,i){return t=n,e=i,f()}}function S(t,e){return C()(t,e)}function k(t,e,i,o){var a,s=n.tickStep(t,e,i);switch((o=r.formatSpecifier(null==o?",f":o)).type){case"s":var l=Math.max(Math.abs(t),Math.abs(e));return null!=o.precision||isNaN(a=r.precisionPrefix(s,l))||(o.precision=a),r.formatPrefix(o,l);case"":case"e":case"g":case"p":case"r":null!=o.precision||isNaN(a=r.precisionRound(s,Math.max(Math.abs(t),Math.abs(e))))||(o.precision=a-("e"===o.type));break;case"f":case"%":null!=o.precision||isNaN(a=r.precisionFixed(s))||(o.precision=a-2*("%"===o.type))}return r.format(o)}function M(t){var e=t.domain;return t.ticks=function(t){var i=e();return n.ticks(i[0],i[i.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return k(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(i){null==i&&(i=10);var r,o=e(),a=0,s=o.length-1,l=o[a],c=o[s];return c0?(l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r,r=n.tickIncrement(l,c,i)):r<0&&(l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r,r=n.tickIncrement(l,c,i)),r>0?(o[a]=Math.floor(l/r)*r,o[s]=Math.ceil(c/r)*r,e(o)):r<0&&(o[a]=Math.ceil(l*r)/r,o[s]=Math.floor(c*r)/r,e(o)),t},t}function E(t,e){var n,i=0,r=(t=t.slice()).length-1,o=t[i],a=t[r];return a0){for(;fc)break;g.push(d)}}else for(;f=1;--h)if(!((d=u*h)c)break;g.push(d)}}else g=n.ticks(f,p,Math.min(p-f,m)).map(i);return r?g.reverse():g},o.tickFormat=function(t,n){if(null==n&&(n=10===s?".0e":","),"function"!=typeof n&&(n=r.format(n)),t===1/0)return n;null==t&&(t=10);var a=Math.max(1,s*t/o.ticks().length);return function(t){var r=t/i(Math.round(e(t)));return r*s0?o[e-1]:i[0],e=o?[a[o-1],r]:[a[e-1],a[e]]},c.unknown=function(t){return arguments.length?(e=t,c):c},c.thresholds=function(){return a.slice()},c.copy=function(){return t().domain([i,r]).range(l).unknown(e)},s.apply(M(c),arguments)},t.scaleThreshold=function t(){var e,i=[.5],r=[0,1],o=1;function a(t){return t<=t?r[n.bisect(i,t,0,o)]:e}return a.domain=function(t){return arguments.length?(i=h.call(t),o=Math.min(i.length,r.length-1),a):i.slice()},a.range=function(t){return arguments.length?(r=h.call(t),o=Math.min(i.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var e=r.indexOf(t);return[i[e-1],i[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(i).range(r).unknown(e)},s.apply(a,arguments)},t.scaleTime=function(){return s.apply(G(o.timeYear,o.timeMonth,o.timeWeek,o.timeDay,o.timeHour,o.timeMinute,o.timeSecond,o.timeMillisecond,a.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},t.scaleUtc=function(){return s.apply(G(o.utcYear,o.utcMonth,o.utcWeek,o.utcDay,o.utcHour,o.utcMinute,o.utcSecond,o.utcMillisecond,a.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},t.scaleSequential=function t(){var e=M(H()(v));return e.copy=function(){return X(e,t())},l.apply(e,arguments)},t.scaleSequentialLog=function t(){var e=R(H()).domain([1,10]);return e.copy=function(){return X(e,t()).base(e.base())},l.apply(e,arguments)},t.scaleSequentialPow=W,t.scaleSequentialSqrt=function(){return W.apply(null,arguments).exponent(.5)},t.scaleSequentialSymlog=function t(){var e=B(H());return e.copy=function(){return X(e,t()).constant(e.constant())},l.apply(e,arguments)},t.scaleSequentialQuantile=function t(){var e=[],i=v;function r(t){if(!isNaN(t=+t))return i((n.bisect(e,t)-1)/(e.length-1))}return r.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var i,o=0,a=t.length;o=0&&"xmlns"!==(e=t.slice(0,i))&&(t=t.slice(i+1)),n.hasOwnProperty(e)?{space:n[e],local:t}:t}function r(t){return function(){var n=this.ownerDocument,i=this.namespaceURI;return i===e&&n.documentElement.namespaceURI===e?n.createElement(t):n.createElementNS(i,t)}}function o(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function a(t){var e=i(t);return(e.local?o:r)(e)}function s(){}function l(t){return null==t?s:function(){return this.querySelector(t)}}function c(){return[]}function u(t){return null==t?c:function(){return this.querySelectorAll(t)}}function h(t){return function(){return this.matches(t)}}function d(t){return new Array(t.length)}function f(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}f.prototype={constructor:f,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function p(t,e,n,i,r,o){for(var a,s=0,l=e.length,c=o.length;se?1:t>=e?0:NaN}function _(t){return function(){this.removeAttribute(t)}}function v(t){return function(){this.removeAttributeNS(t.space,t.local)}}function y(t,e){return function(){this.setAttribute(t,e)}}function x(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function b(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function w(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function T(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function C(t){return function(){this.style.removeProperty(t)}}function S(t,e,n){return function(){this.style.setProperty(t,e,n)}}function k(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function M(t,e){return t.style.getPropertyValue(e)||T(t).getComputedStyle(t,null).getPropertyValue(e)}function E(t){return function(){delete this[t]}}function A(t,e){return function(){this[t]=e}}function P(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function I(t){return t.trim().split(/^|\s+/)}function O(t){return t.classList||new D(t)}function D(t){this._node=t,this._names=I(t.getAttribute("class")||"")}function z(t,e){for(var n=O(t),i=-1,r=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var K={};(t.event=null,"undefined"!=typeof document)&&("onmouseenter"in document.documentElement||(K={mouseenter:"mouseover",mouseleave:"mouseout"}));function J(t,e,n){return t=Q(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function Q(e,n,i){return function(r){var o=t.event;t.event=r;try{e.call(this,this.__data__,n,i)}finally{t.event=o}}}function tt(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function et(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i=T&&(T=w+1);!(b=y[T])&&++T<_;);x._next=b||null}}return(s=new st(s,r))._enter=l,s._exit=c,s},enter:function(){return new st(this._enter||this._groups.map(d),this._parents)},exit:function(){return new st(this._exit||this._groups.map(d),this._parents)},join:function(t,e,n){var i=this.enter(),r=this,o=this.exit();return i="function"==typeof t?t(i):i.append(t+""),null!=e&&(r=e(r)),null==n?o.remove():n(o),i&&r?i.merge(r).order():r},merge:function(t){for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),a=new Array(i),s=0;s=0;)(i=r[o])&&(a&&4^i.compareDocumentPosition(a)&&a.parentNode.insertBefore(i,a),a=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=g);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o1?this.each((null==e?C:"function"==typeof e?k:S)(t,e,null==n?"":n)):M(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?E:"function"==typeof e?P:A)(t,e)):this.node()[t]},classed:function(t,e){var n=I(t+"");if(arguments.length<2){for(var i=O(this.node()),r=-1,o=n.length;++r1?0:t<-1?u:Math.acos(t)}function p(t){return t>=1?h:t<=-1?-h:Math.asin(t)}function m(t){return t.innerRadius}function g(t){return t.outerRadius}function _(t){return t.startAngle}function v(t){return t.endAngle}function y(t){return t&&t.padAngle}function x(t,e,n,i,r,o,a,s){var l=n-t,c=i-e,u=a-r,h=s-o,d=h*l-u*c;if(!(d*d<1e-12))return[t+(d=(u*(e-o)-h*(t-r))/d)*l,e+d*c]}function b(t,e,n,i,r,o,s){var l=t-n,u=e-i,h=(s?o:-o)/c(l*l+u*u),d=h*u,f=-h*l,p=t+d,m=e+f,g=n+d,_=i+f,v=(p+g)/2,y=(m+_)/2,x=g-p,b=_-m,w=x*x+b*b,T=r-o,C=p*_-g*m,S=(b<0?-1:1)*c(a(0,T*T*w-C*C)),k=(C*b-x*S)/w,M=(-C*x-b*S)/w,E=(C*b+x*S)/w,A=(-C*x+b*S)/w,P=k-v,I=M-y,O=E-v,D=A-y;return P*P+I*I>O*O+D*D&&(k=E,M=A),{cx:k,cy:M,x01:-d,y01:-f,x11:k*(r/T-1),y11:M*(r/T-1)}}function w(t){this._context=t}function T(t){return new w(t)}function C(t){return t[0]}function S(t){return t[1]}function k(){var t=C,i=S,r=n(!0),o=null,a=T,s=null;function l(n){var l,c,u,h=n.length,d=!1;for(null==o&&(s=a(u=e.path())),l=0;l<=h;++l)!(l=h;--d)c.point(_[d],v[d]);c.lineEnd(),c.areaEnd()}g&&(_[u]=+t(f,u,n),v[u]=+r(f,u,n),c.point(i?+i(f,u,n):_[u],o?+o(f,u,n):v[u]))}if(p)return c=null,p+""||null}function h(){return k().defined(a).curve(l).context(s)}return u.x=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),i=null,u):t},u.x0=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),u):t},u.x1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:n(+t),u):i},u.y=function(t){return arguments.length?(r="function"==typeof t?t:n(+t),o=null,u):r},u.y0=function(t){return arguments.length?(r="function"==typeof t?t:n(+t),u):r},u.y1=function(t){return arguments.length?(o=null==t?null:"function"==typeof t?t:n(+t),u):o},u.lineX0=u.lineY0=function(){return h().x(t).y(r)},u.lineY1=function(){return h().x(t).y(o)},u.lineX1=function(){return h().x(i).y(r)},u.defined=function(t){return arguments.length?(a="function"==typeof t?t:n(!!t),u):a},u.curve=function(t){return arguments.length?(l=t,null!=s&&(c=l(s)),u):l},u.context=function(t){return arguments.length?(null==t?s=c=null:c=l(s=t),u):s},u}function E(t,e){return et?1:e>=t?0:NaN}function A(t){return t}w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var P=O(T);function I(t){this._curve=t}function O(t){function e(e){return new I(t(e))}return e._curve=t,e}function D(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(O(t)):e()._curve},t}function z(){return D(k().curve(P))}function R(){var t=M().curve(P),e=t.curve,n=t.lineX0,i=t.lineX1,r=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return D(n())},delete t.lineX0,t.lineEndAngle=function(){return D(i())},delete t.lineX1,t.lineInnerRadius=function(){return D(r())},delete t.lineY0,t.lineOuterRadius=function(){return D(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(O(t)):e()._curve},t}function L(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}I.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};var F=Array.prototype.slice;function B(t){return t.source}function N(t){return t.target}function $(t){var i=B,r=N,o=C,a=S,s=null;function l(){var n,l=F.call(arguments),c=i.apply(this,l),u=r.apply(this,l);if(s||(s=n=e.path()),t(s,+o.apply(this,(l[0]=c,l)),+a.apply(this,l),+o.apply(this,(l[0]=u,l)),+a.apply(this,l)),n)return s=null,n+""||null}return l.source=function(t){return arguments.length?(i=t,l):i},l.target=function(t){return arguments.length?(r=t,l):r},l.x=function(t){return arguments.length?(o="function"==typeof t?t:n(+t),l):o},l.y=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),l):a},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function j(t,e,n,i,r){t.moveTo(e,n),t.bezierCurveTo(e=(e+i)/2,n,e,r,i,r)}function U(t,e,n,i,r){t.moveTo(e,n),t.bezierCurveTo(e,n=(n+r)/2,i,n,i,r)}function V(t,e,n,i,r){var o=L(e,n),a=L(e,n=(n+r)/2),s=L(i,n),l=L(i,r);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],s[0],s[1],l[0],l[1])}var q={draw:function(t,e){var n=Math.sqrt(e/u);t.moveTo(n,0),t.arc(0,0,n,0,d)}},Z={draw:function(t,e){var n=Math.sqrt(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},G=Math.sqrt(1/3),H=2*G,X={draw:function(t,e){var n=Math.sqrt(e/H),i=n*G;t.moveTo(0,-n),t.lineTo(i,0),t.lineTo(0,n),t.lineTo(-i,0),t.closePath()}},W=Math.sin(u/10)/Math.sin(7*u/10),Y=Math.sin(d/10)*W,K=-Math.cos(d/10)*W,J={draw:function(t,e){var n=Math.sqrt(.8908130915292852*e),i=Y*n,r=K*n;t.moveTo(0,-n),t.lineTo(i,r);for(var o=1;o<5;++o){var a=d*o/5,s=Math.cos(a),l=Math.sin(a);t.lineTo(l*n,-s*n),t.lineTo(s*i-l*r,l*i+s*r)}t.closePath()}},Q={draw:function(t,e){var n=Math.sqrt(e),i=-n/2;t.rect(i,i,n,n)}},tt=Math.sqrt(3),et={draw:function(t,e){var n=-Math.sqrt(e/(3*tt));t.moveTo(0,2*n),t.lineTo(-tt*n,-n),t.lineTo(tt*n,-n),t.closePath()}},nt=-.5,it=Math.sqrt(3)/2,rt=1/Math.sqrt(12),ot=3*(rt/2+1),at={draw:function(t,e){var n=Math.sqrt(e/ot),i=n/2,r=n*rt,o=i,a=n*rt+n,s=-o,l=a;t.moveTo(i,r),t.lineTo(o,a),t.lineTo(s,l),t.lineTo(nt*i-it*r,it*i+nt*r),t.lineTo(nt*o-it*a,it*o+nt*a),t.lineTo(nt*s-it*l,it*s+nt*l),t.lineTo(nt*i+it*r,nt*r-it*i),t.lineTo(nt*o+it*a,nt*a-it*o),t.lineTo(nt*s+it*l,nt*l-it*s),t.closePath()}},st=[q,Z,X,Q,J,et,at];function lt(){}function ct(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function ut(t){this._context=t}function ht(t){this._context=t}function dt(t){this._context=t}function ft(t,e){this._basis=new ut(t),this._beta=e}ut.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ct(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ht.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},dt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,i=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ft.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var i,r=t[0],o=e[0],a=t[n]-r,s=e[n]-o,l=-1;++l<=n;)i=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(r+i*a),this._beta*e[l]+(1-this._beta)*(o+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var pt=function t(e){function n(t){return 1===e?new ut(t):new ft(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function mt(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function gt(t,e){this._context=t,this._k=(1-e)/6}gt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:mt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:mt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var _t=function t(e){function n(t){return new gt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function vt(t,e){this._context=t,this._k=(1-e)/6}vt.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:mt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var yt=function t(e){function n(t){return new vt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function xt(t,e){this._context=t,this._k=(1-e)/6}xt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:mt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var bt=function t(e){function n(t){return new xt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function wt(t,e,n){var i=t._x1,r=t._y1,o=t._x2,a=t._y2;if(t._l01_a>1e-12){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,r=(r*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>1e-12){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(i,r,o,a,t._x2,t._y2)}function Tt(t,e){this._context=t,this._alpha=e}Tt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ct=function t(e){function n(t){return e?new Tt(t,e):new gt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function St(t,e){this._context=t,this._alpha=e}St.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var kt=function t(e){function n(t){return e?new St(t,e):new vt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Mt(t,e){this._context=t,this._alpha=e}Mt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Et=function t(e){function n(t){return e?new Mt(t,e):new xt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function At(t){this._context=t}function Pt(t){return t<0?-1:1}function It(t,e,n){var i=t._x1-t._x0,r=e-t._x1,o=(t._y1-t._y0)/(i||r<0&&-0),a=(n-t._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(Pt(o)+Pt(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Ot(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Dt(t,e,n){var i=t._x0,r=t._y0,o=t._x1,a=t._y1,s=(o-i)/3;t._context.bezierCurveTo(i+s,r+s*e,o-s,a-s*n,o,a)}function zt(t){this._context=t}function Rt(t){this._context=new Lt(t)}function Lt(t){this._context=t}function Ft(t){this._context=t}function Bt(t){var e,n,i=t.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)r[e]=(a[e]-r[e+1])/o[e];for(o[i-1]=(t[i]+r[i-1])/2,e=0;e1)for(var n,i,r,o=1,a=t[e[0]],s=a.length;o=0;)n[e]=e;return n}function Ut(t,e){return t[e]}function Vt(t){var e=t.map(qt);return jt(t).sort((function(t,n){return e[t]-e[n]}))}function qt(t){for(var e,n=-1,i=0,r=t.length,o=-1/0;++no&&(o=e,i=n);return i}function Zt(t){var e=t.map(Gt);return jt(t).sort((function(t,n){return e[t]-e[n]}))}function Gt(t){for(var e,n=0,i=-1,r=t.length;++i=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}},t.arc=function(){var t=m,a=g,w=n(0),T=null,C=_,S=v,k=y,M=null;function E(){var n,m,g=+t.apply(this,arguments),_=+a.apply(this,arguments),v=C.apply(this,arguments)-h,y=S.apply(this,arguments)-h,E=i(y-v),A=y>v;if(M||(M=n=e.path()),_1e-12)if(E>d-1e-12)M.moveTo(_*o(v),_*l(v)),M.arc(0,0,_,v,y,!A),g>1e-12&&(M.moveTo(g*o(y),g*l(y)),M.arc(0,0,g,y,v,A));else{var P,I,O=v,D=y,z=v,R=y,L=E,F=E,B=k.apply(this,arguments)/2,N=B>1e-12&&(T?+T.apply(this,arguments):c(g*g+_*_)),$=s(i(_-g)/2,+w.apply(this,arguments)),j=$,U=$;if(N>1e-12){var V=p(N/g*l(B)),q=p(N/_*l(B));(L-=2*V)>1e-12?(z+=V*=A?1:-1,R-=V):(L=0,z=R=(v+y)/2),(F-=2*q)>1e-12?(O+=q*=A?1:-1,D-=q):(F=0,O=D=(v+y)/2)}var Z=_*o(O),G=_*l(O),H=g*o(R),X=g*l(R);if($>1e-12){var W,Y=_*o(D),K=_*l(D),J=g*o(z),Q=g*l(z);if(E1e-12?U>1e-12?(P=b(J,Q,Z,G,_,U,A),I=b(Y,K,H,X,_,U,A),M.moveTo(P.cx+P.x01,P.cy+P.y01),U<$?M.arc(P.cx,P.cy,U,r(P.y01,P.x01),r(I.y01,I.x01),!A):(M.arc(P.cx,P.cy,U,r(P.y01,P.x01),r(P.y11,P.x11),!A),M.arc(0,0,_,r(P.cy+P.y11,P.cx+P.x11),r(I.cy+I.y11,I.cx+I.x11),!A),M.arc(I.cx,I.cy,U,r(I.y11,I.x11),r(I.y01,I.x01),!A))):(M.moveTo(Z,G),M.arc(0,0,_,O,D,!A)):M.moveTo(Z,G),g>1e-12&&L>1e-12?j>1e-12?(P=b(H,X,Y,K,g,-j,A),I=b(Z,G,J,Q,g,-j,A),M.lineTo(P.cx+P.x01,P.cy+P.y01),j<$?M.arc(P.cx,P.cy,j,r(P.y01,P.x01),r(I.y01,I.x01),!A):(M.arc(P.cx,P.cy,j,r(P.y01,P.x01),r(P.y11,P.x11),!A),M.arc(0,0,g,r(P.cy+P.y11,P.cx+P.x11),r(I.cy+I.y11,I.cx+I.x11),A),M.arc(I.cx,I.cy,j,r(I.y11,I.x11),r(I.y01,I.x01),!A))):M.arc(0,0,g,R,z,A):M.lineTo(H,X)}else M.moveTo(0,0);if(M.closePath(),n)return M=null,n+""||null}return E.centroid=function(){var e=(+t.apply(this,arguments)+ +a.apply(this,arguments))/2,n=(+C.apply(this,arguments)+ +S.apply(this,arguments))/2-u/2;return[o(n)*e,l(n)*e]},E.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),E):t},E.outerRadius=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),E):a},E.cornerRadius=function(t){return arguments.length?(w="function"==typeof t?t:n(+t),E):w},E.padRadius=function(t){return arguments.length?(T=null==t?null:"function"==typeof t?t:n(+t),E):T},E.startAngle=function(t){return arguments.length?(C="function"==typeof t?t:n(+t),E):C},E.endAngle=function(t){return arguments.length?(S="function"==typeof t?t:n(+t),E):S},E.padAngle=function(t){return arguments.length?(k="function"==typeof t?t:n(+t),E):k},E.context=function(t){return arguments.length?(M=null==t?null:t,E):M},E},t.area=M,t.areaRadial=R,t.curveBasis=function(t){return new ut(t)},t.curveBasisClosed=function(t){return new ht(t)},t.curveBasisOpen=function(t){return new dt(t)},t.curveBundle=pt,t.curveCardinal=_t,t.curveCardinalClosed=yt,t.curveCardinalOpen=bt,t.curveCatmullRom=Ct,t.curveCatmullRomClosed=kt,t.curveCatmullRomOpen=Et,t.curveLinear=T,t.curveLinearClosed=function(t){return new At(t)},t.curveMonotoneX=function(t){return new zt(t)},t.curveMonotoneY=function(t){return new Rt(t)},t.curveNatural=function(t){return new Ft(t)},t.curveStep=function(t){return new Nt(t,.5)},t.curveStepAfter=function(t){return new Nt(t,1)},t.curveStepBefore=function(t){return new Nt(t,0)},t.line=k,t.lineRadial=z,t.linkHorizontal=function(){return $(j)},t.linkRadial=function(){var t=$(V);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.linkVertical=function(){return $(U)},t.pie=function(){var t=A,e=E,i=null,r=n(0),o=n(d),a=n(0);function s(n){var s,l,c,u,h,f=n.length,p=0,m=new Array(f),g=new Array(f),_=+r.apply(this,arguments),v=Math.min(d,Math.max(-d,o.apply(this,arguments)-_)),y=Math.min(Math.abs(v)/f,a.apply(this,arguments)),x=y*(v<0?-1:1);for(s=0;s0&&(p+=h);for(null!=e?m.sort((function(t,n){return e(g[t],g[n])})):null!=i&&m.sort((function(t,e){return i(n[t],n[e])})),s=0,c=p?(v-f*x)/p:0;s0?h*c:0)+x,g[l]={data:n[l],index:s,value:h,startAngle:_,endAngle:u,padAngle:y};return g}return s.value=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,i=null,s):e},s.sort=function(t){return arguments.length?(i=t,e=null,s):i},s.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:n(+t),s):r},s.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:n(+t),s):o},s.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),s):a},s},t.pointRadial=L,t.radialArea=R,t.radialLine=z,t.stack=function(){var t=n([]),e=jt,i=$t,r=Ut;function o(n){var o,a,s=t.apply(this,arguments),l=n.length,c=s.length,u=new Array(c);for(o=0;o0)for(var n,i,r,o,a,s,l=0,c=t[e[0]].length;l0?(i[0]=o,i[1]=o+=r):r<0?(i[1]=a,i[0]=a+=r):(i[0]=0,i[1]=r)},t.stackOffsetExpand=function(t,e){if((i=t.length)>0){for(var n,i,r,o=0,a=t[0].length;o0){for(var n,i=0,r=t[e[0]],o=r.length;i0&&(i=(n=t[e[0]]).length)>0){for(var n,i,r,o=0,a=1;a=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:wt,s:Tt,S:V,u:q,U:Z,V:H,w:X,W:W,x:null,X:null,y:Y,Y:J,Z:tt,"%":bt},zt={a:function(t){return h[t.getUTCDay()]},A:function(t){return u[t.getUTCDay()]},b:function(t){return G[t.getUTCMonth()]},B:function(t){return d[t.getUTCMonth()]},c:null,d:et,e:et,f:at,g:_t,G:yt,H:nt,I:it,j:rt,L:ot,m:st,M:lt,p:function(t){return c[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:wt,s:Tt,S:ct,u:ut,U:ht,V:ft,w:pt,W:mt,x:null,X:null,y:gt,Y:vt,Z:xt,"%":bt},Rt={a:function(t,e,n){var i=Mt.exec(e.slice(n));return i?(t.w=Et[i[0].toLowerCase()],n+i[0].length):-1},A:function(t,e,n){var i=St.exec(e.slice(n));return i?(t.w=kt[i[0].toLowerCase()],n+i[0].length):-1},b:function(t,e,n){var i=It.exec(e.slice(n));return i?(t.m=Ot[i[0].toLowerCase()],n+i[0].length):-1},B:function(t,e,n){var i=At.exec(e.slice(n));return i?(t.m=Pt[i[0].toLowerCase()],n+i[0].length):-1},c:function(t,e,n){return Bt(t,o,e,n)},d:S,e:S,f:I,g:b,G:x,H:M,I:M,j:k,L:P,m:C,M:E,p:function(t,e,n){var i=dt.exec(e.slice(n));return i?(t.p=Ct[i[0].toLowerCase()],n+i[0].length):-1},q:T,Q:D,s:z,S:A,u:g,U:_,V:v,w:m,W:y,x:function(t,e,n){return Bt(t,a,e,n)},X:function(t,e,n){return Bt(t,l,e,n)},y:b,Y:x,Z:w,"%":O};function Lt(t,e){return function(n){var i,r,o,a=[],l=-1,c=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++l53)return null;"w"in c||(c.w=1),"Z"in c?(l=(s=i(r(c.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(c.V-1)),c.y=s.getUTCFullYear(),c.m=s.getUTCMonth(),c.d=s.getUTCDate()+(c.w+6)%7):(l=(s=n(r(c.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(c.V-1)),c.y=s.getFullYear(),c.m=s.getMonth(),c.d=s.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),l="Z"in c?i(r(c.y,0,1)).getUTCDay():n(r(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(l+5)%7:c.w+7*c.U-(l+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,i(c)):n(c)}}function Bt(t,e,n,i){for(var r,o,a=0,l=e.length,c=n.length;a=c)return-1;if(37===(r=e.charCodeAt(a++))){if(r=e.charAt(a++),!(o=Rt[r in s?e.charAt(a++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return Dt.x=Lt(a,Dt),Dt.X=Lt(l,Dt),Dt.c=Lt(o,Dt),zt.x=Lt(a,zt),zt.X=Lt(l,zt),zt.c=Lt(o,zt),{format:function(t){var e=Lt(t+="",Dt);return e.toString=function(){return t},e},parse:function(t){var e=Ft(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=Lt(t+="",zt);return e.toString=function(){return t},e},utcParse:function(t){var e=Ft(t+="",!0);return e.toString=function(){return t},e}}}var a,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function h(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o68?1900:2e3),n+i[0].length):-1}function w(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function T(t,e,n){var i=l.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function C(t,e,n){var i=l.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function S(t,e,n){var i=l.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function k(t,e,n){var i=l.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function M(t,e,n){var i=l.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function E(t,e,n){var i=l.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function A(t,e,n){var i=l.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function P(t,e,n){var i=l.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function I(t,e,n){var i=l.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function O(t,e,n){var i=c.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function D(t,e,n){var i=l.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function z(t,e,n){var i=l.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function R(t,e){return h(t.getDate(),e,2)}function L(t,e){return h(t.getHours(),e,2)}function F(t,e){return h(t.getHours()%12||12,e,2)}function B(t,n){return h(1+e.timeDay.count(e.timeYear(t),t),n,3)}function N(t,e){return h(t.getMilliseconds(),e,3)}function $(t,e){return N(t,e)+"000"}function j(t,e){return h(t.getMonth()+1,e,2)}function U(t,e){return h(t.getMinutes(),e,2)}function V(t,e){return h(t.getSeconds(),e,2)}function q(t){var e=t.getDay();return 0===e?7:e}function Z(t,n){return h(e.timeSunday.count(e.timeYear(t)-1,t),n,2)}function G(t){var n=t.getDay();return n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t)}function H(t,n){return t=G(t),h(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),n,2)}function X(t){return t.getDay()}function W(t,n){return h(e.timeMonday.count(e.timeYear(t)-1,t),n,2)}function Y(t,e){return h(t.getFullYear()%100,e,2)}function K(t,e){return h((t=G(t)).getFullYear()%100,e,2)}function J(t,e){return h(t.getFullYear()%1e4,e,4)}function Q(t,n){var i=t.getDay();return h((t=i>=4||0===i?e.timeThursday(t):e.timeThursday.ceil(t)).getFullYear()%1e4,n,4)}function tt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+h(e/60|0,"0",2)+h(e%60,"0",2)}function et(t,e){return h(t.getUTCDate(),e,2)}function nt(t,e){return h(t.getUTCHours(),e,2)}function it(t,e){return h(t.getUTCHours()%12||12,e,2)}function rt(t,n){return h(1+e.utcDay.count(e.utcYear(t),t),n,3)}function ot(t,e){return h(t.getUTCMilliseconds(),e,3)}function at(t,e){return ot(t,e)+"000"}function st(t,e){return h(t.getUTCMonth()+1,e,2)}function lt(t,e){return h(t.getUTCMinutes(),e,2)}function ct(t,e){return h(t.getUTCSeconds(),e,2)}function ut(t){var e=t.getUTCDay();return 0===e?7:e}function ht(t,n){return h(e.utcSunday.count(e.utcYear(t)-1,t),n,2)}function dt(t){var n=t.getUTCDay();return n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t)}function ft(t,n){return t=dt(t),h(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),n,2)}function pt(t){return t.getUTCDay()}function mt(t,n){return h(e.utcMonday.count(e.utcYear(t)-1,t),n,2)}function gt(t,e){return h(t.getUTCFullYear()%100,e,2)}function _t(t,e){return h((t=dt(t)).getUTCFullYear()%100,e,2)}function vt(t,e){return h(t.getUTCFullYear()%1e4,e,4)}function yt(t,n){var i=t.getUTCDay();return h((t=i>=4||0===i?e.utcThursday(t):e.utcThursday.ceil(t)).getUTCFullYear()%1e4,n,4)}function xt(){return"+0000"}function bt(){return"%"}function wt(t){return+t}function Tt(t){return Math.floor(+t/1e3)}function Ct(e){return a=o(e),t.timeFormat=a.format,t.timeParse=a.parse,t.utcFormat=a.utcFormat,t.utcParse=a.utcParse,a}Ct({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var St=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var kt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=St,t.isoParse=kt,t.timeFormatDefaultLocale=Ct,t.timeFormatLocale=o,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":29}],29:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,n=new Date;function i(t,r,o,a){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),r(e,1),t(e),e},s.round=function(t){var e=s(t),n=s.ceil(t);return t-e0))return a;do{a.push(o=new Date(+e)),r(e,i),t(e)}while(o=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,n){if(t>=t)if(n<0)for(;++n<=0;)for(;r(t,-1),!e(t););else for(;--n>=0;)for(;r(t,1),!e(t););}))},o&&(s.count=function(i,r){return e.setTime(+i),n.setTime(+r),t(e),t(n),Math.floor(o(e,n))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(a?function(e){return a(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var r=i((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):r:null};var o=r.range,a=i((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=a.range,l=i((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),c=l.range,u=i((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),h=u.range,d=i((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),f=d.range;function p(t){return i((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var m=p(0),g=p(1),_=p(2),v=p(3),y=p(4),x=p(5),b=p(6),w=m.range,T=g.range,C=_.range,S=v.range,k=y.range,M=x.range,E=b.range,A=i((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),P=A.range,I=i((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));I.every=function(t){return isFinite(t=Math.floor(t))&&t>0?i((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var O=I.range,D=i((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),z=D.range,R=i((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),L=R.range,F=i((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),B=F.range;function N(t){return i((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var $=N(0),j=N(1),U=N(2),V=N(3),q=N(4),Z=N(5),G=N(6),H=$.range,X=j.range,W=U.range,Y=V.range,K=q.range,J=Z.range,Q=G.range,tt=i((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,nt=i((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));nt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?i((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var it=nt.range;t.timeDay=d,t.timeDays=f,t.timeFriday=x,t.timeFridays=M,t.timeHour=u,t.timeHours=h,t.timeInterval=i,t.timeMillisecond=r,t.timeMilliseconds=o,t.timeMinute=l,t.timeMinutes=c,t.timeMonday=g,t.timeMondays=T,t.timeMonth=A,t.timeMonths=P,t.timeSaturday=b,t.timeSaturdays=E,t.timeSecond=a,t.timeSeconds=s,t.timeSunday=m,t.timeSundays=w,t.timeThursday=y,t.timeThursdays=k,t.timeTuesday=_,t.timeTuesdays=C,t.timeWednesday=v,t.timeWednesdays=S,t.timeWeek=m,t.timeWeeks=w,t.timeYear=I,t.timeYears=O,t.utcDay=F,t.utcDays=B,t.utcFriday=Z,t.utcFridays=J,t.utcHour=R,t.utcHours=L,t.utcMillisecond=r,t.utcMilliseconds=o,t.utcMinute=D,t.utcMinutes=z,t.utcMonday=j,t.utcMondays=X,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=G,t.utcSaturdays=Q,t.utcSecond=a,t.utcSeconds=s,t.utcSunday=$,t.utcSundays=H,t.utcThursday=q,t.utcThursdays=K,t.utcTuesday=U,t.utcTuesdays=W,t.utcWednesday=V,t.utcWednesdays=Y,t.utcWeek=$,t.utcWeeks=H,t.utcYear=nt,t.utcYears=it,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],30:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e,n,i=0,r=0,o=0,a=0,s=0,l=0,c="object"==typeof performance&&performance.now?performance:Date,u="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function h(){return s||(u(d),s=c.now()+l)}function d(){s=0}function f(){this._call=this._time=this._next=null}function p(t,e,n){var i=new f;return i.restart(t,e,n),i}function m(){h(),++i;for(var t,n=e;n;)(t=s-n._time)>=0&&n._call.call(null,t),n=n._next;--i}function g(){s=(a=c.now())+l,i=r=0;try{m()}finally{i=0,function(){var t,i,r=e,o=1/0;for(;r;)r._call?(o>r._time&&(o=r._time),t=r,r=r._next):(i=r._next,r._next=null,r=t?t._next=i:e=i);n=t,v(o)}(),s=0}}function _(){var t=c.now(),e=t-a;e>1e3&&(l-=e,a=t)}function v(t){i||(r&&(r=clearTimeout(r)),t-s>24?(t<1/0&&(r=setTimeout(g,t-c.now()-l)),o&&(o=clearInterval(o))):(o||(a=c.now(),o=setInterval(_,1e3)),i=1,u(g)))}f.prototype=p.prototype={constructor:f,restart:function(t,i,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?h():+r)+(null==i?0:+i),this._next||n===this||(n?n._next=this:e=this,n=this),this._call=t,this._time=r,v()},stop:function(){this._call&&(this._call=null,this._time=1/0,v())}},t.interval=function(t,e,n){var i=new f,r=e;return null==e?(i.restart(t,e,n),i):(e=+e,n=null==n?h():+n,i.restart((function o(a){a+=r,i.restart(o,r+=e,n),t(a)}),e,n),i)},t.now=h,t.timeout=function(t,e,n){var i=new f;return e=null==e?0:+e,i.restart((function(n){i.stop(),t(n+e)}),e,n),i},t.timer=p,t.timerFlush=m,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],31:[function(t,e,n){!function(i,r){"object"==typeof n&&void 0!==e?r(n,t("d3-selection"),t("d3-dispatch"),t("d3-timer"),t("d3-interpolate"),t("d3-color"),t("d3-ease")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch","d3-timer","d3-interpolate","d3-color","d3-ease"],r):r((i=i||self).d3=i.d3||{},i.d3,i.d3,i.d3,i.d3,i.d3,i.d3)}(this,(function(t,e,n,i,r,o,a){"use strict";var s=n.dispatch("start","end","cancel","interrupt"),l=[];function c(t,e,n,r,o,a){var c=t.__transition;if(c){if(n in c)return}else t.__transition={};!function(t,e,n){var r,o=t.__transition;function a(c){var u,h,d,f;if(1!==n.state)return l();for(u in o)if((f=o[u]).name===n.name){if(3===f.state)return i.timeout(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete o[u]):+u0)throw new Error("too late; already scheduled");return n}function h(t,e){var n=d(t,e);if(n.state>3)throw new Error("too late; already running");return n}function d(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function f(t,e){var n,i,r,o=t.__transition,a=!0;if(o){for(r in e=null==e?null:e+"",o)(n=o[r]).name===e?(i=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[r]):a=!1;a&&delete t.__transition}}function p(t,e){var n,i;return function(){var r=h(this,t),o=r.tween;if(o!==n)for(var a=0,s=(i=n=o).length;a=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?u:h;return function(){var a=o(this,t),s=a.on;s!==i&&(r=(i=s).copy()).on(e,n),a.on=r}}var z=e.selection.prototype.constructor;function R(t){return function(){this.style.removeProperty(t)}}function L(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function F(t,e,n){var i,r;function o(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&L(t,o,n)),i}return o._value=e,o}function B(t){return function(e){this.textContent=t.call(this,e)}}function N(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&B(i)),e}return i._value=t,i}var $=0;function j(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function U(t){return e.selection().transition(t)}function V(){return++$}var q=e.selection.prototype;j.prototype=U.prototype={constructor:j,select:function(t){var n=this._name,i=this._id;"function"!=typeof t&&(t=e.selector(t));for(var r=this._groups,o=r.length,a=new Array(o),s=0;s1&&n.name===e)return new j([[t]],H,e,+i);return null},t.interrupt=f,t.transition=U,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-color":8,"d3-dispatch":10,"d3-ease":13,"d3-interpolate":19,"d3-selection":26,"d3-timer":30}],32:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i(t.d3=t.d3||{})}(this,(function(t){"use strict";function e(t){return function(){return t}}function n(t){return t[0]}function i(t){return t[1]}function r(){this._=null}function o(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function a(t,e){var n=e,i=e.R,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.R=i.L,n.R&&(n.R.U=n),i.L=n}function s(t,e){var n=e,i=e.L,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.L=i.R,n.L&&(n.L.U=n),i.R=n}function l(t){for(;t.L;)t=t.L;return t}function c(t,e,n,i){var r=[null,null],o=D.push(r)-1;return r.left=t,r.right=e,n&&h(r,t,e,n),i&&h(r,e,t,i),I[t.index].halfedges.push(o),I[e.index].halfedges.push(o),r}function u(t,e,n){var i=[e,n];return i.left=t,i}function h(t,e,n,i){t[0]||t[1]?t.left===n?t[1]=i:t[0]=i:(t[0]=i,t.left=e,t.right=n)}function d(t,e,n,i,r){var o,a=t[0],s=t[1],l=a[0],c=a[1],u=0,h=1,d=s[0]-l,f=s[1]-c;if(o=e-l,d||!(o>0)){if(o/=d,d<0){if(o0){if(o>h)return;o>u&&(u=o)}if(o=i-l,d||!(o<0)){if(o/=d,d<0){if(o>h)return;o>u&&(u=o)}else if(d>0){if(o0)){if(o/=f,f<0){if(o0){if(o>h)return;o>u&&(u=o)}if(o=r-c,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>u&&(u=o)}else if(f>0){if(o0||h<1)||(u>0&&(t[0]=[l+u*d,c+u*f]),h<1&&(t[1]=[l+h*d,c+h*f]),!0)}}}}}function f(t,e,n,i,r){var o=t[1];if(o)return!0;var a,s,l=t[0],c=t.left,u=t.right,h=c[0],d=c[1],f=u[0],p=u[1],m=(h+f)/2,g=(d+p)/2;if(p===d){if(m=i)return;if(h>f){if(l){if(l[1]>=r)return}else l=[m,n];o=[m,r]}else{if(l){if(l[1]1)if(h>f){if(l){if(l[1]>=r)return}else l=[(n-s)/a,n];o=[(r-s)/a,r]}else{if(l){if(l[1]=i)return}else l=[e,a*e+s];o=[i,a*i+s]}else{if(l){if(l[0]=-R)){var f=l*l+c*c,p=u*u+h*h,m=(h*f-c*p)/d,g=(l*p-u*f)/d,x=v.pop()||new y;x.arc=t,x.site=r,x.x=m+a,x.y=(x.cy=g+s)+Math.sqrt(m*m+g*g),t.circle=x;for(var b=null,w=O._;w;)if(x.yz)s=s.L;else{if(!((r=o-A(s,a))>z)){i>-z?(e=s.P,n=s):r>-z?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}!function(t){I[t.index]={site:t,halfedges:[]}}(t);var l=C(t);if(P.insert(e,l),e||n){if(e===n)return b(e),n=C(e.site),P.insert(l,n),l.edge=n.edge=c(e.site,l.site),x(e),void x(n);if(n){b(e),b(n);var u=e.site,d=u[0],f=u[1],p=t[0]-d,m=t[1]-f,g=n.site,_=g[0]-d,v=g[1]-f,y=2*(p*v-m*_),w=p*p+m*m,T=_*_+v*v,S=[(v*w-m*T)/y+d,(p*T-_*w)/y+f];h(n.edge,u,g,S),l.edge=c(u,t,null,S),n.edge=c(t,g,null,S),x(e),x(n)}else l.edge=c(e.site,l.site)}}function E(t,e){var n=t.site,i=n[0],r=n[1],o=r-e;if(!o)return i;var a=t.P;if(!a)return-1/0;var s=(n=a.site)[0],l=n[1],c=l-e;if(!c)return s;var u=s-i,h=1/o-1/c,d=u/c;return h?(-d+Math.sqrt(d*d-2*h*(u*u/(-2*c)-l+c/2+r-o/2)))/h+i:(i+s)/2}function A(t,e){var n=t.N;if(n)return E(n,e);var i=t.site;return i[1]===e?i[0]:1/0}var P,I,O,D,z=1e-6,R=1e-12;function L(t,e){return e[1]-t[1]||e[0]-t[0]}function F(t,e){var n,i,o,a=t.sort(L).pop();for(D=[],I=new Array(t.length),P=new r,O=new r;;)if(o=_,a&&(!o||a[1]z||Math.abs(r[0][1]-r[1][1])>z)||delete D[o]}(s,l,c,h),function(t,e,n,i){var r,o,a,s,l,c,h,d,f,p,_,v,y=I.length,x=!0;for(r=0;rz||Math.abs(v-f)>z)&&(l.splice(s,0,D.push(u(a,p,Math.abs(_-t)z?[t,Math.abs(d-t)z?[Math.abs(f-i)z?[n,Math.abs(d-n)z?[Math.abs(f-e)=s)return null;var l=t-r.site[0],c=e-r.site[1],u=l*l+c*c;do{r=o.cells[i=a],a=null,r.halfedges.forEach((function(n){var i=o.edges[n],s=i.left;if(s!==r.site&&s||(s=i.right)){var l=t-s[0],c=e-s[1],h=l*l+c*c;hi?(i+r)/2:Math.min(0,i)||Math.max(0,r),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}u.prototype=l.prototype,t.zoom=function(){var t,u,y=f,x=p,b=v,w=g,T=_,C=[0,1/0],S=[[-1/0,-1/0],[1/0,1/0]],k=250,M=i.interpolateZoom,E=e.dispatch("start","zoom","end"),A=0;function P(t){t.property("__zoom",m).on("wheel.zoom",F).on("mousedown.zoom",B).on("dblclick.zoom",N).filter(T).on("touchstart.zoom",$).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",U).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function I(t,e){return(e=Math.max(C[0],Math.min(C[1],e)))===t.k?t:new l(e,t.x,t.y)}function O(t,e,n){var i=e[0]-n[0]*t.k,r=e[1]-n[1]*t.k;return i===t.x&&r===t.y?t:new l(t.k,i,r)}function D(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function z(t,e,n){t.on("start.zoom",(function(){R(this,arguments).start()})).on("interrupt.zoom end.zoom",(function(){R(this,arguments).end()})).tween("zoom",(function(){var t=this,i=arguments,r=R(t,i),o=x.apply(t,i),a=null==n?D(o):"function"==typeof n?n.apply(t,i):n,s=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),c=t.__zoom,u="function"==typeof e?e.apply(t,i):e,h=M(c.invert(a).concat(s/c.k),u.invert(a).concat(s/u.k));return function(t){if(1===t)t=u;else{var e=h(t),n=s/e[2];t=new l(n,a[0]-e[0]*n,a[1]-e[1]*n)}r.zoom(null,t)}}))}function R(t,e,n){return!n&&t.__zooming||new L(t,e)}function L(t,e){this.that=t,this.args=e,this.active=0,this.extent=x.apply(t,e),this.taps=0}function F(){if(y.apply(this,arguments)){var t=R(this,arguments),e=this.__zoom,n=Math.max(C[0],Math.min(C[1],e.k*Math.pow(2,w.apply(this,arguments)))),i=r.mouse(this);if(t.wheel)t.mouse[0][0]===i[0]&&t.mouse[0][1]===i[1]||(t.mouse[1]=e.invert(t.mouse[0]=i)),clearTimeout(t.wheel);else{if(e.k===n)return;t.mouse=[i,e.invert(i)],o.interrupt(this),t.start()}d(),t.wheel=setTimeout(a,150),t.zoom("mouse",b(O(I(e,n),t.mouse[0],t.mouse[1]),t.extent,S))}function a(){t.wheel=null,t.end()}}function B(){if(!u&&y.apply(this,arguments)){var t=R(this,arguments,!0),e=r.select(r.event.view).on("mousemove.zoom",l,!0).on("mouseup.zoom",c,!0),i=r.mouse(this),a=r.event.clientX,s=r.event.clientY;n.dragDisable(r.event.view),h(),t.mouse=[i,this.__zoom.invert(i)],o.interrupt(this),t.start()}function l(){if(d(),!t.moved){var e=r.event.clientX-a,n=r.event.clientY-s;t.moved=e*e+n*n>A}t.zoom("mouse",b(O(t.that.__zoom,t.mouse[0]=r.mouse(t.that),t.mouse[1]),t.extent,S))}function c(){e.on("mousemove.zoom mouseup.zoom",null),n.dragEnable(r.event.view,t.moved),d(),t.end()}}function N(){if(y.apply(this,arguments)){var t=this.__zoom,e=r.mouse(this),n=t.invert(e),i=t.k*(r.event.shiftKey?.5:2),o=b(O(I(t,i),e,n),x.apply(this,arguments),S);d(),k>0?r.select(this).transition().duration(k).call(z,o,e):r.select(this).call(P.transform,o)}}function $(){if(y.apply(this,arguments)){var e,n,i,a,s=r.event.touches,l=s.length,c=R(this,arguments,r.event.changedTouches.length===l);for(h(),n=0;n_&&(_=m),mx?x-1:l?"y"===l?x/y:y:Math.max(y,x/y))||0,b.b=x<0?o-x:o}return x=(b[t]-b.min)/b.max,b.b+(i?i.getRatio(x):x)*b.v}},s=function t(e,n,r){i.call(this,e,n,r),this._cycle=0,this._yoyo=!0===this.vars.yoyo||!!this.vars.yoyoEase,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._repeat&&this._uncache(!0),this.render=t.prototype.render},l=i._internals,c=l.isSelector,u=l.isArray,h=s.prototype=i.to({},.1,{}),d=[];s.version="2.1.3",h.constructor=s,h.kill()._gc=!1,s.killTweensOf=s.killDelayedCallsTo=i.killTweensOf,s.getTweensOf=i.getTweensOf,s.lagSmoothing=i.lagSmoothing,s.ticker=i.ticker,s.render=i.render,s.distribute=a,h.invalidate=function(){return this._yoyo=!0===this.vars.yoyo||!!this.vars.yoyoEase,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._yoyoEase=null,this._uncache(!0),i.prototype.invalidate.call(this)},h.updateTo=function(t,e){var n,r=this.ratio,o=this.vars.immediateRender||t.immediateRender;for(n in e&&this._startTime.998){var a=this._totalTime;this.render(0,!0,!1),this._initted=!1,this.render(a,!0,!1)}else if(this._initted=!1,this._init(),this._time>0||o)for(var s,l=1/(1-r),c=this._firstPT;c;)s=c.s+c.c,c.c*=l,c.s=s-c.c,c=c._next;return this},h.render=function(t,e,n){this._initted||0===this._duration&&this.vars.repeat&&this.invalidate();var r,o,a,s,c,u,h,d,f,p=this._dirty?this.totalDuration():this._totalDuration,m=this._time,g=this._totalTime,_=this._cycle,v=this._duration,y=this._rawPrevTime;if(t>=p-1e-8&&t>=0?(this._totalTime=p,this._cycle=this._repeat,this._yoyo&&0!=(1&this._cycle)?(this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0):(this._time=v,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1),this._reversed||(r=!0,o="onComplete",n=n||this._timeline.autoRemoveChildren),0===v&&(this._initted||!this.vars.lazy||n)&&(this._startTime===this._timeline._duration&&(t=0),(y<0||t<=0&&t>=-1e-8||1e-8===y&&"isPause"!==this.data)&&y!==t&&(n=!0,y>1e-8&&(o="onReverseComplete")),this._rawPrevTime=d=!e||t||y===t?t:1e-8)):t<1e-8?(this._totalTime=this._time=this._cycle=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==g||0===v&&y>0)&&(o="onReverseComplete",r=this._reversed),t>-1e-8?t=0:t<0&&(this._active=!1,0===v&&(this._initted||!this.vars.lazy||n)&&(y>=0&&(n=!0),this._rawPrevTime=d=!e||t||y===t?t:1e-8)),this._initted||(n=!0)):(this._totalTime=this._time=t,0!==this._repeat&&(s=v+this._repeatDelay,this._cycle=this._totalTime/s>>0,0!==this._cycle&&this._cycle===this._totalTime/s&&g<=t&&this._cycle--,this._time=this._totalTime-this._cycle*s,this._yoyo&&0!=(1&this._cycle)&&(this._time=v-this._time,(f=this._yoyoEase||this.vars.yoyoEase)&&(this._yoyoEase||(!0!==f||this._initted?this._yoyoEase=f=!0===f?this._ease:f instanceof Ease?f:Ease.map[f]:(f=this.vars.ease,this._yoyoEase=f=f?f instanceof Ease?f:"function"==typeof f?new Ease(f,this.vars.easeParams):Ease.map[f]||i.defaultEase:i.defaultEase)),this.ratio=f?1-f.getRatio((v-this._time)/v):0)),this._time>v?this._time=v:this._time<0&&(this._time=0)),this._easeType&&!f?(c=this._time/v,(1===(u=this._easeType)||3===u&&c>=.5)&&(c=1-c),3===u&&(c*=2),1===(h=this._easePower)?c*=c:2===h?c*=c*c:3===h?c*=c*c*c:4===h&&(c*=c*c*c*c),this.ratio=1===u?1-c:2===u?c:this._time/v<.5?c/2:1-c/2):f||(this.ratio=this._ease.getRatio(this._time/v))),m!==this._time||n||_!==this._cycle){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!n&&this._firstPT&&(!1!==this.vars.lazy&&this._duration||this.vars.lazy&&!this._duration))return this._time=m,this._totalTime=g,this._rawPrevTime=y,this._cycle=_,l.lazyTweens.push(this),void(this._lazy=[t,e]);!this._time||r||f?r&&this._ease._calcEnd&&!f&&(this.ratio=this._ease.getRatio(0===this._time?0:1)):this.ratio=this._ease.getRatio(this._time/v)}for(!1!==this._lazy&&(this._lazy=!1),this._active||!this._paused&&this._time!==m&&t>=0&&(this._active=!0),0===g&&(2===this._initted&&t>0&&this._init(),this._startAt&&(t>=0?this._startAt.render(t,!0,n):o||(o="_dummyGS")),this.vars.onStart&&(0===this._totalTime&&0!==v||e||this._callback("onStart"))),a=this._firstPT;a;)a.f?a.t[a.p](a.c*this.ratio+a.s):a.t[a.p]=a.c*this.ratio+a.s,a=a._next;this._onUpdate&&(t<0&&this._startAt&&this._startTime&&this._startAt.render(t,!0,n),e||(this._totalTime!==g||o)&&this._callback("onUpdate")),this._cycle!==_&&(e||this._gc||this.vars.onRepeat&&this._callback("onRepeat")),o&&(this._gc&&!n||(t<0&&this._startAt&&!this._onUpdate&&this._startTime&&this._startAt.render(t,!0,n),r&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[o]&&this._callback(o),0===v&&1e-8===this._rawPrevTime&&1e-8!==d&&(this._rawPrevTime=0)))}else g!==this._totalTime&&this._onUpdate&&(e||this._callback("onUpdate"))},s.to=function(t,e,n){return new s(t,e,n)},s.from=function(t,e,n){return n.runBackwards=!0,n.immediateRender=0!=n.immediateRender,new s(t,e,n)},s.fromTo=function(t,e,n,i){return i.startAt=n,i.immediateRender=0!=i.immediateRender&&0!=n.immediateRender,new s(t,e,i)},s.staggerTo=s.allTo=function(t,e,n,l,h,f,p){var m,g,_,v,y=[],x=a(n.stagger||l),b=n.cycle,w=(n.startAt||d).cycle;for(u(t)||("string"==typeof t&&(t=i.selector(t)||t),c(t)&&(t=r(t))),m=(t=t||[]).length-1,_=0;_<=m;_++){for(v in g={},n)g[v]=n[v];if(b&&(o(g,t,_),null!=g.duration&&(e=g.duration,delete g.duration)),w){for(v in w=g.startAt={},n.startAt)w[v]=n.startAt[v];o(g.startAt,t,_)}g.delay=x(_,t[_],t)+(g.delay||0),_===m&&h&&(g.onComplete=function(){n.onComplete&&n.onComplete.apply(n.onCompleteScope||this,arguments),h.apply(p||n.callbackScope||this,f||d)}),y[_]=new s(t[_],e,g)}return y},s.staggerFrom=s.allFrom=function(t,e,n,i,r,o,a){return n.runBackwards=!0,n.immediateRender=0!=n.immediateRender,s.staggerTo(t,e,n,i,r,o,a)},s.staggerFromTo=s.allFromTo=function(t,e,n,i,r,o,a,l){return i.startAt=n,i.immediateRender=0!=i.immediateRender&&0!=n.immediateRender,s.staggerTo(t,e,i,r,o,a,l)},s.delayedCall=function(t,e,n,i,r){return new s(e,0,{delay:t,onComplete:e,onCompleteParams:n,callbackScope:i,onReverseComplete:e,onReverseCompleteParams:n,immediateRender:!1,useFrames:r,overwrite:0})},s.set=function(t,e){return new s(t,0,e)},s.isTweening=function(t){return i.getTweensOf(t,!0).length>0};var f=function t(e,n){for(var r=[],o=0,a=e._first;a;)a instanceof i?r[o++]=a:(n&&(r[o++]=a),o=(r=r.concat(t(a,n))).length),a=a._next;return r},p=s.getAllTweens=function(e){return f(t._rootTimeline,e).concat(f(t._rootFramesTimeline,e))};s.killAll=function(t,n,i,r){null==n&&(n=!0),null==i&&(i=!0);var o,a,s,l=p(0!=r),c=l.length,u=n&&i&&r;for(s=0;s-1;)s.killChildTweensOf(t[h],e);else{for(a in n=[],f)for(o=f[a].target.parentNode;o;)o===t&&(n=n.concat(f[a].tweens)),o=o.parentNode;for(d=n.length,h=0;h-1;)a=s[c],(l||a instanceof e||(o=a.target===a.vars.onComplete)&&i||n&&!o)&&a.paused(t)};return s.pauseAll=function(t,e,n){m(!0,t,e,n)},s.resumeAll=function(t,e,n){m(!1,t,e,n)},s.globalTimeScale=function(e){var n=t._rootTimeline,r=i.ticker.time;return arguments.length?(e=e||1e-8,n._startTime=r-(r-n._startTime)*n._timeScale/e,n=t._rootFramesTimeline,r=i.ticker.frame,n._startTime=r-(r-n._startTime)*n._timeScale/e,n._timeScale=t._rootTimeline._timeScale=e,e):n._timeScale},h.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&0!=(1&this._cycle)?1-t:t)+this._cycle*(this._duration+this._repeatDelay),e):this.duration()?this._time/this._duration:this.ratio},h.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this._totalTime/this.totalDuration()},h.time=function(t,e){if(!arguments.length)return this._time;this._dirty&&this.totalDuration();var n=this._duration,i=this._cycle,r=i*(n+this._repeatDelay);return t>n&&(t=n),this.totalTime(this._yoyo&&1&i?n-t+r:this._repeat?t+r:t,e)},h.duration=function(e){return arguments.length?t.prototype.duration.call(this,e):this._duration},h.totalDuration=function(t){return arguments.length?-1===this._repeat?this:this.duration((t-this._repeat*this._repeatDelay)/(this._repeat+1)):(this._dirty&&(this._totalDuration=-1===this._repeat?999999999999:this._duration*(this._repeat+1)+this._repeatDelay*this._repeat,this._dirty=!1),this._totalDuration)},h.repeat=function(t){return arguments.length?(this._repeat=t,this._uncache(!0)):this._repeat},h.repeatDelay=function(t){return arguments.length?(this._repeatDelay=t,this._uncache(!0)):this._repeatDelay},h.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},s}),!0),i._gsDefine("TimelineLite",["core.Animation","core.SimpleTimeline","TweenLite"],(function(t,e,r){var o=function(t){e.call(this,t);var n,i,r=this.vars;for(i in this._labels={},this.autoRemoveChildren=!!r.autoRemoveChildren,this.smoothChildTiming=!!r.smoothChildTiming,this._sortChildren=!0,this._onUpdate=r.onUpdate,r)n=r[i],c(n)&&-1!==n.join("").indexOf("{self}")&&(r[i]=this._swapSelfInParams(n));c(r.tweens)&&this.add(r.tweens,0,r.align,r.stagger)},a=r._internals,s=o._internals={},l=a.isSelector,c=a.isArray,u=a.lazyTweens,h=a.lazyRender,d=i._gsDefine.globals,f=function(t){var e,n={};for(e in t)n[e]=t[e];return n},p=function(t,e,n){var i,r,o=t.cycle;for(i in o)r=o[i],t[i]="function"==typeof r?r(n,e[n],e):r[n%r.length];delete t.cycle},m=s.pauseCallback=function(){},g=function(t,e,n,i){var r="immediateRender";return r in e||(e[r]=!(n&&!1===n[r]||i)),e},_=function(t){if("function"==typeof t)return t;var e="object"===n(t)?t:{each:t},i=e.ease,r=e.from||0,o=e.base||0,a={},s=isNaN(r),l=e.axis,c={center:.5,end:1}[r]||0;return function(t,n,u){var h,d,f,p,m,g,_,v,y,x=(u||e).length,b=a[x];if(!b){if(!(y="auto"===e.grid?0:(e.grid||[1/0])[0])){for(_=-1/0;_<(_=u[y++].getBoundingClientRect().left)&&y_&&(_=m),mx?x-1:l?"y"===l?x/y:y:Math.max(y,x/y))||0,b.b=x<0?o-x:o}return x=(b[t]-b.min)/b.max,b.b+(i?i.getRatio(x):x)*b.v}},v=o.prototype=new e;return o.version="2.1.3",o.distribute=_,v.constructor=o,v.kill()._gc=v._forcingPlayhead=v._hasPause=!1,v.to=function(t,e,n,i){var o=n.repeat&&d.TweenMax||r;return e?this.add(new o(t,e,n),i):this.set(t,n,i)},v.from=function(t,e,n,i){return this.add((n.repeat&&d.TweenMax||r).from(t,e,g(0,n)),i)},v.fromTo=function(t,e,n,i,o){var a=i.repeat&&d.TweenMax||r;return i=g(0,i,n),e?this.add(a.fromTo(t,e,n,i),o):this.set(t,i,o)},v.staggerTo=function(t,e,n,i,a,s,c,u){var h,d,m=new o({onComplete:s,onCompleteParams:c,callbackScope:u,smoothChildTiming:this.smoothChildTiming}),g=_(n.stagger||i),v=n.startAt,y=n.cycle;for("string"==typeof t&&(t=r.selector(t)||t),l(t=t||[])&&(t=function(t){var e,n=[],i=t.length;for(e=0;e!==i;n.push(t[e++]));return n}(t)),d=0;d1e-5)&&n.render(l,!1,!1)),(this._gc||this._time===this._duration)&&!this._paused&&this._durationn._startTime;f._timeline;)p&&f._timeline.smoothChildTiming?f.totalTime(f._totalTime,!0):f._gc&&f._enabled(!0,!1),f=f._timeline;return this},v.remove=function(e){if(e instanceof t){this._remove(e,!1);var n=e._timeline=e.vars.useFrames?t._rootFramesTimeline:t._rootTimeline;return e._startTime=(e._paused?e._pauseTime:n._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&c(e)){for(var i=e.length;--i>-1;)this.remove(e[i]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},v._remove=function(t,n){return e.prototype._remove.call(this,t,n),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},v.append=function(t,e){return this.add(t,this._parseTimeOrLabel(null,e,!0,t))},v.insert=v.insertMultiple=function(t,e,n,i){return this.add(t,e||0,n,i)},v.appendMultiple=function(t,e,n,i){return this.add(t,this._parseTimeOrLabel(null,e,!0,t),n,i)},v.addLabel=function(t,e){return this._labels[t]=this._parseTimeOrLabel(e),this},v.addPause=function(t,e,n,i){var o=r.delayedCall(0,m,n,i||this);return o.vars.onComplete=o.vars.onReverseComplete=e,o.data="isPause",this._hasPause=!0,this.add(o,t)},v.removeLabel=function(t){return delete this._labels[t],this},v.getLabelTime=function(t){return null!=this._labels[t]?this._labels[t]:-1},v._parseTimeOrLabel=function(e,n,i,r){var o,a;if(r instanceof t&&r.timeline===this)this.remove(r);else if(r&&(r instanceof Array||r.push&&c(r)))for(a=r.length;--a>-1;)r[a]instanceof t&&r[a].timeline===this&&this.remove(r[a]);if(o="number"!=typeof e||n?this.duration()>99999999999?this.recent().endTime(!1):this._duration:0,"string"==typeof n)return this._parseTimeOrLabel(n,i&&"number"==typeof e&&null==this._labels[n]?e-o:0,i);if(n=n||0,"string"!=typeof e||!isNaN(e)&&null==this._labels[e])null==e&&(e=o);else{if(-1===(a=e.indexOf("=")))return null==this._labels[e]?i?this._labels[e]=o+n:n:this._labels[e]+n;n=parseInt(e.charAt(a-1)+"1",10)*Number(e.substr(a+1)),e=a>1?this._parseTimeOrLabel(e.substr(0,a-1),0,i):o}return Number(e)+n},v.seek=function(t,e){return this.totalTime("number"==typeof t?t:this._parseTimeOrLabel(t),!1!==e)},v.stop=function(){return this.paused(!0)},v.gotoAndPlay=function(t,e){return this.play(t,e)},v.gotoAndStop=function(t,e){return this.pause(t,e)},v.render=function(t,e,n){this._gc&&this._enabled(!0,!1);var i,r,o,a,s,l,c,d,f=this._time,p=this._dirty?this.totalDuration():this._totalDuration,m=this._startTime,g=this._timeScale,_=this._paused;if(f!==this._time&&(t+=this._time-f),this._hasPause&&!this._forcingPlayhead&&!e){if(t>f)for(i=this._first;i&&i._startTime<=t&&!l;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===this._rawPrevTime||(l=i),i=i._next;else for(i=this._last;i&&i._startTime>=t&&!l;)i._duration||"isPause"===i.data&&i._rawPrevTime>0&&(l=i),i=i._prev;l&&(this._time=this._totalTime=t=l._startTime,d=this._startTime+(this._reversed?this._duration-t:t)/this._timeScale)}if(t>=p-1e-8&&t>=0)this._totalTime=this._time=p,this._reversed||this._hasPausedChild()||(r=!0,a="onComplete",s=!!this._timeline.autoRemoveChildren,0===this._duration&&(t<=0&&t>=-1e-8||this._rawPrevTime<0||1e-8===this._rawPrevTime)&&this._rawPrevTime!==t&&this._first&&(s=!0,this._rawPrevTime>1e-8&&(a="onReverseComplete"))),this._rawPrevTime=this._duration||!e||t||this._rawPrevTime===t?t:1e-8,t=p+1e-4;else if(t<1e-8)if(this._totalTime=this._time=0,t>-1e-8&&(t=0),(0!==f||0===this._duration&&1e-8!==this._rawPrevTime&&(this._rawPrevTime>0||t<0&&this._rawPrevTime>=0))&&(a="onReverseComplete",r=this._reversed),t<0)this._active=!1,this._timeline.autoRemoveChildren&&this._reversed?(s=r=!0,a="onReverseComplete"):this._rawPrevTime>=0&&this._first&&(s=!0),this._rawPrevTime=t;else{if(this._rawPrevTime=this._duration||!e||t||this._rawPrevTime===t?t:1e-8,0===t&&r)for(i=this._first;i&&0===i._startTime;)i._duration||(r=!1),i=i._next;t=0,this._initted||(s=!0)}else this._totalTime=this._time=this._rawPrevTime=t;if(this._time!==f&&this._first||n||s||l){if(this._initted||(this._initted=!0),this._active||!this._paused&&this._time!==f&&t>0&&(this._active=!0),0===f&&this.vars.onStart&&(0===this._time&&this._duration||e||this._callback("onStart")),(c=this._time)>=f)for(i=this._first;i&&(o=i._next,c===this._time&&(!this._paused||_));)(i._active||i._startTime<=c&&!i._paused&&!i._gc)&&(l===i&&(this.pause(),this._pauseTime=d),i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(t-i._startTime)*i._timeScale,e,n):i.render((t-i._startTime)*i._timeScale,e,n)),i=o;else for(i=this._last;i&&(o=i._prev,c===this._time&&(!this._paused||_));){if(i._active||i._startTime<=f&&!i._paused&&!i._gc){if(l===i){for(l=i._prev;l&&l.endTime()>this._time;)l.render(l._reversed?l.totalDuration()-(t-l._startTime)*l._timeScale:(t-l._startTime)*l._timeScale,e,n),l=l._prev;l=null,this.pause(),this._pauseTime=d}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(t-i._startTime)*i._timeScale,e,n):i.render((t-i._startTime)*i._timeScale,e,n)}i=o}this._onUpdate&&(e||(u.length&&h(),this._callback("onUpdate"))),a&&(this._gc||m!==this._startTime&&g===this._timeScale||(0===this._time||p>=this.totalDuration())&&(r&&(u.length&&h(),this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[a]&&this._callback(a)))}},v._hasPausedChild=function(){for(var t=this._first;t;){if(t._paused||t instanceof o&&t._hasPausedChild())return!0;t=t._next}return!1},v.getChildren=function(t,e,n,i){i=i||-9999999999;for(var o=[],a=this._first,s=0;a;)a._startTime-1;)(n[i].timeline===this||e&&this._contains(n[i]))&&(a[s++]=n[i]);return o&&this._enabled(!1,!0),a},v.recent=function(){return this._recent},v._contains=function(t){for(var e=t.timeline;e;){if(e===this)return!0;e=e.timeline}return!1},v.shiftChildren=function(t,e,n){n=n||0;for(var i,r=this._first,o=this._labels;r;)r._startTime>=n&&(r._startTime+=t),r=r._next;if(e)for(i in o)o[i]>=n&&(o[i]+=t);return this._uncache(!0)},v._kill=function(t,e){if(!t&&!e)return this._enabled(!1,!1);for(var n=e?this.getTweensOf(e):this.getChildren(!0,!0,!1),i=n.length,r=!1;--i>-1;)n[i]._kill(t,e)&&(r=!0);return r},v.clear=function(t){var e=this.getChildren(!1,!0,!0),n=e.length;for(this._time=this._totalTime=0;--n>-1;)e[n]._enabled(!1,!1);return!1!==t&&(this._labels={}),this._uncache(!0)},v.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return t.prototype.invalidate.call(this)},v._enabled=function(t,n){if(t===this._gc)for(var i=this._first;i;)i._enabled(t,!0),i=i._next;return e.prototype._enabled.call(this,t,n)},v.totalTime=function(e,n,i){this._forcingPlayhead=!0;var r=t.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,r},v.duration=function(t){return arguments.length?(0!==this.duration()&&0!==t&&this.timeScale(this._duration/t),this):(this._dirty&&this.totalDuration(),this._duration)},v.totalDuration=function(t){if(!arguments.length){if(this._dirty){for(var e,n,i=0,r=this,o=r._last,a=999999999999;o;)e=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&r._sortChildren&&!o._paused&&!r._calculatingDuration?(r._calculatingDuration=1,r.add(o,o._startTime-o._delay),r._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(i-=o._startTime,r._timeline.smoothChildTiming&&(r._startTime+=o._startTime/r._timeScale,r._time-=o._startTime,r._totalTime-=o._startTime,r._rawPrevTime-=o._startTime),r.shiftChildren(-o._startTime,!1,-9999999999),a=0),(n=o._startTime+o._totalDuration/o._timeScale)>i&&(i=n),o=e;r._duration=r._totalDuration=i,r._dirty=!1}return this._totalDuration}return t&&this.totalDuration()?this.timeScale(this._totalDuration/t):this},v.paused=function(e){if(!1===e&&this._paused)for(var n=this._first;n;)n._startTime===this._time&&"isPause"===n.data&&(n._rawPrevTime=0),n=n._next;return t.prototype.paused.apply(this,arguments)},v.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===t._rootFramesTimeline},v.rawTime=function(t){return t&&(this._paused||this._repeat&&this.time()>0&&this.totalProgress()<1)?this._totalTime%(this._duration+this._repeatDelay):this._paused?this._totalTime:(this._timeline.rawTime(t)-this._startTime)*this._timeScale},o}),!0),i._gsDefine("TimelineMax",["TimelineLite","TweenLite","easing.Ease"],(function(t,e,n){var r=function(e){t.call(this,e),this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._cycle=0,this._yoyo=!!this.vars.yoyo,this._dirty=!0},o=e._internals,a=o.lazyTweens,s=o.lazyRender,l=i._gsDefine.globals,c=new n(null,null,1,0),u=r.prototype=new t;return u.constructor=r,u.kill()._gc=!1,r.version="2.1.3",u.invalidate=function(){return this._yoyo=!!this.vars.yoyo,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._uncache(!0),t.prototype.invalidate.call(this)},u.addCallback=function(t,n,i,r){return this.add(e.delayedCall(0,t,i,r),n)},u.removeCallback=function(t,e){if(t)if(null==e)this._kill(null,t);else for(var n=this.getTweensOf(t,!1),i=n.length,r=this._parseTimeOrLabel(e);--i>-1;)n[i]._startTime===r&&n[i]._enabled(!1,!1);return this},u.removePause=function(e){return this.removeCallback(t._internals.pauseCallback,e)},u.tweenTo=function(t,n){n=n||{};var i,r,o,a={ease:c,useFrames:this.usesFrames(),immediateRender:!1,lazy:!1},s=n.repeat&&l.TweenMax||e;for(r in n)a[r]=n[r];return a.time=this._parseTimeOrLabel(t),i=Math.abs(Number(a.time)-this._time)/this._timeScale||.001,o=new s(this,i,a),a.onStart=function(){o.target.paused(!0),o.vars.time===o.target.time()||i!==o.duration()||o.isFromTo||o.duration(Math.abs(o.vars.time-o.target.time())/o.target._timeScale).render(o.time(),!0,!0),n.onStart&&n.onStart.apply(n.onStartScope||n.callbackScope||o,n.onStartParams||[])},o},u.tweenFromTo=function(t,e,n){n=n||{},t=this._parseTimeOrLabel(t),n.startAt={onComplete:this.seek,onCompleteParams:[t],callbackScope:this},n.immediateRender=!1!==n.immediateRender;var i=this.tweenTo(e,n);return i.isFromTo=1,i.duration(Math.abs(i.vars.time-t)/this._timeScale||.001)},u.render=function(t,e,n){this._gc&&this._enabled(!0,!1);var i,r,o,l,c,u,h,d,f,p=this._time,m=this._dirty?this.totalDuration():this._totalDuration,g=this._duration,_=this._totalTime,v=this._startTime,y=this._timeScale,x=this._rawPrevTime,b=this._paused,w=this._cycle;if(p!==this._time&&(t+=this._time-p),t>=m-1e-8&&t>=0)this._locked||(this._totalTime=m,this._cycle=this._repeat),this._reversed||this._hasPausedChild()||(r=!0,l="onComplete",c=!!this._timeline.autoRemoveChildren,0===this._duration&&(t<=0&&t>=-1e-8||x<0||1e-8===x)&&x!==t&&this._first&&(c=!0,x>1e-8&&(l="onReverseComplete"))),this._rawPrevTime=this._duration||!e||t||this._rawPrevTime===t?t:1e-8,this._yoyo&&1&this._cycle?this._time=t=0:(this._time=g,t=g+1e-4);else if(t<1e-8)if(this._locked||(this._totalTime=this._cycle=0),this._time=0,t>-1e-8&&(t=0),(0!==p||0===g&&1e-8!==x&&(x>0||t<0&&x>=0)&&!this._locked)&&(l="onReverseComplete",r=this._reversed),t<0)this._active=!1,this._timeline.autoRemoveChildren&&this._reversed?(c=r=!0,l="onReverseComplete"):x>=0&&this._first&&(c=!0),this._rawPrevTime=t;else{if(this._rawPrevTime=g||!e||t||this._rawPrevTime===t?t:1e-8,0===t&&r)for(i=this._first;i&&0===i._startTime;)i._duration||(r=!1),i=i._next;t=0,this._initted||(c=!0)}else 0===g&&x<0&&(c=!0),this._time=this._rawPrevTime=t,this._locked||(this._totalTime=t,0!==this._repeat&&(u=g+this._repeatDelay,this._cycle=this._totalTime/u>>0,this._cycle&&this._cycle===this._totalTime/u&&_<=t&&this._cycle--,this._time=this._totalTime-this._cycle*u,this._yoyo&&1&this._cycle&&(this._time=g-this._time),this._time>g?(this._time=g,t=g+1e-4):this._time<0?this._time=t=0:t=this._time));if(this._hasPause&&!this._forcingPlayhead&&!e){if((t=this._time)>p||this._repeat&&w!==this._cycle)for(i=this._first;i&&i._startTime<=t&&!h;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===this._rawPrevTime||(h=i),i=i._next;else for(i=this._last;i&&i._startTime>=t&&!h;)i._duration||"isPause"===i.data&&i._rawPrevTime>0&&(h=i),i=i._prev;h&&(f=this._startTime+(this._reversed?this._duration-h._startTime:h._startTime)/this._timeScale,h._startTime0&&(this._active=!0),0===_&&this.vars.onStart&&(0===this._totalTime&&this._totalDuration||e||this._callback("onStart")),(d=this._time)>=p)for(i=this._first;i&&(o=i._next,d===this._time&&(!this._paused||b));)(i._active||i._startTime<=this._time&&!i._paused&&!i._gc)&&(h===i&&(this.pause(),this._pauseTime=f),i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(t-i._startTime)*i._timeScale,e,n):i.render((t-i._startTime)*i._timeScale,e,n)),i=o;else for(i=this._last;i&&(o=i._prev,d===this._time&&(!this._paused||b));){if(i._active||i._startTime<=p&&!i._paused&&!i._gc){if(h===i){for(h=i._prev;h&&h.endTime()>this._time;)h.render(h._reversed?h.totalDuration()-(t-h._startTime)*h._timeScale:(t-h._startTime)*h._timeScale,e,n),h=h._prev;h=null,this.pause(),this._pauseTime=f}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(t-i._startTime)*i._timeScale,e,n):i.render((t-i._startTime)*i._timeScale,e,n)}i=o}this._onUpdate&&(e||(a.length&&s(),this._callback("onUpdate"))),l&&(this._locked||this._gc||v!==this._startTime&&y===this._timeScale||(0===this._time||m>=this.totalDuration())&&(r&&(a.length&&s(),this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[l]&&this._callback(l)))}else _!==this._totalTime&&this._onUpdate&&(e||this._callback("onUpdate"))},u.getActive=function(t,e,n){var i,r,o=[],a=this.getChildren(t||null==t,e||null==t,!!n),s=0,l=a.length;for(i=0;it)return n[e].name;return null},u.getLabelBefore=function(t){null==t&&(t=this._time);for(var e=this.getLabelsArray(),n=e.length;--n>-1;)if(e[n].timen&&(t=n),this.totalTime(this._yoyo&&1&i?n-t+r:this._repeat?t+r:t,e)},u.repeat=function(t){return arguments.length?(this._repeat=t,this._uncache(!0)):this._repeat},u.repeatDelay=function(t){return arguments.length?(this._repeatDelay=t,this._uncache(!0)):this._repeatDelay},u.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},u.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.getLabelBefore(this._time+1e-8)},r}),!0),t=180/Math.PI,e=[],r=[],o=[],a={},s=i._gsDefine.globals,l=function(t,e,n,i){n===i&&(n=i-(i-e)/1e6),t===e&&(e=t+(n-t)/1e6),this.a=t,this.b=e,this.c=n,this.d=i,this.da=i-t,this.ca=n-t,this.ba=e-t},c=function(t,e,n,i){var r={a:t},o={},a={},s={c:i},l=(t+e)/2,c=(e+n)/2,u=(n+i)/2,h=(l+c)/2,d=(c+u)/2,f=(d-h)/8;return r.b=l+(t-l)/4,o.b=h+f,r.c=o.a=(r.b+o.b)/2,o.c=a.a=(h+d)/2,a.b=d-f,s.b=u+(i-u)/4,a.c=s.a=(a.b+s.b)/2,[r,o,a,s]},u=function(t,n,i,a,s){var l,u,h,d,f,p,m,g,_,v,y,x,b,w=t.length-1,T=0,C=t[0].a;for(l=0;l-1;)"string"==typeof(d=t[s][n])&&"="===d.charAt(1)&&(t[s][n]=o[n]+Number(d.charAt(0)+d.substr(2)));if((a=t.length-2)<0)return f[0]=new l(t[0][n],0,0,t[0][n]),f;for(s=0;s1){for(y=t[t.length-1],v=!0,d=b.length;--d>-1;)if(f=b[d],Math.abs(w[f]-y[f])>.05){v=!1;break}v&&(t=t.concat(),c&&t.unshift(c),t.push(t[1]),c=t[t.length-3])}for(e.length=r.length=o.length=0,d=b.length;--d>-1;)f=b[d],a[f]=-1!==l.indexOf(","+f+","),x[f]=h(t,f,a[f],c);for(d=e.length;--d>-1;)e[d]=Math.sqrt(e[d]),r[d]=Math.sqrt(r[d]);if(!s){for(d=b.length;--d>-1;)if(a[f])for(_=(p=x[b[d]]).length-1,m=0;m<_;m++)g=p[m+1].da/r[m]+p[m].da/e[m]||0,o[m]=(o[m]||0)+g*g;for(d=o.length;--d>-1;)o[d]=Math.sqrt(o[d])}for(d=b.length,m=i?4:1;--d>-1;)p=x[f=b[d]],u(p,n,i,s,a[f]),v&&(p.splice(0,m),p.splice(p.length-m,m));return x},f=function(t,e,n){for(var i,r,o,a,s,l,c,u,h,d,f,p=1/n,m=t.length;--m>-1;)for(o=(d=t[m]).a,a=d.d-o,s=d.c-o,l=d.b-o,i=r=0,u=1;u<=n;u++)i=r-(r=((c=p*u)*c*a+3*(h=1-c)*(c*s+h*l))*c),e[f=m*n+u-1]=(e[f]||0)+i*i},p=i._gsDefine.plugin({propName:"bezier",priority:-1,version:"1.3.9",API:2,global:!0,init:function(t,e,n){this._target=t,e instanceof Array&&(e={values:e}),this._func={},this._mod={},this._props=[],this._timeRes=null==e.timeResolution?6:parseInt(e.timeResolution,10);var i,r,o,a,s,c=e.values||[],u={},h=c[0],p=e.autoRotate||n.vars.orientToBezier;for(i in this._autoRotate=p?p instanceof Array?p:[["x","y","rotation",!0===p?0:Number(p)||0]]:null,h)this._props.push(i);for(o=this._props.length;--o>-1;)i=this._props[o],this._overwriteProps.push(i),r=this._func[i]="function"==typeof t[i],u[i]=r?t[i.indexOf("set")||"function"!=typeof t["get"+i.substr(3)]?i:"get"+i.substr(3)]():parseFloat(t[i]),s||u[i]!==c[0][i]&&(s=u);if(this._beziers="cubic"!==e.type&&"quadratic"!==e.type&&"soft"!==e.type?d(c,isNaN(e.curviness)?1:e.curviness,!1,"thruBasic"===e.type,e.correlate,s):function(t,e,n){var i,r,o,a,s,c,u,h,d,f,p,m={},g="cubic"===(e=e||"soft")?3:2,_="soft"===e,v=[];if(_&&n&&(t=[n].concat(t)),null==t||t.length-1;){for(m[d=v[c]]=s=[],f=0,h=t.length,u=0;u1&&u>0||6)-1,h=[],d=[];for(n in t)f(t[n],a,e);for(r=a.length,i=0;i>0]=d,s[o]=c,l=0,d=[]);return{length:c,lengths:s,segments:h}}(this._beziers,this._timeRes);this._length=m.length,this._lengths=m.lengths,this._segments=m.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(p=this._autoRotate)for(this._initialRotations=[],p[0]instanceof Array||(this._autoRotate=p=[p]),o=p.length;--o>-1;){for(a=0;a<3;a++)i=p[o][a],this._func[i]="function"==typeof t[i]&&t[i.indexOf("set")||"function"!=typeof t["get"+i.substr(3)]?i:"get"+i.substr(3)];i=p[o][2],this._initialRotations[o]=(this._func[i]?this._func[i].call(this._target):this._target[i])||0,this._overwriteProps.push(i)}return this._startRatio=n.vars.runBackwards?1:0,!0},set:function(e){var n,i,r,o,a,s,l,c,u,h,d,f=this._segCount,p=this._func,m=this._target,g=e!==this._startRatio;if(this._timeRes){if(u=this._lengths,h=this._curSeg,d=e*this._length,r=this._li,d>this._l2&&r0){for(;r>0&&(this._l1=u[--r])>=d;);0===r&&dthis._s2&&r0){for(;r>0&&(this._s1=h[--r])>=d;);0===r&&d=1?f-1:f*e>>0)*(1/f))*f;for(i=1-s,r=this._props.length;--r>-1;)o=this._props[r],l=(s*s*(a=this._beziers[o][n]).da+3*i*(s*a.ca+i*a.ba))*s+a.a,this._mod[o]&&(l=this._mod[o](l,m)),p[o]?m[o](l):m[o]=l;if(this._autoRotate){var _,v,y,x,b,w,T,C=this._autoRotate;for(r=C.length;--r>-1;)o=C[r][2],w=C[r][3]||0,T=!0===C[r][4]?1:t,a=this._beziers[C[r][0]],_=this._beziers[C[r][1]],a&&_&&(a=a[n],_=_[n],v=a.a+(a.b-a.a)*s,v+=((x=a.b+(a.c-a.b)*s)-v)*s,x+=(a.c+(a.d-a.c)*s-x)*s,y=_.a+(_.b-_.a)*s,y+=((b=_.b+(_.c-_.b)*s)-y)*s,b+=(_.c+(_.d-_.c)*s-b)*s,l=g?Math.atan2(b-y,x-v)*T+w:this._initialRotations[r],this._mod[o]&&(l=this._mod[o](l,m)),p[o]?m[o](l):m[o]=l)}}}),m=p.prototype,p.bezierThrough=d,p.cubicToQuadratic=c,p._autoCSS=!0,p.quadraticToCubic=function(t,e,n){return new l(t,(2*e+t)/3,(2*e+n)/3,n)},p._cssRegister=function(){var t=s.CSSPlugin;if(t){var e=t._internals,n=e._parseToProxy,i=e._setPluginRatio,r=e.CSSPropTween;e._registerComplexSpecialProp("bezier",{parser:function(t,e,o,a,s,l){e instanceof Array&&(e={values:e}),l=new p;var c,u,h,d=e.values,f=d.length-1,m=[],g={};if(f<0)return s;for(c=0;c<=f;c++)h=n(t,d[c],a,s,l,f!==c),m[c]=h.end;for(u in e)g[u]=e[u];return g.values=m,(s=new r(t,"bezier",0,0,h.pt,2)).data=h,s.plugin=l,s.setRatio=i,0===g.autoRotate&&(g.autoRotate=!0),!g.autoRotate||g.autoRotate instanceof Array||(c=!0===g.autoRotate?0:Number(g.autoRotate),g.autoRotate=null!=h.end.left?[["left","top","rotation",c,!1]]:null!=h.end.x&&[["x","y","rotation",c,!1]]),g.autoRotate&&(a._transform||a._enableTransforms(!1),h.autoRotate=a._target._gsTransform,h.proxy.rotation=h.autoRotate.rotation||0,a._overwriteProps.push("rotation")),l._onInitTween(h.proxy,g,a._tween),s}})}},m._mod=function(t){for(var e,n=this._overwriteProps,i=n.length;--i>-1;)(e=t[n[i]])&&"function"==typeof e&&(this._mod[n[i]]=e)},m._kill=function(t){var e,n,i=this._props;for(e in this._beziers)if(e in t)for(delete this._beziers[e],delete this._func[e],n=i.length;--n>-1;)i[n]===e&&i.splice(n,1);if(i=this._autoRotate)for(n=i.length;--n>-1;)t[i[n][2]]&&i.splice(n,1);return this._super._kill.call(this,t)},i._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],(function(t,e){var r,o,a,s,l=function e(){t.call(this,"css"),this._overwriteProps.length=0,this.setRatio=e.prototype.setRatio},c=i._gsDefine.globals,u={},h=l.prototype=new t("css");h.constructor=l,l.version="2.1.3",l.API=2,l.defaultTransformPerspective=0,l.defaultSkewType="compensated",l.defaultSmoothOrigin=!0,l.suffixMap={top:h="px",right:h,bottom:h,left:h,width:h,height:h,fontSize:h,padding:h,margin:h,perspective:h,lineHeight:""};var d,f,p,m,g,_,v,y,x=/(?:\-|\.|\b)(\d|\.|e\-)+/g,b=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,w=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,T=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b),?/gi,C=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,S=/(?:\d|\-|\+|=|#|\.)*/g,k=/opacity *= *([^)]*)/i,M=/opacity:([^;]*)/i,E=/alpha\(opacity *=.+?\)/i,A=/^(rgb|hsl)/,P=/([A-Z])/g,I=/-([a-z])/gi,O=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,D=function(t,e){return e.toUpperCase()},z=/(?:Left|Right|Width)/i,R=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,L=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,F=/,(?=[^\)]*(?:\(|$))/gi,B=/[\s,\(]/i,N=Math.PI/180,$=180/Math.PI,j={},U={style:{}},V=i.document||{createElement:function(){return U}},q=function(t,e){var n=V.createElementNS?V.createElementNS(e||"http://www.w3.org/1999/xhtml",t):V.createElement(t);return n.style?n:V.createElement(t)},Z=q("div"),G=q("img"),H=l._internals={_specialProps:u},X=(i.navigator||{}).userAgent||"",W=function(){var t=X.indexOf("Android"),e=q("a");return p=-1!==X.indexOf("Safari")&&-1===X.indexOf("Chrome")&&(-1===t||parseFloat(X.substr(t+8,2))>3),g=p&&parseFloat(X.substr(X.indexOf("Version/")+8,2))<6,m=-1!==X.indexOf("Firefox"),(/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(X)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(X))&&(_=parseFloat(RegExp.$1)),!!e&&(e.style.cssText="top:1px;opacity:.55;",/^0.55/.test(e.style.opacity))}(),Y=function(t){return k.test("string"==typeof t?t:(t.currentStyle?t.currentStyle.filter:t.style.filter)||"")?parseFloat(RegExp.$1)/100:1},K=function(t){i.console},J="",Q="",tt=function(t,e){var n,i,r=(e=e||Z).style;if(void 0!==r[t])return t;for(t=t.charAt(0).toUpperCase()+t.substr(1),n=["O","Moz","ms","Ms","Webkit"],i=5;--i>-1&&void 0===r[n[i]+t];);return i>=0?(J="-"+(Q=3===i?"ms":n[i]).toLowerCase()+"-",Q+t):null},et="undefined"!=typeof window?window:V.defaultView||{getComputedStyle:function(){}},nt=function(t){return et.getComputedStyle(t)},it=l.getStyle=function(t,e,n,i,r){var o;return W||"opacity"!==e?(!i&&t.style[e]?o=t.style[e]:(n=n||nt(t))?o=n[e]||n.getPropertyValue(e)||n.getPropertyValue(e.replace(P,"-$1").toLowerCase()):t.currentStyle&&(o=t.currentStyle[e]),null==r||o&&"none"!==o&&"auto"!==o&&"auto auto"!==o?o:r):Y(t)},rt=H.convertToPixels=function(t,n,i,r,o){if("px"===r||!r&&"lineHeight"!==n)return i;if("auto"===r||!i)return 0;var a,s,c,u=z.test(n),h=t,d=Z.style,f=i<0,p=1===i;if(f&&(i=-i),p&&(i*=100),"lineHeight"!==n||r)if("%"===r&&-1!==n.indexOf("border"))a=i/100*(u?t.clientWidth:t.clientHeight);else{if(d.cssText="border:0 solid red;position:"+it(t,"position")+";line-height:0;","%"!==r&&h.appendChild&&"v"!==r.charAt(0)&&"rem"!==r)d[u?"borderLeftWidth":"borderTopWidth"]=i+r;else{if(h=t.parentNode||V.body,-1!==it(h,"display").indexOf("flex")&&(d.position="absolute"),s=h._gsCache,c=e.ticker.frame,s&&u&&s.time===c)return s.width*i/100;d[u?"width":"height"]=i+r}h.appendChild(Z),a=parseFloat(Z[u?"offsetWidth":"offsetHeight"]),h.removeChild(Z),u&&"%"===r&&!1!==l.cacheWidths&&((s=h._gsCache=h._gsCache||{}).time=c,s.width=a/i*100),0!==a||o||(a=rt(t,n,i,r,!0))}else s=nt(t).lineHeight,t.style.lineHeight=i,a=parseFloat(nt(t).lineHeight),t.style.lineHeight=s;return p&&(a/=100),f?-a:a},ot=H.calculateOffset=function(t,e,n){if("absolute"!==it(t,"position",n))return 0;var i="left"===e?"Left":"Top",r=it(t,"margin"+i,n);return t["offset"+i]-(rt(t,e,parseFloat(r),r.replace(S,""))||0)},at=function(t,e){var n,i,r,o={};if(e=e||nt(t))if(n=e.length)for(;--n>-1;)-1!==(r=e[n]).indexOf("-transform")&&Ft!==r||(o[r.replace(I,D)]=e.getPropertyValue(r));else for(n in e)-1!==n.indexOf("Transform")&&Lt!==n||(o[n]=e[n]);else if(e=t.currentStyle||t.style)for(n in e)"string"==typeof n&&void 0===o[n]&&(o[n.replace(I,D)]=e[n]);return W||(o.opacity=Y(t)),i=Kt(t,e,!1),o.rotation=i.rotation,o.skewX=i.skewX,o.scaleX=i.scaleX,o.scaleY=i.scaleY,o.x=i.x,o.y=i.y,Nt&&(o.z=i.z,o.rotationX=i.rotationX,o.rotationY=i.rotationY,o.scaleZ=i.scaleZ),o.filters&&delete o.filters,o},st=function(t,e,n,i,r){var o,a,s,l={},c=t.style;for(a in n)"cssText"!==a&&"length"!==a&&isNaN(a)&&(e[a]!==(o=n[a])||r&&r[a])&&-1===a.indexOf("Origin")&&("number"!=typeof o&&"string"!=typeof o||(l[a]="auto"!==o||"left"!==a&&"top"!==a?""!==o&&"auto"!==o&&"none"!==o||"string"!=typeof e[a]||""===e[a].replace(C,"")?o:0:ot(t,a),void 0!==c[a]&&(s=new wt(c,a,c[a],s))));if(i)for(a in i)"className"!==a&&(l[a]=i[a]);return{difs:l,firstMPT:s}},lt={width:["Left","Right"],height:["Top","Bottom"]},ct=["marginLeft","marginRight","marginTop","marginBottom"],ut=function(t,e,n){if("svg"===(t.nodeName+"").toLowerCase())return(n||nt(t))[e]||0;if(t.getCTM&&Xt(t))return t.getBBox()[e]||0;var i=parseFloat("width"===e?t.offsetWidth:t.offsetHeight),r=lt[e],o=r.length;for(n=n||nt(t);--o>-1;)i-=parseFloat(it(t,"padding"+r[o],n,!0))||0,i-=parseFloat(it(t,"border"+r[o]+"Width",n,!0))||0;return i},ht=function t(e,n){if("contain"===e||"auto"===e||"auto auto"===e)return e+" ";null!=e&&""!==e||(e="0 0");var i,r=e.split(" "),o=-1!==e.indexOf("left")?"0%":-1!==e.indexOf("right")?"100%":r[0],a=-1!==e.indexOf("top")?"0%":-1!==e.indexOf("bottom")?"100%":r[1];if(r.length>3&&!n){for(r=e.split(", ").join(",").split(","),e=[],i=0;i2?" "+r[2]:""),n&&(n.oxp=-1!==o.indexOf("%"),n.oyp=-1!==a.indexOf("%"),n.oxr="="===o.charAt(1),n.oyr="="===a.charAt(1),n.ox=parseFloat(o.replace(C,"")),n.oy=parseFloat(a.replace(C,"")),n.v=e),n||e},dt=function(t,e){return"function"==typeof t&&(t=t(y,v)),"string"==typeof t&&"="===t.charAt(1)?parseInt(t.charAt(0)+"1",10)*parseFloat(t.substr(2)):parseFloat(t)-parseFloat(e)||0},ft=function(t,e){"function"==typeof t&&(t=t(y,v));var n="string"==typeof t&&"="===t.charAt(1);return"string"==typeof t&&"v"===t.charAt(t.length-2)&&(t=(n?t.substr(0,2):0)+window["inner"+("vh"===t.substr(-2)?"Height":"Width")]*(parseFloat(n?t.substr(2):t)/100)),null==t?e:n?parseInt(t.charAt(0)+"1",10)*parseFloat(t.substr(2))+e:parseFloat(t)||0},pt=function(t,e,n,i){var r,o,a,s;return"function"==typeof t&&(t=t(y,v)),null==t?a=e:"number"==typeof t?a=t:(360,r=t.split("_"),o=((s="="===t.charAt(1))?parseInt(t.charAt(0)+"1",10)*parseFloat(r[0].substr(2)):parseFloat(r[0]))*(-1===t.indexOf("rad")?1:$)-(s?0:e),r.length&&(i&&(i[n]=e+o),-1!==t.indexOf("short")&&(o%=360)!==o%180&&(o=o<0?o+360:o-360),-1!==t.indexOf("_cw")&&o<0?o=(o+3599999999640)%360-360*(o/360|0):-1!==t.indexOf("ccw")&&o>0&&(o=(o-3599999999640)%360-360*(o/360|0))),a=e+o),a<1e-6&&a>-1e-6&&(a=0),a},mt={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},gt=function(t,e,n){return 255*(6*(t=t<0?t+1:t>1?t-1:t)<1?e+(n-e)*t*6:t<.5?n:3*t<2?e+(n-e)*(2/3-t)*6:e)+.5|0},_t=l.parseColor=function(t,e){var n,i,r,o,a,s,l,c,u,h,d;if(t)if("number"==typeof t)n=[t>>16,t>>8&255,255&t];else{if(","===t.charAt(t.length-1)&&(t=t.substr(0,t.length-1)),mt[t])n=mt[t];else if("#"===t.charAt(0))4===t.length&&(i=t.charAt(1),r=t.charAt(2),o=t.charAt(3),t="#"+i+i+r+r+o+o),n=[(t=parseInt(t.substr(1),16))>>16,t>>8&255,255&t];else if("hsl"===t.substr(0,3))if(n=d=t.match(x),e){if(-1!==t.indexOf("="))return t.match(b)}else a=Number(n[0])%360/360,s=Number(n[1])/100,i=2*(l=Number(n[2])/100)-(r=l<=.5?l*(s+1):l+s-l*s),n.length>3&&(n[3]=Number(n[3])),n[0]=gt(a+1/3,i,r),n[1]=gt(a,i,r),n[2]=gt(a-1/3,i,r);else n=t.match(x)||mt.transparent;n[0]=Number(n[0]),n[1]=Number(n[1]),n[2]=Number(n[2]),n.length>3&&(n[3]=Number(n[3]))}else n=mt.black;return e&&!d&&(i=n[0]/255,r=n[1]/255,o=n[2]/255,l=((c=Math.max(i,r,o))+(u=Math.min(i,r,o)))/2,c===u?a=s=0:(h=c-u,s=l>.5?h/(2-c-u):h/(c+u),a=c===i?(r-o)/h+(r0?a[0].replace(x,""):"";return u?r=e?function(t){var e,d,f,p;if("number"==typeof t)t+=h;else if(i&&F.test(t)){for(p=t.replace(F,"|").split("|"),f=0;ff--)for(;++fd--)for(;++d>0];return r.parse(e,s,o,a)}},wt=(H._setPluginRatio=function(t){this.plugin.setRatio(t);for(var e,n,i,r,o,a=this.data,s=a.proxy,l=a.firstMPT;l;)e=s[l.v],l.r?e=l.r(e):e<1e-6&&e>-1e-6&&(e=0),l.t[l.p]=e,l=l._next;if(a.autoRotate&&(a.autoRotate.rotation=a.mod?a.mod.call(this._tween,s.rotation,this.t,this._tween):s.rotation),1===t||0===t)for(l=a.firstMPT,o=1===t?"e":"b";l;){if((n=l.t).type){if(1===n.type){for(r=n.xs0+n.s+n.xs1,i=1;i0;)l="xn"+a,f[s=i.p+"_"+l]=i.data[l],d[s]=i[l],o||(c=new wt(i,l,s,c,i.rxp[l]));i=i._next}return{proxy:d,end:f,firstMPT:c,pt:u}},H.CSSPropTween=function(t,e,n,i,o,a,l,c,u,h,d){this.t=t,this.p=e,this.s=n,this.c=i,this.n=l||e,t instanceof Tt||s.push(this.n),this.r=c?"function"==typeof c?c:Math.round:c,this.type=a||0,u&&(this.pr=u,r=!0),this.b=void 0===h?n:h,this.e=void 0===d?n+i:d,o&&(this._next=o,o._prev=this)}),Ct=function(t,e,n,i,r,o){var a=new Tt(t,e,n,i-n,r,-1,o);return a.b=n,a.e=a.xs0=i,a},St=l.parseComplex=function(t,e,n,i,r,o,a,s,c,u){n=n||o||"","function"==typeof i&&(i=i(y,v)),a=new Tt(t,e,0,0,a,u?2:1,null,!1,s,n,i),i+="",r&&yt.test(i+n)&&(l.colorStringFilter(i=[n,i]),n=i[0],i=i[1]);var h,f,p,m,g,_,w,T,C,S,k,M,E,A=n.split(", ").join(",").split(" "),P=i.split(", ").join(",").split(" "),I=A.length,O=!1!==d;for(-1===i.indexOf(",")&&-1===n.indexOf(",")||(-1!==(i+n).indexOf("rgb")||-1!==(i+n).indexOf("hsl")?(A=A.join(" ").replace(F,", ").split(" "),P=P.join(" ").replace(F,", ").split(" ")):(A=A.join(" ").split(",").join(", ").split(" "),P=P.join(" ").split(",").join(", ").split(" ")),I=A.length),I!==P.length&&(I=(A=(o||"").split(" ")).length),a.plugin=c,a.setRatio=u,yt.lastIndex=0,h=0;h6)&&!W&&0===g[3]?(a["xs"+a.l]+=a.l?" transparent":"transparent",a.e=a.e.split(P[h]).join("transparent")):(W||(C=!1),E?a.appendXtra(S.substr(0,S.indexOf("hsl"))+(C?"hsla(":"hsl("),m[0],dt(g[0],m[0]),",",!1,!0).appendXtra("",m[1],dt(g[1],m[1]),"%,",!1).appendXtra("",m[2],dt(g[2],m[2]),C?"%,":"%"+M,!1):a.appendXtra(S.substr(0,S.indexOf("rgb"))+(C?"rgba(":"rgb("),m[0],g[0]-m[0],",",Math.round,!0).appendXtra("",m[1],g[1]-m[1],",",Math.round).appendXtra("",m[2],g[2]-m[2],C?",":M,Math.round),C&&(m=m.length<4?1:m[3],a.appendXtra("",m,(g.length<4?1:g[3])-m,M,!1))),yt.lastIndex=0;else if(_=m.match(x)){if(!(w=g.match(b))||w.length!==_.length)return a;for(p=0,f=0;f<_.length;f++)k=_[f],S=m.indexOf(k,p),a.appendXtra(m.substr(p,S-p),Number(k),dt(w[f],k),"",!(!O||"px"!==m.substr(S+k.length,2))&&Math.round,0===f),p=S+k.length;a["xs"+a.l]+=m.substr(p)}else a["xs"+a.l]+=a.l||a["xs"+a.l]?" "+g:g;if(-1!==i.indexOf("=")&&a.data){for(M=a.xs0+a.data.s,h=1;h0;)h["xn"+kt]=0,h["xs"+kt]="";h.xs0="",h._next=h._prev=h.xfirst=h.data=h.plugin=h.setRatio=h.rxp=null,h.appendXtra=function(t,e,n,i,r,o){var a=this,s=a.l;return a["xs"+s]+=o&&(s||a["xs"+s])?" "+t:t||"",n||0===s||a.plugin?(a.l++,a.type=a.setRatio?2:1,a["xs"+a.l]=i||"",s>0?(a.data["xn"+s]=e+n,a.rxp["xn"+s]=r,a["xn"+s]=e,a.plugin||(a.xfirst=new Tt(a,"xn"+s,e,n,a.xfirst||a,0,a.n,r,a.pr),a.xfirst.xs0=0),a):(a.data={s:e+n},a.rxp={},a.s=e,a.c=n,a.r=r,a)):(a["xs"+s]+=e+(i||""),a)};var Mt=function(t,e){e=e||{},this.p=e.prefix&&tt(t)||t,u[t]=u[this.p]=this,this.format=e.formatter||xt(e.defaultValue,e.color,e.collapsible,e.multi),e.parser&&(this.parse=e.parser),this.clrs=e.color,this.multi=e.multi,this.keyword=e.keyword,this.dflt=e.defaultValue,this.allowFunc=e.allowFunc,this.pr=e.priority||0},Et=H._registerComplexSpecialProp=function(t,e,i){"object"!==n(e)&&(e={parser:i});var r,o=t.split(","),a=e.defaultValue;for(i=i||[a],r=0;rs.length?l.length:s.length,a=0;a-1;)o=Number(r[kt]),r[kt]=(a=o-(o|=0))?(1e5*a+(a<0?-.5:.5)|0)/1e5+o:o;return e&&r.length>6?[r[0],r[1],r[4],r[5],r[12],r[13]]:r},Kt=H.getTransform=function(t,n,i,r){if(t._gsTransform&&i&&!r)return t._gsTransform;var o,a,s,c,u,h,d=i&&t._gsTransform||new $t,f=d.scaleX<0,p=1e5,m=Nt&&(parseFloat(it(t,Bt,n,!1,"0 0 0").split(" ")[2])||d.zOrigin)||0,g=parseFloat(l.defaultTransformPerspective)||0;if(d.svg=!(!t.getCTM||!Xt(t)),d.svg&&(Zt(t,it(t,Bt,n,!1,"50% 50%")+"",d,t.getAttribute("data-svg-origin")),Pt=l.useSVGTransformAttr||qt),(o=Yt(t))!==Wt){if(16===o.length){var _,v,y,x,b,w=o[0],T=o[1],C=o[2],S=o[3],k=o[4],M=o[5],E=o[6],A=o[7],P=o[8],I=o[9],O=o[10],D=o[12],z=o[13],R=o[14],L=o[11],F=Math.atan2(E,O);d.zOrigin&&(D=P*(R=-d.zOrigin)-o[12],z=I*R-o[13],R=O*R+d.zOrigin-o[14]),d.rotationX=F*$,F&&(_=k*(x=Math.cos(-F))+P*(b=Math.sin(-F)),v=M*x+I*b,y=E*x+O*b,P=k*-b+P*x,I=M*-b+I*x,O=E*-b+O*x,L=A*-b+L*x,k=_,M=v,E=y),F=Math.atan2(-C,O),d.rotationY=F*$,F&&(v=T*(x=Math.cos(-F))-I*(b=Math.sin(-F)),y=C*x-O*b,I=T*b+I*x,O=C*b+O*x,L=S*b+L*x,w=_=w*x-P*b,T=v,C=y),F=Math.atan2(T,w),d.rotation=F*$,F&&(_=w*(x=Math.cos(F))+T*(b=Math.sin(F)),v=k*x+M*b,y=P*x+I*b,T=T*x-w*b,M=M*x-k*b,I=I*x-P*b,w=_,k=v,P=y),d.rotationX&&Math.abs(d.rotationX)+Math.abs(d.rotation)>359.9&&(d.rotationX=d.rotation=0,d.rotationY=180-d.rotationY),F=Math.atan2(k,M),d.scaleX=(Math.sqrt(w*w+T*T+C*C)*p+.5|0)/p,d.scaleY=(Math.sqrt(M*M+E*E)*p+.5|0)/p,d.scaleZ=(Math.sqrt(P*P+I*I+O*O)*p+.5|0)/p,w/=d.scaleX,k/=d.scaleY,T/=d.scaleX,M/=d.scaleY,Math.abs(F)>2e-5?(d.skewX=F*$,k=0,"simple"!==d.skewType&&(d.scaleY*=1/Math.cos(F))):d.skewX=0,d.perspective=L?1/(L<0?-L:L):0,d.x=D,d.y=z,d.z=R,d.svg&&(d.x-=d.xOrigin-(d.xOrigin*w-d.yOrigin*k),d.y-=d.yOrigin-(d.yOrigin*T-d.xOrigin*M))}else if(!Nt||r||!o.length||d.x!==o[4]||d.y!==o[5]||!d.rotationX&&!d.rotationY){var B=o.length>=6,N=B?o[0]:1,j=o[1]||0,U=o[2]||0,V=B?o[3]:1;d.x=o[4]||0,d.y=o[5]||0,s=Math.sqrt(N*N+j*j),c=Math.sqrt(V*V+U*U),u=N||j?Math.atan2(j,N)*$:d.rotation||0,h=U||V?Math.atan2(U,V)*$+u:d.skewX||0,d.scaleX=s,d.scaleY=c,d.rotation=u,d.skewX=h,Nt&&(d.rotationX=d.rotationY=d.z=0,d.perspective=g,d.scaleZ=1),d.svg&&(d.x-=d.xOrigin-(d.xOrigin*N+d.yOrigin*U),d.y-=d.yOrigin-(d.xOrigin*j+d.yOrigin*V))}for(a in Math.abs(d.skewX)>90&&Math.abs(d.skewX)<270&&(f?(d.scaleX*=-1,d.skewX+=d.rotation<=0?180:-180,d.rotation+=d.rotation<=0?180:-180):(d.scaleY*=-1,d.skewX+=d.skewX<=0?180:-180)),d.zOrigin=m,d)d[a]<2e-5&&d[a]>-2e-5&&(d[a]=0)}return i&&(t._gsTransform=d,d.svg&&(Pt&&t.style[Lt]?e.delayedCall(.001,(function(){ee(t.style,Lt)})):!Pt&&t.getAttribute("transform")&&e.delayedCall(.001,(function(){t.removeAttribute("transform")})))),d},Jt=function(t){var e,n,i=this.data,r=-i.rotation*N,o=r+i.skewX*N,a=1e5,s=(Math.cos(r)*i.scaleX*a|0)/a,l=(Math.sin(r)*i.scaleX*a|0)/a,c=(Math.sin(o)*-i.scaleY*a|0)/a,u=(Math.cos(o)*i.scaleY*a|0)/a,h=this.t.style,d=this.t.currentStyle;if(d){n=l,l=-c,c=-n,e=d.filter,h.filter="";var f,p,m=this.t.offsetWidth,g=this.t.offsetHeight,v="absolute"!==d.position,y="progid:DXImageTransform.Microsoft.Matrix(M11="+s+", M12="+l+", M21="+c+", M22="+u,x=i.x+m*i.xPercent/100,b=i.y+g*i.yPercent/100;if(null!=i.ox&&(x+=(f=(i.oxp?m*i.ox*.01:i.ox)-m/2)-(f*s+(p=(i.oyp?g*i.oy*.01:i.oy)-g/2)*l),b+=p-(f*c+p*u)),y+=v?", Dx="+((f=m/2)-(f*s+(p=g/2)*l)+x)+", Dy="+(p-(f*c+p*u)+b)+")":", sizingMethod='auto expand')",-1!==e.indexOf("DXImageTransform.Microsoft.Matrix(")?h.filter=e.replace(L,y):h.filter=y+" "+e,0!==t&&1!==t||1===s&&0===l&&0===c&&1===u&&(v&&-1===y.indexOf("Dx=0, Dy=0")||k.test(e)&&100!==parseFloat(RegExp.$1)||-1===e.indexOf(e.indexOf("Alpha"))&&h.removeAttribute("filter")),!v){var w,T,C,M=_<8?1:-1;for(f=i.ieOffsetX||0,p=i.ieOffsetY||0,i.ieOffsetX=Math.round((m-((s<0?-s:s)*m+(l<0?-l:l)*g))/2+x),i.ieOffsetY=Math.round((g-((u<0?-u:u)*g+(c<0?-c:c)*m))/2+b),kt=0;kt<4;kt++)C=(n=-1!==(w=d[T=ct[kt]]).indexOf("px")?parseFloat(w):rt(this.t,T,parseFloat(w),w.replace(S,""))||0)!==i[T]?kt<2?-i.ieOffsetX:-i.ieOffsetY:kt<2?f-i.ieOffsetX:p-i.ieOffsetY,h[T]=(i[T]=Math.round(n-C*(0===kt||2===kt?1:M)))+"px"}}},Qt=H.set3DTransformRatio=H.setTransformRatio=function(t){var e,n,i,r,o,a,s,l,c,u,h,d,f,p,g,_,v,y,x,b,w,T=this.data,C=this.t.style,S=T.rotation,k=T.rotationX,M=T.rotationY,E=T.scaleX,A=T.scaleY,P=T.scaleZ,I=T.x,O=T.y,D=T.z,z=T.svg,R=T.perspective,L=T.force3D,F=T.skewY,B=T.skewX;if(F&&(B+=F,S+=F),!((1!==t&&0!==t||"auto"!==L||this.tween._totalTime!==this.tween._totalDuration&&this.tween._totalTime)&&L||D||R||M||k||1!==P)||Pt&&z||!Nt)S||B||z?(S*=N,b=B*N,w=1e5,n=Math.cos(S)*E,o=Math.sin(S)*E,i=Math.sin(S-b)*-A,a=Math.cos(S-b)*A,b&&"simple"===T.skewType&&(e=Math.tan(b-F*N),i*=e=Math.sqrt(1+e*e),a*=e,F&&(e=Math.tan(F*N),n*=e=Math.sqrt(1+e*e),o*=e)),z&&(I+=T.xOrigin-(T.xOrigin*n+T.yOrigin*i)+T.xOffset,O+=T.yOrigin-(T.xOrigin*o+T.yOrigin*a)+T.yOffset,Pt&&(T.xPercent||T.yPercent)&&(g=this.t.getBBox(),I+=.01*T.xPercent*g.width,O+=.01*T.yPercent*g.height),I<(g=1e-6)&&I>-g&&(I=0),O-g&&(O=0)),x=(n*w|0)/w+","+(o*w|0)/w+","+(i*w|0)/w+","+(a*w|0)/w+","+I+","+O+")",z&&Pt?this.t.setAttribute("transform","matrix("+x):C[Lt]=(T.xPercent||T.yPercent?"translate("+T.xPercent+"%,"+T.yPercent+"%) matrix(":"matrix(")+x):C[Lt]=(T.xPercent||T.yPercent?"translate("+T.xPercent+"%,"+T.yPercent+"%) matrix(":"matrix(")+E+",0,0,"+A+","+I+","+O+")";else{if(m&&(E<(g=1e-4)&&E>-g&&(E=P=2e-5),A-g&&(A=P=2e-5),!R||T.z||T.rotationX||T.rotationY||(R=0)),S||B)S*=N,_=n=Math.cos(S),v=o=Math.sin(S),B&&(S-=B*N,_=Math.cos(S),v=Math.sin(S),"simple"===T.skewType&&(e=Math.tan((B-F)*N),_*=e=Math.sqrt(1+e*e),v*=e,T.skewY&&(e=Math.tan(F*N),n*=e=Math.sqrt(1+e*e),o*=e))),i=-v,a=_;else{if(!(M||k||1!==P||R||z))return void(C[Lt]=(T.xPercent||T.yPercent?"translate("+T.xPercent+"%,"+T.yPercent+"%) translate3d(":"translate3d(")+I+"px,"+O+"px,"+D+"px)"+(1!==E||1!==A?" scale("+E+","+A+")":""));n=a=1,i=o=0}u=1,r=s=l=c=h=d=0,f=R?-1/R:0,p=T.zOrigin,g=1e-6,",","0",(S=M*N)&&(_=Math.cos(S),l=-(v=Math.sin(S)),h=f*-v,r=n*v,s=o*v,u=_,f*=_,n*=_,o*=_),(S=k*N)&&(e=i*(_=Math.cos(S))+r*(v=Math.sin(S)),y=a*_+s*v,c=u*v,d=f*v,r=i*-v+r*_,s=a*-v+s*_,u*=_,f*=_,i=e,a=y),1!==P&&(r*=P,s*=P,u*=P,f*=P),1!==A&&(i*=A,a*=A,c*=A,d*=A),1!==E&&(n*=E,o*=E,l*=E,h*=E),(p||z)&&(p&&(I+=r*-p,O+=s*-p,D+=u*-p+p),z&&(I+=T.xOrigin-(T.xOrigin*n+T.yOrigin*i)+T.xOffset,O+=T.yOrigin-(T.xOrigin*o+T.yOrigin*a)+T.yOffset),I-g&&(I="0"),O-g&&(O="0"),D-g&&(D=0)),x=T.xPercent||T.yPercent?"translate("+T.xPercent+"%,"+T.yPercent+"%) matrix3d(":"matrix3d(",x+=(n-g?"0":n)+","+(o-g?"0":o)+","+(l-g?"0":l),x+=","+(h-g?"0":h)+","+(i-g?"0":i)+","+(a-g?"0":a),k||M||1!==P?(x+=","+(c-g?"0":c)+","+(d-g?"0":d)+","+(r-g?"0":r),x+=","+(s-g?"0":s)+","+(u-g?"0":u)+","+(f-g?"0":f)+","):x+=",0,0,0,0,1,0,",x+=I+","+O+","+D+","+(R?1+-D/R:1)+")",C[Lt]=x}};(h=$t.prototype).x=h.y=h.z=h.skewX=h.skewY=h.rotation=h.rotationX=h.rotationY=h.zOrigin=h.xPercent=h.yPercent=h.xOffset=h.yOffset=0,h.scaleX=h.scaleY=h.scaleZ=1,Et("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin",{parser:function(t,e,i,r,o,s,c){if(r._lastParsedTransform===c)return o;r._lastParsedTransform=c;var u=c.scale&&"function"==typeof c.scale?c.scale:0;u&&(c.scale=u(y,t));var h,d,f,p,m,g,_,x,b,w=t._gsTransform,T=t.style,C=Rt.length,S=c,k={},M=Kt(t,a,!0,S.parseTransform),E=S.transform&&("function"==typeof S.transform?S.transform(y,v):S.transform);if(M.skewType=S.skewType||M.skewType||l.defaultSkewType,r._transform=M,"rotationZ"in S&&(S.rotation=S.rotationZ),E&&"string"==typeof E&&Lt)(d=Z.style)[Lt]=E,d.display="block",d.position="absolute",-1!==E.indexOf("%")&&(d.width=it(t,"width"),d.height=it(t,"height")),V.body.appendChild(Z),h=Kt(Z,null,!1),"simple"===M.skewType&&(h.scaleY*=Math.cos(h.skewX*N)),M.svg&&(g=M.xOrigin,_=M.yOrigin,h.x-=M.xOffset,h.y-=M.yOffset,(S.transformOrigin||S.svgOrigin)&&(E={},Zt(t,ht(S.transformOrigin),E,S.svgOrigin,S.smoothOrigin,!0),g=E.xOrigin,_=E.yOrigin,h.x-=E.xOffset-M.xOffset,h.y-=E.yOffset-M.yOffset),(g||_)&&(x=Yt(Z,!0),h.x-=g-(g*x[0]+_*x[2]),h.y-=_-(g*x[1]+_*x[3]))),V.body.removeChild(Z),h.perspective||(h.perspective=M.perspective),null!=S.xPercent&&(h.xPercent=ft(S.xPercent,M.xPercent)),null!=S.yPercent&&(h.yPercent=ft(S.yPercent,M.yPercent));else if("object"===n(S)){if(h={scaleX:ft(null!=S.scaleX?S.scaleX:S.scale,M.scaleX),scaleY:ft(null!=S.scaleY?S.scaleY:S.scale,M.scaleY),scaleZ:ft(S.scaleZ,M.scaleZ),x:ft(S.x,M.x),y:ft(S.y,M.y),z:ft(S.z,M.z),xPercent:ft(S.xPercent,M.xPercent),yPercent:ft(S.yPercent,M.yPercent),perspective:ft(S.transformPerspective,M.perspective)},null!=(m=S.directionalRotation))if("object"===n(m))for(d in m)S[d]=m[d];else S.rotation=m;"string"==typeof S.x&&-1!==S.x.indexOf("%")&&(h.x=0,h.xPercent=ft(S.x,M.xPercent)),"string"==typeof S.y&&-1!==S.y.indexOf("%")&&(h.y=0,h.yPercent=ft(S.y,M.yPercent)),h.rotation=pt("rotation"in S?S.rotation:"shortRotation"in S?S.shortRotation+"_short":M.rotation,M.rotation,"rotation",k),Nt&&(h.rotationX=pt("rotationX"in S?S.rotationX:"shortRotationX"in S?S.shortRotationX+"_short":M.rotationX||0,M.rotationX,"rotationX",k),h.rotationY=pt("rotationY"in S?S.rotationY:"shortRotationY"in S?S.shortRotationY+"_short":M.rotationY||0,M.rotationY,"rotationY",k)),h.skewX=pt(S.skewX,M.skewX),h.skewY=pt(S.skewY,M.skewY)}for(Nt&&null!=S.force3D&&(M.force3D=S.force3D,p=!0),(f=M.force3D||M.z||M.rotationX||M.rotationY||h.z||h.rotationX||h.rotationY||h.perspective)||null==S.scale||(h.scaleZ=1);--C>-1;)((E=h[b=Rt[C]]-M[b])>1e-6||E<-1e-6||null!=S[b]||null!=j[b])&&(p=!0,o=new Tt(M,b,M[b],E,o),b in k&&(o.e=k[b]),o.xs0=0,o.plugin=s,r._overwriteProps.push(o.n));return E="function"==typeof S.transformOrigin?S.transformOrigin(y,v):S.transformOrigin,M.svg&&(E||S.svgOrigin)&&(g=M.xOffset,_=M.yOffset,Zt(t,ht(E),h,S.svgOrigin,S.smoothOrigin),o=Ct(M,"xOrigin",(w?M:h).xOrigin,h.xOrigin,o,"transformOrigin"),o=Ct(M,"yOrigin",(w?M:h).yOrigin,h.yOrigin,o,"transformOrigin"),g===M.xOffset&&_===M.yOffset||(o=Ct(M,"xOffset",w?g:M.xOffset,M.xOffset,o,"transformOrigin"),o=Ct(M,"yOffset",w?_:M.yOffset,M.yOffset,o,"transformOrigin")),E="0px 0px"),(E||Nt&&f&&M.zOrigin)&&(Lt?(p=!0,b=Bt,E||(E=(E=(it(t,b,a,!1,"50% 50%")+"").split(" "))[0]+" "+E[1]+" "+M.zOrigin+"px"),E+="",(o=new Tt(T,b,0,0,o,-1,"transformOrigin")).b=T[b],o.plugin=s,Nt?(d=M.zOrigin,E=E.split(" "),M.zOrigin=(E.length>2?parseFloat(E[2]):d)||0,o.xs0=o.e=E[0]+" "+(E[1]||"50%")+" 0px",(o=new Tt(M,"zOrigin",0,0,o,-1,o.n)).b=d,o.xs0=o.e=M.zOrigin):o.xs0=o.e=E):ht(E+"",M)),p&&(r._transformType=M.svg&&Pt||!f&&3!==this._transformType?2:3),u&&(c.scale=u),o},allowFunc:!0,prefix:!0}),Et("boxShadow",{defaultValue:"0px 0px 0px 0px #999",prefix:!0,color:!0,multi:!0,keyword:"inset"}),Et("clipPath",{defaultValue:"inset(0%)",prefix:!0,multi:!0,formatter:xt("inset(0% 0% 0% 0%)",!1,!0)}),Et("borderRadius",{defaultValue:"0px",parser:function(t,e,n,i,r,s){e=this.format(e);var l,c,u,h,d,f,p,m,g,_,v,y,x,b,w,T,C=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],S=t.style;for(g=parseFloat(t.offsetWidth),_=parseFloat(t.offsetHeight),l=e.split(" "),c=0;c-1;)(u=-1!==(m=s[c]).indexOf("%"))!==(-1!==l[c].indexOf("%"))&&(h=0===c?t.offsetWidth-G.width:t.offsetHeight-G.height,s[c]=u?parseFloat(m)/100*h+"px":parseFloat(m)/h*100+"%");m=s.join(" ")}return this.parseComplex(t.style,m,g,r,o)},formatter:ht}),Et("backgroundSize",{defaultValue:"0 0",formatter:function(t){return"co"===(t+="").substr(0,2)?t:ht(-1===t.indexOf(" ")?t+" "+t:t)}}),Et("perspective",{defaultValue:"0px",prefix:!0}),Et("perspectiveOrigin",{defaultValue:"50% 50%",prefix:!0}),Et("transformStyle",{prefix:!0}),Et("backfaceVisibility",{prefix:!0}),Et("userSelect",{prefix:!0}),Et("margin",{parser:bt("marginTop,marginRight,marginBottom,marginLeft")}),Et("padding",{parser:bt("paddingTop,paddingRight,paddingBottom,paddingLeft")}),Et("clip",{defaultValue:"rect(0px,0px,0px,0px)",parser:function(t,e,n,i,r,o){var s,l,c;return _<9?(l=t.currentStyle,c=_<8?" ":",",s="rect("+l.clipTop+c+l.clipRight+c+l.clipBottom+c+l.clipLeft+")",e=this.format(e).split(",").join(c)):(s=this.format(it(t,this.p,a,!1,this.dflt)),e=this.format(e)),this.parseComplex(t.style,s,e,r,o)}}),Et("textShadow",{defaultValue:"0px 0px 0px #999",color:!0,multi:!0}),Et("autoRound,strictUnits",{parser:function(t,e,n,i,r){return r}}),Et("border",{defaultValue:"0px solid #000",parser:function(t,e,n,i,r,o){var s=it(t,"borderTopWidth",a,!1,"0px"),l=this.format(e).split(" "),c=l[0].replace(S,"");return"px"!==c&&(s=parseFloat(s)/rt(t,"borderTopWidth",1,c)+c),this.parseComplex(t.style,this.format(s+" "+it(t,"borderTopStyle",a,!1,"solid")+" "+it(t,"borderTopColor",a,!1,"#000")),l.join(" "),r,o)},color:!0,formatter:function(t){var e=t.split(" ");return e[0]+" "+(e[1]||"solid")+" "+(t.match(yt)||["#000"])[0]}}),Et("borderWidth",{parser:bt("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}),Et("float,cssFloat,styleFloat",{parser:function(t,e,n,i,r,o){var a=t.style,s="cssFloat"in a?"cssFloat":"styleFloat";return new Tt(a,s,0,0,r,-1,n,!1,0,a[s],e)}});var te=function(t){var e,n=this.t,i=n.filter||it(this.data,"filter")||"",r=this.s+this.c*t|0;100===r&&(-1===i.indexOf("atrix(")&&-1===i.indexOf("radient(")&&-1===i.indexOf("oader(")?(n.removeAttribute("filter"),e=!it(this.data,"filter")):(n.filter=i.replace(E,""),e=!0)),e||(this.xn1&&(n.filter=i=i||"alpha(opacity="+r+")"),-1===i.indexOf("pacity")?0===r&&this.xn1||(n.filter=i+" alpha(opacity="+r+")"):n.filter=i.replace(k,"opacity="+r))};Et("opacity,alpha,autoAlpha",{defaultValue:"1",parser:function(t,e,n,i,r,o){var s=parseFloat(it(t,"opacity",a,!1,"1")),l=t.style,c="autoAlpha"===n;return"string"==typeof e&&"="===e.charAt(1)&&(e=("-"===e.charAt(0)?-1:1)*parseFloat(e.substr(2))+s),c&&1===s&&"hidden"===it(t,"visibility",a)&&0!==e&&(s=0),W?r=new Tt(l,"opacity",s,e-s,r):((r=new Tt(l,"opacity",100*s,100*(e-s),r)).xn1=c?1:0,l.zoom=1,r.type=2,r.b="alpha(opacity="+r.s+")",r.e="alpha(opacity="+(r.s+r.c)+")",r.data=t,r.plugin=o,r.setRatio=te),c&&((r=new Tt(l,"visibility",0,0,r,-1,null,!1,0,0!==s?"inherit":"hidden",0===e?"hidden":"inherit")).xs0="inherit",i._overwriteProps.push(r.n),i._overwriteProps.push(n)),r}});var ee=function(t,e){e&&(t.removeProperty?("ms"!==e.substr(0,2)&&"webkit"!==e.substr(0,6)||(e="-"+e),t.removeProperty(e.replace(P,"-$1").toLowerCase())):t.removeAttribute(e))},ne=function(t){if(this.t._gsClassPT=this,1===t||0===t){this.t.setAttribute("class",0===t?this.b:this.e);for(var e=this.data,n=this.t.style;e;)e.v?n[e.p]=e.v:ee(n,e.p),e=e._next;1===t&&this.t._gsClassPT===this&&(this.t._gsClassPT=null)}else this.t.getAttribute("class")!==this.e&&this.t.setAttribute("class",this.e)};Et("className",{parser:function(t,e,n,i,o,s,l){var c,u,h,d,f,p=t.getAttribute("class")||"",m=t.style.cssText;if((o=i._classNamePT=new Tt(t,n,0,0,o,2)).setRatio=ne,o.pr=-11,r=!0,o.b=p,u=at(t,a),h=t._gsClassPT){for(d={},f=h.data;f;)d[f.p]=1,f=f._next;h.setRatio(1)}return t._gsClassPT=o,o.e="="!==e.charAt(1)?e:p.replace(new RegExp("(?:\\s|^)"+e.substr(2)+"(?![\\w-])"),"")+("+"===e.charAt(0)?" "+e.substr(2):""),t.setAttribute("class",o.e),c=st(t,u,at(t),l,d),t.setAttribute("class",p),o.data=c.firstMPT,t.style.cssText!==m&&(t.style.cssText=m),o=o.xfirst=i.parse(t,c.difs,o,s)}});var ie=function(t){if((1===t||0===t)&&this.data._totalTime===this.data._totalDuration&&"isFromStart"!==this.data.data){var e,n,i,r,o,a=this.t.style,s=u.transform.parse;if("all"===this.e)a.cssText="",r=!0;else for(i=(e=this.e.split(" ").join("").split(",")).length;--i>-1;)n=e[i],u[n]&&(u[n].parse===s?r=!0:n="transformOrigin"===n?Bt:u[n].p),ee(a,n);r&&(ee(a,Lt),(o=this.t._gsTransform)&&(o.svg&&(this.t.removeAttribute("data-svg-origin"),this.t.removeAttribute("transform")),delete this.t._gsTransform))}};for(Et("clearProps",{parser:function(t,e,n,i,o){return(o=new Tt(t,n,0,0,o,2)).setRatio=ie,o.e=e,o.pr=-10,o.data=i._tween,r=!0,o}}),h="bezier,throwProps,physicsProps,physics2D".split(","),kt=h.length;kt--;)At(h[kt]);(h=l.prototype)._firstPT=h._lastParsedTransform=h._transform=null,h._onInitTween=function(t,e,n,i){if(!t.nodeType)return!1;this._target=v=t,this._tween=n,this._vars=e,y=i,d=e.autoRound,r=!1,o=e.suffixMap||l.suffixMap,a=nt(t),s=this._overwriteProps;var c,h,m,_,x,b,w,T,C,S=t.style;if(f&&""===S.zIndex&&("auto"!==(c=it(t,"zIndex",a))&&""!==c||this._addLazySet(S,"zIndex",0)),"string"==typeof e&&(_=S.cssText,c=at(t,a),S.cssText=_+";"+e,c=st(t,c,at(t)).difs,!W&&M.test(e)&&(c.opacity=parseFloat(RegExp.$1)),e=c,S.cssText=_),e.className?this._firstPT=h=u.className.parse(t,e.className,"className",this,null,null,e):this._firstPT=h=this.parse(t,e,null),this._transformType){for(C=3===this._transformType,Lt?p&&(f=!0,""===S.zIndex&&("auto"!==(w=it(t,"zIndex",a))&&""!==w||this._addLazySet(S,"zIndex",0)),g&&this._addLazySet(S,"WebkitBackfaceVisibility",this._vars.WebkitBackfaceVisibility||(C?"visible":"hidden"))):S.zoom=1,m=h;m&&m._next;)m=m._next;T=new Tt(t,"transform",0,0,null,2),this._linkCSSP(T,null,m),T.setRatio=Lt?Qt:Jt,T.data=this._transform||Kt(t,a,!0),T.tween=n,T.pr=-1,s.pop()}if(r){for(;h;){for(b=h._next,m=_;m&&m.pr>h.pr;)m=m._next;(h._prev=m?m._prev:x)?h._prev._next=h:_=h,(h._next=m)?m._prev=h:x=h,h=b}this._firstPT=_}return!0},h.parse=function(t,e,n,i){var r,s,l,c,h,f,p,m,g,_,x=t.style;for(r in e){if(f=e[r],s=u[r],"function"!=typeof f||s&&s.allowFunc||(f=f(y,v)),s)n=s.parse(t,f,r,this,n,i,e);else{if("--"===r.substr(0,2)){this._tween._propLookup[r]=this._addTween.call(this._tween,t.style,"setProperty",nt(t).getPropertyValue(r)+"",f+"",r,!1,r);continue}h=it(t,r,a)+"",g="string"==typeof f,"color"===r||"fill"===r||"stroke"===r||-1!==r.indexOf("Color")||g&&A.test(f)?(g||(f=((f=_t(f)).length>3?"rgba(":"rgb(")+f.join(",")+")"),n=St(x,r,h,f,!0,"transparent",n,0,i)):g&&B.test(f)?n=St(x,r,h,f,!0,null,n,0,i):(p=(l=parseFloat(h))||0===l?h.substr((l+"").length):"",""!==h&&"auto"!==h||("width"===r||"height"===r?(l=ut(t,r,a),p="px"):"left"===r||"top"===r?(l=ot(t,r,a),p="px"):(l="opacity"!==r?0:1,p="")),(_=g&&"="===f.charAt(1))?(c=parseInt(f.charAt(0)+"1",10),f=f.substr(2),c*=parseFloat(f),m=f.replace(S,"")):(c=parseFloat(f),m=g?f.replace(S,""):""),""===m&&(m=r in o?o[r]:p),f=c||0===c?(_?c+l:c)+m:e[r],p!==m&&(""===m&&"lineHeight"!==r||(c||0===c)&&l&&(l=rt(t,r,l,p),"%"===m?(l/=rt(t,r,100,"%")/100,!0!==e.strictUnits&&(h=l+"%")):"em"===m||"rem"===m||"vw"===m||"vh"===m?l/=rt(t,r,1,m):"px"!==m&&(c=rt(t,r,c,m),m="px"),_&&(c||0===c)&&(f=c+l+m))),_&&(c+=l),!l&&0!==l||!c&&0!==c?void 0!==x[r]&&(f||f+""!="NaN"&&null!=f)?(n=new Tt(x,r,c||l||0,0,n,-1,r,!1,0,h,f)).xs0="none"!==f||"display"!==r&&-1===r.indexOf("Style")?f:h:K(e[r]):(n=new Tt(x,r,l,c-l,n,0,r,!1!==d&&("px"===m||"zIndex"===r),0,h,f)).xs0=m)}i&&n&&!n.plugin&&(n.plugin=i)}return n},h.setRatio=function(t){var e,n,i,r=this._firstPT;if(1!==t||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(t||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;r;){if(e=r.c*t+r.s,r.r?e=r.r(e):e<1e-6&&e>-1e-6&&(e=0),r.type)if(1===r.type)if(2===(i=r.l))r.t[r.p]=r.xs0+e+r.xs1+r.xn1+r.xs2;else if(3===i)r.t[r.p]=r.xs0+e+r.xs1+r.xn1+r.xs2+r.xn2+r.xs3;else if(4===i)r.t[r.p]=r.xs0+e+r.xs1+r.xn1+r.xs2+r.xn2+r.xs3+r.xn3+r.xs4;else if(5===i)r.t[r.p]=r.xs0+e+r.xs1+r.xn1+r.xs2+r.xn2+r.xs3+r.xn3+r.xs4+r.xn4+r.xs5;else{for(n=r.xs0+e+r.xs1,i=1;i-1;)t(e[o],n,i);else for(o=(r=e.childNodes).length;--o>-1;)s=(a=r[o]).type,a.style&&(n.push(at(a)),i&&i.push(a)),1!==s&&9!==s&&11!==s||!a.childNodes.length||t(a,n,i)};return l.cascadeTo=function(t,n,i){var r,o,a,s,l=e.to(t,n,i),c=[l],u=[],h=[],d=[],f=e._internals.reservedProps;for(t=l._targets||l.target,oe(t,u,d),l.render(n,!0,!0),oe(t,h),l.render(0,!0,!0),l._enabled(!0),r=d.length;--r>-1;)if((o=st(d[r],u[r],h[r])).firstMPT){for(a in o=o.difs,i)f[a]&&(o[a]=i[a]);for(a in s={},o)s[a]=u[r][a];c.push(e.fromTo(d[r],n,s,o))}return c},t.activate([l]),l}),!0),function(){var t=i._gsDefine.plugin({propName:"roundProps",version:"1.7.0",priority:-1,API:2,init:function(t,e,n){return this._tween=n,!0}}),e=function(t){var e=t<1?Math.pow(10,(t+"").length-2):1;return function(n){return(Math.round(n/t)*t*e|0)/e}},r=function(t,e){for(;t;)t.f||t.blob||(t.m=e||Math.round),t=t._next},o=t.prototype;o._onInitAllProps=function(){var t,i,o,a,s=this._tween,l=s.vars.roundProps,c={},u=s._propLookup.roundProps;if("object"!==n(l)||l.push)for("string"==typeof l&&(l=l.split(",")),o=l.length;--o>-1;)c[l[o]]=Math.round;else for(a in l)c[a]=e(l[a]);for(a in c)for(t=s._firstPT;t;)i=t._next,t.pg?t.t._mod(c):t.n===a&&(2===t.f&&t.t?r(t.t._firstPT,c[a]):(this._add(t.t,a,t.s,t.c,c[a]),i&&(i._prev=t._prev),t._prev?t._prev._next=i:s._firstPT===t&&(s._firstPT=i),t._next=t._prev=null,s._propLookup[a]=u)),t=i;return!1},o._add=function(t,e,n,i,r){this._addTween(t,e,n,n+i,e,r||Math.round),this._overwriteProps.push(e)}}(),i._gsDefine.plugin({propName:"attr",API:2,version:"0.6.1",init:function(t,e,n,i){var r,o;if("function"!=typeof t.setAttribute)return!1;for(r in e)"function"==typeof(o=e[r])&&(o=o(i,t)),this._addTween(t,"setAttribute",t.getAttribute(r)+"",o+"",r,!1,r),this._overwriteProps.push(r);return!0}}),i._gsDefine.plugin({propName:"directionalRotation",version:"0.3.1",API:2,init:function(t,e,i,r){"object"!==n(e)&&(e={rotation:e}),this.finals={};var o,a,s,l,c,u,h=!0===e.useRadians?2*Math.PI:360;for(o in e)"useRadians"!==o&&("function"==typeof(l=e[o])&&(l=l(r,t)),a=(u=(l+"").split("_"))[0],s=parseFloat("function"!=typeof t[o]?t[o]:t[o.indexOf("set")||"function"!=typeof t["get"+o.substr(3)]?o:"get"+o.substr(3)]()),c=(l=this.finals[o]="string"==typeof a&&"="===a.charAt(1)?s+parseInt(a.charAt(0)+"1",10)*Number(a.substr(2)):Number(a)||0)-s,u.length&&(-1!==(a=u.join("_")).indexOf("short")&&(c%=h)!==c%(h/2)&&(c=c<0?c+h:c-h),-1!==a.indexOf("_cw")&&c<0?c=(c+9999999999*h)%h-(c/h|0)*h:-1!==a.indexOf("ccw")&&c>0&&(c=(c-9999999999*h)%h-(c/h|0)*h)),(c>1e-6||c<-1e-6)&&(this._addTween(t,o,s,s+c,o),this._overwriteProps.push(o)));return!0},set:function(t){var e;if(1!==t)this._super.setRatio.call(this,t);else for(e=this._firstPT;e;)e.f?e.t[e.p](this.finals[e.p]):e.t[e.p]=this.finals[e.p],e=e._next}})._autoCSS=!0,i._gsDefine("easing.Back",["easing.Ease"],(function(t){var e,n,r,o,a=i.GreenSockGlobals||i,s=a.com.greensock,l=2*Math.PI,c=Math.PI/2,u=s._class,h=function(e,n){var i=u("easing."+e,(function(){}),!0),r=i.prototype=new t;return r.constructor=i,r.getRatio=n,i},d=t.register||function(){},f=function(t,e,n,i,r){var o=u("easing."+t,{easeOut:new e,easeIn:new n,easeInOut:new i},!0);return d(o,t),o},p=function(t,e,n){this.t=t,this.v=e,n&&(this.next=n,n.prev=this,this.c=n.v-e,this.gap=n.t-t)},m=function(e,n){var i=u("easing."+e,(function(t){this._p1=t||0===t?t:1.70158,this._p2=1.525*this._p1}),!0),r=i.prototype=new t;return r.constructor=i,r.getRatio=n,r.config=function(t){return new i(t)},i},g=f("Back",m("BackOut",(function(t){return(t-=1)*t*((this._p1+1)*t+this._p1)+1})),m("BackIn",(function(t){return t*t*((this._p1+1)*t-this._p1)})),m("BackInOut",(function(t){return(t*=2)<1?.5*t*t*((this._p2+1)*t-this._p2):.5*((t-=2)*t*((this._p2+1)*t+this._p2)+2)}))),_=u("easing.SlowMo",(function(t,e,n){e=e||0===e?e:.7,null==t?t=.7:t>1&&(t=1),this._p=1!==t?e:0,this._p1=(1-t)/2,this._p2=t,this._p3=this._p1+this._p2,this._calcEnd=!0===n}),!0),v=_.prototype=new t;return v.constructor=_,v.getRatio=function(t){var e=t+(.5-t)*this._p;return tthis._p3?this._calcEnd?1===t?0:1-(t=(t-this._p3)/this._p1)*t:e+(t-e)*(t=(t-this._p3)/this._p1)*t*t*t:this._calcEnd?1:e},_.ease=new _(.7,.7),v.config=_.config=function(t,e,n){return new _(t,e,n)},(v=(e=u("easing.SteppedEase",(function(t,e){t=t||1,this._p1=1/t,this._p2=t+(e?0:1),this._p3=e?1:0}),!0)).prototype=new t).constructor=e,v.getRatio=function(t){return t<0?t=0:t>=1&&(t=.999999999),((this._p2*t|0)+this._p3)*this._p1},v.config=e.config=function(t,n){return new e(t,n)},(v=(n=u("easing.ExpoScaleEase",(function(t,e,n){this._p1=Math.log(e/t),this._p2=e-t,this._p3=t,this._ease=n}),!0)).prototype=new t).constructor=n,v.getRatio=function(t){return this._ease&&(t=this._ease.getRatio(t)),(this._p3*Math.exp(this._p1*t)-this._p3)/this._p2},v.config=n.config=function(t,e,i){return new n(t,e,i)},(v=(r=u("easing.RoughEase",(function(e){for(var n,i,r,o,a,s,l=(e=e||{}).taper||"none",c=[],u=0,h=0|(e.points||20),d=h,f=!1!==e.randomize,m=!0===e.clamp,g=e.template instanceof t?e.template:null,_="number"==typeof e.strength?.4*e.strength:.4;--d>-1;)n=f?Math.random():1/h*d,i=g?g.getRatio(n):n,r="none"===l?_:"out"===l?(o=1-n)*o*_:"in"===l?n*n*_:n<.5?(o=2*n)*o*.5*_:(o=2*(1-n))*o*.5*_,f?i+=Math.random()*r-.5*r:d%2?i+=.5*r:i-=.5*r,m&&(i>1?i=1:i<0&&(i=0)),c[u++]={x:n,y:i};for(c.sort((function(t,e){return t.x-e.x})),s=new p(1,1,null),d=h;--d>-1;)a=c[d],s=new p(a.x,a.y,s);this._prev=new p(0,0,0!==s.t?s:s.next)}),!0)).prototype=new t).constructor=r,v.getRatio=function(t){var e=this._prev;if(t>e.t){for(;e.next&&t>=e.t;)e=e.next;e=e.prev}else for(;e.prev&&t<=e.t;)e=e.prev;return this._prev=e,e.v+(t-e.t)/e.gap*e.c},v.config=function(t){return new r(t)},r.ease=new r,f("Bounce",h("BounceOut",(function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375})),h("BounceIn",(function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)})),h("BounceInOut",(function(t){var e=t<.5;return(t=e?1-2*t:2*t-1)<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5}))),f("Circ",h("CircOut",(function(t){return Math.sqrt(1-(t-=1)*t)})),h("CircIn",(function(t){return-(Math.sqrt(1-t*t)-1)})),h("CircInOut",(function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}))),f("Elastic",(o=function(e,n,i){var r=u("easing."+e,(function(t,e){this._p1=t>=1?t:1,this._p2=(e||i)/(t<1?t:1),this._p3=this._p2/l*(Math.asin(1/this._p1)||0),this._p2=l/this._p2}),!0),o=r.prototype=new t;return o.constructor=r,o.getRatio=n,o.config=function(t,e){return new r(t,e)},r})("ElasticOut",(function(t){return this._p1*Math.pow(2,-10*t)*Math.sin((t-this._p3)*this._p2)+1}),.3),o("ElasticIn",(function(t){return-this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*this._p2)}),.3),o("ElasticInOut",(function(t){return(t*=2)<1?this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(t-=1))*Math.sin((t-this._p3)*this._p2)*.5+1}),.45)),f("Expo",h("ExpoOut",(function(t){return 1-Math.pow(2,-10*t)})),h("ExpoIn",(function(t){return Math.pow(2,10*(t-1))-.001})),h("ExpoInOut",(function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))}))),f("Sine",h("SineOut",(function(t){return Math.sin(t*c)})),h("SineIn",(function(t){return 1-Math.cos(t*c)})),h("SineInOut",(function(t){return-.5*(Math.cos(Math.PI*t)-1)}))),u("easing.EaseLookup",{find:function(e){return t.map[e]}},!0),d(a.SlowMo,"SlowMo","ease,"),d(r,"RoughEase","ease,"),d(e,"SteppedEase","ease,"),g}),!0)})),i._gsDefine&&i._gsQueue.pop()(),function(t,i){var r={},o=t.document,a=t.GreenSockGlobals=t.GreenSockGlobals||t,s=a.TweenMax;if(s)return void 0!==e&&e.exports&&(e.exports=s),s;var l,c,u,h,d,f,p,m=function(t){var e,n=t.split("."),i=a;for(e=0;e-1;)(h=x[o[g]]||new n(o[g],[])).gsClass?(c[g]=h.gsClass,_--):u&&h.sc.push(this);if(0===_&&s){if(f=(d=("com.greensock."+i).split(".")).pop(),p=m(d.join("."))[f]=this.gsClass=s.apply(s,c),l)if(a[f]=r[f]=p,void 0!==e&&e.exports)if("TweenMax"===i)for(g in e.exports=r.TweenMax=p,r)p[g]=r[g];else r.TweenMax&&(r.TweenMax[f]=p);else"function"==typeof define&&define.amd&&define((t.GreenSockAMDPath?t.GreenSockAMDPath+"/":"")+i.split(".").pop(),[],(function(){return p}));for(g=0;g-1;)for(o=l[c],r=i?T("easing."+o,null,!0):g.easing[o]||{},a=u.length;--a>-1;)s=u[a],k[o+"."+s]=k[s+o]=r[s]=t.getRatio?t:t[s]||new t};for((u=S.prototype)._calcEnd=!1,u.getRatio=function(t){if(this._func)return this._params[0]=t,this._func.apply(null,this._params);var e=this._type,n=this._power,i=1===e?1-t:2===e?t:t<.5?2*t:2*(1-t);return 1===n?i*=i:2===n?i*=i*i:3===n?i*=i*i*i:4===n&&(i*=i*i*i*i),1===e?1-i:2===e?i:t<.5?i/2:1-i/2},c=(l=["Linear","Quad","Cubic","Quart","Quint,Strong"]).length;--c>-1;)u=l[c]+",Power"+c,M(new S(null,null,1,c),u,"easeOut",!0),M(new S(null,null,2,c),u,"easeIn"+(0===c?",easeNone":"")),M(new S(null,null,3,c),u,"easeInOut");k.linear=g.easing.Linear.easeIn,k.swing=g.easing.Quad.easeInOut;var E=T("events.EventDispatcher",(function(t){this._listeners={},this._eventTarget=t||this}));(u=E.prototype).addEventListener=function(t,e,n,i,r){r=r||0;var o,a,s=this._listeners[t],l=0;for(this!==h||d||h.wake(),null==s&&(this._listeners[t]=s=[]),a=s.length;--a>-1;)(o=s[a]).c===e&&o.s===n?s.splice(a,1):0===l&&o.pr-1;)if(i[n].c===e)return void i.splice(n,1)},u.dispatchEvent=function(t){var e,n,i,r=this._listeners[t];if(r)for((e=r.length)>1&&(r=r.slice(0)),n=this._eventTarget;--e>-1;)(i=r[e])&&(i.up?i.c.call(i.s||n,{type:t,target:n}):i.c.call(i.s||n))};var A=t.requestAnimationFrame,P=t.cancelAnimationFrame,I=Date.now||function(){return(new Date).getTime()},O=I();for(c=(l=["ms","moz","webkit","o"]).length;--c>-1&&!A;)A=t[l[c]+"RequestAnimationFrame"],P=t[l[c]+"CancelAnimationFrame"]||t[l[c]+"CancelRequestAnimationFrame"];T("Ticker",(function(t,e){var n,i,r,a,s,l=this,c=I(),u=!(!1===e||!A)&&"auto",f=500,p=33,m=function t(e){var o,u,h=I()-O;h>f&&(c+=h-p),O+=h,l.time=(O-c)/1e3,o=l.time-s,(!n||o>0||!0===e)&&(l.frame++,s+=o+(o>=a?.004:a-o),u=!0),!0!==e&&(r=i(t)),u&&l.dispatchEvent("tick")};E.call(l),l.time=l.frame=0,l.tick=function(){m(!0)},l.lagSmoothing=function(t,e){if(!arguments.length)return f<1/1e-8;f=t||1/1e-8,p=Math.min(e,f,0)},l.sleep=function(){null!=r&&(u&&P?P(r):clearTimeout(r),i=v,r=null,l===h&&(d=!1))},l.wake=function(t){null!==r?l.sleep():t?c+=-O+(O=I()):l.frame>10&&(O=I()-f+5),i=0===n?v:u&&A?A:function(t){return setTimeout(t,1e3*(s-l.time)+1|0)},l===h&&(d=!0),m(2)},l.fps=function(t){if(!arguments.length)return n;a=1/((n=t)||60),s=this.time+a,l.wake()},l.useRAF=function(t){if(!arguments.length)return u;l.sleep(),u=t,l.fps(n)},l.fps(t),setTimeout((function(){"auto"===u&&l.frame<5&&"hidden"!==(o||{}).visibilityState&&l.useRAF(!1)}),1500)})),(u=g.Ticker.prototype=new g.events.EventDispatcher).constructor=g.Ticker;var D=T("core.Animation",(function(t,e){if(this.vars=e=e||{},this._duration=this._totalDuration=t||0,this._delay=Number(e.delay)||0,this._timeScale=1,this._active=!!e.immediateRender,this.data=e.data,this._reversed=!!e.reversed,J){d||h.wake();var n=this.vars.useFrames?K:J;n.add(this,n._time),this.vars.paused&&this.paused(!0)}}));h=D.ticker=new g.Ticker,(u=D.prototype)._dirty=u._gc=u._initted=u._paused=!1,u._totalTime=u._time=0,u._rawPrevTime=-1,u._next=u._last=u._onUpdate=u._timeline=u.timeline=null,u._paused=!1;!function t(){d&&I()-O>2e3&&("hidden"!==(o||{}).visibilityState||!h.lagSmoothing())&&h.wake();var e=setTimeout(t,2e3);e.unref&&e.unref()}(),u.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},u.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},u.resume=function(t,e){return null!=t&&this.seek(t,e),this.paused(!1)},u.seek=function(t,e){return this.totalTime(Number(t),!1!==e)},u.restart=function(t,e){return this.reversed(!1).paused(!1).totalTime(t?-this._delay:0,!1!==e,!0)},u.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},u.render=function(t,e,n){},u.invalidate=function(){return this._time=this._totalTime=0,this._initted=this._gc=!1,this._rawPrevTime=-1,!this._gc&&this.timeline||this._enabled(!0),this},u.isActive=function(){var t,e=this._timeline,n=this._startTime;return!e||!this._gc&&!this._paused&&e.isActive()&&(t=e.rawTime(!0))>=n&&t-1;)"{self}"===t[e]&&(n[e]=this);return n},u._callback=function(t){var e=this.vars,n=e[t],i=e[t+"Params"],r=e[t+"Scope"]||e.callbackScope||this;switch(i?i.length:0){case 0:n.call(r);break;case 1:n.call(r,i[0]);break;case 2:n.call(r,i[0],i[1]);break;default:n.apply(r,i)}},u.eventCallback=function(t,e,n,i){if("on"===(t||"").substr(0,2)){var r=this.vars;if(1===arguments.length)return r[t];null==e?delete r[t]:(r[t]=e,r[t+"Params"]=y(n)&&-1!==n.join("").indexOf("{self}")?this._swapSelfInParams(n):n,r[t+"Scope"]=i),"onUpdate"===t&&(this._onUpdate=e)}return this},u.delay=function(t){return arguments.length?(this._timeline.smoothChildTiming&&this.startTime(this._startTime+t-this._delay),this._delay=t,this):this._delay},u.duration=function(t){return arguments.length?(this._duration=this._totalDuration=t,this._uncache(!0),this._timeline.smoothChildTiming&&this._time>0&&this._timethis._duration?this._duration:t,e)):this._time},u.totalTime=function(t,e,n){if(d||h.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(t<0&&!n&&(t+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var i=this._totalDuration,r=this._timeline;if(t>i&&!n&&(t=i),this._startTime=(this._paused?this._pauseTime:r._time)-(this._reversed?i-t:t)/this._timeScale,r._dirty||this._uncache(!1),r._timeline)for(;r._timeline;)r._timeline._time!==(r._startTime+r._totalTime)/r._timeScale&&r.totalTime(r._totalTime,!0),r=r._timeline}this._gc&&this._enabled(!0,!1),this._totalTime===t&&0!==this._duration||(F.length&&tt(),this.render(t,e,!1),F.length&&tt())}return this},u.progress=u.totalProgress=function(t,e){var n=this.duration();return arguments.length?this.totalTime(n*t,e):n?this._time/n:this.ratio},u.startTime=function(t){return arguments.length?(t!==this._startTime&&(this._startTime=t,this.timeline&&this.timeline._sortChildren&&this.timeline.add(this,t-this._delay)),this):this._startTime},u.endTime=function(t){return this._startTime+(0!=t?this.totalDuration():this.duration())/this._timeScale},u.timeScale=function(t){if(!arguments.length)return this._timeScale;var e,n;for(t=t||1e-8,this._timeline&&this._timeline.smoothChildTiming&&(n=(e=this._pauseTime)||0===e?e:this._timeline.totalTime(),this._startTime=n-(n-this._startTime)*this._timeScale/t),this._timeScale=t,n=this.timeline;n&&n.timeline;)n._dirty=!0,n.totalDuration(),n=n.timeline;return this},u.reversed=function(t){return arguments.length?(t!=this._reversed&&(this._reversed=t,this.totalTime(this._timeline&&!this._timeline.smoothChildTiming?this.totalDuration()-this._totalTime:this._totalTime,!0)),this):this._reversed},u.paused=function(t){if(!arguments.length)return this._paused;var e,n,i=this._timeline;return t!=this._paused&&i&&(d||t||h.wake(),n=(e=i.rawTime())-this._pauseTime,!t&&i.smoothChildTiming&&(this._startTime+=n,this._uncache(!1)),this._pauseTime=t?e:null,this._paused=t,this._active=this.isActive(),!t&&0!==n&&this._initted&&this.duration()&&(e=i.smoothChildTiming?this._totalTime:(e-this._startTime)/this._timeScale,this.render(e,e===this._totalTime,!0))),this._gc&&!t&&this._enabled(!0,!1),this};var z=T("core.SimpleTimeline",(function(t){D.call(this,0,t),this.autoRemoveChildren=this.smoothChildTiming=!0}));(u=z.prototype=new D).constructor=z,u.kill()._gc=!1,u._first=u._last=u._recent=null,u._sortChildren=!1,u.add=u.insert=function(t,e,n,i){var r,o;if(t._startTime=Number(e||0)+t._delay,t._paused&&this!==t._timeline&&(t._pauseTime=this.rawTime()-(t._timeline.rawTime()-t._pauseTime)),t.timeline&&t.timeline._remove(t,!0),t.timeline=t._timeline=this,t._gc&&t._enabled(!0,!0),r=this._last,this._sortChildren)for(o=t._startTime;r&&r._startTime>o;)r=r._prev;return r?(t._next=r._next,r._next=t):(t._next=this._first,this._first=t),t._next?t._next._prev=t:this._last=t,t._prev=r,this._recent=t,this._timeline&&this._uncache(!0),this},u._remove=function(t,e){return t.timeline===this&&(e||t._enabled(!1,!0),t._prev?t._prev._next=t._next:this._first===t&&(this._first=t._next),t._next?t._next._prev=t._prev:this._last===t&&(this._last=t._prev),t._next=t._prev=t.timeline=null,t===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},u.render=function(t,e,n){var i,r=this._first;for(this._totalTime=this._time=this._rawPrevTime=t;r;)i=r._next,(r._active||t>=r._startTime&&!r._paused&&!r._gc)&&(r._reversed?r.render((r._dirty?r.totalDuration():r._totalDuration)-(t-r._startTime)*r._timeScale,e,n):r.render((t-r._startTime)*r._timeScale,e,n)),r=i},u.rawTime=function(){return d||h.wake(),this._totalTime};var R=T("TweenLite",(function(e,n,i){if(D.call(this,n,i),this.render=R.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:R.selector(e)||e;var r,o,a,s=e.jquery||e.length&&e!==t&&e[0]&&(e[0]===t||e[0].nodeType&&e[0].style&&!e.nodeType),l=this.vars.overwrite;if(this._overwrite=l=null==l?Y[R.defaultOverwrite]:"number"==typeof l?l>>0:Y[l],(s||e instanceof Array||e.push&&y(e))&&"number"!=typeof e[0])for(this._targets=a=_(e),this._propLookup=[],this._siblings=[],r=0;r1&&it(o,this,null,1,this._siblings[r])):"string"==typeof(o=a[r--]=R.selector(o))&&a.splice(r+1,1):a.splice(r--,1);else this._propLookup={},this._siblings=et(e,this,!1),1===l&&this._siblings.length>1&&it(e,this,null,1,this._siblings);(this.vars.immediateRender||0===n&&0===this._delay&&!1!==this.vars.immediateRender)&&(this._time=-1e-8,this.render(Math.min(0,-this._delay)))}),!0),L=function(e){return e&&e.length&&e!==t&&e[0]&&(e[0]===t||e[0].nodeType&&e[0].style&&!e.nodeType)};(u=R.prototype=new D).constructor=R,u.kill()._gc=!1,u.ratio=0,u._firstPT=u._targets=u._overwrittenProps=u._startAt=null,u._notifyPluginsOfEnabled=u._lazy=!1,R.version="2.1.3",R.defaultEase=u._ease=new S(null,null,1,1),R.defaultOverwrite="auto",R.ticker=h,R.autoSleep=120,R.lagSmoothing=function(t,e){h.lagSmoothing(t,e)},R.selector=t.$||t.jQuery||function(e){var n=t.$||t.jQuery;return n?(R.selector=n,n(e)):(o||(o=t.document),o?o.querySelectorAll?o.querySelectorAll(e):o.getElementById("#"===e.charAt(0)?e.substr(1):e):e)};var F=[],B={},N=/(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,$=/[\+-]=-?[\.\d]/,j=function(t){for(var e,n=this._firstPT;n;)e=n.blob?1===t&&null!=this.end?this.end:t?this.join(""):this.start:n.c*t+n.s,n.m?e=n.m.call(this._tween,e,this._target||n.t,this._tween):e<1e-6&&e>-1e-6&&!n.blob&&(e=0),n.f?n.fp?n.t[n.p](n.fp,e):n.t[n.p](e):n.t[n.p]=e,n=n._next},U=function(t){return(1e3*t|0)/1e3+""},V=function(t,e,n,i){var r,o,a,s,l,c,u,h=[],d=0,f="",p=0;for(h.start=t,h.end=e,t=h[0]=t+"",e=h[1]=e+"",n&&(n(h),t=h[0],e=h[1]),h.length=0,r=t.match(N)||[],o=e.match(N)||[],i&&(i._next=null,i.blob=1,h._firstPT=h._applyPT=i),l=o.length,s=0;s=Q){for(n in Q=h.frame+(parseInt(R.autoSleep,10)||120),H){for(t=(e=H[n].tweens).length;--t>-1;)e[t]._gc&&e.splice(t,1);0===e.length&&delete H[n]}if((!(n=J._first)||n._paused)&&R.autoSleep&&!K._first&&1===h._listeners.tick.length){for(;n&&n._paused;)n=n._next;n||h.sleep()}}},h.addEventListener("tick",D._updateRoot);var et=function(t,e,n){var i,r,o=t._gsTweenID;if(H[o||(t._gsTweenID=o="t"+X++)]||(H[o]={target:t,tweens:[]}),e&&((i=H[o].tweens)[r=i.length]=e,n))for(;--r>-1;)i[r]===e&&i.splice(r,1);return H[o].tweens},nt=function(t,e,n,i){var r,o,a=t.vars.onOverwrite;return a&&(r=a(t,e,n,i)),(a=R.onOverwrite)&&(o=a(t,e,n,i)),!1!==r&&!1!==o},it=function(t,e,n,i,r){var o,a,s,l;if(1===i||i>=4){for(l=r.length,o=0;o-1;)(s=r[o])===e||s._gc||s._paused||(s._timeline!==e._timeline?(c=c||rt(e,0,f),0===rt(s,c,f)&&(h[d++]=s)):s._startTime<=u&&s._startTime+s.totalDuration()/s._timeScale>u&&((f||!s._initted)&&u-s._startTime<=2e-8||(h[d++]=s)));for(o=d;--o>-1;)if(l=(s=h[o])._firstPT,2===i&&s._kill(n,t,e)&&(a=!0),2!==i||!s._firstPT&&s._initted&&l){if(2!==i&&!nt(s,e))continue;s._enabled(!1,!1)&&(a=!0)}return a},rt=function(t,e,n){for(var i=t._timeline,r=i._timeScale,o=t._startTime;i._timeline;){if(o+=i._startTime,r*=i._timeScale,i._paused)return-100;i=i._timeline}return(o/=r)>e?o-e:n&&o===e||!t._initted&&o-e<2e-8?1e-8:(o+=t.totalDuration()/t._timeScale/r)>e+1e-8?0:o-e-1e-8};u._init=function(){var t,e,n,i,r,o,a=this.vars,s=this._overwrittenProps,l=this._duration,c=!!a.immediateRender,u=a.ease,h=this._startAt;if(a.startAt){for(i in h&&(h.render(-1,!0),h.kill()),r={},a.startAt)r[i]=a.startAt[i];if(r.data="isStart",r.overwrite=!1,r.immediateRender=!0,r.lazy=c&&!1!==a.lazy,r.startAt=r.delay=null,r.onUpdate=a.onUpdate,r.onUpdateParams=a.onUpdateParams,r.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=R.to(this.target||{},0,r),c)if(this._time>0)this._startAt=null;else if(0!==l)return}else if(a.runBackwards&&0!==l)if(h)h.render(-1,!0),h.kill(),this._startAt=null;else{for(i in 0!==this._time&&(c=!1),n={},a)W[i]&&"autoCSS"!==i||(n[i]=a[i]);if(n.overwrite=0,n.data="isFromStart",n.lazy=c&&!1!==a.lazy,n.immediateRender=c,this._startAt=R.to(this.target,0,n),c){if(0===this._time)return}else this._startAt._init(),this._startAt._enabled(!1),this.vars.immediateRender&&(this._startAt=null)}if(this._ease=u=u?u instanceof S?u:"function"==typeof u?new S(u,a.easeParams):k[u]||R.defaultEase:R.defaultEase,a.easeParams instanceof Array&&u.config&&(this._ease=u.config.apply(u,a.easeParams)),this._easeType=this._ease._type,this._easePower=this._ease._power,this._firstPT=null,this._targets)for(o=this._targets.length,t=0;t-1;)n[c._overwriteProps[s]]=this._firstPT;(c._priority||c._onInitAllProps)&&(l=!0),(c._onDisable||c._onEnable)&&(this._notifyPluginsOfEnabled=!0),u._next&&(u._next._prev=u)}else n[a]=q.call(this,e,a,"get",h,a,0,null,this.vars.stringFilter,o);return r&&this._kill(r,e)?this._initProps(e,n,i,r,o):this._overwrite>1&&this._firstPT&&i.length>1&&it(e,this,n,this._overwrite,i)?(this._kill(n,e),this._initProps(e,n,i,r,o)):(this._firstPT&&(!1!==this.vars.lazy&&this._duration||this.vars.lazy&&!this._duration)&&(B[e._gsTweenID]=!0),l)},u.render=function(t,e,n){var i,r,o,a,s=this._time,l=this._duration,c=this._rawPrevTime;if(t>=l-1e-8&&t>=0)this._totalTime=this._time=l,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1,this._reversed||(i=!0,r="onComplete",n=n||this._timeline.autoRemoveChildren),0===l&&(this._initted||!this.vars.lazy||n)&&(this._startTime===this._timeline._duration&&(t=0),(c<0||t<=0&&t>=-1e-8||1e-8===c&&"isPause"!==this.data)&&c!==t&&(n=!0,c>1e-8&&(r="onReverseComplete")),this._rawPrevTime=a=!e||t||c===t?t:1e-8);else if(t<1e-8)this._totalTime=this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==s||0===l&&c>0)&&(r="onReverseComplete",i=this._reversed),t>-1e-8?t=0:t<0&&(this._active=!1,0===l&&(this._initted||!this.vars.lazy||n)&&(c>=0&&(1e-8!==c||"isPause"!==this.data)&&(n=!0),this._rawPrevTime=a=!e||t||c===t?t:1e-8)),(!this._initted||this._startAt&&this._startAt.progress())&&(n=!0);else if(this._totalTime=this._time=t,this._easeType){var u=t/l,h=this._easeType,d=this._easePower;(1===h||3===h&&u>=.5)&&(u=1-u),3===h&&(u*=2),1===d?u*=u:2===d?u*=u*u:3===d?u*=u*u*u:4===d&&(u*=u*u*u*u),this.ratio=1===h?1-u:2===h?u:t/l<.5?u/2:1-u/2}else this.ratio=this._ease.getRatio(t/l);if(this._time!==s||n){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!n&&this._firstPT&&(!1!==this.vars.lazy&&this._duration||this.vars.lazy&&!this._duration))return this._time=this._totalTime=s,this._rawPrevTime=c,F.push(this),void(this._lazy=[t,e]);this._time&&!i?this.ratio=this._ease.getRatio(this._time/l):i&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(!1!==this._lazy&&(this._lazy=!1),this._active||!this._paused&&this._time!==s&&t>=0&&(this._active=!0),0===s&&(this._startAt&&(t>=0?this._startAt.render(t,!0,n):r||(r="_dummyGS")),this.vars.onStart&&(0===this._time&&0!==l||e||this._callback("onStart"))),o=this._firstPT;o;)o.f?o.t[o.p](o.c*this.ratio+o.s):o.t[o.p]=o.c*this.ratio+o.s,o=o._next;this._onUpdate&&(t<0&&this._startAt&&-1e-4!==t&&this._startAt.render(t,!0,n),e||(this._time!==s||i||n)&&this._callback("onUpdate")),r&&(this._gc&&!n||(t<0&&this._startAt&&!this._onUpdate&&-1e-4!==t&&this._startAt.render(t,!0,n),i&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[r]&&this._callback(r),0===l&&1e-8===this._rawPrevTime&&1e-8!==a&&(this._rawPrevTime=0)))}},u._kill=function(t,e,i){if("all"===t&&(t=null),null==t&&(null==e||e===this.target))return this._lazy=!1,this._enabled(!1,!1);e="string"!=typeof e?e||this._targets||this.target:R.selector(e)||e;var r,o,a,s,l,c,u,h,d,f=i&&this._time&&i._startTime===this._startTime&&this._timeline===i._timeline,p=this._firstPT;if((y(e)||L(e))&&"number"!=typeof e[0])for(r=e.length;--r>-1;)this._kill(t,e[r],i)&&(c=!0);else{if(this._targets){for(r=this._targets.length;--r>-1;)if(e===this._targets[r]){l=this._propLookup[r]||{},this._overwrittenProps=this._overwrittenProps||[],o=this._overwrittenProps[r]=t?this._overwrittenProps[r]||{}:"all";break}}else{if(e!==this.target)return!1;l=this._propLookup,o=this._overwrittenProps=t?this._overwrittenProps||{}:"all"}if(l){if(u=t||l,h=t!==o&&"all"!==o&&t!==l&&("object"!==n(t)||!t._tempKill),i&&(R.onOverwrite||this.vars.onOverwrite)){for(a in u)l[a]&&(d||(d=[]),d.push(a));if((d||!t)&&!nt(this,i,e,d))return!1}for(a in u)(s=l[a])&&(f&&(s.f?s.t[s.p](s.s):s.t[s.p]=s.s,c=!0),s.pg&&s.t._kill(u)&&(c=!0),s.pg&&0!==s.t._overwriteProps.length||(s._prev?s._prev._next=s._next:s===this._firstPT&&(this._firstPT=s._next),s._next&&(s._next._prev=s._prev),s._next=s._prev=null),delete l[a]),h&&(o[a]=1);!this._firstPT&&this._initted&&p&&this._enabled(!1,!1)}}return c},u.invalidate=function(){this._notifyPluginsOfEnabled&&R._onPluginEvent("_onDisable",this);var t=this._time;return this._firstPT=this._overwrittenProps=this._startAt=this._onUpdate=null,this._notifyPluginsOfEnabled=this._active=this._lazy=!1,this._propLookup=this._targets?{}:[],D.prototype.invalidate.call(this),this.vars.immediateRender&&(this._time=-1e-8,this.render(t,!1,!1!==this.vars.lazy)),this},u._enabled=function(t,e){if(d||h.wake(),t&&this._gc){var n,i=this._targets;if(i)for(n=i.length;--n>-1;)this._siblings[n]=et(i[n],this,!0);else this._siblings=et(this.target,this,!0)}return D.prototype._enabled.call(this,t,e),!(!this._notifyPluginsOfEnabled||!this._firstPT)&&R._onPluginEvent(t?"_onEnable":"_onDisable",this)},R.to=function(t,e,n){return new R(t,e,n)},R.from=function(t,e,n){return n.runBackwards=!0,n.immediateRender=0!=n.immediateRender,new R(t,e,n)},R.fromTo=function(t,e,n,i){return i.startAt=n,i.immediateRender=0!=i.immediateRender&&0!=n.immediateRender,new R(t,e,i)},R.delayedCall=function(t,e,n,i,r){return new R(e,0,{delay:t,onComplete:e,onCompleteParams:n,callbackScope:i,onReverseComplete:e,onReverseCompleteParams:n,immediateRender:!1,lazy:!1,useFrames:r,overwrite:0})},R.set=function(t,e){return new R(t,0,e)},R.getTweensOf=function(t,e){if(null==t)return[];var n,i,r,o;if(t="string"!=typeof t?t:R.selector(t)||t,(y(t)||L(t))&&"number"!=typeof t[0]){for(n=t.length,i=[];--n>-1;)i=i.concat(R.getTweensOf(t[n],e));for(n=i.length;--n>-1;)for(o=i[n],r=n;--r>-1;)o===i[r]&&i.splice(n,1)}else if(t._gsTweenID)for(n=(i=et(t).concat()).length;--n>-1;)(i[n]._gc||e&&!i[n].isActive())&&i.splice(n,1);return i||[]},R.killTweensOf=R.killDelayedCallsTo=function(t,e,i){"object"===n(e)&&(i=e,e=!1);for(var r=R.getTweensOf(t,e),o=r.length;--o>-1;)r[o]._kill(i,t)};var ot=T("plugins.TweenPlugin",(function(t,e){this._overwriteProps=(t||"").split(","),this._propName=this._overwriteProps[0],this._priority=e||0,this._super=ot.prototype}),!0);if(u=ot.prototype,ot.version="1.19.0",ot.API=2,u._firstPT=null,u._addTween=q,u.setRatio=j,u._kill=function(t){var e,n=this._overwriteProps,i=this._firstPT;if(null!=t[this._propName])this._overwriteProps=[];else for(e=n.length;--e>-1;)null!=t[n[e]]&&n.splice(e,1);for(;i;)null!=t[i.n]&&(i._next&&(i._next._prev=i._prev),i._prev?(i._prev._next=i._next,i._prev=null):this._firstPT===i&&(this._firstPT=i._next)),i=i._next;return!1},u._mod=u._roundProps=function(t){for(var e,n=this._firstPT;n;)(e=t[this._propName]||null!=n.n&&t[n.n.split(this._propName+"_").join("")])&&"function"==typeof e&&(2===n.f?n.t._applyPT.m=e:n.m=e),n=n._next},R._onPluginEvent=function(t,e){var n,i,r,o,a,s=e._firstPT;if("_onInitAllProps"===t){for(;s;){for(a=s._next,i=r;i&&i.pr>s.pr;)i=i._next;(s._prev=i?i._prev:o)?s._prev._next=s:r=s,(s._next=i)?i._prev=s:o=s,s=a}s=e._firstPT=r}for(;s;)s.pg&&"function"==typeof s.t[t]&&s.t[t]()&&(n=!0),s=s._next;return n},ot.activate=function(t){for(var e=t.length;--e>-1;)t[e].API===ot.API&&(G[(new t[e])._propName]=t[e]);return!0},w.plugin=function(t){if(!(t&&t.propName&&t.init&&t.API))throw"illegal plugin definition.";var e,n=t.propName,i=t.priority||0,r=t.overwriteProps,o={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=T("plugins."+n.charAt(0).toUpperCase()+n.substr(1)+"Plugin",(function(){ot.call(this,n,i),this._overwriteProps=r||[]}),!0===t.global),s=a.prototype=new ot(n);for(e in s.constructor=a,a.API=t.API,o)"function"==typeof t[e]&&(s[o[e]]=t[e]);return a.version=t.version,ot.activate([a]),a},l=t._gsQueue){for(c=0;c(i=1))return i;for(;no?n=r:i=r,r=.5*(i-n)+n}return r},i.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var r=o;function o(t,e){this.x=t,this.y=e}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_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},_rotateAround:function(t,e){var n=Math.cos(t),i=Math.sin(t),r=e.y+i*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-i*(this.y-e.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var a="undefined"!=typeof self?self:{};function s(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n=1)return 1;const e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function f(t,e,i,r){const o=new n(t,e,i,r);return function(t){return o.solve(t)}}const p=f(.25,.1,.25,1);function m(t,e,n){return Math.min(n,Math.max(e,t))}function g(t,e,n){const i=n-e,r=((t-e)%i+i)%i+e;return r===e?n:r}function _(t,e,n){if(!t.length)return n(null,[]);let i=t.length;const r=new Array(t.length);let o=null;t.forEach((t,a)=>{e(t,(t,e)=>{t&&(o=t),r[a]=e,0==--i&&n(o,r)})})}function v(t){const e=[];for(const n in t)e.push(t[n]);return e}function y(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}let x=1;function b(){return x++}function w(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function T(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function C(t,e){t.forEach(t=>{e[t]&&(e[t]=e[t].bind(e))})}function S(t,e){return-1!==t.indexOf(e,t.length-e.length)}function k(t,e,n){const i={};for(const r in t)i[r]=e.call(n||this,t[r],r,t);return i}function M(t,e,n){const i={};for(const r in t)e.call(n||this,t[r],r,t)&&(i[r]=t[r]);return i}function E(t){return Array.isArray(t)?t.map(E):"object"==typeof t&&t?k(t,E):t}const A={};function P(t){A[t]||(A[t]=!0)}function I(t,e,n){return(n.y-t.y)*(e.x-t.x)>(e.y-t.y)*(n.x-t.x)}function O(t){let e=0;for(let n,i,r=0,o=t.length,a=o-1;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,n,i,r)=>{const o=i||r;return e[n]=!o||o.toLowerCase(),""}),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let R,L,F=null;function B(t){if(null==F){const e=t.navigator?t.navigator.userAgent:null;F=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return F}function N(t){try{const e=a[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}let $,j=!1;const U={now:()=>void 0!==$?$:a.performance.now(),setErrorState(){j=!0},setNow(t){$=t},restoreNow(){$=void 0},frame(t){if(j)return{cancel:()=>{}};const e=a.requestAnimationFrame(t);return{cancel:()=>a.cancelAnimationFrame(e)}},getImageData(t,e=0){const n=a.document.createElement("canvas"),i=n.getContext("2d");if(!i)throw new Error("failed to create canvas 2d context");return n.width=t.width,n.height=t.height,i.drawImage(t,0,0,t.width,t.height),i.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:t=>(R||(R=a.document.createElement("a")),R.href=t,R.href),get devicePixelRatio(){return a.devicePixelRatio},get prefersReducedMotion(){return!!a.matchMedia&&(null==L&&(L=a.matchMedia("(prefers-reduced-motion: reduce)")),L.matches)}};let V;const q={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==V){const e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{V=null!=t.env.API_URL_REGEX?new RegExp(t.env.API_URL_REGEX):e}catch(t){V=e}}return V},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},Z={supported:!1,testSupport:function(t){!X&&H&&(W?Y(t):G=t)}};let G,H,X=!1,W=!1;function Y(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,H),t.isContextLost())return;Z.supported=!0}catch(t){}t.deleteTexture(e),X=!0}a.document&&(H=a.document.createElement("img"),H.onload=function(){G&&Y(G),G=null,W=!0},H.onerror=function(){X=!0,G=null},H.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const K="01";function J(t){return 0===t.indexOf("mapbox:")}function Q(t){return q.API_URL_REGEX.test(t)}const tt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function et(t){const e=t.match(tt);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function nt(t){const e=t.params.length?"?"+t.params.join("&"):"";return`${t.protocol}://${t.authority}${t.path}${e}`}function it(t){if(!t)return null;const e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(a.atob(e[1]).split("").map(t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(t){return null}}class rt{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const e=it(q.ACCESS_TOKEN);let n="";return n=e&&e.u?a.btoa(encodeURIComponent(e.u).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(Number("0x"+e)))):q.ACCESS_TOKEN||"",t?`mapbox.eventData.${t}:${n}`:"mapbox.eventData:"+n}fetchEventData(){const t=N("localStorage"),e=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{const t=a.localStorage.getItem(e);t&&(this.eventData=JSON.parse(t));const i=a.localStorage.getItem(n);i&&(this.anonId=i)}catch(t){P("Unable to read from LocalStorage")}}saveEventData(){const t=N("localStorage"),e=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{a.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&a.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){P("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,e,n,i){if(!q.EVENTS_URL)return;const r=et(q.EVENTS_URL);r.params.push("access_token="+(i||q.ACCESS_TOKEN||""));const o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"2.1.1",skuId:K,userId:this.anonId},a=e?y(o,e):o,s={url:nt(r),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=St(s,t=>{this.pendingRequest=null,n(t),this.saveEventData(),this.processRequests(i)})}queueRequest(t,e){this.queue.push(t),this.processRequests(e)}}const ot=new class extends rt{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){q.EVENTS_URL&&q.ACCESS_TOKEN&&Array.isArray(t)&&t.some(t=>J(t)||Q(t))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=it(q.ACCESS_TOKEN),n=e?e.u:q.ACCESS_TOKEN;let i=n!==this.eventData.tokenU;T(this.anonId)||(this.anonId=w(),i=!0);const r=this.queue.shift();if(this.eventData.lastSuccess){const t=new Date(this.eventData.lastSuccess),e=new Date(r),n=(r-this.eventData.lastSuccess)/864e5;i=i||n>=1||n<-1||t.getDate()!==e.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(r,{"enabled.telemetry":!1},t=>{t||(this.eventData.lastSuccess=r,this.eventData.tokenU=n)},t)}},at=ot.postTurnstileEvent.bind(ot),st=new class extends rt{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,n,i){this.skuToken=e,this.errorCb=i,q.EVENTS_URL&&(n||q.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},n):this.errorCb(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:n}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),T(this.anonId)||(this.anonId=w()),this.postEvent(n,{skuToken:this.skuToken},t=>{t?this.errorCb(t):e&&(this.success[e]=!0)},t))}},lt=st.postMapLoadEvent.bind(st),ct=new class extends rt{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,n,i){if(!q.API_URL||!q.SESSION_PATH)return;const r=et(q.API_URL+q.SESSION_PATH);r.params.push("sku="+(e||"")),r.params.push("access_token="+(i||q.ACCESS_TOKEN||""));const o={url:nt(r),headers:{"Content-Type":"text/plain"}};this.pendingRequest=kt(o,t=>{this.pendingRequest=null,n(t),this.saveEventData(),this.processRequests(i)})}getSessionAPI(t,e,n,i){this.skuToken=e,this.errorCb=i,q.SESSION_PATH&&q.API_URL&&(n||q.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},n):this.errorCb(new Error("NO_ACCESS_TOKEN")))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:n}=this.queue.shift();e&&this.success[e]||this.getSession(n,this.skuToken,t=>{t?this.errorCb(t):e&&(this.success[e]=!0)},t)}},ut=ct.getSessionAPI.bind(ct);let ht,dt,ft=500,pt=50;function mt(){a.caches&&!ht&&(ht=a.caches.open("mapbox-tiles"))}function gt(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}let _t,vt=1/0;function yt(){return null==_t&&(_t=a.OffscreenCanvas&&new a.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.createImageBitmap),_t}const xt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(xt);class bt extends Error{constructor(t,e,n){401===e&&Q(n)&&(t+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(t),this.status=e,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const wt=D()?()=>self.worker&&self.worker.referrer:()=>("blob:"===a.location.protocol?a.parent:a).location.href,Tt=function(t,e){if(!(/^file:/.test(n=t.url)||/^file:/.test(wt())&&!/^\w+:/.test(n))){if(a.fetch&&a.Request&&a.AbortController&&a.Request.prototype.hasOwnProperty("signal"))return function(t,e){const n=new a.AbortController,i=new a.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:wt(),signal:n.signal});let r=!1,o=!1;const s=(l=i.url).indexOf("sku=")>0&&Q(l);var l;"json"===t.type&&i.headers.set("Accept","application/json");const c=(n,r,l)=>{if(o)return;if(n&&"SecurityError"!==n.message&&P(n),r&&l)return u(r);const c=Date.now();a.fetch(i).then(n=>{if(n.ok){const t=s?n.clone():null;return u(n,t,c)}return e(new bt(n.statusText,n.status,t.url))}).catch(t=>{20!==t.code&&e(new Error(t.message))})},u=(n,s,l)=>{("arrayBuffer"===t.type?n.arrayBuffer():"json"===t.type?n.json():n.text()).then(t=>{o||(s&&l&&function(t,e,n){if(mt(),!ht)return;const i={status:e.status,statusText:e.statusText,headers:new a.Headers};e.headers.forEach((t,e)=>i.headers.set(e,t));const r=z(e.headers.get("Cache-Control")||"");r["no-store"]||(r["max-age"]&&i.headers.set("Expires",new Date(n+1e3*r["max-age"]).toUTCString()),new Date(i.headers.get("Expires")).getTime()-n<42e4||function(t,e){if(void 0===dt)try{new Response(new ReadableStream),dt=!0}catch(t){dt=!1}dt?e(t.body):t.blob().then(e)}(e,e=>{const n=new a.Response(e,i);mt(),ht&&ht.then(e=>e.put(gt(t.url),n)).catch(t=>P(t.message))}))}(i,s,l),r=!0,e(null,t,n.headers.get("Cache-Control"),n.headers.get("Expires")))}).catch(t=>{o||e(new Error(t.message))})};return s?function(t,e){if(mt(),!ht)return e(null);const n=gt(t.url);ht.then(t=>{t.match(n).then(i=>{const r=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),n=z(t.headers.get("Cache-Control")||"");return e>Date.now()&&!n["no-cache"]}(i);t.delete(n),r&&t.put(n,i.clone()),e(null,i,r)}).catch(e)}).catch(e)}(i,c):c(null,null),{cancel:()=>{o=!0,r||n.abort()}}}(t,e);if(D()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var n;return function(t,e){const n=new a.XMLHttpRequest;n.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(n.responseType="arraybuffer");for(const e in t.headers)n.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===t.credentials,n.onerror=()=>{e(new Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let i=n.response;if("json"===t.type)try{i=JSON.parse(n.response)}catch(t){return e(t)}e(null,i,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else e(new bt(n.statusText,n.status,t.url))},n.send(t.body),{cancel:()=>n.abort()}}(t,e)},Ct=function(t,e){return Tt(y(t,{type:"arrayBuffer"}),e)},St=function(t,e){return Tt(y(t,{method:"POST"}),e)},kt=function(t,e){return Tt(y(t,{method:"GET"}),e)};function Mt(t){const e=a.document.createElement("a");return e.href=t,e.protocol===a.document.location.protocol&&e.host===a.document.location.host}const Et="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let At,Pt;At=[],Pt=0;const It=function(t,e){if(Z.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Pt>=q.MAX_PARALLEL_IMAGE_REQUESTS){const n={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return At.push(n),n}Pt++;let n=!1;const i=()=>{if(!n)for(n=!0,Pt--;At.length&&Pt{i(),t?e(t):n&&(yt()?function(t,e){const n=new a.Blob([new Uint8Array(t)],{type:"image/png"});a.createImageBitmap(n).then(t=>{e(null,t)}).catch(t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(n,e):function(t,e,n,i){const r=new a.Image,o=a.URL;r.onload=()=>{e(null,r),o.revokeObjectURL(r.src),r.onload=null,a.requestAnimationFrame(()=>{r.src=Et})},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new a.Blob([new Uint8Array(t)],{type:"image/png"});r.cacheControl=n,r.expires=i,r.src=t.byteLength?o.createObjectURL(s):Et}(n,e,r,o))});return{cancel:()=>{r.cancel(),i()}}};function Ot(t,e,n){n[t]&&-1!==n[t].indexOf(e)||(n[t]=n[t]||[],n[t].push(e))}function Dt(t,e,n){if(n&&n[t]){const i=n[t].indexOf(e);-1!==i&&n[t].splice(i,1)}}class zt{constructor(t,e={}){y(this,e),this.type=t}}class Rt extends zt{constructor(t,e={}){super("error",y({error:t},e))}}class Lt{on(t,e){return this._listeners=this._listeners||{},Ot(t,e,this._listeners),this}off(t,e){return Dt(t,e,this._listeners),Dt(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},Ot(t,e,this._oneTimeListeners),this):new Promise(e=>this.once(t,e))}fire(t,e){"string"==typeof t&&(t=new zt(t,e||{}));const n=t.type;if(this.listens(n)){t.target=this;const e=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of e)n.call(this,t);const i=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const e of i)Dt(n,e,this._oneTimeListeners),e.call(this,t);const r=this._eventedParent;r&&(y(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(t))}return this}listens(t){return!!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var Ft={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{},sky:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_sky:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"property-type":"data-constant"},"sky-gradient-center":{type:"array",requires:[{"sky-type":"gradient"}],value:"number",default:[0,0],length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class Bt{constructor(t,e,n,i){this.message=(t?t+": ":"")+n,i&&(this.identifier=i),null!=e&&e.__line__&&(this.line=e.__line__)}}function Nt(t){const e=t.value;return e?[new Bt(t.key,e,"constants have been deprecated as of v8")]:[]}function $t(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}function jt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ut(t){if(Array.isArray(t))return t.map(Ut);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const n in t)e[n]=Ut(t[n]);return e}return jt(t)}class Vt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class qt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,n]of e)this.bindings[t]=n}concat(t){return new qt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Zt={kind:"null"},Gt={kind:"number"},Ht={kind:"string"},Xt={kind:"boolean"},Wt={kind:"color"},Yt={kind:"object"},Kt={kind:"value"},Jt={kind:"collator"},Qt={kind:"formatted"},te={kind:"resolvedImage"};function ee(t,e){return{kind:"array",itemType:t,N:e}}function ne(t){if("array"===t.kind){const e=ne(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const ie=[Zt,Gt,Ht,Xt,Wt,Qt,Yt,ee(Kt),te];function re(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!re(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of ie)if(!re(t,e))return null}return`Expected ${ne(t)} but found ${ne(e)} instead.`}function oe(t,e){return e.some(e=>e.kind===t.kind)}function ae(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function se(t,e){return t(e={exports:{}},e.exports),e.exports}var le=se((function(t,e){var n={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function i(t){return(t=Math.round(t))<0?0:t>255?255:t}function r(t){return i("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function a(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in n)return n[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),c=s.indexOf(")");if(-1!==l&&c+1===s.length){var u=s.substr(0,l),h=s.substr(l+1,c-(l+1)).split(","),d=1;switch(u){case"rgba":if(4!==h.length)return null;d=o(h.pop());case"rgb":return 3!==h.length?null:[r(h[0]),r(h[1]),r(h[2]),d];case"hsla":if(4!==h.length)return null;d=o(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,p=o(h[1]),m=o(h[2]),g=m<=.5?m*(p+1):m+p-m*p,_=2*m-g;return[i(255*a(_,g,f+1/3)),i(255*a(_,g,f)),i(255*a(_,g,f-1/3)),d];default:return null}}return null}}catch(t){}})).parseCSSColor;class ce{constructor(t,e,n,i=1){this.r=t,this.g=e,this.b=n,this.a=i}static parse(t){if(!t)return;if(t instanceof ce)return t;if("string"!=typeof t)return;const e=le(t);return e?new ce(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,n,i]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(n)},${i})`}toArray(){const{r:t,g:e,b:n,a:i}=this;return 0===i?[0,0,0,0]:[255*t/i,255*e/i,255*n/i,i]}}ce.black=new ce(0,0,0,1),ce.white=new ce(1,1,1,1),ce.transparent=new ce(0,0,0,0),ce.red=new ce(1,0,0,1),ce.blue=new ce(0,0,1,1);class ue{constructor(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class he{constructor(t,e,n,i,r){this.text=t,this.image=e,this.scale=n,this.fontStack=i,this.textColor=r}}class de{constructor(t){this.sections=t}static fromString(t){return new de([new he(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof de?t:de.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const n={};e.fontStack&&(n["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(n["font-scale"]=e.scale),e.textColor&&(n["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(n)}return t}}class fe{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new fe({name:t,available:!1}):null}serialize(){return["image",this.name]}}function pe(t,e,n,i){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,n,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[t,e,n,i]:[t,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function me(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof ce)return!0;if(t instanceof ue)return!0;if(t instanceof de)return!0;if(t instanceof fe)return!0;if(Array.isArray(t)){for(const e of t)if(!me(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!me(t[e]))return!1;return!0}return!1}function ge(t){if(null===t)return Zt;if("string"==typeof t)return Ht;if("boolean"==typeof t)return Xt;if("number"==typeof t)return Gt;if(t instanceof ce)return Wt;if(t instanceof ue)return Jt;if(t instanceof de)return Qt;if(t instanceof fe)return te;if(Array.isArray(t)){const e=t.length;let n;for(const e of t){const t=ge(e);if(n){if(n===t)continue;n=Kt;break}n=t}return ee(n||Kt,e)}return Yt}function _e(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof ce||t instanceof de||t instanceof fe?t.toString():JSON.stringify(t)}class ve{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!me(t[1]))return e.error("invalid value");const n=t[1];let i=ge(n);const r=e.expectedType;return"array"!==i.kind||0!==i.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(i=r),new ve(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof ce?["rgba"].concat(this.value.toArray()):this.value instanceof de?this.value.serialize():this.value}}class ye{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const xe={string:Ht,number:Gt,boolean:Xt,object:Yt};class be{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let n,i=1;const r=t[0];if("array"===r){let r,o;if(t.length>2){const n=t[1];if("string"!=typeof n||!(n in xe)||"object"===n)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=xe[n],i++}else r=Kt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],i++}n=ee(r,o)}else n=xe[r];const o=[];for(;it.outputDefined())}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const n=t.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){e.push(n.kind);const i=t.N;("number"==typeof i||this.args.length>1)&&e.push(i)}}return e.concat(this.args.map(t=>t.serialize()))}}class we{constructor(t){this.type=Qt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return e.error("First argument must be an image or text section.");const i=[];let r=!1;for(let n=1;n<=t.length-1;++n){const o=t[n];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,Gt),!t))return null;let n=null;if(o["text-font"]&&(n=e.parse(o["text-font"],1,ee(Ht)),!n))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,Wt),!a))return null;const s=i[i.length-1];s.scale=t,s.font=n,s.textColor=a}else{const o=e.parse(t[n],1,Kt);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,i.push({content:o,scale:null,font:null,textColor:null})}}return new we(i)}evaluate(t){return new de(this.sections.map(e=>{const n=e.content.evaluate(t);return ge(n)===te?new he("",n,null,null,null):new he(_e(n),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const n={};e.scale&&(n["font-scale"]=e.scale.serialize()),e.font&&(n["text-font"]=e.font.serialize()),e.textColor&&(n["text-color"]=e.textColor.serialize()),t.push(n)}return t}}class Te{constructor(t){this.type=te,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,Ht);return n?new Te(n):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),n=fe.fromString(e);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(e)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Ce={"to-boolean":Xt,"to-color":Wt,"to-number":Gt,"to-string":Ht};class Se{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[0];if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return e.error("Expected one argument.");const i=Ce[n],r=[];for(let n=1;n4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:pe(e[0],e[1],e[2],e[3]),!n))return new ce(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ye(n||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const n of this.args){if(e=n.evaluate(t),null===e)return 0;const i=Number(e);if(!isNaN(i))return i}throw new ye(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?de.fromString(_e(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?fe.fromString(_e(this.args[0].evaluate(t))):_e(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){if("formatted"===this.type.kind)return new we([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Te(this.args[0]).serialize();const t=["to-"+this.type.kind];return this.eachChild(e=>{t.push(e.serialize())}),t}}const ke=["Unknown","Point","LineString","Polygon"];class Me{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ke[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=ce.parse(t)),e}}class Ee{constructor(t,e,n,i){this.name=t,this.type=e,this._evaluate=n,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(t=>t.serialize()))}static parse(t,e){const n=t[0],i=Ee.definitions[n];if(!i)return e.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let s=null;for(const[i,o]of a){s=new Ye(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(ne).join(", ")})`:`(${ne(e.type)}...)`;var e}).join(" | "),i=[];for(let n=1;n=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Oe(t,e){const n=(180+t[0])/360,i=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,r=Math.pow(2,e.z);return[Math.round(n*r*8192),Math.round(i*r*8192)]}function De(t,e,n){const i=t[0]-e[0],r=t[1]-e[1],o=t[0]-n[0],a=t[1]-n[1];return i*a-o*r==0&&i*o<=0&&r*a<=0}function ze(t,e){let n=!1;for(let a=0,s=e.length;a(i=t)[1]!=(o=s[e+1])[1]>i[1]&&i[0]<(o[0]-r[0])*(i[1]-r[1])/(o[1]-r[1])+r[0]&&(n=!n)}}var i,r,o;return n}function Re(t,e){for(let n=0;n0&&s<0||a<0&&s>0}function Fe(t,e,n){for(const c of n)for(let n=0;nn[2]){const e=.5*i;let r=t[0]-n[0]>e?-i:n[0]-t[0]>e?i:0;0===r&&(r=t[0]-n[2]>e?-i:n[2]-t[0]>e?i:0),t[0]+=r}Pe(e,t)}function Ve(t,e,n,i){const r=8192*Math.pow(2,i.z),o=[8192*i.x,8192*i.y],a=[];for(const i of t)for(const t of i){const i=[t.x+o[0],t.y+o[1]];Ue(i,e,n,r),a.push(i)}return a}function qe(t,e,n,i){const r=8192*Math.pow(2,i.z),o=[8192*i.x,8192*i.y],a=[];for(const n of t){const t=[];for(const i of n){const n=[i.x+o[0],i.y+o[1]];Pe(e,n),t.push(n)}a.push(t)}if(e[2]-e[0]<=r/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const i of t)Ue(i,e,n,r)}var s;return a}class Ze{constructor(t,e){this.type=Xt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(me(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!Ge(t)&&(e=!1)}),e}function He(t){if(t instanceof Ee&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!He(t)&&(e=!1)}),e}function Xe(t,e){if(t instanceof Ee&&e.indexOf(t.name)>=0)return!1;let n=!0;return t.eachChild(t=>{n&&!Xe(t,e)&&(n=!1)}),n}class We{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const n=t[1];return e.scope.has(n)?new We(n,e.scope.get(n)):e.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ye{constructor(t,e=[],n,i=new qt,r=[]){this.registry=t,this.path=e,this.key=e.map(t=>`[${t}]`).join(""),this.scope=i,this.errors=r,this.expectedType=n}parse(t,e,n,i,r={}){return e?this.concat(e,n,i)._parse(t,r):this._parse(t,r)}_parse(t,e){function n(t,e,n){return"assert"===n?new be(e,[t]):"coerce"===n?new Se(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=t[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[i];if(r){let i=r.parse(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,r=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(t,r))return null}else i=n(i,t,e.typeAnnotation||"coerce");else i=n(i,t,e.typeAnnotation||"assert")}if(!(i instanceof ve)&&"resolvedImage"!==i.type.kind&&function t(e){if(e instanceof We)return t(e.boundExpression);if(e instanceof Ee&&"error"===e.name)return!1;if(e instanceof Ae)return!1;if(e instanceof Ze)return!1;const n=e instanceof Se||e instanceof be;let i=!0;return e.eachChild(e=>{i=n?i&&t(e):i&&e instanceof ve}),!!i&&Ge(e)&&Xe(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script"])}(i)){const e=new Me;try{i=new ve(i.type,i.evaluate(e))}catch(t){return this.error(t.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,n){const i="number"==typeof t?this.path.concat(t):this.path,r=n?this.scope.concat(n):this.scope;return new Ye(this.registry,i,e||null,r,this.errors)}error(t,...e){const n=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new Vt(n,t))}checkSubtype(t,e){const n=re(t,e);return n&&this.error(n),n}}function Ke(t,e){const n=t.length-1;let i,r,o=0,a=n,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),i=t[s],r=t[s+1],i<=e){if(s===n||ee))throw new ye("Input is not a number.");a=s-1}return 0}class Je{constructor(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const n=e.parse(t[1],1,Gt);if(!n)return null;const i=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let n=1;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(a,l,r);if(!c)return null;r=r||c.type,i.push([o,c])}return new Je(r,n,i)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);const r=e.length;return i>=e[r-1]?n[r-1].evaluate(t):n[Ke(e,i)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){const t=["step",this.input.serialize()];for(let e=0;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function Qe(t,e,n){return t*(1-n)+e*n}var tn=Object.freeze({__proto__:null,number:Qe,color:function(t,e,n){return new ce(Qe(t.r,e.r,n),Qe(t.g,e.g,n),Qe(t.b,e.b,n),Qe(t.a,e.a,n))},array:function(t,e,n){return t.map((t,i)=>Qe(t,e[i],n))}});const en=6/29*3*(6/29),nn=Math.PI/180,rn=180/Math.PI;function on(t){return t>.008856451679035631?Math.pow(t,1/3):t/en+4/29}function an(t){return t>6/29?t*t*t:en*(t-4/29)}function sn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ln(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function cn(t){const e=ln(t.r),n=ln(t.g),i=ln(t.b),r=on((.4124564*e+.3575761*n+.1804375*i)/.95047),o=on((.2126729*e+.7151522*n+.072175*i)/1);return{l:116*o-16,a:500*(r-o),b:200*(o-on((.0193339*e+.119192*n+.9503041*i)/1.08883)),alpha:t.a}}function un(t){let e=(t.l+16)/116,n=isNaN(t.a)?e:e+t.a/500,i=isNaN(t.b)?e:e-t.b/200;return e=1*an(e),n=.95047*an(n),i=1.08883*an(i),new ce(sn(3.2404542*n-1.5371385*e-.4985314*i),sn(-.969266*n+1.8760108*e+.041556*i),sn(.0556434*n-.2040259*e+1.0572252*i),t.alpha)}function hn(t,e,n){const i=e-t;return t+n*(i>180||i<-180?i-360*Math.round(i/360):i)}const dn={forward:cn,reverse:un,interpolate:function(t,e,n){return{l:Qe(t.l,e.l,n),a:Qe(t.a,e.a,n),b:Qe(t.b,e.b,n),alpha:Qe(t.alpha,e.alpha,n)}}},fn={forward:function(t){const{l:e,a:n,b:i}=cn(t),r=Math.atan2(i,n)*rn;return{h:r<0?r+360:r,c:Math.sqrt(n*n+i*i),l:e,alpha:t.a}},reverse:function(t){const e=t.h*nn,n=t.c;return un({l:t.l,a:Math.cos(e)*n,b:Math.sin(e)*n,alpha:t.alpha})},interpolate:function(t,e,n){return{h:hn(t.h,e.h,n),c:Qe(t.c,e.c,n),l:Qe(t.l,e.l,n),alpha:Qe(t.alpha,e.alpha,n)}}};var pn=Object.freeze({__proto__:null,lab:dn,hcl:fn});class mn{constructor(t,e,n,i,r){this.type=t,this.operator=e,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,r){let o=0;if("exponential"===t.name)o=gn(e,t.base,i,r);else if("linear"===t.name)o=gn(e,1,i,r);else if("cubic-bezier"===t.name){const a=t.controlPoints;o=new n(a[0],a[1],a[2],a[3]).solve(gn(e,1,i,r))}return o}static parse(t,e){let[n,i,r,...o]=t;if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const t=i[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:t}}else{if("cubic-bezier"!==i[0])return e.error("Unknown interpolation type "+String(i[0]),1,0);{const t=i.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,Gt),!r)return null;const a=[];let s=null;"interpolate-hcl"===n||"interpolate-lab"===n?s=Wt:e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let t=0;t=n)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=e.parse(i,l,s);if(!c)return null;s=s||c.type,a.push([n,c])}return"number"===s.kind||"color"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new mn(s,n,i,r,a):e.error(`Type ${ne(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);const r=e.length;if(i>=e[r-1])return n[r-1].evaluate(t);const o=Ke(e,i),a=mn.interpolationFactor(this.interpolation,i,e[o],e[o+1]),s=n[o].evaluate(t),l=n[o+1].evaluate(t);return"interpolate"===this.operator?tn[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?fn.reverse(fn.interpolate(fn.forward(s),fn.forward(l),a)):dn.reverse(dn.interpolate(dn.forward(s),dn.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;tre(i,t.type));return new _n(o?Kt:n,r)}evaluate(t){let e,n=null,i=0;for(const r of this.args)if(i++,n=r.evaluate(t),n&&n instanceof fe&&!n.available&&(e||(e=n.name),n=null,i===this.args.length&&(n=e)),null!==n)break;return n}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){const t=["coalesce"];return this.eachChild(e=>{t.push(e.serialize())}),t}}class vn{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const n=[];for(let i=1;i=n.length)throw new ye(`Array index out of bounds: ${e} > ${n.length-1}.`);if(e!==Math.floor(e))throw new ye(`Array index must be an integer, but found ${e} instead.`);return n[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class xn{constructor(t,e){this.type=Xt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Kt),i=e.parse(t[2],2,Kt);return n&&i?oe(n.type,[Xt,Ht,Gt,Zt,Kt])?new xn(n,i):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${ne(n.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!ae(e,["boolean","string","number","null"]))throw new ye(`Expected first argument to be of type boolean, string, number or null, but found ${ne(ge(e))} instead.`);if(!ae(n,["string","array"]))throw new ye(`Expected second argument to be of type array or string, but found ${ne(ge(n))} instead.`);return n.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class bn{constructor(t,e,n){this.type=Gt,this.needle=t,this.haystack=e,this.fromIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Kt),i=e.parse(t[2],2,Kt);if(!n||!i)return null;if(!oe(n.type,[Xt,Ht,Gt,Zt,Kt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${ne(n.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Gt);return r?new bn(n,i,r):null}return new bn(n,i)}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!ae(e,["boolean","string","number","null"]))throw new ye(`Expected first argument to be of type boolean, string, number or null, but found ${ne(ge(e))} instead.`);if(!ae(n,["string","array"]))throw new ye(`Expected second argument to be of type array or string, but found ${ne(ge(n))} instead.`);if(this.fromIndex){const i=this.fromIndex.evaluate(t);return n.indexOf(e,i)}return n.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class wn{constructor(t,e,n,i,r,o){this.inputType=t,this.type=e,this.input=n,this.cases=i,this.outputs=r,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let n,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r={},o=[];for(let a=2;aNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,ge(t)))return null}else n=ge(t);if(void 0!==r[String(t)])return c.error("Branch labels must be unique.");r[String(t)]=o.length}const u=e.parse(l,a,i);if(!u)return null;i=i||u.type,o.push(u)}const a=e.parse(t[1],1,Kt);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,i);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(n,a.type)?null:new wn(n,i,a,r,o,s):null}evaluate(t){const e=this.input.evaluate(t);return(ge(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),n=[],i={};for(const t of e){const e=i[this.cases[t]];void 0===e?(i[this.cases[t]]=n.length,n.push([this.cases[t],[t]])):n[e][1].push(t)}const r=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,i]of n)t.push(1===i.length?r(i[0]):i.map(r)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class Tn{constructor(t,e,n){this.type=t,this.branches=e,this.otherwise=n}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i=[];for(let r=1;re.outputDefined())&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild(e=>{t.push(e.serialize())}),t}}class Cn{constructor(t,e,n,i){this.type=t,this.input=e,this.beginIndex=n,this.endIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Kt),i=e.parse(t[2],2,Gt);if(!n||!i)return null;if(!oe(n.type,[ee(Kt),Ht,Kt]))return e.error(`Expected first argument to be of type array or string, but found ${ne(n.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Gt);return r?new Cn(n.type,n,i,r):null}return new Cn(n.type,n,i)}evaluate(t){const e=this.input.evaluate(t),n=this.beginIndex.evaluate(t);if(!ae(e,["string","array"]))throw new ye(`Expected first argument to be of type array or string, but found ${ne(ge(e))} instead.`);if(this.endIndex){const i=this.endIndex.evaluate(t);return e.slice(n,i)}return e.slice(n)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Sn(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function kn(t,e,n,i){return 0===i.compare(e,n)}function Mn(t,e,n){const i="=="!==t&&"!="!==t;return class r{constructor(t,e,n){this.type=Xt,this.lhs=t,this.rhs=e,this.collator=n,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const n=t[0];let o=e.parse(t[1],1,Kt);if(!o)return null;if(!Sn(n,o.type))return e.concat(1).error(`"${n}" comparisons are not supported for type '${ne(o.type)}'.`);let a=e.parse(t[2],2,Kt);if(!a)return null;if(!Sn(n,a.type))return e.concat(2).error(`"${n}" comparisons are not supported for type '${ne(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${ne(o.type)}' and '${ne(a.type)}'.`);i&&("value"===o.type.kind&&"value"!==a.type.kind?o=new be(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new be(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,Jt),!s)return null}return new r(o,a,s)}evaluate(r){const o=this.lhs.evaluate(r),a=this.rhs.evaluate(r);if(i&&this.hasUntypedArgument){const e=ge(o),n=ge(a);if(e.kind!==n.kind||"string"!==e.kind&&"number"!==e.kind)throw new ye(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${n.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const t=ge(o),n=ge(a);if("string"!==t.kind||"string"!==n.kind)return e(r,o,a)}return this.collator?n(r,o,a,this.collator.evaluate(r)):e(r,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild(t=>{e.push(t.serialize())}),e}}}const En=Mn("==",(function(t,e,n){return e===n}),kn),An=Mn("!=",(function(t,e,n){return e!==n}),(function(t,e,n,i){return!kn(0,e,n,i)})),Pn=Mn("<",(function(t,e,n){return e",(function(t,e,n){return e>n}),(function(t,e,n,i){return i.compare(e,n)>0})),On=Mn("<=",(function(t,e,n){return e<=n}),(function(t,e,n,i){return i.compare(e,n)<=0}));class Dn{constructor(t,e,n,i,r){this.type=Ht,this.number=t,this.locale=e,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,Gt);if(!n)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");let r=null;if(i.locale&&(r=e.parse(i.locale,1,Ht),!r))return null;let o=null;if(i.currency&&(o=e.parse(i.currency,1,Ht),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=e.parse(i["min-fraction-digits"],1,Gt),!a))return null;let s=null;return i["max-fraction-digits"]&&(s=e.parse(i["max-fraction-digits"],1,Gt),!s)?null:new Dn(n,r,o,a,s)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class zn{constructor(t){this.type=Gt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=e.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?e.error(`Expected argument of type string or array, but found ${ne(n.type)} instead.`):new zn(n):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ye(`Expected value to be of type string or array, but found ${ne(ge(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild(e=>{t.push(e.serialize())}),t}}const Rn={"==":En,"!=":An,">":In,"<":Pn,">=":Mn(">=",(function(t,e,n){return e>=n}),(function(t,e,n,i){return i.compare(e,n)>=0})),"<=":On,array:be,at:yn,boolean:be,case:Tn,coalesce:_n,collator:Ae,format:we,image:Te,in:xn,"index-of":bn,interpolate:mn,"interpolate-hcl":mn,"interpolate-lab":mn,length:zn,let:vn,literal:ve,match:wn,number:be,"number-format":Dn,object:be,slice:Cn,step:Je,string:be,"to-boolean":Se,"to-color":Se,"to-number":Se,"to-string":Se,var:We,within:Ze};function Ln(t,[e,n,i,r]){e=e.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);const o=r?r.evaluate(t):1,a=pe(e,n,i,o);if(a)throw new ye(a);return new ce(e/255*o,n/255*o,i/255*o,o)}function Fn(t,e){return t in e}function Bn(t,e){const n=e[t];return void 0===n?null:n}function Nn(t){return{type:t}}function $n(t){return{result:"success",value:t}}function jn(t){return{result:"error",value:t}}function Un(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Vn(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function qn(t){return!!t.expression&&t.expression.interpolated}function Zn(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Gn(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Hn(t){return t}function Xn(t,e,n){return void 0!==t?t:void 0!==e?e:void 0!==n?n:void 0}function Wn(t,e,n,i,r){return Xn(typeof n===r?i[n]:void 0,t.default,e.default)}function Yn(t,e,n){if("number"!==Zn(n))return Xn(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[i-1][0])return t.stops[i-1][1];const r=Ke(t.stops.map(t=>t[0]),n);return t.stops[r][1]}function Kn(t,e,n){const i=void 0!==t.base?t.base:1;if("number"!==Zn(n))return Xn(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[r-1][0])return t.stops[r-1][1];const o=Ke(t.stops.map(t=>t[0]),n),a=function(t,e,n,i){const r=i-n,o=t-n;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}(n,i,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1];let c=tn[e.type]||Hn;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=pn[t.colorSpace];c=(t,n)=>e.reverse(e.interpolate(e.forward(t),e.forward(n),a))}return"function"==typeof s.evaluate?{evaluate(...t){const e=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==n)return c(e,n,a)}}:c(s,l,a)}function Jn(t,e,n){return"color"===e.type?n=ce.parse(n):"formatted"===e.type?n=de.fromString(n.toString()):"resolvedImage"===e.type?n=fe.fromString(n.toString()):Zn(n)===e.type||"enum"===e.type&&e.values[n]||(n=void 0),Xn(n,t.default,e.default)}Ee.register(Rn,{error:[{kind:"error"},[Ht],(t,[e])=>{throw new ye(e.evaluate(t))}],typeof:[Ht,[Kt],(t,[e])=>ne(ge(e.evaluate(t)))],"to-rgba":[ee(Gt,4),[Wt],(t,[e])=>e.evaluate(t).toArray()],rgb:[Wt,[Gt,Gt,Gt],Ln],rgba:[Wt,[Gt,Gt,Gt,Gt],Ln],has:{type:Xt,overloads:[[[Ht],(t,[e])=>Fn(e.evaluate(t),t.properties())],[[Ht,Yt],(t,[e,n])=>Fn(e.evaluate(t),n.evaluate(t))]]},get:{type:Kt,overloads:[[[Ht],(t,[e])=>Bn(e.evaluate(t),t.properties())],[[Ht,Yt],(t,[e,n])=>Bn(e.evaluate(t),n.evaluate(t))]]},"feature-state":[Kt,[Ht],(t,[e])=>Bn(e.evaluate(t),t.featureState||{})],properties:[Yt,[],t=>t.properties()],"geometry-type":[Ht,[],t=>t.geometryType()],id:[Kt,[],t=>t.id()],zoom:[Gt,[],t=>t.globals.zoom],"heatmap-density":[Gt,[],t=>t.globals.heatmapDensity||0],"line-progress":[Gt,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Gt,[],t=>t.globals.skyRadialProgress||0],accumulated:[Kt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Gt,Nn(Gt),(t,e)=>{let n=0;for(const i of e)n+=i.evaluate(t);return n}],"*":[Gt,Nn(Gt),(t,e)=>{let n=1;for(const i of e)n*=i.evaluate(t);return n}],"-":{type:Gt,overloads:[[[Gt,Gt],(t,[e,n])=>e.evaluate(t)-n.evaluate(t)],[[Gt],(t,[e])=>-e.evaluate(t)]]},"/":[Gt,[Gt,Gt],(t,[e,n])=>e.evaluate(t)/n.evaluate(t)],"%":[Gt,[Gt,Gt],(t,[e,n])=>e.evaluate(t)%n.evaluate(t)],ln2:[Gt,[],()=>Math.LN2],pi:[Gt,[],()=>Math.PI],e:[Gt,[],()=>Math.E],"^":[Gt,[Gt,Gt],(t,[e,n])=>Math.pow(e.evaluate(t),n.evaluate(t))],sqrt:[Gt,[Gt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Gt,[Gt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Gt,[Gt],(t,[e])=>Math.log(e.evaluate(t))],log2:[Gt,[Gt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Gt,[Gt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Gt,[Gt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Gt,[Gt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Gt,[Gt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Gt,[Gt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Gt,[Gt],(t,[e])=>Math.atan(e.evaluate(t))],min:[Gt,Nn(Gt),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[Gt,Nn(Gt),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[Gt,[Gt],(t,[e])=>Math.abs(e.evaluate(t))],round:[Gt,[Gt],(t,[e])=>{const n=e.evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[Gt,[Gt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Gt,[Gt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Xt,[Ht,Kt],(t,[e,n])=>t.properties()[e.value]===n.value],"filter-id-==":[Xt,[Kt],(t,[e])=>t.id()===e.value],"filter-type-==":[Xt,[Ht],(t,[e])=>t.geometryType()===e.value],"filter-<":[Xt,[Ht,Kt],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i{const n=t.id(),i=e.value;return typeof n==typeof i&&n":[Xt,[Ht,Kt],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i>r}],"filter-id->":[Xt,[Kt],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n>i}],"filter-<=":[Xt,[Ht,Kt],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i<=r}],"filter-id-<=":[Xt,[Kt],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n<=i}],"filter->=":[Xt,[Ht,Kt],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i>=r}],"filter-id->=":[Xt,[Kt],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n>=i}],"filter-has":[Xt,[Kt],(t,[e])=>e.value in t.properties()],"filter-has-id":[Xt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Xt,[ee(Ht)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Xt,[ee(Kt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Xt,[Ht,ee(Kt)],(t,[e,n])=>n.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Xt,[Ht,ee(Kt)],(t,[e,n])=>function(t,e,n,i){for(;n<=i;){const r=n+i>>1;if(e[r]===t)return!0;e[r]>t?i=r-1:n=r+1}return!1}(t.properties()[e.value],n.value,0,n.value.length-1)],all:{type:Xt,overloads:[[[Xt,Xt],(t,[e,n])=>e.evaluate(t)&&n.evaluate(t)],[Nn(Xt),(t,e)=>{for(const n of e)if(!n.evaluate(t))return!1;return!0}]]},any:{type:Xt,overloads:[[[Xt,Xt],(t,[e,n])=>e.evaluate(t)||n.evaluate(t)],[Nn(Xt),(t,e)=>{for(const n of e)if(n.evaluate(t))return!0;return!1}]]},"!":[Xt,[Xt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Xt,[Ht],(t,[e])=>{const n=t.globals&&t.globals.isSupportedScript;return!n||n(e.evaluate(t))}],upcase:[Ht,[Ht],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Ht,[Ht],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Ht,Nn(Kt),(t,e)=>e.map(e=>_e(e.evaluate(t))).join("")],"resolved-locale":[Ht,[Jt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Qn{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Me,this._defaultValue=e?function(t){return"color"===t.type&&Gn(t.default)?new ce(0,0,0,0):"color"===t.type?ce.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,n,i,r,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,n,i,r,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new ye(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0),this._defaultValue}}}function ti(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Rn}function ei(t,e){const n=new Ye(Rn,[],e?function(t){const e={color:Wt,string:Ht,number:Gt,enum:Ht,boolean:Xt,formatted:Qt,resolvedImage:te};return"array"===t.type?ee(e[t.value]||Kt,t.length):e[t.type]}(e):void 0),i=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?$n(new Qn(i,e)):jn(n.errors)}class ni{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!He(e.expression)}evaluateWithoutErrorHandling(t,e,n,i,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,i,r,o)}evaluate(t,e,n,i,r,o){return this._styleExpression.evaluate(t,e,n,i,r,o)}}class ii{constructor(t,e,n,i){this.kind=t,this.zoomStops=n,this._styleExpression=e,this.isStateDependent="camera"!==t&&!He(e.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,e,n,i,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,i,r,o)}evaluate(t,e,n,i,r,o){return this._styleExpression.evaluate(t,e,n,i,r,o)}interpolationFactor(t,e,n){return this.interpolationType?mn.interpolationFactor(this.interpolationType,t,e,n):0}}function ri(t,e){if("error"===(t=ei(t,e)).result)return t;const n=t.value.expression,i=Ge(n);if(!i&&!Un(e))return jn([new Vt("","data expressions not supported")]);const r=Xe(n,["zoom"]);if(!r&&!Vn(e))return jn([new Vt("","zoom expressions not supported")]);const o=function t(e){let n=null;if(e instanceof vn)n=t(e.result);else if(e instanceof _n){for(const i of e.args)if(n=t(i),n)break}else(e instanceof Je||e instanceof mn)&&e.input instanceof Ee&&"zoom"===e.input.name&&(n=e);return n instanceof Vt||e.eachChild(e=>{const i=t(e);i instanceof Vt?n=i:!n&&i?n=new Vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&i&&n!==i&&(n=new Vt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(n);return o||r?o instanceof Vt?jn([o]):o instanceof mn&&!qn(e)?jn([new Vt("",'"interpolate" expressions cannot be used with this property')]):$n(o?new ii(i?"camera":"composite",t.value,o.labels,o instanceof mn?o.interpolation:void 0):new ni(i?"constant":"source",t.value)):jn([new Vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class oi{constructor(t,e){this._parameters=t,this._specification=e,$t(this,function t(e,n){const i="color"===n.type,r=e.stops&&"object"==typeof e.stops[0][0],o=r||!(r||void 0!==e.property),a=e.type||(qn(n)?"exponential":"interval");if(i&&((e=$t({},e)).stops&&(e.stops=e.stops.map(t=>[t[0],ce.parse(t[1])])),e.default=ce.parse(e.default?e.default:n.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!pn[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);let s,l,c;if("exponential"===a)s=Kn;else if("interval"===a)s=Yn;else if("categorical"===a){s=Wn,l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];c=typeof e.stops[0][0]}else{if("identity"!==a)throw new Error(`Unknown function type "${a}"`);s=Jn}if(r){const i={},r=[];for(let t=0;tt[0]),evaluate:({zoom:t},i)=>Kn({stops:o,base:e.base},n,t).evaluate(t,i)}}if(o){const t="exponential"===a?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:t,interpolationFactor:mn.interpolationFactor.bind(void 0,t),zoomStops:e.stops.map(t=>t[0]),evaluate:({zoom:t})=>s(e,n,t,l,c)}}return{kind:"source",evaluate(t,i){const r=i&&i.properties?i.properties[e.property]:void 0;return void 0===r?Xn(e.default,n.default):s(e,n,r,l,c)}}}(this._parameters,this._specification))}static deserialize(t){return new oi(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function ai(t){const e=t.key,n=t.value,i=t.valueSpec||{},r=t.objectElementValidators||{},o=t.style,a=t.styleSpec;let s=[];const l=Zn(n);if("object"!==l)return[new Bt(e,n,`object expected, ${l} found`)];for(const t in n){const l=t.split(".")[0],c=i[l]||i["*"];let u;if(r[l])u=r[l];else if(i[l])u=Oi;else if(r["*"])u=r["*"];else{if(!i["*"]){s.push(new Bt(e,n[t],`unknown property "${t}"`));continue}u=Oi}s=s.concat(u({key:(e?e+".":e)+t,value:n[t],valueSpec:c,style:o,styleSpec:a,object:n,objectKey:t},n))}for(const t in i)r[t]||i[t].required&&void 0===i[t].default&&void 0===n[t]&&s.push(new Bt(e,n,`missing required property "${t}"`));return s}function si(t){const e=t.value,n=t.valueSpec,i=t.style,r=t.styleSpec,o=t.key,a=t.arrayElementValidator||Oi;if("array"!==Zn(e))return[new Bt(o,e,`array expected, ${Zn(e)} found`)];if(n.length&&e.length!==n.length)return[new Bt(o,e,`array length ${n.length} expected, length ${e.length} found`)];if(n["min-length"]&&e.lengthr)return[new Bt(e,n,`${n} is greater than the maximum value ${r}`)]}return[]}function ci(t){const e=t.valueSpec,n=jt(t.value.type);let i,r,o,a={};const s="categorical"!==n&&void 0===t.value.property,l=!s,c="array"===Zn(t.value.stops)&&"array"===Zn(t.value.stops[0])&&"object"===Zn(t.value.stops[0][0]),u=ai({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===n)return[new Bt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const i=t.value;return e=e.concat(si({key:t.key,value:i,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Zn(i)&&0===i.length&&e.push(new Bt(t.key,i,"array must have at least one stop")),e},default:function(t){return Oi({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===n&&s&&u.push(new Bt(t.key,t.value,'missing required property "property"')),"identity"===n||t.value.stops||u.push(new Bt(t.key,t.value,'missing required property "stops"')),"exponential"===n&&t.valueSpec.expression&&!qn(t.valueSpec)&&u.push(new Bt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Un(t.valueSpec)?u.push(new Bt(t.key,t.value,"property functions not supported")):s&&!Vn(t.valueSpec)&&u.push(new Bt(t.key,t.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==t.value.property||u.push(new Bt(t.key,t.value,'"property" property is required')),u;function h(t){let n=[];const i=t.value,s=t.key;if("array"!==Zn(i))return[new Bt(s,i,`array expected, ${Zn(i)} found`)];if(2!==i.length)return[new Bt(s,i,`array length 2 expected, length ${i.length} found`)];if(c){if("object"!==Zn(i[0]))return[new Bt(s,i,`object expected, ${Zn(i[0])} found`)];if(void 0===i[0].zoom)return[new Bt(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new Bt(s,i,"object stop key must have value")];if(o&&o>jt(i[0].zoom))return[new Bt(s,i[0].zoom,"stop zoom values must appear in ascending order")];jt(i[0].zoom)!==o&&(o=jt(i[0].zoom),r=void 0,a={}),n=n.concat(ai({key:s+"[0]",value:i[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:li,value:d}}))}else n=n.concat(d({key:s+"[0]",value:i[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},i));return ti(Ut(i[1]))?n.concat([new Bt(s+"[1]",i[1],"expressions are not allowed in function stops.")]):n.concat(Oi({key:s+"[1]",value:i[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function d(t,o){const s=Zn(t.value),l=jt(t.value),c=null!==t.value?t.value:o;if(i){if(s!==i)return[new Bt(t.key,c,`${s} stop domain type must match previous stop domain type ${i}`)]}else i=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Bt(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){let i=`number expected, ${s} found`;return Un(e)&&void 0===n&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Bt(t.key,c,i)]}return"categorical"!==n||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&void 0!==r&&lnew Bt(`${t.key}${e.key}`,t.value,e.message));const n=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!n.outputDefined())return[new Bt(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!He(n))return[new Bt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!He(n))return[new Bt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Xe(n,["zoom","feature-state"]))return[new Bt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Ge(n))return[new Bt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function hi(t){const e=t.key,n=t.value,i=t.valueSpec,r=[];return Array.isArray(i.values)?-1===i.values.indexOf(jt(n))&&r.push(new Bt(e,n,`expected one of [${i.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(i.values).indexOf(jt(n))&&r.push(new Bt(e,n,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(n)} found`)),r}function di(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!di(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const fi={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function pi(t){if(null==t)return{filter:()=>!0,needGeometry:!1};di(t)||(t=gi(t));const e=ei(t,fi);if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,n,i)=>e.value.evaluate(t,n,{},i),needGeometry:function t(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let n=1;ne?1:0}function gi(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?_i(t[1],t[2],"=="):"!="===e?xi(_i(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?_i(t[1],t[2],e):"any"===e?(n=t.slice(1),["any"].concat(n.map(gi))):"all"===e?["all"].concat(t.slice(1).map(gi)):"none"===e?["all"].concat(t.slice(1).map(gi).map(xi)):"in"===e?vi(t[1],t.slice(2)):"!in"===e?xi(vi(t[1],t.slice(2))):"has"===e?yi(t[1]):"!has"===e?xi(yi(t[1])):"within"!==e||t;var n}function _i(t,e,n){switch(t){case"$type":return["filter-type-"+n,e];case"$id":return["filter-id-"+n,e];default:return["filter-"+n,t,e]}}function vi(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(mi)]]:["filter-in-small",t,["literal",e]]}}function yi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function xi(t){return["!",t]}function bi(t){return di(Ut(t.value))?ui($t({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){const n=e.value,i=e.key;if("array"!==Zn(n))return[new Bt(i,n,`array expected, ${Zn(n)} found`)];const r=e.styleSpec;let o,a=[];if(n.length<1)return[new Bt(i,n,"filter array must have at least 1 element")];switch(a=a.concat(hi({key:i+"[0]",value:n[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),jt(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===jt(n[1])&&a.push(new Bt(i,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&a.push(new Bt(i,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(o=Zn(n[1]),"string"!==o&&a.push(new Bt(i+"[1]",n[1],`string expected, ${o} found`)));for(let t=2;t{t in n&&e.push(new Bt(i,n[t],`"${t}" is prohibited for ref layers`))}),r.layers.forEach(e=>{jt(e.id)===s&&(t=e)}),t?t.ref?e.push(new Bt(i,n.ref,"ref cannot reference another ref layer")):a=jt(t.type):e.push(new Bt(i,n.ref,`ref layer "${s}" not found`))}else if("background"!==a&&"sky"!==a)if(n.source){const t=r.sources&&r.sources[n.source],o=t&&jt(t.type);t?"vector"===o&&"raster"===a?e.push(new Bt(i,n.source,`layer "${n.id}" requires a raster source`)):"raster"===o&&"raster"!==a?e.push(new Bt(i,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==o||n["source-layer"]?"raster-dem"===o&&"hillshade"!==a?e.push(new Bt(i,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!n.paint||!n.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new Bt(i,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Bt(i,n,`layer "${n.id}" must specify a "source-layer"`)):e.push(new Bt(i,n.source,`source "${n.source}" not found`))}else e.push(new Bt(i,n,'missing required property "source"'));return e=e.concat(ai({key:i,value:n,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Oi({key:i+".type",value:n.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:n,objectKey:"type"}),filter:bi,layout:t=>ai({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Ci($t({layerType:a},t))}}),paint:t=>ai({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Ti($t({layerType:a},t))}})}})),e}function ki(t){const e=t.value,n=t.key,i=Zn(e);return"string"!==i?[new Bt(n,e,`string expected, ${i} found`)]:[]}const Mi={promoteId:function({key:t,value:e}){if("string"===Zn(e))return ki({key:t,value:e});{const n=[];for(const i in e)n.push(...ki({key:`${t}.${i}`,value:e[i]}));return n}}};function Ei(t){const e=t.value,n=t.key,i=t.styleSpec,r=t.style;if(!e.type)return[new Bt(n,e,'"type" is required')];const o=jt(e.type);let a;switch(o){case"vector":case"raster":case"raster-dem":return a=ai({key:n,value:e,valueSpec:i["source_"+o.replace("-","_")],style:t.style,styleSpec:i,objectElementValidators:Mi}),a;case"geojson":if(a=ai({key:n,value:e,valueSpec:i.source_geojson,style:r,styleSpec:i,objectElementValidators:Mi}),e.cluster)for(const t in e.clusterProperties){const[i,r]=e.clusterProperties[t],o="string"==typeof i?[i,["accumulated"],["get",t]]:i;a.push(...ui({key:`${n}.${t}.map`,value:r,expressionContext:"cluster-map"})),a.push(...ui({key:`${n}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return ai({key:n,value:e,valueSpec:i.source_video,style:r,styleSpec:i});case"image":return ai({key:n,value:e,valueSpec:i.source_image,style:r,styleSpec:i});case"canvas":return[new Bt(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return hi({key:n+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:i})}}function Ai(t){const e=t.value,n=t.styleSpec,i=n.light,r=t.style;let o=[];const a=Zn(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Bt("light",e,`object expected, ${a} found`)]),o;for(const t in e){const a=t.match(/^(.*)-transition$/);o=o.concat(a&&i[a[1]]&&i[a[1]].transition?Oi({key:t,value:e[t],valueSpec:n.transition,style:r,styleSpec:n}):i[t]?Oi({key:t,value:e[t],valueSpec:i[t],style:r,styleSpec:n}):[new Bt(t,e[t],`unknown property "${t}"`)])}return o}function Pi(t){const e=t.value,n=t.key,i=t.style,r=t.styleSpec,o=r.terrain;let a=[];const s=Zn(e);if(void 0===e)return a;if("object"!==s)return a=a.concat([new Bt("terrain",e,`object expected, ${s} found`)]),a;for(const t in e){const n=t.match(/^(.*)-transition$/);a=a.concat(n&&o[n[1]]&&o[n[1]].transition?Oi({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):o[t]?Oi({key:t,value:e[t],valueSpec:o[t],style:i,styleSpec:r}):[new Bt(t,e[t],`unknown property "${t}"`)])}if(e.source){const t=i.sources&&i.sources[e.source],r=t&&jt(t.type);t?"raster-dem"!==r&&a.push(new Bt(n,e.source,`terrain cannot be used with a source of type ${r}, it only be used with a "raster-dem" source type`)):a.push(new Bt(n,e.source,`source "${e.source}" not found`))}else a.push(new Bt(n,e,'terrain is missing required property "source"'));return a}const Ii={"*":()=>[],array:si,boolean:function(t){const e=t.value,n=t.key,i=Zn(e);return"boolean"!==i?[new Bt(n,e,`boolean expected, ${i} found`)]:[]},number:li,color:function(t){const e=t.key,n=t.value,i=Zn(n);return"string"!==i?[new Bt(e,n,`color expected, ${i} found`)]:null===le(n)?[new Bt(e,n,`color expected, "${n}" found`)]:[]},constants:Nt,enum:hi,filter:bi,function:ci,layer:Si,object:ai,source:Ei,light:Ai,terrain:Pi,string:ki,formatted:function(t){return 0===ki(t).length?[]:ui(t)},resolvedImage:function(t){return 0===ki(t).length?[]:ui(t)}};function Oi(t){const e=t.value,n=t.valueSpec,i=t.styleSpec;return n.expression&&Gn(jt(e))?ci(t):n.expression&&ti(Ut(e))?ui(t):n.type&&Ii[n.type]?Ii[n.type](t):ai($t({},t,{valueSpec:n.type?i[n.type]:n}))}function Di(t){const e=t.value,n=t.key,i=ki(t);return i.length||(-1===e.indexOf("{fontstack}")&&i.push(new Bt(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&i.push(new Bt(n,e,'"glyphs" url must include a "{range}" token'))),i}function zi(t,e=Ft){let n=[];return n=n.concat(Oi({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Di,"*":()=>[]}})),t.constants&&(n=n.concat(Nt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Ri(n)}function Ri(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function Li(t){return function(...e){return Ri(t.apply(this,e))}}zi.source=Li(Ei),zi.light=Li(Ai),zi.terrain=Li(Pi),zi.layer=Li(Si),zi.filter=Li(bi),zi.paintProperty=Li(Ti),zi.layoutProperty=Li(Ci);const Fi=zi,Bi=Fi.light,Ni=Fi.paintProperty,$i=Fi.layoutProperty;function ji(t,e){let n=!1;if(e&&e.length)for(const i of e)t.fire(new Rt(new Error(i.message))),n=!0;return n}var Ui=Vi;function Vi(t,e,n){var i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var r=new Int32Array(this.arrayBuffer);t=r[0],this.d=(e=r[1])+2*(n=r[2]);for(var o=0;o=u[f+0]&&i>=u[f+1])?(a[d]=!0,o.push(c[d])):a[d]=!1}}},Vi.prototype._forEachCell=function(t,e,n,i,r,o,a,s){for(var l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),u=this._convertToCellCoord(n),h=this._convertToCellCoord(i),d=l;d<=u;d++)for(var f=c;f<=h;f++){var p=this.d*f+d;if((!s||s(this._convertFromCellCoord(d),this._convertFromCellCoord(f),this._convertFromCellCoord(d+1),this._convertFromCellCoord(f+1)))&&r.call(this,t,e,n,i,p,o,a,s))return}},Vi.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Vi.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Vi.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,n=0,i=0;i=0)continue;const o=t[n];r[n]=Gi[i].shallow.indexOf(n)>=0?o:Yi(o,e)}t instanceof Error&&(r.message=t.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(r.$name=i),r}throw new Error("can't serialize object of type "+typeof t)}function Ki(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Xi(t)||Wi(t)||ArrayBuffer.isView(t)||t instanceof qi)return t;if(Array.isArray(t))return t.map(Ki);if("object"==typeof t){const e=t.$name||"Object",{klass:n}=Gi[e];if(!n)throw new Error("can't deserialize unregistered class "+e);if(n.deserialize)return n.deserialize(t);const i=Object.create(n.prototype);for(const n of Object.keys(t)){if("$name"===n)continue;const r=t[n];i[n]=Gi[e].shallow.indexOf(n)>=0?r:Ki(r)}return i}throw new Error("can't deserialize object of type "+typeof t)}class Ji{constructor(){this.first=!0}update(t,e){const n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=e):this.lastFloorZoomt>=1536&&t<=1791,tr=t=>t>=1872&&t<=1919,er=t=>t>=2208&&t<=2303,nr=t=>t>=11904&&t<=12031,ir=t=>t>=12032&&t<=12255,rr=t=>t>=12272&&t<=12287,or=t=>t>=12288&&t<=12351,ar=t=>t>=12352&&t<=12447,sr=t=>t>=12448&&t<=12543,lr=t=>t>=12544&&t<=12591,cr=t=>t>=12704&&t<=12735,ur=t=>t>=12736&&t<=12783,hr=t=>t>=12784&&t<=12799,dr=t=>t>=12800&&t<=13055,fr=t=>t>=13056&&t<=13311,pr=t=>t>=13312&&t<=19903,mr=t=>t>=19968&&t<=40959,gr=t=>t>=40960&&t<=42127,_r=t=>t>=42128&&t<=42191,vr=t=>t>=44032&&t<=55215,yr=t=>t>=63744&&t<=64255,xr=t=>t>=64336&&t<=65023,br=t=>t>=65040&&t<=65055,wr=t=>t>=65072&&t<=65103,Tr=t=>t>=65104&&t<=65135,Cr=t=>t>=65136&&t<=65279,Sr=t=>t>=65280&&t<=65519;function kr(t){for(const e of t)if(Ar(e.charCodeAt(0)))return!0;return!1}function Mr(t){for(const e of t)if(!Er(e.charCodeAt(0)))return!1;return!0}function Er(t){return!(Qi(t)||tr(t)||er(t)||xr(t)||Cr(t))}function Ar(t){return!(746!==t&&747!==t&&(t<4352||!(cr(t)||lr(t)||wr(t)&&!(t>=65097&&t<=65103)||yr(t)||fr(t)||nr(t)||ur(t)||!(!or(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||pr(t)||mr(t)||dr(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||vr(t)||ar(t)||rr(t)||(t=>t>=12688&&t<=12703)(t)||ir(t)||hr(t)||sr(t)&&12540!==t||!(!Sr(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Tr(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||br(t)||(t=>t>=19904&&t<=19967)(t)||gr(t)||_r(t))))}function Pr(t){return!(Ar(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||or(t)||sr(t)||(t=>t>=57344&&t<=63743)(t)||wr(t)||Tr(t)||Sr(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Ir(t){return t>=1424&&t<=2303||xr(t)||Cr(t)}function Or(t,e){return!(!e&&Ir(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function Dr(t){for(const e of t)if(Ir(e.charCodeAt(0)))return!0;return!1}let zr=null,Rr="unavailable",Lr=null;const Fr=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Rr="error"),zr&&zr(t)};function Br(){Nr.fire(new zt("pluginStateChange",{pluginStatus:Rr,pluginURL:Lr}))}const Nr=new Lt,$r=function(){return Rr},jr=function(){if("deferred"!==Rr||!Lr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Rr="loading",Br(),Lr&&Ct({url:Lr},t=>{t?Fr(t):(Rr="loaded",Br())})},Ur={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>"loaded"===Rr||null!=Ur.applyArabicShaping,isLoading:()=>"loading"===Rr,setState(t){Rr=t.pluginStatus,Lr=t.pluginURL},isParsed:()=>null!=Ur.applyArabicShaping&&null!=Ur.processBidirectionalText&&null!=Ur.processStyledBidirectionalText,getPluginURL:()=>Lr};class Vr{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ji,this.transition={})}isSupportedScript(t){return function(t,e){for(const n of t)if(!Or(n.charCodeAt(0),e))return!1;return!0}(t,Ur.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*e}}}class qr{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Gn(t))return new oi(t,e);if(ti(t)){const n=ri(t,e);if("error"===n.result)throw new Error(n.value.map(t=>`${t.key}: ${t.message}`).join(", "));return n.value}{let n=t;return"string"==typeof t&&"color"===e.type&&(n=ce.parse(t)),{kind:"constant",evaluate:()=>n}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,n){return this.property.possiblyEvaluate(this,t,e,n)}}class Zr{constructor(t){this.property=t,this.value=new qr(t,void 0)}transitioned(t,e){return new Hr(this.property,this.value,e,y({},t.transition,this.transition),t.now)}untransitioned(){return new Hr(this.property,this.value,null,{},0)}}class Gr{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return E(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Zr(this._values[t].property)),this._values[t].value=new qr(this._values[t].property,null===e?void 0:E(e))}getTransition(t){return E(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Zr(this._values[t].property)),this._values[t].transition=E(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const n=this.getValue(e);void 0!==n&&(t[e]=n);const i=this.getTransition(e);void 0!==i&&(t[e+"-transition"]=i)}return t}transitioned(t,e){const n=new Xr(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(t,e._values[i]);return n}untransitioned(){const t=new Xr(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Hr{constructor(t,e,n,i,r){this.property=t,this.value=e,this.begin=r+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(t,e,n){const i=t.now||0,r=this.value.possiblyEvaluate(t,e,n),o=this.prior;if(o){if(i>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(ii.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}}interpolate(t){return t}}class eo{constructor(t){this.specification=t}possiblyEvaluate(t,e,n,i){if(void 0!==t.value){if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},n,i);return this._calculate(r,r,r,e)}return this._calculate(t.expression.evaluate(new Vr(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Vr(Math.floor(e.zoom),e)),t.expression.evaluate(new Vr(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}}interpolate(t){return t}}class no{constructor(t){this.specification=t}possiblyEvaluate(t,e,n,i){return!!t.expression.evaluate(e,null,{},n,i)}interpolate(){return!1}}class io{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const n=t[e];n.specification.overridable&&this.overridableProperties.push(e);const i=this.defaultPropertyValues[e]=new qr(n,void 0),r=this.defaultTransitionablePropertyValues[e]=new Zr(n);this.defaultTransitioningPropertyValues[e]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}}function ro(t,e){return 256*(t=m(Math.floor(t),0,255))+m(Math.floor(e),0,255)}Hi("DataDrivenProperty",Qr),Hi("DataConstantProperty",Jr),Hi("CrossFadedDataDrivenProperty",to),Hi("CrossFadedProperty",eo),Hi("ColorRampProperty",no);const oo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ao{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class so{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function lo(t,e=1){let n=0,i=0;return{members:t.map(t=>{const r=oo[t.type].BYTES_PER_ELEMENT,o=n=co(n,Math.max(e,r)),a=t.components||1;return i=Math.max(i,r),n+=r*a,{name:t.name,type:t.type,components:a,offset:o}}),size:co(n,Math.max(i,e)),alignment:e}}function co(t,e){return Math.ceil(t/e)*e}class uo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const i=2*t;return this.int16[i+0]=e,this.int16[i+1]=n,t}}uo.prototype.bytesPerElement=4,Hi("StructArrayLayout2i4",uo);class ho extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)}emplace(t,e,n,i,r){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=n,this.int16[o+2]=i,this.int16[o+3]=r,t}}ho.prototype.bytesPerElement=8,Hi("StructArrayLayout4i8",ho);class fo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,n,i,r,o,a)}emplace(t,e,n,i,r,o,a,s){const l=6*t,c=12*t,u=3*t;return this.int16[l+0]=e,this.int16[l+1]=n,this.uint8[c+4]=i,this.uint8[c+5]=r,this.uint8[c+6]=o,this.uint8[c+7]=a,this.float32[u+2]=s,t}}fo.prototype.bytesPerElement=12,Hi("StructArrayLayout2i4ub1f12",fo);class po extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const i=2*t;return this.float32[i+0]=e,this.float32[i+1]=n,t}}po.prototype.bytesPerElement=8,Hi("StructArrayLayout2f8",po);class mo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,n,i,r,o,a,s,l,c)}emplace(t,e,n,i,r,o,a,s,l,c,u){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=n,this.uint16[h+2]=i,this.uint16[h+3]=r,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,t}}mo.prototype.bytesPerElement=20,Hi("StructArrayLayout10ui20",mo);class go extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,n,i,r,o,a,s,l,c,u,h)}emplace(t,e,n,i,r,o,a,s,l,c,u,h,d){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=n,this.int16[f+2]=i,this.int16[f+3]=r,this.uint16[f+4]=o,this.uint16[f+5]=a,this.uint16[f+6]=s,this.uint16[f+7]=l,this.int16[f+8]=c,this.int16[f+9]=u,this.int16[f+10]=h,this.int16[f+11]=d,t}}go.prototype.bytesPerElement=24,Hi("StructArrayLayout4i4ui4i24",go);class _o extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)}emplace(t,e,n,i){const r=3*t;return this.float32[r+0]=e,this.float32[r+1]=n,this.float32[r+2]=i,t}}_o.prototype.bytesPerElement=12,Hi("StructArrayLayout3f12",_o);class vo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}vo.prototype.bytesPerElement=4,Hi("StructArrayLayout1ul4",vo);class yo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,n,i,r,o,a,s,l,c)}emplace(t,e,n,i,r,o,a,s,l,c,u){const h=16*t,d=8*t;return this.int16[h+0]=e,this.int16[h+1]=n,this.float32[d+1]=i,this.float32[d+2]=r,this.float32[d+3]=o,this.float32[d+4]=a,this.int16[h+10]=s,this.uint32[d+6]=l,this.uint16[h+14]=c,this.uint16[h+15]=u,t}}yo.prototype.bytesPerElement=32,Hi("StructArrayLayout2i4f1i1ul2ui32",yo);class xo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,n,i,r,o)}emplace(t,e,n,i,r,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=n,this.int16[s+2]=i,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,t}}xo.prototype.bytesPerElement=12,Hi("StructArrayLayout2i2i2i12",xo);class bo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,n,i,r)}emplace(t,e,n,i,r,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=n,this.float32[a+2]=i,this.int16[s+6]=r,this.int16[s+7]=o,t}}bo.prototype.bytesPerElement=16,Hi("StructArrayLayout2f1f2i16",bo);class wo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)}emplace(t,e,n,i,r){const o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=n,this.float32[a+1]=i,this.float32[a+2]=r,t}}wo.prototype.bytesPerElement=12,Hi("StructArrayLayout2ub2f12",wo);class To extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)}emplace(t,e,n,i){const r=3*t;return this.uint16[r+0]=e,this.uint16[r+1]=n,this.uint16[r+2]=i,t}}To.prototype.bytesPerElement=6,Hi("StructArrayLayout3ui6",To);class Co extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m,g)}emplace(t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m,g,_){const v=24*t,y=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=n,this.uint16[v+2]=i,this.uint16[v+3]=r,this.uint32[y+2]=o,this.uint32[y+3]=a,this.uint32[y+4]=s,this.uint16[v+10]=l,this.uint16[v+11]=c,this.uint16[v+12]=u,this.float32[y+7]=h,this.float32[y+8]=d,this.uint8[x+36]=f,this.uint8[x+37]=p,this.uint8[x+38]=m,this.uint32[y+10]=g,this.int16[v+22]=_,t}}Co.prototype.bytesPerElement=48,Hi("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Co);class So extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m,g,_,v,y,x,b,w,T,C,S,k,M){const E=this.length;return this.resize(E+1),this.emplace(E,t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m,g,_,v,y,x,b,w,T,C,S,k,M)}emplace(t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m,g,_,v,y,x,b,w,T,C,S,k,M,E){const A=34*t,P=17*t;return this.int16[A+0]=e,this.int16[A+1]=n,this.int16[A+2]=i,this.int16[A+3]=r,this.int16[A+4]=o,this.int16[A+5]=a,this.int16[A+6]=s,this.int16[A+7]=l,this.uint16[A+8]=c,this.uint16[A+9]=u,this.uint16[A+10]=h,this.uint16[A+11]=d,this.uint16[A+12]=f,this.uint16[A+13]=p,this.uint16[A+14]=m,this.uint16[A+15]=g,this.uint16[A+16]=_,this.uint16[A+17]=v,this.uint16[A+18]=y,this.uint16[A+19]=x,this.uint16[A+20]=b,this.uint16[A+21]=w,this.uint16[A+22]=T,this.uint32[P+12]=C,this.float32[P+13]=S,this.float32[P+14]=k,this.float32[P+15]=M,this.float32[P+16]=E,t}}So.prototype.bytesPerElement=68,Hi("StructArrayLayout8i15ui1ul4f68",So);class ko extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}ko.prototype.bytesPerElement=4,Hi("StructArrayLayout1f4",ko);class Mo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)}emplace(t,e,n,i){const r=3*t;return this.int16[r+0]=e,this.int16[r+1]=n,this.int16[r+2]=i,t}}Mo.prototype.bytesPerElement=6,Hi("StructArrayLayout3i6",Mo);class Eo extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)}emplace(t,e,n,i,r){const o=6*t;return this.uint32[3*t+0]=e,this.uint16[o+2]=n,this.uint16[o+3]=i,this.uint16[o+4]=r,t}}Eo.prototype.bytesPerElement=12,Hi("StructArrayLayout1ul3ui12",Eo);class Ao extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const i=2*t;return this.uint16[i+0]=e,this.uint16[i+1]=n,t}}Ao.prototype.bytesPerElement=4,Hi("StructArrayLayout2ui4",Ao);class Po extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Po.prototype.bytesPerElement=2,Hi("StructArrayLayout1ui2",Po);class Io extends so{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)}emplace(t,e,n,i,r){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=n,this.float32[o+2]=i,this.float32[o+3]=r,t}}Io.prototype.bytesPerElement=16,Hi("StructArrayLayout4f16",Io);class Oo extends ao{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.float32[this._pos4+1]}get y1(){return this._structArray.float32[this._pos4+2]}get x2(){return this._structArray.float32[this._pos4+3]}get y2(){return this._structArray.float32[this._pos4+4]}get padding(){return this._structArray.int16[this._pos2+10]}get featureIndex(){return this._structArray.uint32[this._pos4+6]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+14]}get bucketIndex(){return this._structArray.uint16[this._pos2+15]}get anchorPoint(){return new r(this.anchorPointX,this.anchorPointY)}}Oo.prototype.size=32;class Do extends yo{get(t){return new Oo(this,t)}}Hi("CollisionBoxArray",Do);class zo extends ao{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}zo.prototype.size=48;class Ro extends Co{get(t){return new zo(this,t)}}Hi("PlacedSymbolArray",Ro);class Lo extends ao{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Lo.prototype.size=68;class Fo extends So{get(t){return new Lo(this,t)}}Hi("SymbolInstanceArray",Fo);class Bo extends ko{getoffsetX(t){return this.float32[1*t+0]}}Hi("GlyphOffsetArray",Bo);class No extends Mo{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Hi("SymbolLineVertexArray",No);class $o extends ao{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}$o.prototype.size=12;class jo extends Eo{get(t){return new $o(this,t)}}Hi("FeatureIndexArray",jo);class Uo extends ao{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}Uo.prototype.size=4;class Vo extends Ao{get(t){return new Uo(this,t)}}Hi("FillExtrusionCentroidArray",Vo);const qo=lo([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]);var Zo=se((function(t){t.exports=function(t,e){var n,i,r,o,a,s,l,c;for(i=t.length-(n=3&t.length),r=e,a=3432918353,s=461845907,c=0;c>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=t.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0}})),Go=se((function(t){t.exports=function(t,e){for(var n,i=t.length,r=e^i,o=0;i>=4;)n=1540483477*(65535&(n=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(n>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:r^=(255&t.charCodeAt(o+2))<<16;case 2:r^=(255&t.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}})),Ho=Zo,Xo=Go;Ho.murmur3=Zo,Ho.murmur2=Xo;class Wo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,n,i){this.ids.push(Yo(t)),this.positions.push(e,n,i)}getPositions(t){const e=Yo(t);let n=0,i=this.ids.length-1;for(;n>1;this.ids[t]>=e?i=t:n=t+1}const r=[];for(;this.ids[n]===e;)r.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return r}static serialize(t,e){const n=new Float64Array(t.ids),i=new Uint32Array(t.positions);return function t(e,n,i,r){for(;i>1];let a=i-1,s=r+1;for(;;){do{a++}while(e[a]o);if(a>=s)break;Ko(e,a,s),Ko(n,3*a,3*s),Ko(n,3*a+1,3*s+1),Ko(n,3*a+2,3*s+2)}s-i"u_"+t),this.type=n}setUniform(t,e,n){t.set(n.constantOr(this.value))}getBinding(t,e,n){return"color"===this.type?new ea(t,e):new Qo(t,e)}}class aa{constructor(t,e){this.uniformNames=e.map(t=>"u_"+t),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,n,i){const r="u_pattern_to"===i?this.patternTo:"u_pattern_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;r&&t.set(r)}getBinding(t,e,n){return"u_pattern"===n.substr(0,9)?new ta(t,e):new Qo(t,e)}}class sa{constructor(t,e,n,i){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:"a_"+t,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,n,i,r){const o=this.paintVertexArray.length,a=this.expression.evaluate(new Vr(0),e,{},i,[],r);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,n,i){const r=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(t,e,r)}_setPaintValue(t,e,n){if("color"===this.type){const i=ra(n);for(let n=t;n`u_${t}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:"a_"+t,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(t,e,n,i,r){const o=this.expression.evaluate(new Vr(this.zoom),e,{},i,[],r),a=this.expression.evaluate(new Vr(this.zoom+1),e,{},i,[],r),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)}updatePaintArray(t,e,n,i){const r=this.expression.evaluate({zoom:this.zoom},n,i),o=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(t,e,r,o)}_setPaintValue(t,e,n,i){if("color"===this.type){const r=ra(n),o=ra(i);for(let n=t;n!0)){this.binders={},this._buffers=[];const i=[];for(const r in t.paint._values){if(!n(r))continue;const o=t.paint.get(r);if(!(o instanceof Yr&&Un(o.property.specification)))continue;const a=da(r,t.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],h="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===s.kind)this.binders[r]=h?new aa(s.value,a):new oa(s.value,a,l),i.push("/u_"+r);else if("source"===s.kind||h){const n=fa(r,l,"source");this.binders[r]=h?new ca(s,a,l,c,e,n,t.id):new sa(s,a,l,n),i.push("/a_"+r)}else{const t=fa(r,l,"composite");this.binders[r]=new la(s,a,l,c,e,t),i.push("/z_"+r)}}this.cacheKey=i.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof sa||e instanceof la?e.maxValue:0}populatePaintArrays(t,e,n,i,r){for(const o in this.binders){const a=this.binders[o];(a instanceof sa||a instanceof la||a instanceof ca)&&a.populatePaintArray(t,e,n,i,r)}}setConstantPatternPositions(t,e){for(const n in this.binders){const i=this.binders[n];i instanceof aa&&i.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,n,i,r){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=n.feature(e.index);for(const n in this.binders){const l=this.binders[n];if((l instanceof sa||l instanceof la||l instanceof ca)&&!0===l.expression.isStateDependent){const c=i.paint.get(n);l.expression=c.value,l.updatePaintArray(e.start,e.end,s,t[a],r),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const n=this.binders[e];(n instanceof oa||n instanceof aa)&&t.push(...n.uniformNames.map(t=>"#define HAS_UNIFORM_"+t))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const n=this.binders[e];if(n instanceof sa||n instanceof la)for(let e=0;e!0)){this.programConfigurations={};for(const i of t)this.programConfigurations[i.id]=new ua(i,e,n);this.needsUpload=!1,this._featureMap=new Wo,this._bufferOffset=0}populatePaintArrays(t,e,n,i,r,o){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i,r,o);void 0!==e.id&&this._featureMap.add(e.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,n,i){for(const r of n)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(t,this._featureMap,e,r,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function da(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function fa(t,e,n){const i={color:{source:po,composite:Io},number:{source:ko,composite:po}},r=function(t){return{"line-pattern":{source:mo,composite:mo},"fill-pattern":{source:mo,composite:mo},"fill-extrusion-pattern":{source:mo,composite:mo}}[t]}(t);return r&&r[n]||i[e][n]}Hi("ConstantBinder",oa),Hi("CrossFadedConstantBinder",aa),Hi("SourceExpressionBinder",sa),Hi("CrossFadedCompositeBinder",ca),Hi("CompositeExpressionBinder",la),Hi("ProgramConfiguration",ua,{omit:["_buffers"]}),Hi("ProgramConfigurationSet",ha);class pa extends Lt{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&"sky"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Wr(e.layout)),e.paint)){this._transitionablePaint=new Gr(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Kr(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,n={}){null!=e&&this._validate($i,`layers.${this.id}.layout.${t}`,t,e,n)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return S(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,n={}){if(null!=e&&this._validate(Ni,`layers.${this.id}.paint.${t}`,t,e,n))return!1;if(S(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;{const n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],r=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||r||i||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getProgramConfiguration(t){return null}_handleOverridablePaintPropertyUpdate(t,e,n){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),M(t,(t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length))}_validate(t,e,n,i,r={}){return(!r||!1!==r.validate)&&ji(this,t.call(Fi,{key:e,layerType:this.type,objectKey:n,value:i,styleSpec:Ft,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Yr&&Un(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const ma=lo([{name:"a_pos",components:2,type:"Int16"}],4),{members:ga}=ma;class _a{constructor(t=[]){this.segments=t}prepareSegment(t,e,n,i){let r=this.segments[this.segments.length-1];return t>_a.MAX_VERTEX_ARRAY_LENGTH&&P(`Max vertices per segment is ${_a.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!r||r.vertexLength+t>_a.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==i)&&(r={vertexOffset:e.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==i&&(r.sortKey=i),this.segments.push(r)),r}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,n,i){return new _a([{vertexOffset:t,primitiveOffset:e,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}}_a.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Hi("SegmentVector",_a);const va=Math.pow(2,14)-1,ya=-va-1;function xa(t){const e=8192/t.extent,n=t.loadGeometry();for(let t=0;tn.x+1||on.y+1)&&P("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function ba(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?xa(t):[]}}function wa(t,e,n,i,r){t.emplaceBack(2*e+(i+1)/2,2*n+(r+1)/2)}class Ta{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new uo,this.indexArray=new To,this.segments=new _a,this.programConfigurations=new ha(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,n){const i=this.layers[0],r=[];let o=null;"circle"===i.type&&(o=i.layout.get("circle-sort-key"));for(const{feature:e,id:i,index:a,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,l=ba(e,t);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),l,n))continue;const c=o?o.evaluate(l,{},n):void 0,u={id:i,properties:e.properties,type:e.type,sourceLayerIndex:s,index:a,geometry:t?l.geometry:xa(e),patterns:{},sortKey:c};r.push(u)}o&&r.sort((t,e)=>t.sortKey-e.sortKey);for(const i of r){const{geometry:r,index:o,sourceLayerIndex:a}=i,s=t[o].feature;this.addFeature(i,r,o,n),e.featureIndex.insert(s,r,o,a,this.index)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ga),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,n,i){for(const n of e)for(const e of n){const n=e.x,i=e.y;if(n<0||n>=8192||i<0||i>=8192)continue;const r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=r.vertexLength;wa(this.layoutVertexArray,n,i,-1,-1),wa(this.layoutVertexArray,n,i,1,-1),wa(this.layoutVertexArray,n,i,1,1),wa(this.layoutVertexArray,n,i,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),r.vertexLength+=4,r.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},i)}}function Ca(t,e){for(let n=0;n1){if(Ea(t,e))return!0;for(let i=0;i1?n:n.sub(e)._mult(r)._add(e))}function Oa(t,e){let n,i,r,o=!1;for(let a=0;ae.y!=r.y>e.y&&e.x<(r.x-i.x)*(e.y-i.y)/(r.y-i.y)+i.x&&(o=!o)}return o}function Da(t,e){let n=!1;for(let i=0,r=t.length-1;ie.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function za(t,e,n,i,o){for(const r of t)if(e<=r.x&&n<=r.y&&i>=r.x&&o>=r.y)return!0;const a=[new r(e,n),new r(e,o),new r(i,o),new r(i,n)];if(t.length>2)for(const e of a)if(Da(t,e))return!0;for(let e=0;er.x&&e.x>r.x||t.yr.y&&e.y>r.y)return!1;const o=I(t,e,n[0]);return o!==I(t,e,n[1])||o!==I(t,e,n[2])||o!==I(t,e,n[3])}function La(t,e,n){const i=e.paint.get(t).value;return"constant"===i.kind?i.value:n.programConfigurations.get(e.id).getMaxValue(t)}function Fa(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ba(t,e,n,i,o){if(!e[0]&&!e[1])return t;const a=r.convert(e)._mult(o);"viewport"===n&&a._rotate(-i);const s=[];for(let e=0;e0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function ns(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function is(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=r*l-o*s,t[1]=o*a-i*l,t[2]=i*s-r*a,t}function rs(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[3]*i+n[7]*r+n[11]*o+n[15];return t[0]=(n[0]*i+n[4]*r+n[8]*o+n[12])/(a=a||1),t[1]=(n[1]*i+n[5]*r+n[9]*o+n[13])/a,t[2]=(n[2]*i+n[6]*r+n[10]*o+n[14])/a,t}function os(t,e,n){var i=n[0],r=n[1],o=n[2],a=e[0],s=e[1],l=e[2],c=r*l-o*s,u=o*a-i*l,h=i*s-r*a,d=r*h-o*u,f=o*c-i*h,p=i*u-r*c,m=2*n[3];return u*=m,h*=m,f*=2,p*=2,t[0]=a+(c*=m)+(d*=2),t[1]=s+u+f,t[2]=l+h+p,t}var as,ss=Ja,ls=Wa;function cs(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*o+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*o+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*o+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*o+n[15]*a,t}function us(){var t=new Ua(4);return Ua!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function hs(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function ds(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+a*s,t[1]=r*l+o*s,t[2]=o*l-r*s,t[3]=a*l-i*s,t}Ha(),as=new Ua(4),Ua!=Float32Array&&(as[0]=0,as[1]=0,as[2]=0,as[3]=0),Ha(),Ya(1,0,0),Ya(0,1,0),us(),us(),Va();class fs{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(t,e,n){const i=Math.pow(2,n),r=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(n=>{const r=cs([],n,t),o=1/r[3]/e*i;return function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}(r,r,[o,o,1/r[3],o])}),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(t=>{const e=es([],is([],ss([],r[t[0]],r[t[1]]),ss([],r[t[2]],r[t[1]]))),n=-ns(e,r[t[1]]);return e.concat(n)});return new fs(r,o)}}class ps{constructor(t,e){this.min=t,this.max=e,this.center=Qa([],Ka([],this.min,this.max),.5)}quadrant(t){const e=[t%2==0,t<2],n=Xa(this.min),i=Xa(this.max);for(let t=0;t=0;if(0===s)return 0;s!==e.length&&(n=!1)}var i,r;if(n)return 2;for(let e=0;e<3;e++){let n=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;rthis.max[e]-this.min[e])return 0}return 1}}function ms(t,e,n){const i=cs([],[t.x,t.y,e,1],n);return new r(i[0]/i[3],i[1]/i[3])}const gs=Ya(0,0,0),_s=Ya(0,0,1);function vs(t,e){const n=Ha();return gs[2]=e,t.intersectsPlane(gs,_s,n),new r(n[0],n[1])}class ys extends Ta{}function xs(t,{width:e,height:n},i,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==e*n*i)throw new RangeError("mismatched image size")}else r=new Uint8Array(e*n*i);return t.width=e,t.height=n,t.data=r,t}function bs(t,{width:e,height:n},i){if(e===t.width&&n===t.height)return;const r=xs({},{width:e,height:n},i);ws(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,n)},i),t.width=e,t.height=n,t.data=r.data}function ws(t,e,n,i,r,o){if(0===r.width||0===r.height)return e;if(r.width>t.width||r.height>t.height||n.x>t.width-r.width||n.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>e.width||r.height>e.height||i.x>e.width-r.width||i.y>e.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;for(let l=0;l{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);r.data[n+i+0]=Math.floor(255*a.r/a.a),r.data[n+i+1]=Math.floor(255*a.g/a.a),r.data[n+i+2]=Math.floor(255*a.b/a.a),r.data[n+i+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,r=0;e80*n){i=o=t[0],r=a=t[1];for(var p=n;po&&(o=s),l>a&&(a=l);c=0!==(c=Math.max(o-i,a-r))?1/c:0}return Rs(d,f,n,i,r,c),f}function Ds(t,e,n,i,r){var o,a;if(r===il(t,e,n,i)>0)for(o=e;o=e;o-=i)a=tl(o,t[o],t[o+1],a);return a&&Xs(a,a.next)&&(el(a),a=a.next),a}function zs(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!Xs(i,i.next)&&0!==Hs(i.prev,i,i.next))i=i.next;else{if(el(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function Rs(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=Vs(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,l,c=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,o);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?Fs(t,i,r,o):Ls(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),el(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Rs(t=Bs(zs(t),e,n),e,n,i,r,o,2):2===a&&Ns(t,e,n,i,r,o):Rs(zs(t),e,n,i,r,o,1);break}}}function Ls(t){var e=t.prev,n=t,i=t.next;if(Hs(e,n,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Zs(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Hs(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Fs(t,e,n,i){var r=t.prev,o=t,a=t.next;if(Hs(r,o,a)>=0)return!1;for(var s=r.x>o.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,l=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,c=Vs(r.x=c&&d&&d.z<=u;){if(h!==t.prev&&h!==t.next&&Zs(r.x,r.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Hs(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,d!==t.prev&&d!==t.next&&Zs(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Hs(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;h&&h.z>=c;){if(h!==t.prev&&h!==t.next&&Zs(r.x,r.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Hs(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;d&&d.z<=u;){if(d!==t.prev&&d!==t.next&&Zs(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Hs(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function Bs(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!Xs(r,o)&&Ws(r,i,i.next,o)&&Js(r,o)&&Js(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),el(i),el(i.next),i=t=o),i=i.next}while(i!==t);return zs(i)}function Ns(t,e,n,i,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Gs(a,s)){var l=Qs(a,s);return a=zs(a,a.next),l=zs(l,l.next),Rs(a,e,n,i,r,o),void Rs(l,e,n,i,r,o)}s=s.next}a=a.next}while(a!==t)}function $s(t,e){return t.x-e.x}function js(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=u&&r!==i.x&&Zs(on.x||i.x===n.x&&Us(n,i)))&&(n=i,d=l)),i=i.next}while(i!==c);return n}(t,e)){var n=Qs(e,t);zs(e,e.next),zs(n,n.next)}}function Us(t,e){return Hs(t.prev,t,e.prev)<0&&Hs(e.next,t,t.next)<0}function Vs(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qs(t){var e=t,n=t;do{(e.x=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function Gs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Ws(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Js(t,e)&&Js(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(Hs(t.prev,t,e.prev)||Hs(t,e.prev,e))||Xs(t,e)&&Hs(t.prev,t,t.next)>0&&Hs(e.prev,e,e.next)>0)}function Hs(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Xs(t,e){return t.x===e.x&&t.y===e.y}function Ws(t,e,n,i){var r=Ks(Hs(t,e,n)),o=Ks(Hs(t,e,i)),a=Ks(Hs(n,i,t)),s=Ks(Hs(n,i,e));return r!==o&&a!==s||!(0!==r||!Ys(t,n,e))||!(0!==o||!Ys(t,i,e))||!(0!==a||!Ys(n,t,i))||!(0!==s||!Ys(n,e,i))}function Ys(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Ks(t){return t>0?1:t<0?-1:0}function Js(t,e){return Hs(t.prev,t,t.next)<0?Hs(t,e,t.next)>=0&&Hs(t,t.prev,e)>=0:Hs(t,e,t.prev)<0||Hs(t,t.next,e)<0}function Qs(t,e){var n=new nl(t.i,t.x,t.y),i=new nl(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function tl(t,e,n,i){var r=new nl(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function el(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function nl(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function il(t,e,n,i){for(var r=0,o=e,a=n-i;oi;){if(r-i>600){var a=r-i+1,s=n-i+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);t(e,n,Math.max(i,Math.floor(n-s*c/a+u)),Math.min(r,Math.floor(n+(a-s)*c/a+u)),o)}var h=e[n],d=i,f=r;for(ol(e,i,n),o(e[r],h)>0&&ol(e,i,r);d0;)f--}0===o(e[i],h)?ol(e,i,f):ol(e,++f,r),f<=n&&(i=f+1),n<=f&&(r=f-1)}}(t,e,n||0,i||t.length-1,r||al)}function ol(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function al(t,e){return te?1:0}function sl(t,e){const n=t.length;if(n<=1)return[t];const i=[];let r,o;for(let e=0;e1)for(let t=0;t0&&n.holes.push(i+=t[r-1].length)}return n},Ps.default=Is;class hl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new uo,this.indexArray=new To,this.indexArray2=new Ao,this.programConfigurations=new ha(t.layers,t.zoom),this.segments=new _a,this.segments2=new _a,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,n){this.hasPattern=cl("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),r=[];for(const{feature:o,id:a,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=ba(o,t);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),c,n))continue;const u=i?i.evaluate(c,{},n,e.availableImages):void 0,h={id:a,properties:o.properties,type:o.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:xa(o),patterns:{},sortKey:u};r.push(h)}i&&r.sort((t,e)=>t.sortKey-e.sortKey);for(const i of r){const{geometry:r,index:o,sourceLayerIndex:a}=i;if(this.hasPattern){const t=ul("fill",this.layers,i,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(i,r,o,n,{});e.featureIndex.insert(t[o].feature,r,o,a,this.index)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}addFeatures(t,e,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,As),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,n,i,r){for(const t of sl(e,500)){let e=0;for(const n of t)e+=n.length;const n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),i=n.vertexLength,r=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(r.length/2);const n=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),i=n.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(i+e.length-1,i),r.push(e[0].x),r.push(e[0].y);for(let t=1;t>3}if(o--,1===i||2===i)a+=t.readSVarint(),s+=t.readSVarint(),1===i&&(e&&l.push(e),e=[]),e.push(new r(a,s));else{if(7!==i)throw new Error("unknown command "+i);e&&e.push(e[0].clone())}}return e&&l.push(e),l},vl.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,i=0,r=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;t.pos>3}if(i--,1===n||2===n)(r+=t.readSVarint())s&&(s=r),(o+=t.readSVarint())c&&(c=o);else if(7!==n)throw new Error("unknown command "+n)}return[a,l,s,c]},vl.prototype.toGeoJSON=function(t,e,n){var i,r,o=this.extent*Math.pow(2,n),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),c=vl.types[this.type];function u(t){for(var e=0;e>3;e=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return e}(n))}function Cl(t,e,n){if(3===t){var i=new bl(n,n.readVarint()+n.pos);i.length&&(e[i.name]=i)}}wl.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new _l(this._pbf,e,this.extent,this._keys,this._values)};var Sl={VectorTile:function(t,e){this.layers=t.readFields(Cl,{},e)},VectorTileFeature:_l,VectorTileLayer:bl};const kl=Sl.VectorTileFeature.types,Ml=Math.pow(2,13);function El(t,e,n,i,r,o,a,s){t.emplaceBack((e<<1)+a,(n<<1)+o,(Math.floor(i*Ml)<<1)+r,Math.round(s))}class Al{constructor(){this.acc=new r(0,0),this.polyCount=[]}startRing(t){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new r(t.x,t.y),this.max=new r(t.x,t.y))}append(t,e){this.currentPolyCount.edges++,this.acc._add(t);let n=!!this.borders;const i=this.min,r=this.max;t.xr.x&&(r.x=t.x,n=!0),t.yr.y&&(r.y=t.y,n=!0),((0===t.x||8192===t.x)&&t.x===e.x)!=((0===t.y||8192===t.y)&&t.y===e.y)&&this.processBorderOverlap(t,e),n&&this.checkBorderIntersection(t,e)}checkBorderIntersection(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,Qe(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>8192!=t.x>8192&&this.addBorderIntersection(1,Qe(e.y,t.y,(8192-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,Qe(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>8192!=t.y>8192&&this.addBorderIntersection(3,Qe(e.x,t.x,(8192-e.y)/(t.y-e.y)))}addBorderIntersection(t,e){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[t];en[1]&&(n[1]=e)}processBorderOverlap(t,e){if(t.x===e.x){if(t.y===e.y)return;const n=0===t.x?0:1;this.addBorderIntersection(n,e.y),this.addBorderIntersection(n,t.y)}else{const n=0===t.y?2:3;this.addBorderIntersection(n,e.x),this.addBorderIntersection(n,t.x)}}centroid(){const t=this.polyCount.reduce((t,e)=>t+e.edges,0);return 0!==t?this.acc.div(t)._round():new r(0,0)}span(){return new r(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((t,e)=>t+ +(e[0]!==Number.MAX_VALUE),0)}}class Pl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ho,this.centroidVertexArray=new Vo,this.indexArray=new To,this.programConfigurations=new ha(t.layers,t.zoom),this.segments=new _a,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.enableTerrain=t.enableTerrain}populate(t,e,n){this.features=[],this.hasPattern=cl("fill-extrusion",this.layers,e),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(t){const e=Math.exp(Math.PI*(1-t.y/(1<t.x<=0)||a.every(t=>t.x>=8192)||a.every(t=>t.y<=0)||a.every(t=>t.y>=8192))continue;for(let t=0;t=1){const n=r[t-1];if(!Il(e,n)){o&&o.append(e,n),i.vertexLength+4>_a.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=e.sub(n)._perp(),r=t.x/(Math.abs(t.x)+Math.abs(t.y)),s=t.y>0?1:0,l=n.dist(e);a+l>32768&&(a=0),El(this.layoutVertexArray,e.x,e.y,r,s,0,0,a),El(this.layoutVertexArray,e.x,e.y,r,s,0,1,a),a+=l,El(this.layoutVertexArray,n.x,n.y,r,s,0,0,a),El(this.layoutVertexArray,n.x,n.y,r,s,0,1,a);const c=i.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),i.vertexLength+=4,i.primitiveLength+=2}}}}if(i.vertexLength+e>_a.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==kl[t.type])continue;const r=[],s=[],l=i.vertexLength;for(let t=0;t0){if(o.borders){o.vertexArrayOffset=this.centroidVertexArray.length;const t=o.borders,e=this.featuresOnBorder.push(o)-1;for(let n=0;n<4;n++)t[n][0]!==Number.MAX_VALUE&&this.borders[n].push(e)}this.encodeCentroid(o.borders?void 0:o.centroid(),o)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,r,i)}sortBorders(){for(let t=0;t<4;t++)this.borders[t].sort((e,n)=>this.featuresOnBorder[e].borders[t][0]-this.featuresOnBorder[n].borders[t][0])}encodeCentroid(t,e,n=!0){let i,r;if(t)if(0!==t.y){const n=e.span()._mult(this.tileToMeter);i=(Math.max(t.x,1)<<3)+Math.min(7,Math.round(n.x/10)),r=(Math.max(t.y,1)<<3)+Math.min(7,Math.round(n.y/10))}else i=Math.ceil(7.3*t.x),r=0;else i=0,r=+n;let o=n?this.centroidVertexArray.length:e.vertexArrayOffset;for(const t of e.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*t.edges+t.top);for(let e=0;e<2*t.edges;e++)this.centroidVertexArray.emplace(o++,0,r),this.centroidVertexArray.emplace(o++,i,r);for(let e=0;e8192)||t.y===e.y&&(t.y<0||t.y>8192)}Hi("FillExtrusionBucket",Pl,{omit:["layers","features"]}),Hi("PartMetadata",Al);var Ol={paint:new io({"fill-extrusion-opacity":new Jr(Ft["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Qr(Ft["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Jr(Ft["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Jr(Ft["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new to(Ft["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Qr(Ft["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Qr(Ft["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Jr(Ft["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Dl(t,e){return t.x*e.x+t.y*e.y}function zl(t,e){if(1===t.length){let n=0;const i=e[n++];let r;for(;!r||i.equals(r);)if(r=e[n++],!r)return 1/0;for(;nt.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new fo,this.layoutVertexArray2=new po,this.indexArray=new To,this.programConfigurations=new ha(t.layers,t.zoom),this.segments=new _a,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,n){this.hasPattern=cl("line",this.layers,e);const i=this.layers[0].layout.get("line-sort-key"),r=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,l=ba(e,t);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),l,n))continue;const c=i?i.evaluate(l,{},n):void 0,u={id:o,properties:e.properties,type:e.type,sourceLayerIndex:s,index:a,geometry:t?l.geometry:xa(e),patterns:{},sortKey:c};r.push(u)}i&&r.sort((t,e)=>t.sortKey-e.sortKey);for(const i of r){const{geometry:r,index:o,sourceLayerIndex:a}=i;if(this.hasPattern){const t=ul("line",this.layers,i,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(i,r,o,n,{});e.featureIndex.insert(t[o].feature,r,o,a,this.index)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}addFeatures(t,e,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,$l)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Bl),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,n,i,r){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap"),l=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const n of e)this.addLine(n,t,a,s,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,r,i)}addLine(t,e,n,i,r,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e=2&&t[s-1].equals(t[s-2]);)s--;let l=0;for(;l0;if(b&&e>l){const t=h.dist(d);if(t>2*c){const e=h.sub(h.sub(d)._mult(c/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,p,0,0,u),d=e}}const T=d&&f;let C=T?n:a?"butt":i;if(T&&"round"===C&&(yr&&(C="bevel"),"bevel"===C&&(y>2&&(C="flipbevel"),y100)g=m.mult(-1);else{const t=y*p.add(m).mag()/p.sub(m).mag();g._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(h,g,0,0,u),this.addCurrentVertex(h,g.mult(-1),0,0,u)}else if("bevel"===C||"fakeround"===C){const t=-Math.sqrt(y*y-1),e=w?t:0,n=w?0:t;if(d&&this.addCurrentVertex(h,p,e,n,u),"fakeround"===C){const t=Math.round(180*x/Math.PI/20);for(let e=1;e2*c){const e=h.add(f.sub(h)._mult(c/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,m,0,0,u),h=e}}}}addCurrentVertex(t,e,n,i,r,o=!1){const a=e.y*i-e.x,s=-e.y-e.x*i;this.addHalfVertex(t,e.x+e.y*n,e.y-e.x*n,o,!1,n,r),this.addHalfVertex(t,a,s,o,!0,-i,r)}addHalfVertex({x:t,y:e},n,i,r,o,a,s){this.layoutVertexArray.emplaceBack((t<<1)+(r?1:0),(e<<1)+(o?1:0),Math.round(63*n)+128,Math.round(63*i)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length);const l=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),s.primitiveLength++),o?this.e2=l:this.e1=l}updateScaledDistance(){if(this.lineClips){const t=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}Hi("LineBucket",Vl,{omit:["layers","patternFeatures"]});const ql=new io({"line-cap":new Jr(Ft.layout_line["line-cap"]),"line-join":new Qr(Ft.layout_line["line-join"]),"line-miter-limit":new Jr(Ft.layout_line["line-miter-limit"]),"line-round-limit":new Jr(Ft.layout_line["line-round-limit"]),"line-sort-key":new Qr(Ft.layout_line["line-sort-key"])});var Zl={paint:new io({"line-opacity":new Qr(Ft.paint_line["line-opacity"]),"line-color":new Qr(Ft.paint_line["line-color"]),"line-translate":new Jr(Ft.paint_line["line-translate"]),"line-translate-anchor":new Jr(Ft.paint_line["line-translate-anchor"]),"line-width":new Qr(Ft.paint_line["line-width"]),"line-gap-width":new Qr(Ft.paint_line["line-gap-width"]),"line-offset":new Qr(Ft.paint_line["line-offset"]),"line-blur":new Qr(Ft.paint_line["line-blur"]),"line-dasharray":new eo(Ft.paint_line["line-dasharray"]),"line-pattern":new to(Ft.paint_line["line-pattern"]),"line-gradient":new no(Ft.paint_line["line-gradient"])}),layout:ql};const Gl=new class extends Qr{possiblyEvaluate(t,e){return e=new Vr(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,n,i){return e=y({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,n,i)}}(Zl.paint.properties["line-width"].specification);function Hl(t,e){return e>0?e+2*t:t}Gl.useIntegerZoom=!0;const Xl=lo([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Wl=lo([{name:"a_projected_pos",components:3,type:"Float32"}],4),Yl=(lo([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),lo([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Kl=lo([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]),Jl=(lo([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),lo([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Ql=lo([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function tc(t,e){const{expression:n}=e;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new Vr(t+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:i}=n;let r=0;for(;r{t.text=function(t,e,n){const i=e.layout.get("text-transform").evaluate(n,{});return"uppercase"===i?t=t.toLocaleUpperCase():"lowercase"===i&&(t=t.toLocaleLowerCase()),Ur.applyArabicShaping&&(t=Ur.applyArabicShaping(t)),t}(t.text,e,n)}),t}const oc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ac=function(t,e,n,i,r){var o,a,s=8*r-i-1,l=(1<>1,u=-7,h=n?r-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+t[e+h],h+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=i;u>0;a=256*a+t[e+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),o-=c}return(f?-1:1)*a*Math.pow(2,o-i)},sc=function(t,e,n,i,r,o){var a,s,l,c=8*o-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=u?(s=0,a=u):a+h>=1?(s=(e*l-1)*Math.pow(2,r),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;t[n+f]=255&s,f+=p,s/=256,r-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*m},lc=cc;function cc(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}cc.Varint=0,cc.Fixed64=1,cc.Bytes=2,cc.Fixed32=5;var uc="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function hc(t){return t.type===cc.Bytes?t.readVarint()+t.pos:t.pos+1}function dc(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function fc(t,e,n){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(i);for(var r=n.pos-1;r>=t;r--)n.buf[r+i]=n.buf[r]}function pc(t,e){for(var n=0;n>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Sc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function kc(t,e,n){1===t&&n.readMessage(Mc,e)}function Mc(t,e,n){if(3===t){const{id:t,bitmap:i,width:r,height:o,left:a,top:s,advance:l}=n.readMessage(Ec,{});e.push({id:t,bitmap:new Ts({width:r+6,height:o+6},i),metrics:{width:r,height:o,left:a,top:s,advance:l}})}}function Ec(t,e,n){1===t?e.id=n.readVarint():2===t?e.bitmap=n.readBytes():3===t?e.width=n.readVarint():4===t?e.height=n.readVarint():5===t?e.left=n.readSVarint():6===t?e.top=n.readSVarint():7===t&&(e.advance=n.readVarint())}function Ac(t){let e=0,n=0;for(const i of t)e+=i.w*i.h,n=Math.max(n,i.w);t.sort((t,e)=>e.h-t.h);const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}];let r=0,o=0;for(const e of t)for(let t=i.length-1;t>=0;t--){const n=i[t];if(!(e.w>n.w||e.h>n.h)){if(e.x=n.x,e.y=n.y,o=Math.max(o,e.y+e.h),r=Math.max(r,e.x+e.w),e.w===n.w&&e.h===n.h){const e=i.pop();t>3,o=this.pos;this.type=7&i,t(r,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Tc(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Sc(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Tc(this.buf,this.pos)+4294967296*Tc(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Tc(this.buf,this.pos)+4294967296*Sc(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=ac(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ac(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,i=this.buf;return e=127&(n=i[this.pos++]),n<128?e:(e|=(127&(n=i[this.pos++]))<<7,n<128?e:(e|=(127&(n=i[this.pos++]))<<14,n<128?e:(e|=(127&(n=i[this.pos++]))<<21,n<128?e:function(t,e,n){var i,r,o=n.buf;if(i=(112&(r=o[n.pos++]))>>4,r<128)return dc(t,i,e);if(i|=(127&(r=o[n.pos++]))<<3,r<128)return dc(t,i,e);if(i|=(127&(r=o[n.pos++]))<<10,r<128)return dc(t,i,e);if(i|=(127&(r=o[n.pos++]))<<17,r<128)return dc(t,i,e);if(i|=(127&(r=o[n.pos++]))<<24,r<128)return dc(t,i,e);if(i|=(1&(r=o[n.pos++]))<<31,r<128)return dc(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&uc?function(t,e,n){return uc.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){for(var i="",r=e;r239?4:l>223?3:l>191?2:1;if(r+u>n)break;1===u?l<128&&(c=l):2===u?128==(192&(o=t[r+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(a=t[r+2],128==(192&(o=t[r+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(a=t[r+2],s=t[r+3],128==(192&(o=t[r+1]))&&128==(192&a)&&128==(192&s)&&((c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,i+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),i+=String.fromCharCode(c),r+=u}return i}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==cc.Bytes)return t.push(this.readVarint(e));var n=hc(this);for(t=t||[];this.pos127;);else if(e===cc.Bytes)this.pos=this.readVarint()+this.pos;else if(e===cc.Fixed32)this.pos+=4;else{if(e!==cc.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var n,i;if(t>=0?(n=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,n.buf[n.pos]=127&(t>>>=7)}(n,0,e),function(t,e){var n=(7&t)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,n){for(var i,r,o=0;o55295&&i<57344){if(!r){i>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):r=i;continue}if(i<56320){t[n++]=239,t[n++]=191,t[n++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[n++]=239,t[n++]=191,t[n++]=189,r=null);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(i<65536?t[n++]=i>>12|224:(t[n++]=i>>18|240,t[n++]=i>>12&63|128),t[n++]=i>>6&63|128),t[n++]=63&i|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&fc(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),sc(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),sc(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n=128&&fc(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,e,n){this.writeTag(t,cc.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,pc,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,mc,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,vc,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,gc,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,_c,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,yc,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,xc,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,bc,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,wc,e)},writeBytesField:function(t,e){this.writeTag(t,cc.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,cc.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,cc.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,cc.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,cc.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,cc.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,cc.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,cc.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,cc.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,cc.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class Pc{constructor(t,{pixelRatio:e,version:n,stretchX:i,stretchY:r,content:o}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=i,this.stretchY=r,this.content=o,this.version=n}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Ic{constructor(t,e){const n={},i={};this.haveRenderCallbacks=[];const r=[];this.addImages(t,n,r),this.addImages(e,i,r);const{w:o,h:a}=Ac(r),s=new Cs({width:o||1,height:a||1});for(const e in t){const i=t[e],r=n[e].paddedRect;Cs.copy(i.data,s,{x:0,y:0},{x:r.x+1,y:r.y+1},i.data)}for(const t in e){const n=e[t],r=i[t].paddedRect,o=r.x+1,a=r.y+1,l=n.data.width,c=n.data.height;Cs.copy(n.data,s,{x:0,y:0},{x:o,y:a},n.data),Cs.copy(n.data,s,{x:0,y:c-1},{x:o,y:a-1},{width:l,height:1}),Cs.copy(n.data,s,{x:0,y:0},{x:o,y:a+c},{width:l,height:1}),Cs.copy(n.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:c}),Cs.copy(n.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:c})}this.image=s,this.iconPositions=n,this.patternPositions=i}addImages(t,e,n){for(const i in t){const r=t[i],o={x:0,y:0,w:r.data.width+2,h:r.data.height+2};n.push(o),e[i]=new Pc(o,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),e),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),e)}patchUpdatedImage(t,e,n){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[i,r]=t.tl;n.update(e.data,void 0,{x:i,y:r})}}Hi("ImagePosition",Pc),Hi("ImageAtlas",Ic);const Oc={horizontal:1,vertical:2,horizontalOnly:3};class Dc{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const n=new Dc;return n.scale=t||1,n.fontStack=e,n}static forImage(t){const e=new Dc;return e.imageName=t,e}}class zc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const n=new zc;for(let i=0;i=0&&n>=t&&Lc[this.text.charCodeAt(n)];n--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const n=new zc;return n.text=this.text.substring(t,e),n.sectionIndex=this.sectionIndex.slice(t,e),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,e)=>Math.max(t,this.sections[e].scale),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Dc.forText(t.scale,t.fontStack||e));const n=this.sections.length-1;for(let e=0;e=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Rc(t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m){const g=zc.fromFeature(t,r);let _;h===Oc.vertical&&g.verticalizePunctuation();const{processBidirectionalText:v,processStyledBidirectionalText:y}=Ur;if(v&&1===g.sections.length){_=[];const t=v(g.toString(),Uc(g,c,o,e,i,f,p));for(const e of t){const t=new zc;t.text=e,t.sections=g.sections;for(let n=0;n0&&o>b&&(b=o)}else{const t=n[p.fontStack],i=t&&t[g];if(i&&i.rect)w=i.rect,y=i.metrics;else{const t=e[p.fontStack],n=t&&t[g];if(!n)continue;y=n.metrics}_=24*(r-p.scale)}S?(t.verticalizable=!0,x.push({glyph:g,imageName:T,x:d,y:f+_,vertical:S,scale:p.scale,localGlyph:y.localGlyph,fontStack:p.fontStack,sectionIndex:m,metrics:y,rect:w}),d+=C*p.scale+c):(x.push({glyph:g,imageName:T,x:d,y:f+_,vertical:S,scale:p.scale,localGlyph:y.localGlyph,fontStack:p.fontStack,sectionIndex:m,metrics:y,rect:w}),d+=y.advance*p.scale+c)}0!==x.length&&(p=Math.max(d-c,p),qc(x,0,x.length-1,g,b)),d=0;const w=o*r+b;y.lineOffset=Math.max(b,s),f+=w,m=Math.max(w,m),++_}var v;const y=f- -17,{horizontalAlign:x,verticalAlign:b}=Vc(a);(function(t,e,n,i,r,o,a,s,l){const c=(e-n)*r;let u=0;u=o!==a?-s*i- -17:(-i*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=u})(t.positionedLines,g,x,b,p,m,o,y,r.length),t.top+=-b*y,t.bottom=t.top+y,t.left+=-x*p,t.right=t.left+p}(b,e,n,i,_,a,s,l,h,c,d,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(x)&&b}const Lc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Fc={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Bc(t,e,n,i,r,o){if(e.imageName){const t=i[e.imageName];return t?t.displaySize[0]*e.scale*24/o+r:0}{const i=n[e.fontStack],o=i&&i[t];return o?o.metrics.advance*e.scale+r:0}}function Nc(t,e,n,i){const r=Math.pow(t-e,2);return i?t=0;let u=0;for(let n=0;n-n/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let c=0;for(;si;)c-=l.shift().angleDelta;if(c>r)return!1;a++,s+=e.dist(n)}return!0}function Wc(t){let e=0;for(let n=0;nc){const u=(c-l)/o,h=Qe(i.x,r.x,u),d=Qe(i.y,r.y,u),f=new Hc(h,d,r.angleTo(i),n);return f._round(),!a||Xc(t,f,s,a,e)?f:void 0}l+=o}}function Qc(t,e,n,i,r,o,a,s,l){const c=Yc(i,o,a),u=Kc(i,r),h=u*a,d=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&_=0&&v=0&&f+u<=h){const n=new Hc(_,v,m,t);n._round(),r&&!Xc(e,n,a,r,o)||p.push(n)}}d+=l}return l||p.length||s||(p=t(e,d/2,i,r,o,a,s,!0,c)),p}(t,d?e/2*s%e:(u/2+2*o)*a*s%e,e,c,n,h,d,!1,l)}function tu(t,e,n,i,o){const a=[];for(let s=0;s=i&&u.x>=i||(s.x>=i?s=new r(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=i&&(u=new r(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=o&&u.y>=o||(s.y>=o?s=new r(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round():u.y>=o&&(u=new r(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round()),c&&s.equals(c[c.length-1])||(c=[s],a.push(c)),c.push(u)))))}}return a}Hi("Anchor",Hc);var eu=ru,nu=ru,iu=1e20;function ru(t,e,n,i,r,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=i||.25,this.fontFamily=r||"sans-serif",this.fontWeight=o||"normal",this.radius=n||8;var a=this.size=this.fontSize+2*this.buffer,s=a+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function ou(t,e,n,i,r,o){for(var a=0;a-1);o[++l]=s,a[l]=c,a[l+1]=iu}for(s=0,l=0;s{let i=this.entries[t];i||(i=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=i.glyphs[e];if(void 0!==r)return void n(null,{stack:t,id:e,glyph:r});if(r=this._tinySDF(i,t,e),r)return i.glyphs[e]=r,void n(null,{stack:t,id:e,glyph:r});const o=Math.floor(e/256);if(256*o>65535)return void n(new Error("glyphs > 65535 not supported"));if(i.ranges[o])return void n(null,{stack:t,id:e,glyph:r});let a=i.requests[o];a||(a=i.requests[o]=[],lu.loadGlyphRange(t,o,this.url,this.requestManager,(t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(i.glyphs[+t]=e[+t]);i.ranges[o]=!0}for(const n of a)n(t,e);delete i.requests[o]})),a.push((i,r)=>{i?n(i):r&&n(null,{stack:t,id:e,glyph:r[e]||null})})},(t,n)=>{if(t)e(t);else if(n){const t={};for(const{stack:e,id:i,glyph:r}of n)(t[e]||(t[e]={}))[i]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics};e(null,t)}})}_doesCharSupportLocalGlyph(t){return this.localGlyphMode!==su.none&&(this.localGlyphMode===su.all?!!this.localFontFamily:!!this.localFontFamily&&(mr(t)||vr(t)||ar(t)||sr(t)))}_tinySDF(t,e,n){const i=this.localFontFamily;if(!i)return;if(!this._doesCharSupportLocalGlyph(n))return;let r=t.tinySDF;if(!r){let n="400";/bold/i.test(e)?n="900":/medium/i.test(e)?n="500":/light/i.test(e)&&(n="200"),r=t.tinySDF=new lu.TinySDF(48,6,16,.25,i,n)}if(this.localGlyphs[r.fontWeight][n])return this.localGlyphs[r.fontWeight][n];const{data:o,metrics:a}=r.drawWithMetrics(String.fromCharCode(n)),{fontAscent:s,sdfWidth:l,sdfHeight:c,width:u,height:h,left:d,top:f,advance:p}=a,m=(s?s/2:17)-9;return this.localGlyphs[r.fontWeight][n]={id:n,bitmap:new Ts({width:l,height:c},o),metrics:{width:u/2,height:h/2,left:d/2,top:f/2-m,advance:p/2,localGlyph:!0}}}}function cu(t,e,n,i){const o=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2,u=t.right-t.left,h=t.bottom-t.top,d=a.stretchX||[[0,l]],f=a.stretchY||[[0,c]],p=(t,e)=>t+e[1]-e[0],m=d.reduce(p,0),g=f.reduce(p,0),_=l-m,v=c-g;let y=0,x=m,b=0,w=g,T=0,C=_,S=0,k=v;if(a.content&&i){const t=a.content;y=uu(d,0,t[0]),b=uu(f,0,t[1]),x=uu(d,t[0],t[2]),w=uu(f,t[1],t[3]),T=t[0]-y,S=t[1]-b,C=t[2]-t[0]-x,k=t[3]-t[1]-w}const M=(i,o,l,c)=>{const d=du(i.stretch-y,x,u,t.left),f=fu(i.fixed-T,C,i.stretch,m),p=du(o.stretch-b,w,h,t.top),_=fu(o.fixed-S,k,o.stretch,g),v=du(l.stretch-y,x,u,t.left),M=fu(l.fixed-T,C,l.stretch,m),E=du(c.stretch-b,w,h,t.top),A=fu(c.fixed-S,k,c.stretch,g),P=new r(d,p),I=new r(v,p),O=new r(v,E),D=new r(d,E),z=new r(f/s,_/s),R=new r(M/s,A/s),L=e*Math.PI/180;if(L){const t=Math.sin(L),e=Math.cos(L),n=[e,-t,t,e];P._matMult(n),I._matMult(n),D._matMult(n),O._matMult(n)}const F=i.stretch+i.fixed,B=o.stretch+o.fixed;return{tl:P,tr:I,bl:D,br:O,tex:{x:a.paddedRect.x+1+F,y:a.paddedRect.y+1+B,w:l.stretch+l.fixed-F,h:c.stretch+c.fixed-B},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:z,pixelOffsetBR:R,minFontScaleX:C/s/u,minFontScaleY:k/s/h,isSDF:n}};if(i&&(a.stretchX||a.stretchY)){const t=hu(d,_,m),e=hu(f,v,g);for(let n=0;n{if(t)r(t);else if(e){const t={};for(const n of function(t){return new lc(t).readFields(kc,[])}(e))t[n.id]=n;r(null,t)}})},lu.TinySDF=eu;class pu{constructor(t=[],e=mu){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,i=e[t];for(;t>0;){const r=t-1>>1,o=e[r];if(n(i,o)>=0)break;e[t]=o,t=r}e[t]=i}_down(t){const{data:e,compare:n}=this,i=this.length>>1,r=e[t];for(;t=0)break;e[t]=o,t=i}e[t]=r}}function mu(t,e){return te?1:0}function gu(t,e=1,n=!1){let i=1/0,o=1/0,a=-1/0,s=-1/0;const l=t[0];for(let t=0;ta)&&(a=e.x),(!t||e.y>s)&&(s=e.y)}const c=Math.min(a-i,s-o);let u=c/2;const h=new pu([],_u);if(0===c)return new r(i,o);for(let e=i;ed.d||!d.d)&&(d=n),n.max-d.d<=e||(u=n.h/2,h.push(new vu(n.p.x-u,n.p.y-u,u,t)),h.push(new vu(n.p.x+u,n.p.y-u,u,t)),h.push(new vu(n.p.x-u,n.p.y+u,u,t)),h.push(new vu(n.p.x+u,n.p.y+u,u,t)),f+=4)}return d.p}function _u(t,e){return e.max-t.max}function vu(t,e,n,i){this.p=new r(t,e),this.h=n,this.d=function(t,e){let n=!1,i=1/0;for(let r=0;rt.y!=s.y>t.y&&t.x<(s.x-r.x)*(t.y-r.y)/(s.y-r.y)+r.x&&(n=!n),i=Math.min(i,Ia(t,r,s))}}return(n?1:-1)*Math.sqrt(i)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}const yu=Number.POSITIVE_INFINITY;function xu(t,e){return e[1]!==yu?function(t,e,n){let i=0,r=0;switch(e=Math.abs(e),n=Math.abs(n),t){case"top-right":case"top-left":case"top":r=n-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-n}switch(t){case"top-right":case"bottom-right":case"right":i=-e;break;case"top-left":case"bottom-left":case"left":i=e}return[i,r]}(t,e[0],e[1]):function(t,e){let n=0,i=0;e<0&&(e=0);const r=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":i=r-7;break;case"bottom-right":case"bottom-left":i=7-r;break;case"bottom":i=7-e;break;case"top":i=e-7}switch(t){case"top-right":case"bottom-right":n=-r;break;case"top-left":case"bottom-left":n=r;break;case"left":n=e;break;case"right":n=-e}return[n,i]}(t,e[0])}function bu(t,e,n,i,r,o,a,s){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const l=t.layers[0].layout,c=t.layers[0]._unevaluatedLayout._values,u={};if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:n}=t.textSizeData;u.compositeTextSizes=[c["text-size"].possiblyEvaluate(new Vr(e),a),c["text-size"].possiblyEvaluate(new Vr(n),a)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:n}=t.iconSizeData;u.compositeIconSizes=[c["icon-size"].possiblyEvaluate(new Vr(e),a),c["icon-size"].possiblyEvaluate(new Vr(n),a)]}u.layoutTextSize=c["text-size"].possiblyEvaluate(new Vr(s+1),a),u.layoutIconSize=c["icon-size"].possiblyEvaluate(new Vr(s+1),a),u.textMaxSize=c["text-size"].possiblyEvaluate(new Vr(18),a);const h=24*l.get("text-line-height"),d="map"===l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),f=l.get("text-keep-upright"),p=l.get("text-size");for(const o of t.features){const s=l.get("text-font").evaluate(o,{},a).join(","),c=p.evaluate(o,{},a),m=u.layoutTextSize.evaluate(o,{},a),g=(u.layoutIconSize.evaluate(o,{},a),{horizontal:{},vertical:void 0}),_=o.text;let v,y=[0,0];if(_){const i=_.toString(),u=24*l.get("text-letter-spacing").evaluate(o,{},a),p=Mr(i)?u:0,v=l.get("text-anchor").evaluate(o,{},a),x=l.get("text-variable-anchor");if(!x){const t=l.get("text-radial-offset").evaluate(o,{},a);y=t?xu(v,[24*t,yu]):l.get("text-offset").evaluate(o,{},a).map(t=>24*t)}let b=d?"center":l.get("text-justify").evaluate(o,{},a);const w=l.get("symbol-placement"),T="point"===w?24*l.get("text-max-width").evaluate(o,{},a):0,C=()=>{t.allowVerticalPlacement&&kr(i)&&(g.vertical=Rc(_,e,n,r,s,T,h,v,"left",p,y,Oc.vertical,!0,w,m,c))};if(!d&&x){const t="auto"===b?x.map(t=>wu(t)):[b];let i=!1;for(let o=0;o{h.x<0||h.x>=8192||h.y<0||h.y>=8192||function(t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m,g,_,v,y,x,b,w,T,C){const S=t.addToLineVertexArray(e,n);let k,M,E,A,I,O,D,z=0,R=0,L=0,F=0,B=-1,N=-1;const $={};let j=Ho(""),U=0,V=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?[U,V]=s.layout.get("text-offset").evaluate(x,{},T).map(t=>24*t):(U=24*s.layout.get("text-radial-offset").evaluate(x,{},T),V=yu),t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(p)O=Mu(t),a&&(D=Mu(a));else{const n=s.layout.get("text-rotate").evaluate(x,{},T)+90;E=ku(l,e,c,u,h,t,0,f,n),a&&(A=ku(l,e,c,u,h,a,0,_,n))}}if(r){const n=s.layout.get("icon-rotate").evaluate(x,{},T),i="none"!==s.layout.get("icon-text-fit"),o=cu(r,n,w,i),d=a?cu(a,n,w,i):void 0;M=ku(l,e,c,u,h,r,0,_,n),z=4*o.length;const f=t.iconSizeData;let p=null;"source"===f.kind?(p=[128*s.layout.get("icon-size").evaluate(x,{},T)],p[0]>32640&&P(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===f.kind&&(p=[128*b.compositeIconSizes[0].evaluate(x,{},T),128*b.compositeIconSizes[1].evaluate(x,{},T)],(p[0]>32640||p[1]>32640)&&P(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')),t.addSymbols(t.icon,o,p,y,v,x,!1,e,S.lineStartIndex,S.lineLength,-1,T),B=t.icon.placedSymbolArray.length-1,d&&(R=4*d.length,t.addSymbols(t.icon,d,p,y,v,x,Oc.vertical,e,S.lineStartIndex,S.lineLength,-1,T),N=t.icon.placedSymbolArray.length-1)}for(const n in i.horizontal){const r=i.horizontal[n];k||(j=Ho(r.text),p?I=Mu(r):k=ku(l,e,c,u,h,r,0,f,s.layout.get("text-rotate").evaluate(x,{},T)));const a=1===r.positionedLines.length;if(L+=Cu(t,e,r,o,s,p,x,m,S,i.vertical?Oc.horizontal:Oc.horizontalOnly,a?Object.keys(i.horizontal):[n],$,B,b,T),a)break}i.vertical&&(F+=Cu(t,e,i.vertical,o,s,p,x,m,S,Oc.vertical,["vertical"],$,N,b,T));let q=-1;const Z=(t,e)=>t?Math.max(t,e):e;q=Z(I,q),q=Z(O,q),q=Z(D,q);const G=q>-1?1:0;G&&(q*=C/24),t.glyphOffsetArray.length>=Lu.MAX_GLYPHS&&P("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,$.right>=0?$.right:-1,$.center>=0?$.center:-1,$.left>=0?$.left:-1,$.vertical||-1,B,N,j,void 0!==k?k:t.collisionBoxArray.length,void 0!==k?k+1:t.collisionBoxArray.length,void 0!==E?E:t.collisionBoxArray.length,void 0!==E?E+1:t.collisionBoxArray.length,void 0!==M?M:t.collisionBoxArray.length,void 0!==M?M+1:t.collisionBoxArray.length,A||t.collisionBoxArray.length,A?A+1:t.collisionBoxArray.length,c,L,F,z,R,G,0,d,U,V,q)}(t,h,s,n,i,r,E,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,_,x,T,l,0,b,C,p,e,o,c,u,a)};if("line"===S)for(const r of tu(e.geometry,0,0,8192,8192)){const e=Qc(r,y,w,n.vertical||m,i,24,v,t.overscaling,8192);for(const n of e){const e=m;e&&Eu(t,e.text,k,n)||A(r,n)}}else if("line-center"===S){for(const t of e.geometry)if(t.length>1){const e=Jc(t,w,n.vertical||m,i,24,v);e&&A(t,e)}}else if("Polygon"===e.type)for(const t of sl(e.geometry,0)){const e=gu(t,16);A(t[0],new Hc(e.x,e.y,0))}else if("LineString"===e.type)for(const t of e.geometry)A(t,new Hc(t[0].x,t[0].y,0));else if("Point"===e.type)for(const t of e.geometry)for(const e of t)A([e],new Hc(e.x,e.y,0))}function Cu(t,e,n,i,o,a,s,l,c,u,h,d,f,p,m){const g=function(t,e,n,i,o,a,s,l){const c=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(const t of e.positionedLines)for(const i of t.positionedGlyphs){if(!i.rect)continue;const a=i.rect||{};let h=4,d=!0,f=1,p=0;const m=(o||l)&&i.vertical,g=i.metrics.advance*i.scale/2;if(l&&e.verticalizable){const e=24*(i.scale-1),n=(24-i.metrics.width*i.scale)/2;p=t.lineOffset/2-(i.imageName?-n:e)}if(i.imageName){const t=s[i.imageName];d=t.sdf,f=t.pixelRatio,h=1/f}const _=o?[i.x+g,i.y]:[0,0];let v=o?[0,0]:[i.x+g+n[0],i.y+n[1]-p],y=[0,0];m&&(y=v,v=[0,0]);const x=(i.metrics.left-h)*i.scale-g+v[0],b=(-i.metrics.top-h)*i.scale+v[1],w=x+a.w*i.scale/(f*(i.localGlyph?2:1)),T=b+a.h*i.scale/(f*(i.localGlyph?2:1)),C=new r(x,b),S=new r(w,b),k=new r(x,T),M=new r(w,T);if(m){const t=new r(-g,g- -17),e=-Math.PI/2,n=12-g,o=new r(22-n,-(i.imageName?n:0)),a=new r(...y);C._rotateAround(e,t)._add(o)._add(a),S._rotateAround(e,t)._add(o)._add(a),k._rotateAround(e,t)._add(o)._add(a),M._rotateAround(e,t)._add(o)._add(a)}if(c){const t=Math.sin(c),e=Math.cos(c),n=[e,-t,t,e];C._matMult(n),S._matMult(n),k._matMult(n),M._matMult(n)}const E=new r(0,0),A=new r(0,0);u.push({tl:C,tr:S,bl:k,br:M,tex:a,writingMode:e.writingMode,glyphOffset:_,sectionIndex:i.sectionIndex,isSDF:d,pixelOffsetTL:E,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,n,l,o,a,s,i,t.allowVerticalPlacement),_=t.textSizeData;let v=null;"source"===_.kind?(v=[128*o.layout.get("text-size").evaluate(s,{},m)],v[0]>32640&&P(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===_.kind&&(v=[128*p.compositeTextSizes[0].evaluate(s,{},m),128*p.compositeTextSizes[1].evaluate(s,{},m)],(v[0]>32640||v[1]>32640)&&P(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')),t.addSymbols(t.text,g,v,l,a,s,u,e,c.lineStartIndex,c.lineLength,f,m);for(const e of h)d[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function Su(t){for(const e in t)return t[e];return null}function ku(t,e,n,i,o,a,s,l,c){let u=a.top,d=a.bottom,f=a.left,p=a.right;const m=a.collisionPadding;if(m&&(f-=m[0],u-=m[1],p+=m[2],d+=m[3]),c){const t=new r(f,u),e=new r(p,u),n=new r(f,d),i=new r(p,d),o=h(c);t._rotate(o),e._rotate(o),n._rotate(o),i._rotate(o),f=Math.min(t.x,e.x,n.x,i.x),p=Math.max(t.x,e.x,n.x,i.x),u=Math.min(t.y,e.y,n.y,i.y),d=Math.max(t.y,e.y,n.y,i.y)}return t.emplaceBack(e.x,e.y,f,u,p,d,l,n,i,o),t.length-1}function Mu(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function Eu(t,e,n,i){const r=t.compareText;if(e in r){const t=r[e];for(let e=t.length-1;e>=0;e--)if(i.dist(t[e])t.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=qa([]),this.placementViewportMatrix=qa([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=tc(this.zoom,e["text-size"]),this.iconSizeData=tc(this.zoom,e["icon-size"]);const n=this.layers[0].layout,i=n.get("symbol-sort-key"),r=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==r&&void 0!==i.constantOr(1),this.sortFeaturesByY=("viewport-y"===r||"auto"===r&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map(t=>Oc[t])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.sourceID=t.sourceID}createArrays(){this.text=new zu(new ha(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new zu(new ha(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Bo,this.lineVertexArray=new No,this.symbolInstances=new Fo}calculateGlyphDependencies(t,e,n,i,r){for(let o=0;o0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,u=r.get("symbol-sort-key");if(this.features=[],!l&&!c)return;const h=e.iconDependencies,d=e.glyphDependencies,f=e.availableImages,p=new Vr(this.zoom);for(const{feature:e,id:a,index:s,sourceLayerIndex:m}of t){const t=i._featureFilter.needGeometry,g=ba(e,t);if(!i._featureFilter.filter(p,g,n))continue;let _,v;if(t||(g.geometry=xa(e)),l){const t=i.getValueAndResolveTokens("text-field",g,n,f),e=de.factory(t);Du(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===$r()||this.hasRTLText&&Ur.isParsed())&&(_=rc(e,i,g))}if(c){const t=i.getValueAndResolveTokens("icon-image",g,n,f);v=t instanceof fe?t:fe.fromString(t)}if(!_&&!v)continue;const y=this.sortFeaturesByKey?u.evaluate(g,{},n):void 0;if(this.features.push({id:a,text:_,icon:v,index:s,sourceLayerIndex:m,geometry:g.geometry,properties:e.properties,type:Au[e.type],sortKey:y}),v&&(h[v.name]=!0),_){const t=o.evaluate(g,{},n).join(","),e="map"===r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Oc.vertical)>=0;for(const n of _.sections)if(n.image)h[n.image.name]=!0;else{const i=kr(_.toString()),r=n.fontStack||t,o=d[r]=d[r]||{};this.calculateGlyphDependencies(n.text,o,e,this.allowVerticalPlacement,i)}}}"line"===r.get("symbol-placement")&&(this.features=function(t){const e={},n={},i=[];let r=0;function o(e){i.push(t[e]),r++}function a(t,e,r){const o=n[t];return delete n[t],n[e]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(r[0]),o}function s(t,n,r){const o=e[n];return delete e[n],e[t]=o,i[o].geometry[0].shift(),i[o].geometry[0]=r[0].concat(i[o].geometry[0]),o}function l(t,e,n){const i=n?e[0][e[0].length-1]:e[0][0];return`${t}:${i.x}:${i.y}`}for(let c=0;ct.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,e)=>t.sortKey-e.sortKey)}update(t,e,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const n=this.lineVertexArray.length;if(void 0!==t.segment){let n=t.dist(e[t.segment+1]),i=t.dist(e[t.segment]);const r={};for(let i=t.segment+1;i=0;n--)r[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:i},n>0&&(i+=e[n-1].dist(e[n]));for(let t=0;t=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:i),o=ec(this.textSizeData,t,r)/24;return this.tilePixelRatio*o}getSymbolInstanceIconSize(t,e,n){const i=this.icon.placedSymbolArray.get(n),r=ec(this.iconSizeData,t,i);return this.tilePixelRatio*r}_commitDebugCollisionVertexUpdate(t,e,n){t.emplaceBack(e,-n,-n),t.emplaceBack(e,n,-n),t.emplaceBack(e,n,n),t.emplaceBack(e,-n,n)}_updateTextDebugCollisionBoxes(t,e,n,i,r,o){for(let a=i;a0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const n=t.placedSymbolArray.get(e),i=n.vertexStartIndex+4*n.numGlyphs;for(let e=n.vertexStartIndex;ei[t]-i[e]||r[e]-r[t]),o}addToSortKeyRanges(t,e){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===e?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach((t,e,n)=>{t>=0&&n.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Hi("SymbolBucket",Lu,{omit:["layers","collisionBoxArray","features","compareText"]}),Lu.MAX_GLYPHS=65535,Lu.addDynamicAttributes=Ou;const Fu=new io({"symbol-placement":new Jr(Ft.layout_symbol["symbol-placement"]),"symbol-spacing":new Jr(Ft.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Jr(Ft.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Qr(Ft.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Jr(Ft.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Jr(Ft.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Jr(Ft.layout_symbol["icon-ignore-placement"]),"icon-optional":new Jr(Ft.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Jr(Ft.layout_symbol["icon-rotation-alignment"]),"icon-size":new Qr(Ft.layout_symbol["icon-size"]),"icon-text-fit":new Jr(Ft.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Jr(Ft.layout_symbol["icon-text-fit-padding"]),"icon-image":new Qr(Ft.layout_symbol["icon-image"]),"icon-rotate":new Qr(Ft.layout_symbol["icon-rotate"]),"icon-padding":new Jr(Ft.layout_symbol["icon-padding"]),"icon-keep-upright":new Jr(Ft.layout_symbol["icon-keep-upright"]),"icon-offset":new Qr(Ft.layout_symbol["icon-offset"]),"icon-anchor":new Qr(Ft.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Jr(Ft.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Jr(Ft.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Jr(Ft.layout_symbol["text-rotation-alignment"]),"text-field":new Qr(Ft.layout_symbol["text-field"]),"text-font":new Qr(Ft.layout_symbol["text-font"]),"text-size":new Qr(Ft.layout_symbol["text-size"]),"text-max-width":new Qr(Ft.layout_symbol["text-max-width"]),"text-line-height":new Jr(Ft.layout_symbol["text-line-height"]),"text-letter-spacing":new Qr(Ft.layout_symbol["text-letter-spacing"]),"text-justify":new Qr(Ft.layout_symbol["text-justify"]),"text-radial-offset":new Qr(Ft.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Jr(Ft.layout_symbol["text-variable-anchor"]),"text-anchor":new Qr(Ft.layout_symbol["text-anchor"]),"text-max-angle":new Jr(Ft.layout_symbol["text-max-angle"]),"text-writing-mode":new Jr(Ft.layout_symbol["text-writing-mode"]),"text-rotate":new Qr(Ft.layout_symbol["text-rotate"]),"text-padding":new Jr(Ft.layout_symbol["text-padding"]),"text-keep-upright":new Jr(Ft.layout_symbol["text-keep-upright"]),"text-transform":new Qr(Ft.layout_symbol["text-transform"]),"text-offset":new Qr(Ft.layout_symbol["text-offset"]),"text-allow-overlap":new Jr(Ft.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Jr(Ft.layout_symbol["text-ignore-placement"]),"text-optional":new Jr(Ft.layout_symbol["text-optional"])});var Bu={paint:new io({"icon-opacity":new Qr(Ft.paint_symbol["icon-opacity"]),"icon-color":new Qr(Ft.paint_symbol["icon-color"]),"icon-halo-color":new Qr(Ft.paint_symbol["icon-halo-color"]),"icon-halo-width":new Qr(Ft.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Qr(Ft.paint_symbol["icon-halo-blur"]),"icon-translate":new Jr(Ft.paint_symbol["icon-translate"]),"icon-translate-anchor":new Jr(Ft.paint_symbol["icon-translate-anchor"]),"text-opacity":new Qr(Ft.paint_symbol["text-opacity"]),"text-color":new Qr(Ft.paint_symbol["text-color"],{runtimeType:Wt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Qr(Ft.paint_symbol["text-halo-color"]),"text-halo-width":new Qr(Ft.paint_symbol["text-halo-width"]),"text-halo-blur":new Qr(Ft.paint_symbol["text-halo-blur"]),"text-translate":new Jr(Ft.paint_symbol["text-translate"]),"text-translate-anchor":new Jr(Ft.paint_symbol["text-translate-anchor"])}),layout:Fu};class Nu{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Zt,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Hi("FormatSectionOverride",Nu,{omit:["defaultValue"]});class $u extends pa{constructor(t){super(t,Bu)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const n of t)e.indexOf(n)<0&&e.push(n);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,n,i){const r=this.layout.get(t).evaluate(e,{},n,i),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||ti(o.value)||!r?r:function(t,e){return e.replace(/{([^{}]+)}/g,(e,n)=>n in t?String(t[n]):"")}(e.properties,r)}createBucket(t){return new Lu(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of Bu.paint.overridableProperties){if(!$u.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),n=new Nu(e),i=new Qn(n,e.property.specification);let r=null;r="constant"===e.value.kind||"source"===e.value.kind?new ni("source",i):new ii("composite",i,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new Yr(e.property,r,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,n){return!(!this.layout||e.isDataDriven()||n.isDataDriven())&&$u.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const n=t.get("text-field"),i=Bu.paint.properties[e];let r=!1;const o=t=>{for(const e of t)if(i.overrides&&i.overrides.hasOverride(e))return void(r=!0)};if("constant"===n.value.kind&&n.value.value instanceof de)o(n.value.value.sections);else if("source"===n.value.kind){const t=e=>{r||(e instanceof ve&&ge(e.value)===Qt?o(e.value.sections):e instanceof we?o(e.sections):e.eachChild(t))},e=n.value;e._styleExpression&&t(e._styleExpression.expression)}return r}getProgramConfiguration(t){return new ua(this,t)}}var ju={paint:new io({"background-color":new Jr(Ft.paint_background["background-color"]),"background-pattern":new eo(Ft.paint_background["background-pattern"]),"background-opacity":new Jr(Ft.paint_background["background-opacity"])})},Uu={paint:new io({"raster-opacity":new Jr(Ft.paint_raster["raster-opacity"]),"raster-hue-rotate":new Jr(Ft.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Jr(Ft.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Jr(Ft.paint_raster["raster-brightness-max"]),"raster-saturation":new Jr(Ft.paint_raster["raster-saturation"]),"raster-contrast":new Jr(Ft.paint_raster["raster-contrast"]),"raster-resampling":new Jr(Ft.paint_raster["raster-resampling"]),"raster-fade-duration":new Jr(Ft.paint_raster["raster-fade-duration"])})};class Vu extends pa{constructor(t){super(t,{}),this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)}onRemove(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)}}var qu={paint:new io({"sky-type":new Jr(Ft.paint_sky["sky-type"]),"sky-atmosphere-sun":new Jr(Ft.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Jr(Ft.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Jr(Ft.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Jr(Ft.paint_sky["sky-gradient-radius"]),"sky-gradient":new no(Ft.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Jr(Ft.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Jr(Ft.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Jr(Ft.paint_sky["sky-opacity"])})};function Zu(t,e,n){const i=Ya(0,0,1),r=hs(us());return function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);t[0]=i*l-o*s,t[1]=r*l+a*s,t[2]=o*l+i*s,t[3]=a*l-r*s}(r,r,n?-h(t)+Math.PI:h(t)),ds(r,r,-h(e)),os(i,i,r),es(i,i)}const Gu={circle:class extends pa{constructor(t){super(t,ja)}createBucket(t){return new Ta(t)}queryRadius(t){const e=t;return La("circle-radius",this,e)+La("circle-stroke-width",this,e)+Fa(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,n,i,r,o,a,s){const l="map"===this.paint.get("circle-pitch-alignment");if(l&&t.queryGeometry.isAboveHorizon)return!1;const c=Na(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(e,n)+this.paint.get("circle-stroke-width").evaluate(e,n),h=l?u*t.pixelToTileUnitsFactor:u;for(const e of i)for(const n of e){const e=n.add(c),i=s&&o.elevation?o.elevation.exaggeration()*s.getElevationAt(e.x,e.y,!0):0,r=l?e:ms(e,i,a),u=l?t.tilespaceRays.map(t=>vs(t,i)):t.queryGeometry.screenGeometry;let d=h;const f=cs([],[n.x,n.y,i,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?d*=f[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(d*=o.cameraToCenterDistance/f[3]),Sa(u,r,d))return!0}return!1}getProgramIds(){return["circle"]}getProgramConfiguration(t){return new ua(this,t)}},heatmap:class extends pa{createBucket(t){return new ys(t)}constructor(t){super(t,Ss),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ks({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(t){return new ua(this,t)}},hillshade:class extends pa{constructor(t){super(t,Ms)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getProgramConfiguration(t){return new ua(this,t)}},fill:class extends pa{constructor(t){super(t,fl)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),n=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(t){return new ua(this,t)}recalculate(t,e){super.recalculate(t,e);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new hl(t)}queryRadius(){return Fa(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,n,i,r,o){return!t.queryGeometry.isAboveHorizon&&ka(Ba(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),i)}isTileClipped(){return!0}},"fill-extrusion":class extends pa{constructor(t){super(t,Ol)}createBucket(t){return new Pl(t)}queryRadius(){return Fa(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(t){return new ua(this,t)}queryIntersectsFeature(t,e,n,i,o,a,s,l,c){const u=Na(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,t.pixelToTileUnitsFactor),h=this.paint.get("fill-extrusion-height").evaluate(e,n),d=this.paint.get("fill-extrusion-base").evaluate(e,n),f=[0,0],p=l&&a.elevation,m=a.elevation?a.elevation.exaggeration():1;if(p){const e=t.tile.getBucket(this).centroidVertexArray,n=c+1;if(n=3)for(let e=0;e{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const th=a.performance;class eh{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},th.mark(this._marks.start)}finish(){th.mark(this._marks.end);let t=th.getEntriesByName(this._marks.measure);return 0===t.length&&(th.measure(this._marks.measure,this._marks.start,this._marks.end),t=th.getEntriesByName(this._marks.measure),th.clearMarks(this._marks.start),th.clearMarks(this._marks.end),th.clearMeasures(this._marks.measure)),t}}class nh{constructor(){this.tasks={},this.taskQueue=[],C(["process"],this),this.invoker=new Qu(this.process),this.nextId=0}add(t,e){const n=this.nextId++;return this.tasks[n]={fn:t,metadata:e,priority:ih(e),id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){D();try{if(this.taskQueue=this.taskQueue.filter(t=>!!this.tasks[t]),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn()}finally{}}pick(){let t=null,e=1/0;for(let n=0;nthis._ne.lng&&(i=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i}static convert(t){return!t||t instanceof rh?t:new rh(t)}}class oh{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new oh(g(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,n=this.lat*e,i=t.lat*e,r=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(r,1))}toBounds(t=0){const e=360*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return new rh(new oh(this.lng-n,this.lat-e),new oh(this.lng+n,this.lat+e))}static convert(t){if(t instanceof oh)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new oh(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new oh(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const ah=2*Math.PI*6371008.8;function sh(t){return ah*Math.cos(t*Math.PI/180)}function lh(t){return(180+t)/360}function ch(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function uh(t,e){return t/sh(e)}function hh(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function dh(t,e){return t*sh(hh(e))}class fh{constructor(t,e,n=0){this.x=+t,this.y=+e,this.z=+n}static fromLngLat(t,e=0){const n=oh.convert(t);return new fh(lh(n.lng),ch(n.lat),uh(e,n.lat))}toLngLat(){return new oh(360*this.x-180,hh(this.y))}toAltitude(){return dh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ah*(t=hh(this.y),1/Math.cos(t*Math.PI/180));var t}}function ph(t,e,n){var i=2*Math.PI*6378137/256/Math.pow(2,n);return[t*i-2*Math.PI*6378137/2,e*i-2*Math.PI*6378137/2]}class mh{constructor(t,e,n){this.z=t,this.x=e,this.y=n,this.key=vh(0,t,t,e,n)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e){const n=(r=this.y,o=this.z,a=ph(256*(i=this.x),256*(r=Math.pow(2,o)-r-1),o),s=ph(256*(i+1),256*(r+1),o),a[0]+","+a[1]+","+s[0]+","+s[1]);var i,r,o,a,s;const l=function(t,e,n){let i,r="";for(let o=t;o>0;o--)i=1<this.canonical.z?new _h(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new _h(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e=!0){if(this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return vh(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-t;return vh(this.wrap*+e,t,t,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new _h(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,n=2*this.canonical.x,i=2*this.canonical.y;return[new _h(e,this.wrap,e,n,i),new _h(e,this.wrap,e,n+1,i),new _h(e,this.wrap,e,n,i+1),new _h(e,this.wrap,e,n+1,i+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ye.getLayer(t)).filter(Boolean);if(0!==t.length){i.layers=t,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(e=>t.filter(t=>t.id===e)[0]));for(const e of t)n[e.id]=i}}return n}(t.buckets,e.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const e=this.buckets[t];if(e instanceof Lu){if(this.hasSymbolBuckets=!0,!n)break;e.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const e=this.buckets[t];if(e instanceof Lu&&e.hasRTLText){this.hasRTLText=!0,Ur.isLoading()||Ur.isLoaded()||"deferred"!==$r()||jr();break}}this.queryPadding=0;for(const t in this.buckets){const n=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(t).queryRadius(n))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new Do}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const n=this.buckets[e];n.uploadPending()&&n.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ju(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ju(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,n,i,r,o,a,s){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:i,pixelPosMatrix:a,transform:o,params:r},t,e,n):{}}querySourceFeatures(t,e){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const i=n.loadVTLayers(),r=e?e.sourceLayer:"",o=i._geojsonTileLayer||i[r];if(!o)return;const a=pi(e&&e.filter),{z:s,x:l,y:c}=this.tileID.canonical,u={z:s,x:l,y:c};for(let e=0;et)n=!1;else if(e)if(this.expirationTimee[a])return null}else{const s=1/i[a];let l=(t[a]-n[a])*s,c=(e[a]-n[a])*s;if(l>c){const t=l;l=c,c=t}if(l>r&&(r=l),co)return null}return r}function kh(t,e,n,i,r,o,a,s,l,c,u){const h=i-t,d=r-e,f=o-n,p=a-t,m=s-e,g=l-n,_=u[1]*g-u[2]*m,v=u[2]*p-u[0]*g,y=u[0]*m-u[1]*p,x=h*_+d*v+f*y;if(Math.abs(x)<1e-15)return null;const b=1/x,w=c[0]-t,T=c[1]-e,C=c[2]-n,S=(w*_+T*v+C*y)*b;if(S<0||S>1)return null;const k=T*f-C*d,M=C*h-w*f,E=w*d-T*h,A=(u[0]*k+u[1]*M+u[2]*E)*b;return A<0||S+A>1?null:(p*k+m*M+g*E)*b}function Mh(t,e,n){return(t-e)/(n-e)}function Eh(t,e,n,i,r,o,a,s,l){const c=1<{const o=i?1:0,a=(t+1)*n-o,s=e*n,l=(e+1)*n-o;r[0]=t*n,r[1]=s,r[2]=a,r[3]=l};let a=new Ch(i);const s=[];for(let e=0;e=1;i/=2){const t=n[n.length-1];a=new Ch(i);for(let e=0;e0;){const{idx:s,t:f,nodex:p,nodey:m,depth:g}=d.pop();if(this.leaves[s]){Eh(p,m,g,t,e,n,i,u,h);const s=1<=t[2])return f}continue}let _=0;for(let d=0;d=l[c[n]]&&(c.splice(n,0,d),e=!0);e||(c[_]=d),_++}}for(let t=0;t<_;t++){const e=c[t];d.push({idx:this.childOffsets[s]+e,t:l[e],nodex:(p<<1)+this._siblingOffset[e][0],nodey:(m<<1)+this._siblingOffset[e][1],depth:g+1})}}return null}_addNode(t,e,n){return this.minimums.push(t),this.maximums.push(e),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(t,e,n,i,r){if(1===t[i].isLeaf(e,n))return;this.childOffsets[r]||(this.childOffsets[r]=this.nodeCount);const o=i-1,a=t[o];let s,l=0;for(let t=0;t=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,n){return(256*t*256+256*e+n)/10-1e4}_unpackTerrarium(t,e,n){return 256*t+e+n/256-32768}static pack(t,e){const n=[0,0,0,0],i=Dh.getUnpackVector(e);let r=Math.floor((t+i[3])/i[2]);return n[2]=r%256,r=Math.floor(r/256),n[1]=r%256,r=Math.floor(r/256),n[0]=r,n}getPixels(){return new Cs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=e*this.dim,r=e*this.dim+this.dim,o=n*this.dim,a=n*this.dim+this.dim;switch(e){case-1:i=r-1;break;case 1:r=i+1}switch(n){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-n*this.dim;for(let e=o;e{this.remove(t,r)},n)),this.data[i].push(r),this.order.push(i),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const n=t.wrapped().key,i=void 0===e?0:this.data[n].indexOf(e),r=this.data[n][i];return this.data[n].splice(i,1),r.timeout&&clearTimeout(r.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(r.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const n in this.data)for(const i of this.data[n])t(i.value)||e.push(i);for(const t of e)this.remove(t.value.tileID,t)}}class Rh{constructor(t,e,n){this.context=t;const i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Lh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Fh{constructor(t,e,n,i){this.length=e.length,this.attributes=n,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;const r=t.gl;this.buffer=r.createBuffer(),t.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let n=0;n{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),e.on("error",()=>{this._sourceErrored=!0}),this._source=e,this._tiles={},this._cache=new zh(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Th}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,e){return t.isSymbolTile=this._onlySymbols,this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t,()=>{})}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const n=this._tiles[e];n.upload(t),n.prepare(this.map.style.imageManager)}}getIds(){return v(this._tiles).map(t=>t.tileID).sort(Sd).map(t=>t.key)}getRenderableIds(t){const e=[];for(const n in this._tiles)this._isIdRenderable(+n,t)&&e.push(this._tiles[n]);return t?e.sort((t,e)=>{const n=t.tileID,i=e.tileID,o=new r(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new r(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-i.overscaledZ||a.y-o.y||a.x-o.x}).map(t=>t.tileID.key):e.map(t=>t.tileID).sort(Sd).map(t=>t.key)}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(+t,"reloading")}}_reloadTile(t,e){const n=this._tiles[t];n&&("loading"!==n.state&&(n.state=e),this._loadTile(n,this._tileLoaded.bind(this,n,t,e)))}_tileLoaded(t,e,n,i){if(i)return t.state="errored",void(404!==i.status?this._source.fire(new Rt(i,{tile:t})):this.update(this.transform));t.timeAdded=U.now(),"expired"===n&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new zt("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const e=this.getRenderableIds();for(let i=0;i1||(Math.abs(n)>1&&(1===Math.abs(n+r)?n+=r:1===Math.abs(n-r)&&(n-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,n,i),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,n,i){for(const r in this._tiles){let o=this._tiles[r];if(i[r]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>n)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let s=a;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]){i[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const n=this._loadedParentTiles[t.key];return n&&n.tileID.overscaledZ>=e?n:null}for(let n=t.overscaledZ-1;n>=e;n--){const e=t.scaledTo(n),i=this._getLoadedTile(e);if(i)return i}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,e){e=e||this._source.tileSize;const n=Math.ceil(t.width/e)+1,i=Math.ceil(t.height/e)+1,r=Math.floor(n*i*5),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(o)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const n in this._tiles){const i=this._tiles[n];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),t[i.tileID.key]=i}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(+t,this._tiles[t])}}update(t,e,n){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!n)return;let i;this.updateCacheSize(t,e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new _h(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(i=t.coveringTiles({tileSize:e||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,useElevationData:!!this.transform.elevation&&!this.usedForTerrain}),this._source.hasTile&&(i=i.filter(t=>this._source.hasTile(t)))):i=[];const r=this._updateRetainedTiles(i);if(kd(this._source.type)&&0!==i.length){const t={},e={},n=Object.keys(r);for(const i of n){const n=r[i],o=this._tiles[i];if(!o||o.fadeEndTime&&o.fadeEndTime<=U.now())continue;const a=this.findLoadedParent(n,Math.max(n.overscaledZ-Cd.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),t[a.tileID.key]=a.tileID),e[i]=n}const o=i[i.length-1].overscaledZ;for(const t in this._tiles){const n=this._tiles[t];if(r[t]||!n.hasData())continue;let i=n.tileID;for(;i.overscaledZ>o;){i=i.scaledTo(i.overscaledZ-1);const o=this._tiles[i.key];if(o&&o.hasData()&&e[i.key]){r[t]=n.tileID;break}}}for(const e in t)r[e]||(this._coveredTiles[e]=!0,r[e]=t[e])}for(const t in r)this._tiles[t].clearFadeHold();const o=function(t,e){const n=[];for(const i in t)i in e||n.push(i);return n}(this._tiles,r);for(const t of o){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+t)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const e={};if(0===t.length)return e;const n={},i=t[t.length-1].overscaledZ,r=t[0].overscaledZ,o=Math.max(r-Cd.maxOverzooming,this._source.minzoom),a=Math.max(r+Cd.maxUnderzooming,this._source.minzoom),s={};for(const n of t){const t=this._addTile(n);e[n.key]=n,t.hasData()||i=this._source.maxzoom){const t=i.children(this._source.maxzoom)[0],n=this.getTile(t);if(n&&n.hasData()){e[t.key]=t;continue}}else{const t=i.children(this._source.maxzoom);if(e[t[0].key]&&e[t[1].key]&&e[t[2].key]&&e[t[3].key])continue}let r=t.wasRequested();for(let a=i.overscaledZ-1;a>=o;--a){const o=i.scaledTo(a);if(n[o.key])break;if(n[o.key]=!0,t=this.getTile(o),!t&&r&&(t=this._addTile(o)),t&&(e[o.key]=o,r=t.wasRequested(),t.hasData()))break}}return e}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let n,i=this._tiles[t].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){n=this._loadedParentTiles[i.key];break}e.push(i.key);const t=i.scaledTo(i.overscaledZ-1);if(n=this._getLoadedTile(t),n)break;i=t}for(const t of e)this._loadedParentTiles[t]=n}}_addTile(t){let e=this._tiles[t.key];if(e)return e;e=this._cache.getAndRemove(t),e&&(this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e)));const n=Boolean(e);return n||(e=new wh(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom),this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))),e?(e.uses++,this._tiles[t.key]=e,n||this._source.fire(new zt("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e):null}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},n))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._cache.reset()}tilesIn(t,e,n){const i=[],r=this.transform;if(!r)return i;for(const o in this._tiles){const a=this._tiles[o];if(n&&a.clearQueryDebugViz(),a.holdingForFade())continue;const s=t.containsTile(a,r,e);s&&i.push(s)}return i}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map(t=>this._tiles[t].tileID);for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(kd(this._source.type))for(const t in this._tiles){const e=this._tiles[t];if(void 0!==e.fadeEndTime&&e.fadeEndTime>=U.now())return!0}return!1}setFeatureState(t,e,n){this._state.updateState(t=t||"_geojsonTileLayer",e,n)}removeFeatureState(t,e,n){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,n)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,n){const i=this._tiles[t];i&&i.setDependencies(e,n)}reloadTilesForDependencies(t,e){for(const n in this._tiles)this._tiles[n].hasDependency(t,e)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(t,e))}}function Sd(t,e){const n=Math.abs(2*t.wrap)-+(t.wrap<0),i=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||i-n||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function kd(t){return"raster"===t||"image"===t||"video"===t}Cd.maxOverzooming=10,Cd.maxUnderzooming=3;class Md{constructor(t,e,n){this._demTile=t,this._dem=this._demTile.dem,this._scale=e,this._offset=n}static create(t,e,n){const i=n||t.findDEMTileFor(e);if(!i||!i.dem)return;const r=i.dem,o=i.tileID,a=1<=0&&i[3]>=0&&s.insert(a,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Sl.VectorTile(new lc(this.rawTileData)).layers,this.sourceLayerCoder=new yh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,n,i){this.loadVTLayers();const r=t.params||{},o=pi(r.filter),a=t.tileResult,s=t.transform,l=a.bufferedTilespaceBounds,c=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,(t,e,n,i)=>za(a.bufferedTilespaceGeometry,t,e,n,i));c.sort(Pd);let u=null;s.elevation&&c.length>0&&(u=Md.create(s.elevation,this.tileID));const h={};let d;for(let s=0;s(p||(p=xa(e)),n.queryIntersectsFeature(a,e,i,p,this.z,t.transform,t.pixelPosMatrix,u,r)))}return h}loadMatchingFeature(t,e,n,i,r,o,a,s,l){const{featureIndex:c,bucketIndex:u,sourceLayerIndex:h,layoutVertexArrayOffset:d}=e,f=this.bucketLayerIDs[u];if(i&&!function(t,e){for(let n=0;n=0)return!0;return!1}(i,f))return;const p=this.sourceLayerCoder.decode(h),m=this.vtLayers[p].feature(c);if(n.needGeometry){const t=ba(m,!0);if(!n.filter(new Vr(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new Vr(this.tileID.overscaledZ),m))return;const g=this.getId(m,p);for(let e=0;e{const a=e instanceof Kr?e.get(o):null;return a&&a.evaluate?a.evaluate(n,i,r):a})}function Pd(t,e){return e-t}Hi("FeatureIndex",Ed,{omit:["rawTileData","sourceLayerCoder"]});class Id{constructor(t){const e={},n=[];for(const i in t){const r=t[i],o=e[i]={};for(const t in r){const e=r[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i=e.metrics.localGlyph?2:1,a={x:0,y:0,w:e.bitmap.width+2*i,h:e.bitmap.height+2*i};n.push(a),o[t]={rect:a,metrics:e.metrics}}}const{w:i,h:r}=Ac(n),o=new Ts({width:i||1,height:r||1});for(const n in t){const i=t[n];for(const t in i){const r=i[+t];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const a=e[n][t].rect,s=r.metrics.localGlyph?2:1;Ts.copy(r.bitmap,o,{x:0,y:0},{x:a.x+s,y:a.y+s},r.bitmap)}}this.image=o,this.positions=e}}Hi("GlyphAtlas",Id);class Od{constructor(t){this.tileID=new _h(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.enableTerrain=!!t.enableTerrain,this.isSymbolTile=t.isSymbolTile}parse(t,e,n,i,r){this.status="parsing",this.data=t,this.collisionBoxArray=new Do;const o=new yh(Object.keys(t.layers).sort()),a=new Ed(this.tileID,this.promoteId);a.bucketLayerIDs=[];const s={},l={featureIndex:a,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},c=e.familiesBySource[this.source];for(const e in c){const i=t.layers[e];if(!i)continue;let r=!1,u=!1;for(const t of c[e])"symbol"===t[0].type?r=!0:u=!0;if(!0===this.isSymbolTile&&!r)continue;if(!1===this.isSymbolTile&&!u)continue;1===i.version&&P(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const h=o.encode(e),d=[];for(let t=0;t=e.maxzoom||"none"!==e.visibility&&(Dd(t,this.zoom,n),(s[e.id]=e.createBucket({index:a.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:h,sourceID:this.source,enableTerrain:this.enableTerrain})).populate(d,l,this.tileID.canonical),a.bucketLayerIDs.push(t.map(t=>t.id)))}}let u,h,d,f;const p={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},m=k(l.glyphDependencies,t=>Object.keys(t).map(Number));Object.keys(m).length?i.send("getGlyphs",{uid:this.uid,stacks:m},(t,e)=>{u||(u=t,h=e,y.call(this))},void 0,void 0,p):h={};const g=Object.keys(l.iconDependencies);g.length?i.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},(t,e)=>{u||(u=t,d=e,y.call(this))},void 0,void 0,p):d={};const _=Object.keys(l.patternDependencies);function y(){if(u)return r(u);if(h&&d&&f){const t=new Id(h),e=new Ic(d,f);for(const i in s){const r=s[i];r instanceof Lu?(Dd(r.layers,this.zoom,n),bu(r,h,t.positions,d,e.iconPositions,this.showCollisionBoxes,this.tileID.canonical,this.tileZoom)):r.hasPattern&&(r instanceof Vl||r instanceof hl||r instanceof Pl)&&(Dd(r.layers,this.zoom,n),r.addFeatures(l,this.tileID.canonical,e.patternPositions))}this.status="done",r(null,{buckets:v(s).filter(t=>!t.isEmpty()),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:e,glyphMap:this.returnDependencies?h:null,iconMap:this.returnDependencies?d:null,glyphPositions:this.returnDependencies?t.positions:null})}}_.length?i.send("getImages",{icons:_,source:this.source,tileID:this.tileID,type:"patterns"},(t,e)=>{u||(u=t,f=e,y.call(this))},void 0,void 0,p):f={},y.call(this)}}function Dd(t,e,n){const i=new Vr(e);for(const e of t)e.recalculate(i,n)}class zd{constructor(t){this.entries={},this.scheduler=t}request(t,e,n,i){const r=this.entries[t]=this.entries[t]||{callbacks:[]};if(r.result){const[t,n]=r.result;return this.scheduler?this.scheduler.add(()=>{i(t,n)},e):i(t,n),()=>{}}return r.callbacks.push(i),r.cancel||(r.cancel=n((n,i)=>{r.result=[n,i];for(const t of r.callbacks)this.scheduler?this.scheduler.add(()=>{t(n,i)},e):t(n,i);setTimeout(()=>delete this.entries[t],3e3)})),()=>{r.result||(r.callbacks=r.callbacks.filter(t=>t!==i),r.callbacks.length||(r.cancel(),delete this.entries[t]))}}}function Rd(t,e,n){const i=JSON.stringify(t.request);return t.data&&(this.deduped.entries[i]={result:[null,t.data]}),this.deduped.request(i,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},e=>{const i=Ct(t.request,(t,i,r,o)=>{t?e(t):i&&e(null,{vectorTile:n?void 0:new Sl.VectorTile(new lc(i)),rawData:i,cacheControl:r,expires:o})});return()=>{i.cancel(),e()}},e)}e.AUTH_ERR_MSG="NO_ACCESS_TOKEN",e.Aabb=ps,e.Actor=class{constructor(t,e,n){this.target=t,this.parent=e,this.mapId=n,this.callbacks={},this.cancelCallbacks={},C(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=D()?t:a,this.scheduler=new nh}send(t,e,n,i,r=!1,o){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=o,this.callbacks[a]=n);const s=B(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!n,targetMapId:i,mustQueue:r,sourceMapId:this.mapId,data:Yi(e,s)},s),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:"",targetMapId:i,sourceMapId:this.mapId})}}}receive(t){const e=t.data,n=e.id;if(n&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){const t=this.cancelCallbacks[n];delete this.cancelCallbacks[n],t&&t.cancel()}else if(D()||e.mustQueue){const t=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add(()=>this.processTask(n,e),t&&t.metadata||{type:"message"})}else this.processTask(n,e)}processTask(t,e){if(""===e.type){const n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(Ki(e.error)):n(null,Ki(e.data)))}else{const n=B(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"",sourceMapId:this.mapId,error:e?Yi(e):null,data:Yi(i,n)},n)}:t=>{},r=Ki(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,r,i);else if(this.parent.getWorkerSource){const t=e.type.split(".");this.parent.getWorkerSource(e.sourceMapId,t[0],r.source)[t[1]](r,i)}else i(new Error("Could not find function "+e.type))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},e.CanonicalTileID=mh,e.Color=ce,e.ColorMode=wd,e.Context=class{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Nh(this),this.clearDepth=new $h(this),this.clearStencil=new jh(this),this.colorMask=new Uh(this),this.depthMask=new Vh(this),this.stencilMask=new qh(this),this.stencilFunc=new Zh(this),this.stencilOp=new Gh(this),this.stencilTest=new Hh(this),this.depthRange=new Xh(this),this.depthTest=new Wh(this),this.depthFunc=new Yh(this),this.blend=new Kh(this),this.blendFunc=new Jh(this),this.blendColor=new Qh(this),this.blendEquation=new td(this),this.cullFace=new ed(this),this.cullFaceSide=new nd(this),this.frontFace=new id(this),this.program=new rd(this),this.activeTexture=new od(this),this.viewport=new ad(this),this.bindFramebuffer=new sd(this),this.bindRenderbuffer=new ld(this),this.bindTexture=new cd(this),this.bindVertexBuffer=new ud(this),this.bindElementBuffer=new hd(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new dd(this),this.pixelStoreUnpack=new fd(this),this.pixelStoreUnpackPremultiplyAlpha=new pd(this),this.pixelStoreUnpackFlipY=new md(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Rh(this,t,e)}createVertexBuffer(t,e,n){return new Fh(this,t,e,n)}createRenderbuffer(t,e,n){const i=this.gl,r=i.createRenderbuffer();return this.bindRenderbuffer.set(r),i.renderbufferStorage(i.RENDERBUFFER,t,e,n),this.bindRenderbuffer.set(null),r}createFramebuffer(t,e,n){return new yd(this,t,e,n)}clear({color:t,depth:e,stencil:n}){const i=this.gl;let r=0;t&&(r|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(r|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==n&&(r|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),i.clear(r)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){s(t.blendFunction,wd.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}},e.CullFaceMode=Td,e.DEMData=Dh,e.DataConstantProperty=Jr,e.DedupedRequest=zd,e.DepthMode=xd,e.DepthStencilAttachment=class extends vd{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}},e.EXTENT=8192,e.Elevation=class{getAtPoint(t,e=0){const n=this._source();if(!n)return e;if(t.y<0||t.y>1)return e;const i=n.getSource().maxzoom,r=1<{t[2]=this.exaggeration()*r.getElevationAt(t[0],t[1],n)}),!0)}getMinMaxForTile(t){const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const n=e.dem.tree,i=e.tileID,r=1<this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!J(t))return t;const n=et(t);return n.path="/styles/v1"+n.path,this._makeAPIURL(n,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!J(t))return t;const n=et(t);return n.path="/fonts/v1"+n.path,this._makeAPIURL(n,this._customAccessToken||e)}normalizeSourceURL(t,e){if(!J(t))return t;const n=et(t);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),this._makeAPIURL(n,this._customAccessToken||e)}normalizeSpriteURL(t,e,n,i){const r=et(t);return J(t)?(r.path=`/styles/v1${r.path}/sprite${e}${n}`,this._makeAPIURL(r,this._customAccessToken||i)):(r.path+=`${e}${n}`,nt(r))}normalizeTileURL(t,e,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!J(t))return t;const i=et(t);i.path=i.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||n&&"raster"!==i.authority&&512===n?"@2x":""}${Z.supported?".webp":"$1"}`),"raster"===i.authority?i.path=`/${q.RASTER_URL_PREFIX}${i.path}`:(i.path=i.path.replace(/^.+\/v4\//,"/"),i.path=`/${q.TILE_URL_VERSION}${i.path}`);const r=this._customAccessToken||function(t){for(const e of t){const t=e.match(/^access_token=(.*)$/);if(t)return t[1]}return null}(i.params)||q.ACCESS_TOKEN;return q.REQUIRE_ACCESS_TOKEN&&r&&this._skuToken&&i.params.push("sku="+this._skuToken),this._makeAPIURL(i,r)}canonicalizeTileURL(t,e){const n=et(t);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return t;let i="mapbox://";n.path.match(/^\/raster\/v1\//)?i+="raster/"+n.path.replace(`/${q.RASTER_URL_PREFIX}/`,""):i+="tiles/"+n.path.replace(`/${q.TILE_URL_VERSION}/`,"");let r=n.params;return e&&(r=r.filter(t=>!t.match(/^access_token=/))),r.length&&(i+="?"+r.join("&")),i}canonicalizeTileset(t,e){const n=!!e&&J(e),i=[];for(const e of t.tiles||[])Q(e)?i.push(this.canonicalizeTileURL(e,n)):i.push(e);return i}_makeAPIURL(t,e){const n="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",i=et(q.API_URL);if(t.protocol=i.protocol,t.authority=i.authority,"http"===t.protocol){const e=t.params.indexOf("secure");e>=0&&t.params.splice(e,1)}if("/"!==i.path&&(t.path=`${i.path}${t.path}`),!q.REQUIRE_ACCESS_TOKEN)return nt(t);if(!(e=e||q.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+n);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+n);return t.params=t.params.filter(t=>-1===t.indexOf("access_token")),t.params.push("access_token="+e),nt(t)}},e.RequestPerformance=eh,e.ResourceType=xt,e.SegmentVector=_a,e.SourceCache=Cd,e.StencilMode=bd,e.StructArrayLayout1ui2=Po,e.StructArrayLayout2f1f2i16=bo,e.StructArrayLayout2i4=uo,e.StructArrayLayout3f12=_o,e.StructArrayLayout3ui6=To,e.StructArrayLayout4i8=ho,e.Texture=Ju,e.Tile=wh,e.Transitionable=Gr,e.Uniform1f=Qo,e.Uniform1i=class extends Jo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},e.Uniform2f=class extends Jo{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},e.Uniform3f=class extends Jo{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},e.Uniform4f=ta,e.UniformColor=ea,e.UniformMatrix3f=class extends Jo{constructor(t,e){super(t,e),this.current=ia}set(t){for(let e=0;e<9;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix3fv(this.location,!1,t);break}}},e.UniformMatrix4f=class extends Jo{constructor(t,e){super(t,e),this.current=na}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},e.UnwrappedTileID=gh,e.ValidationError=Bt,e.VectorTileWorkerSource=class extends Lt{constructor(t,e,n,i,r){super(),this.actor=t,this.layerIndex=e,this.availableImages=n,this.loadVectorData=r||Rd,this.loading={},this.loaded={},this.deduped=new zd(t.scheduler),this.isSpriteLoaded=i,this.scheduler=t.scheduler}loadTile(t,e){const n=t.uid,i=!!(t&&t.request&&t.request.collectResourceTiming)&&new eh(t.request),r=this.loading[n]=new Od(t);r.abort=this.loadVectorData(t,(o,a)=>{const s=!this.loading[n];if(delete this.loading[n],s||o||!a)return r.status="done",s||(this.loaded[n]=r),e(o);const l=a.rawData,c={};a.expires&&(c.expires=a.expires),a.cacheControl&&(c.cacheControl=a.cacheControl);const u={};if(i){const t=i.finish();t&&(u.resourceTiming=JSON.parse(JSON.stringify(t)))}r.vectorTile=a.vectorTile||new Sl.VectorTile(new lc(l));const h=()=>{r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,(t,n)=>{if(t||!n)return e(t);e(null,y({rawTileData:l.slice(0)},n,c,u))})};this.isSpriteLoaded?h():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(h,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom}):h()}),this.loaded=this.loaded||{},this.loaded[n]=r})}reloadTile(t,e){const n=this.loaded,i=t.uid,r=this;if(n&&n[i]){const o=n[i];o.showCollisionBoxes=t.showCollisionBoxes,o.enableTerrain=!!t.enableTerrain;const a=(t,n)=>{const i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,r.layerIndex,this.availableImages,r.actor,i)),e(t,n)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(t,e){const n=t.uid,i=this.loading[n];i&&(i.abort&&i.abort(),delete this.loading[n]),e()}removeTile(t,e){const n=this.loaded,i=t.uid;n&&n[i]&&delete n[i],e()}},e.WritingMode=Oc,e.ZoomHistory=Ji,e.add=Ka,e.addDynamicAttributes=Ou,e.altitudeFromMercatorZ=dh,e.asyncAll=_,e.bezier=f,e.bindAll=C,e.browser=U,e.bufferConvexPolygon=function(t,e){const n=[];for(let i=0;ipt&&(t.getActor().send("enforceCacheSizeLimit",ft),vt=0)},e.clamp=m,e.clearTileCache=function(t){const e=a.caches.delete("mapbox-tiles");t&&e.catch(t).then(()=>t())},e.clipLine=tu,e.clone=function(t){var e=new Ua(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],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},e.clone$1=E,e.collisionCircleLayout=Ql,e.config=q,e.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},e.create=function(){var t=new Ua(16);return Ua!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},e.create$1=Va,e.create$2=function(){var t=new Ua(4);return Ua!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},e.createExpression=ei,e.createLayout=lo,e.createStyleLayer=function(t){return"custom"===t.type?new Vu(t):new Gu[t.type](t)},e.cross=is,e.deepEqual=s,e.degToRad=h,e.div=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t},e.dot=ns,e.ease=p,e.easeCubicInOut=d,e.emitValidationErrors=ji,e.endsWith=S,e.enforceCacheSizeLimit=function(t){mt(),ht&&ht.then(e=>{e.keys().then(n=>{for(let i=0;i{}}},e.identity=qa,e.identity$1=hs,e.invert=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],m=e[13],g=e[14],_=e[15],v=n*s-i*a,y=n*l-r*a,x=n*c-o*a,b=i*l-r*s,w=i*c-o*s,T=r*c-o*l,C=u*m-h*p,S=u*g-d*p,k=u*_-f*p,M=h*g-d*m,E=h*_-f*m,A=d*_-f*g,P=v*A-y*E+x*M+b*k-w*S+T*C;return P?(t[0]=(s*A-l*E+c*M)*(P=1/P),t[1]=(r*E-i*A-o*M)*P,t[2]=(m*T-g*w+_*b)*P,t[3]=(d*w-h*T-f*b)*P,t[4]=(l*k-a*A-c*S)*P,t[5]=(n*A-r*k+o*S)*P,t[6]=(g*x-p*T-_*y)*P,t[7]=(u*T-d*x+f*y)*P,t[8]=(a*E-s*k+c*C)*P,t[9]=(i*k-n*E-o*C)*P,t[10]=(p*w-m*x+_*v)*P,t[11]=(h*x-u*w-f*v)*P,t[12]=(s*S-a*M-l*C)*P,t[13]=(n*M-i*S+r*C)*P,t[14]=(m*y-p*b-g*v)*P,t[15]=(u*b-h*y+d*v)*P,t):null},e.isMapboxURL=J,e.latFromMercatorY=hh,e.len=ls,e.length=Wa,e.length$1=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},e.loadVectorTile=Rd,e.makeRequest=Tt,e.mercatorXfromLng=lh,e.mercatorYfromLat=ch,e.mercatorZfromAltitude=uh,e.mul=Ga,e.mul$1=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t},e.multiply=Za,e.mvt=Sl,e.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},e.normalize=es,e.normalize$1=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=i*a,t[2]=r*a,t[3]=o*a,t},e.number=Qe,e.offscreenCanvasSupported=yt,e.ortho=function(t,e,n,i,r,o,a){var s=1/(e-n),l=1/(i-r),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(r+i)*l,t[14]=(a+o)*c,t[15]=1,t},e.pbf=lc,e.perspective=function(t,e,n,i,r){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=r&&r!==1/0?(t[10]=(r+i)*(o=1/(i-r)),t[14]=2*r*i*o):(t[10]=-1,t[14]=-2*i),t},e.pick=function(t,e){const n={};for(let i=0;ithis._layers[t.id]),n=e[0];if("none"===n.visibility)continue;const i=n.source||"";let r=this.familiesBySource[i];r||(r=this.familiesBySource[i]={});const o=n.sourceLayer||"_geojsonTileLayer";let a=r[o];a||(a=r[o]=[]),a.push(e)}}}const{ImageBitmap:r}=t.window;class o{loadTile(e,n){const{uid:i,encoding:o,rawImageData:a,padding:s,buildQuadTree:l}=e,c=r&&a instanceof r?this.getImageData(a,s):a;n(null,new t.DEMData(i,c,o,s<1,l))}getImageData(e,n){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-n,-n,e.width+2*n,e.height+2*n);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)}}function a(t,e){if(0!==t.length){s(t[0],e);for(var n=1;n=0!=!!e&&t.reverse()}const l=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;class c{constructor(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const n of this._feature.geometry)e.push([new t.Point$1(n[0],n[1])]);return e}{const e=[];for(const n of this._feature.geometry){const i=[];for(const e of n)i.push(new t.Point$1(e[0],e[1]));e.push(i)}return e}}toGeoJSON(t,e,n){return l.call(this,t,e,n)}}class u{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(t){return new c(this._features[t])}}var h=t.vectorTile.VectorTileFeature,d=f;function f(t,e){this.options=e||{},this.features=t,this.length=t.length}function p(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}f.prototype.feature=function(t){return new p(this.features[t],this.options.extent)},p.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var n=0;n>31}function T(t,e){for(var n=t.loadGeometry(),i=t.type,r=0,o=0,a=n.length,s=0;st[0],A=t=>t[1];class P{constructor(t,e=E,n=A,i=64,r=Float64Array){this.nodeSize=i,this.points=t;const o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new r(2*t.length);for(let i=0;i>1;!function t(e,n,i,r,o,a){for(;o>r;){if(o-r>600){const s=o-r+1,l=i-r+1,c=Math.log(s),u=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);t(e,n,i,Math.max(r,Math.floor(i-l*u/s+h)),Math.min(o,Math.floor(i+(s-l)*u/s+h)),a)}const s=n[2*i+a];let l=r,c=o;for(S(e,n,r,i),n[2*o+a]>s&&S(e,n,r,o);ls;)c--}n[2*r+a]===s?S(e,n,r,c):(c++,S(e,n,c,o)),c<=i&&(r=c+1),i<=c&&(o=c-1)}}(e,n,s,r,o,a%2),t(e,n,i,r,s-1,a+1),t(e,n,i,s+1,o,a+1)}(a,s,i,0,a.length-1,0)}range(t,e,n,i){return function(t,e,n,i,r,o,a){const s=[0,t.length-1,0],l=[];let c,u;for(;s.length;){const h=s.pop(),d=s.pop(),f=s.pop();if(d-f<=a){for(let a=f;a<=d;a++)c=e[2*a],u=e[2*a+1],c>=n&&c<=r&&u>=i&&u<=o&&l.push(t[a]);continue}const p=Math.floor((f+d)/2);c=e[2*p],u=e[2*p+1],c>=n&&c<=r&&u>=i&&u<=o&&l.push(t[p]);const m=(h+1)%2;(0===h?n<=c:i<=u)&&(s.push(f),s.push(p-1),s.push(m)),(0===h?r>=c:o>=u)&&(s.push(p+1),s.push(d),s.push(m))}return l}(this.ids,this.coords,t,e,n,i,this.nodeSize)}within(t,e,n){return function(t,e,n,i,r,o){const a=[0,t.length-1,0],s=[],l=r*r;for(;a.length;){const c=a.pop(),u=a.pop(),h=a.pop();if(u-h<=o){for(let r=h;r<=u;r++)M(e[2*r],e[2*r+1],n,i)<=l&&s.push(t[r]);continue}const d=Math.floor((h+u)/2),f=e[2*d],p=e[2*d+1];M(f,p,n,i)<=l&&s.push(t[d]);const m=(c+1)%2;(0===c?n-r<=f:i-r<=p)&&(a.push(h),a.push(d-1),a.push(m)),(0===c?n+r>=f:i+r>=p)&&(a.push(d+1),a.push(u),a.push(m))}return s}(this.ids,this.coords,t,e,n,this.nodeSize)}}const I={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},O=Math.fround||(D=new Float32Array(1),t=>(D[0]=+t,D[0]));var D;class z{constructor(t){this.options=U(Object.create(I),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:n,maxZoom:i,nodeSize:r}=this.options;t.length;this.points=t;let o=[];for(let e=0;e=n;t--){Date.now();o=this._cluster(o,t),this.trees[t]=new P(o,V,q,r,Float32Array)}return this}getClusters(t,e){let n=((t[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[1]));let r=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,r=180;else if(n>r){const t=this.getClusters([n,i,180,o],e),a=this.getClusters([-180,i,r,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range(N(n),$(o),N(r),$(i)),l=[];for(const t of s){const e=a.points[t];l.push(e.numPoints?F(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),n=this._getOriginZoom(t),i="No cluster with the specified id.",r=this.trees[n];if(!r)throw new Error(i);const o=r.points[e];if(!o)throw new Error(i);const a=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=r.within(o.x,o.y,a),l=[];for(const e of s){const n=r.points[e];n.parentId===t&&l.push(n.numPoints?F(n):this.points[n.index])}if(0===l.length)throw new Error(i);return l}getLeaves(t,e,n){const i=[];return this._appendLeaves(i,t,e=e||10,n=n||0,0),i}getTile(t,e,n){const i=this.trees[this._limitZoom(t)],r=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(n-s)/r,c=(n+1+s)/r,u={features:[]};return this._addTileFeatures(i.range((e-s)/r,l,(e+1+s)/r,c),i.points,e,n,r,u),0===e&&this._addTileFeatures(i.range(1-s/r,l,1,c),i.points,r,n,r,u),e===r-1&&this._addTileFeatures(i.range(0,l,s/r,c),i.points,-1,n,r,u),u.features.length?u:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const n=this.getChildren(t);if(e++,1!==n.length)break;t=n[0].properties.cluster_id}return e}_appendLeaves(t,e,n,i,r){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?r+o.point_count<=i?r+=o.point_count:r=this._appendLeaves(t,o.cluster_id,n,i,r):re&&(h+=n.numPoints||1)}if(h>=a){let t=r.x*u,a=r.y*u,s=o&&u>1?this._map(r,!0):null;const d=(i<<5)+(e+1)+this.points.length;for(const n of c){const i=l.points[n];if(i.zoom<=e)continue;i.zoom=e;const c=i.numPoints||1;t+=i.x*c,a+=i.y*c,i.parentId=d,o&&(s||(s=this._map(r,!0)),o(s,this._map(i)))}r.parentId=d,n.push(R(t/h,a/h,d,h,s))}else if(n.push(r),h>1)for(const t of c){const i=l.points[t];i.zoom<=e||(i.zoom=e,n.push(i))}}return n}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?U({},t.properties):t.properties;const n=this.points[t.index].properties,i=this.options.map(n);return e&&i===n?U({},i):i}}function R(t,e,n,i,r){return{x:O(t),y:O(e),zoom:1/0,id:n,parentId:-1,numPoints:i,properties:r}}function L(t,e){const[n,i]=t.geometry.coordinates;return{x:O(N(n)),y:O($(i)),zoom:1/0,index:e,parentId:-1}}function F(t){return{type:"Feature",id:t.id,properties:B(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),j(t.y)]}};var e}function B(t){const e=t.numPoints,n=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return U(U({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:n})}function N(t){return t/360+.5}function $(t){const e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function j(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function U(t,e){for(const n in e)t[n]=e[n];return t}function V(t){return t.x}function q(t){return t.y}function Z(t,e,n,i,r,o){var a=r-n,s=o-i;if(0!==a||0!==s){var l=((t-n)*a+(e-i)*s)/(a*a+s*s);l>1?(n=r,i=o):l>0&&(n+=a*l,i+=s*l)}return(a=t-n)*a+(s=e-i)*s}function G(t,e,n,i){var r={id:void 0===t?null:t,type:e,geometry:n,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,n=t.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)H(t,e);else if("Polygon"===n||"MultiLineString"===n)for(var i=0;i0&&(a+=i?(r*c-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-o,2))),r=l,o=c}var u=e.length-3;e[2]=1,function t(e,n,i,r){for(var o,a=r,s=i-n>>1,l=i-n,c=e[n],u=e[n+1],h=e[i],d=e[i+1],f=n+3;fa)o=f,a=p;else if(p===a){var m=Math.abs(f-s);mr&&(o-n>3&&t(e,n,o,r),e[o+2]=a,i-o>3&&t(e,o,i,r))}(e,0,u,n),e[u+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function K(t,e,n,i){for(var r=0;r1?1:n}function tt(t,e,n,i,r,o,a,s){if(i/=e,o>=(n/=e)&&a=i)return null;for(var l=[],c=0;c=n&&p=i)){var m=[];if("Point"===d||"MultiPoint"===d)et(h,m,n,i,r);else if("LineString"===d)nt(h,m,n,i,r,!1,s.lineMetrics);else if("MultiLineString"===d)rt(h,m,n,i,r,!1);else if("Polygon"===d)rt(h,m,n,i,r,!0);else if("MultiPolygon"===d)for(var g=0;g=n&&a<=i&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function nt(t,e,n,i,r,o,a){for(var s,l,c=it(t),u=0===r?at:st,h=t.start,d=0;dn&&(l=u(c,f,p,g,_,n),a&&(c.start=h+s*l)):v>i?y=n&&(l=u(c,f,p,g,_,n),x=!0),y>i&&v<=i&&(l=u(c,f,p,g,_,i),x=!0),!o&&x&&(a&&(c.end=h+s*l),e.push(c),c=it(t)),a&&(h+=s)}var b=t.length-3;f=t[b],p=t[b+1],m=t[b+2],(v=0===r?f:p)>=n&&v<=i&&ot(c,f,p,m),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&ot(c,c[0],c[1],c[2]),c.length&&e.push(c)}function it(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function rt(t,e,n,i,r,o){for(var a=0;aa.maxX&&(a.maxX=u),h>a.maxY&&(a.maxY=h)}return a}function ft(t,e,n,i){var r=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&e.size<(r?a:i))n.numPoints+=e.length/3;else{for(var s=[],l=0;la)&&(n.numSimplified++,s.push(e[l]),s.push(e[l+1])),n.numPoints++;r&&function(t,e){for(var n=0,i=0,r=t.length,o=r-2;i0===e)for(i=0,r=t.length;i24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var i=function(t,e){var n=[];if("FeatureCollection"===t.type)for(var i=0;i24)return null;var o=1<0;)l--,c=Math.floor(c/2),u=Math.floor(u/2),s=this.tiles[gt(l,c,u)];return s&&s.source?(this.splitTile(s.source,l,c,u,t,e,n),this.tiles[a]?ut(this.tiles[a],r):null):null};class vt extends t.VectorTileWorkerSource{constructor(t,e,n,i,r){super(t,e,n,i,_t),r&&(this.loadGeoJSON=r)}loadData(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;const e=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;const i=!!(n&&n.request&&n.request.collectResourceTiming)&&new t.RequestPerformance(n.request);this.loadGeoJSON(n,(r,o)=>{if(r||!o)return e(r);if("object"!=typeof o)return e(new Error(`Input data given to '${n.source}' is not a valid GeoJSON object.`));{!function t(e,n){var i,r=e&&e.type;if("FeatureCollection"===r)for(i=0;i`${t.key}: ${t.message}`).join(", "));const i=o.features.filter(t=>e.value.evaluate({zoom:0},t));o={type:"FeatureCollection",features:i}}this._geoJSONIndex=n.cluster?new z(function({superclusterOptions:e,clusterProperties:n}){if(!n||!e)return e;const i={},r={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(n);for(const e of s){const[o,a]=n[e],s=t.createExpression(a),l=t.createExpression("string"==typeof o?[o,["accumulated"],["get",e]]:o);i[e]=s.value,r[e]=l.value}return e.map=t=>{a.properties=t;const e={};for(const t of s)e[t]=i[t].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const e of s)o.accumulated=t[e],t[e]=r[e].evaluate(o,a)},e}(n)).load(o.features):function(t,e){return new mt(t,e)}(o,n.geojsonVtOptions)}catch(r){return e(r)}this.loaded={};const s={};if(i){const t=i.finish();t&&(s.resourceTiming={},s.resourceTiming[n.source]=JSON.parse(JSON.stringify(t)))}e(null,s)}})}coalesce(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())}reloadTile(t,e){const n=this.loaded;return n&&n[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(e,n){if(e.request)t.getJSON(e.request,n);else{if("string"!=typeof e.data)return n(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(e.data))}catch(t){return n(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}}}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class yt{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded=!1,this.workerSourceTypes={vector:t.VectorTileWorkerSource,geojson:vt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}checkIfReady(t,e,n){n()}setReferrer(t,e){this.referrer=e}spriteLoaded(e,n){this.isSpriteLoaded=n;for(const i in this.workerSources[e]){const r=this.workerSources[e][i];for(const e in r)r[e]instanceof t.VectorTileWorkerSource&&(r[e].isSpriteLoaded=n,r[e].fire(new t.Event("isSpriteLoaded")))}}setImages(t,e,n){this.availableImages[t]=e;for(const n in this.workerSources[t]){const i=this.workerSources[t][n];for(const t in i)i[t].availableImages=e}n()}enableTerrain(t,e,n){this.terrain=e,n()}setLayers(t,e,n){this.getLayerIndex(t).replace(e),n()}updateLayers(t,e,n){this.getLayerIndex(t).update(e.layers,e.removedIds),n()}loadTile(e,n,i){const r=this.enableTerrain?t.extend({enableTerrain:this.terrain},n):n;this.getWorkerSource(e,n.type,n.source).loadTile(r,i)}loadDEMTile(e,n,i){const r=this.enableTerrain?t.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(e,n.source).loadTile(r,i)}reloadTile(e,n,i){const r=this.enableTerrain?t.extend({enableTerrain:this.terrain},n):n;this.getWorkerSource(e,n.type,n.source).reloadTile(r,i)}abortTile(t,e,n){this.getWorkerSource(t,e.type,e.source).abortTile(e,n)}removeTile(t,e,n){this.getWorkerSource(t,e.type,e.source).removeTile(e,n)}removeSource(t,e,n){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const i=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==i.removeSource?i.removeSource(e,n):n()}loadWorkerSource(t,e,n){try{this.self.importScripts(e.url),n()}catch(t){n(t.toString())}}syncRTLPluginState(e,n,i){try{t.plugin.setState(n);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const n=t.plugin.isParsed();i(n?void 0:new Error("RTL Text Plugin failed to import scripts from "+e),n)}}catch(t){i(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new i),e}getWorkerSource(t,e,n){return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][n]||(this.workerSources[t][e][n]=new this.workerSourceTypes[e]({send:(e,n,i,r,o,a)=>{this.actor.send(e,n,i,t,r,a)},scheduler:this.actor.scheduler},this.getLayerIndex(t),this.getAvailableImages(t),this.isSpriteLoaded)),this.workerSources[t][e][n]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new o),this.demWorkerSources[t][e]}enforceCacheSizeLimit(e,n){t.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(t,e,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new yt(self)),yt})),r(0,(function(t){var e=n;function n(t){return!function(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,n=new Blob([""],{type:"text/javascript"}),i=URL.createObjectURL(n);try{e=new Worker(i),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(i),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var n=e.getImageData(0,0,1,1);return n&&n.width===t.width}()?(void 0===i[e=t&&t.failIfMajorPerformanceCaveat]&&(i[e]=function(t){var e,i=function(t){var e=document.createElement("canvas"),i=Object.create(n.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=t,e.getContext("webgl",i)||e.getContext("experimental-webgl",i)}(t);if(!i)return!1;try{e=i.createShader(i.VERTEX_SHADER)}catch(t){return!1}return!(!e||i.isContextLost())&&(i.shaderSource(e,"void main() {}"),i.compileShader(e),!0===i.getShaderParameter(e,i.COMPILE_STATUS))}(e)),i[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e}(t)}var i={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const r={create:function(e,n,i){const r=t.window.document.createElement(e);return void 0!==n&&(r.className=n),i&&i.appendChild(r),r},createNS:function(e,n){return t.window.document.createElementNS(e,n)}},o=t.window.document&&t.window.document.documentElement.style,a=o&&void 0!==o.userSelect?"userSelect":"WebkitUserSelect";let s;r.disableDrag=function(){o&&a&&(s=o[a],o[a]="none")},r.enableDrag=function(){o&&a&&(o[a]=s)},r.setTransform=function(t,e){t.style.transform=e};let l=!1;try{const e=Object.defineProperty({},"passive",{get(){l=!0}});t.window.addEventListener("test",e,e),t.window.removeEventListener("test",e,e)}catch(t){l=!1}r.addEventListener=function(t,e,n,i={}){t.addEventListener(e,n,"passive"in i&&l?i:i.capture)},r.removeEventListener=function(t,e,n,i={}){t.removeEventListener(e,n,"passive"in i&&l?i:i.capture)};const c=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",c,!0)};function u(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}r.suppressClick=function(){t.window.addEventListener("click",c,!0),t.window.setTimeout(()=>{t.window.removeEventListener("click",c,!0)},0)},r.mousePos=function(e,n){const i=e.getBoundingClientRect();return new t.Point(n.clientX-i.left-e.clientLeft,n.clientY-i.top-e.clientTop)},r.touchPos=function(e,n){const i=e.getBoundingClientRect(),r=[];for(let o=0;o=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};class h extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,e){this._validate(t,e)&&(this.images[t]=e)}_validate(e,n){let i=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(n.content,n)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let n=0;for(const i of t){if(i[0]1&&(a=t[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const d=e/n*(i+1);if(a.isDash){const t=i-Math.abs(d);h=Math.sqrt(u*u+t*t)}else h=i-Math.sqrt(u*u+d*d);this.data[r+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const n=t[e],i=t[e+1];n.zeroLength?t.splice(e,1):i&&i.isDash===n.isDash&&(i.left=n.left,t.splice(e,1))}const e=t[0],n=t[t.length-1];e.isDash===n.isDash&&(e.left=n.left-this.width,n.right=e.right+this.width);const i=this.width*this.nextRow;let r=0,o=t[r];for(let e=0;e1&&(o=t[++r]);const n=Math.abs(e-o.left),a=Math.abs(e-o.right),s=Math.min(n,a);this.data[i+e]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(e,n){const i=n?7:0,r=2*i+1;if(this.nextRow+r>this.height)return t.warnOnce("LineAtlas out of space"),null;0===e.length&&e.push(1);let o=0;for(let n=0;n{this.ready=!0})}broadcast(e,n,i){t.asyncAll(this.actors,(t,i)=>{t.send(e,n,i)},i=i||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function v(e,n,i){return n*(t.EXTENT/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}_.Actor=t.Actor;class y{constructor(t,e,n,i){this.screenBounds=t,this.cameraPoint=e,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this.screenGeometry.map(t=>i.pointCoordinate3D(t)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(e,n){let i,r;if(e instanceof t.Point||"number"==typeof e[0]){const o=t.Point.convert(e);i=[t.Point.convert(e)],r=n.isPointAboveHorizon(o)}else{const o=t.Point.convert(e[0]),a=t.Point.convert(e[1]);i=[o,a],r=t.polygonizeBounds(o,a).every(t=>n.isPointAboveHorizon(t))}return new y(i,n.getCameraPoint(),r,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(e){return t.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],e)}bufferedCameraGeometry(e){const n=this.screenBounds[0],i=1===this.screenBounds.length?this.screenBounds[0].add(new t.Point(1,1)):this.screenBounds[1],r=t.polygonizeBounds(n,i,0,!1);return this.cameraPoint.y>i.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=i.x?r[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(r[3]=this.cameraPoint)),t.bufferConvexPolygon(r,e)}containsTile(e,n,i){const r=e.queryPadding+1,o=i?this._bufferedCameraMercator(r,n).map(t=>e.tileID.getTilePoint(t)):this._bufferedScreenMercator(r,n).map(t=>e.tileID.getTilePoint(t)),a=this.screenGeometryMercator.map(t=>e.tileID.getTileVec3(t)),s=a.map(e=>new t.Point(e[0],e[1])),l=n.getFreeCameraOptions().position||new t.MercatorCoordinate(0,0,0),c=e.tileID.getTileVec3(l),u=a.map(e=>{const n=t.sub(e,e,c);return t.normalize(n,n),new t.Ray(c,n)}),h=v(e,1,n.zoom);if(t.polygonIntersectsBox(o,0,0,t.EXTENT,t.EXTENT))return{queryGeometry:this,tilespaceGeometry:s,tilespaceRays:u,bufferedTilespaceGeometry:o,bufferedTilespaceBounds:(d=t.getBounds(o),d.min.x=t.clamp(d.min.x,0,t.EXTENT),d.min.y=t.clamp(d.min.y,0,t.EXTENT),d.max.x=t.clamp(d.max.x,0,t.EXTENT),d.max.y=t.clamp(d.max.y,0,t.EXTENT),d),tile:e,tileID:e.tileID,pixelToTileUnitsFactor:h};var d}_bufferedScreenMercator(t,e){const n=x(t);if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{const i=this.bufferedScreenGeometry(t).map(t=>e.pointCoordinate3D(t));return this._screenRaycastCache[n]=i,i}}_bufferedCameraMercator(t,e){const n=x(t);if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{const i=this.bufferedCameraGeometry(t).map(t=>e.pointCoordinate3D(t));return this._cameraRaycastCache[n]=i,i}}}function x(t){return 100*t|0}function b(e,n,i){const r=function(r,o){if(r)return i(r);if(o){const r=t.pick(t.extend(o,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(r.vectorLayers=o.vector_layers,r.vectorLayerIds=r.vectorLayers.map(t=>t.id)),r.tiles=n.canonicalizeTileset(r,e.url),i(null,r)}};return e.url?t.getJSON(n.transformRequest(n.normalizeSourceURL(e.url),t.ResourceType.Source),r):t.browser.frame(()=>r(null,e))}class w{constructor(e,n,i){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const n=Math.pow(2,e.z),i=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*n),r=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*n),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*n),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*n);return e.x>=i&&e.x=r&&e.y{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):n&&(t.extend(this,n),n.bounds&&(this.tileBounds=new w(n.bounds,this.minzoom,this.maxzoom)),t.postTurnstileEvent(n.tiles),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,n){const i=t.browser.devicePixelRatio>=2,r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),i,this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(r,t.ResourceType.Tile),(i,r)=>{if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(i)e.state="errored",n(i);else if(r){this.map._refreshExpiredTiles&&e.setExpiryData(r),delete r.cacheControl,delete r.expires;const i=this.map.painter.context,o=i.gl;e.texture=this.map.painter.getTileTexture(r.width),e.texture?e.texture.update(r,{useMipmap:!0}):(e.texture=new t.Texture(i,r,o.RGBA,{useMipmap:!0}),e.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}var C=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class S extends t.Evented{constructor(t,e,n,i){super(),this.id=t,this.dispatcher=n,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=e}load(e,n){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(i,r)=>{this._loaded=!0,i?this.fire(new t.ErrorEvent(i)):r&&(this.image=r,e&&(this.coordinates=e),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(e){this.coordinates=e;const n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let n=1/0,i=1/0,r=-1/0,o=-1/0;for(const t of e)n=Math.min(n,t.x),i=Math.min(i,t.y),r=Math.max(r,t.x),o=Math.max(o,t.y);const a=Math.max(r-n,o-i),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new t.CanonicalTileID(s,Math.floor((n+r)/2*l),Math.floor((i+o)/2*l))}(n),this.minzoom=this.maxzoom=this.tileID.z;const i=n.map(t=>this.tileID.getTilePoint(t)._round());return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(i[2].x,i[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,C.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const k={vector:class extends t.Evented{constructor(e,n,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(n,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r),this._tileWorkers={},this._deduped=new t.DedupedRequest}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=b(this._options,this.map._requestManager,(e,n)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):n&&(t.extend(this,n),n.bounds&&(this.tileBounds=new w(n.bounds,this.minzoom,this.maxzoom)),t.postTurnstileEvent(n.tiles,this.map._requestManager._customAccessToken),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t();const e=this.map.style._getSourceCaches(this.id);for(const t of e)t.clearTiles();this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}loadTile(e,n){const i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),r={request:this.map._requestManager.transformRequest(i,t.ResourceType.Tile),data:void 0,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:e.isSymbolTile};if(r.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state)"loading"===e.state?e.reloadCallback=n:e.request=e.actor.send("reloadTile",r,o.bind(this));else if(e.actor=this._tileWorkers[i]=this._tileWorkers[i]||this.dispatcher.getActor(),this.dispatcher.ready)e.request=e.actor.send("loadTile",r,o.bind(this));else{const n=t.loadVectorTile.call({deduped:this._deduped},r,(t,n)=>{t||!n?o.call(this,t):(r.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},e.actor&&e.actor.send("loadTile",r,o.bind(this)))},!0);e.request={cancel:n}}function o(i,r){return delete e.request,e.aborted?n(null):i&&404!==i.status?n(i):(r&&r.resourceTiming&&(e.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&e.setExpiryData(r),e.loadVectorData(r,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:T,"raster-dem":class extends T{constructor(e,n,i,r){super(e,n,i,r),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,n){const i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function r(t,i){t&&(e.state="errored",n(t)),i&&(e.dem=i,e.dem.onDeserialize(),e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0,e.state="loaded",n(null))}e.request=t.getImage(this.map._requestManager.transformRequest(i,t.ResourceType.Tile),function(i,o){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(i)e.state="errored",n(i);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;const n=t.window.ImageBitmap&&o instanceof t.window.ImageBitmap&&t.offscreenCanvasSupported(),i=1-(o.width-t.prevPowerOfTwo(o.width))/2;i<1||e.neighboringTiles||(e.neighboringTiles=this._getNeighboringTiles(e.tileID));const a=n?o:t.browser.getImageData(o,i),s={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:a,encoding:this.encoding,padding:i};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",s,r.bind(this)))}}.bind(this))}_getNeighboringTiles(e){const n=e.canonical,i=Math.pow(2,n.z),r=(n.x-1+i)%i,o=0===n.x?e.wrap-1:e.wrap,a=(n.x+1+i)%i,s=n.x+1===i?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,n.z,r,n.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y).key]={backfilled:!1},n.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,n.z,r,n.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y-1).key]={backfilled:!1}),n.y+1{if(e)return void this.fire(new t.ErrorEvent(e));const n={dataType:"source",sourceDataType:"metadata"};this._collectResourceTiming&&this._resourceTiming&&this._resourceTiming.length>0&&(n.resourceTiming=this._resourceTiming,this._resourceTiming=[]),this.fire(new t.Event("data",n))})}onAdd(t){this.map=t,this.load()}setData(e){return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(e=>{if(e)return void this.fire(new t.ErrorEvent(e));const n={dataType:"source",sourceDataType:"content"};this._collectResourceTiming&&this._resourceTiming&&this._resourceTiming.length>0&&(n.resourceTiming=this._resourceTiming,this._resourceTiming=[]),this.fire(new t.Event("data",n))}),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,n,i){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:n},i),this}_updateWorkerData(e){this._loaded=!1;const n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.actor.send(this.type+".loadData",n,(t,i)=>{this._removed||i&&i.abandoned||(this._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[this.id]&&(this._resourceTiming=i.resourceTiming[this.id].slice(0)),this.actor.send(this.type+".coalesce",{source:n.source},null),e(t))})}loaded(){return this._loaded}loadTile(e,n){const i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{type:this.type,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(t,r)=>(delete e.request,e.unloadVectorData(),e.aborted?n(null):t?n(t):(e.loadVectorData(r,this.map.painter,"reloadTile"===i),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends S{constructor(t,e,n,i){super(t,e,n,i),this.roundZoom=!0,this.type="video",this.options=e}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,t.ResourceType.Source).url);t.getVideo(this.urls,(e,n)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):n&&(this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const n=this.video.seekable;en.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,C.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:S,canvas:class extends S{constructor(e,n,i,r){super(e,n,i,r),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,i=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,C.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(n,this.canvas,i.RGBA,{premultiply:!0});for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}},M=function(e,n,i,r){const o=new k[n.type](e,n,i,r);if(o.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${o.id}`);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o};function E(e,n){const i=t.identity([]);return t.scale(i,i,[.5*e.width,.5*-e.height,1]),t.translate(i,i,[1,-1,0]),t.multiply(i,i,e.calculatePosMatrix(n.toUnwrapped()))}function A(t,e,n,i,r,o,a,s=!1){const l=t.tilesIn(i,a,s);l.sort(I);const c=[];for(const i of l)c.push({wrappedTileID:i.tile.tileID.wrapped().key,queryResults:i.tile.queryRenderedFeatures(e,n,t._state,i,r,o,E(t.transform,i.tile.tileID),s)});const u=function(t){const e={},n={};for(const i of t){const t=i.queryResults,r=i.wrappedTileID,o=n[r]=n[r]||{};for(const n in t){const i=t[n],r=o[n]=o[n]||{},a=e[n]=e[n]||[];for(const t of i)r[t.featureIndex]||(r[t.featureIndex]=!0,a.push(t))}}return e}(c);for(const e in u)u[e].forEach(e=>{const n=e.feature,i=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=i});return u}function P(t,e){const n=t.getRenderableIds().map(e=>t.getTileByID(e)),i=[],r={};for(let t=0;t{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[D]}numActive(){return Object.keys(this.active).length}}let R;function L(){return R||(R=new z),R}function F(e,n){const i={};for(const t in e)"ref"!==t&&(i[t]=e[t]);return t.refProperties.forEach(t=>{t in n&&(i[t]=n[t])}),i}function B(t){t=t.slice();const e=Object.create(null);for(let n=0;n0?(r-a)/s:0;return this.points[o].mult(1-l).add(this.points[n].mult(l))}}class X{constructor(t,e,n){const i=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(e/n);for(let t=0;tthis.width||i<0||e>this.height)return!r&&[];const a=[];if(t<=0&&e<=0&&this.width<=n&&this.height<=i){if(r)return!0;for(let t=0;t0:a}_queryCircle(t,e,n,i,r){const o=t-n,a=t+n,s=e-n,l=e+n;if(a<0||o>this.width||l<0||s>this.height)return!i&&[];const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:i,circle:{x:t,y:e,radius:n},seenUids:{box:{},circle:{}}},r),i?c.length>0:c}query(t,e,n,i,r){return this._query(t,e,n,i,!1,r)}hitTest(t,e,n,i,r){return this._query(t,e,n,i,!0,r)}hitTestCircle(t,e,n,i){return this._queryCircle(t,e,n,!0,i)}_queryCell(t,e,n,i,r,o,a,s){const l=a.seenUids,c=this.boxCells[r];if(null!==c){const r=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(t<=r[c+2]&&e<=r[c+3]&&n>=r[c+0]&&i>=r[c+1]&&(!s||s(this.boxKeys[u]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[u],x1:r[c],y1:r[c+1],x2:r[c+2],y2:r[c+3]})}}}const u=this.circleCells[r];if(null!==u){const r=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(r[u],r[u+1],r[u+2],t,e,n,i)&&(!s||s(this.circleKeys[c]))){if(a.hitTest)return o.push(!0),!0;{const t=r[u],e=r[u+1],n=r[u+2];o.push({key:this.circleKeys[c],x1:t-n,y1:e-n,x2:t+n,y2:e+n})}}}}}_queryCellCircle(t,e,n,i,r,o,a,s){const l=a.circle,c=a.seenUids,u=this.boxCells[r];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const n=4*e;if(this._circleAndRectCollide(l.x,l.y,l.radius,t[n+0],t[n+1],t[n+2],t[n+3])&&(!s||s(this.boxKeys[e])))return o.push(!0),!0}}const h=this.circleCells[r];if(null!==h){const t=this.circles;for(const e of h)if(!c.circle[e]){c.circle[e]=!0;const n=3*e;if(this._circlesCollide(t[n],t[n+1],t[n+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[e])))return o.push(!0),!0}}}_forEachCell(t,e,n,i,r,o,a,s){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),u=this._convertToXCellCoord(n),h=this._convertToYCellCoord(i);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(r.call(this,t,e,n,i,this.xCellCount*l+d,o,a,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,n,i,r,o){const a=i-t,s=r-e,l=n+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,n,i,r,o,a){const s=(o-i)/2,l=Math.abs(t-(i+s));if(l>s+n)return!1;const c=(a-r)/2,u=Math.abs(e-(r+c));if(u>c+n)return!1;if(l<=s||u<=c)return!0;const h=l-s,d=u-c;return h*h+d*d<=n*n}}function W(e,n,i,r,o){const a=t.create();return n?(t.scale(a,a,[1/o,1/o,1]),i||t.rotateZ(a,a,r.angle)):t.multiply(a,r.labelPlaneMatrix,e),a}function Y(e,n,i,r,o){if(n){const n=t.clone(e);return t.scale(n,n,[o,o,1]),i||t.rotateZ(n,n,-r.angle),n}return r.glCoordMatrix}function K(e,n,i=0){const r=[e.x,e.y,i,1];i?t.transformMat4(r,r,n):lt(r,r,n);const o=r[3];return{point:new t.Point(r[0]/o,r[1]/o),signedDistanceFromCamera:o}}function J(t,e){return Math.min(.5+t/e*.5,1.5)}function Q(t,e){const n=t[0]/t[3],i=t[1]/t[3];return n>=-e[0]&&n<=e[0]&&i>=-e[1]&&i<=e[1]}function tt(e,n,i,r,o,a,s,l,c){const u=r?e.textSizeData:e.iconSizeData,h=t.evaluateSizeForZoom(u,i.transform.zoom),d=[256/i.width*2+1,256/i.height*2+1],f=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;f.clear();const p=e.lineVertexArray,m=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=i.transform.width/i.transform.height;let _=!1;for(let r=0;rMath.abs(i.x-n.x)*r?{useVertical:!0}:(e===t.WritingMode.vertical?n.yi.x)?{needsFlipping:!0}:null}function it(e,n,i,r,o,a,s,l,c,u,h,d,f,p,m){const g=n/24,_=e.lineOffsetX*g,v=e.lineOffsetY*g;let y;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,n=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,u=et(g,l,_,v,i,h,d,e,c,a,f,m);if(!u)return{notEnoughRoom:!0};const x=K(u.first.point,s).point,b=K(u.last.point,s).point;if(r&&!i){const t=nt(e.writingMode,x,b,p);if(t)return t}y=[u.first];for(let r=e.glyphStartIndex+1;r0?a.point:rt(d,r,n,1,o),l=nt(e.writingMode,n,s,p);if(l)return l}const n=ot(g*l.getoffsetX(e.glyphStartIndex),_,v,i,h,d,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,a,f,m);if(!n)return{notEnoughRoom:!0};y=[n]}for(const e of y)t.addDynamicAttributes(u,e.point,e.angle);return{}}function rt(t,e,n,i,r,o){const a=t.add(t.sub(e)._unit()),s=K(a,r,o?o(a):0).point,l=n.sub(s);return n.add(l._mult(i/l.mag()))}function ot(e,n,i,r,o,a,s,l,c,u,h,d,f,p,m){const g=r?e-n:e+n;let _=g>0?1:-1,v=0;r&&(_*=-1,v=Math.PI),_<0&&(v+=Math.PI);let y=_>0?l+s:l+s+1,x=o,b=o,w=0,T=0;const C=Math.abs(g),S=[],k=[];let M=a;const E=()=>{const e=y-_;return 0===w?a:new t.Point(u.getx(e),u.gety(e))},A=()=>rt(E(),M,b,C-w+1,h,f);for(;w+T<=C;){if(y+=_,y=c)return null;if(b=x,S.push(x),p&&k.push(M||E()),x=d[y],void 0===x){M=new t.Point(u.getx(y),u.gety(y));const e=K(M,h,f?f(M):0);x=e.signedDistanceFromCamera>0?d[y]=e.point:A()}else M=null;w+=T,T=b.dist(x)}m&&f&&(M=M||new t.Point(u.getx(y),u.gety(y)),d[y]=x=void 0===d[y]?x:A(),T=b.dist(x));const P=(C-w)/T,I=x.sub(b),O=I.mult(P)._add(b);i&&O._add(I._unit()._perp()._mult(i*_));const D=v+Math.atan2(x.y-b.y,x.x-b.x);return S.push(O),p&&(M=M||new t.Point(u.getx(y),u.gety(y)),k.push(function(e,n,i){const r=1-i;return new t.Point(e.x*r+n.x*i,e.y*r+n.y*i)}(k.length>0?k[k.length-1]:M,M,P))),{point:O,angle:D,path:S,tilePath:k}}const at=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function st(t,e){for(let n=0;ng.getAtTileOffset(p,t.x,t.y):t=>0,v=new t.Point(n.anchorX,n.anchorY),y=_(v),x=this.projectAndGetPerspectiveRatio(a,v.x,v.y,y),{perspectiveRatio:b}=x,w=(u?o/b:o*b)/t.ONE_EM,T=K(v,s,y).point,C=x.signedDistanceFromCamera>0?et(w,r,n.lineOffsetX*w,n.lineOffsetY*w,!1,T,v,n,i,s,{},g&&!u?_:null,u&&!!g):null;let S=!1,k=!1,M=!0;if(C&&!x.aboveHorizon){const n=.5*d*b+f,i=new t.Point(-100,-100),r=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),o=new H,a=C.first,s=C.last;let u=[];for(let t=a.path.length-1;t>=1;t--)u.push(a.path[t]);for(let t=1;t{const n=_(eK(t,l));u=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let v=[];if(u.length>0){const e=u[0].clone(),n=u[0].clone();for(let t=1;t=i.x&&n.x<=r.x&&e.y>=i.y&&n.y<=r.y?[u]:n.xr.x||n.yr.y?[]:t.clipLine([u],i.x,i.y,r.x,r.y)}for(const t of v){o.reset(t,.25*n);let i=0;i=o.length<=.5*n?1:Math.ceil(o.paddedLength/p)+1;for(let t=0;t0?(t.transformMat4(o,o,e),a=o[2]>o[3]):lt(o,o,e),{point:new t.Point((o[0]/o[3]+1)/2*this.transform.width+100,(-o[1]/o[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/o[3]*.5,1.5),signedDistanceFromCamera:o[3],aboveHorizon:a}}isOffscreen(t,e,n,i){return n<100||t>=this.screenRightBoundary||i<100||e>this.screenBottomBoundary}isInsideGrid(t,e,n,i){return n>=0&&t=0&&et.collisionGroupID===e}}return this.collisionGroups[t]}}function gt(e,n,i,r,o){const{horizontalAlign:a,verticalAlign:s}=t.getAnchorAlignment(e),l=-(a-.5)*n,c=-(s-.5)*i,u=t.evaluateVariableOffset(e,r);return new t.Point(l+u[0]*o,c+u[1]*o)}function _t(e,n,i,r,o){const a=new t.Point(e,n);return i&&a._rotate(r?o:-o),a}class vt{constructor(t,e,n,i){this.transform=t.clone(),this.collisionIndex=new ct(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new mt(n),this.collisionCircleArrays={},this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,n,i,r){const o=i.getBucket(n),a=i.latestFeatureIndex;if(!o||!a||n.id!==o.layerIds[0])return;const s=i.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/t.EXTENT,h=this.transform.calculatePosMatrix(i.tileID.toUnwrapped()),d="map"===l.get("text-pitch-alignment"),f="map"===l.get("text-rotation-alignment"),p=v(i,1,this.transform.zoom),m=W(h,d,f,this.transform,p);let g=null;if(d){const e=Y(h,d,f,this.transform,p);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[o.bucketInstanceId]=new pt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);const _={bucket:o,layout:l,posMatrix:h,textLabelPlaneMatrix:m,labelToScreenMatrix:g,scale:c,textPixelRatio:u,holdingForFade:i.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:t.evaluateSizeForZoom(o.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const t of o.sortKeyRanges){const{sortKey:n,symbolInstanceStart:i,symbolInstanceEnd:r}=t;e.push({sortKey:n,symbolInstanceStart:i,symbolInstanceEnd:r,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m,g,_){const v=[h.textOffset0,h.textOffset1],y=f.getSymbolInstanceTextSize(g,h,this.transform.zoom,d),x=gt(t,n,i,v,r),b=this.collisionIndex.placeCollisionBox(y,e,_t(x.x,x.y,o,a,this.transform.angle),u,s,l,c.predicate);if((!m||0!==this.collisionIndex.placeCollisionBox(f.getSymbolInstanceIconSize(_,this.transform.zoom,d),m,_t(x.x,x.y,o,a,this.transform.angle),u,s,l,c.predicate).box.length)&&b.box.length>0){let e;return this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(e=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:v,width:n,height:i,anchor:t,textBoxScale:r,prevAnchor:e},this.markUsedJustification(f,t,h,p),f.allowVerticalPlacement&&(this.markUsedOrientation(f,p,h),this.placedOrientations[h.crossTileID]=p),{shift:x,placedGlyphBoxes:b}}}placeLayerBucketPart(e,n,i){const{bucket:r,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:u,collisionBoxArray:h,partiallyEvaluatedTextSize:d,partiallyEvaluatedIconSize:f,collisionGroup:p}=e.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),_=o.get("text-allow-overlap"),v=o.get("icon-allow-overlap"),y="map"===o.get("text-rotation-alignment"),x="map"===o.get("text-pitch-alignment"),b="none"!==o.get("icon-text-fit"),w="viewport-y"===o.get("symbol-z-order"),T=_&&(v||!r.hasIconData()||g),C=v&&(_||!r.hasTextData()||m);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h),i&&r.updateCollisionDebugBuffers(this.transform.zoom,h);const S=(e,h,w)=>{if(n[e.crossTileID])return;if(u)return void(this.placements[e.crossTileID]=new dt(!1,!1,!1));let S=!1,k=!1,M=!0,E=null,A={box:null,offscreen:null},P={box:null,offscreen:null},I=null,O=null,D=null,z=0,R=0,L=0;w.textFeatureIndex?z=w.textFeatureIndex:e.useRuntimeCollisionCircles&&(z=e.featureIndex),w.verticalTextFeatureIndex&&(R=w.verticalTextFeatureIndex);const F=t=>{(this.transform.elevation||t.elevation)&&(t.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[r.bucketInstanceId].tileID,t.anchorPointX,t.anchorPointY):0)},B=w.textBox;if(B){F(B);const n=n=>{let i=t.WritingMode.horizontal;if(r.allowVerticalPlacement&&!n&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,i=t,this.markUsedOrientation(r,i,e))}return i},i=(n,i)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&w.verticalTextBox){for(const e of r.writingModes)if(e===t.WritingMode.vertical?(A=i(),P=A):A=n(),A&&A.box&&A.box.length)break}else A=n()};if(o.get("text-variable-anchor")){let s=o.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];s.indexOf(t.anchor)>0&&(s=s.filter(e=>e!==t.anchor),s.unshift(t.anchor))}const l=(t,n,i)=>{const o=e.textBoxScale,l=(t.x2-t.x1)*o+2*t.padding,u=(t.y2-t.y1)*o+2*t.padding,m=b&&!v?n:null;m&&F(m);let g={box:[],offscreen:!1};const w=_?2*s.length:s.length;for(let n=0;n=s.length,e,h,r,i,m,d,f);if(_&&(g=_.placedGlyphBoxes,g&&g.box&&g.box.length)){S=!0,E=_.shift;break}}return g};i(()=>l(B,w.iconBox,t.WritingMode.horizontal),()=>{const n=w.verticalTextBox;return n&&F(n),r.allowVerticalPlacement&&!(A&&A.box&&A.box.length)&&e.numVerticalGlyphVertices>0&&n?l(n,w.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}}),A&&(S=A.box,M=A.offscreen);const u=n(A&&A.box);if(!S&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,u))}}else{const o=(n,i)=>{const o=r.getSymbolInstanceTextSize(d,e,this.transform.zoom,h),s=this.collisionIndex.placeCollisionBox(o,n,new t.Point(0,0),_,c,a,p.predicate);return s&&s.box&&s.box.length&&(this.markUsedOrientation(r,i,e),this.placedOrientations[e.crossTileID]=i),s};i(()=>o(B,t.WritingMode.horizontal),()=>{const n=w.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?(F(n),o(n,t.WritingMode.vertical)):{box:null,offscreen:null}}),n(A&&A.box&&A.box.length)}}if(I=A,S=I&&I.box&&I.box.length>0,M=I&&I.offscreen,e.useRuntimeCollisionCircles){const n=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.evaluateSizeForFeature(r.textSizeData,d,n),u=o.get("text-padding");O=this.collisionIndex.placeCollisionCircles(_,n,r.lineVertexArray,r.glyphOffsetArray,c,a,s,l,i,x,p.predicate,e.collisionCircleDiameter,u,this.retainedQueryData[r.bucketInstanceId].tileID),S=_||O.circles.length>0&&!O.collisionDetected,M=M&&O.offscreen}if(w.iconFeatureIndex&&(L=w.iconFeatureIndex),w.iconBox){const e=e=>{F(e);const n=b&&E?_t(E.x,E.y,y,x,this.transform.angle):new t.Point(0,0),i=r.getSymbolInstanceIconSize(f,this.transform.zoom,h);return this.collisionIndex.placeCollisionBox(i,e,n,v,c,a,p.predicate)};P&&P.box&&P.box.length&&w.verticalIconBox?(D=e(w.verticalIconBox),k=D.box.length>0):(D=e(w.iconBox),k=D.box.length>0),M=M&&D.offscreen}const N=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,$=g||0===e.numIconVertices;if(N||$?$?N||(k=k&&S):S=k&&S:k=S=k&&S,S&&I&&I.box&&this.collisionIndex.insertCollisionBox(I.box,o.get("text-ignore-placement"),r.bucketInstanceId,P&&P.box&&R?R:z,p.ID),k&&D&&this.collisionIndex.insertCollisionBox(D.box,o.get("icon-ignore-placement"),r.bucketInstanceId,L,p.ID),O&&(S&&this.collisionIndex.insertCollisionCircles(O.circles,o.get("text-ignore-placement"),r.bucketInstanceId,z,p.ID),i)){const t=r.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new ft);for(let t=0;t=0;--e){const n=t[e];S(r.symbolInstances.get(n),n,r.collisionArrays[n])}}else for(let t=e.symbolInstanceStart;t=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:i.crossTileID)}markUsedOrientation(e,n,i){const r=n===t.WritingMode.horizontal||n===t.WritingMode.horizontalOnly?n:0,o=n===t.WritingMode.vertical?n:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let n=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const i=e?e.symbolFadeChange(t):1,r=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=r[t];o?(this.opacities[t]=new ht(o,i,e.text,e.icon),n=n||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new ht(null,i,e.text,e.icon,e.skipFade),n=n||e.text||e.icon)}for(const t in r){const e=r[t];if(!this.opacities[t]){const r=new ht(e,i,!1,!1);r.isHidden()||(this.opacities[t]=r,n=n||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);n?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const n={};for(const i of e){const e=i.getBucket(t);e&&i.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,n,i.collisionBoxArray)}}updateBucketOpacities(e,n,i){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const r=e.layers[0].layout,o=new ht(null,0,!1,!1,!0),a=r.get("text-allow-overlap"),s=r.get("icon-allow-overlap"),l=r.get("text-variable-anchor"),c="map"===r.get("text-rotation-alignment"),u="map"===r.get("text-pitch-alignment"),h="none"!==r.get("icon-text-fit"),d=new ht(null,0,a&&(s||!e.hasIconData()||r.get("icon-optional")),s&&(a||!e.hasTextData()||r.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);const f=(t,e,n)=>{for(let i=0;i0,_=this.placedOrientations[r.crossTileID],v=_===t.WritingMode.vertical,y=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(a>0||s>0){const t=Mt(m.text);f(e.text,a,v?Et:t),f(e.text,s,y?Et:t);const n=m.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach(t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||v?1:0)}),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=n||y?1:0);const i=this.variableOffsets[r.crossTileID];i&&this.markUsedJustification(e,i.anchor,r,_);const o=this.placedOrientations[r.crossTileID];o&&(this.markUsedJustification(e,"left",r,o),this.markUsedOrientation(e,o,r))}if(g){const t=Mt(m.icon),n=!(h&&r.verticalPlacedIconSymbolIndex&&v);r.placedIconSymbolIndex>=0&&(f(e.icon,r.numIconVertices,n?t:Et),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=m.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(f(e.icon,r.numVerticalIconVertices,n?Et:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const n=e.collisionArrays[i];if(n){let i=new t.Point(0,0);if(n.textBox||n.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[p];e?(i=gt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&i._rotate(u?this.transform.angle:-this.transform.angle)):t=!1}n.textBox&&yt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||v,i.x,i.y),n.verticalTextBox&&yt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||y,i.x,i.y)}const r=Boolean(!y&&n.verticalIconBox);n.iconBox&&yt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,r,h?i.x:0,h?i.y:0),n.verticalIconBox&&yt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!r,h?i.x:0,h?i.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function yt(t,e,n,i,r){t.emplaceBack(e?1:0,n?1:0,i||0,r||0),t.emplaceBack(e?1:0,n?1:0,i||0,r||0),t.emplaceBack(e?1:0,n?1:0,i||0,r||0),t.emplaceBack(e?1:0,n?1:0,i||0,r||0)}const xt=Math.pow(2,25),bt=Math.pow(2,24),wt=Math.pow(2,17),Tt=Math.pow(2,16),Ct=Math.pow(2,9),St=Math.pow(2,8),kt=Math.pow(2,1);function Mt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,n=Math.floor(127*t.opacity);return n*xt+e*bt+n*wt+e*Tt+n*Ct+e*St+n*kt+e}const Et=0;class At{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,n,i,r){const o=this._bucketParts;for(;this._currentTileIndext.sortKey-e.sortKey));this._currentPartIndex{const e=t.browser.now()-r;return!this._forceFullPlacement&&e>2};for(;this._currentPlacementIndex>=0;){const t=n[e[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=r)&&(!t.maxzoom||t.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new At(t)),this._inProgressLayer.continuePlacement(i[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const It=512/t.EXTENT/2;class Ot{constructor(t,e,n){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let n=0;nt.overscaledZ)for(const n in r){const o=r[n];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,i)}else{const o=r[t.scaledTo(Number(n)).key];o&&o.findMatches(e.symbolInstances,t,i)}}for(let t=0;t{e[t]=!0});for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const Lt=(e,n)=>t.emitValidationErrors(e,n&&n.filter(t=>"source.canvas"!==t.identifier)),Ft=t.pick(N,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain"]),Bt=t.pick(N,["setCenter","setZoom","setBearing","setPitch"]),Nt=function(){const e={},n=t.styleSpec.$version;for(const i in t.styleSpec.$root){const r=t.styleSpec.$root[i];if(r.required){let t=null;t="version"===i?n:"array"===r.type?[]:{},null!=t&&(e[i]=t)}}return e}(),$t={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class jt extends t.Evented{constructor(e,n={}){super(),this.map=e,this.dispatcher=new _(L(),this),this.imageManager=new h,this.imageManager.setEventedParent(this),this.glyphManager=new t.GlyphManager(e._requestManager,n.localFontFamily?t.LocalGlyphMode.all:n.localIdeographFontFamily?t.LocalGlyphMode.ideographs:t.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.lineAtlas=new g(256,512),this.crossTileSymbolIndex=new Rt,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const i=this;this._rtlTextPluginCallback=jt.registerForPluginStateChange(e=>{i.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(e,n)=>{if(t.triggerPluginCompletionEvent(e),n&&n.every(t=>t))for(const t in i._sourceCaches){const e=i._sourceCaches[t],n=e.getSource().type;"vector"!==n&&"geojson"!==n||e.reload()}})}),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.getSource(t.sourceId);if(e&&e.vectorLayerIds)for(const t in this._layers){const n=this._layers[t];n.source===e.id&&this._validateLayer(n)}})}loadURL(e,n={}){this.fire(new t.Event("dataloading",{dataType:"style"}));const i="boolean"==typeof n.validate?n.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,n.accessToken);const r=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(r,(e,n)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):n&&this._load(n,i)})}loadJSON(e,n={}){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame(()=>{this._request=null,this._load(e,!1!==n.validate)})}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(Nt,!1)}_updateLayerCount(t,e){const n=e?1:-1;t.is3D()&&(this._num3DLayers+=n),"circle"===t.type&&(this._numCircleLayers+=n),"symbol"===t.type&&(this._numSymbolLayers+=n)}_load(e,n){if(n&&Lt(this,t.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(const t in e.sources)this.addSource(t,e.sources[t],{validate:!1});this._changed=!1,e.sprite?this._loadSprite(e.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(e.glyphs);const i=B(this.stylesheet.layers);this._order=i.map(t=>t.id),this._layers={},this._serializedLayers={};for(let e of i)e=t.createStyleLayer(e),e.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=e,this._serializedLayers[e.id]=e.serialize(),this._updateLayerCount(e,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new f(this.stylesheet.light),this.stylesheet.terrain&&this._createTerrain(this.stylesheet.terrain),this._updateDrapeFirstLayers(),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(e,n,i){let r,o,a;const s=t.browser.devicePixelRatio>1?"@2x":"";let l=t.getJSON(n.transformRequest(n.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(t,e)=>{l=null,a||(a=t,r=e,u())}),c=t.getImage(n.transformRequest(n.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(t,e)=>{c=null,a||(a=t,o=e,u())});function u(){if(a)i(a);else if(r&&o){const e=t.browser.getImageData(o),n={};for(const i in r){const{width:o,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:f}=r[i],p=new t.RGBAImage({width:o,height:a});t.RGBAImage.copy(e,p,{x:s,y:l},{x:0,y:0},{width:o,height:a}),n[i]={data:p,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:f}}i(null,n)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(e,this.map._requestManager,(e,n)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(n)for(const t in n)this.imageManager.addImage(t,n[t]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new t.Event("data",{dataType:"style"}))})}_validateLayer(e){const n=this.getSource(e.source);if(!n)return;const i=e.sourceLayer;i&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(i))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${e.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const e=[];for(const n of t){const t=this._layers[n];"custom"!==t.type&&e.push(t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(t){return!!this.terrain&&$t[t.type]}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(e){if(!this._loaded)return;const n=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(t.length||n.length)&&this._updateWorkerLayers(t,n);for(const t in this._updatedSources){const e=this._updatedSources[t];"reload"===e?this._reloadSource(t):"clear"===e&&this._clearSource(t)}this._updateTilesForChangedImages();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const i={};for(const t in this._sourceCaches){const e=this._sourceCaches[t];i[t]=e.used,e.used=!1}for(const t of this._order){const n=this._layers[t];if(n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)){const t=this._getLayerSourceCache(n);t&&(t.used=!0)}const i=this.map.painter;if(i){const t=n.getProgramIds();if(!t)continue;const r=n.getProgramConfiguration(e.zoom);for(const e of t)i.useProgram(e,r)}}for(const e in i){const n=this._sourceCaches[e];i[e]!==n.used&&n.getSource().fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:n.getSource().id}))}this.light.recalculate(e),this.terrain&&this.terrain.recalculate(e),this.z=e.zoom,n&&this.fire(new t.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this._sourceCaches)this._sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(e){if(this._checkLoaded(),Lt(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=B(e.layers);const n=function(e,n){if(!e)return[{command:N.setStyle,args:[n]}];let i=[];try{if(!t.deepEqual(e.version,n.version))return[{command:N.setStyle,args:[n]}];t.deepEqual(e.center,n.center)||i.push({command:N.setCenter,args:[n.center]}),t.deepEqual(e.zoom,n.zoom)||i.push({command:N.setZoom,args:[n.zoom]}),t.deepEqual(e.bearing,n.bearing)||i.push({command:N.setBearing,args:[n.bearing]}),t.deepEqual(e.pitch,n.pitch)||i.push({command:N.setPitch,args:[n.pitch]}),t.deepEqual(e.sprite,n.sprite)||i.push({command:N.setSprite,args:[n.sprite]}),t.deepEqual(e.glyphs,n.glyphs)||i.push({command:N.setGlyphs,args:[n.glyphs]}),t.deepEqual(e.transition,n.transition)||i.push({command:N.setTransition,args:[n.transition]}),t.deepEqual(e.light,n.light)||i.push({command:N.setLight,args:[n.light]});const r={},o=[];!function(e,n,i,r){let o;for(o in n=n||{},e=e||{})e.hasOwnProperty(o)&&(n.hasOwnProperty(o)||j(o,i,r));for(o in n)n.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t.deepEqual(e[o],n[o])||("geojson"===e[o].type&&"geojson"===n[o].type&&V(e,n,o)?i.push({command:N.setGeoJSONSourceData,args:[o,n[o].data]}):U(o,n,i,r)):$(o,n,i))}(e.sources,n.sources,o,r);const a=[];e.layers&&e.layers.forEach(t=>{r[t.source]?i.push({command:N.removeLayer,args:[t.id]}):a.push(t)});let s=e.terrain;s&&r[s.source]&&(i.push({command:N.setTerrain,args:[void 0]}),s=void 0),i=i.concat(o),t.deepEqual(s,n.terrain)||i.push({command:N.setTerrain,args:[n.terrain]}),function(e,n,i){n=n||[];const r=(e=e||[]).map(Z),o=n.map(Z),a=e.reduce(G,{}),s=n.reduce(G,{}),l=r.slice(),c=Object.create(null);let u,h,d,f,p,m,g;for(u=0,h=0;u!(t.command in Bt));if(0===n.length)return!1;const i=n.filter(t=>!(t.command in Ft));if(i.length>0)throw new Error(`Unimplemented: ${i.map(t=>t.command).join(", ")}.`);return n.forEach(t=>{"setTransition"!==t.command&&this[t.command].apply(this,t.args)}),this.stylesheet=e,!0}addImage(e,n){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,i={}){if(this._checkLoaded(),void 0!==this.getSource(e))throw new Error("There is already a source with this ID");if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,n,null,i))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const r=M(e,n,this.dispatcher,this);r.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:r.serialize(),sourceId:e}));const o=n=>{const i=(n?"symbol:":"other:")+e,o=this._sourceCaches[i]=new t.SourceCache(i,r,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[e]=o,o.style=this,o.onAdd(this.map)};o(!1),"vector"!==n.type&&"geojson"!==n.type||o(!0),r.onAdd&&r.onAdd(this.map),this._changed=!0}removeSource(e){this._checkLoaded();const n=this.getSource(e);if(void 0===n)throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${n}" is using it.`)));if(this.terrain&&this.terrain.get().source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while terrain is using it.`)));const i=this._getSourceCaches(e);for(const e of i)delete this._sourceCaches[e.id],delete this._updatedSources[e.id],e.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e.getSource().id})),e.setEventedParent(null),e.clearTiles();delete this._otherSourceCaches[e],delete this._symbolSourceCaches[e],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){this._checkLoaded(),this.getSource(t).setData(e),this._changed=!0}getSource(t){const e=this._getSourceCache(t);return e&&e.getSource()}addLayer(e,n,i={}){this._checkLoaded();const r=e.id;if(this.getLayer(r))return void this.fire(new t.ErrorEvent(new Error(`Layer with id "${r}" already exists on this map`)));let o;if("custom"===e.type){if(Lt(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(r,e.source),e=t.clone$1(e),e=t.extend(e,{source:r})),this._validate(t.validateStyle.layer,"layers."+r,e,{arrayIndex:-1},i))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[o.id]=o.serialize(),this._updateLayerCount(o,!0)}const a=n?this._order.indexOf(n):this._order.length;if(n&&-1===a)return void this.fire(new t.ErrorEvent(new Error(`Layer with id "${n}" does not exist on this map.`)));this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=o;const s=this._getLayerSourceCache(o);if(this._removedLayers[r]&&o.source&&s&&"custom"!==o.type){const t=this._removedLayers[r];delete this._removedLayers[r],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",s.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;const i=this._order.indexOf(e);this._order.splice(i,1);const r=n?this._order.indexOf(n):this._order.length;n&&-1===r?this.fire(new t.ErrorEvent(new Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(r,0,e),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(e){this._checkLoaded();const n=this._layers[e];if(!n)return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);const i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}hasLayerType(t){for(const e in this._layers)if(this._layers[e].type===t)return!0;return!1}setLayerZoomRange(e,n,i){this._checkLoaded();const r=this.getLayer(e);r?r.minzoom===n&&r.maxzoom===i||(null!=n&&(r.minzoom=n),null!=i&&(r.maxzoom=i),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(e,n,i={}){this._checkLoaded();const r=this.getLayer(e);if(r){if(!t.deepEqual(r.filter,n))return null==n?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(t.validateStyle.filter,`layers.${r.id}.filter`,n,null,i)||(r.filter=t.clone$1(n),this._updateLayer(r)))}else this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be filtered.`)))}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,n,i,r={}){this._checkLoaded();const o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(n),i)||(o.setLayoutProperty(n,i,r),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(e,n){const i=this.getLayer(e);if(i)return i.getLayoutProperty(n);this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style.`)))}setPaintProperty(e,n,i,r={}){this._checkLoaded();const o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(n),i)||(o.setPaintProperty(n,i,r)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,n){this._checkLoaded();const i=e.source,r=e.sourceLayer,o=this.getSource(i);if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)));const a=o.type;if("geojson"===a&&r)return void this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===a&&!r)return void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided.")));const s=this._getSourceCaches(i);for(const t of s)t.setFeatureState(r,e.id,n)}removeFeatureState(e,n){this._checkLoaded();const i=e.source,r=this.getSource(i);if(void 0===r)return void this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)));const o=r.type,a="vector"===o?e.sourceLayer:void 0;if("vector"===o&&!a)return void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof e.id&&"number"!=typeof e.id)return void this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const s=this._getSourceCaches(i);for(const t of s)t.removeFeatureState(a,e.id,n)}getFeatureState(e){this._checkLoaded();const n=e.source,i=e.sourceLayer,r=this.getSource(n);if(void 0!==r){if("vector"!==r.type||i)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(i,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const e={};for(const t in this._sourceCaches){const n=this._sourceCaches[t].getSource();e[n.id]||(e[n.id]=n.serialize())}return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:e,layers:this._serializeLayers(this._order)},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0;const e=this._getLayerSourceCache(t);t.source&&!this._updatedSources[t.source]&&e&&"raster"!==e.getSource().type&&(this._updatedSources[t.source]="reload",e.pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,n={},i=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(e(o)){n[o]=r;for(const e of t){const t=e[o];if(t)for(const e of t)i.push(e)}}}i.sort((t,e)=>e.intersectionZ-t.intersectionZ);const r=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=i.length-1;t>=0;t--){const e=i[t].feature;if(n[e.layer.id]{const e=this.getLayer(t);return e&&e.is3D()}):this.has3DLayers(),s=y.createFromScreenPoints(e,i);for(const t in this._sourceCaches){const e=this._sourceCaches[t].getSource().id;n.layers&&!r[e]||o.push(A(this._sourceCaches[t],this._layers,this._serializedLayers,s,n,i,a,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(t,e,n,i,r,o,a){const s={},l=o.queryRenderedSymbols(i),c=[];for(const t of Object.keys(l).map(Number))c.push(a[t]);c.sort(I);for(const n of c){const i=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],e,n.bucketIndex,n.sourceLayerIndex,r.filter,r.layers,r.availableImages,t);for(const t in i){const e=s[t]=s[t]||[],r=i[t];r.sort((t,e)=>{const i=n.featureSortOrder;if(i){const n=i.indexOf(t.featureIndex);return i.indexOf(e.featureIndex)-n}return e.featureIndex-t.featureIndex});for(const t of r)e.push(t)}}for(const e in s)s[e].forEach(i=>{const r=i.feature,o=n(t[e]).getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=o});return s}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),s.screenGeometry,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,n){n&&n.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const i=this._getSourceCaches(e);let r=[];for(const t of i)r=r.concat(P(t,n));return r}addSourceType(t,e,n){return jt.getSourceType(t)?n(new Error(`A source type called "${t}" already exists.`)):(jt.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();const i=this.light.getLight();let r=!1;for(const n in e)if(!t.deepEqual(e[n],i[n])){r=!0;break}if(!r)return;const o={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(o)}setTerrain(e){if(this._checkLoaded(),!e)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),void this._force3DLayerUpdate();if("object"==typeof e.source){const n="terrain-dem-src";this.addSource(n,e.source),e=t.clone$1(e),e=t.extend(e,{source:n})}if(!this._validate(t.validateStyle.terrain,"terrain",e)){if(this.terrain){const n=this.terrain,i=n.get();for(const r in e)if(!t.deepEqual(e[r],i[r])){n.set(e),this.stylesheet.terrain=e;const i={now:t.browser.now(),transition:t.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(i);break}}else this._createTerrain(e);this._updateDrapeFirstLayers()}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const t=this._order.filter(t=>this.isLayerDraped(this._layers[t])),e=this._order.filter(t=>!this.isLayerDraped(this._layers[t]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...e)}_createTerrain(e){const n=this.terrain=new m(e);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const i={now:t.browser.now(),transition:t.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(i)}_force3DLayerUpdate(){for(const t in this._layers){const e=this._layers[t];"fill-extrusion"===e.type&&this._updateLayer(e)}}_validate(e,n,i,r,o={}){return(!o||!1!==o.validate)&&Lt(this,e.call(t.validateStyle,t.extend({key:n,style:this.serialize(),value:i,styleSpec:t.styleSpec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this._sourceCaches)this._sourceCaches[t].clearTiles(),this._sourceCaches[t].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){const e=this._getSourceCaches(t);for(const t of e)t.clearTiles()}_reloadSource(t){const e=this._getSourceCaches(t);for(const t of e)t.resume(),t.reload()}_updateSources(t){for(const e in this._sourceCaches)this._sourceCaches[e].update(t)}_generateCollisionBoxes(){for(const t in this._sourceCaches){const e=this._sourceCaches[t];e.resume(),e.reload()}}_updatePlacement(e,n,i,r,o=!1){let a=!1,s=!1;const l={};for(const t of this._order){const n=this._layers[t];if("symbol"!==n.type)continue;if(!l[n.source]){const t=this._getLayerSourceCache(n);if(!t)continue;l[n.source]=t.getRenderableIds(!0).map(e=>t.getTileByID(e)).sort((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1))}const i=this.crossTileSymbolIndex.addLayer(n,l[n.source],e.center.lng);a=a||i}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),o=o||this._layerOrderChanged||0===i,this._layerOrderChanged&&this.fire(new t.Event("neworder")),(o||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new Pt(e,this._order,o,n,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.browser.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,n){this.imageManager.getImages(e.icons,n),this._updateTilesForChangedImages();const i=t=>{t&&t.setDependencies(e.tileID.key,e.type,e.icons)};i(this._otherSourceCaches[e.source]),i(this._symbolSourceCaches[e.source])}getGlyphs(t,e,n){this.glyphManager.getGlyphs(e.stacks,n)}getResource(e,n,i){return t.makeRequest(n,i)}_getSourceCache(t){return this._otherSourceCaches[t]}_getLayerSourceCache(t){return"symbol"===t.type?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}_getSourceCaches(t){const e=[];return this._otherSourceCaches[t]&&e.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&e.push(this._symbolSourceCaches[t]),e}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}}jt.getSourceType=function(t){return k[t]},jt.setSourceType=function(t,e){k[t]=e},jt.registerForPluginStateChange=t.registerForPluginStateChange;var Ut="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}";let Vt={};Vt=be("","\n#define ELEVATION_SCALE 7.3\n#ifdef TERRAIN\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;uniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));float tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);}float prevElevation(vec2 apos) {float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {vec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*word/ELEVATION_SCALE;}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",!0);const qt=be("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nconst float PI=3.141592653589793;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const float PI=3.141592653589793;const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),Zt=be("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Gt=be("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),Ht=be("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);vec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),Xt=be("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Wt=be("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}"),Yt=be("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),Kt=be("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=u_matrix*vec4(a_pos,elevation(a_pos),1.0);gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),Jt=be("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),Qt=be("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);}"),te=be("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),ee=be("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ne=be("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ie=be("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),re=be("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;\n#ifdef TERRAIN\nvec2 centroid_pos=a_centroid_pos;bool flat_roof=centroid_pos.x !=0.0;float ele=elevation(pos_nx.xy);float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);gl_Position=mix(u_matrix*vec4(pos_nx.xy,h,1),AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(pos_nx.xy,t > 0.0 ? height : base,1);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),oe=be("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;\n#ifdef TERRAIN\nvec2 centroid_pos=a_centroid_pos;bool flat_roof=centroid_pos.x !=0.0;float ele=elevation(pos_nx.xy);float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);gl_Position=mix(u_matrix*vec4(pos_nx.xy,h,1),AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(pos_nx.xy,z,1);\n#endif\nvec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),ae=be("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),se=be("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),le=be("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_width2=vec2(outset,inset);}"),ce=be("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_width2=vec2(outset,inset);}"),ue=be("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),he=be("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),de=be("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),fe=be("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));}"),pe=be("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),me=be("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),ge=be("uniform sampler2D u_image0;varying vec2 v_pos0;void main() {gl_FragColor=texture2D(u_image0,v_pos0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;const float skirtOffset=24575.0;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;vec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);}"),_e=be("#ifdef GL_ES\nprecision highp float;\n#endif\nvec4 pack_depth(float ndc_z) {float depth=ndc_z*0.5+0.5;const vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}varying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),ve=be("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(vec3(p.xyx)*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;color.rgb+=rnd/255.0;return color;}float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",Ut),ye=be("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform lowp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(vec3(p.xyx)*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;color.rgb+=rnd/255.0;return color;}void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5))*u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",Ut),xe=be("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}");function be(t,e,n){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),o=t.match(/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=e.match(/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g);let s=a?a.concat(o):o;n||(s=Vt.staticUniforms.concat(s));const l={};return{fragmentSource:t=t.replace(i,(t,e,n,i,r)=>(l[r]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${n} ${i} ${r};\n#else\nuniform ${n} ${i} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${n} ${i} ${r} = u_${r};\n#endif\n`)),vertexSource:e=e.replace(i,(t,e,n,i,r)=>{const o="float"===i?"vec2":"vec4",a=r.match(/color/)?"color":o;return l[r]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${n} ${o} a_${r};\nvarying ${n} ${i} ${r};\n#else\nuniform ${n} ${i} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${n} ${i} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${n} ${i} ${r} = u_${r};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${n} ${o} a_${r};\n#else\nuniform ${n} ${i} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${n} ${i} ${r} = a_${r};\n#else\n ${n} ${i} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${n} ${i} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${n} ${i} ${r} = u_${r};\n#endif\n`}),staticAttributes:r,staticUniforms:s}}var we=Object.freeze({__proto__:null,get preludeTerrain(){return Vt},prelude:qt,background:Zt,backgroundPattern:Gt,circle:Ht,clippingMask:Xt,heatmap:Wt,heatmapTexture:Yt,collisionBox:Kt,collisionCircle:Jt,debug:Qt,fill:te,fillOutline:ee,fillOutlinePattern:ne,fillPattern:ie,fillExtrusion:re,fillExtrusionPattern:oe,hillshadePrepare:ae,hillshade:se,line:le,lineGradient:ce,linePattern:ue,lineSDF:he,raster:de,symbolIcon:fe,symbolSDF:pe,symbolTextAndIcon:me,terrainRaster:ge,terrainDepth:_e,skybox:ve,skyboxGradient:ye,skyboxCapture:xe});class Te{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,n,i,r,o,a,s){this.context=t;let l=this.boundPaintVertexBuffers.length!==i.length;for(let t=0;!l&&t{const r=n.paint.get("hillshade-shadow-color"),o=n.paint.get("hillshade-highlight-color"),a=n.paint.get("hillshade-accent-color");let s=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(s-=t.transform.angle);const l=!t.options.moving;return{u_matrix:i||t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Ce(0,e.tileID),u_light:[n.paint.get("hillshade-exaggeration"),s],u_shadow:r,u_highlight:o,u_accent:a}})(e,i,r,e.terrain?n.posMatrix:null);h.draw(l,c.TRIANGLES,o,a,s,t.CullFaceMode.disabled,d,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function ke(e,n,i){if(!n.needsDEMTextureUpload)return;const r=e.context,o=r.gl;r.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||e.getTileTexture(i.stride);const a=i.getPixels();n.demTexture?n.demTexture.update(a,{premultiply:!1}):n.demTexture=new t.Texture(r,a,o.RGBA,{premultiply:!1}),n.needsDEMTextureUpload=!1}function Me(e,n,i,r,o,a){const s=e.context,l=s.gl;if(!n.dem)return;const c=n.dem;if(s.activeTexture.set(l.TEXTURE1),ke(e,n,c),!n.demTexture)return;n.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);const u=c.dim;s.activeTexture.set(l.TEXTURE0);let h=n.fbo;if(!h){const e=new t.Texture(s,{width:u,height:u,data:null},l.RGBA);e.bind(l.LINEAR,l.CLAMP_TO_EDGE),h=n.fbo=s.createFramebuffer(u,u,!0),h.colorAttachment.set(e.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,u,u]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,r,o,a,t.CullFaceMode.disabled,((e,n)=>{const i=n.stride,r=t.create();return t.ortho(r,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(r,r,[0,-t.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,c),i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),n.needsHillshadePrepare=!1}const Ee=(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image0:new t.Uniform1i(e,n.u_image0),u_skirt_height:new t.Uniform1f(e,n.u_skirt_height)}),Ae=(t,e)=>({u_matrix:t,u_image0:0,u_skirt_height:e}),Pe=new class{constructor(){this.operations={}}newMorphing(t,e,n,i,r){if(t in this.operations){const e=this.operations[t];e.to.tileID.key!==n.tileID.key&&(e.queued=n)}else this.operations[t]={startTime:i,phase:0,duration:r,from:e,to:n,queued:null}}getMorphValuesForProxy(t){if(!(t in this.operations))return null;const e=this.operations[t];return{from:e.from,to:e.to,phase:e.phase}}update(t){for(const e in this.operations){const n=this.operations[e];for(n.phase=(t-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,t)){delete this.operations[e];break}}}_nextOp(t,e){return!!t.queued&&(t.from=t.to,t.to=t.queued,t.queued=null,t.phase=0,t.startTime=e,!0)}_validOp(t){return t.from.hasData()&&t.to.hasData()}},Ie={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Oe(e,n,i,r,o){const a=e.context,s=a.gl;let l=e.useProgram("terrainRaster"),c=0;const u=e.colorModeForRenderPass(),h=new t.DepthMode(s.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D);Pe.update(o);const d=e.transform,f=6*Math.pow(1.5,22-d.zoom)*n.exaggeration();var p,m,g;for(const _ of r){const r=i.getTile(_),v=t.StencilMode.disabled,y=n.prevTerrainTileForTile[_.key],x=n.terrainTileForTile[_.key];g=x,null!=(m=y)&&null!=g&&m.hasData()&&g.hasData()&&null!=m.demTexture&&null!=g.demTexture&&m.tileID.key!==g.tileID.key&&Pe.newMorphing(_.key,y,x,o,250),a.activeTexture.set(s.TEXTURE0),r.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST);const b=Pe.getMorphValuesForProxy(_.key),w=b?1:0;let T;b&&(T={morphing:{srcDemTile:b.from,dstDemTile:b.to,phase:t.easeCubicInOut(b.phase)}});const C=Ae(_.posMatrix,De(_.canonical,d.renderWorldCopies)?f/10:f);c!==(p=w)&&(l=e.useProgram("terrainRaster",null,Ie[p]),c=p),n.setupElevationDraw(r,l,T),l.draw(a,s.TRIANGLES,h,v,u,t.CullFaceMode.backCCW,C,"terrain_raster",n.gridBuffer,n.gridIndexBuffer,n.gridSegments)}}function De(t,e){const n=1<({u_matrix:t});function Re(e,n,i,r,o){if(o>0){const a=t.browser.now(),s=(a-e.timeAdded)/o,l=n?(a-n.timeAdded)/o:-1,c=i.getSource(),u=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!n||Math.abs(n.tileID.overscaledZ-u)>Math.abs(e.tileID.overscaledZ-u),d=h&&e.refreshedUponExpiration?1:t.clamp(h?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),n?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}class Le extends t.SourceCache{constructor(t){const e=M("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new _(L(),null),t.style);super("proxy",e,!1),e.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,n,i){if(e.freezeTileCoverage)return;this.transform=e;const r=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,useElevationData:!0}).reduce((n,i)=>{if(n[i.key]="",!this._tiles[i.key]){const n=new t.Tile(i,this._source.tileSize*i.overscaleFactor(),e.tileZoom);n.state="loaded",this._tiles[i.key]=n}return n},{});for(const t in this._tiles)t in r||(this.freeFBO(t),this._tiles[t].state="unloaded",delete this._tiles[t])}freeFBO(t){const e=this.proxyCachedFBO[t];if(void 0!==e){const n=Object.values(e);this.renderCachePool.push(...n),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Fe extends t.OverscaledTileID{constructor(t,e,n){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=e,this.posMatrix=n}}class Be extends t.Elevation{constructor(e,n){super(),this.painter=e,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[i,r,o]=function(e){const n=new t.StructArrayLayout4i8,i=new t.StructArrayLayout3ui6;n.reserve(17161),i.reserve(33800);const r=t.EXTENT/128,o=t.EXTENT+r/2,a=o+r;for(let e=-r;eo||e<0||e>o?24575:0,a=t.clamp(Math.round(i),0,t.EXTENT),s=t.clamp(Math.round(e),0,t.EXTENT);n.emplaceBack(a+r,s,a,s)}const s=(t,e)=>{const n=131*e+t;i.emplaceBack(n+1,n,n+131),i.emplaceBack(n+131,n+131+1,n+1)};for(let t=1;t<129;t++)for(let e=1;e<129;e++)s(e,t);return[0,129].forEach(t=>{for(let e=0;e<130;e++)s(e,t),s(t,e)}),[n,i,32768]}(),a=e.context;this.gridBuffer=a.createVertexBuffer(i,C.members),this.gridIndexBuffer=a.createIndexBuffer(r),this.gridSegments=t.SegmentVector.simpleSegment(0,0,i.length,r.length),this.gridNoSkirtSegments=t.SegmentVector.simpleSegment(0,0,i.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Le(n.map),this.orthoMatrix=t.create(),t.ortho(this.orthoMatrix,0,t.EXTENT,0,t.EXTENT,0,1);const s=a.gl;this._overlapStencilMode=new t.StencilMode({func:s.GEQUAL,mask:255},0,255,s.KEEP,s.KEEP,s.REPLACE),this._previousZoom=e.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),t.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=t,this._checkRenderCacheEfficiency()}update(e,n,i){if(e&&e.terrain){this._style!==e&&(this.style=e),this.enabled=!0;const r=e.terrain.properties;this.sourceCache=e._getSourceCache(r.get("source")),this._exaggeration=r.get("exaggeration");const o=()=>{this.sourceCache.used&&t.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const e=this.sourceCache.getSource().tileSize/128,i=this.proxySourceCache.getSource().tileSize;this.sourceCache.update(n,e*i,!0),this._findCoveringTileCache[this.sourceCache.id]={}};this.sourceCache.usedForTerrain||(this._findCoveringTileCache[this.sourceCache.id]={},this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),n.updateElevation(!i),this._findCoveringTileCache[this.proxySourceCache.id]={},this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0}else this._disable()}_checkRenderCacheEfficiency(){const e=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==e.efficiency&&t.warnOnce(`Terrain render cache efficiency is not optimal (${e.efficiency}%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '${e.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(t){t.coord&&"source"===t.dataType?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):"style"===t.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._sourceCaches)this._style._sourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(e){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,i=this.painter.transform;this._initializing&&(this._initializing=0===i._centerAltitude&&-1===this.getAtPoint(t.MercatorCoordinate.fromLngLat(i.center),-1),this._emptyDEMTextureDirty=!this._initializing);const r=this.painter.options;this.renderCached=(r.zooming||r.moving||r.rotating||!!this.forceRenderCached)&&!this._invalidateRenderCache,this._invalidateRenderCache=!1;const o=this.proxyCoords=n.getIds().map(t=>{const e=n.getTileByID(t).tileID;return e.posMatrix=i.calculatePosMatrix(e.toUnwrapped()),e});!function(e,n){const i=n.transform.pointCoordinate(n.transform.getCameraPoint()),r=new t.Point(i.x,i.y);e.sort((e,n)=>{if(n.overscaledZ-e.overscaledZ)return n.overscaledZ-e.overscaledZ;const i=new t.Point(e.canonical.x+(1<{this.proxyToSource[t.key]={}}),this.terrainTileForTile={};const s=this._style._sourceCaches;for(const t in s){const n=s[t];if(!n.used)continue;if(n!==this.sourceCache&&(this._findCoveringTileCache[n.id]={}),this._setupProxiedCoordsForOrtho(n,e[t],a),n.usedForTerrain)continue;const i=e[t];n.getSource().reparseOverscaled&&this._assignTerrainTiles(i)}this.proxiedCoords[n.id]=o.map(t=>new Fe(t,t.key,this.orthoMatrix)),this._assignTerrainTiles(o),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._setupRenderCache(a),this.renderingToTexture=!1,this._initFBOPool(),this._updateTimestamp=t.browser.now();const l={};this._visibleDemTiles=[];for(const t of this.proxyCoords){const e=this.terrainTileForTile[t.key];if(!e)continue;const n=e.tileID.key;n in l||(this._visibleDemTiles.push(e),l[n]=n)}}_assignTerrainTiles(t){this._initializing||t.forEach(t=>{if(this.terrainTileForTile[t.key])return;const e=this._findTileCoveringTileID(t,this.sourceCache);e&&(this.terrainTileForTile[t.key]=e)})}_prepareDEMTextures(){const t=this.painter.context,e=t.gl;for(const n in this.terrainTileForTile){const i=this.terrainTileForTile[n],r=i.dem;!r||i.demTexture&&!i.needsDEMTextureUpload||(t.activeTexture.set(e.TEXTURE1),ke(this.painter,i,r))}}_prepareDemTileUniforms(t,e,n,i){if(!e||null==e.demTexture)return!1;const r=t.tileID.canonical,o=Math.pow(2,e.tileID.canonical.z-r.z),a=i||"";return n["u_dem_tl"+a]=[r.x*o%1,r.y*o%1],n["u_dem_scale"+a]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){let t=0;const e=this._visibleDemTiles.reduce((e,n)=>{if(!n.dem)return e;const i=n.dem.tree.minimums[0];return i>0&&t++,e+i},0);return t?e/t:0}_updateEmptyDEMTexture(){const e=this.painter.context,n=e.gl;e.activeTexture.set(n.TEXTURE2);const i=this._getLoadedAreaMinimum(),r={width:1,height:1,data:new Uint8Array(t.DEMData.pack(i,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(r,{premultiply:!1}):o=this._emptyDEMTexture=new t.Texture(e,r,n.RGBA,{premultiply:!1}),o}setupElevationDraw(e,n,i){const r=this.painter.context,o=r.gl,a=(s=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:t.DEMData.getUnpackVector(s),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});var s;a.u_dem_size=this.sourceCache.getSource().tileSize,a.u_exaggeration=this.exaggeration();let l=null,c=null,u=1;if(i&&i.morphing&&this._useVertexMorphing){const t=i.morphing.srcDemTile,n=i.morphing.dstDemTile;u=i.morphing.phase,t&&n&&(this._prepareDemTileUniforms(e,t,a,"_prev")&&(c=t),this._prepareDemTileUniforms(e,n,a)&&(l=n))}if(c&&l?(r.activeTexture.set(o.TEXTURE2),l.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),r.activeTexture.set(o.TEXTURE4),c.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),a.u_dem_lerp=u):(l=this.terrainTileForTile[e.tileID.key],r.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(e,l,a)?l.demTexture:this.emptyDEMTexture).bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST)),i&&i.useDepthForOcclusion&&(r.activeTexture.set(o.TEXTURE3),this._depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),a.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height]),i&&i.useMeterToDem&&l){const e=(1<{i.bindFramebuffer.set(null),i.viewport.set([0,0,n.width,n.height]),this.renderingToTexture=!1},s=this._drapedRenderBatches.shift();let l=[];const c=n.style.order;let u=0;for(let h=0;h0&&(a(),Oe(n,this,r,l,this._updateTimestamp),this.renderingToTexture=!0,l=[]))}else l.push(f.tileID)}return a(),l.length>0&&Oe(n,this,r,l,this._updateTimestamp),s.end+1}postRender(){}renderCacheEfficiency(t){const e=t.order.length;if(0===e)return{efficiency:100};let n,i=0,r=0,o=!1;for(let a=0;at.dem).map(i=>{const r=i.tileID,o=Math.pow(2,r.overscaledZ),{x:a,y:s}=r.canonical,l=a/o,c=(a+1)/o,u=s/o,h=(s+1)/o;return{minx:l,miny:u,maxx:c,maxy:h,t:i.dem.tree.raycastRoot(l,u,c,h,t,e,n),tile:i}});i.sort((t,e)=>(null!==t.t?t.t:Number.MAX_VALUE)-(null!==e.t?e.t:Number.MAX_VALUE));for(const r of i){if(null==r.t)return null;const i=r.tile.dem.tree.raycast(r.minx,r.miny,r.maxx,r.maxy,t,e,n);if(null!=i)return i}return null}_createFBO(){const e=this.painter.context,n=e.gl,i=this.drapeBufferSize;e.activeTexture.set(n.TEXTURE0);const r=new t.Texture(e,{width:i[0],height:i[1],data:null},n.RGBA);r.bind(n.LINEAR,n.CLAMP_TO_EDGE);const o=e.createFramebuffer(i[0],i[1],!1);return o.colorAttachment.set(r.texture),e.extTextureFilterAnisotropic&&!e.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,e.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.extTextureFilterAnisotropicMax),{fb:o,tex:r,dirty:!1,ref:1}}_initFBOPool(){for(;this.pool.length{const e=this._style._layers[t],n=!e.isHidden(this.painter.transform.zoom),i=e.getCrossfadeParameters();return"custom"!==e.type&&!n&&!!i&&1!==i.t})}_clearRasterFadeFromRenderCache(){let t=!1;for(const e in this._style._sourceCaches)if(this._style._sourceCaches[e]._source instanceof T){t=!0;break}if(t)for(let t=0;te.renderCachePool.length){const t=Object.values(e.proxyCachedFBO);e.proxyCachedFBO={};for(let n=0;n=0;r--){const o=n[r];if(e.getTileByID(o.key),void 0!==e.proxyCachedFBO[o.key]){const n=t[o.key],r=this.proxyToSource[o.key];let a=0;for(const t in r){const e=r[t],o=n[t];if(!o||o.length!==e.length||e.some((e,n)=>e!==o[n]||i[t]&&i[t].hasOwnProperty(e.key))){a=-1;break}++a}for(const t in e.proxyCachedFBO[o.key])e.renderCache[e.proxyCachedFBO[o.key][t]].dirty=a<0||a!==Object.values(n).length}else for(let t=0;te[e.length-1].overscaledZ))return void(this._overlapStencilType=!1);l=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}if(!s.depthAttachment){const e=r.createRenderbuffer(r.gl.DEPTH_STENCIL,s.width,s.height);s.depthAttachment=new t.DepthStencilAttachment(r,s.framebuffer),s.depthAttachment.set(e),r.clear({stencil:0})}a.ref+l>255&&(r.clear({stencil:0}),a.ref=0),a.ref+=l,this._overlapStencilMode.ref=a.ref,n.isTileClipped()&&this._renderTileClippingMasks(e,this._overlapStencilMode.ref)}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):t.StencilMode.disabled}_renderTileClippingMasks(e,n){const i=this.painter,r=this.painter.context,o=r.gl;i._tileClippingMaskIDs={},r.setColorMode(t.ColorMode.disabled),r.setDepthMode(t.DepthMode.disabled);const a=i.useProgram("clippingMask");for(const s of e){const e=i._tileClippingMaskIDs[s.key]=--n;a.draw(r,o.TRIANGLES,t.DepthMode.disabled,new t.StencilMode({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),t.ColorMode.disabled,t.CullFaceMode.disabled,ze(s.posMatrix),"$clipping",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments)}}pointCoordinate(e){const n=this.painter.transform;if(e.x<0||e.x>n.width||e.y<0||e.y>n.height)return null;const i=[e.x,e.y,1,1];t.transformMat4(i,i,n.pixelMatrixInverse),t.scale$1(i,i,1/i[3]),i[0]/=n.worldSize,i[1]/=n.worldSize;const r=n._camera.position,o=t.mercatorZfromAltitude(1,n.center.lat),a=[r[0],r[1],r[2]/o,0],s=t.subtract([],i.slice(0,3),a);t.normalize(s,s);const l=this.raycast(a,s,this._exaggeration);return null!==l&&l?(t.scaleAndAdd(a,a,s,l),a[3]=a[2],a[2]*=o,a):null}drawDepth(){const e=this.painter,n=e.context,i=this.proxySourceCache,r=Math.ceil(e.width),o=Math.ceil(e.height);if(!this._depthFBO||this._depthFBO.width===r&&this._depthFBO.height===o||(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const e=n.gl,i=n.createFramebuffer(r,o,!0);n.activeTexture.set(e.TEXTURE0);const a=new t.Texture(n,{width:r,height:o,data:null},e.RGBA);a.bind(e.NEAREST,e.CLAMP_TO_EDGE),i.colorAttachment.set(a.texture);const s=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,r,o);i.depthAttachment.set(s),this._depthFBO=i,this._depthTexture=a}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,r,o]),function(e,n,i,r){const o=e.context,a=o.gl;o.clear({depth:1});const s=e.useProgram("terrainDepth"),l=new t.DepthMode(a.LESS,t.DepthMode.ReadWrite,e.depthRangeFor3D);for(const e of r){const r=i.getTile(e),c=Ae(e.posMatrix,0);n.setupElevationDraw(r,s),s.draw(o,a.TRIANGLES,l,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.backCCW,c,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(e,this,i,this.proxyCoords)}_setupProxiedCoordsForOrtho(t,e,n){if(t.getSource()instanceof S)return this._setupProxiedCoordsForImageSource(t,e,n);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const i=this.proxiedCoords[t.id]=[],r=this.proxyCoords;for(let e=0;e(t.min.x=Math.min(t.min.x,e.x-s.x),t.min.y=Math.min(t.min.y,e.y-s.y),t.max.x=Math.max(t.max.x,e.x-s.x),t.max.y=Math.max(t.max.y,e.y-s.y),t),{min:new t.Point(Number.MAX_VALUE,Number.MAX_VALUE),max:new t.Point(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(e,n)=>{const i=e.wrap+e.canonical.x/(1<a+l.max.x||r+os+l.max.y};for(let t=0;tt.key===n.tileID.key);if(t)return t}if(n.tileID.key!==e.key){const i=e.canonical.z-n.tileID.canonical.z;let o,a,s;r=t.create();const l=n.tileID.wrap-e.wrap<0?(o=t.EXTENT>>i,a=o*((n.tileID.canonical.x<=r){const i=e.canonical.z-r;n.getSource().reparseOverscaled?(s=Math.max(e.canonical.z+2,n.transform.tileZoom),a=new t.OverscaledTileID(s,e.wrap,r,e.canonical.x>>i,e.canonical.y>>i)):0!==i&&(s=r,a=new t.OverscaledTileID(s,e.wrap,r,e.canonical.x>>i,e.canonical.y>>i))}a.key!==e.key&&(c.push(a.key),i=n.getTile(a))}const u=t=>{c.forEach(e=>{r[e]=t}),c.length=0};for(s-=1;s>=l&&(!i||!i.hasData());s--){i&&u(i.tileID.key);const t=a.calculateScaledKey(s);if(i=n.getTileByID(t),i&&i.hasData())break;const e=r[t];if(null===e)break;void 0===e?c.push(t):i=n.getTileByID(e)}return u(i?i.tileID.key:null),i&&i.hasData()?i:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(t){this.renderedToTile||(this.renderedToTile=!0)}_clearRenderCacheForTile(t,e){let n=this._tilesDirty[t];n||(n=this._tilesDirty[t]={}),n[e.key]=!0}}function Ne(t){const e=[];for(let n=0;n"#define "+t));const g=m.concat(qt.fragmentSource,i.fragmentSource).join("\n"),_=m.concat(qt.vertexSource,Vt.vertexSource,i.vertexSource).join("\n"),v=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(v,g),s.compileShader(v),s.attachShader(this.program,v);const y=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(y,_),s.compileShader(y),s.attachShader(this.program,y),this.attributes={};const x={};this.numAttributes=u.length;for(let t=0;t({u_dem:new t.Uniform1i(e,n.u_dem),u_dem_prev:new t.Uniform1i(e,n.u_dem_prev),u_dem_unpack:new t.Uniform4f(e,n.u_dem_unpack),u_dem_tl:new t.Uniform2f(e,n.u_dem_tl),u_dem_scale:new t.Uniform1f(e,n.u_dem_scale),u_dem_tl_prev:new t.Uniform2f(e,n.u_dem_tl_prev),u_dem_scale_prev:new t.Uniform1f(e,n.u_dem_scale_prev),u_dem_size:new t.Uniform1f(e,n.u_dem_size),u_dem_lerp:new t.Uniform1f(e,n.u_dem_lerp),u_exaggeration:new t.Uniform1f(e,n.u_exaggeration),u_depth:new t.Uniform1i(e,n.u_depth),u_depth_size_inv:new t.Uniform2f(e,n.u_depth_size_inv),u_meter_to_dem:new t.Uniform1f(e,n.u_meter_to_dem),u_label_plane_matrix_inv:new t.UniformMatrix4f(e,n.u_label_plane_matrix_inv)}))(e,x))}setTerrainUniformValues(t,e){if(!this.terrainUniforms)return;const n=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const t in e)n[t].set(e[t])}}draw(t,e,n,i,r,o,a,s,l,c,u,h,d,f,p,m){const g=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(n),t.setStencilMode(i),t.setColorMode(r),t.setCullFace(o);for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);f&&f.setUniforms(t,this.binderUniforms,h,{zoom:d});const _={[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[e];for(const n of u.get()){const i=n.vaos||(n.vaos={});(i[s]||(i[s]=new Te)).bind(t,this,l,f?f.getPaintVertexBuffers():[],c,n.vertexOffset,p,m),g.drawElements(e,n.primitiveLength*_,g.UNSIGNED_SHORT,n.primitiveOffset*_*2)}}}function je(t,e,n){const i=1/v(n,1,e.transform.tileZoom),r=Math.pow(2,n.tileID.overscaledZ),o=n.tileSize*Math.pow(2,e.transform.tileZoom)/r,a=o*(n.tileID.canonical.x+n.tileID.wrap*r),s=o*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[i,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}const Ue=(e,n,i,r)=>{const o=n.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=t.create$1();"viewport"===o.properties.get("anchor")&&(t.fromRotation(l,-n.transform.angle),t.transformMat3(s,s,l));const c=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+i,u_opacity:r}},Ve=(e,n,i,r,o,a,s)=>t.extend(Ue(e,n,i,r),je(a,n,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),qe=t=>({u_matrix:t}),Ze=(e,n,i,r)=>t.extend(qe(e),je(i,n,r)),Ge=(t,e)=>({u_matrix:t,u_world:e}),He=(e,n,i,r,o)=>t.extend(Ze(e,n,i,r),{u_world:o}),Xe=(e,n,i,r)=>{const o=e.transform;let a;if("map"===r.paint.get("circle-pitch-alignment")){const t=v(i,1,o.zoom);a=[t,t]}else a=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_matrix:e.translatePosMatrix(n.posMatrix,i,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:a}},We=t=>{const e=[];return"map"===t.paint.get("circle-pitch-alignment")&&e.push("PITCH_WITH_MAP"),"map"===t.paint.get("circle-pitch-scale")&&e.push("SCALE_WITH_MAP"),e},Ye=(e,n,i)=>{const r=t.EXTENT/i.tileSize;return{u_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_extrude_scale:[n.pixelsToGLUnits[0]/r,n.pixelsToGLUnits[1]/r]}},Ke=(t,e,n=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:n}),Je=(t,e,n,i)=>({u_matrix:t,u_extrude_scale:v(e,1,n),u_intensity:i}),Qe=(e,n,i,r)=>{const o=e.transform;return{u_matrix:on(e,n,i,r),u_ratio:1/v(n,1,o.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},tn=(e,n,i,r,o)=>t.extend(Qe(e,n,i,r),{u_image:0,u_image_height:o}),en=(e,n,i,r,o)=>{const a=e.transform,s=rn(n,a);return{u_matrix:on(e,n,i,o),u_texsize:n.imageAtlasTexture.size,u_ratio:1/v(n,1,a.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[s,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},nn=(e,n,i,r,o,a)=>{const s=e.lineAtlas,l=rn(n,e.transform),c="round"===i.layout.get("line-cap"),u=s.getDash(r.from,c),h=s.getDash(r.to,c),d=u.width*o.fromScale,f=h.width*o.toScale;return t.extend(Qe(e,n,i,a),{u_patternscale_a:[l/d,-u.height/2],u_patternscale_b:[l/f,-h.height/2],u_sdfgamma:s.width/(256*Math.min(d,f)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:h.y,u_mix:o.t})};function rn(t,e){return 1/v(t,1,e.tileZoom)}function on(t,e,n,i){return t.translatePosMatrix(i||e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const an=(t,e,n,i,r)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(a=r.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:sn(r.paint.get("raster-hue-rotate"))};var o,a};function sn(t){t*=Math.PI/180;const e=Math.sin(t),n=Math.cos(t);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}const ln=(t,e,n,i,r,o,a,s,l,c)=>{const u=r.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:u.width/u.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+i,u_texsize:c,u_texture:0}},cn=(e,n,i,r,o,a,s,l,c,u,h)=>{const{cameraToCenterDistance:d,_pitch:f}=o.transform;return t.extend(ln(e,n,i,r,o,a,s,l,c,u),{u_gamma_scale:r?d*Math.cos(o.terrain?0:f):1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+h})},un=(e,n,i,r,o,a,s,l,c,u)=>t.extend(cn(e,n,i,r,o,a,s,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1}),hn=(t,e,n)=>({u_matrix:t,u_opacity:e,u_color:n}),dn=(e,n,i,r,o,a)=>t.extend(function(t,e,n,i){const r=n.imageManager.getPattern(t.from.toString()),o=n.imageManager.getPattern(t.to.toString()),{width:a,height:s}=n.imageManager.getPixelSize(),l=Math.pow(2,i.tileID.overscaledZ),c=i.tileSize*Math.pow(2,n.transform.tileZoom)/l,u=c*(i.tileID.canonical.x+i.tileID.wrap*l),h=c*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/v(i,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,h>>16],u_pixel_coord_lower:[65535&u,65535&h]}}(r,a,i,o),{u_matrix:e,u_opacity:n}),fn={fillExtrusion:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_lightpos:new t.Uniform3f(e,n.u_lightpos),u_lightintensity:new t.Uniform1f(e,n.u_lightintensity),u_lightcolor:new t.Uniform3f(e,n.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,n.u_vertical_gradient),u_opacity:new t.Uniform1f(e,n.u_opacity)}),fillExtrusionPattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_lightpos:new t.Uniform3f(e,n.u_lightpos),u_lightintensity:new t.Uniform1f(e,n.u_lightintensity),u_lightcolor:new t.Uniform3f(e,n.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,n.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,n.u_height_factor),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade),u_opacity:new t.Uniform1f(e,n.u_opacity)}),fill:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}),fillPattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}),fillOutline:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world)}),fillOutlinePattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}),circle:(e,n)=>({u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_extrude_scale:new t.Uniform2f(e,n.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}),collisionBox:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_extrude_scale:new t.Uniform2f(e,n.u_extrude_scale)}),collisionCircle:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,n.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,n.u_viewport_size)}),debug:(e,n)=>({u_color:new t.UniformColor(e,n.u_color),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_overlay:new t.Uniform1i(e,n.u_overlay),u_overlay_scale:new t.Uniform1f(e,n.u_overlay_scale)}),clippingMask:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}),heatmap:(e,n)=>({u_extrude_scale:new t.Uniform1f(e,n.u_extrude_scale),u_intensity:new t.Uniform1f(e,n.u_intensity),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}),heatmapTexture:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world),u_image:new t.Uniform1i(e,n.u_image),u_color_ramp:new t.Uniform1i(e,n.u_color_ramp),u_opacity:new t.Uniform1f(e,n.u_opacity)}),hillshade:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_latrange:new t.Uniform2f(e,n.u_latrange),u_light:new t.Uniform2f(e,n.u_light),u_shadow:new t.UniformColor(e,n.u_shadow),u_highlight:new t.UniformColor(e,n.u_highlight),u_accent:new t.UniformColor(e,n.u_accent)}),hillshadePrepare:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_dimension:new t.Uniform2f(e,n.u_dimension),u_zoom:new t.Uniform1f(e,n.u_zoom),u_unpack:new t.Uniform4f(e,n.u_unpack)}),line:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels)}),lineGradient:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_image:new t.Uniform1i(e,n.u_image),u_image_height:new t.Uniform1f(e,n.u_image_height)}),linePattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_texsize:new t.Uniform2f(e,n.u_texsize),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_image:new t.Uniform1i(e,n.u_image),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}),lineSDF:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,n.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,n.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,n.u_sdfgamma),u_image:new t.Uniform1i(e,n.u_image),u_tex_y_a:new t.Uniform1f(e,n.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,n.u_tex_y_b),u_mix:new t.Uniform1f(e,n.u_mix)}),raster:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_tl_parent:new t.Uniform2f(e,n.u_tl_parent),u_scale_parent:new t.Uniform1f(e,n.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,n.u_buffer_scale),u_fade_t:new t.Uniform1f(e,n.u_fade_t),u_opacity:new t.Uniform1f(e,n.u_opacity),u_image0:new t.Uniform1i(e,n.u_image0),u_image1:new t.Uniform1i(e,n.u_image1),u_brightness_low:new t.Uniform1f(e,n.u_brightness_low),u_brightness_high:new t.Uniform1f(e,n.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,n.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,n.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,n.u_spin_weights)}),symbolIcon:(e,n)=>({u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texture:new t.Uniform1i(e,n.u_texture)}),symbolSDF:(e,n)=>({u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texture:new t.Uniform1i(e,n.u_texture),u_gamma_scale:new t.Uniform1f(e,n.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,n.u_is_halo)}),symbolTextAndIcon:(e,n)=>({u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texsize_icon:new t.Uniform2f(e,n.u_texsize_icon),u_texture:new t.Uniform1i(e,n.u_texture),u_texture_icon:new t.Uniform1i(e,n.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,n.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,n.u_is_halo)}),background:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_opacity:new t.Uniform1f(e,n.u_opacity),u_color:new t.UniformColor(e,n.u_color)}),backgroundPattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_opacity:new t.Uniform1f(e,n.u_opacity),u_image:new t.Uniform1i(e,n.u_image),u_pattern_tl_a:new t.Uniform2f(e,n.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,n.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,n.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,n.u_pattern_br_b),u_texsize:new t.Uniform2f(e,n.u_texsize),u_mix:new t.Uniform1f(e,n.u_mix),u_pattern_size_a:new t.Uniform2f(e,n.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,n.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,n.u_scale_a),u_scale_b:new t.Uniform1f(e,n.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,n.u_tile_units_to_pixels)}),terrainRaster:Ee,terrainDepth:Ee,skybox:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_sun_direction:new t.Uniform3f(e,n.u_sun_direction),u_cubemap:new t.Uniform1i(e,n.u_cubemap),u_opacity:new t.Uniform1f(e,n.u_opacity),u_temporal_offset:new t.Uniform1f(e,n.u_temporal_offset)}),skyboxGradient:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_color_ramp:new t.Uniform1i(e,n.u_color_ramp),u_center_direction:new t.Uniform3f(e,n.u_center_direction),u_radius:new t.Uniform1f(e,n.u_radius),u_opacity:new t.Uniform1f(e,n.u_opacity),u_temporal_offset:new t.Uniform1f(e,n.u_temporal_offset)}),skyboxCapture:(e,n)=>({u_matrix_3f:new t.UniformMatrix3f(e,n.u_matrix_3f),u_sun_direction:new t.Uniform3f(e,n.u_sun_direction),u_sun_intensity:new t.Uniform1f(e,n.u_sun_intensity),u_color_tint_r:new t.Uniform4f(e,n.u_color_tint_r),u_color_tint_m:new t.Uniform4f(e,n.u_color_tint_m),u_luminance:new t.Uniform1f(e,n.u_luminance)})};let pn;function mn(e,n,i,r,o,a,s){const l=e.context,c=l.gl,u=e.useProgram("collisionBox"),h=[];let d=0,f=0;for(let p=0;p0){const n=t.create(),i=v;t.mul(n,_.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(n,n,_.placementViewportMatrix),h.push({circleArray:x,circleOffset:f,transform:i,invTransform:n}),d+=x.length/4,f=d}y&&(e.terrain&&e.terrain.setupElevationDraw(g,u),u.draw(l,c.LINES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,Ye(v,e.transform,g),i.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,e.transform.zoom,null,y.collisionVertexBuffer,y.collisionVertexBufferExt))}if(!s||!h.length)return;const p=e.useProgram("collisionCircle"),m=new t.StructArrayLayout2f1f2i16;m.resize(4*d),m._trim();let g=0;for(const t of h)for(let e=0;e=0&&(g[_.associatedIconIndex]={shiftedAnchor:M,angle:E})}else st(_.numGlyphs,p)}if(h){m.clear();const n=e.icon.placedSymbolArray;for(let e=0;et.getAtTileOffset(l,e.x,e.y):null)}const U=e.translatePosMatrix(l.posMatrix,r,a,s),V=y||o&&C||j?gn:F,q=e.translatePosMatrix(N,r,a,s,!0),Z=f&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let G;G=f?c.iconsInText?un(T.kind,A,x,_,e,U,V,q,P,z):cn(T.kind,A,x,_,e,U,V,q,o,P,!0):ln(T.kind,A,x,_,e,U,V,q,o,P);const H={program:E,buffers:h,uniformValues:G,atlasTexture:I,atlasTextureIcon:R,atlasInterpolation:O,atlasInterpolationIcon:D,isSDF:f,hasHalo:Z,tile:r,labelPlaneMatrixInv:B};if(b&&c.canOverlap){w=!0;const e=h.segments.get();for(const n of e)S.push({segments:new t.SegmentVector([n]),sortKey:n.sortKey,state:H})}else S.push({segments:h.segments,sortKey:0,state:H})}w&&S.sort((t,e)=>t.sortKey-e.sortKey);for(const t of S){const n=t.state;if(e.terrain&&e.terrain.setupElevationDraw(n.tile,n.program,{useDepthForOcclusion:!0,labelPlaneMatrixInv:n.labelPlaneMatrixInv}),f.activeTexture.set(p.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,p.CLAMP_TO_EDGE),n.atlasTextureIcon&&(f.activeTexture.set(p.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,p.CLAMP_TO_EDGE)),n.isSDF){const r=n.uniformValues;n.hasHalo&&(r.u_is_halo=1,bn(n.buffers,t.segments,i,e,n.program,T,h,d,r)),r.u_is_halo=0}bn(n.buffers,t.segments,i,e,n.program,T,h,d,n.uniformValues)}}function bn(e,n,i,r,o,a,s,l,c){const u=r.context;o.draw(u,u.gl.TRIANGLES,a,s,l,t.CullFaceMode.disabled,c,i.id,e.layoutVertexBuffer,e.indexBuffer,n,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function wn(e,n,i,r,o,a,s){const l=e.context.gl,c=i.paint.get("fill-pattern"),u=c&&c.constantOr(1),h=i.getCrossfadeParameters();let d,f,p,m,g;s?(f=u&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(f=u?"fillPattern":"fill",d=l.TRIANGLES);for(const _ of r){const r=n.getTile(_);if(u&&!r.patternsLoaded())continue;const v=r.getBucket(i);if(!v)continue;e.prepareDrawTile(_);const y=v.programConfigurations.get(i.id),x=e.useProgram(f,y);u&&(e.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers(h));const b=c.constantOr(null);if(b&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[b.to.toString()],n=t.patternPositions[b.from.toString()];e&&n&&y.setConstantPatternPositions(e,n)}const w=e.translatePosMatrix(_.posMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(s){m=v.indexBuffer2,g=v.segments2;const t=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];p="fillOutlinePattern"===f&&u?He(w,e,h,r,t):Ge(w,t)}else m=v.indexBuffer,g=v.segments,p=u?Ze(w,e,h,r):qe(w);x.draw(e.context,d,o,e.stencilModeForClipping(_),a,t.CullFaceMode.disabled,p,i.id,v.layoutVertexBuffer,m,g,i.paint,e.transform.zoom,y)}}function Tn(e,n,i,r,o,a,s){const l=e.context,c=l.gl,u=i.paint.get("fill-extrusion-pattern"),h=u.constantOr(1),d=i.getCrossfadeParameters(),f=i.paint.get("fill-extrusion-opacity");for(const p of r){const r=n.getTile(p),m=r.getBucket(i);if(!m)continue;const g=m.programConfigurations.get(i.id),_=e.useProgram(h?"fillExtrusionPattern":"fillExtrusion",g);if(e.terrain){const t=e.terrain;if(!m.enableTerrain)continue;if(t.setupElevationDraw(r,_,{useMeterToDem:!0}),Cn(l,n,p,m,i,t),!m.centroidVertexBuffer){const t=_.attributes.a_centroid_pos;void 0!==t&&c.vertexAttrib2f(t,0,0)}}h&&(e.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),g.updatePaintBuffers(d));const v=u.constantOr(null);if(v&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[v.to.toString()],n=t.patternPositions[v.from.toString()];e&&n&&g.setConstantPatternPositions(e,n)}const y=e.translatePosMatrix(p.posMatrix,r,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),x=i.paint.get("fill-extrusion-vertical-gradient"),b=h?Ve(y,e,x,f,p,d,r):Ue(y,e,x,f);_.draw(l,l.gl.TRIANGLES,o,a,s,t.CullFaceMode.backCCW,b,i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,i.paint,e.transform.zoom,g,e.terrain?m.centroidVertexBuffer:null)}}function Cn(e,n,i,r,o,a){const s=[e=>{let n=e.canonical.x-1,i=e.wrap;return n<0&&(n=(1<{let n=e.canonical.x+1,i=e.wrap;return n===1<new t.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<new t.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<{const e=n.getSource().maxzoom;for(const i of[0,-1,1]){if(t.overscaledZ+i0&&t.overscaledZ(c[0]=Math.min(e.min.y,n.min.y),c[1]=Math.max(e.max.y,n.max.y),c[2]=t.EXTENT-n.min.x>e.max.x?n.min.x-t.EXTENT:e.max.x,c),h=(e,n)=>(c[0]=Math.min(e.min.x,n.min.x),c[1]=Math.max(e.max.x,n.max.x),c[2]=t.EXTENT-n.min.y>e.max.y?n.min.y-t.EXTENT:e.max.y,c),d=[(t,e)=>u(t,e),(t,e)=>u(e,t),(t,e)=>h(t,e),(t,e)=>h(e,t)],f=new t.Point(0,0);let p,m,g;const _=(e,n,r,o,s)=>{const l=[[o?r:e,o?e:r,0],[o?r:n,o?n:r,0]],c=s<0?t.EXTENT+s:s,u=[o?c:(e+n)/2,o?(e+n)/2:c,0];return 0===r&&s<0||0!==r&&s>0?a.getForTilePoints(g,[u],!0,m):l.push(u),a.getForTilePoints(i,l,!0,p),Math.max(l[0][2],l[1][2],u[2])/a.exaggeration()};for(let e=0;e<4;e++){const n=r.borders[e];if(0===n.length&&(r.borderDone[e]=!0),r.borderDone[e])continue;const o=g=s[e](i),c=l(o);if(!c||!c.enableTerrain)continue;if(m=a.findDEMTileFor(o),!m||!m.dem)continue;if(!p){const t=a.findDEMTileFor(i);if(!t||!t.dem)return;p=t}const u=(e<2?1:5)-e,h=c.borders[u];let v=0;for(let i=0;ia[0]+3));)c.borderDone[u]||c.encodeCentroid(void 0,s,!1),v++;if(s&&va[1]-3)&&(i++,++v!==h.length);)s=c.featuresOnBorder[h[v]];if(s=c.featuresOnBorder[h[n]],o.intersectsCount()>1||s.intersectsCount()>1||1!==i){1!==i&&(v=n),r.encodeCentroid(void 0,o,!1),c.borderDone[u]||c.encodeCentroid(void 0,s,!1);continue}const l=d[e](o,s),p=e%2?t.EXTENT-1:0;f.x=_(l[0],Math.min(t.EXTENT-1,l[1]),p,e<2,l[2]),f.y=0,r.encodeCentroid(f,o,!1),c.borderDone[u]||c.encodeCentroid(f,s,!1)}else r.encodeCentroid(void 0,o,!1)}r.borderDone[e]=r.needsCentroidUpdate=!0,c.borderDone[u]||(c.borderDone[u]=c.needsCentroidUpdate=!0)}(r.needsCentroidUpdate||!r.centroidVertexBuffer&&0!==r.centroidVertexArray.length)&&r.uploadCentroid(e)}const Sn=new t.Color(1,0,0,1),kn=new t.Color(0,1,0,1),Mn=new t.Color(0,0,1,1),En=new t.Color(1,0,1,1),An=new t.Color(0,1,1,1);function Pn(t,e,n,i){On(t,0,e+n/2,t.transform.width,n,i)}function In(t,e,n,i){On(t,e-n/2,0,n,t.transform.height,i)}function On(e,n,i,r,o,a){const s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(n*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,r*t.browser.devicePixelRatio,o*t.browser.devicePixelRatio),s.clear({color:a}),l.disable(l.SCISSOR_TEST)}function Dn(e,n,i){const r=e.context,o=r.gl,a=i.posMatrix,s=e.useProgram("debug"),l=n.getTileByID(i.key);e.terrain&&e.terrain.setupElevationDraw(l,s);const c=t.DepthMode.disabled,u=t.StencilMode.disabled,h=e.colorModeForRenderPass();r.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(r,o.LINE_STRIP,c,u,h,t.CullFaceMode.disabled,Ke(a,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);const d=l.latestRawTileData,f=Math.floor((d&&d.byteLength||0)/1024),p=n.getTile(i).tileSize,m=512/Math.min(p,512)*(i.overscaledZ/e.transform.zoom)*.5;let g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=" => "+i.overscaledZ),function(t,e){t.initDebugOverlayCanvas();const n=t.debugOverlayCanvas,i=t.context.gl,r=t.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,n.width,n.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(e,5,5),r.strokeText(e,5,5),t.debugOverlayTexture.update(n),t.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(e,`${g} ${f}kb`),s.draw(r,o.TRIANGLES,c,u,t.ColorMode.alphaBlended,t.CullFaceMode.disabled,Ke(a,t.Color.transparent,m),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}const zn=t.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Rn}=zn;function Ln(t,e,n,i){t.emplaceBack(e,n,i)}class Fn{constructor(e){this.vertexArray=new t.StructArrayLayout3f12,this.indices=new t.StructArrayLayout3ui6,Ln(this.vertexArray,-1,-1,1),Ln(this.vertexArray,1,-1,1),Ln(this.vertexArray,-1,1,1),Ln(this.vertexArray,1,1,1),Ln(this.vertexArray,-1,-1,-1),Ln(this.vertexArray,1,-1,-1),Ln(this.vertexArray,-1,1,-1),Ln(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Rn),this.indexBuffer=e.createIndexBuffer(this.indices),this.segment=t.SegmentVector.simpleSegment(0,0,36,12)}}function Bn(e,n,i,r,o,a){const s=e.gl,l=n.paint.get("sky-atmosphere-color"),c=n.paint.get("sky-atmosphere-halo-color"),u=n.paint.get("sky-atmosphere-sun-intensity"),h=((t,e,n,i,r)=>({u_matrix_3f:t,u_sun_direction:e,u_sun_intensity:n,u_color_tint_r:[i.r,i.g,i.b,i.a],u_color_tint_m:[r.r,r.g,r.b,r.a],u_luminance:5e-5}))(t.fromMat4([],r),o,u,l,c);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a,n.skyboxTexture,0),i.draw(e,s.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.frontCW,h,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}const Nn={symbol:function(e,n,i,r,o){if("translucent"!==e.renderPass)return;const a=t.StencilMode.disabled,s=e.colorModeForRenderPass();i.layout.get("text-variable-anchor")&&function(e,n,i,r,o,a,s){const l=n.transform,c="map"===o,u="map"===a;for(const o of e){const e=r.getTile(o),a=e.getBucket(i);if(!a||!a.text||!a.text.segments.get().length)continue;const h=t.evaluateSizeForZoom(a.textSizeData,l.zoom),d=v(e,1,n.transform.zoom),f=W(o.posMatrix,u,c,n.transform,d),p="none"!==i.layout.get("icon-text-fit")&&a.hasIconData();if(h){const n=Math.pow(2,l.zoom-e.tileID.overscaledZ),i=l.elevation;vn(a,c,u,s,t.symbolSize,l,f,o.posMatrix,n,h,p,i?t=>i.getAtTileOffset(o,t.x,t.y):t=>0)}}}(r,e,i,n,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),o),0!==i.paint.get("icon-opacity").constantOr(1)&&xn(e,n,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),a,s),0!==i.paint.get("text-opacity").constantOr(1)&&xn(e,n,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),a,s),n.map.showCollisionBoxes&&(mn(e,n,i,r,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),!0),mn(e,n,i,r,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),!1))},circle:function(e,n,i,r){if("translucent"!==e.renderPass)return;const o=i.paint.get("circle-opacity"),a=i.paint.get("circle-stroke-width"),s=i.paint.get("circle-stroke-opacity"),l=void 0!==i.layout.get("circle-sort-key").constantOr(1);if(0===o.constantOr(1)&&(0===a.constantOr(1)||0===s.constantOr(1)))return;const c=e.context,u=c.gl,h=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),d=t.StencilMode.disabled,f=e.colorModeForRenderPass(),p=[];for(let o=0;ot.sortKey-e.sortKey);for(const n of p){const{programConfiguration:r,program:o,layoutVertexBuffer:a,indexBuffer:s,uniformValues:l,tile:p}=n.state,m=n.segments;e.terrain&&e.terrain.setupElevationDraw(p,o,{useDepthForOcclusion:!0}),o.draw(c,u.TRIANGLES,h,d,f,t.CullFaceMode.disabled,l,i.id,a,s,m,i.paint,e.transform.zoom,r)}},heatmap:function(e,n,i,r){if(0!==i.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,a=o.gl,s=t.StencilMode.disabled,l=new t.ColorMode([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,n){const i=t.gl;t.activeTexture.set(i.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let r=n.heatmapFbo;if(r)i.bindTexture(i.TEXTURE_2D,r.colorAttachment.get()),t.bindFramebuffer.set(r.framebuffer);else{const o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),r=n.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,n,i){const r=t.gl;r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e.width/4,e.height/4,0,r.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:r.UNSIGNED_BYTE,null),i.colorAttachment.set(n)}(t,e,o,r)}}(o,e,i),o.clear({color:t.Color.transparent});for(let c=0;c{const o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);const a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:n.paint.get("heatmap-opacity")}})(e,n),n.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,n.paint,e.transform.zoom)}(e,i))},line:function(e,n,i,r){if("translucent"!==e.renderPass)return;const o=i.paint.get("line-opacity"),a=i.paint.get("line-width");if(0===o.constantOr(1)||0===a.constantOr(1))return;const s=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),l=e.colorModeForRenderPass(),c=i.paint.get("line-dasharray"),u=i.paint.get("line-pattern"),h=u.constantOr(1),d=i.paint.get("line-gradient"),f=i.getCrossfadeParameters(),p=h?"linePattern":c?"lineSDF":d?"lineGradient":"line",m=e.context,g=m.gl;let _=!0;for(const o of r){const r=n.getTile(o);if(h&&!r.patternsLoaded())continue;const a=r.getBucket(i);if(!a)continue;e.prepareDrawTile(o);const v=a.programConfigurations.get(i.id),y=e.context.program.get(),x=e.useProgram(p,v),b=_||x.program!==y,w=u.constantOr(null);if(w&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[w.to.toString()],n=t.patternPositions[w.from.toString()];e&&n&&v.setConstantPatternPositions(e,n)}const T=e.terrain?o.posMatrix:null,C=h?en(e,r,i,f,T):c?nn(e,r,i,c,f,T):d?tn(e,r,i,T,a.lineClipsArray.length):Qe(e,r,i,T);if(h)m.activeTexture.set(g.TEXTURE0),r.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),v.updatePaintBuffers(f);else if(c&&(b||e.lineAtlas.dirty))m.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(m);else if(d){const r=a.gradients[i.id];let s=r.texture;if(i.gradientVersion!==r.version){let l=256;if(i.stepInterpolant){const i=n.getSource().maxzoom,r=o.canonical.z===i?Math.ceil(1<({u_matrix:t,u_sun_direction:e,u_cubemap:0,u_opacity:i,u_temporal_offset:r}))(l.skyboxMatrix,n.getCenter(e,!1),0,r,o);c.draw(a,s.TRIANGLES,i,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.backCW,u,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(e,i,s,r,l):"gradient"===a&&"sky"===e.renderPass&&function(e,n,i,r,o){const a=e.context,s=a.gl,l=e.transform,c=e.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new Fn(a)),a.activeTexture.set(s.TEXTURE0);let u=n.colorRampTexture;u||(u=n.colorRampTexture=new t.Texture(a,n.colorRamp,s.RGBA)),u.bind(s.LINEAR,s.CLAMP_TO_EDGE);const h=((e,n,i,r,o)=>({u_matrix:e,u_color_ramp:0,u_center_direction:n,u_radius:t.degToRad(i),u_opacity:r,u_temporal_offset:o}))(l.skyboxMatrix,n.getCenter(e,!1),n.paint.get("sky-gradient-radius"),r,o);c.draw(a,s.TRIANGLES,i,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.backCW,h,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(e,i,s,r,l)},debug:function(t,e,n){for(let i=0;i256&&this.clearStencil(),r.setColorMode(t.ColorMode.disabled),r.setDepthMode(t.DepthMode.disabled);const a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const e of i){const n=this._tileClippingMaskIDs[e.key]=this.nextStencilID++;a.draw(r,o.TRIANGLES,t.DepthMode.disabled,new t.StencilMode({func:o.ALWAYS,mask:0},n,255,o.KEEP,o.KEEP,o.REPLACE),t.ColorMode.disabled,t.CullFaceMode.disabled,ze(e.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,n=this.context.gl;return new t.StencilMode({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const n=this.context.gl;return new t.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){const n=this.context.gl,i=e.sort((t,e)=>e.overscaledZ-t.overscaledZ),r=i[i.length-1].overscaledZ,o=i[0].overscaledZ-r+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();const e={};for(let i=0;i=0;this.currentLayer--){const t=this.style._layers[i[this.currentLayer]],n=e._getLayerSourceCache(t);if(t.isSky())continue;const r=n?a[n.id]:void 0;this._renderTileClippingMasks(t,n,r),this.renderLayer(this,n,t,r)}if(this.renderPass="sky",this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const i=e._getLayerSourceCache(t);i&&!t.isHidden(this.transform.zoom)&&(!n||n.getSource().maxzoom0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),n=this.imageManager.getPattern(t.to.toString());return!e||!n}currentGlobalDefines(){const t=this.terrain&&this.terrain.renderingToTexture,e=[];return this.terrain&&!this.terrain.renderingToTexture&&e.push("TERRAIN"),t&&e.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&e.push("OVERDRAW_INSPECTOR"),e}useProgram(t,e,n){this.cache=this.cache||{};const i=n||[],r=this.currentGlobalDefines().concat(i),o=$e.cacheKey(t,r,e);return this.cache[o]||(this.cache[o]=new $e(this.context,t,we[t],e,fn[t],r)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}prepareDrawTile(t){this.terrain&&this.terrain.prepareDrawTile(t)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const t=this.context.gl,e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),e}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}}class jn{constructor(t=0,e=0,n=0,i=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(n)||n<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=n,this.right=i}interpolate(e,n,i){return null!=n.top&&null!=e.top&&(this.top=t.number(e.top,n.top,i)),null!=n.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,n.bottom,i)),null!=n.left&&null!=e.left&&(this.left=t.number(e.left,n.left,i)),null!=n.right&&null!=e.right&&(this.right=t.number(e.right,n.right,i)),this}getCenter(e,n){const i=t.clamp((this.left+e-this.right)/2,0,e),r=t.clamp((this.top+n-this.bottom)/2,0,n);return new t.Point(i,r)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new jn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Un(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function Vn(t,e,n){t[4*e+0]=n[0],t[4*e+1]=n[1],t[4*e+2]=n[2],t[4*e+3]=n[3]}function qn(e,n){const i=Un(e,3);t.fromQuat(e,n),Vn(e,3,i)}function Zn(t,e){Vn(t,3,[e[0],e[1],e[2],1])}function Gn(e,n){const i=t.identity$1([]);return t.rotateZ$1(i,i,-n),t.rotateX$1(i,i,-e),i}function Hn(e,n){const i=[e[0],e[1],0],r=[n[0],n[1],0];if(t.length(i)>=1e-15){const e=t.normalize([],i);t.scale$2(r,e,t.dot(r,e)),n[0]=r[0],n[1]=r[1]}const o=t.cross([],n,e);if(t.len(o)<1e-15)return null;const a=Math.atan2(-o[1],o[0]);return Gn(Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2]),a)}class Xn{constructor(t,e){this.position=t,this.orientation=e}get position(){return this._position}set position(e){this._position=this._renderWorldCopies?function(e){if(!e)return;const n=Array.isArray(e)?new t.MercatorCoordinate(e[0],e[1],e[2]):e;return n.x=t.wrap(n.x,0,1),n}(e):e}lookAtPoint(e,n){if(this.orientation=null,!this.position)return;const i=this._elevation?this._elevation.getAtPoint(t.MercatorCoordinate.fromLngLat(e)):0,r=this.position,o=t.MercatorCoordinate.fromLngLat(e,i),a=[o.x-r.x,o.y-r.y,o.z-r.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=Hn(a,n)}setPitchBearing(e,n){this.orientation=Gn(t.degToRad(e),t.degToRad(-n))}}class Wn{constructor(e,n){this._transform=t.identity([]),this._orientation=t.identity$1([]),n&&(this._orientation=n,qn(this._transform,this._orientation)),e&&Zn(this._transform,e)}get mercatorPosition(){const e=this.position;return new t.MercatorCoordinate(e[0],e[1],e[2])}get position(){const t=Un(this._transform,3);return[t[0],t[1],t[2]]}set position(t){Zn(this._transform,t)}get orientation(){return this._orientation}set orientation(t){this._orientation=t,qn(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),e=this.right();return{bearing:Math.atan2(-e[1],e[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,e){this._orientation=Gn(t,e),qn(this._transform,this._orientation)}forward(){const t=Un(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=Un(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=Un(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(e,n){const i=new Float64Array(16);return t.invert(i,this.getWorldToCamera(e,n)),i}getWorldToCamera(e,n){const i=new Float64Array(16),r=new Float64Array(4),o=this.position;return t.conjugate(r,this._orientation),t.scale$2(o,o,-e),t.fromQuat(i,r),t.translate(i,i,o),i[1]*=-1,i[5]*=-1,i[9]*=-1,i[13]*=-1,i[8]*=n,i[9]*=n,i[10]*=n,i[11]*=n,i}getCameraToClipPerspective(e,n,i,r){const o=new Float64Array(16);return t.perspective(o,e,n,i,r),o}clone(){return new Wn([...this.position],[...this.orientation])}}class Yn{constructor(e,n,i,r,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=null==i?0:i,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new jn,this._posMatrixCache={},this._alignedPosMatrixCache={},this._camera=new Wn,this._centerAltitude=0,this.cameraElevationReference="ground",this._horizonShift=.1}clone(){const t=new Yn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._cameraZoom=this._cameraZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,t?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(t){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),t&&this._constrainCameraAltitude(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const n=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const n=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._setZoom(e),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const e=this._elevation.getAtPoint(t.MercatorCoordinate.fromLngLat(this.center),-1);return-1===e?(this._cameraZoom=null,!1):(this._centerAltitude=e,!0)}_updateCameraOnTerrain(){const e=this.cameraToCenterDistance/this.worldSize,n=t.mercatorZfromAltitude(this._centerAltitude,this.center.lat);this._cameraZoom=this._zoomFromMercatorZ(n+e)}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCenterElevation()?this._updateCameraOnTerrain():this._cameraZoom=null:this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._cameraZoom||!this._elevation)return;const e=this._cameraZoom,n=this._elevation.getAtPoint(t.MercatorCoordinate.fromLngLat(this.center)),i=t.mercatorZfromAltitude(n,this.center.lat),r=this._mercatorZfromZoom(e),o=this._mercatorZfromZoom(this._maxZoom),a=Math.max(r-i,o);this._setZoom(this._zoomFromMercatorZ(a))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}computeZoomRelativeTo(e){const n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,e.toAltitude()));let i;i=e.ze.maxzoom&&(n=e.maxzoom);const o=t.MercatorCoordinate.fromLngLat(this.center),a=1<({aabb:new t.Aabb([e*a,0,-m],[(e+1)*a,a,m]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),_=[],v=[],y=n,x=e.reparseOverscaled?i:n,b=(t,e)=>{if(!this._elevation)return;const n=this._elevation.getMinMaxForTile(e);n&&(t.min[2]=n.min,t.max[2]=n.max,t.center[2]=(t.min[2]+t.max[2])/2)},w=t=>t*t,T=w((h-this._centerAltitude)*u),C=(t,e)=>{if(e*w(.707)0;){const i=_.pop(),o=i.x,a=i.y;let c=i.fullyVisible;if(!c){const t=i.aabb.intersects(l);if(0===t)continue;c=2===t}let h=!0;if(p<=i.zoom&&i.zoom>1),l=i.aabb.quadrant(e);let u=null;r&&i.zoom>y-6&&(u=new t.OverscaledTileID(i.zoom+1===y?x:i.zoom+1,i.wrap,i.zoom+1,n,s),b(l,u)),_.push({aabb:l,zoom:i.zoom+1,x:n,y:s,wrap:i.wrap,fullyVisible:c,tileID:u})}else{const r=i.zoom===y?x:i.zoom;if(e.minzoom&&e.minzoom>r)continue;const l=s[0]-(.5+o+(i.wrap<t.distanceSq-e.distanceSq).map(t=>t.tileID)}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const n=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(n)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(e,n){const i=this.pointCoordinate(n),r=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(i.x-r.x),o.y-(i.y-r.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}setLocation(t){this.center=this.coordinateLocation(t),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t){return this._coordinatePoint(this.locationCoordinate(t),!1)}locationPoint3D(t){return this._coordinatePoint(this.locationCoordinate(t),!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t){return this.coordinateLocation(this.pointCoordinate3D(t))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t.toLngLat()}pointRayIntersection(e,n){const i=null!=n?n:this._centerAltitude,r=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(o,o,this.pixelMatrixInverse);const a=o[3];t.scale$1(r,r,1/r[3]),t.scale$1(o,o,1/a);const s=r[2],l=o[2];return{p0:r,p1:o,t:s===l?0:(i-s)/(l-s)}}screenPointToMercatorRay(e){const n=[e.x,e.y,0,1],i=[e.x,e.y,1,1];return t.transformMat4(n,n,this.pixelMatrixInverse),t.transformMat4(i,i,this.pixelMatrixInverse),t.scale$1(n,n,1/n[3]),t.scale$1(i,i,1/i[3]),n[2]=t.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,i[2]=t.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,t.scale$1(n,n,1/this.worldSize),t.scale$1(i,i,1/this.worldSize),new t.Ray([n[0],n[1],n[2]],t.normalize([],t.sub([],i,n)))}rayIntersectionCoordinate(e){const{p0:n,p1:i,t:r}=e,o=t.mercatorZfromAltitude(n[2],this._center.lat),a=t.mercatorZfromAltitude(i[2],this._center.lat);return new t.MercatorCoordinate(t.number(n[0],i[0],r)/this.worldSize,t.number(n[1],i[1],r)/this.worldSize,t.number(o,a,r))}pointCoordinate(e){const n=this.horizonLineFromTop(!1),i=new t.Point(e.x,Math.max(n,e.y));return this.rayIntersectionCoordinate(this.pointRayIntersection(i))}pointCoordinate3D(e){if(!this.elevation)return this.pointCoordinate(e);const n=this.elevation;let i=this.elevation.pointCoordinate(e);if(i)return new t.MercatorCoordinate(i[0],i[1],i[2]);let r=0,o=this.horizonLineFromTop();if(e.y>o)return this.pointCoordinate(e);const a=.02*o,s=e.clone();for(let e=0;e<10&&o-r>a;e++){s.y=t.number(r,o,.66);const e=n.pointCoordinate(s);e?(o=s.y,i=e):r=s.y}return i?new t.MercatorCoordinate(i[0],i[1],i[2]):this.pointCoordinate(e)}isPointAboveHorizon(t){if(this.elevation)return!this.elevation.pointCoordinate(t);{const e=this.horizonLineFromTop();return t.y0?new t.Point(r[0]/r[3],r[1]/r[3]):new t.Point(Number.MAX_VALUE,Number.MAX_VALUE)}getBounds(){return this._terrainEnabled()?this._getBounds3D():(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))}_getBounds3D(){const e=this.elevation,n=e.visibleDemTiles.reduce((t,e)=>{if(e.dem){const n=e.dem.tree;t.min=Math.min(t.min,n.minimums[0]),t.max=Math.max(t.max,n.maximums[0])}return t},{min:Number.MAX_VALUE,max:0});n.min*=e.exaggeration(),n.max*=e.exaggeration();const i=this.horizonLineFromTop();return[new t.Point(0,i),new t.Point(this.width,i),new t.Point(this.width,this.height),new t.Point(0,this.height)].reduce((t,e)=>t.extend(this.coordinateLocation(this.rayIntersectionCoordinate(this.pointRayIntersection(e,n.min)))).extend(this.coordinateLocation(this.rayIntersectionCoordinate(this.pointRayIntersection(e,n.max)))),new t.LngLatBounds)}horizonLineFromTop(t=!0){const e=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-.97*e;return t?Math.max(0,n):n}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,n=!1){const i=e.key,r=n?this._alignedPosMatrixCache:this._posMatrixCache;if(r[i])return r[i];const o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*a,o.y*a,0]),t.scale(l,l,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(l,n?this.alignedProjMatrix:this.projMatrix,l),r[i]=new Float32Array(l),r[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}recenterOnTerrain(){if(!this._elevation)return;const e=this._elevation;this._updateCameraState();const n=this._camera.position,i=this._camera.forward();if(n.z<=0||i[2]>=0)return;const r=t.mercatorZfromAltitude(1,this._center.lat);n[2]/=r,i[2]/=r,t.normalize(i,i);const o=e.raycast(n,i,e.exaggeration());if(o){const e=t.scaleAndAdd([],n,i,o),r=new t.MercatorCoordinate(e[0],e[1],t.mercatorZfromAltitude(e[2],t.latFromMercatorY(e[1]))),a=this._camera.position,s=r.z+t.length([r.x-a[0],r.y-a[1],r.z-a[2]]);this._cameraZoom=this._zoomFromMercatorZ(s),this._centerAltitude=r.toAltitude(),this._center=r.toLngLat(),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCameraAltitude(){if(!this._elevation)return;const e=this._elevation;this._updateCameraState();const n=e.getAtPoint(this._camera.mercatorPosition),i=this._minimumHeightOverTerrain()*Math.cos(t.degToRad(this._maxPitch)),r=t.mercatorZfromAltitude(n,this._center.lat),o=this._camera.position[2]-r;if(oa&&(r=a-e)}if(this.lngRange){const t=h.x,e=c.x/2;t-el&&(i=l-e)}void 0===i&&void 0===r||(this.center=this.unproject(new t.Point(void 0!==i?i:h.x,void 0!==r?r:h.y))),this._constrainCameraAltitude(),this._unmodified=u,this._constraining=!1}_minZoomForBounds(){const e=(t,e)=>Math.log2(t/(this.tileSize*Math.abs(e[1]-e[0])));let n=0;if(this.latRange){const i=this.latRange;n=e(this.height,[t.mercatorYfromLat(i[0]),t.mercatorYfromLat(i[1])])}let i=0;if(this.lngRange){const n=this.lngRange;i=e(this.width,[t.mercatorXfromLng(n[0]),t.mercatorXfromLng(n[1])])}return Math.max(n,i)}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;const n=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;this._updateCameraState();const i=Math.PI/2+this._pitch,r=this.fovAboveCenter,o=this._camera.position[2]*this.worldSize/Math.cos(this._pitch),a=Math.sin(r)*o/Math.sin(t.clamp(Math.PI-i-r,.01,Math.PI-.01)),s=this.point,l=s.x,c=s.y,u=Math.cos(Math.PI/2-this._pitch)*a+o,h=Math.min(1.01*u,o*(1/this._horizonShift)),d=this.height/50,f=this._camera.getWorldToCamera(this.worldSize,n),p=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,d,h);p[8]=2*-e.x/this.width,p[9]=2*e.y/this.height;let m=t.mul([],p,f);this.mercatorMatrix=t.scale([],m,[this.worldSize,this.worldSize,this.worldSize/n]),this.projMatrix=m,this.invProjMatrix=t.invert(new Float64Array(16),this.projMatrix);const g=new Float32Array(16);t.identity(g),t.scale(g,g,[1,-1,1]),t.rotateX(g,g,this._pitch),t.rotateZ(g,g,this.angle);const _=t.perspective(new Float32Array(16),this._fov,this.width/this.height,d,h),v=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;_[8]=2*-e.x/this.width,_[9]=2*(e.y+v)/this.height,this.skyboxMatrix=t.multiply(g,_,g);const y=this.width%2/2,x=this.height%2/2,b=Math.cos(this.angle),w=Math.sin(this.angle),T=l-Math.round(l)+b*y+w*x,C=c-Math.round(c)+b*x+w*y,S=new Float64Array(m);if(t.translate(S,S,[T>.5?T-1:T,C>.5?C-1:C,0]),this.alignedProjMatrix=S,m=t.create(),t.scale(m,m,[this.width/2,-this.height/2,1]),t.translate(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=t.create(),t.scale(m,m,[1,-1,1]),t.translate(m,m,[-1,-1,0]),t.scale(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),m=t.invert(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}_updateCameraState(){if(!this.height)return;this._camera.setPitchBearing(this._pitch,this.angle);const e=this._camera.forward(),n=this.cameraToCenterDistance,i=this.point,r=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)-t.mercatorZfromAltitude(this._centerAltitude,this.center.lat),o=this.cameraToCenterDistance/r;this._camera.position=[i.x/this.worldSize-e[0]*n/o,i.y/this.worldSize-e[1]*n/o,t.mercatorZfromAltitude(this._centerAltitude,this._center.lat)+-e[2]*n/o]}_translateCameraConstrained(e){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),i=e[2];let r=1;i>0&&(r=Math.min((n-this._camera.position[2])/i,1)),this._camera.position=t.scaleAndAdd([],this._camera.position,e,r),this._updateStateFromCamera()}_updateStateFromCamera(){const e=this._camera.position,n=this._camera.forward(),{pitch:i,bearing:r}=this._camera.getPitchBearing(),o=t.mercatorZfromAltitude(this._centerAltitude,this.center.lat),a=this._mercatorZfromZoom(this._maxZoom)*Math.cos(t.degToRad(this._maxPitch)),s=Math.max((e[2]-o)/Math.cos(i),a),l=this._zoomFromMercatorZ(s);t.scaleAndAdd(e,e,n,s),this._pitch=t.clamp(i,t.degToRad(this.minPitch),t.degToRad(this.maxPitch)),this.angle=t.wrap(r,-Math.PI,Math.PI),this._setZoom(t.clamp(l,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=new t.MercatorCoordinate(e[0],e[1],e[2]).toLngLat(),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))}_terrainEnabled(){return!!this._elevation}isHorizonVisibleForPoints(e,n){const i=Math.min(e.x,n.x),r=Math.max(e.x,n.x),o=Math.min(e.y,n.y),a=Math.max(e.y,n.y),s=[new t.Point(i,o),new t.Point(r,a),new t.Point(i,a),new t.Point(r,o)],l=this._renderWorldCopies?-3:0,c=this._renderWorldCopies?4:1;for(const t of s){const e=this.pointRayIntersection(t);if(e.t<0)return!0;const n=this.rayIntersectionCoordinate(e);if(n.xc||n.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+t.radToDeg(this.fovAboveCenter)>88||this.isHorizonVisibleForPoints(new t.Point(0,0),new t.Point(this.width,this.height))}zoomDeltaToMovement(e,n){const i=t.length(t.sub([],this._camera.position,e)),r=this._zoomFromMercatorZ(i)+n;return i-this._mercatorZfromZoom(r)}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))}}class Kn{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(t,e){let n=!1,i=null;const r=()=>{i=null,n&&(t(),i=setTimeout(r,300),n=!1)};return()=>(n=!0,i||r(),i)}(this._updateHashUnthrottled.bind(this))}addTo(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){const n=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,r),a=Math.round(n.lng*o)/o,s=Math.round(n.lat*o)/o,l=this._map.getBearing(),c=this._map.getPitch();let u="";if(u+=e?`/${a}/${s}/${i}`:`${i}/${s}/${a}`,(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+="/"+Math.round(c)),this._hashName){const e=this._hashName;let n=!1;const i=t.window.location.hash.slice(1).split("&").map(t=>{const i=t.split("=")[0];return i===e?(n=!0,`${i}=${u}`):t}).filter(t=>t);return n||i.push(`${e}=${u}`),"#"+i.join("&")}return"#"+u}_getCurrentHash(){const e=t.window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(t=>t.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(t=>isNaN(t))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());t.window.history.replaceState(t.window.history.state,null,e)}}const Jn={linearity:.3,easing:t.bezier(0,0,.3,1)},Qn=t.extend({deceleration:2500,maxSpeed:1400},Jn),ti=t.extend({deceleration:20,maxSpeed:1400},Jn),ei=t.extend({deceleration:1e3,maxSpeed:360},Jn),ni=t.extend({deceleration:1e3,maxSpeed:90},Jn);class ii{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,n=t.browser.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)n.zoom+=t.zoomDelta||0,n.bearing+=t.bearingDelta||0,n.pitch+=t.pitchDelta||0,t.panDelta&&n.pan._add(t.panDelta),t.around&&(n.around=t.around),t.pinchAround&&(n.pinchAround=t.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(n.pan.mag()){const o=oi(n.pan.mag(),i,t.extend({},Qn,e||{}));r.offset=n.pan.mult(o.amount/n.pan.mag()),r.center=this._map.transform.center,ri(r,o)}if(n.zoom){const t=oi(n.zoom,i,ti);r.zoom=this._map.transform.zoom+t.amount,ri(r,t)}if(n.bearing){const e=oi(n.bearing,i,ei);r.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),ri(r,e)}if(n.pitch){const t=oi(n.pitch,i,ni);r.pitch=this._map.transform.pitch+t.amount,ri(r,t)}if(r.zoom||r.bearing){const t=void 0===n.pinchAround?n.around:n.pinchAround;r.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(r,{noMoveStart:!0})}}function ri(t,e){(!t.duration||t.durationn.unproject(t)),l=a.reduce((t,e,n,i)=>t.add(e.div(i.length)),new t.Point(0,0));super(e,{points:a,point:l,lngLats:s,lngLat:n.unproject(l),originalEvent:i}),this._defaultPrevented=!1}}class li extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,n){super(t,{originalEvent:n}),this._defaultPrevented=!1}}class ci{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new li(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new ai(t.type,this._map,t))}mouseup(t){this._map.fire(new ai(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new ai(t.type,this._map,t))}dblclick(t){return this._firePreventable(new ai(t.type,this._map,t))}mouseover(t){this._map.fire(new ai(t.type,this._map,t))}mouseout(t){this._map.fire(new ai(t.type,this._map,t))}touchstart(t){return this._firePreventable(new si(t.type,this._map,t))}touchmove(t){this._map.fire(new si(t.type,this._map,t))}touchend(t){this._map.fire(new si(t.type,this._map,t))}touchcancel(t){this._map.fire(new si(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ui{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(t){this._map.fire(new ai(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ai("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new ai(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hi{constructor(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(r.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const n=e;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)t.fitScreenCoordinates(i,o,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(r.remove(this._box),this._box=null),r.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new t.Event(e,{originalEvent:n}))}}function di(t,e){const n={};for(let i=0;ithis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=function(e){const n=new t.Point(0,0);for(const t of e)n._add(t);return n.div(e.length)}(n),this.touches=di(i,n)))}touchmove(t,e,n){if(this.aborted||!this.centroid)return;const i=di(n,e);for(const t in this.touches){const e=this.touches[t],n=i[t];(!n||n.dist(e)>30)&&(this.aborted=!0)}}touchend(t,e,n){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class pi{constructor(t){this.singleTap=new fi(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,n){this.singleTap.touchstart(t,e,n)}touchmove(t,e,n){this.singleTap.touchmove(t,e,n)}touchend(t,e,n){const i=this.singleTap.touchend(t,e,n);if(i){const e=t.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(i)<30;if(e&&n||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}}class mi{constructor(){this._zoomIn=new pi({numTouches:1,numTaps:2}),this._zoomOut=new pi({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,n){this._zoomIn.touchstart(t,e,n),this._zoomOut.touchstart(t,e,n)}touchmove(t,e,n){this._zoomIn.touchmove(t,e,n),this._zoomOut.touchmove(t,e,n)}touchend(t,e,n){const i=this._zoomIn.touchend(t,e,n),r=this._zoomOut.touchend(t,e,n);return i?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}):r?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(r)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const gi={0:1,2:2};class _i{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,e){return!1}_move(t,e){return{}}mousedown(t,e){if(this._lastPoint)return;const n=r.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}mousemoveWindow(t,e){const n=this._lastPoint;if(n)if(t.preventDefault(),function(t,e){const n=gi[e];return void 0===t.buttons||(t.buttons&n)!==n}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(n)0&&(this._active=!0);const r=di(i,n),o=new t.Point(0,0),a=new t.Point(0,0);let s=0;for(const t in r){const e=r[t],n=this._touches[t];n&&(o._add(e),a._add(e.sub(n)),s++,r[t]=e)}if(this._touches=r,sMath.abs(t.x)}class Ai extends wi{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(t){this._lastPoints=t,Ei(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,n){const i=t[0].sub(this._lastPoints[0]),r=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(i,r,n.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(i.y+r.y)/2*-.5}}gestureBeginsVertically(t,e,n){if(void 0!==this._valid)return this._valid;const i=t.mag()>=2,r=e.mag()>=2;if(!i&&!r)return;if(!i||!r)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return Ei(t)&&Ei(e)&&o}}const Pi={panStep:100,bearingStep:15,pitchStep:10};class Ii{constructor(){const t=Pi;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,n=0,i=0,r=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),r=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),r=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(n=0,i=0),{cameraAnimation:a=>{const s=a.getZoom();a.easeTo({duration:300,easeId:"keyboardHandler",easing:Oi,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+n*this._bearingStep,pitch:a.getPitch()+i*this._pitchStep,offset:[-r*this._panStep,-o*this._panStep],center:a.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Oi(t){return t*(2-t)}class Di{constructor(e,n){this._map=e,this._el=e.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;let n=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const i=t.browser.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const e=r.mousePos(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:e,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._map.transform,n=()=>e._terrainEnabled()?e.computeZoomRelativeTo(this._aroundCoord):e.zoom;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const r=n(),o=Math.pow(2,r),a="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(a*i))),"wheel"===this._type&&(this._startZoom=n(),this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:n(),r=this._startZoom,o=this._easing;let a,s=!1;if("wheel"===this._type&&r&&o){const e=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),n=o(e);a=t.number(r,i,n),e<1?this._frameId||(this._frameId=!0):s=!0}else a=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!s,zoomDelta:a-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=t.ease;if(this._prevEase){const e=this._prevEase,i=(t.browser.now()-e.start)/e.duration,r=e.easing(i+.01)-e.easing(i),o=.27/Math.sqrt(r*r+1e-4)*.01,a=Math.sqrt(.0729-o*o);n=t.bezier(o,a,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:n},n}reset(){this._active=!1}}class zi{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Ri{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:n.getZoom()+(t.shiftKey?-1:1),around:n.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Li{constructor(){this._tap=new pi({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,e,n){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=e[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(t,e,n))}touchmove(t,e,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const i=e[0],r=i.y-this._swipePoint.y;return this._swipePoint=i,t.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(t,e,n)}touchend(t,e,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(t,e,n)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fi{constructor(t,e,n){this._el=t,this._mousePan=e,this._touchPan=n}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Bi{constructor(t,e,n){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ni{constructor(t,e,n,i){this._el=t,this._touchZoom=e,this._touchRotate=n,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const $i=t=>t.zoom||t.drag||t.pitch||t.rotate;class ji extends t.Event{}class Ui{constructor(){this.constants=[1,1,.01],this.radius=0}setup(e,n){const i=t.sub([],n,e);this.radius=t.length(i[2]<0?t.div([],i,this.constants):[i[0],i[1],0])}projectRay(e){t.div(e,e,this.constants),t.normalize(e,e),t.mul$1(e,e,this.constants);const n=t.scale$2([],e,this.radius);if(n[2]>0){const e=t.scale$2([],[0,0,1],t.dot(n,[0,0,1])),i=t.scale$2([],t.normalize([],[n[0],n[1],0]),this.radius),r=t.add([],n,t.scale$2([],t.sub([],t.add([],i,e),n),2));n[0]=r[0],n[1]=r[1]}return n}}function Vi(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class qi{constructor(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ii(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Ui,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(const[e,n,i]of this._listeners)r.addEventListener(e,n,e===t.window.document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[e,n,i]of this._listeners)r.removeEventListener(e,n,e===t.window.document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const e=this._map,n=e.getCanvasContainer();this._add("mapEvent",new ci(e,t));const i=e.boxZoom=new hi(e,t);this._add("boxZoom",i);const r=new mi,o=new Ri;e.doubleClickZoom=new zi(o,r),this._add("tapZoom",r),this._add("clickZoom",o);const a=new Li;this._add("tapDragZoom",a);const s=e.touchPitch=new Ai;this._add("touchPitch",s);const l=new yi(t),c=new xi(t);e.dragRotate=new Bi(t,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new vi(t),h=new bi(t);e.dragPan=new Fi(n,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new Mi,f=new Si;e.touchZoomRotate=new Ni(n,f,d,a),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ui(e));const p=e.scrollZoom=new Di(e,this);this._add("scrollZoom",p,["mousePan"]);const m=e.keyboard=new Ii;this._add("keyboard",m);for(const n of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[n]&&e[n].enable(t[n])}_add(t,e,n){this._handlers.push({handlerName:t,handler:e,allowed:n}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean($i(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,n){for(const i in t)if(i!==n&&(!e||e.indexOf(i)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,t.type+"Window")}_getMapTouches(t){const e=[];for(const n of t)this._el.contains(n.target)&&e.push(n);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const n="renderFrame"===t.type?void 0:t,i={needsRenderFrame:!1},o={},a={},s=t.touches?this._getMapTouches(t.touches):void 0,l=s?r.touchPos(this._el,s):r.mousePos(this._el,t);for(const{handlerName:r,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;this._blockedByActive(a,u,r)?c.reset():c[e||t.type]&&(h=c[e||t.type](t,l,s),this.mergeHandlerResult(i,o,h,r,n),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||c.isActive())&&(a[r]=c)}const c={};for(const t in this._previousActiveHandlers)a[t]||(c[t]=n);this._previousActiveHandlers=a,(Object.keys(c).length||Vi(i))&&(this._changes.push([i,o,c]),this._triggerRenderFrame()),(Object.keys(a).length||Vi(i))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=i;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(e,n,i,r,o){if(!i)return;t.extend(e,i);const a={handlerName:r,originalEvent:i.originalEvent||o};void 0!==i.zoomDelta&&(n.zoom=a),void 0!==i.panDelta&&(n.drag=a),void 0!==i.pitchDelta&&(n.pitch=a),void 0!==i.bearingDelta&&(n.rotate=a)}_applyChanges(){const e={},n={},i={};for(const[r,o,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(e.around=r.around),void 0!==r.aroundCoord&&(e.aroundCoord=r.aroundCoord),void 0!==r.pinchAround&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),t.extend(n,o),t.extend(i,a);this._updateMapTransform(e,n,i),this._changes=[]}_updateMapTransform(e,n,i){const r=this._map,o=r.transform,a=t=>[t.x,t.y,t.z];if((t=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!Vi(e)){const t=o.zoom;o.cameraElevationReference="sea",o.recenterOnTerrain(),o.cameraElevationReference="ground",t!==o.zoom&&this._map._update(!0)}if(!Vi(e))return this._fireEvents(n,i,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:d,pinchAround:f}=e;void 0!==f&&(h=f),(t=>n.drag&&!this._eventsInProgress.drag)()&&h&&(this._dragOrigin=a(o.pointCoordinate3D(h)),this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",r._stop(!0),h=h||r.transform.centerPoint,c&&(o.bearing+=c),u&&(o.pitch+=u),o._updateCameraState();const p=[0,0,0];if(s){const t=o.screenPointToMercatorRay(h),e=o.screenPointToMercatorRay(h.sub(s)),n=this._trackingEllipsoid.projectRay(t.dir),i=this._trackingEllipsoid.projectRay(e.dir);p[0]=i[0]-n[0],p[1]=i[1]-n[1]}const m=o.zoom,g=[0,0,0];if(l){const e=a(d||o.pointCoordinate3D(h)),n={dir:t.normalize([],t.sub([],e,o._camera.position))},i=o.screenPointToMercatorRay(o.centerPoint);if(n.dir[2]<0){const r=t.altitudeFromMercatorZ(e[2],e[1]),s=o.rayIntersectionCoordinate(o.pointRayIntersection(o.centerPoint,r)),c=o.zoomDeltaToMovement(a(s),l)*(i.dir[2]/n.dir[2]);t.scale$2(g,n.dir,c)}else if(o._terrainEnabled()){const i=o.zoomDeltaToMovement(e,l);t.scale$2(g,n.dir,i)}}const _=t.add(p,p,g);o._translateCameraConstrained(_),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,i,!0)}_fireEvents(e,n,i){const r=$i(this._eventsInProgress),o=$i(e),a={};for(const t in e){const{originalEvent:n}=e[t];this._eventsInProgress[t]||(a[t+"start"]=n),this._eventsInProgress[t]=e[t]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:n}=e[t];this._fireEvent(t,n)}const s={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:i}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=n[e]||i,s[t+"end"]=l)}for(const t in s)this._fireEvent(t,s[t]);const c=$i(this._eventsInProgress);if(i&&(r||o)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),n=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new ji("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Zi extends t.Evented{constructor(e,n){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,n,i){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},n),i)}panTo(e,n,i){return this.easeTo(t.extend({center:e},n),i)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,n,i){return this.easeTo(t.extend({zoom:e},n),i)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,n,i){return this.easeTo(t.extend({bearing:e},n),i)}resetNorth(e,n){return this.rotateTo(0,t.extend({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(t,e){return Math.abs(this.getBearing()){if(this._zooming&&(i.zoom=t.number(r,l,e)),this._rotating&&(i.bearing=t.number(o,c,e)),this._pitching&&(i.pitch=t.number(a,u,e)),this._padding&&(i.interpolatePadding(s,h,e),f=i.centerPoint.add(d)),y)i.setLocationAtPoint(y,x);else{const t=i.zoomScale(i.zoom-r),n=l>r?Math.min(2,v):Math.max(.5,v),o=Math.pow(n,1-e),a=i.unproject(g.add(_.mult(e*o)).mult(t));i.setLocationAtPoint(i.renderWorldCopies?a.wrap():a,f)}this._fireMoveEvents(n)},t=>{i.recenterOnTerrain(),this._afterEase(n,t)},e),this}_prepareEase(e,n,i={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||i.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!i.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new t.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.transform.cameraElevationReference="ground";const i=this._zooming,r=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&this.fire(new t.Event("zoomend",e)),r&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,n){if(!e.essential&&t.browser.prefersReducedMotion){const i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,n)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const i=this.transform,r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,i.minZoom,i.maxZoom):r,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,u="pitch"in e?+e.pitch:a,h="padding"in e?e.padding:i.padding,d=i.zoomScale(l-r),f=t.Point.convert(e.offset);let p=i.centerPoint.add(f);const m=i.pointLocation(p),g=t.LngLat.convert(e.center||m);this._normalizeCenter(g);const _=i.project(m),v=i.project(g).sub(_);let y=e.curve;const x=Math.max(i.width,i.height),b=x/d,w=v.mag();if("minZoom"in e){const n=t.clamp(Math.min(e.minZoom,r,l),i.minZoom,i.maxZoom),o=x/i.zoomScale(n-r);y=Math.sqrt(o/w*2)}const T=y*y;function C(t){const e=(b*b-x*x+(t?-1:1)*T*T*w*w)/(2*(t?b:x)*T*w);return Math.log(Math.sqrt(e*e+1)-e)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function k(t){return(Math.exp(t)+Math.exp(-t))/2}const M=C(0);let E=function(t){return k(M)/k(M+y*t)},A=function(t){return x*((k(M)*(S(e=M+y*t)/k(e))-S(M))/T)/w;var e},P=(C(1)-M)/y;if(Math.abs(w)<1e-6||!isFinite(P)){if(Math.abs(x-b)<1e-6)return this.easeTo(e,n);const t=be.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==c,this._pitching=u!==a,this._padding=!i.isPaddingEqual(h),this._prepareEase(n,!1),this._ease(e=>{const d=e*P,m=1/E(d);i.zoom=1===e?l:r+i.scaleZoom(m),this._rotating&&(i.bearing=t.number(o,c,e)),this._pitching&&(i.pitch=t.number(a,u,e)),this._padding&&(i.interpolatePadding(s,h,e),p=i.centerPoint.add(f));const y=1===e?g:i.unproject(_.add(v.mult(A(d))).mult(m));i.setLocationAtPoint(i.renderWorldCopies?y.wrap():y,p),i._updateCenterElevation(),this._fireMoveEvents(n)},()=>this._afterEase(n),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,n,i){!1===i.animate||0===i.duration?(e(1),n()):(this._easeStart=t.browser.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,n){e=t.wrap(e,-180,180);const i=Math.abs(e-n);return Math.abs(e-360-n)180?-360:n<-180?360:0}}class Gi{constructor(e={}){this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=r.create("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=r.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const n=this._map._getUIString("AttributionControl."+e);t.title=n,t.setAttribute("aria-label",n)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))}_updateEditLink(){let e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){const i=n.reduce((t,e,i)=>(e.value&&(t+=`${e.key}=${e.value}${i"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style._sourceCaches;for(const n in e){const i=e[n];if(i.used){const e=i.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t.sort((t,e)=>t.length-e.length),t=t.filter((e,n)=>{for(let i=n+1;i=0)return!1;return!0});const n=t.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,t.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Hi{constructor(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)}onAdd(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");const e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return;const t=this._map.style._sourceCaches;if(0===Object.entries(t).length)return!0;for(const e in t){const n=t[e].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}}}class Xi{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,n=e?this._queue.concat(e):this._queue;for(const e of n)if(e.id===t)return void(e.cancelled=!0)}run(t=0){const e=this._currentlyRunning=this._queue;this._queue=[];for(const n of e)if(!n.cancelled&&(n.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Wi={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},{HTMLImageElement:Yi,HTMLElement:Ki,ImageBitmap:Ji}=t.window,Qi={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function tr(t){t.parentNode&&t.parentNode.removeChild(t)}const er={showCompass:!0,showZoom:!0,visualizePitch:!1};class nr{constructor(e,n,i=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new yi({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,i&&(this.mousePitch=new xi({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener(n,"mousedown",this.mousedown),r.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),r.addEventListener(n,"touchmove",this.touchmove),r.addEventListener(n,"touchend",this.touchend),r.addEventListener(n,"touchcancel",this.reset)}down(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag()}move(t,e){const n=this.map,i=this.mouseRotate.mousemoveWindow(t,e);if(i&&i.bearingDelta&&n.setBearing(n.getBearing()+i.bearingDelta),this.mousePitch){const i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&n.setPitch(n.getPitch()+i.pitchDelta)}}off(){const t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){r.enableDrag(),r.removeEventListener(t.window,"mousemove",this.mousemove),r.removeEventListener(t.window,"mouseup",this.mouseup)}mousedown(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),r.mousePos(this.element,e)),r.addEventListener(t.window,"mousemove",this.mousemove),r.addEventListener(t.window,"mouseup",this.mouseup)}mousemove(t){this.move(t,r.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)i.width||n.y>i.height;i.locationPoint(r).distSqr(n)180;){const t=i.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=i.width&&t.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e}const rr={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function or(t,e,n){const i=t.classList;for(const t in rr)i.remove(`mapboxgl-${n}-anchor-${t}`);i.add(`mapboxgl-${n}-anchor-${e}`)}class ar extends t.Evented{constructor(e,n){if(super(),(e instanceof t.window.HTMLElement||n)&&(e=t.extend({element:e},n)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.Point.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=r.create("div"),this._element.setAttribute("aria-label","Map marker");const n=r.createNS("http://www.w3.org/2000/svg","svg"),i=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",i+"px"),n.setAttributeNS(null,"width",o+"px"),n.setAttributeNS(null,"viewBox",`0 0 ${o} ${i}`);const a=r.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");const s=r.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=r.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=r.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const u=r.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const h=r.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),u.appendChild(h);const d=r.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const f=r.createNS("http://www.w3.org/2000/svg","path");f.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),d.appendChild(f);const p=r.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(6.0, 7.0)"),p.setAttributeNS(null,"fill","#FFFFFF");const m=r.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=r.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=r.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),s.appendChild(l),s.appendChild(u),s.appendChild(d),s.appendChild(p),s.appendChild(m),n.appendChild(s),n.setAttributeNS(null,"height",i*this._scale+"px"),n.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(n),this._offset=t.Point.convert(e&&e.offset||[0,-14])}this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),or(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),r.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,n=13.5,i=Math.sqrt(Math.pow(n,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[i,-1*(e-n+i)],"bottom-right":[-i,-1*(e-n+i)],left:[n,-1*(e-n)],right:[-n,-1*(e-n)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const e=t.code,n=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==n&&13!==n||this.togglePopup()}_onMapClick(t){const e=t.originalEvent.target,n=this._element;this._popup&&(e===n||n.contains(e))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_updateOcclusion(){this._occlusionTimer||(this._occlusionTimer=setTimeout(this._onOcclusionTimer.bind(this),60))}_onOcclusionTimer(){const t=this._map.transform,e=this._pos?this._pos.sub(this._transformedOffset()):null;if(e&&e.x>=0&&e.x=0&&e.y=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const sr={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let lr,cr=0,ur=!1;const hr={maxWidth:100,unit:"metric"};function dr(t,e,n){const i=n&&n.maxWidth||100,r=t._container.clientHeight/2,o=t.unproject([0,r]),a=t.unproject([i,r]),s=o.distanceTo(a);if(n&&"imperial"===n.unit){const n=3.2808*s;n>5280?fr(e,i,n/5280,t._getUIString("ScaleControl.Miles")):fr(e,i,n,t._getUIString("ScaleControl.Feet"))}else n&&"nautical"===n.unit?fr(e,i,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?fr(e,i,s/1e3,t._getUIString("ScaleControl.Kilometers")):fr(e,i,s,t._getUIString("ScaleControl.Meters"))}function fr(t,e,n,i){const r=function(t){const e=Math.pow(10,(""+Math.floor(t)).length-1);let n=t/e;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(n),e*n}(n);t.style.width=e*(r/n)+"px",t.innerHTML=`${r} ${i}`}const pr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},mr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),gr={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends Zi{constructor(e){if(null!=(e=t.extend({},Qi,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Yn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._optimizeForTerrain=e.optimizeForTerrain,this._renderTaskQueue=new Xi,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},Wi,e.locale),this._clickTolerance=e.clickTolerance,this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof Ki))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new qi(this,e),this._hash=e.hash&&new Kn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localFontFamily=e.localFontFamily,this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),e.attributionControl&&this.addControl(new Gi({customAttribution:e.customAttribution})),this._logoControl=new Hi,this.addControl(this._logoControl,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new t.Event(e.dataType+"data",e))}),this.on("dataloading",e=>{this.fire(new t.Event(e.dataType+"dataloading",e))})}_getMapId(){return this._mapId}addControl(e,n){if(void 0===n&&(n=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[n];return-1!==n.indexOf("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(e);return n>-1&&this._controls.splice(n,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}resize(e){const n=this._containerDimensions(),i=n[0],r=n[1];this._resizeCanvas(i,r),this.transform.resize(i,r),this.painter.resize(i,r);const o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(e){return this.transform.locationPoint3D(t.LngLat.convert(e))}unproject(e){return this.transform.pointLocation3D(t.Point.convert(e))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()}_createDelegatedListener(t,e,n){if("mouseenter"===t||"mouseover"===t){let i=!1;const r=r=>{const o=this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[];o.length?i||(i=!0,n.call(this,new ai(t,this,r.originalEvent,{features:o}))):i=!1};return{layer:e,listener:n,delegates:{mousemove:r,mouseout:()=>{i=!1}}}}if("mouseleave"===t||"mouseout"===t){let i=!1;const r=r=>{(this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?i=!0:i&&(i=!1,n.call(this,new ai(t,this,r.originalEvent)))},o=e=>{i&&(i=!1,n.call(this,new ai(t,this,e.originalEvent)))};return{layer:e,listener:n,delegates:{mousemove:r,mouseout:o}}}{const i=t=>{const i=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];i.length&&(t.features=i,n.call(this,t),delete t.features)};return{layer:e,listener:n,delegates:{[t]:i}}}}on(t,e,n){if(void 0===n)return super.on(t,e);const i=this._createDelegatedListener(t,e,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i);for(const t in i.delegates)this.on(t,i.delegates[t]);return this}once(t,e,n){if(void 0===n)return super.once(t,e);const i=this._createDelegatedListener(t,e,n);for(const t in i.delegates)this.once(t,i.delegates[t]);return this}off(t,e,n){return void 0===n?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(i=>{const r=this._delegatedListeners[t];for(let t=0;t{e?this.fire(new t.ErrorEvent(e)):i&&this._updateDiff(i,n)})}else"object"==typeof e&&this._updateDiff(e,n)}_updateDiff(e,n){try{this.style.setState(e)&&this._update(!0)}catch(i){t.warnOnce(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(e,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const n=this.style&&this.style._getSourceCaches(e);if(0!==n.length)return n.every(t=>t.loaded());this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)))}areTilesLoaded(){const t=this.style&&this.style._sourceCaches;for(const e in t){const n=t[e]._tiles;for(const t in n){const e=n[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,n)}removeSource(t){return this.style.removeSource(t),this._updateTerrain(),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,n,{pixelRatio:i=1,sdf:r=!1,stretchX:o,stretchY:a,content:s}={}){if(this._lazyInitEmptyStyle(),n instanceof Yi||Ji&&n instanceof Ji){const{width:l,height:c,data:u}=t.browser.getImageData(n);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},u),pixelRatio:i,stretchX:o,stretchY:a,content:s,sdf:r,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:l,height:c,data:u}=n,h=n;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},new Uint8Array(u)),pixelRatio:i,stretchX:o,stretchY:a,content:s,sdf:r,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e)}}}updateImage(e,n){const i=this.style.getImage(e);if(!i)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=n instanceof Yi||Ji&&n instanceof Ji?t.browser.getImageData(n):n,{width:o,height:a,data:s}=r;return void 0===o||void 0===a?this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):o!==i.data.width||a!==i.data.height?this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(i.data.replace(s,!(n instanceof Yi||Ji&&n instanceof Ji)),void this.style.updateImage(e,i))}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(e,n){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),n)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,n){return this.style.setLayerZoomRange(t,e,n),this._update(!0)}setFilter(t,e,n={}){return this.style.setFilter(t,e,n),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,n,i={}){return this.style.setPaintProperty(t,e,n,i),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,n,i={}){return this.style.setLayoutProperty(t,e,n,i),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(t){return this._lazyInitEmptyStyle(),this.style.setTerrain(t),this._update(!0)}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_detectMissingCSS(){"rgb(250, 128, 114)"!==t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&t.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const t=this._container;t.classList.add("mapboxgl-map"),(this._missingCSSCanary=r.create("div","mapboxgl-canary",t)).style.visibility="hidden",this._detectMissingCSS();const e=this._canvasContainer=r.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=r.create("canvas","mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1]);const i=this._controlContainer=r.create("div","mapboxgl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(t=>{o[t]=r.create("div","mapboxgl-ctrl-"+t,i)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,n){const i=t.browser.devicePixelRatio||1;this._canvas.width=i*e,this._canvas.height=i*n,this._canvas.style.width=e+"px",this._canvas.style.height=n+"px"}_setupPainter(){const n=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);i?(this.painter=new $n(i,this.transform),this.on("data",t=>{"source"===t.dataType&&this.painter.setTileLoadedFlag(!0)}),t.webpSupported.testSupport(i)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(e){let n,i=0;const r=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(n=r.createQueryEXT(),r.beginQueryEXT(r.TIME_ELAPSED_EXT,n),i=t.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let o=!1;const a=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,n=t.browser.now();this.style.zoomHistory.update(e,n);const i=new t.EvaluationParameters(e,{now:n,fadeDuration:a,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=i.crossFadingFactor();1===r&&r===this._crossFadingFactor||(o=!0,this._crossFadingFactor=r),this.style.update(i)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this._updateTerrain(),this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,a,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:a,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const e=t.browser.now()-i;r.endQueryEXT(r.TIME_ELAPSED_EXT,n),setTimeout(()=>{const i=r.getQueryObjectEXT(n,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(n),this.fire(new t.Event("gpu-timing-frame",{cpuTime:e,gpuTime:i}))},50)}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout(()=>{const n=this.painter.queryGpuTimers(e);this.fire(new t.Event("gpu-timing-layer",{layerTimes:n}))},50)}const s=this._sourcesDirty||this._styleDirty||this._placementDirty;if(s||this._repaint)this.triggerRepaint();else if(this._triggerFrame(!1),!this.isMoving()&&this.loaded()&&(this.fire(new t.Event("idle")),this._isInitialLoad&&this._authenticate(),this._isInitialLoad=!1,this.speedIndexTiming)){const e=this._calculateSpeedIndex();this.fire(new t.Event("speedindexcompleted",{speedIndex:e})),this.speedIndexTiming=!1}return!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0),this}_authenticate(){t.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,e=>{if(e&&(e.message===t.AUTH_ERR_MSG||401===e.status)){t.browser.setErrorState();const e=this.painter.context.gl;this._logoControl instanceof Hi&&this._logoControl._updateLogo(),e&&e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT|e.STENCIL_BUFFER_BIT)}}),t.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const t=this.painter.canvasCopy(),e=this.painter.getCanvasCopiesAndTimestamps();e.timeStamps.push(performance.now());const n=this.painter.context.gl,i=n.createFramebuffer();function r(t){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0);const e=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,e),e}return n.bindFramebuffer(n.FRAMEBUFFER,i),this._canvasPixelComparison(r(t),e.canvasCopies.map(r),e.timeStamps)}_canvasPixelComparison(t,e,n){let i=n[1]-n[0];const r=t.length/4;for(let o=0;o{const e=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,e&&this._render(t)}))}_onWindowOnline(){this._update()}_onWindowResize(t){this._trackResize&&this.resize({originalEvent:t})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(t){this._speedIndexTiming!==t&&(this._speedIndexTiming=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}_setCacheLimits(e,n){t.setCacheLimits(e,n)}get version(){return t.version}},NavigationControl:class{constructor(e){this.options=t.extend({},er,e),this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),r.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),r.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=r.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),n=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new nr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){r.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const n=r.create("button",t,this._container);return n.type="button",n.addEventListener("click",e),n}_setButtonTitle(t,e){const n=this._map._getUIString("NavigationControl."+e);t.title=n,t.setAttribute("aria-label",n)}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},sr,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(e){var n;return this._map=e,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==lr?n(lr):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then(t=>{lr="denied"!==t.state,n(lr)}):(lr=!!t.window.navigator.geolocation,n(lr)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),r.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,cr=0,ur=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),n=t.coords;return e&&(n.longitudee.getEast()||n.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}}_updateCamera(e){const n=new t.LngLat(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,r=this._map.getBearing(),o=t.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(i),o,{geolocateSource:!0})}_updateMarker(e){if(e){const n=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),n=this._map.unproject([1,t]),i=e.distanceTo(n),r=Math.ceil(2*this._accuracy/i);this._circleElement.style.width=r+"px",this._circleElement.style.height=r+"px"}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&ur)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=r.create("button","mapboxgl-ctrl-geolocate",this._container),r.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new ar(this._dotElement),this._circleElement=r.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ar({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":cr--,ur=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),cr++,cr>1?(e={maximumAge:6e5,timeout:0},ur=!0):(e=this.options.positionOptions,ur=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Gi,ScaleControl:class{constructor(e){this.options=t.extend({},hr,e),t.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){dr(this._map,this._container,this.options)}onAdd(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(t){this.options.unit=t,dr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in t.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!t.window.document.fullscreenEnabled&&!t.window.document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=r.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(t.window.document.fullscreenElement||t.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(pr),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(t.window.document.createTextNode(e))}setHTML(e){const n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)n.appendChild(r);return this.setDOMContent(n)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=r.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(t){this._update(t.point)}_onMouseMove(t){this._update(t.point)}_onDrag(t){this._update(t.point)}_update(e){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(t=>this._container.classList.add(t)),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ir(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;const n=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);let i=this.options.anchor;const o=function e(n){if(n){if("number"==typeof n){const e=Math.round(Math.sqrt(.5*Math.pow(n,2)));return{center:new t.Point(0,0),top:new t.Point(0,n),"top-left":new t.Point(e,e),"top-right":new t.Point(-e,e),bottom:new t.Point(0,-n),"bottom-left":new t.Point(e,-e),"bottom-right":new t.Point(-e,-e),left:new t.Point(n,0),right:new t.Point(-n,0)}}if(n instanceof t.Point||Array.isArray(n)){const e=t.Point.convert(n);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:t.Point.convert(n.center||[0,0]),top:t.Point.convert(n.top||[0,0]),"top-left":t.Point.convert(n["top-left"]||[0,0]),"top-right":t.Point.convert(n["top-right"]||[0,0]),bottom:t.Point.convert(n.bottom||[0,0]),"bottom-left":t.Point.convert(n["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(n["bottom-right"]||[0,0]),left:t.Point.convert(n.left||[0,0]),right:t.Point.convert(n.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!i){const t=this._container.offsetWidth,e=this._container.offsetHeight;let r;r=n.y+o.bottom.ythis._map.transform.height-e?["bottom"]:[],n.xthis._map.transform.width-t/2&&r.push("right"),i=0===r.length?"bottom":r.join("-")}const a=n.add(o[i]).round();r.setTransform(this._container,`${rr[i]} translate(${a.x}px,${a.y}px)`),or(this._container,i,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(mr);t&&t.focus()}_onClose(){this.remove()}},Marker:ar,Style:jt,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,FreeCameraOptions:Xn,Evented:t.Evented,config:t.config,prewarm:function(){L().acquire(D)},clearPrewarmedResources:function(){const t=R;t&&t.isPreloaded()&&1===t.numActive()&&(t.release(D),R=null)},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return z.workerCount},set workerCount(t){z.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage(e){t.clearTileCache(e)},workerUrl:"",workerClass:null,setNow:t.browser.setNow,restoreNow:t.browser.restoreNow};return gr})),i}))}).call(this)}).call(this,t("_process"))},{_process:39}],39:[function(t,e,n){var i,r,o=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(t){if(i===setTimeout)return setTimeout(t,0);if((i===a||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:a}catch(t){i=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var c,u=[],h=!1,d=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):d=-1,u.length&&p())}function p(){if(!h){var t=l(f);h=!0;for(var e=u.length;e;){for(c=u,u=[];++d1)for(var n=1;n As of ScrollMagic 2.0.0 you need to use 'new ScrollMagic.Controller()' to create a new controller instance. Use 'new ScrollMagic.Scene()' to instance a scene.")};t.version="2.0.7",window.addEventListener("mousewheel",(function(){})),t.Controller=function(n){var r,o,a="ScrollMagic.Controller",s=e.defaults,l=this,c=i.extend({},s,n),u=[],h=!1,d=0,f="PAUSED",p=!0,m=0,g=!0,_=function(){c.refreshInterval>0&&(o=window.setTimeout(C,c.refreshInterval))},v=function(){return c.vertical?i.get.scrollTop(c.container):i.get.scrollLeft(c.container)},y=function(){return c.vertical?i.get.height(c.container):i.get.width(c.container)},x=this._setScrollPos=function(t){c.vertical?p?window.scrollTo(i.get.scrollLeft(),t):c.container.scrollTop=t:p?window.scrollTo(t,i.get.scrollTop()):c.container.scrollLeft=t},b=function(){if(g&&h){var t=i.type.Array(h)?h:u.slice(0);h=!1;var e=d,n=(d=l.scrollPos())-e;0!==n&&(f=n>0?"FORWARD":"REVERSE"),"REVERSE"===f&&t.reverse(),t.forEach((function(e,n){S(3,"updating Scene "+(n+1)+"/"+t.length+" ("+u.length+" total)"),e.update(!0)})),0===t.length&&c.loglevel>=3&&S(3,"updating 0 Scenes (nothing added to controller)")}},w=function(){r=i.rAF(b)},T=function(t){S(3,"event fired causing an update:",t.type),"resize"==t.type&&(m=y(),f="PAUSED"),!0!==h&&(h=!0,w())},C=function(){if(!p&&m!=y()){var t;try{t=new Event("resize",{bubbles:!1,cancelable:!1})}catch(e){(t=document.createEvent("Event")).initEvent("resize",!1,!1)}c.container.dispatchEvent(t)}u.forEach((function(t,e){t.refresh()})),_()},S=this._log=function(t,e){c.loglevel>=t&&(Array.prototype.splice.call(arguments,1,0,"("+a+") ->"),i.log.apply(window,arguments))};this._options=c;var k=function(t){if(t.length<=1)return t;var e=t.slice(0);return e.sort((function(t,e){return t.scrollOffset()>e.scrollOffset()?1:-1})),e};return this.addScene=function(e){if(i.type.Array(e))e.forEach((function(t,e){l.addScene(t)}));else if(e instanceof t.Scene){if(e.controller()!==l)e.addTo(l);else if(u.indexOf(e)<0){for(var n in u.push(e),u=k(u),e.on("shift.controller_sort",(function(){u=k(u)})),c.globalSceneOptions)e[n]&&e[n].call(e,c.globalSceneOptions[n]);S(3,"adding Scene (now "+u.length+" total)")}}else S(1,"ERROR: invalid argument supplied for '.addScene()'");return l},this.removeScene=function(t){if(i.type.Array(t))t.forEach((function(t,e){l.removeScene(t)}));else{var e=u.indexOf(t);e>-1&&(t.off("shift.controller_sort"),u.splice(e,1),S(3,"removing Scene (now "+u.length+" left)"),t.remove())}return l},this.updateScene=function(e,n){return i.type.Array(e)?e.forEach((function(t,e){l.updateScene(t,n)})):n?e.update(!0):!0!==h&&e instanceof t.Scene&&(-1==(h=h||[]).indexOf(e)&&h.push(e),h=k(h),w()),l},this.update=function(t){return T({type:"resize"}),t&&b(),l},this.scrollTo=function(e,n){if(i.type.Number(e))x.call(c.container,e,n);else if(e instanceof t.Scene)e.controller()===l?l.scrollTo(e.scrollOffset(),n):S(2,"scrollTo(): The supplied scene does not belong to this controller. Scroll cancelled.",e);else if(i.type.Function(e))x=e;else{var r=i.get.elements(e)[0];if(r){for(;r.parentNode.hasAttribute("data-scrollmagic-pin-spacer");)r=r.parentNode;var o=c.vertical?"top":"left",a=i.get.offset(c.container),s=i.get.offset(r);p||(a[o]-=l.scrollPos()),l.scrollTo(s[o]-a[o],n)}else S(2,"scrollTo(): The supplied argument is invalid. Scroll cancelled.",e)}return l},this.scrollPos=function(t){return arguments.length?(i.type.Function(t)?v=t:S(2,"Provided value for method 'scrollPos' is not a function. To change the current scroll position use 'scrollTo()'."),l):v.call(l)},this.info=function(t){var e={size:m,vertical:c.vertical,scrollPos:d,scrollDirection:f,container:c.container,isDocument:p};return arguments.length?void 0!==e[t]?e[t]:void S(1,'ERROR: option "'+t+'" is not available'):e},this.loglevel=function(t){return arguments.length?(c.loglevel!=t&&(c.loglevel=t),l):c.loglevel},this.enabled=function(t){return arguments.length?(g!=t&&(g=!!t,l.updateScene(u,!0)),l):g},this.destroy=function(t){window.clearTimeout(o);for(var e=u.length;e--;)u[e].destroy(t);return c.container.removeEventListener("resize",T),c.container.removeEventListener("scroll",T),i.cAF(r),S(3,"destroyed "+a+" (reset: "+(t?"true":"false")+")"),null},function(){for(var e in c)s.hasOwnProperty(e)||(S(2,'WARNING: Unknown option "'+e+'"'),delete c[e]);if(c.container=i.get.elements(c.container)[0],!c.container)throw S(1,"ERROR creating object "+a+": No valid scroll container supplied"),a+" init failed.";(p=c.container===window||c.container===document.body||!document.body.contains(c.container))&&(c.container=window),m=y(),c.container.addEventListener("resize",T),c.container.addEventListener("scroll",T);var n=parseInt(c.refreshInterval,10);c.refreshInterval=i.type.Number(n)?n:s.refreshInterval,_(),S(3,"added new "+a+" controller (v"+t.version+")")}(),l};var e={defaults:{container:window,vertical:!0,globalSceneOptions:{},loglevel:2,refreshInterval:100}};t.Controller.addOption=function(t,n){e.defaults[t]=n},t.Controller.extend=function(e){var n=this;t.Controller=function(){return n.apply(this,arguments),this.$super=i.extend({},this),e.apply(this,arguments)||this},i.extend(t.Controller,n),t.Controller.prototype=n.prototype,t.Controller.prototype.constructor=t.Controller},t.Scene=function(e){var r,o,a="ScrollMagic.Scene",s=n.defaults,l=this,c=i.extend({},s,e),u="BEFORE",h=0,d={start:0,end:0},f=0,p=!0,m={};this.on=function(t,e){return i.type.Function(e)?(t=t.trim().split(" ")).forEach((function(t){var n=t.split("."),i=n[0],r=n[1];"*"!=i&&(m[i]||(m[i]=[]),m[i].push({namespace:r||"",callback:e}))})):g(1,"ERROR when calling '.on()': Supplied callback for '"+t+"' is not a valid function!"),l},this.off=function(t,e){return t?((t=t.trim().split(" ")).forEach((function(t,n){var i=t.split("."),r=i[0],o=i[1]||"";("*"===r?Object.keys(m):[r]).forEach((function(t){for(var n=m[t]||[],i=n.length;i--;){var r=n[i];!r||o!==r.namespace&&"*"!==o||e&&e!=r.callback||n.splice(i,1)}n.length||delete m[t]}))})),l):(g(1,"ERROR: Invalid event name supplied."),l)},this.trigger=function(e,n){if(e){var i=e.trim().split("."),r=i[0],o=i[1],a=m[r];g(3,"event fired:",r,n?"->":"",n||""),a&&a.forEach((function(e,i){o&&o!==e.namespace||e.callback.call(l,new t.Event(r,e.namespace,l,n))}))}else g(1,"ERROR: Invalid event name supplied.");return l},l.on("change.internal",(function(t){"loglevel"!==t.what&&"tweenChanges"!==t.what&&("triggerElement"===t.what?b():"reverse"===t.what&&l.update())})).on("shift.internal",(function(t){y(),l.update()}));var g=this._log=function(t,e){c.loglevel>=t&&(Array.prototype.splice.call(arguments,1,0,"("+a+") ->"),i.log.apply(window,arguments))};this.addTo=function(e){return e instanceof t.Controller?o!=e&&(o&&o.removeScene(l),o=e,C(),x(!0),b(!0),y(),o.info("container").addEventListener("resize",w),e.addScene(l),l.trigger("add",{controller:o}),g(3,"added "+a+" to controller"),l.update()):g(1,"ERROR: supplied argument of 'addTo()' is not a valid ScrollMagic Controller"),l},this.enabled=function(t){return arguments.length?(p!=t&&(p=!!t,l.update(!0)),l):p},this.remove=function(){if(o){o.info("container").removeEventListener("resize",w);var t=o;o=void 0,t.removeScene(l),l.trigger("remove"),g(3,"removed "+a+" from controller")}return l},this.destroy=function(t){return l.trigger("destroy",{reset:t}),l.remove(),l.off("*.*"),g(3,"destroyed "+a+" (reset: "+(t?"true":"false")+")"),null},this.update=function(t){if(o)if(t)if(o.enabled()&&p){var e,n=o.info("scrollPos");e=c.duration>0?(n-d.start)/(d.end-d.start):n>=d.start?1:0,l.trigger("update",{startPos:d.start,endPos:d.end,scrollPos:n}),l.progress(e)}else _&&"DURING"===u&&M(!0);else o.updateScene(l,!1);return l},this.refresh=function(){return x(),b(),l},this.progress=function(t){if(arguments.length){var e=!1,n=u,i=o?o.info("scrollDirection"):"PAUSED",r=c.reverse||t>=h;if(0===c.duration?(e=h!=t,u=0==(h=t<1&&r?0:1)?"BEFORE":"DURING"):t<0&&"BEFORE"!==u&&r?(h=0,u="BEFORE",e=!0):t>=0&&t<1&&r?(h=t,u="DURING",e=!0):t>=1&&"AFTER"!==u?(h=1,u="AFTER",e=!0):"DURING"!==u||r||M(),e){var a={progress:h,state:u,scrollDirection:i},s=u!=n,d=function(t){l.trigger(t,a)};s&&"DURING"!==n&&(d("enter"),d("BEFORE"===n?"start":"end")),d("progress"),s&&"DURING"!==u&&(d("BEFORE"===u?"start":"end"),d("leave"))}return l}return h};var _,v,y=function(){d={start:f+c.offset},o&&c.triggerElement&&(d.start-=o.info("size")*c.triggerHook),d.end=d.start+c.duration},x=function(t){r&&S("duration",r.call(l))&&!t&&(l.trigger("change",{what:"duration",newval:c.duration}),l.trigger("shift",{reason:"duration"}))},b=function(t){var e=0,n=c.triggerElement;if(o&&(n||f>0)){if(n)if(n.parentNode){for(var r=o.info(),a=i.get.offset(r.container),s=r.vertical?"top":"left";n.parentNode.hasAttribute("data-scrollmagic-pin-spacer");)n=n.parentNode;var u=i.get.offset(n);r.isDocument||(a[s]-=o.scrollPos()),e=u[s]-a[s]}else g(2,"WARNING: triggerElement was removed from DOM and will be reset to",void 0),l.triggerElement(void 0);var h=e!=f;f=e,h&&!t&&l.trigger("shift",{reason:"triggerElementPosition"})}},w=function(t){c.triggerHook>0&&l.trigger("shift",{reason:"containerResize"})},T=i.extend(n.validate,{duration:function(t){if(i.type.String(t)&&t.match(/^(\.|\d)*\d+%$/)){var e=parseFloat(t)/100;t=function(){return o?o.info("size")*e:0}}if(i.type.Function(t)){r=t;try{t=parseFloat(r.call(l))}catch(e){t=-1}}if(t=parseFloat(t),!i.type.Number(t)||t<0)throw r?(r=void 0,['Invalid return value of supplied function for option "duration":',t]):['Invalid value for option "duration":',t];return t}}),C=function(t){(t=arguments.length?[t]:Object.keys(T)).forEach((function(t,e){var n;if(T[t])try{n=T[t](c[t])}catch(e){n=s[t];var r=i.type.String(e)?[e]:e;i.type.Array(r)?(r[0]="ERROR: "+r[0],r.unshift(1),g.apply(this,r)):g(1,"ERROR: Problem executing validation callback for option '"+t+"':",e.message)}finally{c[t]=n}}))},S=function(t,e){var n=!1,i=c[t];return c[t]!=e&&(c[t]=e,C(t),n=i!=c[t]),n},k=function(t){l[t]||(l[t]=function(e){return arguments.length?("duration"===t&&(r=void 0),S(t,e)&&(l.trigger("change",{what:t,newval:c[t]}),n.shifts.indexOf(t)>-1&&l.trigger("shift",{reason:t})),l):c[t]})};this.controller=function(){return o},this.state=function(){return u},this.scrollOffset=function(){return d.start},this.triggerPosition=function(){var t=c.offset;return o&&(c.triggerElement?t+=f:t+=o.info("size")*l.triggerHook()),t},l.on("shift.internal",(function(t){var e="duration"===t.reason;("AFTER"===u&&e||"DURING"===u&&0===c.duration)&&M(),e&&E()})).on("progress.internal",(function(t){M()})).on("add.internal",(function(t){E()})).on("destroy.internal",(function(t){l.removePin(t.reset)}));var M=function(t){if(_&&o){var e=o.info(),n=v.spacer.firstChild;if(t||"DURING"!==u){var r={position:v.inFlow?"relative":"absolute",top:0,left:0},a=i.css(n,"position")!=r.position;v.pushFollowers?c.duration>0&&("AFTER"===u&&0===parseFloat(i.css(v.spacer,"padding-top"))||"BEFORE"===u&&0===parseFloat(i.css(v.spacer,"padding-bottom")))&&(a=!0):r[e.vertical?"top":"left"]=c.duration*h,i.css(n,r),a&&E()}else{"fixed"!=i.css(n,"position")&&(i.css(n,{position:"fixed"}),E());var s=i.get.offset(v.spacer,!0),l=c.reverse||0===c.duration?e.scrollPos-d.start:Math.round(h*c.duration*10)/10;s[e.vertical?"top":"left"]+=l,i.css(v.spacer.firstChild,{top:s.top,left:s.left})}}},E=function(){if(_&&o&&v.inFlow){var t="DURING"===u,e=o.info("vertical"),n=v.spacer.firstChild,r=i.isMarginCollapseType(i.css(v.spacer,"display")),a={};v.relSize.width||v.relSize.autoFullWidth?t?i.css(_,{width:i.get.width(v.spacer)}):i.css(_,{width:"100%"}):(a["min-width"]=i.get.width(e?_:n,!0,!0),a.width=t?a["min-width"]:"auto"),v.relSize.height?t?i.css(_,{height:i.get.height(v.spacer)-(v.pushFollowers?c.duration:0)}):i.css(_,{height:"100%"}):(a["min-height"]=i.get.height(e?n:_,!0,!r),a.height=t?a["min-height"]:"auto"),v.pushFollowers&&(a["padding"+(e?"Top":"Left")]=c.duration*h,a["padding"+(e?"Bottom":"Right")]=c.duration*(1-h)),i.css(v.spacer,a)}},A=function(){o&&_&&"DURING"===u&&!o.info("isDocument")&&M()},P=function(){o&&_&&"DURING"===u&&((v.relSize.width||v.relSize.autoFullWidth)&&i.get.width(window)!=i.get.width(v.spacer.parentNode)||v.relSize.height&&i.get.height(window)!=i.get.height(v.spacer.parentNode))&&E()},I=function(t){o&&_&&"DURING"===u&&!o.info("isDocument")&&(t.preventDefault(),o._setScrollPos(o.info("scrollPos")-((t.wheelDelta||t[o.info("vertical")?"wheelDeltaY":"wheelDeltaX"])/3||30*-t.detail)))};this.setPin=function(t,e){var n=e&&e.hasOwnProperty("pushFollowers");if(e=i.extend({},{pushFollowers:!0,spacerClass:"scrollmagic-pin-spacer"},e),!(t=i.get.elements(t)[0]))return g(1,"ERROR calling method 'setPin()': Invalid pin element supplied."),l;if("fixed"===i.css(t,"position"))return g(1,"ERROR calling method 'setPin()': Pin does not work with elements that are positioned 'fixed'."),l;if(_){if(_===t)return l;l.removePin()}var r=(_=t).parentNode.style.display,o=["top","left","bottom","right","margin","marginLeft","marginRight","marginTop","marginBottom"];_.parentNode.style.display="none";var a="absolute"!=i.css(_,"position"),s=i.css(_,o.concat(["display"])),u=i.css(_,["width","height"]);_.parentNode.style.display=r,!a&&e.pushFollowers&&(g(2,"WARNING: If the pinned element is positioned absolutely pushFollowers will be disabled."),e.pushFollowers=!1),window.setTimeout((function(){_&&0===c.duration&&n&&e.pushFollowers&&g(2,"WARNING: pushFollowers =",!0,"has no effect, when scene duration is 0.")}),0);var h=_.parentNode.insertBefore(document.createElement("div"),_),d=i.extend(s,{position:a?"relative":"absolute",boxSizing:"content-box",mozBoxSizing:"content-box",webkitBoxSizing:"content-box"});if(a||i.extend(d,i.css(_,["width","height"])),i.css(h,d),h.setAttribute("data-scrollmagic-pin-spacer",""),i.addClass(h,e.spacerClass),v={spacer:h,relSize:{width:"%"===u.width.slice(-1),height:"%"===u.height.slice(-1),autoFullWidth:"auto"===u.width&&a&&i.isMarginCollapseType(s.display)},pushFollowers:e.pushFollowers,inFlow:a},!_.___origStyle){_.___origStyle={};var f=_.style;o.concat(["width","height","position","boxSizing","mozBoxSizing","webkitBoxSizing"]).forEach((function(t){_.___origStyle[t]=f[t]||""}))}return v.relSize.width&&i.css(h,{width:u.width}),v.relSize.height&&i.css(h,{height:u.height}),h.appendChild(_),i.css(_,{position:a?"relative":"absolute",margin:"auto",top:"auto",left:"auto",bottom:"auto",right:"auto"}),(v.relSize.width||v.relSize.autoFullWidth)&&i.css(_,{boxSizing:"border-box",mozBoxSizing:"border-box",webkitBoxSizing:"border-box"}),window.addEventListener("scroll",A),window.addEventListener("resize",A),window.addEventListener("resize",P),_.addEventListener("mousewheel",I),_.addEventListener("DOMMouseScroll",I),g(3,"added pin"),M(),l},this.removePin=function(t){if(_){if("DURING"===u&&M(!0),t||!o){var e=v.spacer.firstChild;if(e.hasAttribute("data-scrollmagic-pin-spacer")){var n=v.spacer.style,r={};["margin","marginLeft","marginRight","marginTop","marginBottom"].forEach((function(t){r[t]=n[t]||""})),i.css(e,r)}v.spacer.parentNode.insertBefore(e,v.spacer),v.spacer.parentNode.removeChild(v.spacer),_.parentNode.hasAttribute("data-scrollmagic-pin-spacer")||(i.css(_,_.___origStyle),delete _.___origStyle)}window.removeEventListener("scroll",A),window.removeEventListener("resize",A),window.removeEventListener("resize",P),_.removeEventListener("mousewheel",I),_.removeEventListener("DOMMouseScroll",I),_=void 0,g(3,"removed pin (reset: "+(t?"true":"false")+")")}return l};var O,D=[];return l.on("destroy.internal",(function(t){l.removeClassToggle(t.reset)})),this.setClassToggle=function(t,e){var n=i.get.elements(t);return 0!==n.length&&i.type.String(e)?(D.length>0&&l.removeClassToggle(),O=e,D=n,l.on("enter.internal_class leave.internal_class",(function(t){var e="enter"===t.type?i.addClass:i.removeClass;D.forEach((function(t,n){e(t,O)}))})),l):(g(1,"ERROR calling method 'setClassToggle()': Invalid "+(0===n.length?"element":"classes")+" supplied."),l)},this.removeClassToggle=function(t){return t&&D.forEach((function(t,e){i.removeClass(t,O)})),l.off("start.internal_class end.internal_class"),O=void 0,D=[],l},function(){for(var t in c)s.hasOwnProperty(t)||(g(2,'WARNING: Unknown option "'+t+'"'),delete c[t]);for(var e in s)k(e);C()}(),l};var n={defaults:{duration:0,offset:0,triggerElement:void 0,triggerHook:.5,reverse:!0,loglevel:2},validate:{offset:function(t){if(t=parseFloat(t),!i.type.Number(t))throw['Invalid value for option "offset":',t];return t},triggerElement:function(t){if(t=t||void 0){var e=i.get.elements(t)[0];if(!e||!e.parentNode)throw['Element defined in option "triggerElement" was not found:',t];t=e}return t},triggerHook:function(t){var e={onCenter:.5,onEnter:1,onLeave:0};if(i.type.Number(t))t=Math.max(0,Math.min(parseFloat(t),1));else{if(!(t in e))throw['Invalid value for option "triggerHook": ',t];t=e[t]}return t},reverse:function(t){return!!t},loglevel:function(t){if(t=parseInt(t),!i.type.Number(t)||t<0||t>3)throw['Invalid value for option "loglevel":',t];return t}},shifts:["duration","offset","triggerHook"]};t.Scene.addOption=function(e,i,r,o){e in n.defaults?t._util.log(1,"[static] ScrollMagic.Scene -> Cannot add Scene option '"+e+"', because it already exists."):(n.defaults[e]=i,n.validate[e]=r,o&&n.shifts.push(e))},t.Scene.extend=function(e){var n=this;t.Scene=function(){return n.apply(this,arguments),this.$super=i.extend({},this),e.apply(this,arguments)||this},i.extend(t.Scene,n),t.Scene.prototype=n.prototype,t.Scene.prototype.constructor=t.Scene},t.Event=function(t,e,n,i){for(var r in i=i||{})this[r]=i[r];return this.type=t,this.target=this.currentTarget=n,this.namespace=e||"",this.timeStamp=this.timestamp=Date.now(),this};var i=t._util=function(t){var e,n={},i=function(t){return parseFloat(t)||0},r=function(e){return e.currentStyle?e.currentStyle:t.getComputedStyle(e)},o=function(e,n,o,a){if((n=n===document?t:n)===t)a=!1;else if(!p.DomElement(n))return 0;e=e.charAt(0).toUpperCase()+e.substr(1).toLowerCase();var s=(o?n["offset"+e]||n["outer"+e]:n["client"+e]||n["inner"+e])||0;if(o&&a){var l=r(n);s+="Height"===e?i(l.marginTop)+i(l.marginBottom):i(l.marginLeft)+i(l.marginRight)}return s},a=function(t){return t.replace(/^[^a-z]+([a-z])/g,"$1").replace(/-([a-z])/g,(function(t){return t[1].toUpperCase()}))};n.extend=function(t){for(t=t||{},e=1;e-1};var s=0,l=["ms","moz","webkit","o"],c=t.requestAnimationFrame,u=t.cancelAnimationFrame;for(e=0;!c&&eh.length||t<=0)&&(t=h.length);var e=new Date,n=("0"+e.getHours()).slice(-2)+":"+("0"+e.getMinutes()).slice(-2)+":"+("0"+e.getSeconds()).slice(-2)+":"+("00"+e.getMilliseconds()).slice(-3),i=h[t-1],r=Array.prototype.splice.call(arguments,1),o=Function.prototype.bind.call(d[i],d);r.unshift(n),o.apply(d,r)};var p=n.type=function(t){return Object.prototype.toString.call(t).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};p.String=function(t){return"string"===p(t)},p.Function=function(t){return"function"===p(t)},p.Array=function(t){return Array.isArray(t)},p.Number=function(t){return!p.Array(t)&&t-parseFloat(t)+1>=0},p.DomElement=function(t){return"object"==typeof HTMLElement||"function"==typeof HTMLElement?t instanceof HTMLElement||t instanceof SVGElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName};var m=n.get={};return m.elements=function(e){var n=[];if(p.String(e))try{e=document.querySelectorAll(e)}catch(t){return n}if("nodelist"===p(e)||p.Array(e)||e instanceof NodeList)for(var i=0,r=n.length=e.length;i ERROR calling addIndicators() due to missing Plugin 'debug.addIndicators'. Please make sure to include plugins/debug.addIndicators.js"),this},t.Scene.prototype.removeIndicators=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeIndicators() due to missing Plugin 'debug.addIndicators'. Please make sure to include plugins/debug.addIndicators.js"),this},t.Scene.prototype.setTween=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling setTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js"),this},t.Scene.prototype.removeTween=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js"),this},t.Scene.prototype.setVelocity=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling setVelocity() due to missing Plugin 'animation.velocity'. Please make sure to include plugins/animation.velocity.js"),this},t.Scene.prototype.removeVelocity=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeVelocity() due to missing Plugin 'animation.velocity'. Please make sure to include plugins/animation.velocity.js"),this},t},"function"==typeof define&&define.amd?define(r):"object"==typeof n?e.exports=r():i.ScrollMagic=r()},{}],41:[function(t,e,n){ /*! * ScrollMagic v2.0.7 (2019-05-07) * The javascript library for magical scroll interactions. * (c) 2019 Jan Paepke (@janpaepke) * Project Website: http://scrollmagic.io * * @version 2.0.7 * @license Dual licensed under MIT license and GPL. * @author Jan Paepke - e-mail@janpaepke.de * * @file ScrollMagic GSAP Animation Plugin. * * requires: GSAP ~1.14 * Powered by the Greensock Animation Platform (GSAP): http://www.greensock.com/js * Greensock License info at http://www.greensock.com/licensing/ */var i,r;i=this,r=function(t,e,n){"use strict";var i="animation.gsap",r=window.console||{},o=Function.prototype.bind.call(r.error||r.log||function(){},r);t||o("("+i+") -> ERROR: The ScrollMagic main module could not be found. Please make sure it's loaded before this plugin or use an asynchronous loader like requirejs."),e||o("("+i+") -> ERROR: TweenLite or TweenMax could not be found. Please make sure GSAP is loaded before ScrollMagic or use an asynchronous loader like requirejs."),t.Scene.addOption("tweenChanges",!1,(function(t){return!!t})),t.Scene.extend((function(){var t,r=this,o=function(){r._log&&(Array.prototype.splice.call(arguments,1,0,"("+i+")","->"),r._log.apply(this,arguments))};r.on("progress.plugin_gsap",(function(){a()})),r.on("destroy.plugin_gsap",(function(t){r.removeTween(t.reset)}));var a=function(){if(t){var e=r.progress(),n=r.state();t.repeat&&-1===t.repeat()?"DURING"===n&&t.paused()?t.play():"DURING"===n||t.paused()||t.pause():e!=t.progress()&&(0===r.duration()?e>0?t.play():t.reverse():r.tweenChanges()&&t.tweenTo?t.tweenTo(e*t.duration()):t.progress(e).pause())}};r.setTween=function(i,s,l){var c;arguments.length>1&&(arguments.length<3&&(l=s,s=1),i=e.to(i,s,l));try{(c=n?new n({smoothChildTiming:!0}).add(i):i).pause()}catch(t){return o(1,"ERROR calling method 'setTween()': Supplied argument is not a valid TweenObject"),r}if(t&&r.removeTween(),t=c,i.repeat&&-1===i.repeat()&&(t.repeat(-1),t.yoyo(i.yoyo())),r.tweenChanges()&&!t.tweenTo&&o(2,"WARNING: tweenChanges will only work if the TimelineMax object is available for ScrollMagic."),t&&r.controller()&&r.triggerElement()&&r.loglevel()>=2){var u=e.getTweensOf(r.triggerElement()),h=r.controller().info("vertical");u.forEach((function(t,e){var n=t.vars.css||t.vars;if(h?void 0!==n.top||void 0!==n.bottom:void 0!==n.left||void 0!==n.right)return o(2,"WARNING: Tweening the position of the trigger element affects the scene timing and should be avoided!"),!1}))}if(parseFloat(TweenLite.version)>=1.14)for(var d,f,p=t.getChildren?t.getChildren(!0,!0,!1):[t],m=function(){o(2,"WARNING: tween was overwritten by another. To learn how to avoid this issue see here: https://github.com/janpaepke/ScrollMagic/wiki/WARNING:-tween-was-overwritten-by-another")},g=0;g=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n.setImmediate="function"==typeof e?e:function(t){var e=l++,i=!(arguments.length<2)&&a.call(arguments,1);return s[e]=!0,r((function(){s[e]&&(i?t.apply(null,i):t.call(null),n.clearImmediate(e))})),e},n.clearImmediate="function"==typeof i?i:function(t){delete s[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":39,timers:42}],43:[function(t,e,n){var i,r,o=Object.create(null);"undefined"!=typeof window&&(window.__VUE_HOT_MAP__=o);var a=!1,s="beforeCreate";function l(t,e){if(e.functional){var n=e.render;e.render=function(e,i){var r=o[t].instances;return i&&r.indexOf(i.parent)<0&&r.push(i.parent),n(e,i)}}else c(e,s,(function(){var e=o[t];e.Ctor||(e.Ctor=this.constructor),e.instances.push(this)})),c(e,"beforeDestroy",(function(){var e=o[t].instances;e.splice(e.indexOf(this),1)}))}function c(t,e,n){var i=t[e];t[e]=i?Array.isArray(i)?i.concat(n):[i,n]:[n]}function u(t){return function(e,n){try{t(e,n)}catch(t){}}}function h(t,e){for(var n in t)n in e||delete t[n];for(var i in e)t[i]=e[i]}n.install=function(t,e){a||(a=!0,i=t.__esModule?t.default:t,r=i.version.split(".").map(Number),e,i.config._lifecycleHooks.indexOf("init")>-1&&(s="init"),n.compatible=r[0]>=2,n.compatible)},n.createRecord=function(t,e){if(!o[t]){var n=null;"function"==typeof e&&(e=(n=e).options),l(t,e),o[t]={Ctor:n,options:e,instances:[]}}},n.isRecorded=function(t){return void 0!==o[t]},n.rerender=u((function(t,e){var n=o[t];if(e){if("function"==typeof e&&(e=e.options),n.Ctor)n.Ctor.options.render=e.render,n.Ctor.options.staticRenderFns=e.staticRenderFns,n.instances.slice().forEach((function(t){t.$options.render=e.render,t.$options.staticRenderFns=e.staticRenderFns,t._staticTrees&&(t._staticTrees=[]),Array.isArray(n.Ctor.options.cached)&&(n.Ctor.options.cached=[]),Array.isArray(t.$options.cached)&&(t.$options.cached=[]);var i=function(t){if(!t._u)return;var e=t._u;return t._u=function(t){try{return e(t,!0)}catch(n){return e(t,null,!0)}},function(){t._u=e}}(t);t.$forceUpdate(),t.$nextTick(i)}));else if(n.options.render=e.render,n.options.staticRenderFns=e.staticRenderFns,n.options.functional){if(Object.keys(e).length>2)h(n.options,e);else{var i=n.options._injectStyles;if(i){var r=e.render;n.options.render=function(t,e){return i.call(e),r(t,e)}}}n.options._Ctor=null,Array.isArray(n.options.cached)&&(n.options.cached=[]),n.instances.slice().forEach((function(t){t.$forceUpdate()}))}}else n.instances.slice().forEach((function(t){t.$forceUpdate()}))})),n.reload=u((function(t,e){var n=o[t];if(e)if("function"==typeof e&&(e=e.options),l(t,e),n.Ctor){r[1]<2&&(n.Ctor.extendOptions=e);var i=n.Ctor.super.extend(e);i.options._Ctor=n.options._Ctor,n.Ctor.options=i.options,n.Ctor.cid=i.cid,n.Ctor.prototype=i.prototype,i.release&&i.release()}else h(n.options,e);n.instances.slice().forEach((function(t){t.$vnode&&t.$vnode.context&&t.$vnode.context.$forceUpdate()}))}))},{}],44:[function(t,e,n){!function(t,i){if("object"==typeof n&&"object"==typeof e)e.exports=i();else if("function"==typeof define&&define.amd)define([],i);else{var r=i();for(var o in r)("object"==typeof n?n:t)[o]=r[o]}}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var i={debug:!1,enableLinkTracking:!0,requireConsent:!1,trackInitialView:!0,trackerFileName:"piwik"};function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.assign({},i,e),r=n.host,o=n.trackerFileName;(function(t){var e=new Promise((function(e,n){var i=document.createElement("script");i.async=!0,i.defer=!0,i.src=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i),i.onload=e,i.onerror=n}));return e.catch((function(t){t.target.src})),e})("".concat(r,"/").concat(o,".js")).then((function(){return function(t,e){var n=e.host,i=e.siteId,r=e.trackerFileName,o=e.trackerUrl||"".concat(n,"/").concat(r,".php"),a=window.Piwik.getTracker(o,i);t.prototype.$piwik=a,t.prototype.$matomo=a,e.requireConsent&&a.requireConsent(),e.trackInitialView&&a.trackPageView(),e.enableLinkTracking&&a.enableLinkTracking(),e.router&&e.router.afterEach((function(t,n){var i=window.location,r=i.protocol;":"!==r.slice(-1)&&(r+=":");var o="hash"===e.router.mode?"/#":"",s=r+"//"+i.host+o+t.path;t.meta.analyticsIgnore?e.debug:(e.debug,a.setCustomUrl(s),a.trackPageView())}))}(t,n)}))}}])}))},{}],45:[function(t,e,n){ /*! * vue-resource v1.5.1 * https://github.com/pagekit/vue-resource * Released under the MIT License. */ "use strict";function i(t){this.state=2,this.value=void 0,this.deferred=[];var e=this;try{t((function(t){e.resolve(t)}),(function(t){e.reject(t)}))}catch(t){e.reject(t)}}i.reject=function(t){return new i((function(e,n){n(t)}))},i.resolve=function(t){return new i((function(e,n){e(t)}))},i.all=function(t){return new i((function(e,n){var r=0,o=[];function a(n){return function(i){o[n]=i,(r+=1)===t.length&&e(o)}}0===t.length&&e(o);for(var s=0;s=200&&a<300,this.status=a||0,this.statusText=s||"",this.headers=new L(r),this.body=t,p(t)?this.bodyText=t:(n=t,"undefined"!=typeof Blob&&n instanceof Blob&&(this.bodyBlob=t,function(t){return 0===t.type.indexOf("text")||-1!==t.type.indexOf("json")}(t)&&(this.bodyText=function(t){return new o((function(e){var n=new FileReader;n.readAsText(t),n.onload=function(){e(n.result)}}))}(t))))};B.prototype.blob=function(){return v(this.bodyBlob)},B.prototype.text=function(){return v(this.bodyText)},B.prototype.json=function(){return v(this.text(),(function(t){return JSON.parse(t)}))},Object.defineProperty(B.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var N=function(t){var e;this.body=null,this.params={},b(this,t,{method:(e=t.method||"GET",e?e.toUpperCase():"")}),this.headers instanceof L||(this.headers=new L(this.headers))};N.prototype.getUrl=function(){return A(this)},N.prototype.getBody=function(){return this.body},N.prototype.respondWith=function(t,e){return new B(t,b(e||{},{url:this.getUrl()}))};var $={"Content-Type":"application/json;charset=utf-8"};function j(t){var e=this||{},n=function(t){var e=[R],n=[];function i(i){for(;e.length;){var r=e.pop();if(m(r)){var a=void 0,s=void 0;if(g(a=r.call(t,i,(function(t){return s=t}))||s))return new o((function(e,i){n.forEach((function(e){a=v(a,(function(n){return e.call(t,n)||n}),i)})),v(a,e,i)}),t);m(a)&&n.unshift(a)}}}return g(t)||(t=null),i.use=function(t){e.push(t)},i}(e.$vm);return function(t){var e=c.call(arguments,1);e.forEach((function(e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}))}(t||{},e.$options,j.options),j.interceptors.forEach((function(t){p(t)&&(t=j.interceptor[t]),m(t)&&n.use(t)})),n(new N(t)).then((function(t){return t.ok?t:o.reject(t)}),(function(t){return Error,o.reject(t)}))}function U(t,e,n,i){var r=this||{},o={};return x(n=b({},U.actions,n),(function(n,a){n=w({url:t,params:b({},e)},i,n),o[a]=function(){return(r.$http||j)(V(n,arguments))}})),o}function V(t,e){var n,i=b({},t),r={};switch(e.length){case 2:r=e[0],n=e[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(i.method)?n=e[0]:r=e[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+e.length+" arguments"}return i.body=n,i.params=b({},i.params,r),i}function q(t){q.installed||(!function(t){var e=t.config,n=t.nextTick;s=n,e.debug||!e.silent}(t),t.url=A,t.http=j,t.resource=U,t.Promise=o,Object.defineProperties(t.prototype,{$url:{get:function(){return y(t.url,this,this.$options.url)}},$http:{get:function(){return y(t.http,this,this.$options.http)}},$resource:{get:function(){return t.resource.bind(this)}},$promise:{get:function(){var e=this;return function(n){return new t.Promise(n,e)}}}}))}j.options={},j.headers={put:$,post:$,patch:$,delete:$,common:{Accept:"application/json, text/plain, */*"},custom:{}},j.interceptor={before:function(t){m(t.before)&&t.before.call(this,t)},method:function(t){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST")},jsonp:function(t){"JSONP"==t.method&&(t.client=O)},json:function(t){var e=t.headers.get("Content-Type")||"";return g(t.body)&&0===e.indexOf("application/json")&&(t.body=JSON.stringify(t.body)),function(t){return t.bodyText?v(t.text(),(function(e){var n,i;if(0===(t.headers.get("Content-Type")||"").indexOf("application/json")||(i=(n=e).match(/^\s*(\[|\{)/))&&{"[":/]\s*$/,"{":/}\s*$/}[i[1]].test(n))try{t.body=JSON.parse(e)}catch(e){t.body=null}else t.body=e;return t})):t}},form:function(t){var e;e=t.body,"undefined"!=typeof FormData&&e instanceof FormData?t.headers.delete("Content-Type"):g(t.body)&&t.emulateJSON&&(t.body=A.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded"))},header:function(t){x(b({},j.headers.common,t.crossOrigin?{}:j.headers.custom,j.headers[d(t.method)]),(function(e,n){t.headers.has(n)||t.headers.set(n,e)}))},cors:function(t){if(u){var e=A.parse(location.href),n=A.parse(t.getUrl());n.protocol===e.protocol&&n.host===e.host||(t.crossOrigin=!0,t.emulateHTTP=!1,I||(t.client=P))}}},j.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach((function(t){j[t]=function(e,n){return this(b(n||{},{url:e,method:t}))}})),["post","put","patch"].forEach((function(t){j[t]=function(e,n,i){return this(b(i||{},{url:e,method:t,body:n}))}})),U.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(q),e.exports=q},{got:1}],46:[function(t,e,n){(function(t){(function(){ /*! * vue-router v3.4.8 * (c) 2020 Evan You * @license MIT */ "use strict";function n(t,e){if(!t)throw new Error("[vue-router] "+e)}function i(e,n){t.env.NODE_ENV}function r(t,e){for(var n in e)t[n]=e[n];return t}var o=/[!'()*]/g,a=function(t){return"%"+t.charCodeAt(0).toString(16)},s=/%2C/g,l=function(t){return encodeURIComponent(t).replace(o,a).replace(s,",")};function c(e){try{return decodeURIComponent(e)}catch(e){"production"!==t.env.NODE_ENV&&i()}return e}var u=function(t){return null==t||"object"==typeof t?t:String(t)};function h(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach((function(t){var n=t.replace(/\+/g," ").split("="),i=c(n.shift()),r=n.length>0?c(n.join("=")):null;void 0===e[i]?e[i]=r:Array.isArray(e[i])?e[i].push(r):e[i]=[e[i],r]})),e):e}function d(t){var e=t?Object.keys(t).map((function(e){var n=t[e];if(void 0===n)return"";if(null===n)return l(e);if(Array.isArray(n)){var i=[];return n.forEach((function(t){void 0!==t&&(null===t?i.push(l(e)):i.push(l(e)+"="+l(t)))})),i.join("&")}return l(e)+"="+l(n)})).filter((function(t){return t.length>0})).join("&"):null;return e?"?"+e:""}var f=/\/?$/;function p(t,e,n,i){var r=i&&i.options.stringifyQuery,o=e.query||{};try{o=m(o)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:o,params:e.params||{},fullPath:v(e,r),matched:t?_(t):[]};return n&&(a.redirectedFrom=v(n,r)),Object.freeze(a)}function m(t){if(Array.isArray(t))return t.map(m);if(t&&"object"==typeof t){var e={};for(var n in t)e[n]=m(t[n]);return e}return t}var g=p(null,{path:"/"});function _(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function v(t,e){var n=t.path,i=t.query;void 0===i&&(i={});var r=t.hash;return void 0===r&&(r=""),(n||"/")+(e||d)(i)+r}function y(t,e){return e===g?t===e:!!e&&(t.path&&e.path?t.path.replace(f,"")===e.path.replace(f,"")&&t.hash===e.hash&&x(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&x(t.query,e.query)&&x(t.params,e.params)))}function x(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var n=Object.keys(t).sort(),i=Object.keys(e).sort();return n.length===i.length&&n.every((function(n,r){var o=t[n];if(i[r]!==n)return!1;var a=e[n];return null==o||null==a?o===a:"object"==typeof o&&"object"==typeof a?x(o,a):String(o)===String(a)}))}function b(t){for(var e=0;e=0&&(e=t.slice(i),t=t.slice(0,i));var r=t.indexOf("?");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{path:t,query:n,hash:e}}(s.path||""),p=n&&n.path||"/",m=f.path?C(f.path,p,o||s.append):p,g=function(e,n,r){void 0===n&&(n={});var o,a=r||h;try{o=a(e||"")}catch(e){"production"!==t.env.NODE_ENV&&i(0,e.message),o={}}for(var s in n){var l=n[s];o[s]=Array.isArray(l)?l.map(u):u(l)}return o}(f.query,s.query,a&&a.options.parseQuery),_=s.hash||f.hash;return _&&"#"!==_.charAt(0)&&(_="#"+_),{_normalized:!0,path:m,query:g,hash:_}}var Z,G=function(){},H={name:"RouterLink",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:[String,Array],default:"click"}},render:function(e){var n=this,o=this.$router,a=this.$route,s=o.resolve(this.to,a,this.append),l=s.location,c=s.route,u=s.href,h={},d=o.options.linkActiveClass,m=o.options.linkExactActiveClass,g=null==d?"router-link-active":d,_=null==m?"router-link-exact-active":m,v=null==this.activeClass?g:this.activeClass,x=null==this.exactActiveClass?_:this.exactActiveClass,b=c.redirectedFrom?p(null,q(c.redirectedFrom),null,o):c;h[x]=y(a,b),h[v]=this.exact?h[x]:function(t,e){return 0===t.path.replace(f,"/").indexOf(e.path.replace(f,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(a,b);var w=h[x]?this.ariaCurrentValue:null,T=function(t){X(t)&&(n.replace?o.replace(l,G):o.push(l,G))},C={click:X};Array.isArray(this.event)?this.event.forEach((function(t){C[t]=T})):C[this.event]=T;var S={class:h},k=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:u,route:c,navigate:T,isActive:h[v],isExactActive:h[x]});if(k){if(1===k.length)return k[0];if(k.length>1||!k.length)return"production"!==t.env.NODE_ENV&&i(0,this.to),0===k.length?e():e("span",{},k)}if("a"===this.tag)S.on=C,S.attrs={href:u,"aria-current":w};else{var M=function t(e){var n;if(e)for(var i=0;i0){d.map((function(t){return"- "+t})).join("\n");i()}}return{pathList:s,pathMap:l,nameMap:c}}function J(e,n){var r=M(e,[],n);if("production"!==t.env.NODE_ENV){var o=Object.create(null);r.keys.forEach((function(t){i(o[t.name]),o[t.name]=!0}))}return r}function Q(e,r){var o=K(e),a=o.pathList,s=o.pathMap,l=o.nameMap;function c(e,n,o){var c=q(e,n,!1,r),u=c.name;if(u){var d=l[u];if("production"!==t.env.NODE_ENV&&i(),!d)return h(null,c);var f=d.regex.keys.filter((function(t){return!t.optional})).map((function(t){return t.name}));if("object"!=typeof c.params&&(c.params={}),n&&"object"==typeof n.params)for(var p in n.params)!(p in c.params)&&f.indexOf(p)>-1&&(c.params[p]=n.params[p]);return c.path=V(d.path,c.params),h(d,c,o)}if(c.path){c.params={};for(var m=0;m=t.length?n():t[r]?e(t[r],(function(){i(r+1)})):i(r+1)};i(0)}var bt={redirected:2,aborted:4,cancelled:8,duplicated:16};function wt(t,e){return Ct(t,e,bt.redirected,'Redirected when going from "'+t.fullPath+'" to "'+function(t){if("string"==typeof t)return t;if("path"in t)return t.path;var e={};return St.forEach((function(n){n in t&&(e[n]=t[n])})),JSON.stringify(e,null,2)}(e)+'" via a navigation guard.')}function Tt(t,e){return Ct(t,e,bt.cancelled,'Navigation cancelled from "'+t.fullPath+'" to "'+e.fullPath+'" with a new navigation.')}function Ct(t,e,n,i){var r=new Error(i);return r._isRouter=!0,r.from=t,r.to=e,r.type=n,r}var St=["params","query","hash"];function kt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function Mt(t,e){return kt(t)&&t._isRouter&&(null==e||t.type===e)}function Et(e){return function(n,r,o){var a=!1,s=0,l=null;At(e,(function(e,n,r,c){if("function"==typeof e&&void 0===e.cid){a=!0,s++;var u,h=Ot((function(t){var n;((n=t).__esModule||It&&"Module"===n[Symbol.toStringTag])&&(t=t.default),e.resolved="function"==typeof t?t:Z.extend(t),r.components[c]=t,--s<=0&&o()})),d=Ot((function(e){var n="Failed to resolve async component "+c+": "+e;"production"!==t.env.NODE_ENV&&i(),l||(l=kt(e)?e:new Error(n),o(l))}));try{u=e(h,d)}catch(t){d(t)}if(u)if("function"==typeof u.then)u.then(h,d);else{var f=u.component;f&&"function"==typeof f.then&&f.then(h,d)}}})),a||o()}}function At(t,e){return Pt(t.map((function(t){return Object.keys(t.components).map((function(n){return e(t.components[n],t.instances[n],t,n)}))})))}function Pt(t){return Array.prototype.concat.apply([],t)}var It="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function Ot(t){var e=!1;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(!e)return e=!0,t.apply(this,n)}}var Dt=function(t,e){this.router=t,this.base=function(t){if(!t)if(Y){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=g,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]};function zt(t,e,n,i){var r=At(t,(function(t,i,r,o){var a=function(t,e){"function"!=typeof t&&(t=Z.extend(t));return t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map((function(t){return n(t,i,r,o)})):n(a,i,r,o)}));return Pt(i?r.reverse():r)}function Rt(t,e){if(e)return function(){return t.apply(e,arguments)}}Dt.prototype.listen=function(t){this.cb=t},Dt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Dt.prototype.onError=function(t){this.errorCbs.push(t)},Dt.prototype.transitionTo=function(t,e,n){var i,r=this;try{i=this.router.match(t,this.current)}catch(t){throw this.errorCbs.forEach((function(e){e(t)})),t}var o=this.current;this.confirmTransition(i,(function(){r.updateRoute(i),e&&e(i),r.ensureURL(),r.router.afterHooks.forEach((function(t){t&&t(i,o)})),r.ready||(r.ready=!0,r.readyCbs.forEach((function(t){t(i)})))}),(function(t){n&&n(t),t&&!r.ready&&(Mt(t,bt.redirected)&&o===g||(r.ready=!0,r.readyErrorCbs.forEach((function(e){e(t)}))))}))},Dt.prototype.confirmTransition=function(t,e,n){var r=this,o=this.current;this.pending=t;var a,s,l=function(t){!Mt(t)&&kt(t)&&(r.errorCbs.length?r.errorCbs.forEach((function(e){e(t)})):i()),n&&n(t)},c=t.matched.length-1,u=o.matched.length-1;if(y(t,o)&&c===u&&t.matched[c]===o.matched[u])return this.ensureURL(),l(((s=Ct(a=o,t,bt.duplicated,'Avoided redundant navigation to current location: "'+a.fullPath+'".')).name="NavigationDuplicated",s));var h=function(t,e){var n,i=Math.max(t.length,e.length);for(n=0;n0)){var e=this.router,n=e.options.scrollBehavior,i=_t&&n;i&&this.listeners.push(st());var r=function(){var n=t.current,r=Ft(t.base);t.current===g&&r===t._startLocation||t.transitionTo(r,(function(t){i&<(e,t,n,!0)}))};window.addEventListener("popstate",r),this.listeners.push((function(){window.removeEventListener("popstate",r)}))}},e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,(function(t){vt(S(i.base+t.fullPath)),lt(i.router,t,r,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,(function(t){yt(S(i.base+t.fullPath)),lt(i.router,t,r,!1),e&&e(t)}),n)},e.prototype.ensureURL=function(t){if(Ft(this.base)!==this.current.fullPath){var e=S(this.base+this.current.fullPath);t?vt(e):yt(e)}},e.prototype.getCurrentLocation=function(){return Ft(this.base)},e}(Dt);function Ft(t){var e=window.location.pathname;return t&&0===e.toLowerCase().indexOf(t.toLowerCase())&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var Bt=function(t){function e(e,n,i){t.call(this,e,n),i&&function(t){var e=Ft(t);if(!/^\/#/.test(e))return window.location.replace(S(t+"/#"+e)),!0}(this.base)||Nt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;if(!(this.listeners.length>0)){var e=this.router.options.scrollBehavior,n=_t&&e;n&&this.listeners.push(st());var i=function(){var e=t.current;Nt()&&t.transitionTo($t(),(function(i){n&<(t.router,i,e,!0),_t||Vt(i.fullPath)}))},r=_t?"popstate":"hashchange";window.addEventListener(r,i),this.listeners.push((function(){window.removeEventListener(r,i)}))}},e.prototype.push=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,(function(t){Ut(t.fullPath),lt(i.router,t,r,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,(function(t){Vt(t.fullPath),lt(i.router,t,r,!1),e&&e(t)}),n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;$t()!==e&&(t?Ut(e):Vt(e))},e.prototype.getCurrentLocation=function(){return $t()},e}(Dt);function Nt(){var t=$t();return"/"===t.charAt(0)||(Vt("/"+t),!1)}function $t(){var t=window.location.href,e=t.indexOf("#");return e<0?"":t=t.slice(e+1)}function jt(t){var e=window.location.href,n=e.indexOf("#");return(n>=0?e.slice(0,n):e)+"#"+t}function Ut(t){_t?vt(jt(t)):window.location.hash=t}function Vt(t){_t?yt(jt(t)):window.location.replace(jt(t))}var qt=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var i=this;this.transitionTo(t,(function(t){i.stack=i.stack.slice(0,i.index+1).concat(t),i.index++,e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var i=this;this.transitionTo(t,(function(t){i.stack=i.stack.slice(0,i.index).concat(t),e&&e(t)}),n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var i=this.stack[n];this.confirmTransition(i,(function(){var t=e.current;e.index=n,e.updateRoute(i),e.router.afterHooks.forEach((function(e){e&&e(i,t)}))}),(function(t){Mt(t,bt.duplicated)&&(e.index=n)}))}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Dt),Zt=function(e){void 0===e&&(e={}),this.app=null,this.apps=[],this.options=e,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=Q(e.routes||[],this);var i=e.mode||"hash";switch(this.fallback="history"===i&&!_t&&!1!==e.fallback,this.fallback&&(i="hash"),Y||(i="abstract"),this.mode=i,i){case"history":this.history=new Lt(this,e.base);break;case"hash":this.history=new Bt(this,e.base,this.fallback);break;case"abstract":this.history=new qt(this,e.base);break;default:"production"!==t.env.NODE_ENV&&n(!1,"invalid mode: "+i)}},Gt={currentRoute:{configurable:!0}};function Ht(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}Zt.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},Gt.currentRoute.get=function(){return this.history&&this.history.current},Zt.prototype.init=function(e){var i=this;if("production"!==t.env.NODE_ENV&&n(W.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.apps.push(e),e.$once("hook:destroyed",(function(){var t=i.apps.indexOf(e);t>-1&&i.apps.splice(t,1),i.app===e&&(i.app=i.apps[0]||null),i.app||i.history.teardown()})),!this.app){this.app=e;var r=this.history;if(r instanceof Lt||r instanceof Bt){var o=function(t){r.setupListeners(),function(t){var e=r.current,n=i.options.scrollBehavior;_t&&n&&"fullPath"in t&<(i,t,e,!1)}(t)};r.transitionTo(r.getCurrentLocation(),o,o)}r.listen((function(t){i.apps.forEach((function(e){e._route=t}))}))}},Zt.prototype.beforeEach=function(t){return Ht(this.beforeHooks,t)},Zt.prototype.beforeResolve=function(t){return Ht(this.resolveHooks,t)},Zt.prototype.afterEach=function(t){return Ht(this.afterHooks,t)},Zt.prototype.onReady=function(t,e){this.history.onReady(t,e)},Zt.prototype.onError=function(t){this.history.onError(t)},Zt.prototype.push=function(t,e,n){var i=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){i.history.push(t,e,n)}));this.history.push(t,e,n)},Zt.prototype.replace=function(t,e,n){var i=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){i.history.replace(t,e,n)}));this.history.replace(t,e,n)},Zt.prototype.go=function(t){this.history.go(t)},Zt.prototype.back=function(){this.go(-1)},Zt.prototype.forward=function(){this.go(1)},Zt.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map((function(t){return Object.keys(t.components).map((function(e){return t.components[e]}))}))):[]},Zt.prototype.resolve=function(t,e,n){var i=q(t,e=e||this.history.current,n,this),r=this.match(i,e),o=r.redirectedFrom||r.fullPath;return{location:i,route:r,href:function(t,e,n){var i="hash"===n?"#"+e:e;return t?S(t+"/"+i):i}(this.history.base,o,this.mode),normalizedTo:i,resolved:r}},Zt.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==g&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Zt.prototype,Gt),Zt.install=W,Zt.version="3.4.8",Zt.isNavigationFailure=Mt,Zt.NavigationFailureType=bt,Y&&window.Vue&&window.Vue.use(Zt),e.exports=Zt}).call(this)}).call(this,t("_process"))},{_process:39}],47:[function(t,e,n){(function(t,i){(function(){ /*! * Vue.js v2.6.12 * (c) 2014-2020 Evan You * Released under the MIT License. */ !function(t,i){"object"==typeof n&&void 0!==e?e.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).Vue=i()}(this,(function(){"use strict";var e=Object.freeze({});function n(t){return null==t}function r(t){return null!=t}function o(t){return!0===t}function a(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function s(t){return null!==t&&"object"==typeof t}var l=Object.prototype.toString;function c(t){return"[object Object]"===l.call(t)}function u(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function h(t){return r(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function d(t){return null==t?"":Array.isArray(t)||c(t)&&t.toString===l?JSON.stringify(t,null,2):String(t)}function f(t){var e=parseFloat(t);return isNaN(e)?t:e}function p(t,e){for(var n=Object.create(null),i=t.split(","),r=0;r-1)return t.splice(n,1)}}var v=Object.prototype.hasOwnProperty;function y(t,e){return v.call(t,e)}function x(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var b=/-(\w)/g,w=x((function(t){return t.replace(b,(function(t,e){return e?e.toUpperCase():""}))})),T=x((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),C=/\B([A-Z])/g,S=x((function(t){return t.replace(C,"-$1").toLowerCase()})),k=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var i=arguments.length;return i?i>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function M(t,e){e=e||0;for(var n=t.length-e,i=new Array(n);n--;)i[n]=t[n+e];return i}function E(t,e){for(var n in e)t[n]=e[n];return t}function A(t){for(var e={},n=0;n0,K=X&&X.indexOf("edge/")>0,J=(X&&X.indexOf("android"),X&&/iphone|ipad|ipod|ios/.test(X)||"ios"===H),Q=(X&&/chrome\/\d+/.test(X),X&&/phantomjs/.test(X),X&&X.match(/firefox\/(\d+)/)),tt={}.watch,et=!1;if(Z)try{var nt={};Object.defineProperty(nt,"passive",{get:function(){et=!0}}),window.addEventListener("test-passive",null,nt)}catch(e){}var it=function(){return void 0===U&&(U=!Z&&!G&&void 0!==t&&t.process&&"server"===t.process.env.VUE_ENV),U},rt=Z&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ot(t){return"function"==typeof t&&/native code/.test(t.toString())}var at,st="undefined"!=typeof Symbol&&ot(Symbol)&&"undefined"!=typeof Reflect&&ot(Reflect.ownKeys);at="undefined"!=typeof Set&&ot(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var lt=P,ct=0,ut=function(){this.id=ct++,this.subs=[]};ut.prototype.addSub=function(t){this.subs.push(t)},ut.prototype.removeSub=function(t){_(this.subs,t)},ut.prototype.depend=function(){ut.target&&ut.target.addDep(this)},ut.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;e-1)if(o&&!y(r,"default"))a=!1;else if(""===a||a===S(t)){var l=$t(String,r.type);(l<0||s0&&(ce((l=t(l,(i||"")+"_"+s))[0])&&ce(u)&&(h[c]=_t(u.text+l[0].text),l.shift()),h.push.apply(h,l)):a(l)?ce(u)?h[c]=_t(u.text+l):""!==l&&h.push(_t(l)):ce(l)&&ce(u)?h[c]=_t(u.text+l.text):(o(e._isVList)&&r(l.tag)&&n(l.key)&&r(i)&&(l.key="__vlist"+i+"_"+s+"__"),h.push(l)));return h}(t):void 0}function ce(t){return r(t)&&r(t.text)&&!1===t.isComment}function ue(t,e){if(t){for(var n=Object.create(null),i=st?Reflect.ownKeys(t):Object.keys(t),r=0;r0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&i&&i!==e&&s===i.$key&&!o&&!i.$hasNormal)return i;for(var l in r={},t)t[l]&&"$"!==l[0]&&(r[l]=pe(n,l,t[l]))}else r={};for(var c in n)c in r||(r[c]=me(n,c));return t&&Object.isExtensible(t)&&(t._normalized=r),j(r,"$stable",a),j(r,"$key",s),j(r,"$hasNormal",o),r}function pe(t,e,n){var i=function(){var t=arguments.length?n.apply(null,arguments):n({});return(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:le(t))&&(0===t.length||1===t.length&&t[0].isComment)?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:i,enumerable:!0,configurable:!0}),i}function me(t,e){return function(){return t[e]}}function ge(t,e){var n,i,o,a,l;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),i=0,o=t.length;idocument.createEvent("Event").timeStamp&&(sn=function(){return ln.now()})}function cn(){var t,e;for(an=sn(),rn=!0,Qe.sort((function(t,e){return t.id-e.id})),on=0;onon&&Qe[n].id>t.id;)n--;Qe.splice(n+1,0,t)}else Qe.push(t);nn||(nn=!0,te(cn))}}(this)},hn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||s(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){jt(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},hn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},hn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},hn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||_(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var dn={enumerable:!0,configurable:!0,get:P,set:P};function fn(t,e,n){dn.get=function(){return this[e][n]},dn.set=function(t){this[e][n]=t},Object.defineProperty(t,n,dn)}var pn={lazy:!0};function mn(t,e,n){var i=!it();"function"==typeof n?(dn.get=i?gn(e):_n(n),dn.set=P):(dn.get=n.get?i&&!1!==n.cache?gn(e):_n(n.get):P,dn.set=n.set||P),Object.defineProperty(t,e,dn)}function gn(t){return function(){var e=this._computedWatchers&&this._computedWatchers[t];if(e)return e.dirty&&e.evaluate(),ut.target&&e.depend(),e.value}}function _n(t){return function(){return t.call(this,this)}}function vn(t,e,n,i){return c(n)&&(i=n,n=n.handler),"string"==typeof n&&(n=t[n]),t.$watch(e,n,i)}var yn=0;function xn(t){var e=t.options;if(t.super){var n=xn(t.super);if(n!==t.superOptions){t.superOptions=n;var i=function(t){var e,n=t.options,i=t.sealedOptions;for(var r in n)n[r]!==i[r]&&(e||(e={}),e[r]=n[r]);return e}(t);i&&E(t.extendOptions,i),(e=t.options=Rt(n,t.extendOptions)).name&&(e.components[e.name]=t)}}return e}function bn(t){this._init(t)}function wn(t){return t&&(t.Ctor.options.name||t.tag)}function Tn(t,e){return Array.isArray(t)?t.indexOf(e)>-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===l.call(n)&&t.test(e));var n}function Cn(t,e){var n=t.cache,i=t.keys,r=t._vnode;for(var o in n){var a=n[o];if(a){var s=wn(a.componentOptions);s&&!e(s)&&Sn(n,o,i,r)}}}function Sn(t,e,n,i){var r=t[e];!r||i&&r.tag===i.tag||r.componentInstance.$destroy(),t[e]=null,_(n,e)}!function(t){t.prototype._init=function(t){var n=this;n._uid=yn++,n._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),i=e._parentVnode;n.parent=e.parent,n._parentVnode=i;var r=i.componentOptions;n.propsData=r.propsData,n._parentListeners=r.listeners,n._renderChildren=r.children,n._componentTag=r.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,t):n.$options=Rt(xn(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&He(t,e)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,i=t.$vnode=n._parentVnode,r=i&&i.context;t.$slots=he(n._renderChildren,r),t.$scopedSlots=e,t._c=function(e,n,i,r){return Be(t,e,n,i,r,!1)},t.$createElement=function(e,n,i,r){return Be(t,e,n,i,r,!0)};var o=i&&i.data;kt(t,"$attrs",o&&o.attrs||e,null,!0),kt(t,"$listeners",n._parentListeners||e,null,!0)}(n),Je(n,"beforeCreate"),function(t){var e=ue(t.$options.inject,t);e&&(Tt(!1),Object.keys(e).forEach((function(n){kt(t,n,e[n])})),Tt(!0))}(n),function(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},i=t._props={},r=t.$options._propKeys=[];t.$parent&&Tt(!1);var o=function(o){r.push(o);var a=Ft(o,e,n,t);kt(i,o,a),o in t||fn(t,"_props",o)};for(var a in e)o(a);Tt(!0)}(t,e.props),e.methods&&function(t,e){for(var n in t.$options.props,e)t[n]="function"!=typeof e[n]?P:k(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;c(e=t._data="function"==typeof e?function(t,e){dt();try{return t.call(e,e)}catch(t){return jt(t,e,"data()"),{}}finally{ft()}}(e,t):e||{})||(e={});for(var n,i=Object.keys(e),r=t.$options.props,o=(t.$options.methods,i.length);o--;){var a=i[o];r&&y(r,a)||(void 0,36!==(n=(a+"").charCodeAt(0))&&95!==n&&fn(t,"_data",a))}St(e,!0)}(t):St(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),i=it();for(var r in e){var o=e[r],a="function"==typeof o?o:o.get;i||(n[r]=new hn(t,a||P,P,pn)),r in t||mn(t,r,o)}}(t,e.computed),e.watch&&e.watch!==tt&&function(t,e){for(var n in e){var i=e[n];if(Array.isArray(i))for(var r=0;r1?M(e):e;for(var n=M(arguments,1),i='event handler for "'+t+'"',r=0,o=e.length;rparseInt(this.max)&&Sn(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return N}};Object.defineProperty(t,"config",e),t.util={warn:lt,extend:E,mergeOptions:Rt,defineReactive:kt},t.set=Mt,t.delete=Et,t.nextTick=te,t.observable=function(t){return St(t),t},t.options=Object.create(null),F.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,E(t.options.components,Mn),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=M(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Rt(this.options,t),this}}(t),function(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,i=n.cid,r=t._Ctor||(t._Ctor={});if(r[i])return r[i];var o=t.name||n.options.name,a=function(t){this._init(t)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=e++,a.options=Rt(n.options,t),a.super=n,a.options.props&&function(t){var e=t.options.props;for(var n in e)fn(t.prototype,"_props",n)}(a),a.options.computed&&function(t){var e=t.options.computed;for(var n in e)mn(t.prototype,n,e[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,F.forEach((function(t){a[t]=n[t]})),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=t,a.sealedOptions=E({},a.options),r[i]=a,a}}(t),function(t){F.forEach((function(e){t[e]=function(t,n){return n?("component"===e&&c(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}}))}(t)}(bn),Object.defineProperty(bn.prototype,"$isServer",{get:it}),Object.defineProperty(bn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(bn,"FunctionalRenderContext",{value:Ie}),bn.version="2.6.12";var En=p("style,class"),An=p("input,textarea,option,select,progress"),Pn=function(t,e,n){return"value"===n&&An(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},In=p("contenteditable,draggable,spellcheck"),On=p("events,caret,typing,plaintext-only"),Dn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),zn="http://www.w3.org/1999/xlink",Rn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Ln=function(t){return Rn(t)?t.slice(6,t.length):""},Fn=function(t){return null==t||!1===t};function Bn(t,e){return{staticClass:Nn(t.staticClass,e.staticClass),class:r(t.class)?[t.class,e.class]:e.class}}function Nn(t,e){return t?e?t+" "+e:t:e||""}function $n(t){return Array.isArray(t)?function(t){for(var e,n="",i=0,o=t.length;i-1?hi(t,e,n):Dn(e)?Fn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):In(e)?t.setAttribute(e,function(t,e){return Fn(e)||"false"===e?"false":"contenteditable"===t&&On(e)?e:"true"}(e,n)):Rn(e)?Fn(n)?t.removeAttributeNS(zn,Ln(e)):t.setAttributeNS(zn,e,n):hi(t,e,n)}function hi(t,e,n){if(Fn(n))t.removeAttribute(e);else{if(W&&!Y&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var i=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",i)};t.addEventListener("input",i),t.__ieph=!0}t.setAttribute(e,n)}}var di={create:ci,update:ci};function fi(t,e){var i=e.elm,o=e.data,a=t.data;if(!(n(o.staticClass)&&n(o.class)&&(n(a)||n(a.staticClass)&&n(a.class)))){var s=function(t){for(var e=t.data,n=t,i=t;r(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(e=Bn(i.data,e));for(;r(n=n.parent);)n&&n.data&&(e=Bn(e,n.data));return function(t,e){return r(t)||r(e)?Nn(t,$n(e)):""}(e.staticClass,e.class)}(e),l=i._transitionClasses;r(l)&&(s=Nn(s,$n(l))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var pi,mi,gi,_i,vi,yi,xi={create:fi,update:fi},bi=/[\w).+\-_$\]]/;function wi(t){var e,n,i,r,o,a=!1,s=!1,l=!1,c=!1,u=0,h=0,d=0,f=0;for(i=0;i=0&&" "===(m=t.charAt(p));p--);m&&bi.test(m)||(c=!0)}}else void 0===r?(f=i+1,r=t.slice(0,i).trim()):g();function g(){(o||(o=[])).push(t.slice(f,i).trim()),f=i+1}if(void 0===r?r=t.slice(0,i).trim():0!==f&&g(),o)for(i=0;i-1?{exp:t.slice(0,_i),key:'"'+t.slice(_i+1)+'"'}:{exp:t,key:null};for(mi=t,_i=vi=yi=0;!Ni();)$i(gi=Bi())?Ui(gi):91===gi&&ji(gi);return{exp:t.slice(0,vi),key:t.slice(vi+1,yi)}}(t);return null===n.key?t+"="+e:"$set("+n.exp+", "+n.key+", "+e+")"}function Bi(){return mi.charCodeAt(++_i)}function Ni(){return _i>=pi}function $i(t){return 34===t||39===t}function ji(t){var e=1;for(vi=_i;!Ni();)if($i(t=Bi()))Ui(t);else if(91===t&&e++,93===t&&e--,0===e){yi=_i;break}}function Ui(t){for(var e=t;!Ni()&&(t=Bi())!==e;);}var Vi,qi="__r";function Zi(t,e,n){var i=Vi;return function r(){null!==e.apply(null,arguments)&&Xi(t,r,n,i)}}var Gi=Gt&&!(Q&&Number(Q[1])<=53);function Hi(t,e,n,i){if(Gi){var r=an,o=e;e=o._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=r||t.timeStamp<=0||t.target.ownerDocument!==document)return o.apply(this,arguments)}}Vi.addEventListener(t,e,et?{capture:n,passive:i}:n)}function Xi(t,e,n,i){(i||Vi).removeEventListener(t,e._wrapper||e,n)}function Wi(t,e){if(!n(t.data.on)||!n(e.data.on)){var i=e.data.on||{},o=t.data.on||{};Vi=e.elm,function(t){if(r(t.__r)){var e=W?"change":"input";t[e]=[].concat(t.__r,t[e]||[]),delete t.__r}r(t.__c)&&(t.change=[].concat(t.__c,t.change||[]),delete t.__c)}(i),oe(i,o,Hi,Xi,Zi,e.context),Vi=void 0}}var Yi,Ki={create:Wi,update:Wi};function Ji(t,e){if(!n(t.data.domProps)||!n(e.data.domProps)){var i,o,a=e.elm,s=t.data.domProps||{},l=e.data.domProps||{};for(i in r(l.__ob__)&&(l=e.data.domProps=E({},l)),s)i in l||(a[i]="");for(i in l){if(o=l[i],"textContent"===i||"innerHTML"===i){if(e.children&&(e.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=o;var c=n(o)?"":String(o);Qi(a,c)&&(a.value=c)}else if("innerHTML"===i&&Vn(a.tagName)&&n(a.innerHTML)){(Yi=Yi||document.createElement("div")).innerHTML=""+o+"";for(var u=Yi.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}else if(o!==s[i])try{a[i]=o}catch(t){}}}}function Qi(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var n=t.value,i=t._vModifiers;if(r(i)){if(i.number)return f(n)!==f(e);if(i.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var tr={create:Ji,update:Ji},er=x((function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach((function(t){if(t){var i=t.split(n);i.length>1&&(e[i[0].trim()]=i[1].trim())}})),e}));function nr(t){var e=ir(t.style);return t.staticStyle?E(t.staticStyle,e):e}function ir(t){return Array.isArray(t)?A(t):"string"==typeof t?er(t):t}var rr,or=/^--/,ar=/\s*!important$/,sr=function(t,e,n){if(or.test(e))t.style.setProperty(e,n);else if(ar.test(n))t.style.setProperty(S(e),n.replace(ar,""),"important");else{var i=cr(e);if(Array.isArray(n))for(var r=0,o=n.length;r-1?e.split(dr).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function pr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(dr).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",i=" "+e+" ";n.indexOf(i)>=0;)n=n.replace(i," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function mr(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&E(e,gr(t.name||"v")),E(e,t),e}return"string"==typeof t?gr(t):void 0}}var gr=x((function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}})),_r=Z&&!Y,vr="transition",yr="animation",xr="transition",br="transitionend",wr="animation",Tr="animationend";_r&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(xr="WebkitTransition",br="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(wr="WebkitAnimation",Tr="webkitAnimationEnd"));var Cr=Z?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Sr(t){Cr((function(){Cr(t)}))}function kr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),fr(t,e))}function Mr(t,e){t._transitionClasses&&_(t._transitionClasses,e),pr(t,e)}function Er(t,e,n){var i=Pr(t,e),r=i.type,o=i.timeout,a=i.propCount;if(!r)return n();var s=r===vr?br:Tr,l=0,c=function(){t.removeEventListener(s,u),n()},u=function(e){e.target===t&&++l>=a&&c()};setTimeout((function(){l0&&(n=vr,u=a,h=o.length):e===yr?c>0&&(n=yr,u=c,h=l.length):h=(n=(u=Math.max(a,c))>0?a>c?vr:yr:null)?n===vr?o.length:l.length:0,{type:n,timeout:u,propCount:h,hasTransform:n===vr&&Ar.test(i[xr+"Property"])}}function Ir(t,e){for(;t.length1}function Fr(t,e){!0!==e.data.show&&Dr(e)}var Br=function(t){var e,i,s={},l=t.modules,c=t.nodeOps;for(e=0;ep?y(t,n(i[_+1])?null:i[_+1].elm,i,f,_,o):f>_&&b(e,d,p)}(d,m,_,i,u):r(_)?(r(t.text)&&c.setTextContent(d,""),y(d,null,_,0,_.length-1,i)):r(m)?b(m,0,m.length-1):r(t.text)&&c.setTextContent(d,""):t.text!==e.text&&c.setTextContent(d,e.text),r(p)&&r(f=p.hook)&&r(f=f.postpatch)&&f(t,e)}}}function S(t,e,n){if(o(n)&&r(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i-1,a.selected!==o&&(a.selected=o);else if(D(Vr(a),i))return void(t.selectedIndex!==s&&(t.selectedIndex=s));r||(t.selectedIndex=-1)}}function Ur(t,e){return e.every((function(e){return!D(e,t)}))}function Vr(t){return"_value"in t?t._value:t.value}function qr(t){t.target.composing=!0}function Zr(t){t.target.composing&&(t.target.composing=!1,Gr(t.target,"input"))}function Gr(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function Hr(t){return!t.componentInstance||t.data&&t.data.transition?t:Hr(t.componentInstance._vnode)}var Xr={model:Nr,show:{bind:function(t,e,n){var i=e.value,r=(n=Hr(n)).data&&n.data.transition,o=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;i&&r?(n.data.show=!0,Dr(n,(function(){t.style.display=o}))):t.style.display=i?o:"none"},update:function(t,e,n){var i=e.value;!i!=!e.oldValue&&((n=Hr(n)).data&&n.data.transition?(n.data.show=!0,i?Dr(n,(function(){t.style.display=t.__vOriginalDisplay})):zr(n,(function(){t.style.display="none"}))):t.style.display=i?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,i,r){r||(t.style.display=t.__vOriginalDisplay)}}},Wr={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Yr(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Yr(Ve(e.children)):t}function Kr(t){var e={},n=t.$options;for(var i in n.propsData)e[i]=t[i];var r=n._parentListeners;for(var o in r)e[w(o)]=r[o];return e}function Jr(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var Qr=function(t){return t.tag||Ue(t)},to=function(t){return"show"===t.name},eo={name:"transition",props:Wr,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(Qr)).length){var i=this.mode,r=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return r;var o=Yr(r);if(!o)return r;if(this._leaving)return Jr(t,r);var s="__transition-"+this._uid+"-";o.key=null==o.key?o.isComment?s+"comment":s+o.tag:a(o.key)?0===String(o.key).indexOf(s)?o.key:s+o.key:o.key;var l=(o.data||(o.data={})).transition=Kr(this),c=this._vnode,u=Yr(c);if(o.data.directives&&o.data.directives.some(to)&&(o.data.show=!0),u&&u.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(o,u)&&!Ue(u)&&(!u.componentInstance||!u.componentInstance._vnode.isComment)){var h=u.data.transition=E({},l);if("out-in"===i)return this._leaving=!0,ae(h,"afterLeave",(function(){e._leaving=!1,e.$forceUpdate()})),Jr(t,r);if("in-out"===i){if(Ue(o))return c;var d,f=function(){d()};ae(l,"afterEnter",f),ae(l,"enterCancelled",f),ae(h,"delayLeave",(function(t){d=t}))}}return r}}},no=E({tag:String,moveClass:String},Wr);function io(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function ro(t){t.data.newPos=t.elm.getBoundingClientRect()}function oo(t){var e=t.data.pos,n=t.data.newPos,i=e.left-n.left,r=e.top-n.top;if(i||r){t.data.moved=!0;var o=t.elm.style;o.transform=o.WebkitTransform="translate("+i+"px,"+r+"px)",o.transitionDuration="0s"}}delete no.mode;var ao={Transition:eo,TransitionGroup:{props:no,beforeMount:function(){var t=this,e=this._update;this._update=function(n,i){var r=We(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,r(),e.call(t,n,i)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),i=this.prevChildren=this.children,r=this.$slots.default||[],o=this.children=[],a=Kr(this),s=0;s-1?Gn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Gn[t]=/HTMLUnknownElement/.test(e.toString())},E(bn.options.directives,Xr),E(bn.options.components,ao),bn.prototype.__patch__=Z?Br:P,bn.prototype.$mount=function(t,e){return function(t,e,n){var i;return t.$el=e,t.$options.render||(t.$options.render=gt),Je(t,"beforeMount"),i=function(){t._update(t._render(),n)},new hn(t,i,P,{before:function(){t._isMounted&&!t._isDestroyed&&Je(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,Je(t,"mounted")),t}(this,t=t&&Z?Xn(t):void 0,e)},Z&&setTimeout((function(){N.devtools&&rt&&rt.emit("init",bn)}),0);var so,lo=/\{\{((?:.|\r?\n)+?)\}\}/g,co=/[-.*+?^${}()|[\]\/\\]/g,uo=x((function(t){var e=t[0].replace(co,"\\$&"),n=t[1].replace(co,"\\$&");return new RegExp(e+"((?:.|\\n)+?)"+n,"g")})),ho={staticKeys:["staticClass"],transformNode:function(t,e){e.warn;var n=Di(t,"class");n&&(t.staticClass=JSON.stringify(n));var i=Oi(t,"class",!1);i&&(t.classBinding=i)},genData:function(t){var e="";return t.staticClass&&(e+="staticClass:"+t.staticClass+","),t.classBinding&&(e+="class:"+t.classBinding+","),e}},fo={staticKeys:["staticStyle"],transformNode:function(t,e){e.warn;var n=Di(t,"style");n&&(t.staticStyle=JSON.stringify(er(n)));var i=Oi(t,"style",!1);i&&(t.styleBinding=i)},genData:function(t){var e="";return t.staticStyle&&(e+="staticStyle:"+t.staticStyle+","),t.styleBinding&&(e+="style:("+t.styleBinding+"),"),e}},po=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),mo=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),go=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),_o=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,vo=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,yo="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+$.source+"]*",xo="((?:"+yo+"\\:)?"+yo+")",bo=new RegExp("^<"+xo),wo=/^\s*(\/?)>/,To=new RegExp("^<\\/"+xo+"[^>]*>"),Co=/^]+>/i,So=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Po=/&(?:lt|gt|quot|amp|#39);/g,Io=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Oo=p("pre,textarea",!0),Do=function(t,e){return t&&Oo(t)&&"\n"===e[0]};function zo(t,e){var n=e?Io:Po;return t.replace(n,(function(t){return Ao[t]}))}var Ro,Lo,Fo,Bo,No,$o,jo,Uo,Vo=/^@|^v-on:/,qo=/^v-|^@|^:|^#/,Zo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Go=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Ho=/^\(|\)$/g,Xo=/^\[.*\]$/,Wo=/:(.*)$/,Yo=/^:|^\.|^v-bind:/,Ko=/\.[^.\]]+(?=[^\]]*$)/g,Jo=/^v-slot(:|$)|^#/,Qo=/[\r\n]/,ta=/\s+/g,ea=x((function(t){return(so=so||document.createElement("div")).innerHTML=t,so.textContent})),na="_empty_";function ia(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:ca(e),rawAttrsMap:{},parent:n,children:[]}}function ra(t,e){var n,i;(i=Oi(n=t,"key"))&&(n.key=i),t.plain=!t.key&&!t.scopedSlots&&!t.attrsList.length,function(t){var e=Oi(t,"ref");e&&(t.ref=e,t.refInFor=function(t){for(var e=t;e;){if(void 0!==e.for)return!0;e=e.parent}return!1}(t))}(t),function(t){var e;"template"===t.tag?(e=Di(t,"scope"),t.slotScope=e||Di(t,"slot-scope")):(e=Di(t,"slot-scope"))&&(t.slotScope=e);var n=Oi(t,"slot");if(n&&(t.slotTarget='""'===n?'"default"':n,t.slotTargetDynamic=!(!t.attrsMap[":slot"]&&!t.attrsMap["v-bind:slot"]),"template"===t.tag||t.slotScope||Mi(t,"slot",n,function(t,e){return t.rawAttrsMap[":"+e]||t.rawAttrsMap["v-bind:"+e]||t.rawAttrsMap[e]}(t,"slot"))),"template"===t.tag){var i=zi(t,Jo);if(i){var r=sa(i),o=r.name,a=r.dynamic;t.slotTarget=o,t.slotTargetDynamic=a,t.slotScope=i.value||na}}else{var s=zi(t,Jo);if(s){var l=t.scopedSlots||(t.scopedSlots={}),c=sa(s),u=c.name,h=c.dynamic,d=l[u]=ia("template",[],t);d.slotTarget=u,d.slotTargetDynamic=h,d.children=t.children.filter((function(t){if(!t.slotScope)return t.parent=d,!0})),d.slotScope=s.value||na,t.children=[],t.plain=!1}}}(t),function(t){"slot"===t.tag&&(t.slotName=Oi(t,"name"))}(t),function(t){var e;(e=Oi(t,"is"))&&(t.component=e),null!=Di(t,"inline-template")&&(t.inlineTemplate=!0)}(t);for(var r=0;r-1"+("true"===o?":("+e+")":":_q("+e+","+o+")")),Ii(t,"change","var $$a="+e+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(i?"_n("+r+")":r)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Fi(e,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Fi(e,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Fi(e,"$$c")+"}",null,!0)}(t,i,r);else if("input"===o&&"radio"===a)!function(t,e,n){var i=n&&n.number,r=Oi(t,"value")||"null";ki(t,"checked","_q("+e+","+(r=i?"_n("+r+")":r)+")"),Ii(t,"change",Fi(e,r),null,!0)}(t,i,r);else if("input"===o||"textarea"===o)!function(t,e,n){var i=t.attrsMap.type,r=n||{},o=r.lazy,a=r.number,s=r.trim,l=!o&&"range"!==i,c=o?"change":"range"===i?qi:"input",u="$event.target.value";s&&(u="$event.target.value.trim()"),a&&(u="_n("+u+")");var h=Fi(e,u);l&&(h="if($event.target.composing)return;"+h),ki(t,"value","("+e+")"),Ii(t,c,h,null,!0),(s||a)&&Ii(t,"blur","$forceUpdate()")}(t,i,r);else if(!N.isReservedTag(o))return Li(t,i,r),!1;return!0},text:function(t,e){e.value&&ki(t,"textContent","_s("+e.value+")",e)},html:function(t,e){e.value&&ki(t,"innerHTML","_s("+e.value+")",e)}},isPreTag:function(t){return"pre"===t},isUnaryTag:po,mustUseProp:Pn,canBeLeftOpenTag:mo,isReservedTag:qn,getTagNamespace:Zn,staticKeys:function(t){return t.reduce((function(t,e){return t.concat(e.staticKeys||[])}),[]).join(",")}(ma)},_a=x((function(t){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(t?","+t:""))}));var va=/^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/,ya=/\([^)]*?\);*$/,xa=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,ba={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},wa={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Ta=function(t){return"if("+t+")return null;"},Ca={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Ta("$event.target !== $event.currentTarget"),ctrl:Ta("!$event.ctrlKey"),shift:Ta("!$event.shiftKey"),alt:Ta("!$event.altKey"),meta:Ta("!$event.metaKey"),left:Ta("'button' in $event && $event.button !== 0"),middle:Ta("'button' in $event && $event.button !== 1"),right:Ta("'button' in $event && $event.button !== 2")};function Sa(t,e){var n=e?"nativeOn:":"on:",i="",r="";for(var o in t){var a=ka(t[o]);t[o]&&t[o].dynamic?r+=o+","+a+",":i+='"'+o+'":'+a+","}return i="{"+i.slice(0,-1)+"}",r?n+"_d("+i+",["+r.slice(0,-1)+"])":n+i}function ka(t){if(!t)return"function(){}";if(Array.isArray(t))return"["+t.map((function(t){return ka(t)})).join(",")+"]";var e=xa.test(t.value),n=va.test(t.value),i=xa.test(t.value.replace(ya,""));if(t.modifiers){var r="",o="",a=[];for(var s in t.modifiers)if(Ca[s])o+=Ca[s],ba[s]&&a.push(s);else if("exact"===s){var l=t.modifiers;o+=Ta(["ctrl","shift","alt","meta"].filter((function(t){return!l[t]})).map((function(t){return"$event."+t+"Key"})).join("||"))}else a.push(s);return a.length&&(r+=function(t){return"if(!$event.type.indexOf('key')&&"+t.map(Ma).join("&&")+")return null;"}(a)),o&&(r+=o),"function($event){"+r+(e?"return "+t.value+"($event)":n?"return ("+t.value+")($event)":i?"return "+t.value:t.value)+"}"}return e||n?t.value:"function($event){"+(i?"return "+t.value:t.value)+"}"}function Ma(t){var e=parseInt(t,10);if(e)return"$event.keyCode!=="+e;var n=ba[t],i=wa[t];return"_k($event.keyCode,"+JSON.stringify(t)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(i)+")"}var Ea={on:function(t,e){t.wrapListeners=function(t){return"_g("+t+","+e.value+")"}},bind:function(t,e){t.wrapData=function(n){return"_b("+n+",'"+t.tag+"',"+e.value+","+(e.modifiers&&e.modifiers.prop?"true":"false")+(e.modifiers&&e.modifiers.sync?",true":"")+")"}},cloak:P},Aa=function(t){this.options=t,this.warn=t.warn||Ci,this.transforms=Si(t.modules,"transformCode"),this.dataGenFns=Si(t.modules,"genData"),this.directives=E(E({},Ea),t.directives);var e=t.isReservedTag||I;this.maybeComponent=function(t){return!!t.component||!e(t.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Pa(t,e){var n=new Aa(e);return{render:"with(this){return "+(t?Ia(t,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ia(t,e){if(t.parent&&(t.pre=t.pre||t.parent.pre),t.staticRoot&&!t.staticProcessed)return Oa(t,e);if(t.once&&!t.onceProcessed)return Da(t,e);if(t.for&&!t.forProcessed)return Ra(t,e);if(t.if&&!t.ifProcessed)return za(t,e);if("template"!==t.tag||t.slotTarget||e.pre){if("slot"===t.tag)return function(t,e){var n=t.slotName||'"default"',i=Na(t,e),r="_t("+n+(i?","+i:""),o=t.attrs||t.dynamicAttrs?Ua((t.attrs||[]).concat(t.dynamicAttrs||[]).map((function(t){return{name:w(t.name),value:t.value,dynamic:t.dynamic}}))):null,a=t.attrsMap["v-bind"];return!o&&!a||i||(r+=",null"),o&&(r+=","+o),a&&(r+=(o?"":",null")+","+a),r+")"}(t,e);var n;if(t.component)n=function(t,e,n){var i=e.inlineTemplate?null:Na(e,n,!0);return"_c("+t+","+La(e,n)+(i?","+i:"")+")"}(t.component,t,e);else{var i;(!t.plain||t.pre&&e.maybeComponent(t))&&(i=La(t,e));var r=t.inlineTemplate?null:Na(t,e,!0);n="_c('"+t.tag+"'"+(i?","+i:"")+(r?","+r:"")+")"}for(var o=0;o>>0}(a):"")+")"}(t,t.scopedSlots,e)+","),t.model&&(n+="model:{value:"+t.model.value+",callback:"+t.model.callback+",expression:"+t.model.expression+"},"),t.inlineTemplate){var o=function(t,e){var n=t.children[0];if(n&&1===n.type){var i=Pa(n,e.options);return"inlineTemplate:{render:function(){"+i.render+"},staticRenderFns:["+i.staticRenderFns.map((function(t){return"function(){"+t+"}"})).join(",")+"]}"}}(t,e);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",t.dynamicAttrs&&(n="_b("+n+',"'+t.tag+'",'+Ua(t.dynamicAttrs)+")"),t.wrapData&&(n=t.wrapData(n)),t.wrapListeners&&(n=t.wrapListeners(n)),n}function Fa(t){return 1===t.type&&("slot"===t.tag||t.children.some(Fa))}function Ba(t,e){var n=t.attrsMap["slot-scope"];if(t.if&&!t.ifProcessed&&!n)return za(t,e,Ba,"null");if(t.for&&!t.forProcessed)return Ra(t,e,Ba);var i=t.slotScope===na?"":String(t.slotScope),r="function("+i+"){return "+("template"===t.tag?t.if&&n?"("+t.if+")?"+(Na(t,e)||"undefined")+":undefined":Na(t,e)||"undefined":Ia(t,e))+"}",o=i?"":",proxy:true";return"{key:"+(t.slotTarget||'"default"')+",fn:"+r+o+"}"}function Na(t,e,n,i,r){var o=t.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?e.maybeComponent(a)?",1":",0":"";return""+(i||Ia)(a,e)+s}var l=n?function(t,e){for(var n=0,i=0;i]*>)","i")),d=t.replace(h,(function(t,n,i){return c=i.length,Mo(u)||"noscript"===u||(n=n.replace(//g,"$1").replace(//g,"$1")),Do(u,n)&&(n=n.slice(1)),e.chars&&e.chars(n),""}));l+=t.length-d.length,t=d,k(u,l-c,l)}else{var f=t.indexOf("<");if(0===f){if(So.test(t)){var p=t.indexOf("--\x3e");if(p>=0){e.shouldKeepComment&&e.comment(t.substring(4,p),l,l+p+3),T(p+3);continue}}if(ko.test(t)){var m=t.indexOf("]>");if(m>=0){T(m+2);continue}}var g=t.match(Co);if(g){T(g[0].length);continue}var _=t.match(To);if(_){var v=l;T(_[0].length),k(_[1],v,l);continue}var y=C();if(y){S(y),Do(y.tagName,t)&&T(1);continue}}var x=void 0,b=void 0,w=void 0;if(f>=0){for(b=t.slice(f);!(To.test(b)||bo.test(b)||So.test(b)||ko.test(b)||(w=b.indexOf("<",1))<0);)f+=w,b=t.slice(f);x=t.substring(0,f)}f<0&&(x=t),x&&T(x.length),e.chars&&x&&e.chars(x,l-x.length,l)}if(t===n){e.chars&&e.chars(t);break}}function T(e){l+=e,t=t.substring(e)}function C(){var e=t.match(bo);if(e){var n,i,r={tagName:e[1],attrs:[],start:l};for(T(e[0].length);!(n=t.match(wo))&&(i=t.match(vo)||t.match(_o));)i.start=l,T(i[0].length),i.end=l,r.attrs.push(i);if(n)return r.unarySlash=n[1],T(n[0].length),r.end=l,r}}function S(t){var n=t.tagName,l=t.unarySlash;o&&("p"===i&&go(n)&&k(i),s(n)&&i===n&&k(n));for(var c=a(n)||!!l,u=t.attrs.length,h=new Array(u),d=0;d=0&&r[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var c=r.length-1;c>=a;c--)e.end&&e.end(r[c].tag,n,o);r.length=a,i=a&&r[a-1].tag}else"br"===s?e.start&&e.start(t,[],!0,n,o):"p"===s&&(e.start&&e.start(t,[],!1,n,o),e.end&&e.end(t,n,o))}k()}(t,{warn:Ro,expectHTML:e.expectHTML,isUnaryTag:e.isUnaryTag,canBeLeftOpenTag:e.canBeLeftOpenTag,shouldDecodeNewlines:e.shouldDecodeNewlines,shouldDecodeNewlinesForHref:e.shouldDecodeNewlinesForHref,shouldKeepComment:e.comments,outputSourceRange:e.outputSourceRange,start:function(t,o,a,u,h){var d=i&&i.ns||Uo(t);W&&"svg"===d&&(o=function(t){for(var e=[],n=0;nl&&(s.push(o=t.slice(l,r)),a.push(JSON.stringify(o)));var c=wi(i[1].trim());a.push("_s("+c+")"),s.push({"@binding":c}),l=r+i[0].length}return l':'
',Ha.innerHTML.indexOf(" ")>0}var Ka=!!Z&&Ya(!1),Ja=!!Z&&Ya(!0),Qa=x((function(t){var e=Xn(t);return e&&e.innerHTML})),ts=bn.prototype.$mount;return bn.prototype.$mount=function(t,e){if((t=t&&Xn(t))===document.body||t===document.documentElement)return this;var n=this.$options;if(!n.render){var i=n.template;if(i)if("string"==typeof i)"#"===i.charAt(0)&&(i=Qa(i));else{if(!i.nodeType)return this;i=i.innerHTML}else t&&(i=function(t){if(t.outerHTML)return t.outerHTML;var e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML}(t));if(i){var r=Wa(i,{outputSourceRange:!1,shouldDecodeNewlines:Ka,shouldDecodeNewlinesForHref:Ja,delimiters:n.delimiters,comments:n.comments},this),o=r.render,a=r.staticRenderFns;n.render=o,n.staticRenderFns=a}}return ts.call(this,t,e)},bn.compile=Wa,bn}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{timers:42}],48:[function(t,e,n){(function(t,n){(function(){ /*! * Vue.js v2.6.12 * (c) 2014-2020 Evan You * Released under the MIT License. */ "use strict";var i=Object.freeze({});function r(t){return null==t}function o(t){return null!=t}function a(t){return!0===t}function s(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function l(t){return null!==t&&"object"==typeof t}var c=Object.prototype.toString;function u(t){return c.call(t).slice(8,-1)}function h(t){return"[object Object]"===c.call(t)}function d(t){return"[object RegExp]"===c.call(t)}function f(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function p(t){return o(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function m(t){return null==t?"":Array.isArray(t)||h(t)&&t.toString===c?JSON.stringify(t,null,2):String(t)}function g(t){var e=parseFloat(t);return isNaN(e)?t:e}function _(t,e){for(var n=Object.create(null),i=t.split(","),r=0;r-1)return t.splice(n,1)}}var b=Object.prototype.hasOwnProperty;function w(t,e){return b.call(t,e)}function T(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var C=/-(\w)/g,S=T((function(t){return t.replace(C,(function(t,e){return e?e.toUpperCase():""}))})),k=T((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),M=/\B([A-Z])/g,E=T((function(t){return t.replace(M,"-$1").toLowerCase()}));var A=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var i=arguments.length;return i?i>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function P(t,e){e=e||0;for(var n=t.length-e,i=new Array(n);n--;)i[n]=t[n+e];return i}function I(t,e){for(var n in e)t[n]=e[n];return t}function O(t){for(var e={},n=0;n0,tt=K&&K.indexOf("edge/")>0,et=(K&&K.indexOf("android"),K&&/iphone|ipad|ipod|ios/.test(K)||"ios"===Y),nt=(K&&/chrome\/\d+/.test(K),K&&/phantomjs/.test(K),K&&K.match(/firefox\/(\d+)/)),it={}.watch,rt=!1;if(X)try{var ot={};Object.defineProperty(ot,"passive",{get:function(){rt=!0}}),window.addEventListener("test-passive",null,ot)}catch(t){}var at=function(){return void 0===G&&(G=!X&&!W&&void 0!==t&&(t.process&&"server"===t.process.env.VUE_ENV)),G},st=X&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function lt(t){return"function"==typeof t&&/native code/.test(t.toString())}var ct,ut="undefined"!=typeof Symbol&<(Symbol)&&"undefined"!=typeof Reflect&<(Reflect.ownKeys);ct="undefined"!=typeof Set&<(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var ht,dt,ft,pt=D,mt="undefined"!=typeof console,gt=/(?:^|[-_])(\w)/g;ht=function(t,e){var n=e?pt(e):"";j.warnHandler?j.warnHandler.call(null,t,e,n):mt&&j.silent},dt=function(t,e){mt&&j.silent},ft=function(t,e){if(t.$root===t)return"";var n="function"==typeof t&&null!=t.cid?t.options:t._isVue?t.$options||t.constructor.options:t,i=n.name||n._componentTag,r=n.__file;if(!i&&r){var o=r.match(/([^/\\]+)\.vue$/);i=o&&o[1]}return(i?"<"+(i.replace(gt,(function(t){return t.toUpperCase()})).replace(/[-_]/g,"")+">"):"")+(r&&!1!==e?" at "+r:"")};pt=function(t){if(t._isVue&&t.$parent){for(var e=[],n=0;t;){if(e.length>0){var i=e[e.length-1];if(i.constructor===t.constructor){n++,t=t.$parent;continue}n>0&&(e[e.length-1]=[i,n],n=0)}e.push(t),t=t.$parent}return"\n\nfound in\n\n"+e.map((function(t,e){return""+(0===e?"---\x3e ":function(t,e){for(var n="";e;)e%2==1&&(n+=t),e>1&&(t+=t),e>>=1;return n}(" ",5+2*e))+(Array.isArray(t)?ft(t[0])+"... ("+t[1]+" recursive calls)":ft(t))})).join("\n")}return"\n\n(found in "+ft(t)+")"};var _t=0,vt=function(){this.id=_t++,this.subs=[]};vt.prototype.addSub=function(t){this.subs.push(t)},vt.prototype.removeSub=function(t){x(this.subs,t)},vt.prototype.depend=function(){vt.target&&vt.target.addDep(this)},vt.prototype.notify=function(){var t=this.subs.slice();j.async||t.sort((function(t,e){return t.id-e.id}));for(var e=0,n=t.length;e-1)if(o&&!w(r,"default"))a=!1;else if(""===a||a===E(t)){var c=Qt(String,r.type);(c<0||s0&&(Re((l=t(l,(n||"")+"_"+i))[0])&&Re(u)&&(h[c]=St(u.text+l[0].text),l.shift()),h.push.apply(h,l)):s(l)?Re(u)?h[c]=St(u.text+l):""!==l&&h.push(St(l)):Re(l)&&Re(u)?h[c]=St(u.text+l.text):(a(e._isVList)&&o(l.tag)&&r(l.key)&&o(n)&&(l.key="__vlist"+n+"_"+i+"__"),h.push(l)));return h}(t):void 0}function Re(t){return o(t)&&o(t.text)&&!1===t.isComment}function Le(t,e){if(t){for(var n=Object.create(null),i=ut?Reflect.ownKeys(t):Object.keys(t),r=0;r0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&n&&n!==i&&s===n.$key&&!o&&!n.$hasNormal)return n;for(var l in r={},t)t[l]&&"$"!==l[0]&&(r[l]=$e(e,l,t[l]))}else r={};for(var c in e)c in r||(r[c]=je(e,c));return t&&Object.isExtensible(t)&&(t._normalized=r),q(r,"$stable",a),q(r,"$key",s),q(r,"$hasNormal",o),r}function $e(t,e,n){var i=function(){var t=arguments.length?n.apply(null,arguments):n({});return(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:ze(t))&&(0===t.length||1===t.length&&t[0].isComment)?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:i,enumerable:!0,configurable:!0}),i}function je(t,e){return function(){return t[e]}}function Ue(t,e){var n,i,r,a,s;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),i=0,r=t.length;i.",t),u=new wt(j.parsePlatformTagName(e),n,i,void 0,void 0,t)):u=n&&n.pre||!o(d=Ht(t.$options,"components",e))?new wt(e,n,i,void 0,void 0,t):cn(d,n,t,i,e)}else u=cn(e,n,t,i);return Array.isArray(u)?u:o(u)?(o(h)&&function t(e,n,i){e.ns=n,"foreignObject"===e.tag&&(n=void 0,i=!0);if(o(e.children))for(var s=0,l=e.children.length;sdocument.createEvent("Event").timeStamp&&(Rn=function(){return Ln.now()})}function Fn(){var t,e;for(zn=Rn(),On=!0,Mn.sort((function(t,e){return t.id-e.id})),Dn=0;Dn100)){ht("You may have an infinite update loop "+(t.user?'in watcher with expression "'+t.expression+'"':"in a component render function."),t.vm);break}var n=En.slice(),i=Mn.slice();Dn=Mn.length=En.length=0,An={},Pn={},In=On=!1,function(t){for(var e=0;eDn&&Mn[n].id>t.id;)n--;Mn.splice(n+1,0,t)}else Mn.push(t);if(!In){if(In=!0,!j.async)return void Fn();ge(Fn)}}}(this)},Nn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||l(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){ne(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},Nn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Nn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},Nn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||x(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var $n={enumerable:!0,configurable:!0,get:D,set:D};function jn(t,e,n){$n.get=function(){return this[e][n]},$n.set=function(t){this[e][n]=t},Object.defineProperty(t,n,$n)}function Un(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},i=t._props={},r=t.$options._propKeys=[],o=!t.$parent;o||It(!1);var a=function(a){r.push(a);var s=Xt(a,e,n,t),l=E(a);(y(l)||j.isReservedAttr(l))&&ht('"'+l+'" is a reserved attribute and cannot be used as component prop.',t),zt(i,a,s,(function(){o||wn||ht("Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: \""+a+'"',t)})),a in t||jn(t,"_props",a)};for(var s in e)a(s);It(!0)}(t,e.props),e.methods&&function(t,e){var n=t.$options.props;for(var i in e)"function"!=typeof e[i]&&ht('Method "'+i+'" has type "'+typeof e[i]+'" in the component definition. Did you reference the function correctly?',t),n&&w(n,i)&&ht('Method "'+i+'" has already been defined as a prop.',t),i in t&&V(i)&&ht('Method "'+i+'" conflicts with an existing Vue instance method. Avoid defining component methods that start with _ or $.'),t[i]="function"!=typeof e[i]?D:A(e[i],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;h(e=t._data="function"==typeof e?function(t,e){xt();try{return t.call(e,e)}catch(t){return ne(t,e,"data()"),{}}finally{bt()}}(e,t):e||{})||(e={},ht("data functions should return an object:\nhttps://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",t));var n=Object.keys(e),i=t.$options.props,r=t.$options.methods,o=n.length;for(;o--;){var a=n[o];r&&w(r,a)&&ht('Method "'+a+'" has already been defined as a data property.',t),i&&w(i,a)?ht('The data property "'+a+'" is already declared as a prop. Use prop default value instead.',t):V(a)||jn(t,"_data",a)}Dt(e,!0)}(t):Dt(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),i=at();for(var r in e){var o=e[r],a="function"==typeof o?o:o.get;null==a&&ht('Getter is missing for computed property "'+r+'".',t),i||(n[r]=new Nn(t,a||D,D,Vn)),r in t?r in t.$data?ht('The computed property "'+r+'" is already defined in data.',t):t.$options.props&&r in t.$options.props&&ht('The computed property "'+r+'" is already defined as a prop.',t):qn(t,r,o)}}(t,e.computed),e.watch&&e.watch!==it&&function(t,e){for(var n in e){var i=e[n];if(Array.isArray(i))for(var r=0;r-1:"string"==typeof t?t.split(",").indexOf(e)>-1:!!d(t)&&t.test(e)}function ti(t,e){var n=t.cache,i=t.keys,r=t._vnode;for(var o in n){var a=n[o];if(a){var s=Jn(a.componentOptions);s&&!e(s)&&ei(n,o,i,r)}}}function ei(t,e,n,i){var r=t[e];!r||i&&r.tag===i.tag||r.componentInstance.$destroy(),t[e]=null,x(n,e)}!function(t){t.prototype._init=function(t){var e,n,r=this;r._uid=Xn++,j.performance&&Ce&&(e="vue-perf-start:"+r._uid,n="vue-perf-end:"+r._uid,Ce(e)),r._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),i=e._parentVnode;n.parent=e.parent,n._parentVnode=i;var r=i.componentOptions;n.propsData=r.propsData,n._parentListeners=r.listeners,n._renderChildren=r.children,n._componentTag=r.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(r,t):r.$options=Gt(Wn(r.constructor),t||{},r),se(r),r._self=r,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(r),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&xn(t,e)}(r),function(t){t._vnode=null,t._staticTrees=null;var e=t.$options,n=t.$vnode=e._parentVnode,r=n&&n.context;t.$slots=Fe(e._renderChildren,r),t.$scopedSlots=i,t._c=function(e,n,i,r){return hn(t,e,n,i,r,!1)},t.$createElement=function(e,n,i,r){return hn(t,e,n,i,r,!0)};var o=n&&n.data;zt(t,"$attrs",o&&o.attrs||i,(function(){!wn&&ht("$attrs is readonly.",t)}),!0),zt(t,"$listeners",e._parentListeners||i,(function(){!wn&&ht("$listeners is readonly.",t)}),!0)}(r),kn(r,"beforeCreate"),function(t){var e=Le(t.$options.inject,t);e&&(It(!1),Object.keys(e).forEach((function(n){zt(t,n,e[n],(function(){ht('Avoid mutating an injected value directly since the changes will be overwritten whenever the provided component re-renders. injection being mutated: "'+n+'"',t)}))})),It(!0))}(r),Un(r),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(r),kn(r,"created"),j.performance&&Ce&&(r._name=ft(r,!1),Ce(n),Se("vue "+r._name+" init",e,n)),r.$options.el&&r.$mount(r.$options.el)}}(Yn),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};e.set=function(){ht("Avoid replacing instance root $data. Use nested data properties instead.",this)},n.set=function(){ht("$props is readonly.",this)},Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=Rt,t.prototype.$delete=Lt,t.prototype.$watch=function(t,e,n){if(h(e))return Hn(this,t,e,n);(n=n||{}).user=!0;var i=new Nn(this,t,e,n);if(n.immediate)try{e.call(this,i.value)}catch(t){ne(t,this,'callback for immediate watcher "'+i.expression+'"')}return function(){i.teardown()}}}(Yn),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var i=this;if(Array.isArray(t))for(var r=0,o=t.length;r1?P(i):i;for(var r=P(arguments,1),o='event handler for "'+t+'"',a=0,s=i.length;aparseInt(this.max)&&ei(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return j},set:function(){ht("Do not replace the Vue.config object, set individual fields instead.")}};Object.defineProperty(t,"config",e),t.util={warn:ht,extend:I,mergeOptions:Gt,defineReactive:zt},t.set=Rt,t.delete=Lt,t.nextTick=ge,t.observable=function(t){return Dt(t),t},t.options=Object.create(null),N.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,I(t.options.components,ii),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=P(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Gt(this.options,t),this}}(t),Kn(t),function(t){N.forEach((function(e){t[e]=function(t,n){return n?("component"===e&&qt(t),"component"===e&&h(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}}))}(t)}(Yn),Object.defineProperty(Yn.prototype,"$isServer",{get:at}),Object.defineProperty(Yn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Yn,"FunctionalRenderContext",{value:rn}),Yn.version="2.6.12";var ri=_("style,class"),oi=_("input,textarea,option,select,progress"),ai=_("contenteditable,draggable,spellcheck"),si=_("events,caret,typing,plaintext-only"),li=_("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),ci="http://www.w3.org/1999/xlink",ui=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},hi=function(t){return ui(t)?t.slice(6,t.length):""},di=function(t){return null==t||!1===t};function fi(t){for(var e=t.data,n=t,i=t;o(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(e=pi(i.data,e));for(;o(n=n.parent);)n&&n.data&&(e=pi(e,n.data));return function(t,e){if(o(t)||o(e))return mi(t,gi(e));return""}(e.staticClass,e.class)}function pi(t,e){return{staticClass:mi(t.staticClass,e.staticClass),class:o(t.class)?[t.class,e.class]:e.class}}function mi(t,e){return t?e?t+" "+e:t:e||""}function gi(t){return Array.isArray(t)?function(t){for(var e,n="",i=0,r=t.length;i-1?Ni(t,e,n):li(e)?di(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):ai(e)?t.setAttribute(e,function(t,e){return di(e)||"false"===e?"false":"contenteditable"===t&&si(e)?e:"true"}(e,n)):ui(e)?di(n)?t.removeAttributeNS(ci,hi(e)):t.setAttributeNS(ci,e,n):Ni(t,e,n)}function Ni(t,e,n){if(di(n))t.removeAttribute(e);else{if(J&&!Q&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var i=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",i)};t.addEventListener("input",i),t.__ieph=!0}t.setAttribute(e,n)}}var $i={create:Fi,update:Fi};function ji(t,e){var n=e.elm,i=e.data,a=t.data;if(!(r(i.staticClass)&&r(i.class)&&(r(a)||r(a.staticClass)&&r(a.class)))){var s=fi(e),l=n._transitionClasses;o(l)&&(s=mi(s,gi(l))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var Ui,Vi={create:ji,update:ji};function qi(t,e,n){var i=Ui;return function r(){var o=e.apply(null,arguments);null!==o&&Hi(t,r,n,i)}}var Zi=le&&!(nt&&Number(nt[1])<=53);function Gi(t,e,n,i){if(Zi){var r=zn,o=e;e=o._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=r||t.timeStamp<=0||t.target.ownerDocument!==document)return o.apply(this,arguments)}}Ui.addEventListener(t,e,rt?{capture:n,passive:i}:n)}function Hi(t,e,n,i){(i||Ui).removeEventListener(t,e._wrapper||e,n)}function Xi(t,e){if(!r(t.data.on)||!r(e.data.on)){var n=e.data.on||{},i=t.data.on||{};Ui=e.elm,function(t){if(o(t.__r)){var e=J?"change":"input";t[e]=[].concat(t.__r,t[e]||[]),delete t.__r}o(t.__c)&&(t.change=[].concat(t.__c,t.change||[]),delete t.__c)}(n),Ie(n,i,Gi,Hi,qi,e.context),Ui=void 0}}var Wi,Yi={create:Xi,update:Xi};function Ki(t,e){if(!r(t.data.domProps)||!r(e.data.domProps)){var n,i,a=e.elm,s=t.data.domProps||{},l=e.data.domProps||{};for(n in o(l.__ob__)&&(l=e.data.domProps=I({},l)),s)n in l||(a[n]="");for(n in l){if(i=l[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),i===s[n])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===n&&"PROGRESS"!==a.tagName){a._value=i;var c=r(i)?"":String(i);Ji(a,c)&&(a.value=c)}else if("innerHTML"===n&&yi(a.tagName)&&r(a.innerHTML)){(Wi=Wi||document.createElement("div")).innerHTML=""+i+"";for(var u=Wi.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}else if(i!==s[n])try{a[n]=i}catch(t){}}}}function Ji(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var n=t.value,i=t._vModifiers;if(o(i)){if(i.number)return g(n)!==g(e);if(i.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var Qi={create:Ki,update:Ki},tr=T((function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach((function(t){if(t){var i=t.split(n);i.length>1&&(e[i[0].trim()]=i[1].trim())}})),e}));function er(t){var e=nr(t.style);return t.staticStyle?I(t.staticStyle,e):e}function nr(t){return Array.isArray(t)?O(t):"string"==typeof t?tr(t):t}var ir,rr=/^--/,or=/\s*!important$/,ar=function(t,e,n){if(rr.test(e))t.style.setProperty(e,n);else if(or.test(n))t.style.setProperty(E(e),n.replace(or,""),"important");else{var i=lr(e);if(Array.isArray(n))for(var r=0,o=n.length;r-1?e.split(hr).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function fr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(hr).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",i=" "+e+" ";n.indexOf(i)>=0;)n=n.replace(i," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function pr(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&I(e,mr(t.name||"v")),I(e,t),e}return"string"==typeof t?mr(t):void 0}}var mr=T((function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}})),gr=X&&!Q,_r="transition",vr="transitionend",yr="animation",xr="animationend";gr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(_r="WebkitTransition",vr="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(yr="WebkitAnimation",xr="webkitAnimationEnd"));var br=X?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function wr(t){br((function(){br(t)}))}function Tr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),dr(t,e))}function Cr(t,e){t._transitionClasses&&x(t._transitionClasses,e),fr(t,e)}function Sr(t,e,n){var i=Mr(t,e),r=i.type,o=i.timeout,a=i.propCount;if(!r)return n();var s="transition"===r?vr:xr,l=0,c=function(){t.removeEventListener(s,u),n()},u=function(e){e.target===t&&++l>=a&&c()};setTimeout((function(){l0&&(n="transition",u=a,h=o.length):"animation"===e?c>0&&(n="animation",u=c,h=l.length):h=(n=(u=Math.max(a,c))>0?a>c?"transition":"animation":null)?"transition"===n?o.length:l.length:0,{type:n,timeout:u,propCount:h,hasTransform:"transition"===n&&kr.test(i[_r+"Property"])}}function Er(t,e){for(;t.length explicit "+e+" duration is not a valid number - got "+JSON.stringify(t)+".",n.context):isNaN(t)&&ht(" explicit "+e+" duration is NaN - the duration expression might be incorrect.",n.context)}function Dr(t){return"number"==typeof t&&!isNaN(t)}function zr(t){if(r(t))return!1;var e=t.fns;return o(e)?zr(Array.isArray(e)?e[0]:e):(t._length||t.length)>1}function Rr(t,e){!0!==e.data.show&&Pr(e)}var Lr=function(t){var e,n,i={},l=t.modules,c=t.nodeOps;for(e=0;e - did you register the component correctly? For recursive components, make sure to provide the "name" option.',t.context),t.elm=t.ns?c.createElementNS(t.ns,_):c.createElement(_,t),b(t),v(t,p,e),o(d)&&x(t,e),g(n,t.elm,r),d&&d.pre&&f--):a(t.isComment)?(t.elm=c.createComment(t.text),g(n,t.elm,r)):(t.elm=c.createTextNode(t.text),g(n,t.elm,r))}}function m(t,e){o(t.data.pendingInsert)&&(e.push.apply(e,t.data.pendingInsert),t.data.pendingInsert=null),t.elm=t.componentInstance.$el,y(t)?(x(t,e),b(t)):(Si(t),e.push(t))}function g(t,e,n){o(t)&&(o(n)?c.parentNode(n)===t&&c.insertBefore(t,e,n):c.appendChild(t,e))}function v(t,e,n){if(Array.isArray(e)){k(e);for(var i=0;if?w(t,r(n[_+1])?null:n[_+1].elm,n,d,_,i):d>_&&C(e,h,f)}(h,m,g,n,u):o(g)?(k(g),o(t.text)&&c.setTextContent(h,""),w(h,null,g,0,g.length-1,n)):o(m)?C(m,0,m.length-1):o(t.text)&&c.setTextContent(h,""):t.text!==e.text&&c.setTextContent(h,e.text),o(f)&&o(d=f.hook)&&o(d=d.postpatch)&&d(t,e)}}}function A(t,e,n){if(a(n)&&o(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i, or missing . Bailing hydration and performing full client-side render.")}l=t,t=new wt(c.tagName(l).toLowerCase(),{},[],void 0,l)}var f=t.elm,m=c.parentNode(f);if(p(e,h,f._leaveCb?null:m,c.nextSibling(f)),o(e.parent))for(var g=e.parent,_=y(e);g;){for(var v=0;v-1,a.selected!==o&&(a.selected=o);else if(L(jr(a),i))return void(t.selectedIndex!==s&&(t.selectedIndex=s));r||(t.selectedIndex=-1)}else ht('