PageSourceSearch

https://berhasm.com/_next/static/chunks/c36f3faa.a74e21af116715a8.js

js berhasm.com collected 2026-10-05 18:33:24 UTC 1,489,513 bytes, 105 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3415],{7719:function(e){var i;i=function(){"use strict";var e,i,r;function a(a,n){if(e){if(i){var o="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+i+")(sharedChunk); self.onerror = null;",s={};e(s),r=n(s),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(r.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else i=n}else e=n}return a(["exports"],function(e){let i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,z,D,R,L,O,k,F,B,N,V,U,j,G,q,Z,H,$,W,X,Y;function K(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J,Q={},ee={};function et(){if(J)return ee;J=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.setMatrixArrayType=function(e){ee.ARRAY_TYPE=i=e},ee.toRadian=function(e){return e*a},ee.equals=function(i,r){return Math.abs(i-r)<=e*Math.max(1,Math.abs(i),Math.abs(r))},ee.RANDOM=ee.ARRAY_TYPE=ee.EPSILON=void 0;var e=1e-6;ee.EPSILON=e;var i="undefined"!=typeof Float32Array?Float32Array:Array;ee.ARRAY_TYPE=i;var r=Math.random;ee.RANDOM=r;var a=Math.PI/180;return Math.hypot||(Math.hypot=function(){for(var e=0,i=arguments.length;i--;)e+=arguments[i]*arguments[i];return Math.sqrt(e)}),ee}var ei,er,ea,en={},eo={},es={};function el(){if(ea)return es;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}ea=1,Object.defineProperty(es,"__esModule",{value:!0}),es.create=function(){var e=new i.ARRAY_TYPE(9);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e},es.fromMat4=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[4],e[4]=i[5],e[5]=i[6],e[6]=i[8],e[7]=i[9],e[8]=i[10],e},es.clone=function(e){var r=new i.ARRAY_TYPE(9);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r},es.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e},es.fromValues=function(e,r,a,n,o,s,l,h,u){var c=new i.ARRAY_TYPE(9);return c[0]=e,c[1]=r,c[2]=a,c[3]=n,c[4]=o,c[5]=s,c[6]=l,c[7]=h,c[8]=u,c},es.set=function(e,i,r,a,n,o,s,l,h,u){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e[8]=u,e},es.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},es.transpose=function(e,i){if(e===i){var r=i[1],a=i[2],n=i[5];e[1]=i[3],e[2]=i[6],e[3]=r,e[5]=i[7],e[6]=a,e[7]=n}else e[0]=i[0],e[1]=i[3],e[2]=i[6],e[3]=i[1],e[4]=i[4],e[5]=i[7],e[6]=i[2],e[7]=i[5],e[8]=i[8];return e},es.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=c*s-l*u,p=-c*o+l*h,f=u*o-s*h,m=r*d+a*p+n*f;return m?(e[0]=d*(m=1/m),e[1]=(-c*a+n*u)*m,e[2]=(l*a-n*s)*m,e[3]=p*m,e[4]=(c*r-n*h)*m,e[5]=(-l*r+n*o)*m,e[6]=f*m,e[7]=(-u*r+a*h)*m,e[8]=(s*r-a*o)*m,e):null},es.adjoint=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8];return e[0]=s*c-l*u,e[1]=n*u-a*c,e[2]=a*l-n*s,e[3]=l*h-o*c,e[4]=r*c-n*h,e[5]=n*o-r*l,e[6]=o*u-s*h,e[7]=a*h-r*u,e[8]=r*s-a*o,e},es.determinant=function(e){var i=e[3],r=e[4],a=e[5],n=e[6],o=e[7],s=e[8];return e[0]*(s*r-a*o)+e[1]*(-s*i+a*n)+e[2]*(o*i-r*n)},es.multiply=a,es.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=r[0],f=r[1];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=l,e[5]=h,e[6]=p*a+f*s+u,e[7]=p*n+f*l+c,e[8]=p*o+f*h+d,e},es.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=Math.sin(r),f=Math.cos(r);return e[0]=f*a+p*s,e[1]=f*n+p*l,e[2]=f*o+p*h,e[3]=f*s-p*a,e[4]=f*l-p*n,e[5]=f*h-p*o,e[6]=u,e[7]=c,e[8]=d,e},es.scale=function(e,i,r){var a=r[0],n=r[1];return e[0]=a*i[0],e[1]=a*i[1],e[2]=a*i[2],e[3]=n*i[3],e[4]=n*i[4],e[5]=n*i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e},es.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=i[0],e[7]=i[1],e[8]=1,e},es.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=0,e[3]=-r,e[4]=a,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},es.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=i[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},es.fromMat2d=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=0,e[3]=i[2],e[4]=i[3],e[5]=0,e[6]=i[4],e[7]=i[5],e[8]=1,e},es.fromQuat=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r+r,l=a+a,h=n+n,u=r*s,c=a*s,d=a*l,p=n*s,f=n*l,m=n*h,_=o*s,g=o*l,y=o*h;return e[0]=1-d-m,e[3]=c-y,e[6]=p+g,e[1]=c+y,e[4]=1-u-m,e[7]=f-_,e[2]=p-g,e[5]=f+_,e[8]=1-u-d,e},es.normalFromMat4=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*s,v=r*h-n*s,b=r*u-o*s,w=a*h-n*l,T=a*u-o*l,S=n*u-o*h,M=c*_-d*m,E=c*g-p*m,A=c*y-f*m,I=d*g-p*_,C=d*y-f*_,P=p*y-f*g,z=x*P-v*C+b*I+w*A-T*E+S*M;return z?(e[0]=(l*P-h*C+u*I)*(z=1/z),e[1]=(h*A-s*P-u*E)*z,e[2]=(s*C-l*A+u*M)*z,e[3]=(n*C-a*P-o*I)*z,e[4]=(r*P-n*A+o*E)*z,e[5]=(a*A-r*C-o*M)*z,e[6]=(_*S-g*T+y*w)*z,e[7]=(g*b-m*S-y*v)*z,e[8]=(m*T-_*b+y*x)*z,e):null},es.projection=function(e,i,r){return e[0]=2/i,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},es.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},es.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},es.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e[8]=i[8]+r[8],e},es.subtract=n,es.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e},es.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e[6]=i[6]+r[6]*a,e[7]=i[7]+r[7]*a,e[8]=i[8]+r[8]*a,e},es.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]},es.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=e[4],h=e[5],u=e[6],c=e[7],d=e[8],p=r[0],f=r[1],m=r[2],_=r[3],g=r[4],y=r[5],x=r[6],v=r[7],b=r[8];return Math.abs(a-p)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(n-f)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-m)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(s-_)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(l-g)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(h-y)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(y))&&Math.abs(u-x)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(c-v)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(d-b)<=i.EPSILON*Math.max(1,Math.abs(d),Math.abs(b))},es.sub=es.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,n&&n.set(i,o),o}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=r[0],f=r[1],m=r[2],_=r[3],g=r[4],y=r[5],x=r[6],v=r[7],b=r[8];return e[0]=p*a+f*s+m*u,e[1]=p*n+f*l+m*c,e[2]=p*o+f*h+m*d,e[3]=_*a+g*s+y*u,e[4]=_*n+g*l+y*c,e[5]=_*o+g*h+y*d,e[6]=x*a+v*s+b*u,e[7]=x*n+v*l+b*c,e[8]=x*o+v*h+b*d,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e[6]=i[6]-r[6],e[7]=i[7]-r[7],e[8]=i[8]-r[8],e}return es.mul=a,es.sub=n,es}var eh,eu={};function ec(){if(eh)return eu;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}
1eh=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.create=function(){var e=new i.ARRAY_TYPE(16);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},eu.clone=function(e){var r=new i.ARRAY_TYPE(16);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},eu.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},eu.fromValues=function(e,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){var y=new i.ARRAY_TYPE(16);return y[0]=e,y[1]=r,y[2]=a,y[3]=n,y[4]=o,y[5]=s,y[6]=l,y[7]=h,y[8]=u,y[9]=c,y[10]=d,y[11]=p,y[12]=f,y[13]=m,y[14]=_,y[15]=g,y},eu.set=function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=m,e[14]=_,e[15]=g,e},eu.identity=a,eu.transpose=function(e,i){if(e===i){var r=i[1],a=i[2],n=i[3],o=i[6],s=i[7],l=i[11];e[1]=i[4],e[2]=i[8],e[3]=i[12],e[4]=r,e[6]=i[9],e[7]=i[13],e[8]=a,e[9]=o,e[11]=i[14],e[12]=n,e[13]=s,e[14]=l}else e[0]=i[0],e[1]=i[4],e[2]=i[8],e[3]=i[12],e[4]=i[1],e[5]=i[5],e[6]=i[9],e[7]=i[13],e[8]=i[2],e[9]=i[6],e[10]=i[10],e[11]=i[14],e[12]=i[3],e[13]=i[7],e[14]=i[11],e[15]=i[15];return e},eu.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*s,v=r*h-n*s,b=r*u-o*s,w=a*h-n*l,T=a*u-o*l,S=n*u-o*h,M=c*_-d*m,E=c*g-p*m,A=c*y-f*m,I=d*g-p*_,C=d*y-f*_,P=p*y-f*g,z=x*P-v*C+b*I+w*A-T*E+S*M;return z?(e[0]=(l*P-h*C+u*I)*(z=1/z),e[1]=(n*C-a*P-o*I)*z,e[2]=(_*S-g*T+y*w)*z,e[3]=(p*T-d*S-f*w)*z,e[4]=(h*A-s*P-u*E)*z,e[5]=(r*P-n*A+o*E)*z,e[6]=(g*b-m*S-y*v)*z,e[7]=(c*S-p*b+f*v)*z,e[8]=(s*C-l*A+u*M)*z,e[9]=(a*A-r*C-o*M)*z,e[10]=(m*T-_*b+y*x)*z,e[11]=(d*b-c*T-f*x)*z,e[12]=(l*E-s*I-h*M)*z,e[13]=(r*I-a*E+n*M)*z,e[14]=(_*v-m*w-g*x)*z,e[15]=(c*w-d*v+p*x)*z,e):null},eu.adjoint=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15];return e[0]=l*(p*y-f*g)-d*(h*y-u*g)+_*(h*f-u*p),e[1]=-(a*(p*y-f*g)-d*(n*y-o*g)+_*(n*f-o*p)),e[2]=a*(h*y-u*g)-l*(n*y-o*g)+_*(n*u-o*h),e[3]=-(a*(h*f-u*p)-l*(n*f-o*p)+d*(n*u-o*h)),e[4]=-(s*(p*y-f*g)-c*(h*y-u*g)+m*(h*f-u*p)),e[5]=r*(p*y-f*g)-c*(n*y-o*g)+m*(n*f-o*p),e[6]=-(r*(h*y-u*g)-s*(n*y-o*g)+m*(n*u-o*h)),e[7]=r*(h*f-u*p)-s*(n*f-o*p)+c*(n*u-o*h),e[8]=s*(d*y-f*_)-c*(l*y-u*_)+m*(l*f-u*d),e[9]=-(r*(d*y-f*_)-c*(a*y-o*_)+m*(a*f-o*d)),e[10]=r*(l*y-u*_)-s*(a*y-o*_)+m*(a*u-o*l),e[11]=-(r*(l*f-u*d)-s*(a*f-o*d)+c*(a*u-o*l)),e[12]=-(s*(d*g-p*_)-c*(l*g-h*_)+m*(l*p-h*d)),e[13]=r*(d*g-p*_)-c*(a*g-n*_)+m*(a*p-n*d),e[14]=-(r*(l*g-h*_)-s*(a*g-n*_)+m*(a*h-n*l)),e[15]=r*(l*p-h*d)-s*(a*p-n*d)+c*(a*h-n*l),e},eu.determinant=function(e){var i=e[0],r=e[1],a=e[2],n=e[3],o=e[4],s=e[5],l=e[6],h=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],m=e[13],_=e[14],g=e[15];return(i*s-r*o)*(d*g-p*_)-(i*l-a*o)*(c*g-p*m)+(i*h-n*o)*(c*_-d*m)+(r*l-a*s)*(u*g-p*f)-(r*h-n*s)*(u*_-d*f)+(a*h-n*l)*(u*m-c*f)},eu.multiply=n,eu.translate=function(e,i,r){var a,n,o,s,l,h,u,c,d,p,f,m,_=r[0],g=r[1],y=r[2];return i===e?(e[12]=i[0]*_+i[4]*g+i[8]*y+i[12],e[13]=i[1]*_+i[5]*g+i[9]*y+i[13],e[14]=i[2]*_+i[6]*g+i[10]*y+i[14],e[15]=i[3]*_+i[7]*g+i[11]*y+i[15]):(n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],e[0]=a=i[0],e[1]=n,e[2]=o,e[3]=s,e[4]=l,e[5]=h,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=m,e[12]=a*_+l*g+d*y+i[12],e[13]=n*_+h*g+p*y+i[13],e[14]=o*_+u*g+f*y+i[14],e[15]=s*_+c*g+m*y+i[15]),e},eu.scale=function(e,i,r){var a=r[0],n=r[1],o=r[2];return e[0]=i[0]*a,e[1]=i[1]*a,e[2]=i[2]*a,e[3]=i[3]*a,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=i[7]*n,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=i[11]*o,e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},eu.rotate=function(e,r,a,n){var o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P=n[0],z=n[1],D=n[2],R=Math.hypot(P,z,D);return R<i.EPSILON?null:(P*=R=1/R,z*=R,D*=R,o=Math.sin(a),s=Math.cos(a),u=r[1],c=r[2],d=r[3],f=r[5],m=r[6],_=r[7],y=r[9],x=r[10],v=r[11],b=P*P*(l=1-s)+s,S=P*z*l-D*o,M=z*z*l+s,E=D*z*l+P*o,A=P*D*l+z*o,I=z*D*l-P*o,C=D*D*l+s,e[0]=(h=r[0])*b+(p=r[4])*(w=z*P*l+D*o)+(g=r[8])*(T=D*P*l-z*o),e[1]=u*b+f*w+y*T,e[2]=c*b+m*w+x*T,e[3]=d*b+_*w+v*T,e[4]=h*S+p*M+g*E,e[5]=u*S+f*M+y*E,e[6]=c*S+m*M+x*E,e[7]=d*S+_*M+v*E,e[8]=h*A+p*I+g*C,e[9]=u*A+f*I+y*C,e[10]=c*A+m*I+x*C,e[11]=d*A+_*I+v*C,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)},eu.rotateX=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[4],s=i[5],l=i[6],h=i[7],u=i[8],c=i[9],d=i[10],p=i[11];return i!==e&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[4]=o*n+u*a,e[5]=s*n+c*a,e[6]=l*n+d*a,e[7]=h*n+p*a,e[8]=u*n-o*a,e[9]=c*n-s*a,e[10]=d*n-l*a,e[11]=p*n-h*a,e},eu.rotateY=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[0],s=i[1],l=i[2],h=i[3],u=i[8],c=i[9],d=i[10],p=i[11];return i!==e&&(e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=o*n-u*a,e[1]=s*n-c*a,e[2]=l*n-d*a,e[3]=h*n-p*a,e[8]=o*a+u*n,e[9]=s*a+c*n,e[10
1]=l*a+d*n,e[11]=h*a+p*n,e},eu.rotateZ=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[0],s=i[1],l=i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7];return i!==e&&(e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=o*n+u*a,e[1]=s*n+c*a,e[2]=l*n+d*a,e[3]=h*n+p*a,e[4]=u*n-o*a,e[5]=c*n-s*a,e[6]=d*n-l*a,e[7]=p*n-h*a,e},eu.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e},eu.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=i[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.fromRotation=function(e,r,a){var n,o,s,l=a[0],h=a[1],u=a[2],c=Math.hypot(l,h,u);return c<i.EPSILON?null:(l*=c=1/c,h*=c,u*=c,n=Math.sin(r),o=Math.cos(r),e[0]=l*l*(s=1-o)+o,e[1]=h*l*s+u*n,e[2]=u*l*s-h*n,e[3]=0,e[4]=l*h*s-u*n,e[5]=h*h*s+o,e[6]=u*h*s+l*n,e[7]=0,e[8]=l*u*s+h*n,e[9]=h*u*s-l*n,e[10]=u*u*s+o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},eu.fromXRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.fromYRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.fromZRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.fromRotationTranslation=o,eu.fromQuat2=function(e,r){var a=new i.ARRAY_TYPE(3),n=-r[0],s=-r[1],l=-r[2],h=r[3],u=r[4],c=r[5],d=r[6],p=r[7],f=n*n+s*s+l*l+h*h;return f>0?(a[0]=2*(u*h+p*n+c*l-d*s)/f,a[1]=2*(c*h+p*s+d*n-u*l)/f,a[2]=2*(d*h+p*l+u*s-c*n)/f):(a[0]=2*(u*h+p*n+c*l-d*s),a[1]=2*(c*h+p*s+d*n-u*l),a[2]=2*(d*h+p*l+u*s-c*n)),o(e,r,a),e},eu.getTranslation=function(e,i){return e[0]=i[12],e[1]=i[13],e[2]=i[14],e},eu.getScaling=s,eu.getRotation=function(e,r){var a=new i.ARRAY_TYPE(3);s(a,r);var n=1/a[0],o=1/a[1],l=1/a[2],h=r[0]*n,u=r[1]*o,c=r[2]*l,d=r[4]*n,p=r[5]*o,f=r[6]*l,m=r[8]*n,_=r[9]*o,g=r[10]*l,y=h+p+g,x=0;return y>0?(x=2*Math.sqrt(y+1),e[3]=.25*x,e[0]=(f-_)/x,e[1]=(m-c)/x,e[2]=(u-d)/x):h>p&&h>g?(x=2*Math.sqrt(1+h-p-g),e[3]=(f-_)/x,e[0]=.25*x,e[1]=(u+d)/x,e[2]=(m+c)/x):p>g?(x=2*Math.sqrt(1+p-h-g),e[3]=(m-c)/x,e[0]=(u+d)/x,e[1]=.25*x,e[2]=(f+_)/x):(x=2*Math.sqrt(1+g-h-p),e[3]=(u-d)/x,e[0]=(m+c)/x,e[1]=(f+_)/x,e[2]=.25*x),e},eu.fromRotationTranslationScale=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=i[3],h=n+n,u=o+o,c=s+s,d=n*h,p=n*u,f=n*c,m=o*u,_=o*c,g=s*c,y=l*h,x=l*u,v=l*c,b=a[0],w=a[1],T=a[2];return e[0]=(1-(m+g))*b,e[1]=(p+v)*b,e[2]=(f-x)*b,e[3]=0,e[4]=(p-v)*w,e[5]=(1-(d+g))*w,e[6]=(_+y)*w,e[7]=0,e[8]=(f+x)*T,e[9]=(_-y)*T,e[10]=(1-(d+m))*T,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e},eu.fromRotationTranslationScaleOrigin=function(e,i,r,a,n){var o=i[0],s=i[1],l=i[2],h=i[3],u=o+o,c=s+s,d=l+l,p=o*u,f=o*c,m=o*d,_=s*c,g=s*d,y=l*d,x=h*u,v=h*c,b=h*d,w=a[0],T=a[1],S=a[2],M=n[0],E=n[1],A=n[2],I=(1-(_+y))*w,C=(f+b)*w,P=(m-v)*w,z=(f-b)*T,D=(1-(p+y))*T,R=(g+x)*T,L=(m+v)*S,O=(g-x)*S,k=(1-(p+_))*S;return e[0]=I,e[1]=C,e[2]=P,e[3]=0,e[4]=z,e[5]=D,e[6]=R,e[7]=0,e[8]=L,e[9]=O,e[10]=k,e[11]=0,e[12]=r[0]+M-(I*M+z*E+L*A),e[13]=r[1]+E-(C*M+D*E+O*A),e[14]=r[2]+A-(P*M+R*E+k*A),e[15]=1,e},eu.fromQuat=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r+r,l=a+a,h=n+n,u=r*s,c=a*s,d=a*l,p=n*s,f=n*l,m=n*h,_=o*s,g=o*l,y=o*h;return e[0]=1-d-m,e[1]=c+y,e[2]=p-g,e[3]=0,e[4]=c-y,e[5]=1-u-m,e[6]=f+_,e[7]=0,e[8]=p+g,e[9]=f-_,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.frustum=function(e,i,r,a,n,o,s){var l=1/(r-i),h=1/(n-a),u=1/(o-s);return e[0]=2*o*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*h,e[6]=0,e[7]=0,e[8]=(r+i)*l,e[9]=(n+a)*h,e[10]=(s+o)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*u,e[15]=0,e},eu.perspectiveNO=l,eu.perspectiveZO=function(e,i,r,a,n){var o,s=1/Math.tan(i/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=n*(o=1/(a-n)),e[14]=n*a*o):(e[10]=-1,e[14]=-a),e},eu.perspectiveFromFieldOfView=function(e,i,r,a){var n=Math.tan(i.upDegrees*Math.PI/180),o=Math.tan(i.downDegrees*Math.PI/180),s=Math.tan(i.leftDegrees*Math.PI/180),l=Math.tan(i.rightDegrees*Math.PI/180),h=2/(s+l),u=2/(n+o);return e[0]=h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(s-l)*h*.5,e[9]=(n-o)*u*.5,e[10]=a/(r-a),e[11]=-1,e[12]=0,e[13]=0,e[14]=a*r/(r-a),e[15]=0,e},eu.orthoNO=h,eu.orthoZO=function(e,i,r,a,n,o,s){var l=1/(i-r),h=1/(a-n),u=1/(o-s);return e[0]=-2*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*h,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
1]=u,e[11]=0,e[12]=(i+r)*l,e[13]=(n+a)*h,e[14]=o*u,e[15]=1,e},eu.lookAt=function(e,r,n,o){var s,l,h,u,c,d,p,f,m,_,g=r[0],y=r[1],x=r[2],v=o[0],b=o[1],w=o[2],T=n[0],S=n[1],M=n[2];return Math.abs(g-T)<i.EPSILON&&Math.abs(y-S)<i.EPSILON&&Math.abs(x-M)<i.EPSILON?a(e):(p=g-T,f=y-S,m=x-M,(_=Math.hypot(s=b*(m*=_=1/Math.hypot(p,f,m))-w*(f*=_),l=w*(p*=_)-v*m,h=v*f-b*p))?(s*=_=1/_,l*=_,h*=_):(s=0,l=0,h=0),(_=Math.hypot(u=f*h-m*l,c=m*s-p*h,d=p*l-f*s))?(u*=_=1/_,c*=_,d*=_):(u=0,c=0,d=0),e[0]=s,e[1]=u,e[2]=p,e[3]=0,e[4]=l,e[5]=c,e[6]=f,e[7]=0,e[8]=h,e[9]=d,e[10]=m,e[11]=0,e[12]=-(s*g+l*y+h*x),e[13]=-(u*g+c*y+d*x),e[14]=-(p*g+f*y+m*x),e[15]=1,e)},eu.targetTo=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=a[0],h=a[1],u=a[2],c=n-r[0],d=o-r[1],p=s-r[2],f=c*c+d*d+p*p;f>0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var m=h*p-u*d,_=u*c-l*p,g=l*d-h*c;return(f=m*m+_*_+g*g)>0&&(m*=f=1/Math.sqrt(f),_*=f,g*=f),e[0]=m,e[1]=_,e[2]=g,e[3]=0,e[4]=d*g-p*_,e[5]=p*m-c*g,e[6]=c*_-d*m,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=n,e[13]=o,e[14]=s,e[15]=1,e},eu.str=function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},eu.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},eu.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e[8]=i[8]+r[8],e[9]=i[9]+r[9],e[10]=i[10]+r[10],e[11]=i[11]+r[11],e[12]=i[12]+r[12],e[13]=i[13]+r[13],e[14]=i[14]+r[14],e[15]=i[15]+r[15],e},eu.subtract=u,eu.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=i[11]*r,e[12]=i[12]*r,e[13]=i[13]*r,e[14]=i[14]*r,e[15]=i[15]*r,e},eu.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e[6]=i[6]+r[6]*a,e[7]=i[7]+r[7]*a,e[8]=i[8]+r[8]*a,e[9]=i[9]+r[9]*a,e[10]=i[10]+r[10]*a,e[11]=i[11]+r[11]*a,e[12]=i[12]+r[12]*a,e[13]=i[13]+r[13]*a,e[14]=i[14]+r[14]*a,e[15]=i[15]+r[15]*a,e},eu.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]&&e[9]===i[9]&&e[10]===i[10]&&e[11]===i[11]&&e[12]===i[12]&&e[13]===i[13]&&e[14]===i[14]&&e[15]===i[15]},eu.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=e[4],h=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],m=e[11],_=e[12],g=e[13],y=e[14],x=e[15],v=r[0],b=r[1],w=r[2],T=r[3],S=r[4],M=r[5],E=r[6],A=r[7],I=r[8],C=r[9],P=r[10],z=r[11],D=r[12],R=r[13],L=r[14],O=r[15];return Math.abs(a-v)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-b)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-w)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-T)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-S)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(h-M)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(u-E)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-A)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-I)<=i.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-C)<=i.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(f-P)<=i.EPSILON*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(m-z)<=i.EPSILON*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(_-D)<=i.EPSILON*Math.max(1,Math.abs(_),Math.abs(D))&&Math.abs(g-R)<=i.EPSILON*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(y-L)<=i.EPSILON*Math.max(1,Math.abs(y),Math.abs(L))&&Math.abs(x-O)<=i.EPSILON*Math.max(1,Math.abs(x),Math.abs(O))},eu.sub=eu.mul=eu.ortho=eu.perspective=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,n&&n.set(i,o),o}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
1]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],_=i[12],g=i[13],y=i[14],x=i[15],v=r[0],b=r[1],w=r[2],T=r[3];return e[0]=v*a+b*l+w*d+T*_,e[1]=v*n+b*h+w*p+T*g,e[2]=v*o+b*u+w*f+T*y,e[3]=v*s+b*c+w*m+T*x,e[4]=(v=r[4])*a+(b=r[5])*l+(w=r[6])*d+(T=r[7])*_,e[5]=v*n+b*h+w*p+T*g,e[6]=v*o+b*u+w*f+T*y,e[7]=v*s+b*c+w*m+T*x,e[8]=(v=r[8])*a+(b=r[9])*l+(w=r[10])*d+(T=r[11])*_,e[9]=v*n+b*h+w*p+T*g,e[10]=v*o+b*u+w*f+T*y,e[11]=v*s+b*c+w*m+T*x,e[12]=(v=r[12])*a+(b=r[13])*l+(w=r[14])*d+(T=r[15])*_,e[13]=v*n+b*h+w*p+T*g,e[14]=v*o+b*u+w*f+T*y,e[15]=v*s+b*c+w*m+T*x,e}function o(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=a+a,h=n+n,u=o+o,c=a*l,d=a*h,p=a*u,f=n*h,m=n*u,_=o*u,g=s*l,y=s*h,x=s*u;return e[0]=1-(f+_),e[1]=d+x,e[2]=p-y,e[3]=0,e[4]=d-x,e[5]=1-(c+_),e[6]=m+g,e[7]=0,e[8]=p+y,e[9]=m-g,e[10]=1-(c+f),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function s(e,i){var r=i[4],a=i[5],n=i[6],o=i[8],s=i[9],l=i[10];return e[0]=Math.hypot(i[0],i[1],i[2]),e[1]=Math.hypot(r,a,n),e[2]=Math.hypot(o,s,l),e}function l(e,i,r,a,n){var o,s=1/Math.tan(i/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+a)*(o=1/(a-n)),e[14]=2*n*a*o):(e[10]=-1,e[14]=-2*a),e}function h(e,i,r,a,n,o,s){var l=1/(i-r),h=1/(a-n),u=1/(o-s);return e[0]=-2*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*h,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(i+r)*l,e[13]=(n+a)*h,e[14]=(s+o)*u,e[15]=1,e}function u(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e[6]=i[6]-r[6],e[7]=i[7]-r[7],e[8]=i[8]-r[8],e[9]=i[9]-r[9],e[10]=i[10]-r[10],e[11]=i[11]-r[11],e[12]=i[12]-r[12],e[13]=i[13]-r[13],e[14]=i[14]-r[14],e[15]=i[15]-r[15],e}return eu.perspective=l,eu.ortho=h,eu.mul=n,eu.sub=u,eu}var ed,ep={},ef={};function em(){if(ed)return ef;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}ed=1,Object.defineProperty(ef,"__esModule",{value:!0}),ef.create=a,ef.clone=function(e){var r=new i.ARRAY_TYPE(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r},ef.length=n,ef.fromValues=function(e,r,a){var n=new i.ARRAY_TYPE(3);return n[0]=e,n[1]=r,n[2]=a,n},ef.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},ef.set=function(e,i,r,a){return e[0]=i,e[1]=r,e[2]=a,e},ef.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e},ef.subtract=o,ef.multiply=s,ef.divide=l,ef.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e},ef.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e},ef.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e[2]=Math.min(i[2],r[2]),e},ef.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e[2]=Math.max(i[2],r[2]),e},ef.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e},ef.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e},ef.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e},ef.distance=h,ef.squaredDistance=u,ef.squaredLength=c,ef.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e},ef.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e},ef.normalize=function(e,i){var r=i[0],a=i[1],n=i[2],o=r*r+a*a+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=i[0]*o,e[1]=i[1]*o,e[2]=i[2]*o,e},ef.dot=d,ef.cross=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[0],l=r[1],h=r[2];return e[0]=n*h-o*l,e[1]=o*s-a*h,e[2]=a*l-n*s,e},ef.lerp=function(e,i,r,a){var n=i[0],o=i[1],s=i[2];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e[2]=s+a*(r[2]-s),e},ef.hermite=function(e,i,r,a,n,o){var s=o*o,l=s*(2*o-3)+1,h=s*(o-2)+o,u=s*(o-1),c=s*(3-2*o);return e[0]=i[0]*l+r[0]*h+a[0]*u+n[0]*c,e[1]=i[1]*l+r[1]*h+a[1]*u+n[1]*c,e[2]=i[2]*l+r[2]*h+a[2]*u+n[2]*c,e},ef.bezier=function(e,i,r,a,n,o){var s=1-o,l=s*s,h=o*o,u=l*s,c=3*o*l,d=3*h*s,p=h*o;return e[0]=i[0]*u+r[0]*c+a[0]*d+n[0]*p,e[1]=i[1]*u+r[1]*c+a[1]*d+n[1]*p,e[2]=i[2]*u+r[2]*c+a[2]*d+n[2]*p,e},ef.random=function(e,r){r=r||1;var a=2*i.RANDOM()*Math.PI,n=2*i.RANDOM()-1,o=Math.sqrt(1-n*n)*r;return e[0]=Math.cos(a)*o,e[1]=Math.sin(a)*o,e[2]=n*r,e},ef.transformMat4=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[3]*a+r[7]*n+r[11]*o+r[15];return e[0]=(r[0]*a+r[4]*n+r[8]*o+r[12])/(s=s||1),e[1]=(r[1]*a+r[5]*n+r[9]*o+r[13])/s,e[2]=(r[2]*a+r[6]*n+r[10]*o+r[14])/s,e},ef.transformMat3=function(e,i,r){var a=i[0],n=i[1],o=i[2];return e[0]=a*r[0]+n*r[3]+o*r[6],e[1]=a*r[1]+n*r[4]+o*r[7],e[2]=a*r[2]+n*r[5]+o*r[8],e},ef.transformQuat=function(e,i,r){var a=r[0],n=r[1],o=r[2],s=i[0],l=i[1],h=i[2],u=n*h-o*l,c=o*s-a*h,d=a*l-n*s,p=n*d-o*c,f=o*u-a*d,m=a*c-n*u,_=2*r[3];return c*=_,d*=_,f*=2,m*=2,e[0]=s+(u*=_)+(p*=2),e[1]=l+c+f,e[2]=h+d+m,e},ef.rotateX=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(a)-n[2]*Math.sin(a),o[2]=n[1]*Math.sin(a)+n[2]*
1Math.cos(a),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},ef.rotateY=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[2]*Math.sin(a)+n[0]*Math.cos(a),o[1]=n[1],o[2]=n[2]*Math.cos(a)-n[0]*Math.sin(a),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},ef.rotateZ=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[0]*Math.cos(a)-n[1]*Math.sin(a),o[1]=n[0]*Math.sin(a)+n[1]*Math.cos(a),o[2]=n[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},ef.angle=function(e,i){var r=e[0],a=e[1],n=e[2],o=i[0],s=i[1],l=i[2],h=Math.sqrt(r*r+a*a+n*n)*Math.sqrt(o*o+s*s+l*l);return Math.acos(Math.min(Math.max(h&&d(e,i)/h,-1),1))},ef.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},ef.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},ef.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]},ef.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=r[0],l=r[1],h=r[2];return Math.abs(a-s)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(s))&&Math.abs(n-l)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-h)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))},ef.forEach=ef.sqrLen=ef.len=ef.sqrDist=ef.dist=ef.div=ef.mul=ef.sub=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,n&&n.set(i,o),o}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(){var e=new i.ARRAY_TYPE(3);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function n(e){return Math.hypot(e[0],e[1],e[2])}function o(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e}function s(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e[2]=i[2]*r[2],e}function l(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e[2]=i[2]/r[2],e}function h(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2])}function u(e,i){var r=i[0]-e[0],a=i[1]-e[1],n=i[2]-e[2];return r*r+a*a+n*n}function c(e){var i=e[0],r=e[1],a=e[2];return i*i+r*r+a*a}function d(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]}ef.sub=o,ef.mul=s,ef.div=l,ef.dist=h,ef.sqrDist=u,ef.len=n,ef.sqrLen=c;var p,f=(p=a(),function(e,i,r,a,n,o){var s,l;for(i||(i=3),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)p[0]=e[s],p[1]=e[s+1],p[2]=e[s+2],n(p,p,o),e[s]=p[0],e[s+1]=p[1],e[s+2]=p[2];return e});return ef.forEach=f,ef}var e_,eg,ey={};function ex(){if(e_)return ey;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}e_=1,Object.defineProperty(ey,"__esModule",{value:!0}),ey.create=a,ey.clone=function(e){var r=new i.ARRAY_TYPE(4);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},ey.fromValues=function(e,r,a,n){var o=new i.ARRAY_TYPE(4);return o[0]=e,o[1]=r,o[2]=a,o[3]=n,o},ey.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},ey.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},ey.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e},ey.subtract=n,ey.multiply=o,ey.divide=s,ey.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e[3]=Math.ceil(i[3]),e},ey.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e[3]=Math.floor(i[3]),e},ey.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e[2]=Math.min(i[2],r[2]),e[3]=Math.min(i[3],r[3]),e},ey.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e[2]=Math.max(i[2],r[2]),e[3]=Math.max(i[3],r[3]),e},ey.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e[3]=Math.round(i[3]),e},ey.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e},ey.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e},ey.distance=l,ey.squaredDistance=h,ey.length=u,ey.squaredLength=c,ey.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=-i[3],e},ey.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e[3]=1/i[3],e},ey.normalize=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*r+a*a+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=a*s,e[2]=n*s,e[3]=o*s,e},ey.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]+e[3]*i[3]},ey.cross=function(e,i,r,a){var n=r[0]*a[1]-r[1]*a[0],o=r[0]*a[2]-r[2]*a[0],s=r[0]*a[3]-r[3]*a[0],l=r[1]*a[2]-r[2]*a[1],h=r[1]*a[3]-r[3]*a[1],u=r[2]*a[3]-r[3]*a[2],c=i[0],d=i[1],p=i[2],f=i[3];return e[0]=d*u-p*h+f*l,e[1]=-c*u+p*s-f*o,e[2]=c*h-d*s+f*n,e[3]=-c*l+d*o-p*n,e},ey.lerp=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=i[3];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e[2]=s+a*(r[2]-s),e[3]=l+a*(r[3]-l),e},ey.random=function(e,r){r=r||1;do l=(a=2*i.RANDOM()-1)*a+(n=2*i.RANDOM()-1)*n;while(l>=1);do h=(o=2*i.RANDOM()-1)*o+(s=2*i.RANDOM()-1)*s;while(h>=1);var a,n,o,s,l,h,u=Math.sqrt((1-l)/h);return e[0]=r*a,e[1]=r*n,e[2]=r*o*u,e[3]=r*s*u,e},ey.transformMat4=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3];return e[0]=r[0]*a+r[4]*n+r[8]*o+r[12]*s,e[1]=r[1]*a+r[5]*n+r[9]*o+r[13]*s,e[2]=r[2]*a+r[6]*n+r[10]*o+r[14]*s,e[3]=r[3]*a+r[7]*n+r[11]*o+r[15]*s,e},ey.transformQuat=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[0],l=r[1],h=r[2],u=r[3],c=u*a+l*o-h*n,d=u*n+h*
1a-s*o,p=u*o+s*n-l*a,f=-s*a-l*n-h*o;return e[0]=c*u+-(f*s)+-(d*h)- -(p*l),e[1]=d*u+-(f*l)+-(p*s)- -(c*h),e[2]=p*u+-(f*h)+-(c*l)- -(d*s),e[3]=i[3],e},ey.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},ey.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},ey.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},ey.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=r[0],h=r[1],u=r[2],c=r[3];return Math.abs(a-l)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-h)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(o-u)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(s-c)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))},ey.forEach=ey.sqrLen=ey.len=ey.sqrDist=ey.dist=ey.div=ey.mul=ey.sub=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,n&&n.set(i,o),o}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e}function o(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e[2]=i[2]*r[2],e[3]=i[3]*r[3],e}function s(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e[2]=i[2]/r[2],e[3]=i[3]/r[3],e}function l(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2],i[3]-e[3])}function h(e,i){var r=i[0]-e[0],a=i[1]-e[1],n=i[2]-e[2],o=i[3]-e[3];return r*r+a*a+n*n+o*o}function u(e){return Math.hypot(e[0],e[1],e[2],e[3])}function c(e){var i=e[0],r=e[1],a=e[2],n=e[3];return i*i+r*r+a*a+n*n}ey.sub=n,ey.mul=o,ey.div=s,ey.dist=l,ey.sqrDist=h,ey.len=u,ey.sqrLen=c;var d,p=(d=a(),function(e,i,r,a,n,o){var s,l;for(i||(i=4),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)d[0]=e[s],d[1]=e[s+1],d[2]=e[s+2],d[3]=e[s+3],n(d,d,o),e[s]=d[0],e[s+1]=d[1],e[s+2]=d[2],e[s+3]=d[3];return e});
1return ey.forEach=p,ey}function ev(){if(eg)return ep;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}eg=1,Object.defineProperty(ep,"__esModule",{value:!0}),ep.create=l,ep.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},ep.setAxisAngle=h,ep.getAxisAngle=function(e,r){var a=2*Math.acos(r[3]),n=Math.sin(a/2);return n>i.EPSILON?(e[0]=r[0]/n,e[1]=r[1]/n,e[2]=r[2]/n):(e[0]=1,e[1]=0,e[2]=0),a},ep.getAngle=function(e,i){var r=_(e,i);return Math.acos(2*r*r-1)},ep.multiply=u,ep.rotateX=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+s*l,e[1]=n*h+o*l,e[2]=o*h-n*l,e[3]=s*h-a*l,e},ep.rotateY=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h-o*l,e[1]=n*h+s*l,e[2]=o*h+a*l,e[3]=s*h-n*l,e},ep.rotateZ=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+n*l,e[1]=n*h-a*l,e[2]=o*h+s*l,e[3]=s*h-o*l,e},ep.calculateW=function(e,i){var r=i[0],a=i[1],n=i[2];return e[0]=r,e[1]=a,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-a*a-n*n)),e},ep.exp=c,ep.ln=d,ep.pow=function(e,i,r){return d(e,i),m(e,e,r),c(e,e),e},ep.slerp=p,ep.random=function(e){var r=i.RANDOM(),a=i.RANDOM(),n=i.RANDOM(),o=Math.sqrt(1-r),s=Math.sqrt(r);return e[0]=o*Math.sin(2*Math.PI*a),e[1]=o*Math.cos(2*Math.PI*a),e[2]=s*Math.sin(2*Math.PI*n),e[3]=s*Math.cos(2*Math.PI*n),e},ep.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*r+a*a+n*n+o*o,l=s?1/s:0;return e[0]=-r*l,e[1]=-a*l,e[2]=-n*l,e[3]=o*l,e},ep.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e},ep.fromMat3=f,ep.fromEuler=function(e,i,r,a){var n=.5*Math.PI/180;i*=n,r*=n,a*=n;var o=Math.sin(i),s=Math.cos(i),l=Math.sin(r),h=Math.cos(r),u=Math.sin(a),c=Math.cos(a);return e[0]=o*h*c-s*l*u,e[1]=s*l*c+o*h*u,e[2]=s*h*u-o*l*c,e[3]=s*h*c+o*l*u,e},ep.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},ep.setAxes=ep.sqlerp=ep.rotationTo=ep.equals=ep.exactEquals=ep.normalize=ep.sqrLen=ep.squaredLength=ep.len=ep.length=ep.lerp=ep.dot=ep.scale=ep.mul=ep.add=ep.set=ep.copy=ep.fromValues=ep.clone=void 0;var i=s(et()),r=s(el()),a=s(em()),n=s(ex());function o(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(o=function(e){return e?r:i})(e)}function s(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=o(r);if(a&&a.has(i))return a.get(i);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=i[l]}return n.default=i,a&&a.set(i,n),n}function l(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function h(e,i,r){var a=Math.sin(r*=.5);return e[0]=a*i[0],e[1]=a*i[1],e[2]=a*i[2],e[3]=Math.cos(r),e}function u(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*c+s*l+n*u-o*h,e[1]=n*c+s*h+o*l-a*u,e[2]=o*c+s*u+a*h-n*l,e[3]=s*c-a*l-n*h-o*u,e}function c(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=Math.sqrt(r*r+a*a+n*n),l=Math.exp(o),h=s>0?l*Math.sin(s)/s:0;return e[0]=r*h,e[1]=a*h,e[2]=n*h,e[3]=l*Math.cos(s),e}function d(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=Math.sqrt(r*r+a*a+n*n),l=s>0?Math.atan2(s,o)/s:0;return e[0]=r*l,e[1]=a*l,e[2]=n*l,e[3]=.5*Math.log(r*r+a*a+n*n+o*o),e}function p(e,r,a,n){var o,s,l,h,u,c=r[0],d=r[1],p=r[2],f=r[3],m=a[0],_=a[1],g=a[2],y=a[3];return(s=c*m+d*_+p*g+f*y)<0&&(s=-s,m=-m,_=-_,g=-g,y=-y),1-s>i.EPSILON?(l=Math.sin(o=Math.acos(s)),h=Math.sin((1-n)*o)/l,u=Math.sin(n*o)/l):(h=1-n,u=n),e[0]=h*c+u*m,e[1]=h*d+u*_,e[2]=h*p+u*g,e[3]=h*f+u*y,e}function f(e,i){var r,a=i[0]+i[4]+i[8];if(a>0)r=Math.sqrt(a+1),e[3]=.5*r,e[0]=(i[5]-i[7])*(r=.5/r),e[1]=(i[6]-i[2])*r,e[2]=(i[1]-i[3])*r;else{var n=0;i[4]>i[0]&&(n=1),i[8]>i[3*n+n]&&(n=2);var o=(n+1)%3,s=(n+2)%3;r=Math.sqrt(i[3*n+n]-i[3*o+o]-i[3*s+s]+1),e[n]=.5*r,e[3]=(i[3*o+s]-i[3*s+o])*(r=.5/r),e[o]=(i[3*o+n]+i[3*n+o])*r,e[s]=(i[3*s+n]+i[3*n+s])*r}return e}ep.clone=n.clone,ep.fromValues=n.fromValues,ep.copy=n.copy,ep.set=n.set,ep.add=n.add,ep.mul=u;var m=n.scale;ep.scale=m;var _=n.dot;ep.dot=_,ep.lerp=n.lerp;var g=n.length;ep.length=g,ep.len=g;var y=n.squaredLength;ep.squaredLength=y,ep.sqrLen=y;var x=n.normalize;ep.normalize=x,ep.exactEquals=n.exactEquals,ep.equals=n.equals;var v,b,w,T=(v=a.create(),b=a.fromValues(1,0,0),w=a.fromValues(0,1,0),function(e,i,r){var n=a.dot(i,r);return n<-.999999?(a.cross(v,b,i),1e-6>a.len(v)&&a.cross(v,w,i),a.normalize(v,v),h(e,v,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(a.cross(v,i,r),e[0]=v[0],e[1]=v[1],e[2]=v[2],e[3]=1+n,x(e,e))});ep.rotationTo=T;var S,M,E=(S=l(),M=l(),function(e,i,r,a,n,o){return p(S,i,n,o),p(M,r,a,o),p(e,S,M,2*o*(1-o)),e});ep.sqlerp=E;var A,I=(A=r.create(),function(e,i,r,a){return A[0]=r[0],A[3]=r[1],A[6]=r[2],A[1]=a[0],A[4]=a[1],A[7]=a[2],A[2]=-i[0],A[5]=-i[1],A[8]=-i[2],x(e,f(e,A))});return ep.setAxes=I,ep}var eb,ew,eT,eS,eM,eE,eA,eI={},eC={},eP=function(){if(eT)return Q;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}eT=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.vec4=Q.vec3=Q.vec2=Q.quat2=Q.quat=Q.mat4=Q.mat3=Q.mat2d=Q.mat2=Q.glMatrix=void 0;var i=p(et());Q.glMatrix=i;var r=p(function(){if(ei)return en;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}ei=1,Object.defineProperty(en,"__esModule",{value:!0}),en.create=function(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},en.clone=function(e){var r=new i.ARRAY_TYPE(4);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},en.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},en.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},en.fromValues=function(e,r,a,n){var o=new i.ARRAY_TYPE(4);return o[0]=e,o[1]=r,o[2]=a,o[3]=n,o},en.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},en.transpose=function(e,i){if(e===i){var r=i[1];e[1]=i[2],e[2]=r}else e[0]=i[0],e[1]=i[2],e[2]=i[1],e[3]=i[3];return e},en.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*o-n*a;return s?(e[0]=o*(s=1/s),e[1]=-a*s,e[2]=-n*s,e[3]=r*s,e):null},en.adjoint=function(e,i){var r=i[0];return e[0]=i[3],e[1]=-i[1],e[2]=-i[2],e[3]=r,e},en.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},en.multiply=a,en.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);
1return e[0]=a*h+o*l,e[1]=n*h+s*l,e[2]=-(a*l)+o*h,e[3]=-(n*l)+s*h,e},en.scale=function(e,i,r){var a=i[1],n=i[2],o=i[3],s=r[0],l=r[1];return e[0]=i[0]*s,e[1]=a*s,e[2]=n*l,e[3]=o*l,e},en.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=-r,e[3]=a,e},en.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e},en.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},en.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},en.LDU=function(e,i,r,a){return e[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-e[2]*r[1],[e,i,r]},en.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e},en.subtract=n,en.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},en.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=r[0],h=r[1],u=r[2],c=r[3];return Math.abs(a-l)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-h)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(o-u)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(s-c)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))},en.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e},en.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e},en.sub=en.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,n&&n.set(i,o),o}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*l+o*h,e[1]=n*l+s*h,e[2]=a*u+o*c,e[3]=n*u+s*c,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e}return en.mul=a,en.sub=n,en}());Q.mat2=r;var a=p(function(){if(er)return eo;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}er=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.create=function(){var e=new i.ARRAY_TYPE(6);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},eo.clone=function(e){var r=new i.ARRAY_TYPE(6);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r},eo.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e},eo.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},eo.fromValues=function(e,r,a,n,o,s){var l=new i.ARRAY_TYPE(6);return l[0]=e,l[1]=r,l[2]=a,l[3]=n,l[4]=o,l[5]=s,l},eo.set=function(e,i,r,a,n,o,s){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e},eo.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=r*o-a*n;return h?(e[0]=o*(h=1/h),e[1]=-a*h,e[2]=-n*h,e[3]=r*h,e[4]=(n*l-o*s)*h,e[5]=(a*s-r*l)*h,e):null},eo.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},eo.multiply=a,eo.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=Math.sin(r),c=Math.cos(r);return e[0]=a*c+o*u,e[1]=n*c+s*u,e[2]=-(a*u)+o*c,e[3]=-(n*u)+s*c,e[4]=l,e[5]=h,e},eo.scale=function(e,i,r){var a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=r[0],u=r[1];return e[0]=i[0]*h,e[1]=a*h,e[2]=n*u,e[3]=o*u,e[4]=s,e[5]=l,e},eo.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=r[0],c=r[1];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=a*u+o*c+l,e[5]=n*u+s*c+h,e},eo.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=-r,e[3]=a,e[4]=0,e[5]=0,e},eo.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e[4]=0,e[5]=0,e},eo.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=i[0],e[5]=i[1],e},eo.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},eo.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},eo.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e},eo.subtract=n,eo.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e},eo.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e},eo.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]},eo.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=e[4],h=e[5],u=r[0],c=r[1],d=r[2],p=r[3],f=r[4],m=r[5];return Math.abs(a-u)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(n-c)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(o-d)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(s-p)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(l-f)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(f))&&Math.abs(h-m)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(m))},eo.sub=eo.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,n&&n.set(i,o),o}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=r[0],c=r[1],d=r[2],p=r[3],f=r[4],m=r[5];return e[0]=a*u+o*c,e[1]=n*u+s*c,e[2]=a*d+o*p,e[3]=n*d+s*p,e[4]=a*f+o*m+l,e[5]=n*f+s*m+h,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e}return eo.mul=a,eo.sub=n,eo}());Q.mat2d=a;var n=p(el());Q.mat3=n;var o=p(ec());Q.mat4=o;var s=p(ev());Q.quat=s;var l=p(function(){if(eb)return eI;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}eb=1,Object.defineProperty(eI,"__esModule",{value:!0}),eI.create=function(){var e=new i.ARRAY_TYPE(8);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0),e[3]=1,e},eI.clone=function(e){var r=new i.ARRAY_TYPE(8);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r},eI.fromValues=function(e,r,a,n,o,s,l,h){var u=new i.ARRAY_TYPE(8);return u[0]=e,u[1]=r,u[2]=a,u[3]=n,u[4]=o,u[5]=s,u[6]=l,u[7]=h,u},eI.fromRotationTranslationValues=function(e,r,a,n,o,s,l){var h=new i.ARRAY_TYPE(8);h[0]=e,h[1]=r,h[2]=a,h[3]=n;var u=.5*o,c=.5*s,d=.5*l;return h[4]=u*n+c*a-d*r,h[5]=c*n+d*e-u*a,h[6]=d*n+u*r-c*e,h[7]=-u*e-c*r-d*a,h},eI.fromRotationTranslation=s,eI.fromTranslation=function(e,i){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*i[0],e[5]=.5*i[1],e[6]=.5*i[2],e[7]=0,e},eI.fromRotation=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},eI.fromMat4=function(e,n){var o=r.create();a.getRotation(o,n);var l=new i.ARRAY_TYPE(3);return a.getTranslation(l,n),s(e,o,l),e},eI.copy=l,eI.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},eI.set=function(e,i,r,a,n,o,s,l,h){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e},eI.getDual=function(e,i){return e[0]=i[4],e[1]=i[5],e[2]=i[6],e[3]=i[7],e},eI.setDual=function(e,i){return e[4]=i[0],e[5]=i[1],e[6]=i[2],e[7]=i[3],e},eI.getTranslation=function(e,i){var r=i[4],a=i[5],n=i[6],o=i[7],s=-i[0],l=-i[1],h=-i[2],u=i[3];return e[0]=2*(r*u+o*s+a*h-n*l),e[1]=2*(a*u+o*l+n*s-r*h),e[2]=2*(n*u+o*h+r*l-a*s),e},eI.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=.5*r[0],h=.5*r[1],u=.5*r[2],c=i[4],d=i[5],p=i[6],f=i[7];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=s*l+n*u-o*h+c,e[5]=s*h+o*l-a*u+d,e[6]=s*u+a*h-n*l+p,e[7]=-a*l-n*h-o*u+f,e},eI.rotateX=function(e,i,a){var n=-i[0],o=-i[1],s=-i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=h*l+d*n+u*s-c*o,f=u*l+d*o+c*n-h*s,m=c*l+d*s+h*o-u*n,_=d*l-h*n-u*o-c*s;
1return r.rotateX(e,i,a),e[4]=p*(l=e[3])+_*(n=e[0])+f*(s=e[2])-m*(o=e[1]),e[5]=f*l+_*o+m*n-p*s,e[6]=m*l+_*s+p*o-f*n,e[7]=_*l-p*n-f*o-m*s,e},eI.rotateY=function(e,i,a){var n=-i[0],o=-i[1],s=-i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=h*l+d*n+u*s-c*o,f=u*l+d*o+c*n-h*s,m=c*l+d*s+h*o-u*n,_=d*l-h*n-u*o-c*s;return r.rotateY(e,i,a),e[4]=p*(l=e[3])+_*(n=e[0])+f*(s=e[2])-m*(o=e[1]),e[5]=f*l+_*o+m*n-p*s,e[6]=m*l+_*s+p*o-f*n,e[7]=_*l-p*n-f*o-m*s,e},eI.rotateZ=function(e,i,a){var n=-i[0],o=-i[1],s=-i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=h*l+d*n+u*s-c*o,f=u*l+d*o+c*n-h*s,m=c*l+d*s+h*o-u*n,_=d*l-h*n-u*o-c*s;return r.rotateZ(e,i,a),e[4]=p*(l=e[3])+_*(n=e[0])+f*(s=e[2])-m*(o=e[1]),e[5]=f*l+_*o+m*n-p*s,e[6]=m*l+_*s+p*o-f*n,e[7]=_*l-p*n-f*o-m*s,e},eI.rotateByQuatAppend=function(e,i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=i[0],h=i[1],u=i[2],c=i[3];return e[0]=l*s+c*a+h*o-u*n,e[1]=h*s+c*n+u*a-l*o,e[2]=u*s+c*o+l*n-h*a,e[3]=c*s-l*a-h*n-u*o,e[4]=(l=i[4])*s+(c=i[7])*a+(h=i[5])*o-(u=i[6])*n,e[5]=h*s+c*n+u*a-l*o,e[6]=u*s+c*o+l*n-h*a,e[7]=c*s-l*a-h*n-u*o,e},eI.rotateByQuatPrepend=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*c+s*l+n*u-o*h,e[1]=n*c+s*h+o*l-a*u,e[2]=o*c+s*u+a*h-n*l,e[3]=s*c-a*l-n*h-o*u,e[4]=a*(c=r[7])+s*(l=r[4])+n*(u=r[6])-o*(h=r[5]),e[5]=n*c+s*h+o*l-a*u,e[6]=o*c+s*u+a*h-n*l,e[7]=s*c-a*l-n*h-o*u,e},eI.rotateAroundAxis=function(e,r,a,n){if(Math.abs(n)<i.EPSILON)return l(e,r);var o=Math.hypot(a[0],a[1],a[2]),s=Math.sin(n*=.5),h=s*a[0]/o,u=s*a[1]/o,c=s*a[2]/o,d=Math.cos(n),p=r[0],f=r[1],m=r[2],_=r[3];e[0]=p*d+_*h+f*c-m*u,e[1]=f*d+_*u+m*h-p*c,e[2]=m*d+_*c+p*u-f*h,e[3]=_*d-p*h-f*u-m*c;var g=r[4],y=r[5],x=r[6],v=r[7];return e[4]=g*d+v*h+y*c-x*u,e[5]=y*d+v*u+x*h-g*c,e[6]=x*d+v*c+g*u-y*h,e[7]=v*d-g*h-y*u-x*c,e},eI.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e},eI.multiply=h,eI.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e},eI.lerp=function(e,i,r,a){var n=1-a;return 0>u(i,r)&&(a=-a),e[0]=i[0]*n+r[0]*a,e[1]=i[1]*n+r[1]*a,e[2]=i[2]*n+r[2]*a,e[3]=i[3]*n+r[3]*a,e[4]=i[4]*n+r[4]*a,e[5]=i[5]*n+r[5]*a,e[6]=i[6]*n+r[6]*a,e[7]=i[7]*n+r[7]*a,e},eI.invert=function(e,i){var r=d(i);return e[0]=-i[0]/r,e[1]=-i[1]/r,e[2]=-i[2]/r,e[3]=i[3]/r,e[4]=-i[4]/r,e[5]=-i[5]/r,e[6]=-i[6]/r,e[7]=i[7]/r,e},eI.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e[4]=-i[4],e[5]=-i[5],e[6]=-i[6],e[7]=i[7],e},eI.normalize=function(e,i){var r=d(i);if(r>0){r=Math.sqrt(r);var a=i[0]/r,n=i[1]/r,o=i[2]/r,s=i[3]/r,l=i[4],h=i[5],u=i[6],c=i[7],p=a*l+n*h+o*u+s*c;e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=(l-a*p)/r,e[5]=(h-n*p)/r,e[6]=(u-o*p)/r,e[7]=(c-s*p)/r}return e},eI.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},eI.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]},eI.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=e[4],h=e[5],u=e[6],c=e[7],d=r[0],p=r[1],f=r[2],m=r[3],_=r[4],g=r[5],y=r[6],x=r[7];return Math.abs(a-d)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(n-p)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(o-f)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-m)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-_)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(h-g)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(g))&&Math.abs(u-y)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-x)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(x))},eI.sqrLen=eI.squaredLength=eI.len=eI.length=eI.dot=eI.mul=eI.setReal=eI.getReal=void 0;var i=o(et()),r=o(ev()),a=o(ec());function n(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:i})(e)}function o(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=n(r);if(a&&a.has(i))return a.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,a&&a.set(i,o),o}function s(e,i,r){var a=.5*r[0],n=.5*r[1],o=.5*r[2],s=i[0],l=i[1],h=i[2],u=i[3];return e[0]=s,e[1]=l,e[2]=h,e[3]=u,e[4]=a*u+n*h-o*l,e[5]=n*u+o*s-a*h,e[6]=o*u+a*l-n*s,e[7]=-a*s-n*l-o*h,e}function l(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e}function h(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[4],h=r[5],u=r[6],c=r[7],d=i[4],p=i[5],f=i[6],m=i[7],_=r[0],g=r[1],y=r[2],x=r[3];return e[0]=a*x+s*_+n*y-o*g,e[1]=n*x+s*g+o*_-a*y,e[2]=o*x+s*y+a*g-n*_,e[3]=s*x-a*_-n*g-o*y,e[4]=a*c+s*l+n*u-o*h+d*x+m*_+p*y-f*g,e[5]=n*c+s*h+o*l-a*u+p*x+m*g+f*_-d*y,e[6]=o*c+s*u+a*h-n*l+f*x+m*y+d*g-p*_,e[7]=s*c-a*l-n*h-o*u+m*x-d*_-p*g-f*y,e}eI.getReal=r.copy,eI.setReal=r.copy,eI.mul=h;var u=r.dot;eI.dot=u;var c=r.length;eI.length=c,eI.len=c;var d=r.squaredLength;return eI.squaredLength=d,eI.sqrLen=d,eI}());Q.quat2=l;var h=p(function(){if(ew)return eC;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}ew=1,Object.defineProperty(eC,"__esModule",{value:!0}),eC.create=a,eC.clone=function(e){var r=new i.ARRAY_TYPE(2);return r[0]=e[0],r[1]=e[1],r},eC.fromValues=function(e,r){var a=new i.ARRAY_TYPE(2);return a[0]=e,a[1]=r,a},eC.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e}
1,eC.set=function(e,i,r){return e[0]=i,e[1]=r,e},eC.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e},eC.subtract=n,eC.multiply=o,eC.divide=s,eC.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e},eC.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e},eC.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e},eC.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e},eC.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e},eC.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e},eC.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e},eC.distance=l,eC.squaredDistance=h,eC.length=u,eC.squaredLength=c,eC.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e},eC.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e},eC.normalize=function(e,i){var r=i[0],a=i[1],n=r*r+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=i[0]*n,e[1]=i[1]*n,e},eC.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]},eC.cross=function(e,i,r){var a=i[0]*r[1]-i[1]*r[0];return e[0]=e[1]=0,e[2]=a,e},eC.lerp=function(e,i,r,a){var n=i[0],o=i[1];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e},eC.random=function(e,r){r=r||1;var a=2*i.RANDOM()*Math.PI;return e[0]=Math.cos(a)*r,e[1]=Math.sin(a)*r,e},eC.transformMat2=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[2]*n,e[1]=r[1]*a+r[3]*n,e},eC.transformMat2d=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[2]*n+r[4],e[1]=r[1]*a+r[3]*n+r[5],e},eC.transformMat3=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[3]*n+r[6],e[1]=r[1]*a+r[4]*n+r[7],e},eC.transformMat4=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[4]*n+r[12],e[1]=r[1]*a+r[5]*n+r[13],e},eC.rotate=function(e,i,r,a){var n=i[0]-r[0],o=i[1]-r[1],s=Math.sin(a),l=Math.cos(a);return e[0]=n*l-o*s+r[0],e[1]=n*s+o*l+r[1],e},eC.angle=function(e,i){var r=e[0],a=e[1],n=i[0],o=i[1],s=Math.sqrt(r*r+a*a)*Math.sqrt(n*n+o*o);return Math.acos(Math.min(Math.max(s&&(r*n+a*o)/s,-1),1))},eC.zero=function(e){return e[0]=0,e[1]=0,e},eC.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},eC.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]},eC.equals=function(e,r){var a=e[0],n=e[1],o=r[0],s=r[1];return Math.abs(a-o)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(o))&&Math.abs(n-s)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))},eC.forEach=eC.sqrLen=eC.sqrDist=eC.dist=eC.div=eC.mul=eC.sub=eC.len=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,n&&n.set(i,o),o}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(){var e=new i.ARRAY_TYPE(2);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e}function o(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e}function s(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e}function l(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1])}function h(e,i){var r=i[0]-e[0],a=i[1]-e[1];return r*r+a*a}function u(e){return Math.hypot(e[0],e[1])}function c(e){var i=e[0],r=e[1];return i*i+r*r}eC.len=u,eC.sub=n,eC.mul=o,eC.div=s,eC.dist=l,eC.sqrDist=h,eC.sqrLen=c;var d,p=(d=a(),function(e,i,r,a,n,o){var s,l;for(i||(i=2),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)d[0]=e[s],d[1]=e[s+1],n(d,d,o),e[s]=d[0],e[s+1]=d[1];return e});return eC.forEach=p,eC}());Q.vec2=h;var u=p(em());Q.vec3=u;var c=p(ex());function d(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:i})(e)}function p(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=d(r);if(a&&a.has(i))return a.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,a&&a.set(i,n),n}return Q.vec4=c,Q}(),ez=K(function(){if(eM)return eS;function e(e,i,r,a){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=a}return eM=1,eS=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(void 0===i&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,a=0;a<8;a++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<i)return r;var o=this.sampleCurveDerivativeX(r);if(1e-6>Math.abs(o))break;r-=n/o}var s=0,l=1;for(r=e,a=0;a<20&&!(Math.abs((n=this.sampleCurveX(r))-e)<i);a++)e>n?s=r:l=r,r=.5*(l-s)+s;return r}
1,solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},eS}());function eD(){if(eA)return eE;function e(e,i){this.x=e,this.y=i}return eA=1,eE=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,i){return this.clone()._rotateAround(e,i)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var i=e.x-this.x,r=e.y-this.y;return i*i+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,i){return Math.atan2(this.x*i-this.y*e,this.x*e+this.y*i)},_matMult:function(e){var i=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var i=Math.cos(e),r=Math.sin(e),a=r*this.x+i*this.y;return this.x=i*this.x-r*this.y,this.y=a,this},_rotateAround:function(e,i){var r=Math.cos(e),a=Math.sin(e),n=i.y+a*(this.x-i.x)+r*(this.y-i.y);return this.x=i.x+r*(this.x-i.x)-a*(this.y-i.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(i){return i instanceof e?i:Array.isArray(i)?new e(i[0],i[1]):i},eE}var eR=K(eD());function eL(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!eL(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i||Object.keys(e).length!==Object.keys(i).length)return!1;for(let r in e)if(!eL(e[r],i[r]))return!1;return!0}return e===i}let eO=Math.PI/180,ek=180/Math.PI,eF=[[0,0],[1,0],[1,1],[0,1]];function eB(e){if(e<=0)return 0;if(e>=1)return 1;let i=e*e,r=i*e;return 4*(e<.5?r:3*(e-i)+r-.75)}function eN(e,i,r,a){let n=new ez(e,i,r,a);return function(e){return n.solve(e)}}let eV=eN(.25,.1,.25,1);function eU(e,i,r){return Math.min(r,Math.max(i,e))}function ej(e,i,r){return(r=eU((r-e)/(i-e),0,1))*r*(3-2*r)}function eG(e,i,r){let a=r-i,n=((e-i)%a+a)%a+i;return n===i?r:n}function eq(e,i,r){if(!e.length)return r(null,[]);let a=e.length,n=Array(e.length),o=null;e.forEach((e,s)=>{i(e,(e,i)=>{e&&(o=e),n[s]=i,0==--a&&r(o,n)})})}function eZ(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}let eH=1;function e$(){return eH++}function eW(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function eX(e,i){e.forEach(e=>{i[e]&&(i[e]=i[e].bind(i))})}function eY(e,i){return -1!==e.indexOf(i,e.length-i.length)}function eK(e,i,r){let a={};for(let r in e)a[r]=i.call(this,e[r],r,e);return a}function eJ(e,i,r){let a={};for(let r in e)i.call(this,e[r],r,e)&&(a[r]=e[r]);return a}function eQ(e){return Array.isArray(e)?e.map(eQ):"object"==typeof e&&e?eK(e,eQ):e}let e0={};function e1(e){e0[e]||("undefined"!=typeof console&&console.warn(e),e0[e]=!0)}function e2(e,i,r){return(r.y-e.y)*(i.x-e.x)>(i.y-e.y)*(r.x-e.x)}function e3([e,i,r]){let a=(i+90)*eO,n=r*eO;return{x:e*Math.cos(a)*Math.sin(n),y:e*Math.sin(a)*Math.sin(n),z:e*Math.cos(n),azimuthal:i,polar:r}}function e4(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function e5(e){let i={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,a,n)=>{let o=a||n;return i[r]=!o||o.toLowerCase(),""}),i["max-age"]){let e=parseInt(i["max-age"],10);isNaN(e)?delete i["max-age"]:i["max-age"]=e}return i}let e6=null;function e8(e,i){return[e[4*i],e[4*i+1],e[4*i+2],e[4*i+3]]}function e9(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<a?i=n+1:r=n}return i}function e7(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<=a?i=n+1:r=n}return i}function te(e){return e>0?1/(1.001-e):1+e}function tt(e){return e>0?1-1/(1.001-e):-e}let ti={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!ti.API_URL)return null;try{let e=new URL(ti.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MES
1HOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function tr(e){return ti.API_URL_REGEX.test(e)}function ta(e){return ti.API_SPRITE_REGEX.test(e)}function tn(){return null==i&&(i=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),i}let to={now:()=>void 0!==n?n:performance.now(),setNow(e){n=e},restoreNow(){n=void 0},frame(e){let i=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(i)}},getImageData(e,i=0){let{width:r,height:a}=e;o||(o=document.createElement("canvas"));let n=o.getContext("2d",{willReadFrequently:!0});if(!n)throw Error("failed to create canvas 2d context");return(r>o.width||a>o.height)&&(o.width=r,o.height=a),n.clearRect(-i,-i,r+2*i,a+2*i),n.drawImage(e,0,0,r,a),n.getImageData(-i,-i,r+2*i,a+2*i)},resolveURL:e=>(r||(r=document.createElement("a")),r.href=e,r.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==a&&(a=window.matchMedia("(prefers-reduced-motion: reduce)")),a.matches)},hasCanvasFingerprintNoise(){if(void 0!==s)return s;if(!tn())return s=!1,!1;let e=new OffscreenCanvas(85,1),i=e.getContext("2d",{willReadFrequently:!0}),r=0;for(let a=0;a<e.width;++a)i.fillStyle=`rgba(${r++},${r++},${r++}, 255)`,i.fillRect(a,0,1,1);let a=i.getImageData(0,0,e.width,e.height);r=0;for(let e=0;e<a.data.length;++e)if(e%4!=3&&r++!==a.data[e])return s=!0,!0;return s=!1,!1}};function ts(e,i){let r=e.indexOf("?");if(r<0)return`${e}?${new URLSearchParams(i).toString()}`;let a=new URLSearchParams(e.slice(r));for(let e in i)a.set(e,i[e]);return`${e.slice(0,r)}?${a.toString()}`}
1function tl(e,i={persistentParams:[]}){let r=e.indexOf("?");if(r<0)return e;let a=new URLSearchParams,n=new URLSearchParams(e.slice(r));for(let e of i.persistentParams){let i=n.get(e);i&&a.set(e,i)}let o=a.toString();return`${e.slice(0,r)}${o.length>0?`?${o}`:""}`}let th="mapbox-tiles",tu=500,tc=50,td=["language","worldview","jobid"];function tp(){try{return caches}catch(e){}}function tf(){let e=tp();e&&null==l&&(l=e.open(th))}let tm=1/0,t_={supported:!1,testSupport:function(e){!tx&&ty&&(tv?tw(e):tg=e)}},tg,ty,tx=!1,tv=!1,tb="undefined"!=typeof self?self:{};function tw(e){let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,ty),e.isContextLost())return;t_.supported=!0}catch(e){}e.deleteTexture(i),tx=!0}tb.document&&((ty=tb.document.createElement("img")).onload=function(){tg&&tw(tg),tg=null,tv=!0},ty.onerror=function(){tx=!0,tg=null},ty.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let tT={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(tT);class tS extends Error{constructor(e,i,r){401===i&&tr(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let tM=e4()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,tE=function(e,i){var r;if(!(/^file:/.test(r=e.url)||/^file:/.test(tM())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,i){var r;let a=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:tM(),referrerPolicy:e.referrerPolicy,signal:a.signal}),o=!1,s=!1,u=(r=n.url).indexOf("sku=")>0&&tr(r);"json"===e.type&&n.headers.set("Accept","application/json");let c=(r,a,o)=>
1{if(s)return;if(r&&"SecurityError"!==r.message&&e1(r.toString()),a&&o)return d(a);let l=Date.now();fetch(n).then(r=>{if(r.ok){let e=u?r.clone():null;return d(r,e,l)}return i(new tS(r.statusText,r.status,e.url))}).catch(r=>{"AbortError"!==r.name&&i(Error(`${r.message} ${e.url}`))})},d=(r,a,u)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then(e=>{s||(a&&u&&function(e,i,r){if(tf(),null==l)return;let a=e5(i.headers.get("Cache-Control")||"");if(a["no-store"])return;let n={status:i.status,statusText:i.statusText,headers:new Headers};i.headers.forEach((e,i)=>n.headers.set(i,e)),a["max-age"]&&n.headers.set("Expires",new Date(r+1e3*a["max-age"]).toUTCString());let o=n.headers.get("Expires");if(!o||new Date(o).getTime()-r<42e4)return;let s=tl(e.url,{persistentParams:td});if(206===i.status){let i=e.headers.get("Range");if(!i)return;n.status=200,s=ts(s,{range:i})}!function(e,i){if(void 0===h)try{new Response(new ReadableStream),h=!0}catch(e){h=!1}h?i(e.body):e.blob().then(i)}(i,e=>{var r;let a=new Response(200!==(r=i.status)&&404!==r&&[101,103,204,205,304].includes(r)?null:e,n);tf(),null!=l&&l.then(e=>e.put(s,a)).catch(e=>e1(e.message))})}(n,a,u),o=!0,i(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))}).catch(e=>{s||i(Error(e.message))})};return u?function(e,i){if(tf(),null==l)return i(null);l.then(r=>
1{let a=tl(e.url,{persistentParams:td}),n=e.headers.get("Range");n&&(a=ts(a,{range:n})),r.match(a).then(e=>{let n=function(e){if(!e)return!1;let i=new Date(e.headers.get("Expires")||0),r=e5(e.headers.get("Cache-Control")||"");return i>Date.now()&&!r["no-cache"]}(e);r.delete(a),n&&r.put(a,e.clone()),i(null,e,n)}).catch(i)}).catch(i)}(n,c):c(null,null),{cancel:()=>{s=!0,o||a.abort()}}}(e,i);if(e4()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,i,void 0,!0)}return function(e,i){let r=new XMLHttpRequest;for(let i in r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer"),e.headers)r.setRequestHeader(i,e.headers[i]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{i(Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let a=r.response;if("json"===e.type)try{a=JSON.parse(r.response)}catch(e){return i(e)}i(null,a,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else i(new tS(r.statusText,r.status,e.url))},r.send(e.body),{cancel:()=>r.abort()}}(e,i)},tA=function(e,i){return tE(eZ(e,{type:"arrayBuffer"}),i)},tI="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";u=[],c=0;let tC=function(e,i){if(t_.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),c>=ti.MAX_PARALLEL_IMAGE_REQUESTS){let r={requestParameters:e,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return u.push(r),r}c++;let r=!1,a=()=>{if(!r)for(r=!0,c--;u.length&&c<ti.MAX_PARALLEL_IMAGE_REQUESTS;){let e=u.shift(),{requestParameters:i,callback:r,cancelled:a}=e;a||(e.cancel=tC(i,r).cancel)}},n=tA(e,(e,r,n,o)=>{a(),e?i(e):r&&(self.createImageBitmap?function(e,i){createImageBitmap(new Blob([new Uint8Array(e)],{type:"image/png"})).then(e=>{i(null,e)}).catch(e=>{i(Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(r,(e,r)=>i(e,r,n,o)):function(e,i){let r=new Image;r.onload=()=>{i(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame(()=>{r.src=tI})},r.onerror=()=>i(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."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(a):tI}(r,(e,r)=>i(e,r,n,o)))});return{cancel:()=>{n.cancel(),a()}}};var tP,tz,tD,tR={exports:{}},tL={exports:{}},tO={exports:{}},tk=K(function(){if(tD)return tR.exports;tD=1;var e=(tP||(tP=1,tL.exports=function(e,i){var r,a,n,o,s,l;for(a=e.length-(r=3&e.length),n=i,l=0;l<a;)s=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,n=27492+(65535&(o=5*(65535&(n=(n^=s=(65535&(s=(s=(65535&s)*3432918353+(((s>>>16)*3432918353&65535)<<16)&4294967295)<<15|s>>>17))*461845907+(((s>>>16)*461845907&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(s=0,r){case 3:s^=(255&e.charCodeAt(l+2))<<16;case 2:s^=(255&e.charCodeAt(l+1))<<8;case 1:n^=s=(65535&(s=(s=(65535&(s^=255&e.charCodeAt(l)))*3432918353+(((s>>>16)*3432918353&65535)<<16)&4294967295)<<15|s>>>17))*461845907+(((s>>>16)*461845907&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),tL.exports),i=(tz||(tz=1,tO.exports=function(e,i){for(var r,a=e.length,n=i^a,o=0;a>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++o;switch(a){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),tO.exports);return tR.exports=e,tR.exports.murmur3=e,tR.exports.murmur2=i,tR.exports}());class tF{constructor(e,...i){eZ(this,i[0]||{}),this.type=e}}class tB extends tF{constructor(e,i={}){super("error",eZ({error:e},i))}}function tN(e,i,r){r[e]&&-1!==r[e].indexOf(i)||(r[e]=r[e]||[],r[e].push(i))}function tV(e,i,r){if(r&&r[e]){let a=r[e].indexOf(i);-1!==a&&r[e].splice(a,1)}}class tU{on(e,i){return this._listeners=this._listeners||{},tN(e,i,this._listeners),this}off(e,i){return tV(e,i,this._listeners),tV(e,i,this._oneTimeListeners),this}
1once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},tN(e,i,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,i){let r="string"==typeof e?new tF(e,i):e,a=r.type;if(this.listens(a)){for(let e of(r.target=this,this._listeners&&this._listeners[a]?this._listeners[a].slice():[]))e.call(this,r);for(let e of this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[])tV(a,e,this._oneTimeListeners),e.call(this,r);let e=this._eventedParent;e&&(eZ(r,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),e.fire(r))}else r instanceof tB&&console.error(r.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var tj,tG={},tq=function(){if(tj)return tG;tj=1;var e={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(e){return(e=Math.round(e))<0?0:e>255?255:e}function r(e){return i("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function a(e){var i;return(i="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:i>1?1:i}function n(e,i,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(i-e)*r*6:2*r<1?i:3*r<2?e+(i-e)*(2/3-r)*6:e}try{tG.parseCSSColor=function(o){var s,l=o.replace(/ /g,"").toLowerCase();if(l in e)return e[l].slice();if("#"===l[0])return 4===l.length?(s=parseInt(l.substr(1),16))>=0&&s<=4095?[(3840&s)>>4|(3840&s)>>8,240&s|(240&s)>>4,15&s|(15&s)<<4,1]:null:7===l.length&&(s=parseInt(l.substr(1),16))>=0&&s<=16777215?[(16711680&s)>>16,(65280&s)>>8,255&s,1]:null;var h=l.indexOf("("),u=l.indexOf(")");if(-1!==h&&u+1===l.length){var c=l.substr(0,h),d=l.substr(h+1,u-(h+1)).split(","),p=1;switch(c){case"rgba":if(4!==d.length)break;p=a(d.pop());case"rgb":return 3!==d.length?null:[r(d[0]),r(d[1]),r(d[2]),p];case"hsla":if(4!==d.length)break;p=a(d.pop());case"hsl":if(3!==d.length)break;var f=(parseFloat(d[0])%360+360)%360/360,m=a(d[1]),_=a(d[2]),g=_<=.5?_*(m+1):_+m-_*m,y=2*_-g;return[i(255*n(y,g,f+1/3)),i(255*n(y,g,f)),i(255*n(y,g,f-1/3)),p]}}return null}}catch(e){}return tG}();class tZ{constructor(e,i,r,a=1){this.r=e,this.g=i,this.b=r,this.a=a}static parse(e){if(!e)return;if(e instanceof tZ)return e;if("string"!=typeof e)return;let i=tq.parseCSSColor(e);return i?new tZ(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toStringPremultipliedAlpha(){let[e,i,r,a]=0===this.a?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(r)},${a})`}toString(){let[e,i,r,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*r)},${a})`}toRenderColor(e){let{r:i,g:r,b:a,a:n}=this;return new tH(e,i,r,a,n)}clone(){return new tZ(this.r,this.g,this.b,this.a)}}class tH{constructor(e,i,r,a,n){if(e){let o=e.image.height,s=o*o;i=0===n?0:i/n*(o-1),r=0===n?0:r/n*(o-1),a=0===n?0:a/n*(o-1);let l=Math.floor(i),h=Math.floor(r),u=Math.floor(a),c=Math.ceil(i),d=Math.ceil(r),p=Math.ceil(a),f=i-l,m=r-h,_=a-u,g=e.image.data,y=4*(l+h*s+u*o),x=4*(l+h*s+p*o),v=4*(l+d*s+u*o),b=4*(l+d*s+p*o),w=4*(c+h*s+u*o),T=4*(c+h*s+p*o),S=4*(c+d*s+u*o),M=4*(c+d*s+p*o);if(y<0||M>=g.length)throw Error("out of range");this.r=t$(t$(t$(g[y],g[x],_),t$(g[v],g[b],_),m),t$(t$(g[w],g[T],_),t$(g[S],g[M],_),m),f)/255*n,this.g=t$(t$(t$(g[y+1],g[x+1],_),t$(g[v+1],g[b+1],_),m),t$(t$(g[w+1],g[T+1],_),t$(g[S+1],g[M+1],_),m),f)/255*n,this.b=t$(t$(t$(g[y+2],g[x+2],_),t$(g[v+2],g[b+2],_),m),t$(t$(g[w+2],g[T+2],_),t$(g[S+2],g[M+2],_),m),f)/255*n,this.a=n}
1else this.r=i,this.g=r,this.b=a,this.a=n}toArray(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[255*e/a,255*i/a,255*r/a,a]}toHslaArray(){if(0===this.a)return[0,0,0,0];let{r:e,g:i,b:r,a:a}=this,n=Math.min(Math.max(e/a,0),1),o=Math.min(Math.max(i/a,0),1),s=Math.min(Math.max(r/a,0),1),l=Math.min(n,o,s),h=Math.max(n,o,s),u=(l+h)/2;if(l===h)return[0,0,100*u,a];let c=h-l,d=0;return h===n?d=(o-s)/c+(o<s?6:0):h===o?d=(s-n)/c+2:h===s&&(d=(n-o)/c+4),[Math.min(Math.max(d*=60,0),360),Math.min(Math.max(100*(u>.5?c/(2-h-l):c/(h+l)),0),100),Math.min(Math.max(100*u,0),100),a]}toArray01(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[e/a,i/a,r/a,a]}toArray01Scaled(e){let{r:i,g:r,b:a,a:n}=this;return 0===n?[0,0,0]:[i/n*e,r/n*e,a/n*e]}toArray01PremultipliedAlpha(){let{r:e,g:i,b:r,a:a}=this;return[e,i,r,a]}toArray01Linear(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[Math.pow(e/a,2.2),Math.pow(i/a,2.2),Math.pow(r/a,2.2),a]}}function t$(e,i,r){return e*(1-r)+i*r}function tW(e,i,r){return e.map((e,a)=>t$(e,i[a],r))}tZ.black=new tZ(0,0,0,1),tZ.white=new tZ(1,1,1,1),tZ.transparent=new tZ(0,0,0,0),tZ.red=new tZ(1,0,0,1),tZ.blue=new tZ(0,0,1,1);var tX=Object.freeze({__proto__:null,array:tW,color:function(e,i,r){return new tZ(t$(e.r,i.r,r),t$(e.g,i.g,r),t$(e.b,i.b,r),t$(e.a,i.a,r))},number:t$});function tY(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}class tK extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class tJ{constructor(e,i=[]){for(let[r,a]of(this.parent=e,this.bindings={},i))this.bindings[r]=a}concat(e){return new tJ(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let tQ={kind:"null"},t0={kind:"number"},t1={kind:"string"},t2={kind:"boolean"},t3={kind:"color"},t4={kind:"object"},t5={kind:"value"},t6={kind:"collator"},t8={kind:"formatted"},t9={kind:"resolvedImage"};function t7(e,i){return{kind:"array",itemType:e,N:i}}function ie(e){if("array"===e.kind){let i=ie(e.itemType);return"number"==typeof e.N?`array<${i}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${i}>`}return e.kind}let it=[tQ,t0,t1,t2,t3,t8,t4,t7(t5),t9];function ii(e,i){if("error"===i.kind)return null;if("array"===e.kind){if("array"===i.kind&&(0===i.N&&"value"===i.itemType.kind||!ii(e.itemType,i.itemType))&&("number"!=typeof e.N||e.N===i.N))return null}else{if(e.kind===i.kind)return null;if("value"===e.kind){for(let e of it)if(!ii(e,i))return null}}return`Expected ${ie(e)} but found ${ie(i)} instead.`}function ir(e,i){return i.some(i=>i.kind===e.kind)}function ia(e,i){return i.some(i=>"null"===i?null===e:"array"===i?Array.isArray(e):"object"===i?e&&!Array.isArray(e)&&"object"==typeof e:i===typeof e)}class io{constructor(e,i,r){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class is{constructor(e,i,r,a,n){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=r,this.fontStack=a,this.textColor=n}}class il{constructor(e){this.sections=e}static fromString(e){return new il([new is(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&e.image.namePrimary)}static factory(e){return e instanceof il?e:il.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){let e=["format"];for(let i of this.sections){if(i.image){e.push(["image",i.image.namePrimary]);continue}e.push(i.text);let r={};i.fontStack&&(r["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(r["font-scale"]=i.scale),i.textColor&&(r["text-color"]=["rgba"].concat(i.textColor.toRenderColor(null).toArray())),e.push(r)}return e}}class ih{constructor(e,i){if(this.id=e,this.options=i||{params:{}},this.options.transform){let{a:e,b:i,c:r,d:a,e:n,f:o}=this.options.transform;this.options.transform=new DOMMatrix([e,i,r,a,n,o])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}static deserializeId(e){return JSON.parse(e).id}static deserializeFromString(e){let i=JSON.parse(e),{a:r,b:a,c:n,d:o,e:s,f:l}=i.options.transform;return new DOMMatrix([r,a,n,o,s,l]),new ih(i.id,i.options)}scaleSelf(e){return this.options.transform=this.options.transform.scale(e),this}
1serialize(){let e={id:this.id};this.options&&(e.options=this.options);let{a:i,b:r,c:a,d:n,e:o,f:s}=this.options.transform;return e.options.transform={a:i,b:r,c:a,d:n,e:o,f:s},JSON.stringify(e)}}class iu{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),e.optionsPrimary&&(this.optionsPrimary=e.optionsPrimary),e.optionsSecondary&&(this.optionsSecondary=e.optionsSecondary),this.available=e.available}toString(){return this.namePrimary&&this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}getPrimary(){return new ih(this.namePrimary,{params:this.optionsPrimary&&this.optionsPrimary.params||{}})}getSerializedPrimary(){return this.getPrimary().serialize()}getSecondary(){return this.nameSecondary?new ih(this.nameSecondary,{params:this.optionsSecondary&&this.optionsSecondary.params||{}}):null}static from(e){return"string"==typeof e?iu.build(e):e}static build(e,i,r,a){return e?new iu({namePrimary:e,nameSecondary:i,optionsPrimary:r,optionsSecondary:a,available:!1}):null}}function ic(e,i,r,a){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[e,i,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[e,i,r,a]:[e,i,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function id(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof tZ||e instanceof io||e instanceof il||e instanceof iu)return!0;if(Array.isArray(e)){for(let i of e)if(!id(i))return!1;return!0}if("object"==typeof e){for(let i in e)if(!id(e[i]))return!1;return!0}return!1}function ip(e){if(null===e)return tQ;if("string"==typeof e)return t1;if("boolean"==typeof e)return t2;if("number"==typeof e)return t0;if(e instanceof tZ)return t3;if(e instanceof io)return t6;if(e instanceof il)return t8;if(e instanceof iu)return t9;if(Array.isArray(e)){let i;let r=e.length;for(let r of e){let e=ip(r);if(i){if(i===e)continue;i=t5;break}i=e}return t7(i||t5,r)}return t4}function im(e){let i=typeof e;return null===e?"":"string"===i||"number"===i||"boolean"===i?String(e):e instanceof tZ?e.toStringPremultipliedAlpha():e instanceof il||e instanceof iu?e.toString():JSON.stringify(e)}class i_{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(2!==e.length)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!id(e[1]))return i.error("invalid value");let r=e[1],a=ip(r),n=i.expectedType;return"array"===a.kind&&0===a.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(a=n),new i_(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof tZ?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof il?this.value.serialize():this.value}}class ig{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}let iy={string:t1,number:t0,boolean:t2,object:t4};class ix{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r,a=1,n=e[0];if("array"===n){let n,o;if(e.length>2){let r=e[1];if("string"!=typeof r||!(r in iy)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);n=iy[r],a++}else n=t5;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);o=e[2],a++}r=t7(n,o)}else r=iy[n];let o=[];for(;a<e.length;a++){let r=i.parse(e[a],a,t5);if(!r)return null;o.push(r)}return new ix(r,o)}evaluate(e){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(e);if(!ii(this.type,ip(r)))return r;if(i===this.args.length-1)throw new ig(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${ie(ip(r))} but was expected to be of type ${ie(this.type)}.`)}return null}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=this.type,i=[e.kind];if("array"===e.kind){let r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){i.push(r.kind);let a=e.N;("number"==typeof a||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(e=>e.serialize()))}}class iv{constructor(e){this.type=t8,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");let a=[],n=!1;for(let r=1;r<=e.length-1;++r){let o=e[r];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&!(e=i.parseObjectValue(o["font-scale"],r,"font-scale",t0)))return null;let s=null;if(o["text-font"]&&!(s=i.parseObjectValue(o["text-font"],r,"text-font",t7(t1))))return null;let l=null;if(o["text-color"]&&!(l=i.parseObjectValue(o["text-color"],r,"text-color",t3)))return null;let h=a[a.length-1];h.scale=e,h.font=s,h.textColor=l}else{let o=i.parse(e[r],r,t5);if(!o)return null;let s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,a.push({content:o,scale:null,font:null,textColor:null})}}return new iv(a)}evaluate(e){return new il(this.sections.map(i=>{let r=i.content.evaluate(e);return ip(r)===t9?new is("",r,null,null,null):new is(im(r),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(let i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){let e=["format"];for(let i of this.sections){e.push(i.content.serialize());let r={};i.scale&&(r["font-scale"]=i.scale.serialize()),i.font&&(r["text-font"]=i.font.serialize()),i.textColor&&(r["text-color"]=i.textColor.serialize()),e.push(r)}return e}}class ib{constructor(e,i,r,a){this._imageWarnHistory={},this.type=t9,this.inputPrimary=e,this.inputSecondary=i,this.inputPrimaryParams=r,this.inputSecondaryParams=a}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let r=1,a=[];for(let n=0;n<2;n++)if(!function(){if(r<e.length){let n=i.parse(e[r],r++,t1);return n?(a.push({image:n,options:void 0}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}()||!function(){var n;if(r<e.length){if(null===(n=e[r])||"object"!=typeof n||Array.isArray(n))return!0;let o=e[r].params,s=i.concat(r);if(!o)return r++,!0;if("object"!=typeof o||o.constructor!==Object)return s.error('Image options "params" should be an object'),!1;let l={},h=s.concat(void 0,"params");for(let e in o){if(!e)return h.error("Image parameter name should be non-empty"),!1;let i=h.concat(void 0,e).parse(o[e],void 0,t3,void 0,{typeAnnotation:"coerce"});if(!i)return!1;l[e]=i}return a[a.length-1].options=l,r++,!0}return!0}())return;return new ib(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){let r={};if(i){for(let a in i)if(i[a])try{let n=i[a].evaluate(e),o=`Ignoring image parameter "${a}" with semi-transparent color ${n.toString()}`;if(1!==n.a){this._imageWarnHistory[o]||(console.warn(o),this._imageWarnHistory[o]=!0);continue}r[a]=n}catch(e){continue}if(0!==Object.keys(r).length)return{params:r}}}evaluate(e){let i=iu.build(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0,this.inputPrimaryParams?this.evaluateParams(e,this.inputPrimaryParams):void 0,this.inputSecondaryParams?this.evaluateParams(e,this.inputSecondaryParams):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){if(e(this.inputPrimary),this.inputPrimaryParams)for(let i in this.inputPrimaryParams)this.inputPrimaryParams[i]&&e(this.inputPrimaryParams[i]);if(this.inputSecondary&&(e(this.inputSecondary),this.inputSecondaryParams))for(let i in this.inputSecondaryParams)this.inputSecondaryParams[i]&&e(this.inputSecondaryParams[i])}outputDefined(){return!1}serializeParams(e){let i={};if(e){for(let r in e)e[r]&&(i[r]=e[r].serialize());return{params:i}}}serialize(){let e=["image",this.inputPrimary.serialize()];return this.inputPrimaryParams&&e.push(this.serializeParams(this.inputPrimaryParams)),this.inputSecondary&&(e.push(this.inputSecondary.serialize()),this.inputSecondaryParams&&e.push(this.serializeParams(this.inputSecondaryParams))),e}}function iw(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}let iT={"to-boolean":t2,"to-color":t3,"to-number":t0,"to-string":t1};class iS{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[0],a=[],n=tQ;if("to-array"===r){if(!Array.isArray(e[1]))return null;let r=e[1].length;if(i.expectedType){if("array"!==i.expectedType.kind)return i.error(`Expected ${i.expectedType.kind} but found array.`);n=t7(i.expectedType.itemType,r)}else{if(!(r>0&&id(e[1][0])))return null;n=t7(ip(e[1][0]),r)}for(let o=0;o<r;o++){let r;let s=e[1][o];if("array"===iw(s))r=i.parse(s,void 0,n.itemType);else{let e=iw(s);if(e!==n.itemType.kind)return i.error(`Expected ${n.itemType.kind} but found ${e}.`);r=i.registry.literal.parse(["literal",void 0===s?null:s],i)}if(!r)return null;a.push(r)}}else{if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return i.error("Expected one argument.");n=iT[r];for(let r=1;r<e.length;r++){let n=i.parse(e[r],r,t5);if(!n)return null;a.push(n)}}return new iS(n,a)}evaluate(e){if("boolean"===this.type.kind)return!!this.args[0].evaluate(e);if("color"===this.type.kind){let i,r;for(let a of this.args){if(i=a.evaluate(e),r=null,i instanceof tZ)return i;if("string"==typeof i){let r=e.parseColor(i);if(r)return r}else if(Array.isArray(i)&&!(r=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ic(i[0],i[1],i[2],i[3])))return new tZ(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new ig(r||`Could not parse color from value '${"string"==typeof i?i:String(JSON.stringify(i))}'`)}if("number"===this.type.kind){let i=null;for(let r of this.args){if(null===(i=r.evaluate(e)))return 0;let a=Number(i);if(!isNaN(a))return a}throw new ig(`Could not convert ${JSON.stringify(i)} to number.`)}return"formatted"===this.type.kind?il.fromString(im(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?iu.build(im(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(i=>i.evaluate(e)):im(this.args[0].evaluate(e))}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if("formatted"===this.type.kind)return new iv([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ib(this.args[0]).serialize();let e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}let iM=["Unknown","Point","LineString","Polygon"];class iE{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?iM[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:r,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=tZ.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class iA{constructor(e,i,r,a,n){this.name=e,this.type=i,this._evaluate=r,this.args=a,this._overloadIndex=n}evaluate(e){if(!this._evaluate){let e=iA.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){let r=e[0],a=iA.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,o=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,s=[],l=null,h=-1;for(let[a,u]of o){if(Array.isArray(a)&&a.length!==e.length-1)continue;s.push(a),h++,l=new rm(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);let o=[],c=!1;for(let i=1;i<e.length;i++){let r=e[i],n=Array.isArray(a)?a[i-1]:a.type,s=l.parse(r,1+o.length,n);if(!s){c=!0;break}o.push(s)}if(!c){if(Array.isArray(a)&&a.length!==o.length)l.error(`Expected ${a.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){let i=Array.isArray(a)?a[e]:a.type,r=o[e];l.concat(e+1).checkSubtype(i,r.type)}if(0===l.errors.length)return new iA(r,n,u,o,h)}}}if(1===s.length)i.errors.push(...l.errors);else{let r=(s.length?s:o.map(([e])=>e)).map(iI).join(" | "),a=[];for(let r=1;r<e.length;r++){let n=i.parse(e[r],1+a.length);if(!n)return null;a.push(ie(n.type))}i.error(`Expected arguments of type ${r}, but found (${a.join(", ")}) instead.`)}return null}static register(e,i){for(let r in iA.definitions=i,i)e[r]=iA}}function iI(e){return Array.isArray(e)?`(${e.map(ie).join(", ")})`:`(${ie(e.type)}...)`}class iC{constructor(e,i,r){this.type=t6,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(2!==e.length)return i.error("Expected one argument.");let r=e[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=void 0===r["case-sensitive"]?i.parse(!1,1,t2):i.parseObjectValue(r["case-sensitive"],1,"case-sensitive",t2);if(!a)return null;let n=void 0===r["diacritic-sensitive"]?i.parse(!1,1,t2):i.parseObjectValue(r["diacritic-sensitive"],1,"diacritic-sensitive",t2);if(!n)return null;let o=null;return!r.locale||(o=i.parseObjectValue(r.locale,1,"locale",t1))?new iC(a,n,o):null}evaluate(e){return new io(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){let e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function iP(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function iz(e,i){e[0]=Math.min(e[0],i[0]),e[1]=Math.min(e[1],i[1]),e[2]=Math.max(e[2],i[0]),e[3]=Math.max(e[3],i[1])}function iD(e,i){return!(e[0]<=i[0]||e[2]>=i[2]||e[1]<=i[1]||e[3]>=i[3])}function iR(e,i,r=!1){let a=!1;for(let n=0,o=i.length;n<o;n++){let o=i[n];for(let i=0,n=o.length,s=n-1;i<n;s=i++){let n=o[s],l=o[i];if(function(e,i,r){let a=e[0]-i[0],n=e[1]-i[1],o=e[0]-r[0],s=e[1]-r[1];return a*s-o*n==0&&a*o<=0&&n*s<=0}(e,n,l))return r;n[1]>e[1]!=l[1]>e[1]&&e[0]<(l[0]-n[0])*(e[1]-n[1])/(l[1]-n[1])+n[0]&&(a=!a)}}return a}function iL(e,i,r,a){let n=a[0]-r[0],o=a[1]-r[1],s=(e[0]-r[0])*o-n*(e[1]-r[1]),l=(i[0]-r[0])*o-n*(i[1]-r[1]);return s>0&&l<0||s<0&&l>0}function iO(e,i,r,a){var n,o;return 0!=(n=[a[0]-r[0],a[1]-r[1]])[0]*(o=[i[0]-e[0],i[1]-e[1]])[1]-n[1]*o[0]&&!(!iL(e,i,r,a)||
1!iL(r,a,e,i))}function ik(e,i){for(let r=0;r<e.length;++r)if(!iR(e[r],i))return!1;for(let r=0;r<e.length-1;++r)if(function(e,i,r){for(let a of r)for(let r=0,n=a.length,o=n-1;r<n;o=r++)if(iO(e,i,a[o],a[r]))return!0;return!1}(e[r],e[r+1],i))return!1;return!0}function iF(e,i,r){let a=[];for(let n=0;n<e.length;n++){let o=[];for(let a=0;a<e[n].length;a++){let s=function(e,i){let r=(180+e[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,i.z);return[Math.round(r*n*8192),Math.round(a*n*8192)]}(e[n][a],r);iz(i,s),o.push(s)}a.push(o)}return a}function iB(e,i,r){let a=[];for(let n=0;n<e.length;n++){let o=iF(e[n],i,r);a.push(o)}return a}function iN(e,i,r,a){if(e[0]<r[0]||e[0]>r[2]){let i=.5*a,n=e[0]-r[0]>i?-a:r[0]-e[0]>i?a:0;0===n&&(n=e[0]-r[2]>i?-a:r[2]-e[0]>i?a:0),e[0]+=n}iz(i,e)}function iV(e,i,r,a){let n=8192*Math.pow(2,a.z),o=[8192*a.x,8192*a.y],s=[];if(!e)return s;for(let a of e)for(let e of a){let a=[e.x+o[0],e.y+o[1]];iN(a,i,r,n),s.push(a)}return s}function iU(e,i,r,a){let n=8192*Math.pow(2,a.z),o=[8192*a.x,8192*a.y],s=[];if(!e)return s;for(let r of e){let e=[];for(let a of r){let r=[a.x+o[0],a.y+o[1]];iz(i,r),e.push(r)}s.push(e)}if(i[2]-i[0]<=n/2)for(let e of(i[0]=i[1]=1/0,i[2]=i[3]=-1/0,s))for(let a of e)iN(a,i,r,n);return s}class ij{constructor(e,i){this.type=t2,this.geojson=e,this.geometries=i}static parse(e,i){if(2!==e.length)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(id(e[1])){let i=e[1];if("FeatureCollection"===i.type)for(let e=0;e<i.features.length;++e){let r=i.features[e].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new ij(i,i.features[e].geometry)}else if("Feature"===i.type){let e=i.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ij(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new ij(i,i)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===i.type){let o=iF(i.coordinates,a,n),s=iV(e.geometry(),r,a,n);if(!iD(r,a))return!1;for(let e of s)if(!iR(e,o))return!1}if("MultiPolygon"===i.type){let o=iB(i.coordinates,a,n),s=iV(e.geometry(),r,a,n);if(!iD(r,a))return!1;for(let e of s)if(!function(e,i){for(let r=0;r<i.length;r++)if(iR(e,i[r]))return!0;return!1}(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===i.type){let o=iF(i.coordinates,a,n),s=iU(e.geometry(),r,a,n);if(!iD(r,a))return!1;for(let e of s)if(!ik(e,o))return!1}if("MultiPolygon"===i.type){let o=iB(i.coordinates,a,n),s=iU(e.geometry(),r,a,n);if(!iD(r,a))return!1;for(let e of s)if(!function(e,i){for(let r=0;r<i.length;r++)if(ik(e,i[r]))return!0;return!1}(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}let iG={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},iq=1/298.257223563*(2-1/298.257223563),iZ=Math.PI/180;class iH{static fromTile(e,i,r){let a=Math.PI*(1-2*(e+.5)/Math.pow(2,i));return new iH(Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/iZ,r)}static get units(){return iG}constructor(e,i){if(void 0===e)throw Error("No latitude given.");if(i&&!iG[i])throw Error(`Unknown unit ${i}. Use one of: ${Object.keys(iG).join(", ")}`);let r=6378.137*iZ*(i?iG[i]:1),a=Math.cos(e*iZ),n=1/(1-iq*(1-a*a)),o=Math.sqrt(n);this.kx=r*o*a,this.ky=r*o*n*(1-iq)}distance(e,i){let r=iX(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(r*r+a*a)}bearing(e,i){return Math.atan2(iX(i[0]-e[0])*this.kx,(i[1]-e[1])*this.ky)/iZ}destination(e,i,r){let a=r*iZ;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,r){return[e[0]+i/this.kx,e[1]+r/this.ky]}lineDistance(e){let i=0;for(let r=0;r<e.length-1;r++)i+=this.distance(e[r],e[r+1]);return i}area(e){let i=0;for(let r=0;r<e.length;r++){let a=e[r];for(let e=0,n=a.length,o=n-1;e<n;o=e++)i+=iX(a[e][0]-a[o][0])*(a[e][1]+a[o][1])*(r?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let r=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){let n=e[a],o=e[a+1],s=this.distance(n,o);if((r+=s)>i)return iW(n,o,(i-(r-s))/s)}return e[e.length-1]}pointToSegmentDistance(e,i,r){let[a,n]=i,o=iX(r[0]-a)*this.kx,s=(r[1]-n)*this.ky;if(0!==o||0!==s){let i=(iX(e[0]-a)*this.kx*o+(e[1]-n)*this.ky*s)/(o*o+s*s);i>1?(a=r[0],n=r[1]):i>0&&(a+=o/this.kx*i,n+=s/this.ky*i)}return Math.sqrt((o=iX(e[0]-a)*this.kx)*o+(s=(e[1]-n)*this.ky)*s)}pointOnLine(e,i){let r=1/0,a=e[0][0],n=e[0][1],o=0,s=0;for(let l=0;l<e.length-1;l++){let h=e[l][0],u=e[l][1],c=iX(e[l+1][0]-h)*this.kx,d=(e[l+1][1]-u)*this.ky,p=0;0===c&&0===d||((p=(iX(i[0]-h)*this.kx*c+(i[1]-u)*this.ky*d)/(c*c+d*d))>1?(h=e[l+1][0],u=e[l+1][1]):p>0&&(h+=c/this.kx*p,u+=d/this.ky*p));let f=(c=iX(i[0]-h)*this.kx)*c+(d=(i[1]-u)*this.ky)*d;f<r&&(r=f,a=h,n=u,o=l,s=p)}return{point:[a,n],index:o,t:Math.max(0,Math.min(1,s))}}lineSlice(e,i,r){let a=this.pointOnLine(r,e),n=this.pointOnLine(r,i);if(a.index>n.index||a.index===n.index&&a.t>n.t){let e=a;a=n,n=e}let o=[a.point],s=a.index+1,l=n.index;!i$(r[s],o[0])&&s<=l&&o.push(r[s]);for(let e=s+1;e<=l;e++)o.push(r[e]);return i$(r[l],n.point)||o.push(n.point),o}lineSliceAlong(e,i,r){let a=0,n=[];for(let o=0;o<r.length-1;o++){let s=r[o],l=r[o+1],h=this.distance(s,l);if((a+=h)>e&&0===n.length&&n.push(iW(s,l,(e-(a-h))/h)),a>=i)return n.push(iW(s,l,(i-(a-h))/h)),n;a>e&&n.push(l)}return n}bufferPoint(e,i){let r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[0]+a,e[1]+r]}bufferBBox(e,i){let r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[2]+a,e[3]+r]}insideBBox(e,i){return iX(e[0]-i[0])>=0&&0>=iX(e[0]-i[2])&&e[1]>=i[1]&&e[1]<=i[3]}}function i$(e,i){return e[0]===i[0]&&e[1]===i[1]}function iW(e,i,r){let a=iX(i[0]-e[0]);return[e[0]+a*r,e[1]+(i[1]-e[1])*r]}function iX(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class iY{constructor(e=[],i=(e,i)=>e<i?-1:e>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:i,compare:r}=this,a=i[e];for(;e>0;){let n=e-1>>1,o=i[n];if(r(a,o)>=0)break;i[e]=o,e=n}i[e]=a}_down(e){let{data:i,compare:r}=this,a=this.length>>1,n=i[e];for(;e<a;){let a=1+(e<<1),o=a+1;if(o<this.length&&0>r(i[o],i[a])&&(a=o),r(i[a],n)>=0)break;i[e]=i[a],e=a}i[e]=n}}function iK(e,i){return i.dist-e.dist}function iJ(e){let i=[1/0,1/0,-1/0,-1/0];if(i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(i[r]!==e[r])return!1;return!0}function iQ(e){return e[1]-e[0]+1}function i0(e,i){let r=e[1]>=e[0]&&e[1]<i;return r||console.warn("Distance Expression: Index is out of range"),r}function i1(e,i){if(e[0]>
1e[1])return[null,null];let r=iQ(e);if(i){if(2===r)return[e,null];let i=Math.floor(r/2);return[[e[0],e[0]+i],[e[0]+i,e[1]]]}{if(1===r)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}}function i2(e,i){let r=[1/0,1/0,-1/0,-1/0];if(!i0(i,e.length))return r;for(let a=i[0];a<=i[1];++a)iz(r,e[a]);return r}function i3(e){let i=[1/0,1/0,-1/0,-1/0];for(let r=0;r<e.length;++r)for(let a=0;a<e[r].length;++a)iz(i,e[r][a]);return i}function i4(e,i,r){if(iJ(e)||iJ(i))return NaN;let a=0,n=0;return e[2]<i[0]&&(a=i[0]-e[2]),e[0]>i[2]&&(a=e[0]-i[2]),e[1]>i[3]&&(n=e[1]-i[3]),e[3]<i[1]&&(n=i[1]-e[3]),r.distance([0,0],[a,n])}function i5(e,i){let r=Math.pow(2,i.z),a=(e.y/8192+i.y)/r;return[(e.x/8192+i.x)/r*360-180,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90]}function i6(e,i,r){let a=r.pointOnLine(i,e).point;return r.distance(e,a)}function i8(e,i,r,a,n){let o=r.slice(a[0],a[1]+1),s=1/0;for(let r=i[0];r<=i[1];++r)if(0===(s=Math.min(s,i6(e[r],o,n))))return 0;return s}function i9(e,i,r,a,n){return Math.min(Math.min(n.pointToSegmentDistance(e,r,a),n.pointToSegmentDistance(i,r,a)),Math.min(n.pointToSegmentDistance(r,e,i),n.pointToSegmentDistance(a,e,i)))}function i7(e,i){for(let r of e)for(let e=0;e<=r.length-1;++e)if(iR(r[e],i,!0))return!0;return!1}function re(e,i,r,a,n,o,s){if(null===o||null===s)return;let l=i4(i2(a,o),i2(n,s),r);l<i&&e.push({dist:l,range1:o,range2:s})}function rt(e,i,r,a,n,o=1/0){let s=Math.min(o,n.distance(e[0],r[0]));if(0===s)return s;let l=new iY([{dist:0,range1:[0,e.length-1],range2:[0,r.length-1]}],iK),h=i?50:100,u=a?50:100;for(;l.length;){let o=l.pop();if(o.dist>=s)continue;let c=o.range1,d=o.range2;if(iQ(c)<=h&&iQ(d)<=u){if(!i0(c,e.length)||!i0(d,r.length))return NaN;if(i&&a?s=Math.min(s,function(e,i,r,a,n){if(!i0(i,e.length)||!i0(a,r.length))return NaN;let o=1/0;for(let s=i[0];s<i[1];++s)for(let i=a[0];i<a[1];++i){if(iO(e[s],e[s+1],r[i],r[i+1]))return 0;o=Math.min(o,i9(e[s],e[s+1],r[i],r[i+1],n))}return o}(e,c,r,d,n)):i||a?i&&!a?s=Math.min(s,i8(r,d,e,c,n)):!i&&a&&(s=Math.min(s,i8(e,c,r,d,n))):s=Math.min(s,function(e,i,r,a,n){if(!i0(i,e.length)||!i0(a,r.length))return NaN;let o=1/0;for(let s=i[0];s<=i[1];++s)for(let i=a[0];i<=a[1];++i)if(0===(o=Math.min(o,n.distance(e[s],r[i]))))return o;return o}(e,c,r,d,n)),0===s)break}else{let o=i1(c,i),h=i1(d,a);re(l,s,n,e,r,o[0],h[0]),re(l,s,n,e,r,o[0],h[1]),re(l,s,n,e,r,o[1],h[0]),re(l,s,n,e,r,o[1],h[1])}}return s}function ri(e,i,r,a,n=1/0){let o=n,s=i2(e,[0,e.length-1]);for(let n of r)if(!(o!==1/0&&i4(s,i2(n,[0,n.length-1]),a)>=o)&&0===(o=Math.min(o,rt(e,i,n,!0,a,o))))break;return o}function rr(e,i,r,a,n=1/0){let o=n,s=i2(e,[0,e.length-1]);for(let n of r){if(o!==1/0&&i4(s,i3(n),a)>=o)continue;let r=function(e,i,r,a,n=1/0){let o=Math.min(a.distance(e[0],r[0][0]),n);if(0===o)return o;let s=new iY([{dist:0,range1:[0,e.length-1],range2:[0,0]}],iK),l=i?50:100,h=i3(r);for(;s.length;){let n=s.pop();if(n.dist>=o)continue;let u=n.range1;if(iQ(u)<=l){if(!i0(u,e.length))return NaN;if(i){if(0===(o=Math.min(o,function(e,i,r,a){if(!i0(i,e.length))return NaN;for(let a=i[0];a<=i[1];++a)if(iR(e[a],r,!0))return 0;let n=1/0;for(let o=i[0];o<i[1];++o)for(let i of r)for(let r=0,s=i.length,l=s-1;r<s;l=r++){if(iO(e[o],e[o+1],i[l],i[r]))return 0;n=Math.min(n,i9(e[o],e[o+1],i[l],i[r],a))}return n}(e,u,r,a))))break}else for(let i=u[0];i<=u[1];++i)if(0===(o=Math.min(o,function(e,i,r){if(iR(e,i,!0))return 0;let a=1/0;for(let n of i){let i=n.length;if(i<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(n[0]!==n[i-1]&&0===(a=Math.min(a,r.pointToSegmentDistance(e,n[i-1],n[0])))||0===(a=Math.min(a,i6(e,n,r))))break}return a}(e[i],r,a))))return o}else{let r=i1(u,i);if(null!==r[0]){let i=i4(i2(e,r[0]),h,a);i<o&&s.push({dist:i,range1:r[0],range2:[0,0]})}if(null!==r[1]){let i=i4(i2(e,r[1]),h,a);i<o&&s.push({dist:i,range1:r[1],range2:[0,0]})}}}return o}(e,i,n,a,o);if(isNaN(r))return r;if(0===(o=Math.min(o,r)))break}return o}function ra(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class rn{constructor(e,i){this.type=t0,this.geojson=e,this.geometries=i}static parse(e,i){if(2!==e.length)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(id(e[1])){let i=e[1];
1if("FeatureCollection"===i.type){for(let e=0;e<i.features.length;++e)if(ra(i.features[e].geometry.type))return new rn(i,i.features[e].geometry)}else if("Feature"===i.type){if(ra(i.geometry.type))return new rn(i,i.geometry)}else if(ra(i.type))return new rn(i,i)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){let i=e.geometry(),r=e.canonicalID();if(null!=i&&null!=r){if("Point"===e.geometryType())return function(e,i,r){let a=[];for(let r of e)for(let e of r)a.push(i5(e,i));let n=new iH(a[0][1],"meters");return"Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type?rt(a,!1,"Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n):"MultiLineString"===r.type?ri(a,!1,r.coordinates,n):"Polygon"===r.type||"MultiPolygon"===r.type?rr(a,!1,"Polygon"===r.type?[r.coordinates]:r.coordinates,n):null}(i,r,this.geometries);if("LineString"===e.geometryType())return function(e,i,r){let a=[];for(let r of e){let e=[];for(let a of r)e.push(i5(a,i));a.push(e)}let n=new iH(a[0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return ri("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,a,n);if("MultiLineString"===r.type){let e=1/0;for(let i=0;i<r.coordinates.length;i++){let o=ri(r.coordinates[i],!0,a,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}if("Polygon"===r.type||"MultiPolygon"===r.type){let e=1/0;for(let i=0;i<a.length;i++){let o=rr(a[i],!0,"Polygon"===r.type?[r.coordinates]:r.coordinates,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}return null}(i,r,this.geometries);if("Polygon"===e.geometryType())return function(e,i,r){let a=[];for(let r of function(e,i){let r,a;let n=e.length;if(n<=1)return[e];let o=[];for(let i=0;i<n;i++){let n=function(e){let i=0;for(let r,a,n=0,o=e.length,s=o-1;n<o;s=n++)r=e[n],i+=((a=e[s]).x-r.x)*(r.y+a.y);return i}(e[i]);0!==n&&(e[i].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[e[i]]):r.push(e[i]))}return r&&o.push(r),o}(e)){let e=[];for(let a=0;a<r.length;++a)e.push(function(e,i){let r=[];for(let a=0;a<e.length;++a)r.push(i5(e[a],i));return r}(r[a],i));a.push(e)}let n=new iH(a[0][0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return rr("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,a,n);if("MultiLineString"===r.type){let e=1/0;for(let i=0;i<r.coordinates.length;i++){let o=rr(r.coordinates[i],!0,a,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}return"Polygon"===r.type||"MultiPolygon"===r.type?function(e,i,r){let a=1/0;for(let n of e)for(let e of i){let i=function(e,i,r,a=1/0){let n=i3(e),o=i3(i);if(a!==1/0&&i4(n,o,r)>=a)return a;if(iD(n,o)){if(i7(e,i))return 0}else if(i7(i,e))return 0;let s=a;for(let a of e)for(let e=0,n=a.length,o=n-1;e<n;o=e++)for(let n of i)for(let i=0,l=n.length,h=l-1;i<l;h=i++){if(iO(a[o],a[e],n[h],n[i]))return 0;s=Math.min(s,i9(a[o],a[e],n[h],n[i],r))}return s}(n,e,r,a);if(isNaN(i))return i;if(0===(a=Math.min(a,i)))return a}return a}("Polygon"===r.type?[r.coordinates]:r.coordinates,a,n):null}(i,r,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function ro(e,i){switch(e){case"string":return im(i);case"number":return+i;case"boolean":return!!i;case"color":return tZ.parse(i);case"formatted":return il.fromString(im(i));case"resolvedImage":return iu.build(im(i))}return i}function rs(e,i,r,a){return void 0!==a&&(e=a*Math.round(e/a)),void 0!==i&&e<i&&(e=i),void 0!==r&&e>r&&(e=r),e}class rl{constructor(e,i,r){this.type=e,this.key=i,this.scope=r}static parse(e,i){let r=i.expectedType;if(null==r&&(r=t5),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");let a=i.parse(e[1],1);if(!(a instanceof i_))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){let n=i.parse(e[2],2);return n instanceof i_?new rl(r,im(a.value),im(n.value)):i.error("Scope of 'config' expression must be a string literal.")}return new rl(r,im(a.value))}
1evaluate(e){let i=[this.key,this.scope,e.scope].filter(Boolean).join("\x1f"),r=e.getConfig(i);if(!r)return null;let{type:a,value:n,values:o,minValue:s,maxValue:l,stepValue:h}=r,u=r.default.evaluate(e),c=u;if(n){let i=e.scope;e.scope=(i||"").split("\x1f").slice(1).join("\x1f"),c=n.evaluate(e),e.scope=i}return a&&(c=ro(a,c)),void 0===c||void 0===s&&void 0===l&&void 0===h||("number"==typeof c?c=rs(c,s,l,h):Array.isArray(c)&&(c=c.map(e=>"number"==typeof e?rs(e,s,l,h):e))),void 0!==n&&void 0!==c&&o&&!o.includes(c)&&(c=u,a&&(c=ro(a,c))),(a&&a!==this.type||void 0!==c&&ip(c)!==this.type)&&(c=ro(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){let e=["config",this.key];return this.scope&&e.concat(this.key),e}}function rh(e){if(e instanceof iA&&("get"===e.name&&1===e.args.length||"feature-state"===e.name||"has"===e.name&&1===e.args.length||"properties"===e.name||"geometry-type"===e.name||"id"===e.name||/^filter-/.test(e.name))||e instanceof ij||e instanceof rn)return!1;let i=!0;return e.eachChild(e=>{i&&!rh(e)&&(i=!1)}),i}function ru(e){if(e instanceof iA&&"feature-state"===e.name)return!1;let i=!0;return e.eachChild(e=>{i&&!ru(e)&&(i=!1)}),i}function rc(e){if(e instanceof rl)return new Set([e.key]);let i=new Set;return e.eachChild(e=>{i=new Set([...i,...rc(e)])}),i}function rd(e,i){if(e instanceof iA&&i.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!rd(e,i)&&(r=!1)}),r}class rp{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(2!==e.length||"string"!=typeof e[1])return i.error("'var' expression requires exactly one string literal argument.");let r=e[1];return i.scope.has(r)?new rp(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class rf{constructor(e,i=[],r,a=new tJ,n=[],o,s){this.registry=e,this.path=i,this.key=i.map(e=>"string"==typeof e?`['${e}']`:`[${e}]`).join(""),this.scope=a,this.errors=n,this.expectedType=r,this._scope=o,this.options=s}parse(e,i,r,a,n={}){return i||r?this.concat(i,null,r,a)._parse(e,n):this._parse(e,n)}parseObjectValue(e,i,r,a,n,o={}){return this.concat(i,r,a,n)._parse(e,o)}_parse(e,i){function r(e,i,r){return"assert"===r?new ix(i,[e]):"coerce"===r?new iS(i,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let a="string"==typeof e[0]?this.registry[e[0]]:void 0;if(a){let n=a.parse(e,this);if(!n)return null;if(this.expectedType){let e=this.expectedType,a=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind){if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(e,a))return null}else n=r(n,e,i.typeAnnotation||"coerce")}else n=r(n,e,i.typeAnnotation||"assert")}if(!(n instanceof i_)&&"resolvedImage"!==n.type.kind&&function e(i){if(i instanceof rp)return e(i.boundExpression);if(i instanceof iA&&"error"===i.name||i instanceof iC||i instanceof ij||i instanceof rn||i instanceof rl)return!1;let r=i instanceof iS||i instanceof ix,a=!0;return i.eachChild(i=>{a=r?a&&e(i):a&&i instanceof i_}),!!a&&rh(i)&&rd(i,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}(n)){let e=new iE(this._scope,this.options);try{n=new i_(n.type,n.evaluate(e))}catch(e){return this.error(e.message),null}}return n}return iS.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,r,a){let n="number"==typeof e?this.path.concat(e):this.path;n="string"==typeof i?n.concat(i):n;let o=a?this.scope.concat(a):this.scope;return new rf(this.registry,n,r||null,o,this.errors,this._scope,this.options)}error(e,...i){let r=`${this.key}${i.map(e=>`[${e}]`).join("")}`;this.errors.push(new tK(r,e))}checkSubtype(e,i){let r=ii(e,i);return r&&this.error(r),r}}var rm=rf;function r_(e,i){let r=e.length-1,a,n,o=0,s=r,l=0;for(;o<=s;)if(a=e[l=Math.floor((o+s)/2)],n=e[l+1],a<=i){if(l===r||i<n)return l;o=l+1}else{if(!(a>i))throw new ig("Input is not a number.");s=l-1}return 0}
1class rg{constructor(e,i,r){for(let[a,n]of(this.type=e,this.input=i,this.labels=[],this.outputs=[],r))this.labels.push(a),this.outputs.push(n)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(e[1],1,t0);if(!r)return null;let a=[],n=null;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);for(let r=1;r<e.length;r+=2){let o=1===r?-1/0:e[r],s=e[r+1],l=r,h=r+1;if("number"!=typeof o)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',l);if(a.length&&a[a.length-1][0]>=o)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);let u=i.parse(s,h,n);if(!u)return null;n=n||u.type,a.push([o,u])}return new rg(n,r,a)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return r[0].evaluate(e);let n=i.length;return a>=i[n-1]?r[n-1].evaluate(e):r[r_(i,a)].evaluate(e)}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}let ry=4/29,rx=6/29,rv=6/29*3*(6/29),rb=6/29*(6/29)*(6/29),rw=Math.PI/180,rT=180/Math.PI;function rS(e){return e>rb?Math.pow(e,1/3):e/rv+ry}function rM(e){return e>rx?e*e*e:rv*(e-ry)}function rE(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function rA(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function rI(e){let i=rA(e.r),r=rA(e.g),a=rA(e.b),n=rS((.4124564*i+.3575761*r+.1804375*a)/.95047),o=rS((.2126729*i+.7151522*r+.072175*a)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-rS((.0193339*i+.119192*r+.9503041*a)/1.08883)),alpha:e.a}}function rC(e){let i=(e.l+16)/116,r=isNaN(e.a)?i:i+e.a/500,a=isNaN(e.b)?i:i-e.b/200;return i=1*rM(i),new tZ(rE(3.2404542*(r=.95047*rM(r))-1.5371385*i-.4985314*(a=1.08883*rM(a))),rE(-.969266*r+1.8760108*i+.041556*a),rE(.0556434*r-.2040259*i+1.0572252*a),e.alpha)}let rP={forward:rI,reverse:rC,interpolate:function(e,i,r){return{l:t$(e.l,i.l,r),a:t$(e.a,i.a,r),b:t$(e.b,i.b,r),alpha:t$(e.alpha,i.alpha,r)}}},rz={forward:function(e){let{l:i,a:r,b:a}=rI(e),n=Math.atan2(a,r)*rT;return{h:n<0?n+360:n,c:Math.sqrt(r*r+a*a),l:i,alpha:e.a}},reverse:function(e){let i=e.h*rw,r=e.c;return rC({l:e.l,a:Math.cos(i)*r,b:Math.sin(i)*r,alpha:e.alpha})},interpolate:function(e,i,r){return{h:function(e,i,r){let a=i-e;return e+r*(a>180||a<-180?a-360*Math.round(a/360):a)}(e.h,i.h,r),c:t$(e.c,i.c,r),l:t$(e.l,i.l,r),alpha:t$(e.alpha,i.alpha,r)}}};var rD=Object.freeze({__proto__:null,hcl:rz,lab:rP});class rR{constructor(e,i,r,a,n,o){for(let[s,l]of(this.type=e,this.operator=i,this.interpolation=r,this.input=a,this.dynamicStops=n,this.labels=[],this.outputs=[],o))this.labels.push(s),this.outputs.push(l)}static interpolationFactor(e,i,r,a){let n=0;if("exponential"===e.name)n=rL(i,e.base,r,a);else if("linear"===e.name)n=rL(i,1,r,a);else if("cubic-bezier"===e.name){let o=e.controlPoints;n=new ez(o[0],o[1],o[2],o[3]).solve(rL(i,1,r,a))}return n}static parse(e,i){let[r,a,n,...o]=e;if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let e=a[1];if("number"!=typeof e)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:e}}else{if("cubic-bezier"!==a[0])return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{let e=a.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<3)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(n=i.parse(n,2,t0)))return null;let s=[],l=null;if("interpolate-hcl"===r||"interpolate-lab"===r?l=t3:i.expectedType&&"value"!==i.expectedType.kind&&(l=i.expectedType),e.length-1==3){let e=i.parse(o[0],3,t5);return e?new rR(l,r,a,n,e,s):null}for(let e=0;e<o.length;e+=2){let r=o[e],a=o[e+1],n=e+3,h=e+4;if("number"!=typeof r)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',n);if(s.length&&s[s.length-1][0]>=r)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let u=i.parse(a,h,l);if(!u)return null;l=l||u.type,s.push([r,u])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new rR(l,r,a,n,null,s):i.error(`Type ${ie(l)} is not interpolatable.`)}evaluate(e){let i=this.labels,r=this.outputs;if(this.dynamicStops){let a=this.dynamicStops.evaluate(e);if(a.length%2!=0)throw new ig("Expected an even number of arguments.");i=[],r=[];for(let e=0;e<a.length;e+=2){let n=a[e],o=new i_(t0,a[e+1]);if("number"!=typeof n)throw new ig('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.');if(i.length&&i[i.length-1]>=n)throw new ig('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.');i.push(n),r.push(o)}if(0===i.length)throw new ig("Expected at least one input/output pair.")}if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return r[0].evaluate(e);let n=i.length;if(a>=i[n-1])return r[n-1].evaluate(e);let o=r_(i,a),s=rR.interpolationFactor(this.interpolation,a,i[o],i[o+1]),l=r[o].evaluate(e),h=r[o+1].evaluate(e);return"interpolate"===this.operator?tX[this.type.kind.toLowerCase()](l,h,s):"interpolate-hcl"===this.operator?rz.reverse(rz.interpolate(rz.forward(l),rz.forward(h),s)):rP.reverse(rP.interpolate(rP.forward(l),rP.forward(h),s))}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);let i=[this.operator,e,this.input.serialize()];if(this.dynamicStops)i.push(this.dynamicStops.serialize());else for(let e=0;e<this.labels.length;e++)i.push(this.labels[e],this.outputs[e].serialize());return i}}function rL(e,i,r,a){let n=a-r,o=e-r;return 0===n?0:1===i?o/n:(Math.pow(i,o)-1)/(Math.pow(i,n)-1)}class rO{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let r=null,a=i.expectedType;a&&"value"!==a.kind&&(r=a);let n=[];for(let a of e.slice(1)){let e=i.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,n.push(e)}return new rO(a&&n.some(e=>ii(a,e.type))?t5:r,n)}evaluate(e){let i,r=null,a=0;for(let n of this.args){if(a++,(r=n.evaluate(e))&&r instanceof iu&&!r.available&&(i||(i=r),r=null,a===this.args.length))return i;if(null!==r)break}return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class rk{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let r=[];for(let a=1;a<e.length-1;a+=2){let n=e[a];if("string"!=typeof n)return i.error(`Expected string, but found ${typeof n} instead.`,a);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let o=i.parse(e[a+1],a+1);if(!o)return null;r.push([n,o])}let a=i.parse(e[e.length-1],e.length-1,i.expectedType,r);return a?new rk(r,a):null}outputDefined(){return this.result.outputDefined()}serialize(){let e=["let"];for(let[i,r]of this.bindings)e.push(i,r.serialize());return e.push(this.result.serialize()),e}}class rF{constructor(e,i,r){this.type=e,this.index=i,this.input=r}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t0),a=i.parse(e[2],2,t7(i.expectedType||t5));return r&&a?new rF(a.type.itemType,r,a):null}evaluate(e){let i=this.index.evaluate(e),r=this.input.evaluate(e);if(i<0)throw new ig(`Array index out of bounds: ${i} < 0.`);if(i>r.length-1)throw new ig(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i===Math.floor(i))return r[i];let a=Math.floor(i),n=Math.ceil(i),o=r[a],s=r[n];if("number"!=typeof o||"number"!=typeof s)throw new ig(`Cannot interpolate between non-number values at index ${i}.`);let l=i-a;return o*(1-l)+s*l}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class rB{constructor(e,i){this.type=t2,this.needle=e,this.haystack=i}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t5),a=i.parse(e[2],2,t5);return r&&a?ir(r.type,[t2,t1,t0,tQ,t5])?new rB(r,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(r.type)} instead`):null}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!ia(i,["boolean","string","number","null"]))throw new ig(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ip(i))} instead.`);if(!ia(r,["string","array"]))throw new ig(`Expected second argument to be of type array or string, but found ${ie(ip(r))} instead.`);return r.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class rN{constructor(e,i,r){this.type=t0,this.needle=e,this.haystack=i,this.fromIndex=r}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t5),a=i.parse(e[2],2,t5);if(!r||!a)return null;if(!ir(r.type,[t2,t1,t0,tQ,t5]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,t0);return n?new rN(r,a,n):null}return new rN(r,a)}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!ia(i,["boolean","string","number","null"]))throw new ig(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ip(i))} instead.`);if(!ia(r,["string","array"]))throw new ig(`Expected second argument to be of type array or string, but found ${ie(ip(r))} instead.`);if(this.fromIndex){let a=this.fromIndex.evaluate(e);return r.indexOf(i,a)}return r.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class rV{constructor(e,i,r,a,n,o){this.inputType=e,this.type=i,this.input=r,this.cases=a,this.outputs=n,this.otherwise=o}static parse(e,i){let r,a;
1if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);let n={},o=[];for(let s=2;s<e.length-1;s+=2){let l=e[s],h=e[s+1];Array.isArray(l)||(l=[l]);let u=i.concat(s);if(0===l.length)return u.error("Expected at least one branch label.");for(let e of l){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,ip(e)))return null}else r=ip(e);if(void 0!==n[String(e)])return u.error("Branch labels must be unique.");n[String(e)]=o.length}let c=i.parse(h,s,a);if(!c)return null;a=a||c.type,o.push(c)}let s=i.parse(e[1],1,t5);if(!s)return null;let l=i.parse(e[e.length-1],e.length-1,a);return l?"value"!==s.type.kind&&i.concat(1).checkSubtype(r,s.type)?null:new rV(r,a,s,n,o,l):null}evaluate(e){let i=this.input.evaluate(e);return(ip(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),r=[],a={};for(let e of i){let i=a[this.cases[e]];void 0===i?(a[this.cases[e]]=r.length,r.push([this.cases[e],[e]])):r[i][1].push(e)}let n=e=>"number"===this.inputType.kind?Number(e):e;for(let[i,a]of r)e.push(1===a.length?n(a[0]):a.map(n)),e.push(this.outputs[i].serialize());return e.push(this.otherwise.serialize()),e}}class rU{constructor(e,i,r){this.type=e,this.branches=i,this.otherwise=r}static parse(e,i){let r;if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);let a=[];for(let n=1;n<e.length-1;n+=2){let o=i.parse(e[n],n,t2);if(!o)return null;let s=i.parse(e[n+1],n+1,r);if(!s)return null;a.push([o,s]),r=r||s.type}let n=i.parse(e[e.length-1],e.length-1,r);return n?new rU(r,a,n):null}evaluate(e){for(let[i,r]of this.branches)if(i.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[i,r]of this.branches)e(i),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class rj{constructor(e,i,r,a){this.type=e,this.input=i,this.beginIndex=r,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t5),a=i.parse(e[2],2,t0);if(!r||!a)return null;if(!ir(r.type,[t7(t5),t1,t5]))return i.error(`Expected first argument to be of type array or string, but found ${ie(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,t0);return n?new rj(r.type,r,a,n):null}return new rj(r.type,r,a)}evaluate(e){let i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!ia(i,["string","array"]))throw new ig(`Expected first argument to be of type array or string, but found ${ie(ip(i))} instead.`);if(this.endIndex){let a=this.endIndex.evaluate(e);return i.slice(r,a)}return i.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function rG(e,i){return"=="===e||"!="===e?"boolean"===i.kind||"string"===i.kind||"number"===i.kind||"null"===i.kind||"value"===i.kind:"string"===i.kind||"number"===i.kind||"value"===i.kind}function rq(e,i,r,a){return 0===a.compare(i,r)}function rZ(e,i,r){let a="=="!==e&&"!="!==e;
1return class n{constructor(e,i,r){this.type=t2,this.lhs=e,this.rhs=i,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===i.type.kind}static parse(e,i){if(3!==e.length&&4!==e.length)return i.error("Expected two or three arguments.");let r=e[0],o=i.parse(e[1],1,t5);if(!o)return null;if(!rG(r,o.type))return i.concat(1).error(`"${r}" comparisons are not supported for type '${ie(o.type)}'.`);let s=i.parse(e[2],2,t5);if(!s)return null;if(!rG(r,s.type))return i.concat(2).error(`"${r}" comparisons are not supported for type '${ie(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return i.error(`Cannot compare types '${ie(o.type)}' and '${ie(s.type)}'.`);a&&("value"===o.type.kind&&"value"!==s.type.kind?o=new ix(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new ix(o.type,[s])));let l=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return i.error("Cannot use collator to compare non-string types.");if(!(l=i.parse(e[3],3,t6)))return null}return new n(o,s,l)}evaluate(n){let o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(a&&this.hasUntypedArgument){let i=ip(o),r=ip(s);if(i.kind!==r.kind||"string"!==i.kind&&"number"!==i.kind)throw new ig(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${i.kind}, ${r.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let e=ip(o),r=ip(s);if("string"!==e.kind||"string"!==r.kind)return i(n,o,s)}return this.collator?r(n,o,s,this.collator.evaluate(n)):i(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){let i=[e];return this.eachChild(e=>{i.push(e.serialize())}),i}}}let rH=rZ("==",function(e,i,r){return i===r},rq),r$=rZ("!=",function(e,i,r){return i!==r},function(e,i,r,a){return!rq(0,i,r,a)}),rW=rZ("<",function(e,i,r){return i<r},function(e,i,r,a){return 0>a.compare(i,r)}),rX=rZ(">",function(e,i,r){return i>r},function(e,i,r,a){return a.compare(i,r)>0}),rY=rZ("<=",function(e,i,r){return i<=r},function(e,i,r,a){return 0>=a.compare(i,r)}),rK=rZ(">=",function(e,i,r){return i>=r},function(e,i,r,a){return a.compare(i,r)>=0});class rJ{constructor(e,i,r,a,n,o){this.type=t1,this.number=e,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,i){if(3!==e.length)return i.error("Expected two arguments.");let r=i.parse(e[1],1,t0);if(!r)return null;let a=e[2];if("object"!=typeof a||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&!(n=i.parseObjectValue(a.locale,2,"locale",t1)))return null;let o=null;if(a.currency&&!(o=i.parseObjectValue(a.currency,2,"currency",t1)))return null;let s=null;if(a.unit&&!(s=i.parseObjectValue(a.unit,2,"unit",t1)))return null;let l=null;if(a["min-fraction-digits"]&&!(l=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",t0)))return null;let h=null;return!a["max-fraction-digits"]||(h=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",t0))?new rJ(r,n,o,s,l,h):null}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class rQ{constructor(e){this.type=t0,this.input=e}static parse(e,i){if(2!==e.length)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);let r=i.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?i.error(`Expected argument of type string or array, but found ${ie(r.type)} instead.`):new rQ(r):null}evaluate(e){let i=this.input.evaluate(e);if("string"==typeof i||Array.isArray(i))return i.length;throw new ig(`Expected value to be of type string or array, but found ${ie(ip(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){let e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function r0(e){return function(){let i=Math.imul((e=1831565813+(e|=0)|0)^e>>>15,1|e);return(((i=i+Math.imul(i^i>>>7,61|i)^i)^i>>>14)>>>0)/4294967296}}let r1={"==":rH,"!=":r$,">":rX,"<":rW,">=":rK,"<=":rY,array:ix,at:rF,boolean:ix,case:rU,coalesce:rO,collator:iC,format:iv,image:ib,in:rB,"index-of":rN,interpolate:rR,"interpolate-hcl":rR,"interpolate-lab":rR,length:rQ,let:rk,literal:i_,match:rV,number:ix,"number-format":rJ,object:ix,slice:rj,step:rg,string:ix,"to-boolean":iS,"to-color":iS,"to-number":iS,"to-string":iS,var:rp,within:ij,distance:rn,config:rl};function r2(e,[i,r,a,n]){i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let o=n?n.evaluate(e):1,s=ic(i,r,a,o);if(s)throw new ig(s);return new tZ(i/255*o,r/255*o,a/255*o,o)}function r3(e,[i,r,a,n]){var o,s,l;i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let h=n?n.evaluate(e):1,u=(o=i,s=r,l=a,"number"==typeof o&&o>=0&&o<=360?"number"==typeof s&&s>=0&&s<=100&&"number"==typeof l&&l>=0&&l<=100?void 0===h||"number"==typeof h&&h>=0&&h<=1?null:`Invalid hsla value [${[o,s,l,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof h?[o,s,l,h]:[o,s,l]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof h?[o,s,l,h]:[o,s,l]).join(", ")}]: 'h' must be between 0 and 360.`);if(u)throw new ig(u);let c=`hsla(${i}, ${r}%, ${a}%, ${h})`,d=tZ.parse(c);if(!d)throw new ig(`Failed to parse HSLA color: ${c}`);return d}function r4(e,i){let r=i[e];return void 0===r?null:r}function r5(e){return{type:e}}function r6(e){return{result:"success",value:e}}function r8(e){return{result:"error",value:e}}function r9(e,i){return!!e&&!!e.parameters&&e.parameters.indexOf(i)>-1}function r7(e){return"data-driven"===e["property-type"]}function ae(e){return r9(e.expression,"measure-light")}function at(e){return r9(e.expression,"zoom")}function ai(e){return!!e.expression&&e.expression.interpolated}function ar(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function aa(e){return e}function an(e,i,r){return void 0!==e?e:void 0!==i?i:void 0!==r?r:void 0}function ao(e,i,r,a,n){return an(typeof r===n?a[r]:void 0,e.default,i.default)}function as(e,i,r){if("number"!==iw(r))return an(e.default,i.default);let a=e.stops.length;if(1===a||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[a-1][0])return e.stops[a-1][1];let n=r_(e.stops.map(e=>e[0]),r);return e.stops[n][1]}
1function al(e,i,r){let a=void 0!==e.base?e.base:1;if("number"!==iw(r))return an(e.default,i.default);let n=e.stops.length;if(1===n||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let o=r_(e.stops.map(e=>e[0]),r),s=function(e,i,r,a){let n=a-r,o=e-r;return 0===n?0:1===i?o/n:(Math.pow(i,o)-1)/(Math.pow(i,n)-1)}(r,a,e.stops[o][0],e.stops[o+1][0]),l=e.stops[o][1],h=e.stops[o+1][1],u=tX[i.type]||aa;if(e.colorSpace&&"rgb"!==e.colorSpace){let i=rD[e.colorSpace];u=(e,r)=>i.reverse(i.interpolate(i.forward(e),i.forward(r),s))}return"function"==typeof l.evaluate?{evaluate(...e){let i=l.evaluate.apply(void 0,e),r=h.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return u(i,r,s)}}:u(l,h,s)}function ah(e,i,r){return"color"===i.type?r=tZ.parse(r):"formatted"===i.type?r=il.fromString(r.toString()):"resolvedImage"===i.type?r=iu.build(r.toString()):iw(r)===i.type||"enum"===i.type&&i.values[r]||(r=void 0),an(r,e.default,i.default)}iA.register(r1,{error:[{kind:"error"},[t1],(e,[i])=>{throw new ig(i.evaluate(e))}],typeof:[t1,[t5],(e,[i])=>ie(ip(i.evaluate(e)))],"to-rgba":[t7(t0,4),[t3],(e,[i])=>i.evaluate(e).toRenderColor(null).toArray()],"to-hsla":[t7(t0,4),[t3],(e,[i])=>i.evaluate(e).toRenderColor(null).toHslaArray()],rgb:[t3,[t0,t0,t0],r2],rgba:[t3,[t0,t0,t0,t0],r2],hsl:[t3,[t0,t0,t0],r3],hsla:[t3,[t0,t0,t0,t0],r3],has:{type:t2,overloads:[[[t1],(e,[i])=>i.evaluate(e) in e.properties()],[[t1,t4],(e,[i,r])=>i.evaluate(e) in r.evaluate(e)]]},get:{type:t5,overloads:[[[t1],(e,[i])=>r4(i.evaluate(e),e.properties())],[[t1,t4],(e,[i,r])=>r4(i.evaluate(e),r.evaluate(e))]]},"feature-state":[t5,[t1],(e,[i])=>r4(i.evaluate(e),e.featureState||{})],properties:[t4,[],e=>e.properties()],"geometry-type":[t1,[],e=>e.geometryType()],id:[t5,[],e=>e.id()],zoom:[t0,[],e=>e.globals.zoom],pitch:[t0,[],e=>e.globals.pitch||0],"distance-from-center":[t0,[],e=>e.distanceFromCenter()],"measure-light":[t0,[t1],(e,[i])=>e.measureLight(i.evaluate(e))],"heatmap-density":[t0,[],e=>e.globals.heatmapDensity||0],"line-progress":[t0,[],e=>e.globals.lineProgress||0],"raster-value":[t0,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[t0,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[t0,[],e=>e.globals.skyRadialProgress||0],accumulated:[t5,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[t0,r5(t0),(e,i)=>{let r=0;for(let a of i)r+=a.evaluate(e);return r}],"*":[t0,r5(t0),(e,i)=>{let r=1;for(let a of i)r*=a.evaluate(e);return r}],"-":{type:t0,overloads:[[[t0,t0],(e,[i,r])=>i.evaluate(e)-r.evaluate(e)],[[t0],(e,[i])=>-i.evaluate(e)]]},"/":[t0,[t0,t0],(e,[i,r])=>i.evaluate(e)/r.evaluate(e)],"%":[t0,[t0,t0],(e,[i,r])=>i.evaluate(e)%r.evaluate(e)],ln2:[t0,[],()=>Math.LN2],pi:[t0,[],()=>Math.PI],e:[t0,[],()=>Math.E],"^":[t0,[t0,t0],(e,[i,r])=>Math.pow(i.evaluate(e),r.evaluate(e))],sqrt:[t0,[t0],(e,[i])=>Math.sqrt(i.evaluate(e))],log10:[t0,[t0],(e,[i])=>Math.log(i.evaluate(e))/Math.LN10],ln:[t0,[t0],(e,[i])=>Math.log(i.evaluate(e))],log2:[t0,[t0],(e,[i])=>Math.log(i.evaluate(e))/Math.LN2],sin:[t0,[t0],(e,[i])=>Math.sin(i.evaluate(e))],cos:[t0,[t0],(e,[i])=>Math.cos(i.evaluate(e))],tan:[t0,[t0],(e,[i])=>Math.tan(i.evaluate(e))],asin:[t0,[t0],(e,[i])=>Math.asin(i.evaluate(e))],acos:[t0,[t0],(e,[i])=>Math.acos(i.evaluate(e))],atan:[t0,[t0],(e,[i])=>Math.atan(i.evaluate(e))],min:[t0,r5(t0),(e,i)=>Math.min(...i.map(i=>i.evaluate(e)))],max:[t0,r5(t0),(e,i)=>Math.max(...i.map(i=>i.evaluate(e)))],abs:[t0,[t0],(e,[i])=>Math.abs(i.evaluate(e))],round:[t0,[t0],(e,[i])=>{let r=i.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[t0,[t0],(e,[i])=>Math.floor(i.evaluate(e))],ceil:[t0,[t0],(e,[i])=>Math.ceil(i.evaluate(e))],"filter-==":[t2,[t1,t5],(e,[i,r])=>e.properties()[i.value]===r.value],"filter-id-==":[t2,[t5],(e,[i])=>e.id()===i.value],"filter-type-==":[t2,[t1],(e,[i])=>e.geometryType()===i.value],"filter-<":[t2,[t1,t5],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<n}],"filter-id-<":[t2,[t5],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<a}],"filter->":[t2,[t1,t5],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>n}],"filter-id->":[t2,[t5],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>a}],"filter-<=":[t2,[t1,t5],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<=n}],"filter-id-<=":[t2,[t5],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<=a}],"filter->=":[t2,[t1,t5],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>=n}],"filter-id->=":[t2,[t5],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>=a}],"filter-has":[t2,[t5],(e,[i])=>i.value in e.properties()],"filter-has-id":[t2,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[t2,[t7(t1)],(e,[i])=>i.value.indexOf(e.geometryType())>=0],"filter-id-in":[t2,[t7(t5)],(e,[i])=>i.value.indexOf(e.id())>=0],"filter-in-small":[t2,[t1,t7(t5)],(e,[i,r])=>r.value.indexOf(e.properties()[i.value])>=0],"filter-in-large":[t2,[t1,t7(t5)],(e,[i,r])=>(function(e,i,r,a){for(;r<=a;){let n=r+a>>1;if(i[n]===e)return!0;
1i[n]>e?a=n-1:r=n+1}return!1})(e.properties()[i.value],r.value,0,r.value.length-1)],all:{type:t2,overloads:[[[t2,t2],(e,[i,r])=>i.evaluate(e)&&r.evaluate(e)],[r5(t2),(e,i)=>{for(let r of i)if(!r.evaluate(e))return!1;return!0}]]},any:{type:t2,overloads:[[[t2,t2],(e,[i,r])=>i.evaluate(e)||r.evaluate(e)],[r5(t2),(e,i)=>{for(let r of i)if(r.evaluate(e))return!0;return!1}]]},"!":[t2,[t2],(e,[i])=>!i.evaluate(e)],"is-supported-script":[t2,[t1],(e,[i])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[t1,[t1],(e,[i])=>i.evaluate(e).toUpperCase()],downcase:[t1,[t1],(e,[i])=>i.evaluate(e).toLowerCase()],concat:[t1,r5(t5),(e,i)=>i.map(i=>im(i.evaluate(e))).join("")],"resolved-locale":[t1,[t6],(e,[i])=>i.evaluate(e).resolvedLocale()],random:[t0,[t0,t0,t5],(e,i)=>{let r;let[a,n,o]=i.map(i=>i.evaluate(e));if(a>n||a===n)return a;if("string"==typeof o)r=function(e){let i=0;if(0===e.length)return i;for(let r=0;r<e.length;r++)i=(i<<5)-i+e.charCodeAt(r)|0;return i}(o);else{if("number"!=typeof o)throw new ig(`Invalid seed input: ${o}`);r=o}return a+r0(r)()*(n-a)}]});class au{constructor(e,i,r,a){this.expression=e,this._warningHistory={},this._evaluator=new iE(r,a),this._defaultValue=i?"color"===i.type&&(ar(i.default)||Array.isArray(i.default))?new tZ(0,0,0,0):"color"===i.type?tZ.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=i&&"enum"===i.type?i.values:null,this.configDependencies=rc(e)}evaluateWithoutErrorHandling(e,i,r,a,n,o,s,l){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=a||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=l||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,r,a,n,o,s,l){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=l||null;try{let e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new ig(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function ac(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in r1}function ad(e,i,r,a){let n=new rm(r1,[],i?function(e){let i={color:t3,string:t1,number:t0,enum:t1,boolean:t2,formatted:t8,resolvedImage:t9};return"array"===e.type?t7(i[e.value]||t5,e.length):i[e.type]}(i):void 0,void 0,void 0,r,a),o=n.parse(e,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return o?r6(new au(o,i,r,a)):r8(n.errors)}class ap{constructor(e,i,r,a){this.kind=e,this._styleExpression=i,this.isLightConstant=r,this.isLineProgressConstant=a,this.isStateDependent="constant"!==e&&!ru(i.expression),this.configDependencies=rc(i.expression)}evaluateWithoutErrorHandling(e,i,r,a,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,o)}evaluate(e,i,r,a,n,o){return this._styleExpression.evaluate(e,i,r,a,n,o)}}class af{constructor(e,i,r,a,n,o){this.kind=e,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==e&&!ru(i.expression),this.isLightConstant=n,this.isLineProgressConstant=o,this.configDependencies=rc(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,r,a,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,o)}evaluate(e,i,r,a,n,o){return this._styleExpression.evaluate(e,i,r,a,n,o)}interpolationFactor(e,i,r){return this.interpolationType?rR.interpolationFactor(this.interpolationType,e,i,r):0}}function am(e,i,r,a){if("error"===(e=ad(e,i,r,a)).result)return e;let n=e.value.expression,o=rh(n);if(!o&&!r7(i))return r8([new tK("","data expressions not supported")]);let s=rd(n,["zoom","pitch","distance-from-center"]);if(!s&&!at(i))return r8([new tK("","zoom expressions not supported")]);let l=rd(n,["measure-light"]);if(!l&&!ae(i))return r8([new tK("","measure-light expression not supported")]);let h=rd(n,["line-progress"]);if(!h&&!r9(i.expression,"line-progress"))return r8([new tK("","line-progress expression not supported")]);let u=i.expression&&i.expression.relaxZoomRestriction,c=function e(i){let r=null;if(i instanceof rk)r=e(i.result);else if(i instanceof rO){for(let a of i.args)if(r=e(a))break}else(i instanceof rg||i instanceof rR)&&i.input instanceof iA&&"zoom"===i.input.name&&(r=i);return r instanceof tK||i.eachChild(i=>{let a=e(i);a instanceof tK?r=a:r&&a&&r!==a&&(r=new tK("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}(n);return c||s||u?c instanceof tK?r8([c]):c instanceof rR&&!ai(i)?r8([new tK("",'"interpolate" expressions cannot be used with this property')]):r6(c?new af(o&&h?"camera":"composite",e.value,c.labels,c instanceof rR?c.interpolation:void 0,l,h):new ap(o&&h?"constant":"source",e.value,l,h)):r8([new tK("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class a_{constructor(e,i){this._parameters=e,this._specification=i,tY(this,function e(i,r){let a,n,o;let s="color"===r.type,l=i.stops&&"object"==typeof i.stops[0][0],h=l||!(l||void 0!==i.property),u=i.type||(ai(r)?"exponential":"interval");
1if(s&&((i=tY({},i)).stops&&(i.stops=i.stops.map(e=>[e[0],tZ.parse(e[1])])),i.default=tZ.parse(i.default?i.default:r.default)),i.colorSpace&&"rgb"!==i.colorSpace&&!rD[i.colorSpace])throw Error(`Unknown color space: ${i.colorSpace}`);if("exponential"===u)a=al;else if("interval"===u)a=as;else if("categorical"===u){for(let e of(a=ao,n=Object.create(null),i.stops))n[e[0]]=e[1];o=typeof i.stops[0][0]}else{if("identity"!==u)throw Error(`Unknown function type "${u}"`);a=ah}if(l){let a={},n=[];for(let e=0;e<i.stops.length;e++){let r=i.stops[e],o=r[0].zoom;void 0===a[o]&&(a[o]={zoom:o,type:i.type,property:i.property,default:i.default,stops:[]},n.push(o)),a[o].stops.push([r[0].value,r[1]])}let o=[];for(let i of n)o.push([a[i].zoom,e(a[i],r)]);let s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:rR.interpolationFactor.bind(void 0,s),zoomStops:o.map(e=>e[0]),evaluate:({zoom:e},a)=>al({stops:o,base:i.base},r,e).evaluate(e,a)}}if(h){let e="exponential"===u?{name:"exponential",base:void 0!==i.base?i.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:rR.interpolationFactor.bind(void 0,e),zoomStops:i.stops.map(e=>e[0]),evaluate:({zoom:e})=>a(i,r,e,n,o)}}return{kind:"source",evaluate(e,s){let l=s&&s.properties?s.properties[i.property]:void 0;return void 0===l?an(i.default,r.default):a(i,r,l,n,o)}}}(this._parameters,this._specification))}static deserialize(e){return new a_(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}var ag,ay,ax=K(function(){if(ay)return ag;function e(e,i,r){var a=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(i=n[1])+2*(r=n[2]);for(var o=0;o<this.d*this.d;o++){var s=n[3+o],l=n[3+o+1];a.push(s===l?null:n.subarray(s,l))}var h=n[3+a.length+1];this.keys=n.subarray(n[3+a.length],h),this.bboxes=n.subarray(h),this.insert=this._insertReadonly}else{this.d=i+2*r;for(var u=0;u<this.d*this.d;u++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=r,this.scale=i/e,this.uid=0;var c=r/i*e;this.min=-c,this.max=e+c}return ay=1,ag=e,e.prototype.insert=function(e,i,r,a,n){this._forEachCell(i,r,a,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(e,i,r,a,n,o){this.cells[n].push(o)},e.prototype.query=function(e,i,r,a,n){var o=this.min,s=this.max;if(e<=o&&i<=o&&s<=r&&s<=a&&!n)return Array.prototype.slice.call(this.keys);var l=[];return this._forEachCell(e,i,r,a,this._queryCell,l,{},n),l},e.prototype._queryCell=function(e,i,r,a,n,o,s,l){var h=this.cells[n];if(null!==h)for(var u=this.keys,c=this.bboxes,d=0;d<h.length;d++){var p=h[d];if(void 0===s[p]){var f=4*p;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):e<=c[f+2]&&i<=c[f+3]&&r>=c[f+0]&&a>=c[f+1])?(s[p]=!0,o.push(u[p])):s[p]=!1}}},e.prototype._forEachCell=function(e,i,r,a,n,o,s,l){for(var h=this._convertToCellCoord(e),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a),p=h;p<=c;p++)for(var f=u;f<=d;f++){var m=this.d*f+p;if((!l||l(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&n.call(this,e,i,r,a,m,o,s,l))return}},e.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},e.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,i=3+this.cells.length+1+1,r=0,a=0;a<this.cells.length;a++)r+=this.cells[a].length;var n=new Int32Array(i+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;for(var o=i,s=0;s<e.length;s++){var l=e[s];n[3+s]=o,n.set(l,o),o+=l.length}return n[3+e.length]=o,n.set(this.keys,o),n[3+e.length+1]=o+=this.keys.length,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer},ag}());let av={};function ab(e,i,r={}){Object.defineProperty(e,"_classRegistryKey",{value:i,writable:!1}),av[i]={klass:e,omit:r.omit||[]}}for(let e in ab(Object,"Object"),ax.serialize=function(e,i){let r=e.toArrayBuffer();return i&&i.add(r),{buffer:r}},ax.deserialize=function(e){return new ax(e.buffer)},Object.defineProperty(ax,"name",{value:"Grid"}),ab(ax,"Grid"),"undefined"!=typeof DOMMatrix&&ab(DOMMatrix,"DOMMatrix"),ab(tZ,"Color"),ab(Error,"Error"),ab(il,"Formatted"),ab(is,"FormattedSection"),ab(tS,"AJAXError"),ab(iu,"ResolvedImage"),ab(a_,"StylePropertyFunction"),ab(au,"StyleExpression",{omit:["_evaluator"]}),ab(ih,"ImageIdWithOptions"),ab(af,"ZoomDependentExpression"),ab(ap,"ZoomConstantExpression"),ab(iA,"CompoundExpression",{omit:["_evaluate"]}),r1)av[r1[e]._classRegistryKey]||ab(r1[e],`Expression${e}`);function aw(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function aT(e){return self.ImageBitmap&&e instanceof ImageBitmap}function aS(e,i){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(aw(e)||aT(e))return i&&i.add(e),e;if(ArrayBuffer.isView(e))return i&&i.add(e.buffer),e;if(e instanceof ImageData)return i&&i.add(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let a of e)r.push(aS(a,i));return r}if(e instanceof Map){let i={$name:"Map"};for(let[r,a]of e.entries())i[r]=aS(a);return i}if(e instanceof Set){let i={$name:"Set"},r=0;for(let a of e.values())i[++r]=aS(a);return i}if("object"==typeof e){let r=e.constructor,a=r._classRegistryKey;if(!a)throw Error(`Can't serialize object of unregistered class "${a}".`);let n=r.serialize?r.serialize(e,i):{};if(!r.serialize){for(let r in e)e.hasOwnProperty(r)&&(av[a].omit.indexOf(r)>=0||(n[r]=aS(e[r],i)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(n.$name=a),n}throw Error("can't serialize object of type "+typeof e)}function aM(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||aw(e)||aT(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(aM);if("object"==typeof e){let i=e.$name||"Object";if("Map"===i){let i=new Map;for(let r of Object.keys(e))"$name"!==r&&i.set(r,aM(e[r]));return i}if("Set"===i){let i=new Set;for(let r of Object.keys(e))"$name"!==r&&i.add(aM(e[r]));return i}let{klass:r}=av[i];if(!r)throw Error(`Can't deserialize unregistered class "${i}".`);if(r.deserialize)return r.deserialize(e);let a=Object.create(r.prototype);for(let i of Object.keys(e))"$name"!==i&&(a[i]=aM(e[i]));return a}throw Error("can't deserialize object of type "+typeof e)}let aE={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>
1=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519,Osage:e=>e>=66736&&e<=66815,"CJK Unified Ideographs Extension B":e=>e>=131072&&e<=173791};function aA(e){for(let i of e)if(aI(i.charCodeAt(0)))return!0;return!1}function aI(e){return!(746!==e&&747!==e&&(e<4352||!(aE["Bopomofo Extended"](e)||aE.Bopomofo(e)||aE["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||aE["CJK Compatibility Ideographs"](e)||aE["CJK Compatibility"](e)||aE["CJK Radicals Supplement"](e)||aE["CJK Strokes"](e)||!(!aE["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||aE["CJK Unified Ideographs Extension A"](e)||aE["CJK Unified Ideographs"](e)||aE["Enclosed CJK Letters and Months"](e)||aE["Hangul Compatibility Jamo"](e)||aE["Hangul Jamo Extended-A"](e)||aE["Hangul Jamo Extended-B"](e)||aE["Hangul Jamo"](e)||aE["Hangul Syllables"](e)||aE.Hiragana(e)||aE["Ideographic Description Characters"](e)||aE.Kanbun(e)||aE["Kangxi Radicals"](e)||aE["Katakana Phonetic Extensions"](e)||aE.Katakana(e)&&12540!==e||!(!aE["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!aE["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||aE["Unified Canadian Aboriginal Syllabics"](e)||aE["Unified Canadian Aboriginal Syllabics Extended"](e)||aE["Vertical Forms"](e)||aE["Yijing Hexagram Symbols"](e)||aE["Yi Syllables"](e)||aE["Yi Radicals"](e))))}function aC(e){return!(aI(e)||aE["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||aE["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||aE["Letterlike Symbols"](e)||aE["Number Forms"](e)||aE["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||aE["Control Pictures"](e)&&9251!==e||aE["Optical Character Recognition"](e)||aE["Enclosed Alphanumerics"](e)||aE["Geometric Shapes"](e)||aE["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||aE["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||aE["CJK Symbols and Punctuation"](e)||aE.Katakana(e)||aE["Private Use Area"](e)||aE["CJK Compatibility Forms"](e)||aE["Small Form Variants"](e)||aE["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}function aP(e){return e>=1424&&e<=2303||aE["Arabic Presentation Forms-A"](e)||aE["Arabic Presentation Forms-B"](e)}let az="deferred",aD="loading",aR="loaded",aL=null,aO="unavailable",ak=null,aF=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(aO="error"),aL&&aL(e)};function aB(){aN.fire(new tF("pluginStateChange",{pluginStatus:aO,pluginURL:ak}))}let aN=new tU,aV=function(){return aO},aU=function(){if(aO!==az||!ak)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");aO=aD,aB(),ak&&tA({url:ak},e=>{e?aF(e):(aO=aR,aB())})},aj={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>aO===aR||null!=aj.applyArabicShaping,isLoading:()=>aO===aD,setState(e){aO=e.pluginStatus,ak=e.pluginURL},isParsed:()=>null!=aj.applyArabicShaping&&null!=aj.processBidirectionalText&&null!=aj.processStyledBidirectionalText,getPluginURL:()=>ak};class aG{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,i){for(let a of e){var r;
1if(r=a.charCodeAt(0),!i&&aP(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||aE.Khmer(r))return!1}return!0}(e,aj.isLoaded())}}class aq{constructor(e,i,r,a){this.property=e,this.value=i,this.expression=function(e,i,r,a){if(ar(e))return new a_(e,i);if(ac(e)||Array.isArray(e)&&e.length>0){let n=am(e,i,r,a);if("error"===n.result)throw Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return n.value}{let r=e;return"string"==typeof e&&"color"===i.type&&(r=tZ.parse(e)),{kind:"constant",configDependencies:new Set,evaluate:()=>r}}}(void 0===i?e.specification.default:i,e.specification,r,a)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,i,r){return this.property.possiblyEvaluate(this,e,i,r)}}class aZ{constructor(e,i,r){this.property=e,this.value=new aq(e,void 0,i,r)}transitioned(e,i){return new a$(this.property,this.value,i,eZ({},e.transition,this.transition),e.now)}untransitioned(){return new a$(this.property,this.value,null,{},0)}}class aH{constructor(e,i,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=r,this.configDependencies=new Set}getValue(e){return eQ(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new aZ(this._values[e].property,this._scope,this._options)),this._values[e].value=new aq(this._values[e].property,null===i?void 0:eQ(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);let r=this._properties.properties;if(e)for(let i in e){let a=e[i];if(eY(i,"-transition")){let e=i.slice(0,-11);r[e]&&this.setTransition(e,a)}else r.hasOwnProperty(i)&&this.setValue(i,a)}}getTransition(e){return eQ(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new aZ(this._values[e].property)),this._values[e].transition=eQ(i)||void 0}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r);let a=this.getTransition(i);void 0!==a&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){let r=new aW(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(e,i._values[a]);return r}untransitioned(){let e=new aW(this._properties);for(let i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class a${constructor(e,i,r,a,n){let o=a.delay||0,s=a.duration||0;n=n||0,this.property=e,this.value=i,this.begin=n+o,this.end=this.begin+s,e.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(e,i,r){let a=e.now||0,n=this.value.possiblyEvaluate(e,i,r),o=this.prior;if(o){if(a>this.end||this.value.isDataDriven())return this.prior=null,n;if(a<this.begin)return o.possiblyEvaluate(e,i,r);{let s=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,i,r),n,eB(s))}}return n}}class aW{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,r){let a=new aK(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class aX{constructor(e,i,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=r,this.configDependencies=new Set}getValue(e){return eQ(this._values[e].value)}setValue(e,i){this._values[e]=new aq(this._values[e].property,null===i?void 0:eQ(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r)}return e}possiblyEvaluate(e,i,r){let a=new aK(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}}class aY{constructor(e,i,r){this.property=e,this.value=i,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,i,r,a){return this.property.evaluate(this.value,this.parameters,e,i,r,a)}}class aK{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class aJ{constructor(e){this.specification=e}
1possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,r){let a=tX[this.specification.type];return a?a(e,i,r):e}}class aQ{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,r,a){return new aY(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(i,null,{},r,a)}:e.expression,i)}interpolate(e,i,r){if("constant"!==e.value.kind||"constant"!==i.value.kind)return e;if(void 0===e.value.value||void 0===i.value.value)return new aY(this,{kind:"constant",value:void 0},e.parameters);let a=tX[this.specification.type];return a?new aY(this,{kind:"constant",value:a(e.value.value,i.value.value,r)},e.parameters):e}evaluate(e,i,r,a,n,o){return"constant"===e.kind?e.value:e.evaluate(i,r,a,n,o)}}class a0{constructor(e){this.specification=e}possiblyEvaluate(e,i,r,a){return!!e.expression.evaluate(i,null,{},r,a)}interpolate(){return!1}}class a1{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];let i=new aG(0,{});for(let r in e){let a=e[r];a.specification.overridable&&this.overridableProperties.push(r);let n=this.defaultPropertyValues[r]=new aq(a,void 0),o=this.defaultTransitionablePropertyValues[r]=new aZ(a);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=n.possiblyEvaluate(i)}}}ab(aQ,"DataDrivenProperty"),ab(aJ,"DataConstantProperty"),ab(a0,"ColorRampProperty");var a2=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow","experimental":true},"rain":{"type":"rain","experimental":true},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor","experimental":true},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"experimental":true,"type":"featuresets"}},"featuresets":{"experimental":true,"*":{"type":"featureset"}},"featureset":{"experimental":true,"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"experimental":true,"layer":{"type":"string","required":true},"properties":{"type":"selectorProperty","required":false},"featureNamespace":{"type":"string","required":false}},"selectorProperty":{"experimental":true,"*":{"type":"*"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","property-type":"data-constant","expression":{},"required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"property-type":"data-constant"},"shadow-quality":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]},"experimental":true},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"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":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"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},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"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},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"experimental":true,"type":{"required":true,"type":"enum","values":{"raster-array":1}},"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},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{"experimental":true},"hillshade":{},"model":{"experimental":true},"background":{},"sky":{},"slot":{},"clip":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{},"property-type":"data-constant"},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{},"property-type":"data-constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","experimental":true,"private":true,"expression":{},"property-type":"data-constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","experimental":true,"default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","experimental":true,"expression":{},"property-type":"data-constant"},"line-cross-slope":{"type":"number","experimental":true,"expression":{},"property-type":"constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","experimental":true,"private":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","experimental":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","property-type":"data-constant","default":0.4,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","property-type":"data-constant","default":0.71,"minimum":0,"maximum":5,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","property-type":"data-constant","default":0.57,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","property-type":"data-constant","default":0.7,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","experimental":true,"property-type":"data-constant","expression":{}},"buildingFeaturesetId":{"type":"string","experimental":true,"property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":
1{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"flat","property-type":"data-constant"},"fill-extrusion-base-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"terrain","property-type":"data-constant"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]},"experimental":true,"property-type":"data-constant"},"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":
1{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function a3(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function a4(e){if(Array.isArray(e))return e.map(a4);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let i={};for(let r in e)i[r]=a4(e[r]);return i}return a3(e)}function a5(e){if(!0===e||!1===e)return!0;
1if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let i of e.slice(1))if(!a5(i)&&"boolean"!=typeof i)return!1;return!0;default:return!0}}function a6(e,i="",r=null,a="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};a5(e)||(e=function e(i){if(!i)return!0;let r=i[0];return i.length<=1?"any"!==r:"=="===r?ne(i[1],i[2],"=="):"!="===r?nr(ne(i[1],i[2],"==")):"<"===r||">"===r||"<="===r||">="===r?ne(i[1],i[2],r):"any"===r?["any"].concat(i.slice(1).map(e)):"all"===r?["all"].concat(i.slice(1).map(e)):"none"===r?["all"].concat(i.slice(1).map(e).map(nr)):"in"===r?nt(i[1],i.slice(2)):"!in"===r?nr(nt(i[1],i.slice(2))):"has"===r?ni(i[1]):"!has"!==r||nr(ni(i[1]))}(e));let n=e,o=!0;try{o=function(e){if(!a8(e))return e;let i=a4(e);return function e(i){let r=!1,a=[];if("case"===i[0]){for(let e=1;e<i.length-1;e+=2)r=r||a8(i[e]),a.push(i[e+1]);a.push(i[i.length-1])}else if("match"===i[0]){r=r||a8(i[1]);for(let e=2;e<i.length-1;e+=2)a.push(i[e+1]);a.push(i[i.length-1])}else if("step"===i[0]){r=r||a8(i[1]);for(let e=1;e<i.length-1;e+=2)a.push(i[e+1])}r&&(i.length=0,i.push("any",...a));for(let r=1;r<i.length;r++)e(i[r])}(i),i=function e(i){if(!Array.isArray(i))return i;let r=function(e){if(a9.has(e[0])){for(let i=1;i<e.length;i++)if(a8(e[i]))return!0}return e}(i);return!0===r?r:r.map(i=>e(i))}(i)}(n)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
3and paste the contents of this message in the report.
4Thank you!
5Filter Expression:
6${JSON.stringify(n,null,2)}
7        `)}let s=null,l=null;if("background"!==a&&"sky"!==a&&"slot"!==a){let e=ad(o,l=a2[`filter_${a}`],i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));s=(i,r,a)=>e.value.evaluate(i,r,{},a)}let h=null,u=null;if(o!==n){let e=ad(n,l,i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));h=(i,r,a,n,o)=>e.value.evaluate(i,r,{},a,void 0,void 0,n,o),u=!rh(e.value.expression)}return{filter:s,dynamicFilter:h||void 0,needGeometry:function e(i){if(!Array.isArray(i))return!1;if("within"===i[0]||"distance"===i[0])return!0;for(let r=1;r<i.length;r++)if(e(i[r]))return!0;return!1}(o),needFeature:!!u}}function a8(e){var i;if(!Array.isArray(e))return!1;if("pitch"===(i=e[0])||"distance-from-center"===i)return!0;for(let i=1;i<e.length;i++)if(a8(e[i]))return!0;return!1}let a9=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function a7(e,i){return e<i?-1:e>i?1:0}function ne(e,i,r){switch(e){case"$type":return[`filter-type-${r}`,i];case"$id":return[`filter-id-${r}`,i];default:return[`filter-${r}`,e,i]}}function nt(e,i){if(0===i.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(e=>typeof e!=typeof i[0])?["filter-in-large",e,["literal",i.sort(a7)]]:["filter-in-small",e,["literal",i]]}}function ni(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function nr(e){return["!",e]}function na(e,i){return i?`${e}�${i}`:e}let nn="-transition",no=new Set(["fill","line","background","hillshade","raster"]);class ns extends tU{constructor(e,i,r,a,n){if(super(),this.id=e.id,this.fqid=na(this.id,r),this.type=e.type,this.scope=r,this.lut=a,this.options=n,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;let i=ad(this.filter,a2[`filter_${e.type}`]);"error"!==i.result&&(this.configDependencies=new Set([...this.configDependencies,...i.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new aX(i.layout,this.scope,n),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){for(let r in this._transitionablePaint=new aH(i.paint,this.scope,n),e.paint)this.setPaintProperty(r,e.paint[r]);for(let i in e.layout)this.setLayoutProperty(i,e.layout[i]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new aK(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D()&&no.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if("custom"===this.type&&"visibility"===e)return void(this.visibility=i);let r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...r.configDependencies]),"visibility"===e&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return eY(e,nn)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){let r=this._transitionablePaint,a=r._properties.properties;if(eY(e,nn)){let n=e.slice(0,-11);return a[n]&&r.setTransition(n,i||void 0),!1}if(!a[e])return!1;let n=r._values[e],o=n.value.isDataDriven(),s=n.value;r.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...r.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);let l=r._values[e].value,h=l.isDataDriven(),u=eY(e,"pattern")||"line-dasharray"===e;return h||o||u||this._handleOverridablePaintPropertyUpdate(e,s,l)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,r){return null}_handleOverridablePaintPropertyUpdate(e,i,r){return!1}
7isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return eJ({id:this.id,type:this.type,slot:this.slot,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()},(e,i)=>!(void 0===e||"layout"===i&&!Object.keys(e).length||"paint"===i&&!Object.keys(e).length))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(let e in this.paint._values){let i=this.paint.get(e);if(i instanceof aY&&r7(i.property.specification)&&("source"===i.value.kind||"composite"===i.value.kind)&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=a6(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,r,a,n,o,s,l,h){}}let nl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
7class nh{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class nu{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function nc(e,i=1){let r=0,a=0;return{members:e.map(e=>{let n=nl[e.type].BYTES_PER_ELEMENT,o=r=nd(r,Math.max(i,n)),s=e.components||1;return a=Math.max(a,n),r+=n*s,{name:e.name,type:e.type,components:s,offset:o}}),size:nd(r,Math.max(a,i)),alignment:i}}function nd(e,i){return Math.ceil(e/i)*i}class np extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.int16[a+0]=i,this.int16[a+1]=r,e}}np.prototype.bytesPerElement=4,ab(np,"StructArrayLayout2i4");class nf extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,e}}nf.prototype.bytesPerElement=6,ab(nf,"StructArrayLayout3i6");class nm extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.int16[o+0]=i,this.int16[o+1]=r,this.int16[o+2]=a,this.int16[o+3]=n,e}}nm.prototype.bytesPerElement=8,ab(nm,"StructArrayLayout4i8");class n_ extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=5*e;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,this.int16[s+3]=n,this.int16[s+4]=o,e}}n_.prototype.bytesPerElement=10,ab(n_,"StructArrayLayout5i10");class ng extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=6*e,u=12*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.uint8[u+4]=a,this.uint8[u+5]=n,this.uint8[u+6]=o,this.uint8[u+7]=s,this.float32[3*e+2]=l,e}}ng.prototype.bytesPerElement=12,ab(ng,"StructArrayLayout2i4ub1f12");class ny extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.float32[o+0]=i,this.float32[o+1]=r,this.float32[o+2]=a,this.float32[o+3]=n,e}}ny.prototype.bytesPerElement=16,ab(ny,"StructArrayLayout4f16");class nx extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,e}}nx.prototype.bytesPerElement=12,ab(nx,"StructArrayLayout3f12");class nv extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=6*e;return this.uint16[s+0]=i,this.uint16[s+1]=r,this.uint16[s+2]=a,this.uint16[s+3]=n,this.float32[3*e+2]=o,e}}nv.prototype.bytesPerElement=12,ab(nv,"StructArrayLayout4ui1f12");class nb extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.uint16[o+0]=i,this.uint16[o+1]=r,this.uint16[o+2]=a,this.uint16[o+3]=n,e}}nb.prototype.bytesPerElement=8,ab(nb,"StructArrayLayout4ui8");class nw extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=6*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=o,this.int16[l+5]=s,e}}nw.prototype.bytesPerElement=12,ab(nw,"StructArrayLayout6i12");class nT extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,e,i,r,a,n,o,s,l,h,u,c,d)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=12*e;return this.int16[f+0]=i,this.int16[f+1]=r,this.int16[f+2]=a,this.int16[f+3]=n,this.uint16[f+4]=o,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=h,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=d,this.int16[f+11]=p,e}}nT.prototype.bytesPerElement=24,ab(nT,"StructArrayLayout4i4ui4i24");class nS extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=10*e,h=5*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,e}}nS.prototype.bytesPerElement=20,ab(nS,"StructArrayLayout3i3f20");class nM extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}nM.prototype.bytesPerElement=4,ab(nM,"StructArrayLayout1ul4");class nE extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;
7return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=r,e}}nE.prototype.bytesPerElement=4,ab(nE,"StructArrayLayout2ui4");class nA extends nu{_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(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,a,n,o,s,l,h,u,c,d,p)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f){let m=20*e,_=10*e;return this.int16[m+0]=i,this.int16[m+1]=r,this.int16[m+2]=a,this.int16[m+3]=n,this.int16[m+4]=o,this.float32[_+3]=s,this.float32[_+4]=l,this.float32[_+5]=h,this.float32[_+6]=u,this.int16[m+14]=c,this.uint32[_+8]=d,this.uint16[m+18]=p,this.uint16[m+19]=f,e}}nA.prototype.bytesPerElement=40,ab(nA,"StructArrayLayout5i4f1i1ul2ui40");class nI extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=8*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=a,this.int16[h+4]=n,this.int16[h+5]=o,this.int16[h+6]=s,this.int16[h+7]=l,e}}nI.prototype.bytesPerElement=16,ab(nI,"StructArrayLayout3i2i2i16");class nC extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=4*e,l=8*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.int16[l+6]=n,this.int16[l+7]=o,e}}nC.prototype.bytesPerElement=16,ab(nC,"StructArrayLayout2f1f2i16");class nP extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=20*e,h=5*e;return this.uint8[l+0]=i,this.uint8[l+1]=r,this.float32[h+1]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,e}}nP.prototype.bytesPerElement=20,ab(nP,"StructArrayLayout2ub4f20");class nz extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.uint16[n+0]=i,this.uint16[n+1]=r,this.uint16[n+2]=a,e}}nz.prototype.bytesPerElement=6,ab(nz,"StructArrayLayout3ui6");class nD extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=this.length;return this.resize(w+1),this.emplace(w,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=30*e,S=15*e,M=60*e;return this.int16[T+0]=i,this.int16[T+1]=r,this.int16[T+2]=a,this.float32[S+2]=n,this.float32[S+3]=o,this.uint16[T+8]=s,this.uint16[T+9]=l,this.uint32[S+5]=h,this.uint32[S+6]=u,this.uint32[S+7]=c,this.uint16[T+16]=d,this.uint16[T+17]=p,this.uint16[T+18]=f,this.float32[S+10]=m,this.float32[S+11]=_,this.uint8[M+48]=g,this.uint8[M+49]=y,this.uint8[M+50]=x,this.uint32[S+13]=v,this.int16[T+28]=b,this.uint8[M+58]=w,e}}nD.prototype.bytesPerElement=60,ab(nD,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class nR extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,z,D){let R=this.length;return this.resize(R+1),this.emplace(R,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,z,D)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,z,D,R){let L=20*e,O=40*e;return this.float32[L+0]=i,this.float32[L+1]=r,this.int16[O+4]=a,this.int16[O+5]=n,this.int16[O+6]=o,this.int16[O+7]=s,this.int16[O+8]=l,this.int16[O+9]=h,this.int16[O+10]=u,this.int16[O+11]=c,this.int16[O+12]=d,this.uint16[O+13]=p,this.uint16[O+14]=f,this.uint16[O+15]=m,this.uint16[O+16]=_,this.uint16[O+17]=g,this.uint16[O+18]=y,this.uint16[O+19]=x,this.uint16[O+20]=v,this.uint16[O+21]=b,this.uint16[O+22]=w,this.uint16[O+23]=T,this.uint16[O+24]=S,this.uint16[O+25]=M,this.uint16[O+26]=E,this.uint16[O+27]=A,this.uint32[L+14]=I,this.float32[L+15]=C,this.float32[L+16]=P,this.float32[L+17]=z,this.float32[L+18]=D,this.uint8[80*e+76]=R,e}}nR.prototype.bytesPerElement=80,ab(nR,"StructArrayLayout2f9i15ui1ul4f1ub80");class nL extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}nL.prototype.bytesPerElement=4,ab(nL,"StructArrayLayout1f4");class nO extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=5*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.float32[s+3]=n,this.float32[s+4]=o,e}}nO.prototype.bytesPerElement=20,ab(nO,"StructArrayLayout5f20");class nk extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=7*e;return this.float32[h+0]=i,this.float32[h+1]=r,this.float32[h+2]=a,this.float32[h+3]=n,this.float32[h+4]=o,this.float32[h+5]=s,this.float32[h+6]=l,e}}nk.prototype.bytesPerElement=28,ab(nk,"StructArrayLayout7f28");class nF extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,i,r,a,n,o,s,l,h,u,c)}emplace(e,i,r,a,n,o,s,l,h,u,c,d){let p=11*e;return this.float32[p+0]=i,this.float32[p+1]=r,this.float32[p+2]=a,this.float32[p+3]=n,this.float32[p+4]=o,this.float32[p+5]=s,this.float32[p+6]=l,this.float32[p+7]=h,this.float32[p+8]=u,this.float32[p+9]=c,this.float32[p+10]=d,e}}nF.prototype.bytesPerElement=44,ab(nF,"StructArrayLayout11f44");class nB extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,e,i,r,a,n,o,s,l,h)}emplace(e,i,r,a,n,o,s,l,h,u){let c=9*e;return this.float32[c+0]=i,this.float32[c+1]=r,this.float32[c+2]=a,this.float32[c+3]=n,this.float32[c+4]=o,this.float32[c+5]=s,this.float32[c+6]=l,this.float32[c+7]=h,this.float32[c+8]=u,e}}nB.prototype.bytesPerElement=36,ab(nB,"StructArrayLayout9f36");class nN extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;
vendor: 4,154 bytes, line 7
7return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.float32[a+0]=i,this.float32[a+1]=r,e}}nN.prototype.bytesPerElement=8,ab(nN,"StructArrayLayout2f8");class nV extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=6*e;return this.uint32[3*e+0]=i,this.uint16[o+2]=r,this.uint16[o+3]=a,this.uint16[o+4]=n,e}}nV.prototype.bytesPerElement=12,ab(nV,"StructArrayLayout1ul3ui12");class nU extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}nU.prototype.bytesPerElement=2,ab(nU,"StructArrayLayout1ui2");class nj extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=this.length;return this.resize(g+1),this.emplace(g,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=16*e;return this.float32[y+0]=i,this.float32[y+1]=r,this.float32[y+2]=a,this.float32[y+3]=n,this.float32[y+4]=o,this.float32[y+5]=s,this.float32[y+6]=l,this.float32[y+7]=h,this.float32[y+8]=u,this.float32[y+9]=c,this.float32[y+10]=d,this.float32[y+11]=p,this.float32[y+12]=f,this.float32[y+13]=m,this.float32[y+14]=_,this.float32[y+15]=g,e}}nj.prototype.bytesPerElement=64,ab(nj,"StructArrayLayout16f64");class nG extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=10*e,u=5*e;return this.uint16[h+0]=i,this.uint16[h+1]=r,this.uint16[h+2]=a,this.uint16[h+3]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,e}}nG.prototype.bytesPerElement=20,ab(nG,"StructArrayLayout4ui3f20");class nq extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}nq.prototype.bytesPerElement=2,ab(nq,"StructArrayLayout1i2");class nZ extends nu{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}nZ.prototype.bytesPerElement=1,ab(nZ,"StructArrayLayout1ub1");class nH extends nh{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}nH.prototype.size=40;class n$ extends nA{get(e){return new nH(this,e)}}ab(n$,"CollisionBoxArray");class nW extends nh{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}
vendor: 5,059 bytes, line 7
7get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}nW.prototype.size=60;class nX extends nD{get(e){return new nW(this,e)}}ab(nX,"PlacedSymbolArray");class nY extends nh{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}nY.prototype.size=80;class nK extends nR{get(e){return new nY(this,e)}}ab(nK,"SymbolInstanceArray");class nJ extends nL{getoffsetX(e){return this.float32[1*e+0]}}ab(nJ,"GlyphOffsetArray");class nQ extends np{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}ab(nQ,"SymbolLineVertexArray");class n0 extends nh{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]}}n0.prototype.size=12;class n1 extends nV{get(e){return new n0(this,e)}}ab(n1,"FeatureIndexArray");class n2 extends nE{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}ab(n2,"FillExtrusionCentroidArray");class n3 extends nh{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}n3.prototype.size=6;class n4 extends nf{get(e){return new n3(this,e)}}ab(n4,"FillExtrusionWallArray");let n5=nc([{name:"a_pos",components:2,type:"Int16"}],4),n6=nc([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);
7class n8{constructor(e=[]){this.segments=e}_prepareSegment(e,i,r,a){let n=this.segments[this.segments.length-1];return e>n8.MAX_VERTEX_ARRAY_LENGTH&&e1(`Max vertices per segment is ${n8.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>n8.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a)&&(n={vertexOffset:i,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==a&&(n.sortKey=a),this.segments.push(n)),n}prepareSegment(e,i,r,a){return this._prepareSegment(e,i.length,r.length,a)}get(){return this.segments}destroy(){for(let e of this.segments)for(let i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,r,a){return new n8([{vertexOffset:e,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}}function n9(e,i){return 256*(e=eU(Math.floor(e),0,255))+eU(Math.floor(i),0,255)}n8.MAX_VERTEX_ARRAY_LENGTH=65535,ab(n8,"SegmentVector");let n7=nc([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),oe=nc([{name:"a_dash",components:4,type:"Uint16"}]);class ot{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,r,a){this.ids.push(oi(e)),this.positions.push(i,r,a)}eachPosition(e,i){let r=oi(e),a=0,n=this.ids.length-1;for(;a<n;){let e=a+n>>1;this.ids[e]>=r?n=e:a=e+1}for(;this.ids[a]===r;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){let r=new Float64Array(e.ids),a=new Uint32Array(e.positions);return function e(i,r,a,n){for(;a<n;){let o=i[a+n>>1],s=a-1,l=n+1;for(;;){do s++;while(i[s]<o);do l--;while(i[l]>o);if(s>=l)break;or(i,s,l),or(r,3*s,3*l),or(r,3*s+1,3*l+1),or(r,3*s+2,3*l+2)}l-a<n-l?(e(i,r,a,l),a=l+1):(e(i,r,l+1,n),n=l)}}(r,a,0,r.length-1),i&&(i.add(r.buffer),i.add(a.buffer)),{ids:r,positions:a}}static deserialize(e){let i;let r=new ot;for(let a of(r.ids=e.ids,r.positions=e.positions,r.ids))a!==i&&r.uniqueIds.push(a),i=a;return r.indexed=!0,r}}function oi(e){let i=+e;return!isNaN(i)&&Number.MIN_SAFE_INTEGER<=i&&i<=Number.MAX_SAFE_INTEGER?i:tk(String(e))}function or(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}ab(ot,"FeaturePositionMap");class oa{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,r){throw Error("Uniform#set() must be implemented by each concrete Uniform")}}class on extends oa{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}}class oo extends oa{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class os extends oa{constructor(e){super(e),this.current=[0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])))}}class ol extends oa{constructor(e){super(e),this.current=[0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])))}}class oh extends oa{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class ou extends oa{constructor(e){super(e),this.current=tZ.transparent.toRenderColor(null)}set(e,i,r){this.fetchUniformLocation(e,i)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}let oc=new Float32Array(16);class od extends oa{constructor(e){super(e),this.current=oc}set(e,i,r){if(this.fetchUniformLocation(e,i)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}let op=new Float32Array(9),of=new Float32Array(4);class om extends oa{constructor(e){super(e),this.current=of}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let e=0;e<4;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}}function o_(e){return[n9(255*e.r,255*e.g),n9(255*e.b,255*e.a)]}class og{constructor(e,i,r,a){this.value=e,this.uniformNames=i.map(e=>`u_${e}`),this.type=r,this.context=a}setUniform(e,i,r,a,n){let o=a.constantOr(this.value);i.set(e,n,o instanceof tZ?o.toRenderColor(this.ignoreLut?null:this.context.lut):o)}getBinding(e,i){return"color"===this.type?new ou(e):new oo(e)}}class oy{constructor(e,i){this.uniformNames=i.map(e=>`u_${e}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,r,a,n){let o="u_pattern"===n||"u_dash"===n?this.pattern:"u_pixel_ratio"===n?this.pixelRatio:null;o&&i.set(e,n,o)}getBinding(e,i){return"u_pattern"===i||"u_dash"===i?new oh(e):new oo(e)}}class ox{constructor(e,i,r,a){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,r,a,n,o,s){let l=this.paintVertexArray.length,h=this.expression.evaluate(new aG(0,{brightness:o}),i,{},n,a,s);this.paintVertexArray.resize(e),this._setPaintValue(l,e,h,this.context)}updatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate({zoom:0,brightness:s},r,a,void 0,n);this._setPaintValue(e,i,l,this.context)}_setPaintValue(e,i,r,a){if("color"===this.type){let n=o_(r.toRenderColor(this.ignoreLut?null:a.lut));for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let a=e;a<i;a++)this.paintVertexArray.emplace(a,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ov{constructor(e,i,r,a,n,o){this.expression=e,this.uniformNames=i.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=a,this.context=n,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate(new aG(this.context.zoom,{brightness:o}),i,{},n,a,s),h=this.expression.evaluate(new aG(this.context.zoom+1,{brightness:o}),i,{},n,a,s),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,l,h,this.context)}updatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate({zoom:this.context.zoom,brightness:s},r,a,void 0,n),h=this.expression.evaluate({zoom:this.context.zoom+1,brightness:s},r,a,void 0,n);this._setPaintValue(e,i,l,h,this.context)}_setPaintValue(e,i,r,a,n){if("color"===this.type){let a=o_(r.toRenderColor(this.ignoreLut?null:n.lut)),o=o_(r.toRenderColor(this.ignoreLut?null:n.lut));for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,a[0],a[1],o[0],o[1])}else{for(let n=e;n<i;n++)this.paintVertexArray.emplace(n,r,a);
7this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,r,a,n){let o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,s=eU(this.expression.interpolationFactor(o,this.context.zoom,this.context.zoom+1),0,1);i.set(e,n,s)}getBinding(e,i){return new oo(e)}}class ob{constructor(e,i,r,a,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===r?oe:n7).members;for(let e=0;e<i.length;++e);this.paintVertexArray=new a}populatePaintArray(e,i,r,a){let n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(n,e,i.patterns&&i.patterns[this.layerId],r)}updatePaintArray(e,i,r,a,n,o,s){this._setPaintValues(e,i,r.patterns&&r.patterns[this.layerId],o)}_setPaintValues(e,i,r,a){if(!a||!r)return;let n=a[r];if(!n)return;let{tl:o,br:s,pixelRatio:l}=n;for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,o[0],o[1],s[0],s[1],l)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ow{constructor(e,i,r=()=>!0){this.binders={},this._buffers=[],this.context=i;let a=[];for(let o in e.paint._values){var n;let s=e.paint.get(o),l=e.paint.get(`${o}-use-theme`);if(o.endsWith("-use-theme")||!r(o)||!(s instanceof aY&&r7(s.property.specification)))continue;let h=(n=e.type,oS[o]||[o.replace(`${n}-`,"").replace(/-/g,"_")]),u=s.value,c=s.property.specification.type,d=!!s.property.useIntegerZoom,p="line-dasharray"===o||o.endsWith("pattern"),f="line-dasharray"===o&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==u.kind||f){if("source"===u.kind||f||p){let i=oA(o,c,"source");this.binders[o]=p?new ob(u,h,c,i,e.id):new ox(u,h,c,i),a.push(`/a_${o}`)}else{let e=oA(o,c,"composite");this.binders[o]=new ov(u,h,c,d,i,e),a.push(`/z_${o}`)}}else this.binders[o]=p?new oy(u.value,h):new og(u.value,h,c,i),a.push(`/u_${o}`);l&&(this.binders[o].ignoreLut="none"===l.constantOr("default"),this.binders[o].checkUseTheme=!0)}this.cacheKey=a.sort().join("")}getMaxValue(e){let i=this.binders[e];return i instanceof ox||i instanceof ov?i.maxValue:0}populatePaintArrays(e,i,r,a,n,o,s){for(let l in this.binders){let h=this.binders[l];h.context=this.context,(h instanceof ox||h instanceof ov||h instanceof ob)&&h.populatePaintArray(e,i,r,a,n,o,s)}}setConstantPatternPositions(e){for(let i in this.binders){let r=this.binders[i];r instanceof oy&&r.setConstantPatternPositions(e)}}updatePaintArrays(e,i,r,a,n,o,s,l,h){let u=!1,c=Object.keys(e),d=0!==c.length&&!l,p=d?c:i.uniqueIds;for(let l in this.context.lut=n.lut,this.binders){let c=this.binders[l];if(c.context=this.context,(c instanceof ox||c instanceof ov||c instanceof ob)&&(!0===c.expression.isStateDependent||!1===c.expression.isLightConstant)){let f=n.paint.get(l);for(let r of(c.expression=f.value,p)){let n=e[r.toString()];i.eachPosition(r,(e,i,r)=>{let l=a.feature(e);c.updatePaintArray(i,r,l,n,o,s,h)})}if(!d)for(let i of r.uniqueIds){let n=e[i.toString()];r.eachPosition(i,(e,i,r)=>{let l=a.feature(e);c.updatePaintArray(i,r,l,n,o,s,h)})}u=!0}}return u}defines(){let e=[];for(let i in this.binders){let r=this.binders[i];(r instanceof og||r instanceof oy)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof ox||r instanceof ov||r instanceof ob)for(let i=0;i<r.paintVertexAttributes.length;i++)e.push(r.paintVertexAttributes[i].name)}return e}getBinderUniforms(){let e=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof og||r instanceof oy||r instanceof ov)for(let i of r.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){let i=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof og||a instanceof oy||a instanceof ov)for(let n of a.uniformNames)i.push({name:n,property:r,binding:a.getBinding(e,n)})}return i}setUniforms(e,i,r,a,n){for(let{name:i,property:o,binding:s}of r){if(this.binders[o].checkUseTheme&&this.binders[o]instanceof og){let e=a.get(`${o}-use-theme`);e.isConstant()&&(this.binders[o].ignoreLut="none"===e.constantOr("default"))}this.binders[o].setUniform(e,s,n,a.get(o),i)}}updatePaintBuffers(){for(let e in this._buffers=[],this.binders){let i=this.binders[e];(i instanceof ox||i instanceof ov||i instanceof ob)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let i in this.binders){let r=this.binders[i];(r instanceof ox||r instanceof ov||r instanceof ob)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let i=this.binders[e];(i instanceof ox||i instanceof ov||i instanceof ob)&&i.destroy()}}}class oT{constructor(e,i,r=()=>!0){for(let a of(this.programConfigurations={},e))this.programConfigurations[a.id]=new ow(a,i,r);this.needsUpload=!1,this._featureMap=new ot,this._featureMapWithoutIds=new ot,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,r,a,n,o,s,l){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,i,a,n,o,s,l);void 0!==i.id?this._featureMap.add(i.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,r,a,n,o,s){for(let l of r)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,l,a,n,o,s||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}let oS={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
7pwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]},oM={"line-pattern":{source:nv,composite:nv},"fill-pattern":{source:nv,composite:nv},"fill-extrusion-pattern":{source:nv,composite:nv},"line-dasharray":{source:nb,composite:nb}},oE={color:{source:nN,composite:ny},number:{source:nL,composite:nN}};function oA(e,i,r){let a=oM[e];return a&&a[r]||oE[i][r]}ab(og,"ConstantBinder"),ab(oy,"PatternConstantBinder"),ab(ox,"SourceExpressionBinder"),ab(ob,"PatternCompositeBinder"),ab(ov,"CompositeExpressionBinder"),ab(ow,"ProgramConfiguration",{omit:["_buffers"]}),ab(oT,"ProgramConfigurationSet");let oI=8192/Math.PI/2,oC=[64,32,16],oP=-oI;function oz(e,i,r,a=oI){return[e*Math.sin(r*=eO)*a,-i*a,e*Math.cos(r)*a]}function oD(e,i,r){return oz(Math.cos(e*eO),Math.sin(e*eO),i,r)}let oR=2*Math.PI*6371008.8;class oL{constructor(e,i){if(isNaN(e)||isNaN(i))throw Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new oL(eG(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let i=Math.PI/180,r=this.lat*i,a=e.lat*i;return 6371008.8*Math.acos(Math.min(Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((e.lng-this.lng)*i),1))}toBounds(e=0){let i=360*e/40075017,r=i/Math.cos(Math.PI/180*this.lat);return new oO({lng:this.lng-r,lat:this.lat-i},{lng:this.lng+r,lat:this.lat+i})}toEcef(e){return oD(this.lat,this.lng,oI+e*oI/6371008.8)}static convert(e){if(e instanceof oL)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new oL(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new oL(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class oO{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof oL?new oL(e.lng,e.lat):oL.convert(e),this}setSouthWest(e){return this._sw=e instanceof oL?new oL(e.lng,e.lat):oL.convert(e),this}extend(e){let i,r;let a=this._sw,n=this._ne;if(e instanceof oL)i=e,r=e;else{if(!(e instanceof oO))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(oO.convert(e)):this.extend(oL.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(oL.convert(e)):this;if(i=e._sw,r=e._ne,!i||!r)return this}return a||n?(a.lng=Math.min(i.lng,a.lng),a.lat=Math.min(i.lat,a.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new oL(i.lng,i.lat),this._ne=new oL(r.lng,r.lat)),this}getCenter(){return new oL((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new oL(this.getWest(),this.getNorth())}getSouthEast(){return new oL(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:i,lat:r}=oL.convert(e),a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&a}static convert(e){if(e)return e instanceof oO?e:new oO(e)}}function ok(e){return oR*Math.cos(e*Math.PI/180)}function oF(e){return(180+e)/360}function oB(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function oN(e){return 360*e-180}function oV(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180)
7)-90}function oU(e){return Math.cos(eU(e,-85.051129,85.051129)*eO)}function oj(e,i){let r=Math.pow(2,eU(i,0,25.5));return oU(e)*oR/(512*r)}function oG(e){return 1/Math.cos(e*Math.PI/180)}function oq(e,i=0){let r=Math.exp(Math.PI*(1-(e.y+i/8192)/(1<<e.z)*2));return 80150034*r/(r*r+1)/8192/(1<<e.z)}class oZ{constructor(e,i,r=0){this.x=+e,this.y=+i,this.z=+r}static fromLngLat(e,i=0){let r=oL.convert(e);return new oZ(oF(r.lng),oB(r.lat),i/ok(r.lat))}toLngLat(){return new oL(oN(this.x),oV(this.y))}toAltitude(){return this.z*ok(oV(this.y))}meterInMercatorCoordinateUnits(){return 1/oR*oG(oV(this.y))}}function oH(e,i,r){let a=e[0],n=a.x,o=a.y;i(a);let s=[a];for(let l=1;l<e.length;l++){let h=e[l],{x:u,y:c}=h;i(h),function e(i,r,a,n,o,s,l,h,u){let c=(r+n)/2,d=(a+o)/2,p=new eR(c,d);h(p),function(e,i,r,a,n,o){let s=r-n,l=a-o;return Math.abs((a-i)*s-(r-e)*l)/Math.hypot(s,l)}(p.x,p.y,s.x,s.y,l.x,l.y)>=u?(e(i,r,a,c,d,s,p,h,u),e(i,c,d,n,o,p,l,h,u)):i.push(l)}(s,n,o,u,c,a,h,i,r),n=u,o=c,a=h}return s}let o$=-16383-1;function oW(e,i,r){let a=e.loadGeometry(),n=e.extent,o=8192/n;if(i&&r&&r.projection.isReprojectedInTileSpace){let o=1<<i.z,{scale:s,x:l,y:h,projection:u}=r,c=e=>{let r=oN((i.x+e.x/n)/o),a=oV((i.y+e.y/n)/o),c=u.project(r,a);e.x=(c.x*s-l)*n,e.y=(c.y*s-h)*n};for(let i=0;i<a.length;i++)if(1!==e.type)a[i]=oH(a[i],c,1);else{let e=[];for(let r of a[i])r.x<0||r.x>=n||r.y<0||r.y>=n||(c(r),e.push(r));a[i]=e}}for(let e of a)for(let i of e)!function(e,i){let r=Math.round(e.x*i),a=Math.round(e.y*i);e.x=eU(r,o$,16383),e.y=eU(a,o$,16383),(r<e.x||r>e.x+1||a<e.y||a>e.y+1)&&e1("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(i,o);return a}function oX(e,i){return{type:e.type,id:e.id,properties:e.properties,geometry:i?oW(e):[]}}function oY(e,i,r,a,n){e.emplaceBack(2*i+(a+1)/2,2*r+(n+1)/2)}function oK(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class oJ{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new np,this.indexArray=new nz,this.segments=new n8,this.programConfigurations=new oT(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}updateFootprints(e,i){}populate(e,i,r,a){let n=this.layers[0],o=[],s=null;for(let{feature:i,id:l,index:h,sourceLayerIndex:u}of("circle"===n.type&&(s=n.layout.get("circle-sort-key")),e)){let e=this.layers[0]._featureFilter.needGeometry,n=oX(i,e);if(!this.layers[0]._featureFilter.filter(new aG(this.zoom),n,r))continue;let c=s?s.evaluate(n,{},r):void 0,d={id:l,properties:i.properties,type:i.type,sourceLayerIndex:u,index:h,geometry:e?n.geometry:oW(i,r,a),patterns:{},sortKey:c};o.push(d)}s&&o.sort((e,i)=>e.sortKey-i.sortKey);let l=null;for(let n of("globe"===a.projection.name&&(this.globeExtVertexArray=new nw,l=a.projection),o)){let{geometry:a,index:o,sourceLayerIndex:s}=n,h=e[o].feature;this.addFeature(n,a,o,i.availableImages,r,l,i.brightness),i.featureIndex.insert(h,a,o,s,this.index)}}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,n5.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,n6.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,r,a,n,o,s){for(let r of i)for(let i of r){let r=i.x,a=i.y;if(r<0||r>=8192||a<0||a>=8192)continue;if(o){let e=o.projectTilePoint(r,a,n),i=o.upVector(n,r,a),s=this.globeExtVertexArray;oK(s,e,i),oK(s,e,i),oK(s,e,i),oK(s,e,i)}let s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),l=s.vertexLength;oY(this.layoutVertexArray,r,a,-1,-1),oY(this.layoutVertexArray,r,a,1,-1),oY(this.layoutVertexArray,r,a,1,1),oY(this.layoutVertexArray,r,a,-1,1),this.indexArray.emplaceBack(l,l+1,l+2),this.indexArray.emplaceBack(l,l+2,l+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},a,n,s)}}function oQ(e,i){for(let r=0;r<e.length;r++)if(o5(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(o5(e,i[r]))return!0;return!!o1(e,i)}function o0(e,i){if(1===e.length)return o4(i,e[0]);for(let r=0;r<i.length;r++){let a=i[r];for(let i=0;i<a.length;i++)if(o5(e,a[i]))return!0}for(let r=0;r<e.length;r++)if(o4(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(o1(e,i[r]))return!0;return!1}function o1(e,i){if(0===e.length||0===i.length)return!1;for(let n=0;n<e.length-1;n++){let o=e[n],s=e[n+1];for(let e=0;e<i.length-1;e++){var r,a;if(e2(o,r=i[e],a=i[e+1])!==e2(s,r,a)&&e2(o,s,r)!==e2(o,s,a))return!0}}return!1}function o2(e,i,r){let a=r*r;if(1===i.length)return e.distSqr(i[0])<a;for(let r=1;r<i.length;r++)if(o3(e,i[r-1],i[r])<a)return!0;return!1}function o3(e,i,r){let a=i.distSqr(r);if(0===a)return e.distSqr(i);let n=((e.x-i.x)*(r.x-i.x)+(e.y-i.y)*(r.y-i.y))/a;return e.distSqr(n<0?i:n>1?r:r.sub(i)._mult(n)._add(i))}function o4(e,i){let r,a,n,o=!1;for(let s=0;s<e.length;s++){r=e[s];for(let e=0,s=r.length-1;e<r.length;s=e++)a=r[e],n=r[s],a.y>i.y!=n.y>i.y&&i.x<(n.x-a.x)*(i.y-a.y)/(n.y-a.y)+a.x&&(o=!o)}return o}function o5(e,i){let r=!1;for(let a=0,n=e.length-1;a<e.length;n=a++){let o=e[a],s=e[n];o.y>i.y!=s.y>i.y&&i.x<(s.x-o.x)*(i.y-o.y)/(s.y-o.y)+o.x&&(r=!r)}return r}function o6(e,i,r,a,n){for(let o of e)if(i<=o.x&&r<=o.y&&a>=o.x&&n>=o.y)return!0;let o=[new eR(i,r),new eR(i,n),new eR(a,n),new eR(a,r)];if(e.length>2){for(let i of o)if(o5(e,i))return!0}for(let i=0;i<e.length-1;i++)if(o8(e[i],e[i+1],o))return!0;return!1}function o8(e,i,r){let a=r[0],n=r[2];if(e.x<a.x&&i.x<a.x||e.x>n.x&&i.x>n.x||e.y<a.y&&i.y<a.y||e.y>n.y&&i.y>n.y)return!1;let o=e2(e,i,r[0]);return o!==e2(e,i,r[1])||o!==e2(e,i,r[2])||o!==e2(e,i,r[3])}function o9(e,i,r,a,n,o){let s=i.y-e.y,l=e.x-i.x;if(o=o||0){let e=s*s+l*l;if(0===e)return!0;let i=Math.sqrt(e);s/=i,l/=i}
7return!((r.x-e.x)*s+(r.y-e.y)*l-o<0||(a.x-e.x)*s+(a.y-e.y)*l-o<0||(n.x-e.x)*s+(n.y-e.y)*l-o<0)}function o7(e,i,r,a,n,o,s){return!(o9(e,i,a,n,o,s)||o9(i,r,a,n,o,s)||o9(r,e,a,n,o,s)||o9(a,n,e,i,r,s)||o9(n,o,e,i,r,s)||o9(o,a,e,i,r,s))}function se(e,i,r){let a=i.paint.get(e).value;return"constant"===a.kind?a.value:r.programConfigurations.get(i.id).getMaxValue(e)}function st(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function si(e,i,r,a,n){if(!i[0]&&!i[1])return e;let o=eR.convert(i)._mult(n);"viewport"===r&&o._rotate(-a);let s=[];for(let i=0;i<e.length;i++)s.push(e[i].sub(o));return s}function sr(e,i,r,a){let n=eR.convert(e)._mult(a);return"viewport"===i&&n._rotate(-r),n}ab(oJ,"CircleBucket",{omit:["layers"]});var sa,sn={exports:{}},so=(sa||(sa=1,function(e){function i(e,i,a){var n=r(256*e,256*(i=Math.pow(2,a)-i-1),a),o=r(256*(e+1),256*(i+1),a);return n[0]+","+n[1]+","+o[0]+","+o[1]}function r(e,i,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[e*a-2*Math.PI*6378137/2,i*a-2*Math.PI*6378137/2]}e.getURL=function(e,r,a,n,o,s){return s=s||{},e+"?"+["bbox="+i(a,n,o),"format="+(s.format||"image/png"),"service="+(s.service||"WMS"),"version="+(s.version||"1.1.1"),"request="+(s.request||"GetMap"),"srs="+(s.srs||"EPSG:3857"),"width="+(s.width||256),"height="+(s.height||256),"layers="+r].join("&")},e.getTileBBox=i,e.getMercCoords=r,Object.defineProperty(e,"__esModule",{value:!0})}(sn.exports)),sn.exports);class ss{constructor(e,i,r){this.z=e,this.x=i,this.y=r,this.key=su(0,e,e,i,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){let r=so.getTileBBox(this.x,this.y,this.z),a=function(e,i,r){let a,n="";for(let o=e;o>0;o--)n+=(i&(a=1<<o-1)?1:0)+(r&a?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class sl{constructor(e,i){this.wrap=e,this.canonical=i,this.key=su(e,i.z,i.z,i.x,i.y)}}class sh{constructor(e,i,r,a,n){this.overscaledZ=e,this.wrap=i,this.canonical=new ss(r,+a,+n),this.key=0===i&&e===r?this.canonical.key:su(i,e,r,a,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){let i=this.canonical.z-e;return e>this.canonical.z?new sh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sh(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return su(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{let r=this.canonical.z-e;return su(this.wrap*+i,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;let i=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new sh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=2*this.canonical.x,a=2*this.canonical.y;return[new sh(i,this.wrap,i,r,a),new sh(i,this.wrap,i,r+1,a),new sh(i,this.wrap,i,r,a+1),new sh(i,this.wrap,i,r+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new sh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sh(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new sl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}
7function su(e,i,r,a,n){let o=1<<Math.min(r,22),s=n%o*o+a%o;return e&&r<22&&(s+=o*o*((e<0?-2*e-1:2*e)%(1<<2*(22-r)))),16*(32*s+r)+(i-r)}let sc=[e=>{let i=e.canonical.x-1,r=e.wrap;return i<0&&(i=(1<<e.canonical.z)-1,r--),new sh(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>{let i=e.canonical.x+1,r=e.wrap;return i===1<<e.canonical.z&&(i=0,r++),new sh(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>new sh(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new sh(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];ab(ss,"CanonicalTileID"),ab(sh,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});let{members:sd}=nc([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),sp=nc([{name:"a_pos_3",components:3,type:"Int16"}]);var sf=nc([{name:"a_pos",type:"Int16",components:2}]);class sm{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,r){let a=eP.vec3.dot(i,this.dir);if(1e-6>Math.abs(a))return!1;let n=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return r[0]=this.pos[0]+this.dir[0]*n,r[1]=this.pos[1]+this.dir[1]*n,r[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(e,i,r){if(eP.vec3.equals(this.pos,e)||0===i)return r[0]=r[1]=r[2]=0,!1;let[a,n,o]=this.dir,s=this.pos[0]-e[0],l=this.pos[1]-e[1],h=this.pos[2]-e[2],u=a*a+n*n+o*o,c=2*(s*a+l*n+h*o),d=c*c-4*u*(s*s+l*l+h*h-i*i);if(d<0){let e=Math.max(-c/2,0),u=s+a*e,d=l+n*e,p=h+o*e,f=Math.hypot(u,d,p);return r[0]=u*i/f,r[1]=d*i/f,r[2]=p*i/f,!1}{let e=(-c-Math.sqrt(d))/(2*u);if(e<0){let e=Math.hypot(s,l,h);return r[0]=s*i/e,r[1]=l*i/e,r[2]=h*i/e,!1}return r[0]=s+a*e,r[1]=l+n*e,r[2]=h+o*e,!0}}}class s_{constructor(e,i,r,a,n){this.TL=e,this.TR=i,this.BR=r,this.BL=a,this.horizon=n}static fromInvProjectionMatrix(e,i,r){let a=[-1,1,1],n=[1,1,1],o=[1,-1,1],s=[-1,-1,1],l=eP.vec3.transformMat4(a,a,e);return new s_(l,eP.vec3.transformMat4(n,n,e),eP.vec3.transformMat4(o,o,e),eP.vec3.transformMat4(s,s,e),i/r)}}function sg(e,i,r){let a=1/0,n=-1/0,o=[];for(let s of e){eP.vec3.sub(o,s,i);let e=eP.vec3.dot(o,r);a=Math.min(a,e),n=Math.max(n,e)}return[a,n]}function sy(e,i){let r=!0;for(let a=0;a<e.planes.length;a++){let n=e.planes[a],o=0;for(let e=0;e<i.length;e++)o+=eP.vec3.dot(n,i[e])+n[3]>=0;if(0===o)return 0;o!==i.length&&(r=!1)}return r?2:1}function sx(e,i){for(let r of e.projections){let a=sg(i,e.points[0],r.axis);if(r.projection[1]<a[0]||r.projection[0]>a[1])return 0}return 1}function sv(e,i){let r=0,a=[0,0,0,0];for(let n=0;n<e.length;n++)a[0]=e[n][0],a[1]=e[n][1],a[2]=e[n][2],a[3]=1,eP.vec4.dot(a,i)>=0&&r++;return r}class sb{constructor(e,i){for(let r of(this.points=e||Array(8).fill([0,0,0]),this.planes=i||Array(6).fill([0,0,0,0]),this.bounds=sw.fromPoints(this.points),this.projections=[],this.frustumEdges=[eP.vec3.sub([],this.points[2],this.points[3]),eP.vec3.sub([],this.points[0],this.points[3]),eP.vec3.sub([],this.points[4],this.points[0]),eP.vec3.sub([],this.points[5],this.points[1]),eP.vec3.sub([],this.points[6],this.points[2]),eP.vec3.sub([],this.points[7],this.points[3])],this.frustumEdges)){let e=[0,-r[2],r[1]],i=[r[2],0,-r[0]];this.projections.push({axis:e,projection:sg(this.points,this.points[0],e)}),this.projections.push({axis:i,projection:sg(this.points,this.points[0],i)})}}static fromInvProjectionMatrix(e,i,r,a){let n=Math.pow(2,r),o=[[-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(r=>{let o=eP.vec4.transformMat4([],r,e),s=1/o[3]/i*n;return eP.vec4.mul(o,o,[s,s,a?1/o[3]:s,s])}),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(e=>{let i=eP.vec3.sub([],o[e[0]],o[e[1]]),r=eP.vec3.sub([],o[e[2]],o[e[1]]),a=eP.vec3.normalize([],eP.vec3.cross([],i,r)),n=-eP.vec3.dot(a,o[e[1]]);return a.concat(n)}),l=[];for(let e=0;e<o.length;e++)l.push([o[e][0],o[e][1],o[e][2]]);return new sb(l,s)}intersectsPrecise(e,i,r){for(let r=0;r<i.length;r++)if(!sv(e,i[r]))return 0;for(let i=0;i<this.planes.length;i++)if(!sv(e,this.planes[i]))return 0;for(let i of r)for(let r of this.frustumEdges){let a=eP.vec3.cross([],i,r),n=eP.vec3.length(a);if(0===n)continue;eP.vec3.scale(a,a,1/n);let o=sg(this.points,this.points[0],a),s=sg(e,this.points[0],a);if(o[0]>s[1]||s[0]>
7o[1])return 0}return 1}containsPoint(e){for(let i of this.planes){let r=i[3];if(eP.vec3.dot([i[0],i[1],i[2]],e)+r<0)return!1}return!0}}class sw{static fromPoints(e){let i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let a of e)eP.vec3.min(i,i,a),eP.vec3.max(r,r,a);return new sw(i,r)}static fromTileIdAndHeight(e,i,r){let a=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new sw([n/a,o/a,i],[(n+1)/a,(o+1)/a,r])}static applyTransform(e,i){let r=e.getCorners();for(let e=0;e<r.length;++e)eP.vec3.transformMat4(r[e],r[e],i);return sw.fromPoints(r)}static applyTransformFast(e,i){let r=[i[12],i[13],i[14]],a=[...r];for(let n=0;n<3;n++)for(let o=0;o<3;o++){let s=i[4*o+n],l=s*e.min[o],h=s*e.max[o];r[n]+=Math.min(l,h),a[n]+=Math.max(l,h)}return new sw(r,a)}static projectAabbCorners(e,i){let r=e.getCorners();for(let e=0;e<r.length;++e)eP.vec3.transformMat4(r[e],r[e],i);return r}constructor(e,i){this.min=e,this.max=i,this.center=eP.vec3.scale([],eP.vec3.add([],this.min,this.max),.5)}quadrant(e){let i=[e%2==0,e<2],r=eP.vec3.clone(this.min),a=eP.vec3.clone(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],a[e]=i[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new sw(r,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){let e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?sy(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?sy(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?sx(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?sx(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function sT(e){return e*oI/6371008.8}ab(sw,"Aabb");let sS=[new sw([oP,oP,oP],[oI,oI,oI]),new sw([oP,oP,oP],[0,0,oI]),new sw([0,oP,oP],[oI,0,oI]),new sw([oP,0,oP],[0,oI,oI]),new sw([0,0,oP],[oI,oI,oI])];function sM(e,i,r,a=!0){let n=eP.vec3.scale([],e._camera.position,e.worldSize),o=[i,r,1,1];eP.vec4.transformMat4(o,o,e.pixelMatrixInverse),eP.vec4.scale(o,o,1/o[3]);let s=eP.vec3.sub([],o,n),l=eP.vec3.normalize([],s),h=e.globeMatrix,u=[h[12],h[13],h[14]],c=eP.vec3.sub([],u,n),d=eP.vec3.length(c),p=eP.vec3.normalize([],c),f=e.worldSize/(2*Math.PI),m=eP.vec3.dot(p,l),_=Math.asin(f/d);if(_<Math.acos(m)){if(!a)return null;let e=[],i=[];eP.vec3.scale(e,l,d/m),eP.vec3.normalize(i,eP.vec3.sub(i,e,c)),eP.vec3.normalize(l,eP.vec3.add(l,c,eP.vec3.scale(l,i,Math.tan(_)*d)))}let g=[];new sm(n,l).closestPointOnSphere(u,f,g);let y=eP.vec3.normalize([],e8(h,0)),x=eP.vec3.normalize([],e8(h,1)),v=eP.vec3.normalize([],e8(h,2)),b=eP.vec3.dot(y,g),w=eP.vec3.dot(x,g),T=Math.atan2(b,eP.vec3.dot(v,g))*ek;return new oZ(oF(T=e.center.lng+function(e,i){let r=(i-e+180)%360-180;return r<-180?r+360:r}(e.center.lng,T)),eU(oB(Math.asin(-w/f)*ek),0,1))}class sE{constructor(e,i,r){this.a=eP.vec3.sub([],e,r),this.b=eP.vec3.sub([],i,r),this.center=r;let a=eP.vec3.normalize([],this.a),n=eP.vec3.normalize([],this.b);this.angle=Math.acos(eP.vec3.dot(a,n))}}function sA(e,i){let r;return 0===e.angle?null:(r=0===e.a[i]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[i]/e.a[i]/Math.sin(e.angle)-1/Math.tan(e.angle)))<0||r>1?null:function(e,i,r,a){let n=Math.sin(r);return Math.sin((1-a)*r)/n*e+Math.sin(a*r)/n*i}(e.a[i],e.b[i],e.angle,eU(r,0,1))+e.center[i]}function sI(e){if(e.z<=1)return sS[e.z+2*e.y+e.x];let i=sR(sD(e));return sw.fromPoints(i)}function sC(e,i,r){return eP.vec3.scale(e,e,1-r),eP.vec3.scaleAndAdd(e,e,i,r)}function sP(e,i,r){for(let a of e)eP.vec3.transformMat4(a,a,i),eP.vec3.scale(a,a,r)}function sz(e,i,r,a){let n=i/e.worldSize,o=e.globeMatrix;if(r.z<=1){let e=sI(r).getCorners();return sP(e,o,n),sw.fromPoints(e)}let s=sD(r,a),l=sR(s,oI+sT(e._tileCoverLift));sP(l,o,n);let h=Number.MAX_VALUE,u=[-h,-h,-h],c=[h,h,h];if(s.contains(e.center)){for(let e of l)eP.vec3.min(c,c,e),eP.vec3.max(u,u,e);u[2]=0;let i=e.point,r=[i.x*n,i.y*n,0];return eP.vec3.min(c,c,r),eP.vec3.max(u,u,r),new sw(c,u)}if(e._tileCoverLift>0){for(let e of l)eP.vec3.min(c,c,e),eP.vec3.max(u,u,e);return new sw(c,u)}let d=[o[12]*n,o[13]*n,o[14]*n],p=s.getCenter(),f=eU(e.center.lat,-85.051129,85.051129),m=eU(p.lat,-85.051129,85.051129),_=oF(e.center.lng),g=oB(f),y=_-oF(p.lng),x=g-oB(m);y>.5?y-=1:y<-.5&&(y+=1);let v=0;if(Math.abs(y)>Math.abs(x))v=y>=0?1:3;else{v=x>=0?0:2;let e=[o[4]*n,o[5]*n,o[6]*n],i=-Math.sin((x>=0?s.getSouth():s.getNorth())*eO)*oI;eP.vec3.scaleAndAdd(d,d,e,i)}let b=l[v],w=l[(v+1)%4],T=new sE(b,w,d),S=[sA(T,0)||b[0],sA(T,1)||b[1],sA(T,2)||b[2]],M=sj(e.zoom);if(M>0){let a=function({x:e,y:i,z:r},a,n,o,s){let l=1/(1<<r),h=e*l,u=h+l,c=i*l,d=c+l,p=0,f=(h+u)/2-o;return f>.5?p=-1:f<-.5&&(p=1),h=((h+p)*a-(o*=a))*n+o,u=((u+p)*a-o)*n+o,c=(c*a-(s*=a))*n+s,[[h,d=(d
7*a-s)*n+s,0],[u,d,0],[u,c,0],[h,c,0]]}(r,i,e._pixelsPerMercatorPixel,_,g);for(let e=0;e<l.length;e++)sC(l[e],a[e],M);let n=eP.vec3.add([],a[v],a[(v+1)%4]);eP.vec3.scale(n,n,.5),sC(S,n,M)}for(let e of l)eP.vec3.min(c,c,e),eP.vec3.max(u,u,e);return c[2]=Math.min(b[2],w[2]),eP.vec3.min(c,c,S),eP.vec3.max(u,u,S),new sw(c,u)}function sD({x:e,y:i,z:r},a=!1){let n=1/(1<<r);return new oO(new oL(oN(e*n),i===(1<<r)-1&&a?-90:oV((i+1)*n)),new oL(oN((e+1)*n),0===i&&a?90:oV(i*n)))}function sR(e,i=oI){let r=e.getNorth()*eO,a=e.getSouth()*eO,n=Math.cos(r),o=Math.cos(a),s=Math.sin(r),l=Math.sin(a),h=e.getWest(),u=e.getEast();return[oz(o,l,h,i),oz(o,l,u,i),oz(n,s,u,i),oz(n,s,h,i)]}function sL(e,i,r,a){let n=1<<r.z,o=(e/8192+r.x)/n;return oD(oV((i/8192+r.y)/n),oN(o),a)}function sO({min:e,max:i}){return 16383/Math.max(i[0]-e[0],i[1]-e[1],i[2]-e[2])}let sk=new Float64Array(16);function sF(e){let i=sO(e),r=eP.mat4.fromScaling(sk,[i,i,i]);return eP.mat4.translate(r,r,eP.vec3.negate([],e.min))}function sB(e){let i=eP.mat4.fromTranslation(sk,e.min),r=1/sO(e);return eP.mat4.scale(i,i,[r,r,r])}function sN(e){return e/(2*Math.PI)/(8192/(2*Math.PI))}function sV(e,i){return 8192/(512*Math.pow(2,e))*sO(sI(i))}function sU(e,i,r,a,n){let o=sN(r),s=[e,i,-r/(2*Math.PI)],l=eP.mat4.identity(new Float64Array(16));return eP.mat4.translate(l,l,s),eP.mat4.scale(l,l,[o,o,o]),eP.mat4.rotateX(l,l,-n*eO),eP.mat4.rotateY(l,l,-a*eO),l}function sj(e){return ej(5,6,e)}function sG(e,i){let r=oD(i.lat,i.lng),a=function(e){let i=oD(e._center.lat,e._center.lng),r=eP.vec3.fromValues(0,1,0),a=eP.vec3.cross([],r,i),n=eP.mat4.fromRotation([],-e.angle,i);a=eP.vec3.transformMat4(a,a,n),eP.mat4.fromRotation(n,-e._pitch,a);let o=eP.vec3.normalize([],i);return eP.vec3.scale(o,o,sT(e.cameraToCenterDistance/e.pixelsPerMeter)),eP.vec3.transformMat4(o,o,n),eP.vec3.add([],i,o)}(e),n=eP.vec3.subtract([],a,r);return eP.vec3.angle(n,r)}function sq(e,i){return sG(e,i)>Math.PI/2*1.01}let sZ=85*eO,sH=Math.cos(sZ),s$=Math.sin(sZ),sW=eP.mat4.create(),sX=e=>{let i=[];return"map"===e.paint.get("circle-pitch-alignment")&&i.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&i.push("SCALE_WITH_MAP"),i};function sY(e,i,r,a,n,o,s,l,h){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(h*=e.pixelToTileUnitsFactor);let u=e.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(let p of i)for(let i of p){var d;let p=i.add(l),f=n&&r.elevation?r.elevation.exaggeration()*n.getElevationAt(p.x,p.y,!0):0,m=r.projection.projectTilePoint(p.x,p.y,u);if(f>0){let e=r.projection.upVector(u,p.x,p.y);m.x+=e[0]*c*f,m.y+=e[1]*c*f,m.z+=e[2]*c*f}let _=o?p:function(e,i,r,a){let n=eP.vec4.transformMat4([],[e,i,r,1],a);return new eR(n[0]/n[3],n[1]/n[3])}(m.x,m.y,m.z,a),g=o?e.tilespaceRays.map(e=>(function(e,i){let r=eP.vec3.create();return sK[2]=i,e.intersectsPlane(sK,sJ,r),new eR(r[0],r[1])})(e,f)):e.queryGeometry.screenGeometry,y=eP.vec4.transformMat4([],[m.x,m.y,m.z,1],a);if(!s&&o?h*=y[3]/r.cameraToCenterDistance:s&&!o&&(h*=r.cameraToCenterDistance/y[3]),o){let e=oV((i.y/8192+u.y)/(1<<u.z));h/=r.projection.pixelsPerMeter(e,1)/(1/ok(e))}if(d=h,o5(g,_)||o2(_,g,d))return!0}return!1}let sK=eP.vec3.fromValues(0,0,0),sJ=eP.vec3.fromValues(0,0,1);class sQ extends oJ{}function s0(e,{width:i,height:r}
7,a,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*r*a)throw RangeError("mismatched image size")}else n=new Uint8Array(i*r*a);return e.width=i,e.height=r,e.data=n,e}function s1(e,i,r){let{width:a,height:n}=i;a===e.width&&n===e.height||(s2(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,a),height:Math.min(e.height,n)},r,null),e.width=a,e.height=n,e.data=i.data)}function s2(e,i,r,a,n,o,s,l){if(0===n.width||0===n.height)return i;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>i.width||n.height>i.height||a.x>i.width-n.width||a.y>i.height-n.height)throw RangeError("out of range destination coordinates for image copy");let h=e.data,u=i.data,c=4===o&&l;for(let l=0;l<n.height;l++){let d=((r.y+l)*e.width+r.x)*o,p=((a.y+l)*i.width+a.x)*o;if(c)for(let e=0;e<n.width;e++){let i=d+e*o+3,r=p+e*o;u[r+0]=255,u[r+1]=255,u[r+2]=255,u[r+3]=h[i]}else if(s)for(let e=0;e<n.width;e++){let i=d+e*o,r=p+e*o,a=h[i+3],n=new tZ(h[i+0]/255*a,h[i+1]/255*a,h[i+2]/255*a,a).toRenderColor(s).toArray();u[r+0]=n[0],u[r+1]=n[1],u[r+2]=n[2],u[r+3]=n[3]}else for(let e=0;e<n.width*o;e++)u[p+e]=h[d+e]}return i}ab(sQ,"HeatmapBucket",{omit:["layers"]});class s3{constructor(e,i){s0(this,e,1,i)}resize(e){s1(this,new s3(e),1)}clone(){return new s3({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n){s2(e,i,r,a,n,1,null)}}class s4{constructor(e,i){s0(this,e,4,i)}resize(e){s1(this,new s4(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new s4({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n,o,s){s2(e,i,r,a,n,4,o,s)}}class s5{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function s6(e){let i={},r=e.resolution||256,a=e.clips?e.clips.length:1,n=e.image||new s4({width:r,height:a}),o=(r,a,o)=>{i[e.evaluationKey]=o;let s=e.expression.evaluate(i);s&&(n.data[r+a+0]=Math.floor(255*s.r/s.a),n.data[r+a+1]=Math.floor(255*s.g/s.a),n.data[r+a+2]=Math.floor(255*s.b/s.a),n.data[r+a+3]=Math.floor(255*s.a))};if(e.clips)for(let i=0,n=0;i<a;++i,n+=4*r)for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1),{start:h,end:u}=e.clips[i];o(n,s,h*(1-l)+u*l)}else for(let e=0,i=0;e<r;e++,i+=4)o(0,i,e/(r-1));return n}ab(s3,"AlphaImage"),ab(s4,"RGBAImage");let{members:s8}=nc([{name:"a_pos",components:2,type:"Int16"}],4);function s9(e,i,r=2){let a,n,o;let s=i&&i.length,l=s?i[0]*r:e.length,h=s7(e,0,l,r,!0),u=[];if(!h||h.next===h.prev)return u;if(s&&(h=function(e,i,r,a){let n=[];for(let r=0,o=i.length;r<o;r++){let s=s7(e,i[r]*a,r<o-1?i[r+1]*a:e.length,a,!1);s===s.next&&(s.steiner=!0),n.push(function(e){let i=e,r=e;do(i.x<r.x||i.x===r.x&&i.y<r.y)&&(r=i),i=i.next;while(i!==e);return r}(s))}n.sort(lt);for(let e=0;e<n.length;e++)r=function(e,i){let r=function(e,i){let r=i,a=e.x,n=e.y,o,s=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let e=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y
7);if(e<=a&&e>s&&(s=e,o=r.x<r.next.x?r:r.next,e===a))return o}r=r.next}while(r!==i);if(!o)return null;let l=o,h=o.x,u=o.y,c=1/0;r=o;do{if(a>=r.x&&r.x>=h&&a!==r.x&&lr(n<u?a:s,n,h,u,n<u?s:a,n,r.x,r.y)){var d,p;let i=Math.abs(n-r.y)/(a-r.x);lh(r,e)&&(i<c||i===c&&(r.x>o.x||r.x===o.x&&(d=o,p=r,0>la(d.prev,d,p.prev)&&0>la(p.next,d,d.next))))&&(o=r,c=i)}r=r.next}while(r!==l);return o}(e,i);if(!r)return i;let a=lu(r,e);return le(a,a.next),le(r,r.next)}(n[e],r);return r}(e,i,h,r)),e.length>80*r){a=1/0,n=1/0;let i=-1/0,s=-1/0;for(let o=r;o<l;o+=r){let r=e[o],l=e[o+1];r<a&&(a=r),l<n&&(n=l),r>i&&(i=r),l>s&&(s=l)}o=0!==(o=Math.max(i-a,s-n))?32767/o:0}return function e(i,r,a,n,o,s,l){if(!i)return;!l&&s&&function(e,i,r,a){let n=e;do 0===n.z&&(n.z=li(n.x,n.y,i,r,a)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let i,r=1;do{let a,n=e;e=null;let o=null;for(i=0;n;){i++;let s=n,l=0;for(let e=0;e<r&&(l++,s=s.nextZ);e++);let h=r;for(;l>0||h>0&&s;)0!==l&&(0===h||!s||n.z<=s.z)?(a=n,n=n.nextZ,l--):(a=s,s=s.nextZ,h--),o?o.nextZ=a:e=a,a.prevZ=o,o=a;n=s}o.nextZ=null,r*=2}while(i>1)}(n)}(i,n,o,s);let h=i;for(;i.prev!==i.next;){let u=i.prev,c=i.next;if(s?function(e,i,r,a){let n=e.prev,o=e.next;if(la(n,e,o)>=0)return!1;let s=n.x,l=e.x,h=o.x,u=n.y,c=e.y,d=o.y,p=s<l?s<h?s:h:l<h?l:h,f=u<c?u<d?u:d:c<d?c:d,m=s>l?s>h?s:h:l>h?l:h,_=u>c?u>d?u:d:c>d?c:d,g=li(p,f,i,r,a),y=li(m,_,i,r,a),x=e.prevZ,v=e.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==o&&lr(s,u,l,c,h,d,x.x,x.y)&&la(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==o&&lr(s,u,l,c,h,d,v.x,v.y)&&la(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==o&&lr(s,u,l,c,h,d,x.x,x.y)&&la(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==o&&lr(s,u,l,c,h,d,v.x,v.y)&&la(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}(i,n,o,s):function(e){let i=e.prev,r=e.next;if(la(i,e,r)>=0)return!1;let a=i.x,n=e.x,o=r.x,s=i.y,l=e.y,h=r.y,u=a<n?a<o?a:o:n<o?n:o,c=s<l?s<h?s:h:l<h?l:h,d=a>n?a>
7o?a:o:n>o?n:o,p=s>l?s>h?s:h:l>h?l:h,f=r.next;for(;f!==i;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&lr(a,s,n,l,o,h,f.x,f.y)&&la(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}(i))r.push(u.i,i.i,c.i),ld(i),i=c.next,h=c.next;else if((i=c)===h){l?1===l?e(i=function(e,i){let r=e;do{let a=r.prev,n=r.next.next;!ln(a,n)&&lo(a,r,r.next,n)&&lh(a,n)&&lh(n,a)&&(i.push(a.i,r.i,n.i),ld(r),ld(r.next),r=e=n),r=r.next}while(r!==e);return le(r)}(le(i),r),r,a,n,o,s,2):2===l&&function(i,r,a,n,o,s){let l=i;do{let i=l.next.next;for(;i!==l.prev;){var h,u;if(l.i!==i.i&&(h=l,u=i,h.next.i!==u.i&&h.prev.i!==u.i&&!function(e,i){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==i.i&&r.next.i!==i.i&&lo(r,r.next,e,i))return!0;r=r.next}while(r!==e);return!1}(h,u)&&(lh(h,u)&&lh(u,h)&&function(e,i){let r=e,a=!1,n=(e.x+i.x)/2,o=(e.y+i.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(a=!a),r=r.next;while(r!==e);return a}(h,u)&&(la(h.prev,h,u.prev)||la(h,u.prev,u))||ln(h,u)&&la(h.prev,h,h.next)>0&&la(u.prev,u,u.next)>0))){let h=lu(l,i);return l=le(l,l.next),h=le(h,h.next),e(l,r,a,n,o,s,0),void e(h,r,a,n,o,s,0)}i=i.next}l=l.next}while(l!==i)}(i,r,a,n,o,s):e(le(i),r,a,n,o,s,1);break}}}(h,u,r,a,n,o,0),u}function s7(e,i,r,a,n){let o;if(n===function(e,i,r,a){let n=0;for(let o=i,s=r-a;o<r;o+=a)n+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return n}(e,i,r,a)>0)for(let n=i;n<r;n+=a)o=lc(n/a|0,e[n],e[n+1],o);else for(let n=r-a;n>=i;n-=a)o=lc(n/a|0,e[n],e[n+1],o);return o&&ln(o,o.next)&&(ld(o),o=o.next),o}function le(e,i){if(!e)return e;i||(i=e);let r,a=e;do if(r=!1,a.steiner||!ln(a,a.next)&&0!==la(a.prev,a,a.next))a=a.next;else{if(ld(a),(a=i=a.prev)===a.next)break;r=!0}while(r||a!==i);return i}function lt(e,i){return e.x-i.x}function li(e,i,r,a,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-a)*n|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function lr(e,i,r,a,n,o,s,l){return(n-s)*(i-l)>=(e-s)*(o-l)&&(e-s)*(a-l)>=(r-s)*(i-l)&&(r-s)*(o-l)>=(n-s)*(a-l)}function la(e,i,r){return(i.y-e.y)*(r.x-i.x)-(i.x-e.x)*(r.y-i.y)}function ln(e,i){return e.x===i.x&&e.y===i.y}function lo(e,i,r,a){let n=ll(la(e,i,r)),o=ll(la(e,i,a)),s=ll(la(r,a,e)),l=ll(la(r,a,i));return n!==o&&s!==l||!(0!==n||!ls(e,r,i))||!(0!==o||!ls(e,a,i))||!(0!==s||!ls(r,e,a))||!(0!==l||!ls(r,i,a))}function ls(e,i,r){return i.x<=Math.max(e.x,r.x)&&i.x>=Math.min(e.x,r.x)&&i.y<=Math.max(e.y,r.y)&&i.y>=Math.min(e.y,r.y)}function ll(e){return e>0?1:e<0?-1:0}function lh(e,i){return 0>la(e.prev,e,e.next)?la(e,i,e.next)>=0&&la(e,e.prev,i)>=0:0>la(e,i,e.prev)||0>la(e,e.next,i)}function lu(e,i){let r=lp(e.i,e.x,e.y),a=lp(i.i,i.x,i.y),n=e.next,o=i.prev;return e.next=i,i.prev=e,r.next=n,n.prev=r,a.next=r,r.prev=a,o.next=a,a.prev=o,a}function lc(e,i,r,a){let n=lp(e,i,r);return a?(n.next=a.next,n.prev=a,a.next.prev=n,a.next=n):(n.prev=n,n.next=n),n}function ld(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function lp(e,i,r){return{i:e,x:i,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function lf(e,i){let r,a;let n=e.length;if(n<=1)return[e];let o=[];for(let i=0;i<n;i++){let n=function(e){let i=0;for(let r,a,n=0,o=e.length,s=o-1;n<o;s=n++)r=e[n],i+=((a=e[s]).x-r.x)*(r.y+a.y);return i}(e[i]);0!==n&&(e[i].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[e[i]]):r.push(e[i]))}if(r&&o.push(r),i>1)for(let e=0;e<o.length;e++)o[e].length<=i||(function e(i,r,a=0,n=i.length-1,o=function(e,i){return e<i?-1:e>i?1:0}){for(;n>a;){if(n-a>600){let s=n-a+1,l=r-a+1,h=Math.log(s),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(s-u)/s)*(l-s/2<0?-1:1);e(i,r,Math.max(a,Math.floor(r-l*u/s+c)),Math.min(n,Math.floor(r+(s-l)*u/s+c)),o)}let s=i[r],l=a,h=n;for(iP(i,a,r),o(i[n],s)>0&&iP(i,a,n);l<h;){for(iP(i,l,h),l++,h--;0>o(i[l],s);)l++;for(;o(i[h],s)>0;)h--}0===o(i[a],s)?iP(i,a,h):iP(i,++h,n),h<=r&&(a=h+1),r<=h&&(n=h-1)}}(o[e],i,1,o[e].length-1,lm),o[e]=o[e].slice(0,i));return o}function lm(e,i){return i.area-e.area}function l_(e,i){if(!e)return null;let r="string"==typeof e?e:e.getPrimary().id;i[r]||(i[r]=[]);let a=iu.from(e).getPrimary();return i[r].push(a),a.serialize()}function lg(e,i,r){let a=r.patternDependencies,n=!1;for(let r of i){let i=r.paint.get(`${e}-pattern`);i.isConstant()||(n=!0),l_(i.constantOr(null),a)&&(n=!0)}return n}function ly(e,i,r,a,n){let o=n.patternDependencies;for(let s of i){let i=s.paint.get(`${e}-pattern`).value;if("constant"!==i.kind){let e=i.evaluate({zoom:a},r,{},n.availableImages),l=l_(e=e&&e.name?e.name:e,o);l&&(r.patterns[s.id]=l)}}return r}class lx{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new np,this.indexArray=new nz,this.indexArray2=new nE,this.programConfigurations=new oT(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new n8,this.segments2=new n8,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection}updateFootprints(e,i){}populate(e,i,r,a){this.hasPattern=lg("fill",this.layers,i);let n=this.layers[0].layout.get("fill-sort-key"),o=[];for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of e){let e=this.layers[0]._featureFilter.needGeometry,c=oX(s,e);if(!this.layers[0]._featureFilter.filter(new aG(this.zoom),c,r))continue;let d=n?n.evaluate(c,{},r,i.availableImages):void 0,p={id:l,properties:s.properties,type:s.type,sourceLayerIndex:u,index:h,geometry:e?c.geometry:oW(s,r,a),patterns:{},sortKey:d};o.push(p)}for(let a of(n&&o.sort((e,i)=>
7e.sortKey-i.sortKey),o)){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(this.hasPattern){let e=ly("fill",this.layers,a,this.zoom,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,{},i.availableImages,i.brightness);i.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s)}addFeatures(e,i,r,a,n,o){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,i,r,a,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,s8),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,i,r,a,n,o=[],s){for(let e of lf(i,500)){let i=0;for(let r of e)i+=r.length;let r=this.segments.prepareSegment(i,this.layoutVertexArray,this.indexArray),a=r.vertexLength,n=[],o=[];for(let i of e){if(0===i.length)continue;i!==e[0]&&o.push(n.length/2);let r=this.segments2.prepareSegment(i.length,this.layoutVertexArray,this.indexArray2),a=r.vertexLength;this.layoutVertexArray.emplaceBack(i[0].x,i[0].y),this.indexArray2.emplaceBack(a+i.length-1,a),n.push(i[0].x),n.push(i[0].y);for(let e=1;e<i.length;e++)this.layoutVertexArray.emplaceBack(i[e].x,i[e].y),this.indexArray2.emplaceBack(a+e-1,a+e),n.push(i[e].x),n.push(i[e].y);r.vertexLength+=i.length,r.primitiveLength+=i.length}let s=s9(n,o);for(let e=0;e<s.length;e+=3)this.indexArray.emplaceBack(a+s[e],a+s[e+1],a+s[e+2]);r.vertexLength+=i,r.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,s)}}ab(lx,"FillBucket",{omit:["layers","patternFeatures"]});class lv{constructor(e,i,r,a){if(this.triangleCount=i.length/3,this.min=new eR(0,0),this.max=new eR(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;let[n,o]=[e[0].clone(),e[0].clone()];for(let i=1;i<e.length;++i){let r=e[i];n.x=Math.min(n.x,r.x),n.y=Math.min(n.y,r.y),o.x=Math.max(o.x,r.x),o.y=Math.max(o.y,r.y)}if(a&&(r=Math.max(r,Math.ceil(Math.max(o.x-n.x,o.y-n.y)/a))),0===r)return;this.min=n,this.max=o;let s=this.max.sub(this.min);s.x=Math.max(s.x,1),s.y=Math.max(s.y,1);let l=Math.max(s.x,s.y)/r;this.cellsX=Math.max(1,Math.ceil(s.x/l)),this.cellsY=Math.max(1,Math.ceil(s.y/l)),this.xScale=1/l,this.yScale=1/l;let h=[];for(let r=0;r<this.triangleCount;r++){let a=e[i[3*r+0]].sub(this.min),n=e[i[3*r+1]].sub(this.min),o=e[i[3*r+2]].sub(this.min),s=lb(Math.floor(Math.min(a.x,n.x,o.x)),this.xScale,this.cellsX),u=lb(Math.floor(Math.max(a.x,n.x,o.x)),this.xScale,this.cellsX),c=lb(Math.floor(Math.min(a.y,n.y,o.y)),this.yScale,this.cellsY),d=lb(Math.floor(Math.max(a.y,n.y,o.y)),this.yScale,this.cellsY),p=new eR(0,0),f=new eR(0,0),m=new eR(0,0),_=new eR(0,0);for(let e=c;e<=d;++e){p.y=f.y=e*l,m.y=_.y=(e+1)*l;for(let i=s;i<=u;++i)p.x=m.x=i*l,f.x=_.x=(i+1)*l,(o7(a,n,o,p,f,_)||o7(a,n,o,p,_,m))&&h.push({cellIdx:e*this.cellsX+i,triIdx:r})}}if(0===h.length)return;h.sort((e,i)=>e.cellIdx-i.cellIdx||e.triIdx-i.triIdx);let u=0;for(;u<h.length;){let e=h[u].cellIdx,i={start:this.payload.length,len:0};for(;u<h.length&&h[u].cellIdx===e;)++i.len,this.payload.push(h[u++].triIdx);this.cells[e]=i}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(0===this.triangleCount||0===this.cells.length||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;let r=lb(e.x-this.min.x,this.xScale,this.cellsX),a=lb(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[a*this.cellsX+r];if(n){this._lazyInitLookup();for(let e=0;e<n.len;e++){let r=this.payload[n.start+e],a=Math.floor(r/8),o=1<<r%8;if(!(this.lookup[a]&o)&&(this.lookup[a]|=o,i.push(r),i.length===this.triangleCount))return}}}query(e,i,r){if(0===this.triangleCount||0===this.cells.length||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();let a=lb(e.x-this.min.x,this.xScale,this.cellsX),n=lb(i.x-this.min.x,this.xScale,this.cellsX),o=lb(e.y-this.min.y,this.yScale,this.cellsY),s=lb(i.y-this.min.y,this.yScale,this.cellsY);for(let e=o;e<=s;e++)for(let i=a;i<=n;
7i++){let a=this.cells[e*this.cellsX+i];if(a)for(let e=0;e<a.len;e++){let i=this.payload[a.start+e],n=Math.floor(i/8),o=1<<i%8;if(!(this.lookup[n]&o)&&(this.lookup[n]|=o,r.push(i),r.length===this.triangleCount))return}}}}function lb(e,i,r){return Math.max(0,Math.min(r-1,Math.floor(e*i)))}ab(lv,"TriangleGridIndex");class lw{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.footprints=[]}updateFootprints(e,i){for(let r of this.footprints)i.push({footprint:r,id:e})}populate(e,i,r,a){let n=[];for(let{feature:i,id:o,index:s,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,h=oX(i,e);if(!this.layers[0]._featureFilter.filter(new aG(this.zoom),h,r))continue;let u={id:o,properties:i.properties,type:i.type,sourceLayerIndex:l,index:s,geometry:e?h.geometry:oW(i,r,a),patterns:{}};n.push(u)}for(let a of n){let{geometry:n,index:o,sourceLayerIndex:s}=a;this.addFeature(a,n,o,r,{},i.availableImages,i.brightness),i.featureIndex.insert(e[o].feature,n,o,s,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,i,r,a,n,o,s){}destroy(){}addFeature(e,i,r,a,n,o=[],s){for(let e of lf(i,2)){let i=[],r=[],a=[],n=new eR(1/0,1/0),o=new eR(-1/0,-1/0);for(let s of e)if(0!==s.length){s!==e[0]&&a.push(r.length/2);for(let e=0;e<s.length;e++)r.push(s[e].x),r.push(s[e].y),i.push(s[e]),n.x=Math.min(n.x,s[e].x),n.y=Math.min(n.y,s[e].y),o.x=Math.max(o.x,s[e].x),o.y=Math.max(o.y,s[e].y)}let s=s9(r,a),l=new lv(i,s,8,256);this.footprints.push({vertices:i,indices:s,grid:l,min:n,max:o})}}}ab(lw,"ClipBucket",{omit:["layers"]});let lT=nc([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),lS=nc([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),lM=nc([{name:"a_centroid_pos",components:2,type:"Uint16"}]),lE=nc([{name:"a_join_normal_inside",components:3,type:"Int16"}]),lA=nc([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),lI=nc([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:lC}=lT;var lP,lz,lD,lR,lL,lO,lk,lF={};function lB(){if(lz)return lP;lz=1;var e=eD();function i(e,i,a,n,o){this.properties={},this.extent=a,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(r,this,i)}function r(e,i,r){1==e?i.id=r.readVarint():2==e?function(e,i){for(var r=e.readVarint()+e.pos;e.pos<r;){var a=i._keys[e.readVarint()],n=i._values[e.readVarint()];i.properties[a]=n}}(r,i):3==e?i.type=r.readVarint():4==e&&(i._geometry=r.pos)}return lP=i,i.types=["Unknown","Point","LineString","Polygon"],i.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var r,a=i.readVarint()+i.pos,n=1,o=0,s=0,l=0,h=[];i.pos<a;){if(o<=0){var u=i.readVarint();n=7&u,o=u>>3}if(o--,1===n||2===n)s+=i.readSVarint(),l+=i.readSVarint(),1===n&&(r&&h.push(r),r=[]),r.push(new e(s,l));else{if(7!==n)throw Error("unknown command "+n);r&&r.push(r[0].clone())}}return r&&h.push(r),h},i.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var i=e.readVarint()+e.pos,r=1,a=0,n=0,o=0,s=1/0,l=-1/0,h=1/0,u=-1/0;e.pos<i;){if(a<=0){var c=e.readVarint();r=7&c,a=c>>3}if(a--,1===r||2===r)(n+=e.readSVarint())<s&&(s=n),n>l&&(l=n),(o+=e.readSVarint())<h&&(h=o),o>u&&(u=o);else if(7!==r)throw Error("unknown command "+r)}return[s,h,l,u]},i.prototype.toGeoJSON=function(e,r,a){var n,o,s=this.extent*Math.pow(2,a),l=this.extent*e,h=this.extent*r,u=this.loadGeometry(),c=i.types[this.type];function d(e){for(var i=0;i<e.length;i++){var r=e[i];e[i]=[360*(r.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+h)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(n=0;n<u.length;n++)p[n]=u[n][0];d(u=p);break;case 2:for(n=0;n<u.length;n++)d(u[n]);break;case 3:for(u=function(e){var i=e.length;if(i<=1)return[e];for(var r,a,n=[],o=0;o<i;o++){var s=function(e){for(var i,r,a=0,n=0,o=e.length,s=o-1;n<o;s=n++)a+=((r=e[s]).x-(i=e[n]).x)*(i.y+r.y);return a}(e[o]);0!==s&&(void 0===a&&(a=s<0),a===s<0?(r&&n.push(r),r=[e[o]]):r.push(e[o]))}return r&&n.push(r),n}(u),n=0;n<u.length;n++)for(o=0;o<u[n].length;o++)d(u[n][o])}1===u.length?u=u[0]:c="Multi"+c;var f={type:"Feature",geometry:{type:c,coordinates:u},properties:this.properties};
7return"id"in this&&(f.id=this.id),f},lP}function lN(){if(lR)return lD;lR=1;var e=lB();function i(e,i){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(r,this,i),this.length=this._features.length}function r(e,i,r){15===e?i.version=r.readVarint():1===e?i.name=r.readString():5===e?i.extent=r.readVarint():2===e?i._features.push(r.pos):3===e?i._keys.push(r.readString()):4===e&&i._values.push(function(e){for(var i=null,r=e.readVarint()+e.pos;e.pos<r;){var a=e.readVarint()>>3;i=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return i}(r))}return lD=i,i.prototype.feature=function(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,r,this.extent,this._keys,this._values)},lD}function lV(){return lk||(lk=1,lF.VectorTile=function(){if(lO)return lL;lO=1;var e=lN();function i(i,r,a){if(3===i){var n=new e(a,a.readVarint()+a.pos);n.length&&(r[n.name]=n)}}return lL=function(e,r){this.layers=e.readFields(i,{},r)}}(),lF.VectorTileFeature=lB(),lF.VectorTileLayer=lN()),lF}var lU=lV();class lj extends eR{constructor(e,i,r){super(e,i),this.z=r}}class lG extends lj{constructor(e,i,r,a){super(e,i,r),this.w=a}}function lq(e,i,r,a){let n=[],o=0===a?(e,i,r,a,n,o)=>{e.push(new eR(o,r+(o-i)/(a-i)*(n-r)))}:(e,i,r,a,n,o)=>{e.push(new eR(i+(o-r)/(n-r)*(a-i),o))};for(let s of e){let e=[];for(let n of s){if(n.length<=2)continue;let s=[];for(let e=0;e<n.length-1;e++){let l=n[e].x,h=n[e].y,u=n[e+1].x,c=n[e+1].y,d=0===a?l:h,p=0===a?u:c;d<i?p>i&&o(s,l,h,u,c,i):d>r?p<r&&o(s,l,h,u,c,r):s.push(n[e]),p<i&&d>=i&&o(s,l,h,u,c,i),p>r&&d<=r&&o(s,l,h,u,c,r)}let l=n[n.length-1],h=0===a?l.x:l.y;h>=i&&h<=r&&s.push(l),s.length&&(l=s[s.length-1],s[0].x===l.x&&s[0].y===l.y||s.push(s[0]),e.push(s))}e.length&&n.push(e)}return n}function lZ(e,i,r,a){let n="x"===r?"y":"x",o=(a-e[r])/(i[r]-e[r]);e[n]=e[n]+(i[n]-e[n])*o,e[r]=a,e.hasOwnProperty("z")&&(e.z=t$(e.z,i.z,o)),e.hasOwnProperty("w")&&(e.w=t$(e.w,i.w,o))}function lH(e,i,r,a){for(let n of["x","y"]){let o=e,s=i;o[n]>=s[n]&&(o=i,s=e),o[n]<r&&s[n]>r&&lZ(o,s,n,r),o[n]<a&&s[n]>a&&lZ(s,o,n,a)}}let l$=Number.MAX_SAFE_INTEGER;function lW(e,i,r,a){var n;return e.order<i||e.order===l$||!(e.clipMask&r)||0!==(n=e.clipScope).length&&void 0===n.find(e=>e===a)}function lX(e,i){return e.x-i.x||e.y-i.y}function lY(e,i){return 0===lX(e.min,i.min)&&0===lX(e.max,i.max)}function lK(e,i){return!(e.min.x>i.max.x||e.max.x<i.min.x||e.min.y>i.max.y||e.max.y<i.min.y)}function lJ(e,i){if(e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(e[r].sourceId!==i[r].sourceId||!lY(e[r],i[r])||e[r].order!==i[r].order||e[r].clipMask!==i[r].clipMask||!eL(e[r].clipScope,i[r].clipScope))return!1;return!0}function lQ(e,i,r){let a=1/(1<<r.canonical.z),n=(1220703125e-13*i.x+r.canonical.x)*a+r.wrap,o=(1220703125e-13*i.y+r.canonical.y)*a;return{min:new eR((1220703125e-13*e.x+r.canonical.x)*a+r.wrap,(1220703125e-13*e.y+r.canonical.y)*a),max:new eR(n,o)}}function l0(e,i,r,a,n,o,s){let l=e.indices,h=e.vertices,u=[];for(let c=a;c<a+n;c+=3){let a=i[r[c+0]+o],n=i[r[c+1]+o],d=i[r[c+2]+o],p=Math.min(a.x,n.x,d.x),f=Math.max(a.x,n.x,d.x),m=Math.min(a.y,n.y,d.y),_=Math.max(a.y,n.y,d.y);u.length=0,e.grid.query(new eR(p,m),new eR(f,_),u);for(let e=0;e<u.length;e++){let i=u[e];if(o7(h[l[3*i+0]],h[l[3*i+1]],h[l[3*i+2]],a,n,d,s))return!0}}return!1}function l1(e,i,r,a){let n=Math.pow(2,a.z-r.z);return new eR((e+8192*r.x)*n-8192*a.x,(i+8192*r.y)*n-8192*a.y)}function l2(e,i){let r=[];i.grid.queryPoint(e,r);let a=i.indices,n=i.vertices;for(let i=0;i<r.length;i++){let o=r[i];if(o5([n[a[3*o+0]],n[a[3*o+1]],n[a[3*o+2]]],e))return!0}return!1}let l3=[new eR(0,0),new eR(8192,0),new eR(8192,8192),new eR(0,8192)];function l4(e,i){let r=[],a=[];if(!i||e.length<2)return[e];if(2===e.length)return o8(e[0],e[1],l3)?[e]:[];for(let i=0;i<e.length+2;i++){let n=e[i%e.length],o=e[(i+1)%e.length],s=o8(0===i?e[e.length-1]:e[(i-1)%e.length],n,l3),l=o8(n,o,l3),h=s||l;h&&a.push(n),h&&l||a.length>0&&(a.length>1&&r.push(a),a=[])}return a.length>1&&r.push(a),r}let l5=lU.VectorTileFeature.types,l6=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],l8=["fill-extrusion-flood-light-ground-radius"],l9=new eR(0,1);function l7(e,i,r,a,n,o,s,l){e.emplaceBack((i<<1)+s,(r<<1)+o,(Math.floor(8192*a)<<1)+n,Math.round(l))}function he(e,i,r){e.emplaceBack(8192*i.x,8192*i.y,r?1:0)}function ht(e,i,r,a,n,o){e.emplaceBack(i.x,i.y,(r.x<<1)+a,(r.y<<1)+n,o)}function hi(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class hr{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class ha{constructor(){this.centroidXY=new eR(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new eR(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new eR(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new eR(this.max.x-this.min.x,this.max.y-this.min.y)}}class hn{constructor(){this.acc=new eR(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,r){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),a&&this.checkBorderIntersection(i,r)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,t$(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>8192!=e.x>
78192&&this.addBorderIntersection(1,t$(i.y,e.y,(8192-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,t$(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>8192!=e.y>8192&&this.addBorderIntersection(3,t$(i.x,e.x,(8192-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){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]]);let r=this.borders[e];i<r[0]&&(r[0]=i),i>r[1]&&(r[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;let r=0===e.x?0:1;this.addBorderIntersection(r,i.y),this.addBorderIntersection(r,e.y)}else{let r=0===e.y?2:3;this.addBorderIntersection(r,i.x),this.addBorderIntersection(r,e.x)}}centroid(){return 0===this.accCount?new eR(0,0):new eR(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function ho(e,i){let r=e.add(i)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(eU(e.x*r.x+e.y*r.y,-1,1)))))/4*32767*(e.x*i.y-e.y*i.x<0?-1:1)}let hs=[e=>e.x<0,e=>e.x>8192,e=>e.y<0,e=>e.y>8192];class hl{constructor(e){this.vertexArray=new n_,this.indexArray=new nz,this.programConfigurations=new oT(e.layers,{zoom:e.zoom,lut:e.lut},e=>l8.includes(e)),this._segments=new n8,this.hiddenByLandmarkVertexArray=new nZ,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new n8}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,i,r,a=!1){let n=e.length;if(n>2){let o,s=Math.max(0,this._segments.get().length-1),l=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{let i=e[0],r=e[1];o=ho(i.sub(e[n-1])._perp()._unit(),r.sub(i)._perp()._unit())}for(let h=0;h<n;h++){let u=h===n-1?0:h+1,c=e[h],d=e[u],p=e[u===n-1?0:u+1],f=d.sub(c)._perp()._unit(),m=ho(f,p.sub(d)._perp()._unit()),_=o;if(hd(c,d,i)||a&&hp(c,i)&&hp(d,i)){o=m;continue}let g=l.vertexLength;for(let e of(ht(this.vertexArray,c,d,1,1,_),ht(this.vertexArray,c,d,1,0,_),ht(this.vertexArray,c,d,0,1,m),ht(this.vertexArray,c,d,0,0,m),l.vertexLength+=4,function(e,i,r,a){let n=[4];if(0===a)return n;r._mult(a);let o=e.sub(r),s=i.sub(r),l=[e,i,o,s];for(let e=0;e<4;e++)for(let i of l)if(hs[e](i)){n.push(e);break}return n}(c,d,f,r)))this._segmentToGroundQuads[s].push({id:g,region:e}),this._segmentToRegionTriCounts[s][e]+=2,l.primitiveLength+=2;o=m}}}prepareBorderSegments(){if(!this.hasData())return;let e=this._segments.get(),i=e.length;for(let e=0;e<i;e++)this._segmentToGroundQuads[e].sort((e,i)=>e.region-i.region);for(let r=0;r<i;r++){let i=this._segmentToGroundQuads[r],a=e[r],n=this._segmentToRegionTriCounts[r];n.reduce((e,i)=>e+i,0);let o=0;for(let e=0;e<=4;e++){let i=n[e];if(0!==i){let r=this.regionSegments[e];r||(r=this.regionSegments[e]=new n8);let n={vertexOffset:a.vertexOffset,primitiveOffset:a.primitiveOffset+o,vertexLength:a.vertexLength,primitiveLength:i};r.get().push(n)}o+=i}for(let e=0;e<i.length;e++){let r=i[e].id;this.indexArray.emplaceBack(r,r+1,r+3),this.indexArray.emplaceBack(r,r+3,r+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,r,a,n,o){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,r,a,n,o)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,lS.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,r,a,n,o,s){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,r,a,n,o,s)}updateHiddenByLandmark(e){if(!this.hasData())return;let i=e.groundVertexCount+e.groundVertexArrayOffset;if(0===e.groundVertexCount)return;let r=2147483648&e.flags?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,r);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,lA.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){let i=this.regionSegments[e];i&&i.destroy()}}}}class hh{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new nz,this.footprintVertices=new np,this.footprintSegments=[],this.layoutVertexArray=new nm,this.centroidVertexArray=new n2,this.wallVertexArray=new n4,this.indexArray=new nz,this.programConfigurations=new oT(e.layers,{zoom:e.zoom,lut:e.lut},e=>l6.includes(e)),this.segments=new n8,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new hl(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,r,a){for(let{feature:n,id:o,index:s,sourceLayerIndex:l}of(this.features=[],this.hasPattern=lg("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=oq(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1),e)){let e=this.layers[0]._featureFilter.needGeometry,h=oX(n,e);if(!this.layers[0]._featureFilter.filter(new aG(this.zoom),h,r))continue;let u={id:o,sourceLayerIndex:l,index:s,geometry:e?h.geometry:oW(n,r,a),properties:n.properties,type:n.type,patterns:{}},c=this.layoutVertexArray.length,d="Polygon"===l5[u.type];if(this.hasPattern)this.features.push(ly("fill-extrusion",this.layers,u,this.zoom,i));else if(this.wallMode)for(let e of u.geometry)for(let n of l4(e,d))this.addFeature(u,[n],s,r,{},i.availableImages,a,i.brightness);else this.addFeature(u,u.geometry,s,r,{},i.availableImages,a,i.brightness);i.featureIndex.insert(n,u.geometry,s,l,this.index,c)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,r,a,n,o){for(let e of this.features){let s="Polygon"===l5[e.type],{geometry:l}=e;if(this.wallMode)for(let h of l)for(let l of l4(h,s))this.addFeature(e,[l],e.index,i,r,a,n,o);else this.addFeature(e,l,e.index,i,r,a,n,o)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s),this.groundEffect.update(e,i,n,r,a,o,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,lC),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,lE.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,lI.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,lM.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,r,a,n,o,s,l){var h;let u,c;let d=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,p=[new eR(0,0),new eR(8192,8192)],f=s.projection,m="globe"===f.name,_=this.wallMode||"Polygon"===l5[e.type],g=new hn;g.centroidDataIndex=this.centroidData.length;let y=new ha,x=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a),v=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);if(y.height=v,y.vertexArrayOffset=this.layoutVertexArray.length,y.groundVertexArrayOffset=this.groundEffect.vertexArray.length,m&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new nw),this.wallMode){if(m)return void e1("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==i.length)return;i=[(u=function(e){let i=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;(function(e){let i=0,r=e.length;for(let a=0;a<r;a++)i+=(e[(a+1)%r].x-e[a].x)*(e[(a+1)%r].y+e[a].y);return i>=0})(e)||(e=e.reverse());let r={geometry:[],joinNormals:[],indices:[]},a=[],n=[],o=[],s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;if(s<(i?3:2))return r;let l,h,u,c,d,p=0;for(;p<s-1&&e[p].equals(e[p+1]);)p++;i&&(l=e[s-2],d=e[p].sub(l)._unit()._perp());for(let r=p;r<s;r++){if((u=r===s-1?i?e[p+1]:void 0:e[r+1])&&e[r].equals(u))continue;d&&(c=d),l&&(h=l),l=e[r],d=u?u.sub(l)._unit()._perp():c;let f=(c=c||d).add(d);0===f.x&&0===f.y||f._unit();let m=f.x*d.x+f.y*d.y,_=0!==m?1/m:1/0,g=c.x*d.y-c.y*d.x>0,y="miter";
7"miter"===y&&_>2&&(y="bevel"),"bevel"===y&&(_>100&&(y="flipbevel"),_<2&&(y="miter"));let x=(e,i,r,s)=>{let l=new eR(e.x,e.y),h=new eR(e.x,e.y);l.x+=i.x*s,l.y+=i.y*s,h.x-=i.x*Math.max(r,1),h.y-=i.y*Math.max(r,1),o.push(i),a.push(l),n.push(h)};if("miter"===y)f._mult(_),x(l,f,0,0);else if("flipbevel"===y)x(l,f=d.mult(-1),0,0),x(l,f.mult(-1),0,0);else{let e=-Math.sqrt(_*_-1),i=g?e:0,r=g?0:e;h&&x(l,c,i,r),u&&x(l,d,i,r)}}r.geometry=[...a,...n.reverse(),a[0]],r.joinNormals=[...o,...o.reverse(),o[o.length-1]];let f=r.geometry.length-1;for(let e=0;e<f/2;e++)if(e+1<f/2){let i=e,a=e+1,n=f-1-e,o=f-2-e;i=0===i?f-1:i-1,a=0===a?f-1:a-1,n=0===n?f-1:n-1,o=0===o?f-1:o-1,r.indices.push(n),r.indices.push(a),r.indices.push(i),r.indices.push(n),r.indices.push(o),r.indices.push(a)}return r}(i[0])).geometry]}let b=(e,i)=>e<(i.length-1)/2||e===i.length-1,w=this.wallMode?[i]:lf(i,500);for(let e=w.length-1;e>=0;e--){let i=w[e];(0===i.length||(h=i[0]).every(e=>e.x<=0)||h.every(e=>e.x>=8192)||h.every(e=>e.y<=0)||h.every(e=>e.y>=8192))&&w.splice(e,1)}if(m)c=hg(w,p,a);else for(let e of(c=[],w))c.push({polygon:e,bounds:p});let T=_?this.edgeRadius:0,S=T>0&&this.zoom<17,M=(e,i)=>{if(0===e.length)return!1;let r=e[e.length-1];return i.x===r.x&&i.y===r.y};for(let{polygon:e,bounds:i}of c){let r=0,n=0;for(let i of e)_&&!i[0].equals(i[i.length-1])&&i.push(i[0]),n+=_?i.length-1:i.length;let o=this.segments.prepareSegment((_?5:4)*n,this.layoutVertexArray,this.indexArray);y.footprintSegIdx<0&&(y.footprintSegIdx=this.footprintSegments.length),y.polygonSegIdx<0&&(y.polygonSegIdx=this.polygonSegments.length);let s={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},l=new hr;if(l.vertexOffset=this.footprintVertices.length,l.indexOffset=3*this.footprintIndices.length,l.ringIndices=[],_){let n=[],s=[];r=o.vertexLength;for(let r=0;r<e.length;r++){let h,c;let p=e[r];p.length&&0!==r&&s.push(n.length/2);let _=[];h=p[1].sub(p[0])._perp()._unit(),l.ringIndices.push(p.length-1);for(let e=1;e<p.length;e++){let i=p[e],r=p[e===p.length-1?1:e+1],s=i.clone();if(T){c=r.sub(i)._perp()._unit();let e=h.add(c)._unit(),a=T*Math.min(4,1/(h.x*e.x+h.y*e.y));s.x+=a*e.x,s.y+=a*e.y,s.x=Math.round(s.x),s.y=Math.round(s.y),h=c}if(!x||0!==T&&!S||M(_,s)||_.push(s),l7(this.layoutVertexArray,s.x,s.y,0,0,1,1,0),this.wallMode){let i=b(e,p);he(this.wallVertexArray,u.joinNormals[e],!i)}o.vertexLength++,this.footprintVertices.emplaceBack(i.x,i.y),n.push(i.x,i.y),m&&hi(this.layoutVertexExtArray,f.projectTilePoint(s.x,s.y,a),f.upVector(a,s.x,s.y))}x&&(0===T||S)&&(0!==_.length&&M(_,_[0])&&_.pop(),this.groundEffect.addData(_,i,d))}let h=this.wallMode?u.indices:s9(n,s);for(let e=0;e<h.length;e+=3)this.footprintIndices.emplaceBack(l.vertexOffset+h[e+0],l.vertexOffset+h[e+1],l.vertexOffset+h[e+2]),this.indexArray.emplaceBack(r+h[e],r+h[e+2],r+h[e+1]),o.primitiveLength++;l.indexCount+=h.length,l.vertexCount+=this.footprintVertices.length-l.vertexOffset}for(let n=0;n<e.length;n++){let s,l,h;let c=e[n];g.startRing(y,c[0]);let p=c.length>4&&hf(c[c.length-2],c[0],c[1]),v=T?function(e,i,r,a){let n=i.sub(e)._perp()._unit(),o=r.sub(i)._perp()._unit();return hc(e,i,r,hu(n,o),a)}(c[c.length-2],c[0],c[1],T):0,w=[];l=c[1].sub(c[0])._perp()._unit();let S=!0;for(let e=1,n=0;e<c.length;e++){let d=c[e-1],_=c[e],E=c[e===c.length-1?1:e+1];if(g.appendEdge(y,_,d),hd(_,d,i)){T&&(l=E.sub(_)._perp()._unit(),S=!S);continue}let A=_.sub(d)._perp(),I=A.x/(Math.abs(A.x)+Math.abs(A.y)),C=A.y>0?1:0,P=d.dist(_);if(n+P>32768&&(n=0),T){h=E.sub(_)._perp()._unit();let e=hc(d,_,E,hu(l,h),T);isNaN(e)&&(e=0);let i=_.sub(d)._unit();d=d.add(i.mult(v))._round(),_=_.add(i.mult(-e))._round(),v=e,l=h,x&&this.zoom>=17&&(M(w,d)||w.push(d),M(w,_)||w.push(_))}let z=o.vertexLength,D=c.length>4&&hf(d,_,E),R=hm(n,p,S);if(l7(this.layoutVertexArray,d.x,d.y,I,C,0,0,R),l7(this.layoutVertexArray,d.x,d.y,I,C,0,1,R),this.wallMode){let i=b(e-1,c),r=u.joinNormals[e-1];he(this.wallVertexArray,r,i),he(this.wallVertexArray,r,i)}if(n+=P,R=hm(n,D,!S),p=D,l7(this.layoutVertexArray,_.x,_.y,I,C,0,0,R),l7(this.layoutVertexArray,_.x,_.y,I,C,0,1,R),this.wallMode){let i=b(e,c),r=u.joinNormals[e];he(this.wallVertexArray,r,i),he(this.wallVertexArray,r,i)}if(o.vertexLength+=4,this.indexArray.emplaceBack(z+0,z+1,z+2),this.indexArray.emplaceBack(z+1,z+3,z+2),o.primitiveLength+=2,T){let a=r+(1===e?c.length-2:e-2),n=1===e?r:a+1;if(this.indexArray.emplaceBack(z+1,a,z+3),this.indexArray.emplaceBack(a,n,z+3),o.primitiveLength+=2,void 0===s&&(s=z),!hd(E,c[e],i)){let i=e===c.length-1?s:o.vertexLength;this.indexArray.emplaceBack(z+2,z+3,i),this.indexArray.emplaceBack(z+3,i+1,i),this.indexArray.emplaceBack(z+3,n,i+1),o.primitiveLength+=3}S=!S}if(m){let e=this.layoutVertexExtArray,i=f.projectTilePoint(d.x,d.y,a),r=f.projectTilePoint(_.x,_.y,a),n=f.upVector(a,d.x,d.y),o=f.upVector(a,_.x,_.y);hi(e,i,n),hi(e,i,n),hi(e,r,o),hi(e,r,o)}}_&&(r+=c.length-1),x&&T&&this.zoom>=17&&(0!==w.length&&M(w,w[0])&&w.pop(),this.groundEffect.addData(w,i,d,T>0))}this.footprintSegments.push(l),s.triangleCount=this.indexArray.length-s.triangleArrayOffset,this.polygonSegments.push(s),++y.footprintSegLen,++y.polygonSegLen}if(y.vertexCount=this.layoutVertexArray.length-y.vertexArrayOffset,y.groundVertexCount=this.groundEffect.vertexArray.length-y.groundVertexArrayOffset,0!==y.vertexCount){if(y.centroidXY=g.borders?l9:this.encodeCentroid(g,y),this.centroidData.push(y),g.borders){this.featuresOnBorder.push(g);let e=this.featuresOnBorder.length-1;for(let i=0;i<g.borders.length;i++)g.borders[i][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[i].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,l),this.groundEffect.addPaintPropertiesData(e,r,n,o,a,l),this.maxHeight=Math.max(this.maxHeight,v)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,r)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[r].borders[e][0])}splitToSubtiles(){let e=[];for(let i=0;i<this.centroidData.length;i++){let r=this.centroidData[i],a=+(r.min.y+r.max.y>8192),n=2*a+(+(r.min.x+r.max.x>8192)^a);for(let a=0;a<r.polygonSegLen;a++){let o=r.polygonSegIdx+a;e.push({centroidIdx:i,subtile:n,polygonSegmentIdx:o,triangleSegmentIdx:this.polygonSegments[o].triangleSegIdx})}}let i=new nz;e.sort((e,i)=>e.triangleSegmentIdx===i.triangleSegmentIdx?e.subtile-i.subtile:e.triangleSegmentIdx-i.triangleSegmentIdx);let r=0,a=0,n=0;
7for(let i of e){if(i.triangleSegmentIdx!==r)break;n++}let o=e.length;for(;a!==e.length;){r=e[a].triangleSegmentIdx;let s=0,l=a,h=a;for(let i=l;i<n&&e[i].subtile===s;i++)h++;for(;l!==n;){let a=e[l];s=a.subtile;let o=this.centroidData[a.centroidIdx].min.clone(),u=this.centroidData[a.centroidIdx].max.clone(),c={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let r=l;r<h;r++){let a=e[r],n=this.polygonSegments[a.polygonSegmentIdx],s=this.centroidData[a.centroidIdx].min,l=this.centroidData[a.centroidIdx].max,h=this.indexArray.uint16;for(let e=n.triangleArrayOffset;e<n.triangleArrayOffset+n.triangleCount;e++)i.emplaceBack(h[3*e],h[3*e+1],h[3*e+2]);c.primitiveLength+=n.triangleCount,o.x=Math.min(o.x,s.x),o.y=Math.min(o.y,s.y),u.x=Math.max(u.x,l.x),u.y=Math.max(u.y,l.y)}c.primitiveLength>0&&this.triangleSubSegments.push({segment:c,min:o,max:u}),l=h;for(let i=l;i<n&&e[i].subtile===e[l].subtile;i++)h++}a=n;for(let i=a;i<o&&e[i].triangleSegmentIdx===e[a].triangleSegmentIdx;i++)n++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,r){let a;let n=new n8;if(this.wallMode){for(let e of this.triangleSubSegments)n.segments.push(e.segment);return n}let o=0,s=0,l=1<<e.canonical.z;if(i){let r=i.getMinMaxForTile(e);r&&(o=r.min,s=r.max)}s+=this.maxHeight;let h=e.toUnwrapped(),u=[h.canonical.x/l+h.wrap,h.canonical.y/l],c=[(h.canonical.x+1)/l+h.wrap,(h.canonical.y+1)/l],d=(e,i,r)=>[e[0]*(1-r[0])+i[0]*r[0],e[1]*(1-r[1])+i[1]*r[1]],p=[],f=[];for(let e of this.triangleSubSegments){p[0]=e.min.x/8192,p[1]=e.min.y/8192,f[0]=e.max.x/8192,f[1]=e.max.y/8192;let i=d(u,c,p),l=d(u,c,f);if(0===new sw([i[0],i[1],o],[l[0],l[1],s]).intersectsPrecise(r)){a&&(n.segments.push(a),a=void 0);continue}let h=e.segment;a&&a.vertexOffset!==h.vertexOffset&&(n.segments.push(a),a=void 0),a?(a.vertexLength+=h.vertexLength,a.primitiveLength+=h.primitiveLength):a={vertexOffset:h.vertexOffset,primitiveLength:h.primitiveLength,vertexLength:h.vertexLength,primitiveOffset:h.primitiveOffset,sortKey:void 0,vaos:{}}}return a&&n.segments.push(a),n}encodeCentroid(e,i){let r=e.centroid(),a=i.span(),n=Math.min(7,Math.round(a.x*this.tileToMeter/10)),o=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new eR(eU(r.x,1,8191)<<3|n,eU(r.y,1,8191)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new eR(0,0);let i=e.borders,r=Number.MAX_VALUE;if(i[0][0]!==r||i[1][0]!==r){let e=i[0][0]!==r?0:1;return new eR(6|(i[0][0]!==r?0:65528),(i[e][0]+i[e][1])/2<<3|6)}{let e=i[2][0]!==r?2:3;return new eR((i[e][0]+i[e][1])/2<<3|6,6|(i[2][0]!==r?0:65528))}}showCentroid(e){let i=this.centroidData[e.centroidDataIndex];i.flags&=2147483648,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);let i=e.vertexArrayOffset,r=e.vertexCount+e.vertexArrayOffset,a=2147483648&e.flags?l9:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||n!==a.x){for(let e=i;e<r;++e)this.centroidVertexArray.emplace(e,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){for(let e of(this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.centroidData))this.writeCentroidToBuffer(e)}updateReplacement(e,i,r){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let a=i.getReplacementRegionsForTile(e.toUnwrapped());if(lJ(this.activeReplacements,a))return;if(this.activeReplacements=a,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(let e of this.centroidData)e.flags&=2147483647;let n=[];for(let i of this.activeReplacements){if(i.order<r)continue;let a=Math.max(1,Math.pow(2,i.footprintTileId.canonical.z-e.canonical.z));for(let r of this.centroidData)if(!(2147483648&r.flags||i.min.x>r.max.x||r.min.x>i.max.x||i.min.y>r.max.y||r.min.y>i.max.y))for(let o=0;o<r.footprintSegLen;o++){let s=this.footprintSegments[r.footprintSegIdx+o];if(n.length=0,function(e,i,r,a,n,o){let s=Math.pow(2,a.z-n.z);for(let l=0;l<r;l++){let r=e.int16[2*(l+i)+0],h=e.int16[2*(l+i)+1];r=(r+8192*n.x)*s-8192*a.x,h=(h+8192*n.y)*s-8192*a.y,o.push(new eR(r,h))}}(this.footprintVertices,s.vertexOffset,s.vertexCount,i.footprintTileId.canonical,e.canonical,n),l0(i.footprint,n,this.footprintIndices.uint16,s.indexOffset,s.indexCount,-s.vertexOffset,
7-a)){r.flags|=2147483648;break}}}for(let e of this.centroidData)this.writeCentroidToBuffer(e);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,r){let a=!1;for(let n=0;n<r.footprintSegLen;n++){let o=this.footprintSegments[r.footprintSegIdx+n],s=0;for(let r of o.ringIndices){for(let n=s,l=r+s-1;n<r+s;l=n++){let r=this.footprintVertices.int16[2*(n+o.vertexOffset)+0],s=this.footprintVertices.int16[2*(n+o.vertexOffset)+1],h=this.footprintVertices.int16[2*(l+o.vertexOffset)+1];s>i!=h>i&&e<(this.footprintVertices.int16[2*(l+o.vertexOffset)+0]-r)*(i-s)/(h-s)+r&&(a=!a)}s=r}}return a}getHeightAtTileCoord(e,i){let r=Number.NEGATIVE_INFINITY,a=!0,n=4*(e+8192)*8192+(i+8192);if(this.partLookup.hasOwnProperty(n)){let e=this.partLookup[n];return e?{height:e.height,hidden:!!(2147483648&e.flags)}:void 0}for(let o of this.centroidData)e>o.max.x||o.min.x>e||i>o.max.y||o.min.y>i||this.footprintContainsPoint(e,i,o)&&o&&o.height>r&&(r=o.height,this.partLookup[n]=o,a=!!(2147483648&o.flags));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:a};this.partLookup[n]=void 0}}function hu(e,i){let r=e.add(i)._unit();return e.x*r.x+e.y*r.y}function hc(e,i,r,a,n){let o=Math.sqrt(1-a*a);return Math.min(e.dist(i)/3,i.dist(r)/3,n*o/a)}function hd(e,i,r){return e.x<r[0].x&&i.x<r[0].x||e.x>r[1].x&&i.x>r[1].x||e.y<r[0].y&&i.y<r[0].y||e.y>r[1].y&&i.y>r[1].y}function hp(e,i){return e.x<i[0].x||e.x>i[1].x||e.y<i[0].y||e.y>i[1].y}function hf(e,i,r){if(e.x<0||e.x>=8192||i.x<0||i.x>=8192||r.x<0||r.x>=8192)return!1;let a=r.sub(i),n=a.perp(),o=e.sub(i);return(a.x*o.x+a.y*o.y)/Math.sqrt((a.x*a.x+a.y*a.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function hm(e,i,r){let a=i?2|e:-3&e;return r?1|a:-2&a}function h_(){let e=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*e*e)-6371008.8}function hg(e,i,r){let a=1<<r.z,n=oN(r.x/a);return function(e,i,r,a,n=0,o){let s=[];if(!e.length||!r||!a)return s;let l=(e,i)=>{for(let r of e)s.push({polygon:r,bounds:i})},h=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(a)),c=h-u,d=[];for(let e=0;e<Math.abs(c);e++)d.push(c>0?0:1);for(let e=0;e<Math.min(h,u);e++)d.push(0),d.push(1);let p=e;if(p=lq(p,i[0].y-n,i[1].y+n,1),!(p=lq(p,i[0].x-n,i[1].x+n,0)).length)return s;let f=[];for(d.length?f.push({polygons:p,bounds:i,depth:0}):l(p,i);f.length;){let e=f.pop(),i=e.depth,r=d[i],a=e.bounds[0],s=e.bounds[1],h=0===r?a.x:a.y,u=0===r?s.x:s.y,c=o?o(r,h,u):.5*(h+u),p=lq(e.polygons,h-n,c+n,r),m=lq(e.polygons,c-n,u+n,r);if(p.length){let e=[a,new eR(0===r?c:s.x,1===r?c:s.y)];d.length>i+1?f.push({polygons:p,bounds:e,depth:i+1}):l(p,e)}if(m.length){let e=[new eR(0===r?c:a.x,1===r?c:a.y),s];d.length>i+1?f.push({polygons:m,bounds:e,depth:i+1}):l(m,e)}}return s}(e,i,Math.ceil((oN((r.x+1)/a)-n)/11.25),Math.ceil((oV(r.y/a)-oV((r.y+1)/a))/11.25),1,(e,i,n)=>{if(0===e)return .5*(i+n);{let e=oV((r.y+i/8192)/a);return(oB(.5*(oV((r.y+n/8192)/a)+e))*a-r.y)*8192}})}function hy(e,i){return e.x*i.x+e.y*i.y}function hx(e,i){if(1===e.length){let r,a=0,n=i[a++];for(;!r||n.equals(r);)if(!(r=i[a++]))return 1/0;for(;a<i.length;a++){let o=i[a],s=e[0],l=r.sub(n),h=o.sub(n),u=s.sub(n),c=hy(l,l),d=hy(l,h),p=hy(h,h),f=hy(u,l),m=hy(u,h),_=c*p-d*d,g=(p*f-d*m)/_,y=(c*m-d*f)/_,x=n.z*(1-g-y)+r.z*g+o.z*y;if(isFinite(x))return x}return 1/0}{let e=1/0;for(let r of i)e=Math.min(e,r.z);return e}}function hv(e,i,r,a,n,o,s,l){let h=s*n.getElevationAt(e,i,!0,!0),u=0!==o[0],c=u?0===o[1]?s*(o[0]/7-450):s*function(e,i,r){var a,n;let o=Math.floor(i[0]/8),s=Math.floor(i[1]/8),l=10*(i[0]-8*o),h=10*(i[1]-8*s),u=e.getElevationAt(o,s,!0,!0),c=e.getMeterToDEM(r),d=Math.floor(.5*(l*c-1)),p=Math.floor(.5*(h*c-1)),f=e.tileCoordToPixel(o,s),m=2*d+1,_=2*p+1,g=(a=f.x-d,n=f.y-p,[e.getElevationAtPixel(a,n,!0),e.getElevationAtPixel(a+_,n,!0),e.getElevationAtPixel(a,n+_,!0),e.getElevationAtPixel(a+m,n+_,!0)]),y=Math.abs(g[0]-g[1]);return u+Math.max(Math.min(.25,.5*c*(y+Math.abs(g[2]-g[3]))/m)*l,Math.min(.25,.5*c*(Math.abs(g[0]-g[2])+Math.abs(g[1]-g[3]))/_)*h)}(n,o,l):h;return{base:h+(0===r?-1:r),top:u?Math.max(c+a,h+r+2):h+a}}ab(hh,"FillExtrusionBucket",{omit:["layers","features"]}),ab(ha,"PartData"),ab(hr,"FootprintSegment"),ab(hn,"BorderCentroidData"),ab(hl,"GroundEffect");let hb=nc([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),hw=nc([{name:"a_z_offset_width",components:2,type:"Float32"}],4),{members:hT}=hb,{members:hS}=nc([{name:"a_packed",components:4,type:"Float32"}]),{members:hM}=nc([{name:"a_pattern_data",components:3,type:"Float32"}]);class hE{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new s3({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){let r=this.getKey(e,i);return this.positions[r]}trim(){let e=this.width,i=this.height=eW(this.nextRow);this.image.resize({width:e,height:i})}
7getKey(e,i){return e.join(",")+i}getDashRanges(e,i,r){let a=[],n=e.length%2==1?-e[e.length-1]*r:0,o=e[0]*r,s=!0;a.push({left:n,right:o,isDash:s,zeroLength:0===e[0]});let l=e[0];for(let i=1;i<e.length;i++){s=!s;let h=e[i];n=l*r,l+=h,o=l*r,a.push({left:n,right:o,isDash:s,zeroLength:0===h})}return a}addRoundDash(e,i,r){let a=i/2;for(let i=-r;i<=r;i++){let n=this.width*(this.nextRow+r+i),o=0,s=e[0];for(let l=0;l<this.width;l++){let h;l/s.right>1&&(s=e[++o]);let u=Math.min(Math.abs(l-s.left),Math.abs(l-s.right)),c=i/r*(a+1);if(s.isDash){let e=a-Math.abs(c);h=Math.sqrt(u*u+e*e)}else h=a-Math.sqrt(u*u+c*c);this.image.data[n+l]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,i){for(let i=e.length-1;i>=0;--i){let r=e[i],a=e[i+1];r.zeroLength?e.splice(i,1):a&&a.isDash===r.isDash&&(a.left=r.left,e.splice(i,1))}let r=e[0],a=e[e.length-1];r.isDash===a.isDash&&(r.left=a.left-this.width,a.right=r.right+this.width);let n=this.width*this.nextRow,o=0,s=e[0];for(let r=0;r<this.width;r++){r/s.right>1&&(s=e[++o]);let a=Math.min(Math.abs(r-s.left),Math.abs(r-s.right));this.image.data[n+r]=Math.max(0,Math.min(255,(s.isDash?a:-a)+i+128))}}addDash(e,i){let r=this.getKey(e,i);if(this.positions[r])return this.positions[r];let a="round"===i,n=a?7:0,o=2*n+1;if(this.nextRow+o>this.height)return e1("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let i=0;i<e.length;i++)e[i]<0&&(e1("Negative value is found in line dasharray, replacing values with 0"),e[i]=0),s+=e[i];if(0!==s){let r=this.width/s,o=this.getDashRanges(e,this.width,r);a?this.addRoundDash(o,r,n):this.addRegularDash(o,"square"===i?.5*r:0)}let l=this.nextRow+n;this.nextRow+=o;let h={tl:[l,n],br:[s,0]};return this.positions[r]=h,h}}ab(hE,"LineAtlas");let hA=lU.VectorTileFeature.types,hI=Math.cos(Math.PI/180*37.5),hC=Math.cos(Math.PI/180*5);class hP{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new ng,this.layoutVertexArray2=new ny,this.patternVertexArray=new nx,this.indexArray=new nz,this.programConfigurations=new oT(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new n8,this.maxLineLength=0,this.zOffsetVertexArray=new nN,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128}updateFootprints(e,i){}populate(e,i,r,a){this.hasPattern=lg("line",this.layers,i);let n=this.layers[0].layout.get("line-sort-key");this.tileToMeter=oq(r),this.hasZOffset=!this.layers[0].isDraped();let o=this.layers[0].layout.get("line-elevation-reference");this.hasZOffset&&"none"===o&&e1(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`);let s=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.hasZOffset&&void 0!==s;let l=[];for(let{feature:i,id:o,index:s,sourceLayerIndex:h}of e){let e=this.layers[0]._featureFilter.needGeometry,u=oX(i,e);if(!this.layers[0]._featureFilter.filter(new aG(this.zoom),u,r))continue;let c=n?n.evaluate(u,{},r):void 0,d={id:o,properties:i.properties,type:i.type,sourceLayerIndex:h,index:s,geometry:e?u.geometry:oW(i,r,a),patterns:{},sortKey:c};l.push(d)}n&&l.sort((e,i)=>e.sortKey-i.sortKey);let{lineAtlas:h,featureIndex:u}=i,c=this.addConstantDashes(h);for(let a of l){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(c&&this.addFeatureDashes(a,h),this.hasPattern){let e=ly("line",this.layers,a,this.zoom,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,h.positions,i.availableImages,i.brightness);u.insert(e[o].feature,n,o,s,this.index)}}addConstantDashes(e){let i=!1;for(let r of this.layers){let a=r.paint.get("line-dasharray").value,n=r.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==n.kind)i=!0;else{let i=n.value,r=a.value;if(!r)continue;e.addDash(r,i)}}return i}addFeatureDashes(e,i){let r=this.zoom;for(let a of this.layers){let n,o;let s=a.paint.get("line-dasharray").value,l=a.layout.get("line-cap").value;if("constant"!==s.kind||"constant"!==l.kind){if("constant"===s.kind){if(!(n=s.value))continue}else n=s.evaluate({zoom:r},e);o="constant"===l.kind?l.value:l.evaluate({zoom:r},e),i.addDash(n,o),e.patterns[a.id]=i.getKey(n,o)}}}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s)}addFeatures(e,i,r,a,n,o){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,i,r,a,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,hS)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,hM)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,hw.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hT),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,r,a,n,o,s){let l=this.layers[0].layout,h=l.get("line-join").evaluate(e,{}),u=l.get("line-cap").evaluate(e,{}),c=l.get("line-miter-limit"),d=l.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=l.get("line-z-offset").value;let p=this.layers[0].paint.get("line-width").value;for(let r of("constant"!==p.kind&&!1===p.isLineProgressConstant&&(this.variableWidthValue=p),i))this.addLine(r,e,a,h,u,c,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,s)}addLine(e,i,r,a,n,o,s){let l,h,u,c,d,p;this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineS
7oFar=0,this.currentVertex=void 0;let f="none"===a;if(this.patternJoinNone=this.hasPattern&&f,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let i=0;i<e.length-1;i++)this.totalDistance+=e[i].dist(e[i+1]);this.totalFeatureLength=this.totalDistance/(this.lineClips.end-this.lineClips.start),this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let m="Polygon"===hA[i.type],_=e.length;for(;_>=2&&e[_-1].equals(e[_-2]);)_--;let g=0;for(;g<_-1&&e[g].equals(e[g+1]);)g++;if(_<(m?3:2))return;"bevel"===a&&(o=1.05);let y=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,m&&(l=e[_-2],d=e[g].sub(l)._unit()._perp());for(let i=g;i<_;i++){if((u=i===_-1?m?e[g+1]:void 0:e[i+1])&&e[i].equals(u))continue;d&&(c=d),l&&(h=l),l=e[i],p=this.evaluateLineProgressFeatures(h?h.dist(l):0),d=u?u.sub(l)._unit()._perp():c,c=c||d;let r=h&&u,x=r?a:m||f?"butt":n,v=c.x*d.x+c.y*d.y;if(f){let e=function(e){if(e.patternJoinNone){let i=e.segmentPoints.length/2,r=e.lineSoFar-e.segmentStart;for(let a=0;a<i;++a){let i=e.segmentPoints[2*a+1],n=Math.round(e.segmentPoints[2*a])+.5+.25*i;e.patternVertexArray.emplaceBack(n,r,e.segmentStart),e.patternVertexArray.emplaceBack(n,r,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(r&&v<hC){this.updateDistance(h,l),this.addCurrentVertex(l,c,1,1,y,p),e(this),this.addCurrentVertex(l,d,-1,-1,y,p);continue}if(h){if(!u){this.updateDistance(h,l),this.addCurrentVertex(l,c,1,1,y,p),e(this);continue}x="miter"}}let b=c.add(d);0===b.x&&0===b.y||b._unit();let w=b.x*d.x+b.y*d.y,T=0!==w?1/w:1/0,S=2*Math.sqrt(2-2*w),M=w<hI&&h&&u,E=c.x*d.y-c.y*d.x>0,A=this.overscaling<=16?122880/(512*this.overscaling):0;if(r&&"round"===x){if(T<s)x="miter";else if(T<=2){let e=hz(l,-10,8202);x=this.hasZOffset&&(e||this.hasCrossSlope)?"miter":"fakeround"}}if("miter"===x&&T>o&&(x="bevel"),"bevel"===x&&(T>2&&(x="flipbevel"),T<o&&(x="miter")),h&&!("miter"===x&&M)&&this.updateDistance(h,l),"miter"===x){if(M){let e=l.dist(h);if(e>2*A){let i=l.sub(l.sub(h)._mult(A/e)._round());this.updateDistance(h,i),this.addCurrentVertex(i,c,0,0,y,p),h=i}this.updateDistance(h,l),b._mult(T),this.addCurrentVertex(l,b,0,0,y,p);let i=l.dist(u);if(i>2*A){let e=l.add(u.sub(l)._mult(A/i)._round());this.updateDistance(l,e),this.addCurrentVertex(e,d,0,0,y,p),l=e}}else b._mult(T),this.addCurrentVertex(l,b,0,0,y,p)}else if("flipbevel"===x){if(T>100)b=d.mult(-1);else{let e=T*c.add(d).mag()/c.sub(d).mag();b._perp()._mult(e*(E?-1:1))}this.addCurrentVertex(l,b,0,0,y,p),this.addCurrentVertex(l,b.mult(-1),0,0,y,p)}else if("bevel"===x||"fakeround"===x){null!=p&&h&&this.addCurrentVertex(l,c,-1,-1,y,p);let e=l.dist(h)<=2*A&&"bevel"!==x,i=b.mult(E?1:-1);i._mult(T);let r=d.mult(E?-1:1),a=c.mult(E?-1:1),n=this.evaluateLineProgressFeatures(this.distance);if(null==p&&(this.addHalfVertex(l,i.x,i.y,!1,!E,0,y,n),e||this.addHalfVertex(l,i.x+2*a.x,i.y+2*a.y,!1,E,0,y,n)),"fakeround"===x){let e=Math.round(180*S/Math.PI/20);this.addHalfVertex(l,a.x,a.y,!1,E,0,y,n);for(let i=0;i<e;i++){let o=i/e;if(.5!==o){let e=o-.5;o+=o*e*(o-1)*((1.0904+v*(v*(3.55645-1.43519*v)-3.2452))*e*e+(.848013+v*(.215638*v-1.06021)))}let s=r.sub(a)._mult(o)._add(a)._unit();this.addHalfVertex(l,s.x,s.y,!1,E,0,y,n)}this.addHalfVertex(l,r.x,r.y,!1,E,0,y,n)}e||null!=p||this.addHalfVertex(l,i.x+2*r.x,i.y+2*r.y,!1,E,0,y,n),null!=p&&u&&this.addCurrentVertex(l,d,1,1,y,p)}else"butt"===x?this.addCurrentVertex(l,b,0,0,y,p):"square"===x?(h||this.addCurrentVertex(l,b,-1,-1,y,p),this.addCurrentVertex(l,b,0,0,y,p),h&&this.addCurrentVertex(l,b,1,1,y,p)):"round"===x&&(h&&(this.addCurrentVertex(l,c,0,0,y,p),this.addCurrentVertex(l,c,1,1,y,p,!0)),u&&(this.addCurrentVertex(l,d,-1,-1,y,p,!0),this.addCurrentVertex(l,d,0,0,y,p)))}}addVerticesTo(e,i,r,a,n,o,s,l,h,u){let c=(i.w-e.w)/this.tessellationStep|0,d=0,p=this.scaledDistance;if(c>1){this.lineSoFar=e.w;let p=(i.x-e.x)/c,f=(i.y-e.y)/c,m=(i.z-e.z)/c,_=(i.w-e.w)/c;for(let i=1;i<c;++i){e.x+=p,e.y+=f,e.z+=m,this.lineSoFar+=_,d+=_;let i=this.evaluateLineProgressFeatures(this.prevDistance+d);this.scaledDistance=(this.prevDistance+d)/this.totalDistance,this.addHalfVertex(e,r,a,u,!1,s,h,i),this.addHalfVertex(e,n,o,u,!0,-l,h,i)}}
7this.lineSoFar=i.w,this.scaledDistance=p;let f=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,r,a,u,!1,s,h,f),this.addHalfVertex(i,n,o,u,!0,-l,h,f)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&!this.hasZOffset)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):e1(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.hasZOffset?"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}:{zOffset:0,variableWidth:i}}addCurrentVertex(e,i,r,a,n,o,s=!1){let l=i.x+i.y*r,h=i.y-i.x*r,u=i.y*a-i.x,c=-i.y-i.x*a;if(null!=o){let i=this.hasZOffset,d=o.zOffset,p=new lG(e.x,e.y,d,this.lineSoFar),f=!!i&&hz(e,-10,8202),m=this.lineSoFar,_=this.distance;if(this.currentVertex){if(f){let i=this.currentVertexIsOutside,o=this.currentVertex,f=new lG(e.x,e.y,d,this.lineSoFar);if(lH(o,f,-10,8202),!hz(f,-10,8202)){if(i){this.e1=this.e2=-1,this.distance-=o.dist(p),this.lineSoFar=o.w;let e=this.evaluateLineProgressFeatures(o.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(o,l,h,s,!1,r,n,e),this.addHalfVertex(o,u,c,s,!0,-a,n,e),this.prevDistance=this.distance}this.distance=this.prevDistance+o.dist(f),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(o,f,l,h,u,c,r,a,n,s),this.distance=_,this.scaledDistance=this.distance/this.totalDistance}}else{let e=this.currentVertex;if(this.currentVertexIsOutside){lH(e,p,-10,8202),this.e1=this.e2=-1,this.distance-=e.dist(p),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e.w;let i=this.evaluateLineProgressFeatures(e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(e,l,h,s,!1,r,n,i),this.addHalfVertex(e,u,c,s,!0,-a,n,i),this.prevDistance=this.distance,this.distance=_,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(e,p,l,h,u,c,r,a,n,s)}}else f||(this.addHalfVertex(e,l,h,s,!1,r,n,o),this.addHalfVertex(e,u,c,s,!0,-a,n,o));this.currentVertex=p,this.currentVertexIsOutside=f,this.lineSoFar=m}else this.addHalfVertex(e,l,h,s,!1,r,n,o),this.addHalfVertex(e,u,c,s,!0,-a,n,o)}addHalfVertex({x:e,y:i},r,a,n,o,s,l,h){this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),o||this.segmentPoints.push(this.lineSoFar-this.segmentStart,s)),this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(i<<1)+(o?1:0),Math.round(63*r)+128,Math.round(63*a)+128,1+(0===s?0:s<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);let u=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),l.primitiveLength++),o?this.e2=u:this.e1=u,null!=h&&this.zOffsetVertexArray.emplaceBack(h.zOffset,h.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function hz(e,i,r){return e.x<i||e.x>r||e.y<i||e.y>r}function hD(e,i,r){return 8192/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ))*i}ab(hP,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let hR=(e,i,r)=>(1-r)*e+r*i;function hL(e,i){return 1/hD(e,1,i.tileZoom)}function hO(e,i,r,a){return e.translatePosMatrix(a||i.tileID.projMatrix,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let hk=e=>{let i=[];hF(e)&&i.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&i.push("RENDER_LINE_GRADIENT");let r=e.paint.get("line-trim-offset");0===r[0]&&0===r[1]||i.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&i.push("RENDER_LINE_BORDER");let a="none"===e.layout.get("line-join").constantOr("miter"),n=!!e.paint.get("line-pattern").constantOr(1);return a&&n&&i.push("LINE_JOIN_NONE"),i};function hF(e){let i=e.paint.get("line-dasharray").value;return i.value||"constant"!==i.kind}let hB=()=>E||(E={layout:S||(S=new a1({"line-cap":new aQ(a2.layout_line["line-cap"]),"line-join":new aQ(a2.layout_line["line-join"]),"line-miter-limit":new aJ(a2.layout_line["line-miter-limit"]),"line-round-limit":new aJ(a2.layout_line["line-round-limit"]),"line-sort-key":new aQ(a2.layout_line["line-sort-key"]),"line-z-offset":new aQ(a2.layout_line["line-z-offset"]),"line-elevation-reference":new aJ(a2.layout_line["line-elevation-reference"]),"line-cross-slope":new aJ(a2.layout_line["line-cross-slope"]),visibility:new aJ(a2.layout_line.visibility),"line-width-unit":new aJ(a2.layout_line["line-width-unit"])})),paint:M||(M=new a1({"line-opacity":new aQ(a2.paint_line["line-opacity"]),"line-color":new aQ(a2.paint_line["line-color"]),"line-translate":new aJ(a2.paint_line["line-translate"]),"line-translate-anchor":new aJ(a2.paint_line["line-translate-anchor"]),"line-width":new aQ(a2.paint_line["line-width"]),"line-gap-width":new aQ(a2.paint_line["line-gap-width"]),"line-offset":new aQ(a2.paint_line["line-offset"]),"line-blur"
7:new aQ(a2.paint_line["line-blur"]),"line-dasharray":new aQ(a2.paint_line["line-dasharray"]),"line-pattern":new aQ(a2.paint_line["line-pattern"]),"line-gradient":new a0(a2.paint_line["line-gradient"]),"line-trim-offset":new aJ(a2.paint_line["line-trim-offset"]),"line-trim-fade-range":new aJ(a2.paint_line["line-trim-fade-range"]),"line-trim-color":new aJ(a2.paint_line["line-trim-color"]),"line-emissive-strength":new aJ(a2.paint_line["line-emissive-strength"]),"line-border-width":new aQ(a2.paint_line["line-border-width"]),"line-border-color":new aQ(a2.paint_line["line-border-color"]),"line-occlusion-opacity":new aJ(a2.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))});class hN extends aQ{possiblyEvaluate(e,i){return i=new aG(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,r,a){return i=eZ({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,r,a)}}let hV=nc([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),hU=nc([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),hj=nc([{name:"a_projected_pos",components:4,type:"Float32"}],4);nc([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let hG=nc([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),hq=nc([{name:"a_texb",components:2,type:"Uint16"}]),hZ=nc([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),hH=nc([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);nc([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{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"}]);let h$=nc([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),hW=nc([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function hX(e,i,r,a,n){return"camera"===e.kind?e.maxSize:"composite"===e.kind?Math.max(i.possiblyEvaluate(new aG(e.maxZoom),r).evaluate(n,{},r),i.possiblyEvaluate(new aG(e.minZoom),r).evaluate(n,{},r)):i.possiblyEvaluate(new aG(a)).evaluate(n,{},r)}function hY(e,i){let{expression:r}=i;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new aG(e+1))};if("source"===r.kind)return{kind:"source"};{let{zoomStops:i,interpolationType:a}=r,n=0;for(;n<i.length&&i[n]<=e;)n++;let o=n=Math.max(0,n-1);for(;o<i.length&&i[o]<e+1;)o++;o=Math.min(i.length-1,o);let s=i[n],l=i[o];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:a}:{kind:"camera",minZoom:s,maxZoom:l,minSize:r.evaluate(new aG(s)),maxSize:r.evaluate(new aG(l)),interpolationType:a}}}function hK(e,{uSize:i,uSizeT:r},{lowerSize:a,upperSize:n}){return"source"===e.kind?a/128:"composite"===e.kind?t$(a/128,n/128,r):i}function hJ(e,i,r=1){let a=0,n=0;if("constant"===e.kind)n=e.layoutSize*r;else if("source"!==e.kind){let{interpolationType:o,minZoom:s,maxZoom:l}=e,h=o?eU(rR.interpolationFactor(o,i,s,l),0,1):0;"camera"===e.kind?n=t$(e.minSize,e.maxSize,h)*r:a=h*r}return{uSizeT:a,uSize:n}}nc([{name:"triangle",components:3,type:"Uint16"}]),nc([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),nc([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"}]),nc([{type:"Float32",name:"offsetX"}]),nc([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var hQ=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:128,evaluateSizeForFeature:hK,evaluateSizeForZoom:hJ,getRasterizedIconSize:hX,getSizeData:hY});let h0={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};var h1,h2,h3,h4={};function h5(){if(h3)return h2;h3=1,h2=i;var e=(h1||(h1=1,h4.read=function(e,i,r,a,n){var o,s,l=8*n-a-1,h=(1<<l)-1,u=h>>1,c=-7,d=r?n-1:0,p=r?-1:1,f=e[i+d];for(d+=p,o=f&(1<<-c)-1,f>>=-c,c+=l;c>0;o=256*o+e[i+d],d+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=a;c>0;s=256*s+e[i+d],d+=p,c-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,a),o-=u}return(f?-1:1)*s*Math.pow(2,o-a)},h4.write=function(e,i,r,a,n,o){var s,l,h,u=8*o-n-1,c=(1<<u)-1,d=c>>1,p=23===n?5960464477539062e-23:0,f=a?0:o-1,m=a?1:-1,_=i<0||0===i&&1/i<0?1:0;for(isNaN(i=Math.abs(i))||i===1/0?(l=isNaN(i)?1:0,s=c):(s=Math.floor(Math.log(i)/Math.LN2),i*(h=Math.pow(2,-s))<1&&(s--,h*=2),(i+=s+d>=1?p/h:p*Math.pow(2,1-d))*h>=2&&(s++,h/=2),s+d>=c?(l=0,s=c):s+d>=1?(l=(i*h-1)*Math.pow(2,n),s+=d):(l=i*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;e[r+f]=255&l,f+=m,l/=256,n-=8);for(s=s<<n|l,u+=n;u>0;e[r+f]=255&s,f+=m,s/=256,u-=8);e[r+f-m]|=128*_}),h4);function i(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var r="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function a(e){return e.type===i.Bytes?e.readVarint()+e.pos:e.pos+1}function n(e,i,r){var a=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.floor(Math.log(i)/(7*Math.LN2));r.realloc(a);for(var n=r.pos-1;n>=e;n--)r.buf[n+a]=r.buf[n]}function o(e,i){for(var r=0;r<e.length;r++)i.writeVarint(e[r])}function s(e,i){for(var r=0;r<e.length;r++)i.writeSVarint(e[r])}function l(e,i){for(var r=0;r<e.length;r++)i.writeFloat(e[r])}function h(e,i){for(var r=0;r<e.length;r++)i.writeDouble(e[r])}function u(e,i){for(var r=0;r<e.length;r++)i.writeBoolean(e[r])}function c(e,i){for(var r=0;r<e.length;r++)i.writeFixed32(e[r])}function d(e,i){for(var r=0;r<e.length;r++)i.writeSFixed32(e[r])}function p(e,i){for(var r=0;r<e.length;
7r++)i.writeFixed64(e[r])}function f(e,i){for(var r=0;r<e.length;r++)i.writeSFixed64(e[r])}function m(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16)+16777216*e[i+3]}function _(e,i,r){e[r]=i,e[r+1]=i>>>8,e[r+2]=i>>>16,e[r+3]=i>>>24}function g(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16)+(e[i+3]<<24)}return i.prototype={destroy:function(){this.buf=null},readFields:function(e,i,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),n=a>>3,o=this.pos;this.type=7&a,e(n,i,this),this.pos===o&&this.skip(a)}return i},readMessage:function(e,i){return this.readFields(e,i,this.readVarint()+this.pos)},readFixed32:function(){var e=m(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=m(this.buf,this.pos)+4294967296*m(this.buf,this.pos+4);return this.pos+=8,e},readSFixed64:function(){var e=m(this.buf,this.pos)+4294967296*g(this.buf,this.pos+4);return this.pos+=8,e},readFloat:function(){var i=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(e){var i,r,a=this.buf;return i=127&(r=a[this.pos++]),r<128?i:(i|=(127&(r=a[this.pos++]))<<7,r<128?i:(i|=(127&(r=a[this.pos++]))<<14,r<128?i:(i|=(127&(r=a[this.pos++]))<<21,r<128?i:function(e,i,r){var a,n,o,s=r.buf;if(n=(112&(o=s[r.pos++]))>>4,o<128||(n|=(127&(o=s[r.pos++]))<<3,o<128)||(n|=(127&(o=s[r.pos++]))<<10,o<128)||(n|=(127&(o=s[r.pos++]))<<17,o<128)||(n|=(127&(o=s[r.pos++]))<<24,o<128)||(n|=(1&(o=s[r.pos++]))<<31,o<128))return a=n,i?4294967296*a+(e>>>0):4294967296*(a>>>0)+(e>>>0);throw Error("Expected varint not more than 10 bytes")}(i|=(15&(r=a[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?-((e+1)/2):e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e,i=this.readVarint()+this.pos,a=this.pos;return this.pos=i,i-a>=12&&r?(e=this.buf,r.decode(e.subarray(a,i))):function(e,i,r){for(var a="",n=i;n<r;){var o,s,l,h=e[n],u=null,c=h>239?4:h>223?3:h>191?2:1;if(n+c>r)break;
71===c?h<128&&(u=h):2===c?128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)<=127&&(u=null):3===c?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((u=(15&h)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=e[n+2],l=e[n+3],128==(192&(o=e[n+1]))&&128==(192&s)&&128==(192&l)&&((u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&l)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,a+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),a+=String.fromCharCode(u),n+=c}return a}(this.buf,a,i)},readBytes:function(){var e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i},readPackedVarint:function(e,r){if(this.type!==i.Bytes)return e.push(this.readVarint(r));var n=a(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(r));return e},readPackedSVarint:function(e){if(this.type!==i.Bytes)return e.push(this.readSVarint());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==i.Bytes)return e.push(this.readBoolean());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==i.Bytes)return e.push(this.readFloat());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==i.Bytes)return e.push(this.readDouble());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed32());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed32());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed64());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed64());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSFixed64());return e},skip:function(e){var r=7&e;if(r===i.Varint)for(;this.buf[this.pos++]>127;);else if(r===i.Bytes)this.pos=this.readVarint()+this.pos;else if(r===i.Fixed32)this.pos+=4;else{if(r!==i.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(e,i){this.writeVarint(e<<3|i)},realloc:function(e){for(var i=this.length||16;i<this.pos+e;)i*=2;if(i!==this.length){var r=new Uint8Array(i);r.set(this.buf),this.buf=r,this.length=i}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),_(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),_(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),_(this.buf,-1&e,this.pos),_(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),_(this.buf,-1&e,this.pos),_(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,i){var r,a,n,o,s;if(e>=0?(r=e%4294967296|0,a=e/4294967296|0):(a=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");i.realloc(10),n=r,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,i.buf[i.pos]=127&(n>>>=7),s=(7&(o=a))<<4,i.buf[i.pos++]|=s|((o>>>=3)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o)))))}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?-(2*e)-1:2*e)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var i=this.pos;this.pos=function(e,i,r){for(var a,n,o=0;o<i.length;o++){if((a=i.charCodeAt(o))>55295&&a<57344){if(!n){a>
756319||o+1===i.length?(e[r++]=239,e[r++]=191,e[r++]=189):n=a;continue}if(a<56320){e[r++]=239,e[r++]=191,e[r++]=189,n=a;continue}a=n-55296<<10|a-56320|65536,n=null}else n&&(e[r++]=239,e[r++]=191,e[r++]=189,n=null);a<128?e[r++]=a:(a<2048?e[r++]=a>>6|192:(a<65536?e[r++]=a>>12|224:(e[r++]=a>>18|240,e[r++]=a>>12&63|128),e[r++]=a>>6&63|128),e[r++]=63&a|128)}return r}(this.buf,e,this.pos);var r=this.pos-i;r>=128&&n(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),e.write(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),e.write(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var i=e.length;this.writeVarint(i),this.realloc(i);for(var r=0;r<i;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,i){this.pos++;var r=this.pos;e(i,this);var a=this.pos-r;a>=128&&n(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(e,r,a){this.writeTag(e,i.Bytes),this.writeRawMessage(r,a)},writePackedVarint:function(e,i){i.length&&this.writeMessage(e,o,i)},writePackedSVarint:function(e,i){i.length&&this.writeMessage(e,s,i)},writePackedBoolean:function(e,i){i.length&&this.writeMessage(e,u,i)},writePackedFloat:function(e,i){i.length&&this.writeMessage(e,l,i)},writePackedDouble:function(e,i){i.length&&this.writeMessage(e,h,i)},writePackedFixed32:function(e,i){i.length&&this.writeMessage(e,c,i)},writePackedSFixed32:function(e,i){i.length&&this.writeMessage(e,d,i)},writePackedFixed64:function(e,i){i.length&&this.writeMessage(e,p,i)},writePackedSFixed64:function(e,i){i.length&&this.writeMessage(e,f,i)},writeBytesField:function(e,r){this.writeTag(e,i.Bytes),this.writeBytes(r)},writeFixed32Field:function(e,r){this.writeTag(e,i.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(e,r){this.writeTag(e,i.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(e,r){this.writeTag(e,i.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(e,r){this.writeTag(e,i.Fixed64),this.writeSFixed64(r)},writeVarintField:function(e,r){this.writeTag(e,i.Varint),this.writeVarint(r)},writeSVarintField:function(e,r){this.writeTag(e,i.Varint),this.writeSVarint(r)},writeStringField:function(e,r){this.writeTag(e,i.Bytes),this.writeString(r)},writeFloatField:function(e,r){this.writeTag(e,i.Fixed32),this.writeFloat(r)},writeDoubleField:function(e,r){this.writeTag(e,i.Fixed64),this.writeDouble(r)},writeBooleanField:function(e,i){this.writeVarintField(e,!!i)}},h2}var h6=K(h5());function h8(e,i,r){i.glyphs=[],1===e&&r.readMessage(h9,i)}function h9(e,i,r){if(3===e){let{id:e,bitmap:a,width:n,height:o,left:s,top:l,advance:h}=r.readMessage(h7,{});i.glyphs.push({id:e,bitmap:new s3({width:n+6,height:o+6},a),metrics:{width:n,height:o,left:s,top:l,advance:h}})}else 4===e?i.ascender=r.readSVarint():5===e&&(i.descender=r.readSVarint())}function h7(e,i,r){1===e?i.id=r.readVarint():2===e?i.bitmap=r.readBytes():3===e?i.width=r.readVarint():4===e?i.height=r.readVarint():5===e?i.left=r.readSVarint():6===e?i.top=r.readSVarint():7===e&&(i.advance=r.readVarint())}let ue={horizontal:1,vertical:2,horizontalOnly:3};class ut{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){let r=new ut;return r.scale=e||1,r.fontStack=i,r}static forImage(e){let i=new ut;return i.image=e,i}}class ui{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){let r=new ui;for(let a=0;a<e.sections.length;a++){let n=e.sections[a];n.image?r.addImageSection(n):r.addTextSection(n,i)}return r}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,i){let r="";for(let a=0;a<e.length;a++){let n=e.charCodeAt(a+1)||null,o=e.charCodeAt(a-1)||null;r+=!i&&(n&&aC(n)&&!h0[e[a+1]]||o&&aC(o)&&!h0[e[a-1]])||!h0[e[a]]?e[a]:h0[e[a]]}return r}(this.text,e)}trim(){let e=0;for(let i=0;i<this.text.length&&ua[this.text.charCodeAt(i)];i++)e++;let i=this.text.length;for(let r=this.text.length-1;r>=0&&r>=e&&ua[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){let r=new ui;return r.text=this.text.substring(e,i),r.sectionIndex=this.sectionIndex.slice(e,i),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(ut.forText(e.scale,e.fontStack||i));let r=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(r)}addImageSection(e){let i=e.image&&e.image.namePrimary?e.image.getPrimary():null;if(!i)return void e1("Can't add FormattedSection with an empty image.");let r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCodePoint(r),this.sections.push(ut.forImage(i)),this.sectionIndex.push(this.sections.length-1)):e1("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ur(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m){let _=ui.fromFeature(e,n);d===ue.vertical&&_.verticalizePunctuation(p);let g=[],y=function(e,i,r,a,n,o){if(!e)return[];let s=[],l=function(e,i,r,a,n,o){let s=0;for(let r=0;r<e.length();r++){let l=e.getSection(r);s+=uo(e.getCodePoint(r),l,a,n,i,o)}return s/Math.max(1,Math.ceil(s/r))}(e,i,r,a,n,o),h=e.text.indexOf("​")>=0,u=0;for(let r=0;r<e.length();r++){let c=e.getSection(r),d=e.getCodePoint(r);if(ua[d]||(u+=uo(d,c,a,n,i,o)),r<e.length()-1){let i=!(d<11904||!(aE["Bopomofo Extended"](d)||aE.Bopomofo(d)||aE["CJK Compatibility Forms"](d)||aE["CJK Compatibility Ideographs"](d)||aE["CJK Compatibility"](d)||aE["CJK Radicals Supplement"](d)||aE["CJK Strokes"](d)||aE["CJK Symbols and Punctuation"](d)||aE["CJK Unified Ideographs Extension A"](d)||aE["CJK Unified Ideographs"](d)||aE["Enclosed CJK Letters and Months"](d)||aE["Halfwidth and Fullwidth Forms"](d)||aE.Hiragana(d)||aE["Ideographic Description Characters"](d)||aE["Kangxi Radicals"](d)||aE["Katakana Phonet
7ic Extensions"](d)||aE.Katakana(d)||aE["Vertical Forms"](d)||aE["Yi Radicals"](d)||aE["Yi Syllables"](d)));(un[d]||i||c.image)&&s.push(ul(r+1,u,l,s,function(e,i,r){let a=0;return 10===e&&(a-=1e4),r&&(a+=150),40!==e&&65288!==e||(a+=50),41!==i&&65289!==i||(a+=50),a}(d,e.getCodePoint(r+1),i&&h),!1))}}return function e(i){return i?e(i.priorBreak).concat(i.index):[]}(ul(e.length(),u,l,s,0,!0))}(_,u,o,i,a,f),{processBidirectionalText:x,processStyledBidirectionalText:v}=aj;if(x&&1===_.sections.length)for(let e of x(_.toString(),y)){let i=new ui;i.text=e,i.sections=_.sections;for(let r=0;r<e.length;r++)i.sectionIndex.push(0);g.push(i)}else if(v)for(let e of v(_.text,_.sectionIndex,y)){let i=new ui;i.text=e[0],i.sectionIndex=e[1],i.sections=_.sections,g.push(i)}else g=function(e,i){let r=[],a=e.text,n=0;for(let a of i)r.push(e.substring(n,a)),n=a;return n<a.length&&r.push(e.substring(n,a.length)),r}(_,y);let b=[],w={positionedLines:b,text:_.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:d,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,i,r,a,n,o,s,l,h,u,c,d){let p=0,f=0,m=0,_="right"===l?1:"left"===l?0:.5,g=!1;for(let e of n){for(let r of e.getSections()){if(r.image)continue;let e=i[r.fontStack];if(e&&!(g=void 0!==e.ascender&&void 0!==e.descender))break}if(!g)break}let y=0;for(let s of n){s.trim();let n=s.getMaxScale(),l=(n-1)*24,x={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=x;let v=x.positionedGlyphs,b=0;if(!s.length()){f+=o,++y;continue}let w=0,T=0;for(let o=0;o<s.length();o++){let l=s.getSection(o),m=s.getSectionIndex(o),_=s.getCodePoint(o),y=l.scale,x=null,S=null,M=null,E=24,A=0,I=!(h===ue.horizontal||!c&&!aI(_)||c&&(ua[_]||aE.Arabic(_)||aE["Arabic Supplement"](_)||aE["Arabic Extended-A"](_)||aE["Arabic Presentation Forms-A"](_)||aE["Arabic Presentation Forms-B"](_)));if(l.image){let i=a[l.image.serialize()];if(!i)continue;M=l.image.id,e.iconsInText=e.iconsInText||!0,S=i.paddedRect;let r=i.displaySize;y=24*y/d,x={width:r[0],height:r[1],left:0,top:-3,advance:I?r[1]:r[0],localGlyph:!1},A=g?-x.height*y:24*n-17-r[1]*y,E=x.advance;let o=(I?r[0]:r[1])*y-24*n;o>0&&o>b&&(b=o)}else{let e=r[l.fontStack];if(!e)continue;e[_]&&(S=e[_]);let a=i[l.fontStack];if(!a)continue;let o=a.glyphs[_];if(!o)continue;if(x=o.metrics,E=8203!==_?24:0,g){let e=void 0!==a.ascender?Math.abs(a.ascender):0,i=void 0!==a.descender?Math.abs(a.descender):0,r=(e+i)*y;w<r&&(w=r,T=(e-i)/2*y),A=-e*y}else A=(n-y)*24-17}I?(e.verticalizable=!0,v.push({glyph:_,imageName:M,x:p,y:f+A,vertical:I,scale:y,localGlyph:x.localGlyph,fontStack:l.fontStack,sectionIndex:m,metrics:x,rect:S}),p+=E*y+u):(v.push({glyph:_,imageName:M,x:p,y:f+A,vertical:I,scale:y,localGlyph:x.localGlyph,fontStack:l.fontStack,sectionIndex:m,metrics:x,rect:S}),p+=x.advance*y+u)}0!==v.length&&(m=Math.max(p-u,m),g?uu(v,_,b,T,o*n/2):uu(v,_,b,0,o/2)),p=0;let S=o*n+b;x.lineOffset=Math.max(b,l),f+=S,++y}let x=f,{horizontalAlign:v,verticalAlign:b}=uh(s);(function(e,i,r,a,n,o){let s=(i-r)*n,l=-o*a;for(let i of e)for(let e of i.positionedGlyphs)e.x+=s,e.y+=l})(e.positionedLines,_,v,b,m,x),e.top+=-b*x,e.bottom=e.top+x,e.left+=-v*m,e.right=e.left+m,e.hasBaseline=g}(w,i,r,a,g,s,l,h,d,u,p,m),!function(e){for(let i of e)if(0!==i.positionedGlyphs.length)return!1;return!0}(b)&&w}let ua={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},un={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 uo(e,i,r,a,n,o){if(i.image){let e=a[i.image.serialize()];return e?e.displaySize[0]*i.scale*24/o+n:0}{let a=r[i.fontStack],o=a&&a.glyphs[e];return o?o.metrics.advance*i.scale+n:0}}function us(e,i,r,a){let n=Math.pow(e-i,2);return a?e<i?n/2:2*n:n+Math.abs(r)*r}function ul(e,i,r,a,n,o){let s=null,l=us(i,r,n,o);for(let e of a){let a=us(i-e.x,r,n,o)+e.badness;a<=l&&(s=e,l=a)}return{index:e,x:i,priorBreak:s,badness:l}}function uh(e){let i=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":i=1;break;case"left":case"top-left":case"bottom-left":i=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:i,verticalAlign:r}}function uu(e,i,r,a,n){if(!(i||r||a||n))return;let o=e.length-1,s=e[o],l=(s.x+s.metrics.advance*s.scale)*i;for(let i=0;i<=o;i++)e[i].x-=l,e[i].y+=r+a+n}function uc(e,i,r,a,n,o){let s,l,h,u,c;let d=e.imagePrimary;if(d.content){let e=d.content,i=d.pixelRatio||1;s=[e[0]/i,e[1]/i,d.displaySize[0]-e[2]/i,d.displaySize[1]-e[3]/i]}let p=i.left*o,f=i.right*o;"width"===r||"both"===r?(c=n[0]+p-a[3],h=n[0]+f+a[1]):h=(c=n[0]+(p+f-d.displaySize[0])/2)+d.displaySize[0];let m=i.top*o,_=i.bottom*o;return"height"===r||"both"===r?(l=n[1]+m-a[0],u=n[1]+_+a[2]):u=(l=n[1]+(m+_-d.displaySize[1])/2)+d.displaySize[1],{imagePrimary:d,imageSecondary:void 0,top:l,right:h,bottom:u,left:c,collisionPadding:s}}class ud extends eR{constructor(e,i,r,a,n){super(e,i),this.angle=a,this.z=r,void 0!==n&&(this.segment=n)}clone(){return new ud(this.x,this.y,this.z,this.angle,this.segment)}}function up(e,i,r,a,n){if(void 0===i.segment)return!0;let o=i,s=i.segment+1,l=0;for(;l>-r/2;){if(--s<0)return!1;l-=e[s].dist(o),o=e[s]}l+=e[s].dist(e[s+1]),s++;let h=[],u=0;for(;l<r/2;){let i=e[s],r=e[s+1];if(!r)return!1;let o=e[s-1].angleTo(i)-i.angleTo(r);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:l,angleDelta:o}),u+=o;l-h[0].distance>a;)u-=h.shift().angleDelta;if(u>n)return!1;s++,l+=i.dist(r)}return!0}function uf(e){let i=0;for(let r=0;r<e.length-1;r++)i+=e[r].dist(e[r+1]);return i}function um(e,i){return Math.max(e?e.right-e.left:0,i?i.right-i.left:0)}function u_(e,i,r,a,n){let o=[];for(let s=0;s<e.length;s++){let l;let h=e[s];for(let e=0;e<h.length-1;e++){let s=h[e],u=h[e+1];s.x<i&&u.x<i||(s.x<i?s=new eR(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<i&&(u=new eR(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<r&&u.y<r||(s.y<r?s=new eR(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round():u.y<r&&(u=new eR(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round()),s.x>=a&&u.x>=a||(s.x>=a?s=new eR(a,s.y+(a-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=a&&(u=new eR(a,s.y+(a-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=n&&u.y>=n||(s.y>=n?s=new eR(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round():u.y>=n&&(u=new eR(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(u)))))}}return o}function ug(e){let i=0,r=0;for(let a of e)i+=a.w*a.h,r=Math.max(r,a.w);e.sort((e,i)=>i.h-e.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],n=0,o=0;for(let i of e)for(let e=a.length-1;e>=0;e--){let r=a[e];if(!(i.w>r.w||i.h>
7r.h)){if(i.x=r.x,i.y=r.y,o=Math.max(o,i.y+i.h),n=Math.max(n,i.x+i.w),i.w===r.w&&i.h===r.h){let i=a.pop();e<a.length&&(a[e]=i)}else i.h===r.h?(r.x+=i.w,r.w-=i.w):(i.w===r.w||a.push({x:r.x+i.w,y:r.y,w:r.w-i.w,h:i.h}),r.y+=i.h,r.h-=i.h);break}}return{w:n,h:o,fill:i/(n*o)||0}}ab(ud,"Anchor");class uy{constructor(e,{pixelRatio:i,version:r,stretchX:a,stretchY:n,content:o},s){this.paddedRect=e,this.pixelRatio=i,this.stretchX=a,this.stretchY=n,this.content=o,this.version=r,this.padding=s}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class ux{constructor(e,i,r){let a={},n={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,a,1,o),this.addImages(i,n,2,o);let{w:s,h:l}=ug(o),h=new s4({width:s||1,height:l||1});for(let i in e){let n=e[i],o=a[i].paddedRect;s4.copy(n.data,h,{x:0,y:0},{x:o.x+1,y:o.y+1},n.data,r,n.sdf)}for(let e in i){let a=i[e],o=n[e].paddedRect,s=n[e].padding,l=o.x+s,u=o.y+s,c=a.data.width,d=a.data.height;s=s>1?s-1:s,s4.copy(a.data,h,{x:0,y:0},{x:l,y:u},a.data,r),s4.copy(a.data,h,{x:0,y:d-s},{x:l,y:u-s},{width:c,height:s},r),s4.copy(a.data,h,{x:0,y:0},{x:l,y:u+d},{width:c,height:s},r),s4.copy(a.data,h,{x:c-s,y:0},{x:l-s,y:u},{width:s,height:d},r),s4.copy(a.data,h,{x:0,y:0},{x:l+c,y:u},{width:s,height:d},r),s4.copy(a.data,h,{x:c-s,y:d-s},{x:l-s,y:u-s},{width:s,height:s},r),s4.copy(a.data,h,{x:0,y:d-s},{x:l+c,y:u-s},{width:s,height:s},r),s4.copy(a.data,h,{x:0,y:0},{x:l+c,y:u+d},{width:s,height:s},r),s4.copy(a.data,h,{x:c-s,y:0},{x:l-s,y:u+d},{width:s,height:s},r)}this.image=h,this.iconPositions=a,this.patternPositions=n}addImages(e,i,r,a){for(let n in e){let o=e[n],s={x:0,y:0,w:o.data.width+2*r,h:o.data.height+2*r};a.push(s),i[n]=new uy(s,o,r),o.hasRenderCallback&&this.haveRenderCallbacks.push(ih.deserializeId(n))}}patchUpdatedImages(e,i,r){for(let a in this.haveRenderCallbacks=this.haveRenderCallbacks.filter(i=>e.hasImage(i,r)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r),e.getUpdatedImages(r)){for(let n of Object.keys(this.iconPositions))ih.deserializeId(n)===a&&this.patchUpdatedImage(this.iconPositions[n],e.getImage(a,r),i);for(let n of Object.keys(this.patternPositions))ih.deserializeId(n)===a&&this.patchUpdatedImage(this.patternPositions[n],e.getImage(a,r),i)}}patchUpdatedImage(e,i,r){if(!e||!i||e.version===i.version)return;e.version=i.version;let[a,n]=e.tl;r.update(i.data,{position:{x:a,y:n}})}}function uv(e,i,r,a,n,o,s,l,h){for(let u=i;u<i+a;u++)ub(e,r*o+u,o,n,s,l,h);for(let u=r;u<r+n;u++)ub(e,u*o+i,1,a,s,l,h)}function ub(e,i,r,a,n,o,s){o[0]=0,s[0]=-1e20,s[1]=1e20,n[0]=e[i];for(let l=1,h=0,u=0;l<a;l++){n[l]=e[i+l*r];let a=l*l;do{let e=o[h];u=(n[l]-n[e]+a-e*e)/(l-e)/2}while(u<=s[h]&&--h>-1);o[++h]=l,s[h]=u,s[h+1]=1e20}for(let l=0,h=0;l<a;l++){for(;s[h+1]<l;)h++;let a=o[h],u=l-a;e[i+l*r]=n[a]+u*u}}ab(uy,"ImagePosition"),ab(ux,"ImageAtlas");let uw={none:0,ideographs:1,all:2};class uT{constructor(e,i,r){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=r,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,r){let a=[],n=this.urls[i]||ti.GLYPHS_URL;for(let i in e)for(let r of e[i])a.push({stack:i,id:r});eq(a,({stack:e,id:i},r)=>{let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=a.glyphs[i];if(void 0!==o)return void r(null,{stack:e,id:i,glyph:o});if(o=this._tinySDF(a,e,i))return a.glyphs[i]=o,void r(null,{stack:e,id:i,glyph:o});let s=Math.floor(i/256);if(256*s>65535)return e1("glyphs > 65535 not supported"),void r(null,{stack:e,id:i,glyph:o});if(a.ranges[s])return void r(null,{stack:e,id:i,glyph:o});let l=a.requests[s];l||(l=a.requests[s]=[],uT.loadGlyphRange(e,s,n,this.requestManager,(e,i)=>{if(i){for(let e in a.ascender=i.ascender,a.descender=i.descender,i.glyphs)this._doesCharSupportLocalGlyph(+e)||(a.glyphs[+e]=i.glyphs[+e]);a.ranges[s]=!0}for(let r of l)r(e,i);delete a.requests[s]})),l.push((a,n)=>{a?r(a):n&&r(null,{stack:e,id:i,glyph:n.glyphs[i]||null})})},(e,i)=>{if(e)r(e);else if(i){let e={};for(let{stack:r,id:a,glyph:n}of i)void 0===e[r]&&(e[r]={}),void 0===e[r].glyphs&&(e[r].glyphs={}),e[r].glyphs[a]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[r].ascender=this.entries[r].ascender,e[r].descender=this.entries[r].descender;r(null,e)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==uw.none&&(this.localGlyphMode===uw.all?!!this.localFontFamily:!!this.localFontFamily&&
7(aE["CJK Unified Ideographs"](e)||aE["Hangul Syllables"](e)||aE.Hiragana(e)||aE.Katakana(e)||aE["CJK Symbols and Punctuation"](e)||aE["CJK Unified Ideographs Extension A"](e)||aE["CJK Unified Ideographs Extension B"](e)||aE.Osage(e)))}_tinySDF(e,i,r){let a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(r))return;let n=e.tinySDF;if(!n){let r="400";/bold/i.test(i)?r="900":/medium/i.test(i)?r="500":/light/i.test(i)&&(r="200"),(n=e.tinySDF=new uT.TinySDF({fontFamily:a,fontWeight:r,fontSize:48,buffer:6,radius:16})).fontWeight=r}if(this.localGlyphs[n.fontWeight][r])return this.localGlyphs[n.fontWeight][r];let o=String.fromCodePoint(r),{data:s,width:l,height:h,glyphWidth:u,glyphHeight:c,glyphLeft:d,glyphTop:p,glyphAdvance:f}=n.draw(o);return this.localGlyphs[n.fontWeight][r]={id:r,bitmap:new s3({width:l,height:h},s),metrics:{width:u/2,height:c/2,left:d/2,top:p/2-27,advance:f/2,localGlyph:!0}}}}function uS(e,i){return e+i[1]-i[0]}function uM(e,i,r,a,n=1){let o=[],s=e.imagePrimary,l=s.pixelRatio,h=s.paddedRect.w-2,u=s.paddedRect.h-2,c=(e.right-e.left)*n,d=(e.bottom-e.top)*n,p=s.stretchX||[[0,h]],f=s.stretchY||[[0,u]],m=p.reduce(uS,0),_=f.reduce(uS,0),g=h-m,y=u-_,x=0,v=m,b=0,w=_,T=0,S=g,M=0,E=y;if(s.content&&a){let e=s.content;x=uE(p,0,e[0]),b=uE(f,0,e[1]),v=uE(p,e[0],e[2]),w=uE(f,e[1],e[3]),T=e[0]-x,M=e[1]-b,S=e[2]-e[0]-v,E=e[3]-e[1]-w}let A=(a,o,h,u)=>{var p,f,g,y;let A=(a.stretch-x)/v*c+e.left*n,I=(p=a.fixed-T,p-S*a.stretch/m),C=(o.stretch-b)/w*d+e.top*n,P=(f=o.fixed-M,f-E*o.stretch/_),z=(h.stretch-x)/v*c+e.left*n,D=(g=h.fixed-T,g-S*h.stretch/m),R=(u.stretch-b)/w*d+e.top*n,L=(y=u.fixed-M,y-E*u.stretch/_),O=new eR(A,C),k=new eR(z,C),F=new eR(z,R),B=new eR(A,R),N=new eR(I/l,P/l),V=new eR(D/l,L/l),U=i*Math.PI/180;if(U){let e=Math.sin(U),i=Math.cos(U),r=[i,-e,e,i];O._matMult(r),k._matMult(r),B._matMult(r),F._matMult(r)}let j=a.stretch+a.fixed,G=h.stretch+h.fixed,q=o.stretch+o.fixed,Z=u.stretch+u.fixed,H=e.imageSecondary;return{tl:O,tr:k,bl:B,br:F,texPrimary:{x:s.paddedRect.x+1+j,y:s.paddedRect.y+1+q,w:G-j,h:Z-q},texSecondary:H?{x:H.paddedRect.x+1+j,y:H.paddedRect.y+1+q,w:G-j,h:Z-q}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:N,pixelOffsetBR:V,minFontScaleX:S/l/c,minFontScaleY:E/l/d,isSDF:r}};if(a&&(s.stretchX||s.stretchY)){let e=uA(p,g,m),i=uA(f,y,_);for(let r=0;r<e.length-1;r++){let a=e[r],n=e[r+1];for(let e=0;e<i.length-1;e++)o.push(A(a,i[e],n,i[e+1]))}}else o.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:h+1},{fixed:0,stretch:u+1}));return o}function uE(e,i,r){let a=0;for(let n of e)a+=Math.max(i,Math.min(r,n[1]))-Math.max(i,Math.min(r,n[0]));return a}function uA(e,i,r){let a=[{fixed:-1,stretch:0}];for(let[i,r]of e){let e=a[a.length-1];a.push({fixed:i-e.stretch,stretch:e.stretch}),a.push({fixed:i-e.stretch,stretch:e.stretch+(r-i)})}return a.push({fixed:i+1,stretch:r}),a}function uI(e,i){return i.max-e.max}uT.loadGlyphRange=function(e,i,r,a,n){let o=256*i;tA(a.transformRequest(a.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",`${o}-${o+255}`),tT.Glyphs),(e,i)=>{if(e)n(e);else if(i){let e={},r=new h6(i).readFields(h8,{});for(let i of r.glyphs)e[i.id]=i;n(null,{glyphs:e,ascender:r.ascender,descender:r.descender})}})},uT.TinySDF=class{constructor({fontSize:e=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=i,this.cutoff=a,this.radius=r;let l=this.size=e+4*i,h=this._createCanvas(l),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${o} ${e}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let i=document.createElement("canvas");return i.width=i.height=e,i}draw(e){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(r),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))
7),h=Math.min(this.size-this.buffer,s+Math.ceil(a)),u=l+2*this.buffer,c=h+2*this.buffer,d=Math.max(u*c,0),p=new Uint8ClampedArray(d),f={data:p,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:s,glyphLeft:0,glyphAdvance:i};if(0===l||0===h)return f;let{ctx:m,buffer:_,gridInner:g,gridOuter:y}=this;m.clearRect(_,_,l,h),m.fillText(e,_,_+s);let x=m.getImageData(_,_,l,h);y.fill(1e20,0,d),g.fill(0,0,d);for(let e=0;e<h;e++)for(let i=0;i<l;i++){let r=x.data[4*(e*l+i)+3]/255;if(0===r)continue;let a=(e+_)*u+i+_;if(1===r)y[a]=0,g[a]=1e20;else{let e=.5-r;y[a]=e>0?e*e:0,g[a]=e<0?e*e:0}}uv(y,0,0,u,c,u,this.f,this.v,this.z),uv(g,_,_,l,h,u,this.f,this.v,this.z);for(let e=0;e<d;e++){let i=Math.sqrt(y[e])-Math.sqrt(g[e]);p[e]=Math.round(255-255*(i/this.radius+this.cutoff))}return f}};class uC{constructor(e,i,r,a){this.p=new eR(e,i),this.h=r,this.d=function(e,i){let r=!1,a=1/0;for(let n=0;n<i.length;n++){let o=i[n];for(let i=0,n=o.length,s=n-1;i<n;s=i++){let n=o[i],l=o[s];n.y>e.y!=l.y>e.y&&e.x<(l.x-n.x)*(e.y-n.y)/(l.y-n.y)+n.x&&(r=!r),a=Math.min(a,o3(e,n,l))}}return(r?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}let uP=Number.POSITIVE_INFINITY,uz=Math.sqrt(2);function uD(e,[i,r]){let a=0,n=0;if(r===uP){i<0&&(i=0);let r=i/uz;switch(e){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-i;break;case"top":n=i-7}switch(e){case"top-right":case"bottom-right":a=-r;break;case"top-left":case"bottom-left":a=r;break;case"left":a=i;break;case"right":a=-i}}else{switch(i=Math.abs(i),r=Math.abs(r),e){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(e){case"top-right":case"bottom-right":case"right":a=-i;break;case"top-left":case"bottom-left":case"left":a=i}}return[a,n]}function uR(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function uL(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=function(e,i,r,a,n,o,s,l){let h=[];if(0===i.positionedLines.length)return h;let u=a.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,c=function(e){let i=e[0],r=e[1],a=i*r;return a>0?[i,-r]:a<0?[-i,r]:0===i?[r,i]:[r,-i]}(r),d=Math.abs(i.top-i.bottom);for(let e of i.positionedLines)d-=e.lineOffset;let p=i.positionedLines.length,f=d/p,m=i.top-r[1];for(let e=0;e<p;++e){let a=i.positionedLines[e];for(let o of(m=function(e,i,r,a){let n=i+e.positionedLines[a].lineOffset;return 0===a?r+n/2:r+(n+(i+e.positionedLines[a-1].lineOffset))/2}(i,f,m,e),a.positionedGlyphs)){let e,a,d,p;if(!o.rect)continue;let f=o.rect||{},_=4,g=!0,y=1,x=0;if(o.imageName){let e=s[iu.build(o.imageName).getSerializedPrimary()];if(!e)continue;if(e.sdf){e1("SDF images are not supported in formatted text and will be ignored.");continue}g=!1,_=1/(y=e.pixelRatio)}let v=(n||l)&&o.vertical,b=o.metrics.advance*o.scale/2,w=o.metrics,T=o.rect;if(null===T)continue;l&&i.verticalizable&&(x=o.imageName?b-o.metrics.width*o.scale/2:0);let S=n?[o.x+b,o.y]:[0,0],M=[0,0],E=[0,0],A=!1;n||(v?(E=[o.x+b+c[0],o.y+c[1]-x],A=!0):M=[o.x+b+r[0],o.y+r[1]-x]);let I=T.w*o.scale/(y*(o.localGlyph?2:1)),C=T.h*o.scale/(y*(o.localGlyph?2:1));if(v){let i=o.y-m,r=new eR(-b,b-i),n=-Math.PI/2,s=new eR(...E);(e=new eR(-b+M[0],M[1]))._rotateAround(n,r)._add(s),e.x+=-i+b,e.y-=(w.left-_)*o.scale;let l=o.imageName?w.advance*o.scale:24*o.scale,h=String.fromCodePoint(o.glyph);"︶"===h||"﹈"===h||"︸"===h||"﹄"===h||"﹂"===h||"︾"===h||"︼"===h||"︺"===h||"︘"===h||"﹀"===h||"︐"===h||"︓"===h||"︔"===h||"`"===h||" ̄"===h||"︑"===h||"︒"===h?e.x+=(1-_)*o.scale:"︵"===h||"﹇"===h||"︷"===h||"﹃"===h||"﹁"===h||"︽"===h||"︻"===h||"︹"===h||"︗"===h||"︿"===h?e.x+=l-w.height*o.scale+(-_-1)*o.scale:e.x+=o.imageName||w.width+2*_===T.w&&w.height+2*_===T.h?(l-C)/2:(l-(w.height+2*_)*o.scale)/2,a=new eR(e.x,e.y-I),d=new eR(e.x+C,e.y),p=new eR(e.x+C,e.y-I)}else{let i=(w.left-_)*o.scale-b+M[0],r=(-w.top-_)*o.scale+M[1],n=i+I,s=r+C;e=new eR(i,r),a=new eR(n,r),d=new eR(i,s),p=new eR(n,s)}if(u){let i;i=n?new eR(0,0):A?new eR(c[0],c[1]):new eR(r[0],r[1]),e._rotateAroun
7d(u,i),a._rotateAround(u,i),d._rotateAround(u,i),p._rotateAround(u,i)}let P=new eR(0,0),z=new eR(0,0);h.push({tl:e,tr:a,bl:d,br:p,texPrimary:f,texSecondary:void 0,writingMode:i.writingMode,glyphOffset:S,sectionIndex:o.sectionIndex,isSDF:g,pixelOffsetTL:P,pixelOffsetBR:z,minFontScaleX:0,minFontScaleY:0})}}return h}(0,a,h,o,s,l,n,e.allowVerticalPlacement),v=e.textSizeData,b=null;for(let a of("source"===v.kind?(b=[128*o.layout.get("text-size").evaluate(l,{},g)*m.textScaleFactor])[0]>32640&&e1(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===v.kind&&((b=[128*m.compositeTextSizes[0].evaluate(l,{},g)*m.textScaleFactor,128*m.compositeTextSizes[1].evaluate(l,{},g)*m.textScaleFactor])[0]>32640||b[1]>32640)&&e1(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),e.addSymbols(e.text,x,b,h,s,l,c,i,r,u.lineStartIndex,u.lineLength,f,_,g,y,!1),d))p[a]=e.text.placedSymbolArray.length-1;return 4*x.length}function uO(e){for(let i in e)return e[i];return null}function uk(e,i,r,a,n,o,s,l,h,u,c=1){let d=s.top/c,p=s.bottom/c,f=s.left/c,m=s.right/c,_=s.collisionPadding;if(_&&(f-=_[0],d-=_[1],m+=_[2],p+=_[3]),h){let e=new eR(f,d),i=new eR(m,d),r=new eR(f,p),a=new eR(m,p),n=h*eO,o=new eR(0,0);u&&(o=new eR(u[0],u[1])),e._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),a._rotateAround(n,o),f=Math.min(e.x,i.x,r.x,a.x),m=Math.max(e.x,i.x,r.x,a.x),d=Math.min(e.y,i.y,r.y,a.y),p=Math.max(e.y,i.y,r.y,a.y)}return e.emplaceBack(i.x,i.y,i.z,r.x,r.y,f,d,m,p,l,a,n,o),e.length-1}function uF(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);let i=e.bottom-e.top;return i>0?Math.max(10,i):null}function uB(e,i){let r=e.fovAboveCenter,a=e.elevation?e.elevation.getMinElevationBelowMSL()*i:0,n=(e._camera.position[2]*e.worldSize-a)/Math.cos(e._pitch),o=Math.sin(r)*n/Math.sin(Math.max(Math.PI/2-e._pitch-r,.01)),s=Math.sin(e._pitch)*o+n,l=1/e._horizonShift*n;return e.elevation&&0!==e.elevation.exaggeration()||(s*=1+Math.max(e.zoom-17,0)),Math.min(1.01*s,l)}function uN(e,i){if(!i.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:i};let r=Math.pow(2,-e.z),a=e.x*r,n=(e.x+1)*r,o=e.y*r,s=(e.y+1)*r,l=oN(a),h=oN(n),u=oV(o),c=oV(s),d=i.project(l,u),p=i.project(h,u),f=i.project(h,c),m=i.project(l,c),_=Math.min(d.x,p.x,f.x,m.x),g=Math.min(d.y,p.y,f.y,m.y),y=Math.max(d.x,p.x,f.x,m.x),x=Math.max(d.y,p.y,f.y,m.y),v=r/16;function b(e,r,a,n,o,s){let l=(a+o)/2,h=(n+s)/2,u=i.project(oN(l),oV(h)),c=Math.max(0,_-u.x,g-u.y,u.x-y,u.y-x);_=Math.min(_,u.x),y=Math.max(y,u.x),g=Math.min(g,u.y),x=Math.max(x,u.y),c>v&&(b(e,u,a,n,l,h),b(u,r,l,h,o,s))}b(d,p,a,o,n,o),b(p,f,n,o,n,s),b(f,m,n,s,a,s),b(m,d,a,s,a,o),_-=v,g-=v,y+=v,x+=v;let w=1/Math.max(y-_,x-g);return{scale:w,x:_*w,y:g*w,x2:y*w,y2:x*w,projection:i}}function uV(e,{x:i,y:r},a=0){return new eR(((i-a)*e.scale-e.x)*8192,(r*e.scale-e.y)*8192)}let uU=eP.mat4.identity(new Float32Array(16));class uj{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new oL(0,0)}projectTilePoint(e,i,r){return{x:e,y:i,z:0}}locationPoint(e,i,r=!0){return e._coordinatePoint(e.locationCoordinate(i),r)}pixelsPerMeter(e,i){return 1/ok(e)*i}pixelSpaceConversion(e,i,r){return 1}farthestPixelDistance(e){return uB(e,e.pixelsPerMeter)}pointCoordinate(e,i,r,a){let n=new eR(i,Math.max(e.horizonLineFromTop(!1),r));return e.rayIntersectionCoordinate(e.pointRayIntersection(n,a))}pointCoordinate3D(e,i,r){let a=new eR(i,r);if(e.elevation)return e.elevation.pointCoordinate(a);{let i=this.pointCoordinate(e,a.x,a.y,0);return[i.x,i.y,i.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);let r=e.horizonLineFromTop();return i.y<r}createInversionMatrix(e,i){return uU}createTileMatrix(e,i,r){let a,n,o;let s=r.canonical,l=eP.mat4.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){let h=uN(s,this);a=1,n=h.x+r.wrap*h.scale,o=h.y,eP.mat4.scale(l,l,[a/h.scale,a/h.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*r.wrap)*a,o=s.y*a;return eP.mat4.translate(l,l,[n,o,0]),eP.mat4.scale(l,l,[a/8192,a/8192,1]),l}upVector(e,i,r){return[0,0,1]}upVectorScale(e,i,r){return{metersToTile:1}}}class uG extends uj{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];let[i,r]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(i*eO);this.n=(a+Math.sin(r*eO))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){let{n:r,c:a,r0:n}=this,o=(e-this.center[0])*eO,s=Math.sqrt(a-2*r*Math.sin(i*eO))/r;return{x:s*Math.sin(o*r),y:s*Math.cos(o*r)-n,z:0}}unproject(e,i){let{n:r,c:a,r0:n}=this,o=n+i,s=Math.atan2(e,Math.abs(o))*Math.sign(o);o*r<0&&(s-=Math.PI*Math.sign(e)*Math.sign(o));let l=this.center[0]*eO*r,h=eU((s=eG(s,-Math.PI-l,Math.PI-l))/r*ek+this.center[0],-180,180),u=Math.asin(eU((a-(e*e+o*o)*r*r)/(2*r),-1,1));return new oL(h,eU(u*ek,-85.051129,85.051129))}}let uq=Math.sqrt(3)/2;class uZ extends uj{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;let r=Math.asin(uq*Math.sin(i)),a=r*r,n=a*a*a;return{x:.5*(e*Math.cos(r)/(uq*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a)))/M
7ath.PI+.5),y:1-.5*(r*(1.340264+-.081106*a+n*(893e-6+.003796*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,a=r*r,n=a*a*a;for(let e,o,s=0;s<12&&(o=r*(1.340264+-.081106*a+n*(893e-6+.003796*a))-i,n=(a=(r=eU(r-(e=o/(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))),-Math.PI/3,Math.PI/3))*r)*a*a,!(1e-12>Math.abs(e)));++s);let o=uq*e*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))/Math.cos(r),s=Math.asin(Math.sin(r)/uq);return new oL(eU(180*o/Math.PI,-180,180),eU(180*s/Math.PI,-85.051129,85.051129))}}class uH extends uj{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){return new oL(360*(e-.5),eU(360*(.5-i),-85.051129,85.051129))}}let u$=Math.PI/2;function uW(e){return Math.tan((u$+e)/2)}class uX extends uj{constructor(e){super(e),this.center=e.center||[0,30];let[i,r]=this.parallels=e.parallels||[30,30],a=i*eO,n=r*eO;this.southernCenter=a+n<0,this.southernCenter&&(a=-a,n=-n);let o=Math.cos(a),s=uW(a);this.n=a===n?Math.sin(a):Math.log(o/Math.cos(n))/Math.log(uW(n)/s),this.f=o*Math.pow(uW(a),this.n)/this.n}project(e,i){i*=eO,this.southernCenter&&(i=-i),e=(e-this.center[0])*eO;let{n:r,f:a}=this;a>0?i<-u$+1e-6&&(i=-u$+1e-6):i>u$-1e-6&&(i=u$-1e-6);let n=a/Math.pow(uW(i),r),o=n*Math.sin(r*e),s=a-n*Math.cos(r*e);return o=.5*(o/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:o,y:this.southernCenter?s:1-s,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i);let{n:r,f:a}=this,n=a-(i=(2*(1-i)-.5)*Math.PI),o=Math.sign(n),s=Math.sign(r)*Math.sqrt(e*e+n*n),l=Math.atan2(e,Math.abs(n))*o;n*r<0&&(l-=Math.PI*Math.sign(e)*o);let h=eU(l/r*ek+this.center[0],-180,180),u=eU((2*Math.atan(Math.pow(a/s,1/r))-u$)*ek,-85.051129,85.051129);return new oL(h,this.southernCenter?-u:u)}}class uY extends uj{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:oF(e),y:oB(i),z:0}}unproject(e,i){return new oL(oN(e),oV(i))}}let uK=85.051129*eO;class uJ extends uj{project(e,i){let r=(i*=eO)*i,a=r*r;return{x:.5*((e*=eO)*(.8707-.131979*r+a*(a*(.003971*r-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,a=25,n=0,o=r*r;do{let e=(o=r*r)*o;n=(r*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-i)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),r=eU(r-n,-uK,uK)}while(Math.abs(n)>1e-6&&--a>0);return new oL(eU(e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))*ek,-180,180),r*ek)}}let uQ=85.051129*eO;class u0 extends uj{project(e,i){i*=eO,e*=eO;let r=Math.cos(i),a=Math.acos(r*Math.cos(e/2)),n=Math.sin(a)/a;return{x:.5*((.5*(2/Math.PI*e+2*r*Math.sin(e/2)/n)||0)/Math.PI+.5),y:1-.5*((.5*(i+Math.sin(i)/n)||0)/Math.PI+1),z:0}}unproject(e,i){let r=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,n=25,o=0,s=0;do{let n=Math.cos(a),l=Math.sin(a),h=2*l*n,u=l*l,c=n*n,d=Math.cos(r/2),p=Math.sin(r/2),f=2*d*p,m=p*p,_=1-c*d*d,g=_?1/_:0,y=_?Math.acos(n*d)*Math.sqrt(1/_):0,x=.5*(2*y*n*p+2*r/Math.PI)-e,v=.5*(y*l+a)-i,b=.5*g*(c*m+y*n*d*u)+1/Math.PI,w=g*(f*h/4-y*l*p),T=.125*g*(h*p-y*l*c*f),S=.5*g*(u*d+y*m*n)+.5,M=w*T-S*b;o=(v*w-x*S)/M,s=(x*T-v*b)/M,r=eU(r-o,-Math.PI,Math.PI),a=eU(a-s,-uQ,uQ)}while((Math.abs(o)>1e-6||Math.abs(s)>1e-6)&&--n>0);return new oL(r*ek,a*ek)}}class u1 extends uj{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*eO)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){let{scale:r,cosPhi:a}=this;return{x:e*eO*a*r+.5,y:-Math.sin(i*eO)/a*r+.5,z:0}}unproject(e,i){let{scale:r,cosPhi:a}=this,n=eU((e-.5)/r*ek/a,-180,180),o=Math.asin(eU(-(i-.5)/r*a,-1,1));return new oL(n,eU(o*ek,-85.051129,85.051129))}}class u2 extends uY{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,r){let a=sL(e,i,r),n=sF(sI(r));return eP.vec3.transformMat4(a,a,n),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i){let r=oD(i.lat,i.lng),a=eP.vec3.normalize([],r),n=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,o=1/ok(0)*8192*n;eP.vec3.scaleAndAdd(r,r,a,o);let s=eP.mat4.identity(new Float64Array(16));return eP.mat4.multiply(s,e.pixelMatrix,e.globeMatrix),eP.vec3.transformMat4(r,r,s),new eR(r[0],r[1])}
7pixelsPerMeter(e,i){return 1/ok(0)*i}pixelSpaceConversion(e,i,r){let a=1/ok(e)*i,n=t$(1/ok(45)*i,a,r);return this.pixelsPerMeter(e,i)/n}createTileMatrix(e,i,r){let a=sB(sI(r.canonical));return eP.mat4.multiply(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){let{center:r}=e,a=sF(sI(i));return eP.mat4.rotateY(a,a,r.lng*eO),eP.mat4.rotateX(a,a,r.lat*eO),eP.mat4.scale(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,r,a){return sM(e,i,r,!0)||new oZ(0,0)}pointCoordinate3D(e,i,r){let a=this.pointCoordinate(e,i,r,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!sM(e,i.x,i.y,!1)}farthestPixelDistance(e){let i=function(e,i){let r;let a=e.cameraToCenterDistance,n=e._centerAltitude*i,o=e._camera,s=e._camera.forward(),l=eP.vec3.add([],eP.vec3.scale([],s,-a),[0,0,n]),h=e.worldSize/(2*Math.PI),u=[0,0,-h],c=e.width/e.height,d=Math.tan(e.fovAboveCenter),p=eP.vec3.scale([],o.up(),d),f=eP.vec3.scale([],o.right(),d*c),m=eP.vec3.normalize([],eP.vec3.add([],eP.vec3.add([],s,p),f)),_=[];if(new sm(l,m).closestPointOnSphere(u,h,_)){let i=eP.vec3.add([],_,u),a=eP.vec3.sub([],i,l);r=Math.cos(e.fovAboveCenter)*eP.vec3.length(a)}else{let e=eP.vec3.sub([],l,u),i=eP.vec3.sub([],u,l);eP.vec3.normalize(i,i);let a=eP.vec3.length(e)-h,n=Math.acos((r=Math.sqrt(a*(a+2*h)))/(h+a))-Math.acos(eP.vec3.dot(s,i));r*=Math.cos(n)}return 1.01*r}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),r=sj(e.zoom);return r>0?t$(i,uB(e,1/ok(e.center.lat)*e.worldSize)+e.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(e.width,e.height)/e.worldSize*Math.PI)),Math.pow(r,10)):i}upVector(e,i,r){return sL(i,r,e,1)}upVectorScale(e){return{metersToTile:sT(sO(sI(e)))}}}function u3(e){let i=e.parallels,r=!!i&&.01>Math.abs(i[0]+i[1]);switch(e.name){case"mercator":return new uY(e);case"equirectangular":return new uH(e);case"naturalEarth":return new uJ(e);case"equalEarth":return new uZ(e);case"winkelTripel":return new u0(e);case"albers":return r?new u1(e):new uG(e);case"lambertConformalConic":return r?new u1(e):new uX(e);case"globe":return new u2(e)}throw Error(`Invalid projection name: ${e.name}`)}let u4=lU.VectorTileFeature.types,u5=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function u6(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=l?Math.min(32640,Math.round(l[0])):0,m=l?Math.min(32640,Math.round(l[1])):0;e.emplaceBack(i,r,Math.round(32*a),Math.round(32*n),o,s,(f<<1)+(h?1:0),m,16*u,16*c,256*d,256*p)}function u8(e,i,r){e.emplaceBack(i,r)}function u9(e,i,r,a,n,o,s){e.emplaceBack(i,r,a,n,o,s)}function u7(e,i,r,a,n){e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n)}class ce{constructor(e){this.layoutVertexArray=new nT,this.indexArray=new nz,this.programConfigurations=e,this.segments=new n8,this.dynamicLayoutVertexArray=new ny,this.opacityVertexArray=new nM,this.placedSymbolArray=new nX,this.iconTransitioningVertexArray=new nE,this.globeExtVertexArray=new nS,this.zOffsetVertexArray=new nL}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(e,i,r,a,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hV.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,hj.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,u5,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,hq.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,hU.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,hG.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}ab(ce,"SymbolBuffers");class ct{constructor(e,i,r){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new r,this.segments=new n8,this.collisionVertexArray=new nP,this.collisionVertexArrayExt=new ny}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,hZ.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,hH.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}ab(ct,"CollisionBuffers");class ci{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=eP.mat4.identity([]),this.placementViewportMatrix=eP.mat4.identity([]);let i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hY(this.zoom,i["text-size"]),this.iconSizeData=hY(this.zoom,i["icon-size"]);let r=this.layers[0].layout,a=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==a.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map(e=>ue[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=r.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new ce(new oT(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new ce(new oT(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new nJ,this.lineVertexArray=new nQ,this.symbolInstances=new nK}calculateGlyphDependencies(e,i,r,a,n){for(let r of e){let e=r.codePointAt(0);if(void 0===e)break;if(i[e]=!0,a&&n&&e<=65535){let e=h0[r];e&&(i[e.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!lJ(this.activeReplacements,r)&&(this.activeReplacements=r,!0)}populate(e,i,r,a){let n=this.layers[0],o=n.layout,s="globe"===this.projection.name,l=o.get("text-font"),h=o.get("text-field"),u=o.get("icon-image"),[c,d]=o.get("icon-size-scale-range"),p=eU(i.scaleFactor||1,c,d),f=("constant"!==h.value.kind||h.value.value instanceof il&&!h.value.value.isEmpty()||h.value.value.toString().length>0)&&("constant"!==l.value.kind||l.value.value.length>0),m="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,_=o.get("symbol-sort-key");if(this.features=[],!f&&!m)return;let g=i.iconDependencies,y=i.glyphDependencies,x=i.availableImages,v=new aG(this.zoom);for(let{feature:i,id:h,index:u,sourceLayerIndex:c}of e){let e,d;let b=n._featureFilter.needGeometry,w=oX(i,b);if(!n._featureFilter.filter(v,w,r))continue;if(b||(w.geometry=oW(i,r,a)),s&&1!==i.type&&r.z<=5){let e=w.geometry,i=(e,i)=>{let a=sL(e.x,e.y,r,1),n=sL(i.x,i.y,r,1);return .98078528056>eP.vec3.dot(a,n)};for(let r=0;r<e.length;r++)e[r]=function(e,i){let r=e[0],a=[r];for(let n=1;n<e.length;n++){let o=e[n];(function e(i,r,a,n){if(n(r,a)){let o=r.add(a)._mult(.5);e(i,r,o,n),e(i,o,a,n)}else i.push(a)})(a,r,o,i),r=o}return a}(e[r],i)}if(f){let i=n.getValueAndResolveTokens("text-field",w,r,x),a=il.factory(i);(function(e){for(let i of e.sections)if(function(e){for(let i of e)if(aP(i.charCodeAt(0)))return!0;return!1}(i.text))return!0;return!1})(a)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===aV()||this.hasRTLText&&aj.isParsed())&&(e=function(e,i,r){return e.sections.forEach(e=>{e.text=function(e,i,r){let a=i.layout.get("text-transform").evaluate(r,{});return"uppercase"===a?e=e.toLocaleUpperCase():"lowercase"===a&&(e=e.toLocaleLowerCase()),aj.applyArabicShaping&&(e=aj.applyArabicShaping(e)),e}(e.text,i,r)}),e}(a,n,w))}if(m){let e=n.getValueAndResolveTokens("icon-image",w,r,x);d=e instanceof iu?e:iu.build(e)}if(!e&&!d)continue;let T=this.sortFeaturesByKey?_.evaluate(w,{},r):void 0,S={id:h,text:e,icon:d,index:u,sourceLayerIndex:c,geometry:w.geometry,properties:i.properties,type:u4[i.type],sortKey:T};if(this.features.push(S),d){let e=hX(this.iconSizeData,this.layers[0]._unevaluatedLayout._values["icon-size"],r,this.zoom,S)*p*this.pixelRatio,i=d.getPrimary().scaleSelf(e);if(g[i.id]=g[i.id]||[],g[i.id].push(i),d.nameSecondary){let i=d.getSecondary().scaleSelf(e);g[i.id]=g[i.id]||[],g[i.id].push(i)}}if(e){let i=l.evaluate(w,{},r).join(","),a="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");for(let r of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ue.vertical)>=0,e.sections))if(r.image){let e=r.image.getPrimary().scaleSelf(this.pixelRatio);
7g[e.id]=g[e.id]||[],g[e.id].push(e)}else{let n=aA(e.toString()),o=r.fontStack||i,s=y[o]=y[o]||{};this.calculateGlyphDependencies(r.text,s,a,this.allowVerticalPlacement,n)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){let i={},r={},a=[],n=0;function o(i){a.push(e[i]),n++}function s(e,i,n){let o=r[e];return delete r[e],r[i]=o,a[o].geometry[0].pop(),a[o].geometry[0]=a[o].geometry[0].concat(n[0]),o}function l(e,r,n){let o=i[r];return delete i[r],i[e]=o,a[o].geometry[0].shift(),a[o].geometry[0]=n[0].concat(a[o].geometry[0]),o}function h(e,i,r){let a=r?i[0][i[0].length-1]:i[0][0];return`${e}:${a.x}:${a.y}`}for(let u=0;u<e.length;u++){let c=e[u],d=c.geometry,p=c.text?c.text.toString():null;if(!p){o(u);continue}let f=h(p,d),m=h(p,d,!0);if(f in r&&m in i&&r[f]!==i[m]){let e=l(f,m,d),n=s(f,m,a[e].geometry);delete i[f],delete r[m],r[h(p,a[n].geometry,!0)]=n,a[e].geometry=null}else f in r?s(f,m,d):m in i?l(f,m,d):(o(u),i[f]=n-1,r[m]=n-1)}return a.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,i)=>e.sortKey-i.sortKey)}update(e,i,r,a,n,o,s){this.text.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s),this.icon.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s)}updateZOffset(){let e=(e,i,a)=>{(r+=i)>e.length&&e.resize(r);for(let n=-i;n<0;n++)e.emplace(n+r,a)},i=(e,i,r)=>{(a+=i)>e.length&&e.resize(a);for(let n=-i;n<0;n++)e.emplace(n+a,r)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,a=0;for(let r=0;r<this.symbolInstances.length;r++){let a=this.symbolInstances.get(r),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,numIconVertices:s}=a,l=a.zOffset,h=s>0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,l),e(this.text.zOffsetVertexArray,o,l)),h){let{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:r}=a;e>=0&&i(this.icon.zOffsetVertexArray,s,l),r>=0&&i(this.icon.zOffsetVertexArray,a.numVerticalIconVertices,l)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=u3(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){let r=this.lineVertexArray.length;if(void 0!==e.segment)for(let{x:e,y:r}of i)this.lineVertexArray.emplaceBack(e,r);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=e.indexArray,y=e.layoutVertexArray,x=e.globeExtVertexArray,v=e.segments.prepareSegment(4*i.length,y,g,this.canOverlap?o.sortKey:void 0),b=this.glyphOffsetArray.length,w=v.vertexLength,T=this.allowVerticalPlacement&&s===ue.vertical?Math.PI/2:0,S=o.text&&o.text.sections;for(let a=0;a<i.length;a++){let{tl:n,tr:s,bl:u,br:c,texPrimary:d,texSecondary:b,pixelOffsetTL:w,pixelOffsetBR:M,minFontScaleX:E,minFontScaleY:A,glyphOffset:I,isSDF:C,sectionIndex:P}=i[a],z=v.vertexLength,D=I[1];if(u6(y,h.x,h.y,n.x,D+n.y,d.x,d.y,r,C,w.x,w.y,E,A),u6(y,h.x,h.y,s.x,D+s.y,d.x+d.w,d.y,r,C,M.x,w.y,E,A),u6(y,h.x,h.y,u.x,D+u.y,d.x,d.y+d.h,r,C,w.x,M.y,E,A),u6(y,h.x,h.y,c.x,D+c.y,d.x+d.w,d.y+d.h,r,C,M.x,M.y,E,A),l){let{x:i,y:r,z:a}=l.anchor,[n,o,s]=l.up;u9(x,i,r,a,n,o,s),u9(x,i,r,a,n,o,s),u9(x,i,r,a,n,o,s),u9(x,i,r,a,n,o,s),u7(e.dynamicLayoutVertexArray,i,r,a,T)}else u7(e.dynamicLayoutVertexArray,h.x,h.y,h.z,T);if(_){let i=b||d;u8(e.iconTransitioningVertexArray,i.x,i.y),u8(e.iconTransitioningVertexArray,i.x+i.w,i.y),u8(e.iconTransitioningVertexArray,i.x,i.y+i.h),u8(e.iconTransitioningVertexArray,i.x+i.w,i.y+i.h)}g.emplaceBack(z,z+1,z+2),g.emplaceBack(z+1,z+2,z+3),v.vertexLength+=4,v.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),a!==i.length-1&&P===i[a+1].sectionIndex||e.programConfigurations.populatePaintArrays(y.length,o,o.index,{},p,f,m,S&&S[P])}let M=l?l.anchor:h;e.placedSymbolArray.emplaceBack(M.x,M.y,M.z,h.x,h.y,b,this.glyphOffsetArray.length-b,w,u,c,h.segment,r?r[0]:0,r?r[1]:0,a[0],a[1],s,0,!1,0,d,0)}_commitLayoutVertex(e,i,r,a,n,o,s){e.emplaceBack(i,r,a,n,o,Math.round(s.x),Math.round(s.y))}_addCollisionDebugVertices(e,i,r,a,n,o,s){let l=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),h=l.vertexLength,u=s.tileAnchorX,c=s.tileAnchorY;for(let e=0;e<4;e++)r.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,i,e.padding,s.zOffset),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eR(e.x1,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eR(e.x2,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eR(e.x2,e.y2)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eR(e.x1,e.y2)),l.vertexLength+=4;let d=r.indexArray;d.emplaceBack(h,h+1),d.emplaceBack(h+1,h+2),d.emplaceBack(h+2,h+3),d.emplaceBack(h+3,h),l.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,r,a,n,o){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceTextSize(e,o,i,s);this._addCollisionDebugVertices(a,n,this.textCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(e,i,r,a,n,o){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceIconSize(e,i,o.placedIconSymbolIndex);this._addCollisionDebugVertices(a,n,this.iconCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,o)}}generateCollisionDebugBuffers(e,i,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ct(nI,h$.members,nE),this.iconCollisionBox=new ct(nI,h$.members,nE);let a=hJ(this.iconSizeData,e),n=hJ(this.textSizeData,e,r);for(let r=0;r<this.symbolInstances.length;r++){let o=this.symbolInstances.get(r);this._addTextDebugCollisionBoxes(n,e,i,o.textBoxStartIndex,o.textBoxEndIndex,o),this._addTextDebugCollisionBoxes(n,e,i,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._addIconDebugCollisionBoxes(a,e,i,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._addIconDebugCollisionBoxes(a,e,i,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}}getSymbolInstanceTextSize(e,i,r,a){let n=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),o=hK(this.textSizeData,e,n)/24;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,i,r){let a=this.icon.placedSymbolArray.get(r),n=hK(this.iconSizeData,e,a);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,i,r,a){e.emplaceBack(i,-r,-r,a),e.emplaceBack(i,r,-r,a),e.emplaceBack(i,r,r,a),e.emplaceBack(i,-r,r,a)}_updateTextDebugCollisionBoxes(e,i,r,a,n,o,s){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceTextSize(e,o,i,s);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,a.padding,o.zOffset)}}_updateIconDebugCollisionBoxes(e,i,r,a,n,o,s){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceIconSize(e,i,o.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,a.padding,o.zOffset)}}updateCollisionDebugBuffers(e,i,r,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let n=hJ(this.iconSizeData,e,a),o=hJ(this.textSizeData,e,r);for(let s=0;s<this.symbolInstances.length;s++){let l=this.symbolInstances.get(s);this._updateTextDebugCollisionBoxes(o,e,i,l.textBoxStartIndex,l.textBoxEndIndex,l,r),this._updateTextDebugCollisionBoxes(o,e,i,l.verticalTextBoxStartIndex,l.verticalTextBoxEndIndex,l,r),this._updateIconDebugCollisionBoxes(n,e,i,l.iconBoxStartIndex,l.iconBoxEndIndex,l,a),this._updateIconDebugCollisionBoxes(n,e,i,l.verticalIconBoxStartIndex,l.verticalIconBoxEndIndex,l,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,r,a,n,o,s,l,h){let u={};if(i<r){let{x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(i);u.textBox={x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.textFeatureIndex=f}if(a<n){let{x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(a);u.verticalTextBox={x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.verticalTextFeatureIndex=f}
7if(o<s){let{x1:i,y1:r,x2:a,y2:n,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(o);u.iconBox={x1:i,y1:r,x2:a,y2:n,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.iconFeatureIndex=f}if(l<h){let{x1:i,y1:r,x2:a,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(l);u.verticalIconBox={x1:i,y1:r,x2:a,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.verticalIconFeatureIndex=f}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){let r=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){let r=e.placedSymbolArray.get(i),a=r.vertexStartIndex+4*r.numGlyphs;for(let i=r.vertexStartIndex;i<a;i+=4)e.indexArray.emplaceBack(i,i+1,i+2),e.indexArray.emplaceBack(i+1,i+2,i+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let i=Math.sin(e),r=Math.cos(e),a=[],n=[],o=[];for(let e=0;e<this.symbolInstances.length;++e){o.push(e);let s=this.symbolInstances.get(e);a.push(0|Math.round(i*s.tileAnchorX+r*s.tileAnchorY)),n.push(s.featureIndex)}return o.sort((e,i)=>a[e]-a[i]||n[i]-n[e]),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===i?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let i of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let e=this.symbolInstances.get(i);this.featureSortOrder.push(e.featureIndex);let{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:l}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),a>=0&&a!==r&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ab(ci,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),ci.addDynamicAttributes=u7;class cr{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:tQ,this.defaultValue=e}evaluate(e){if(e.formattedSection){let i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ab(cr,"FormatSectionOverride",{omit:["defaultValue"]});let ca=()=>P||(P={layout:I||(I=new a1({"symbol-placement":new aJ(a2.layout_symbol["symbol-placement"]),"symbol-spacing":new aJ(a2.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new aJ(a2.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new aQ(a2.layout_symbol["symbol-sort-key"]),"symbol-z-order":new aJ(a2.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new aJ(a2.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new aJ(a2.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new aJ(a2.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new aJ(a2.layout_symbol["icon-ignore-placement"]),"icon-optional":new aJ(a2.layout_symbol["icon-optional"]),"icon-rotation-alignment":new aJ(a2.layout_symbol["icon-rotation-alignment"]),"icon-size":new aQ(a2.layout_symbol["icon-size"]),"icon-size-scale-range":new aJ(a2.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new aQ(a2.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new aQ(a2.layout_symbol["icon-text-fit-padding"]),"icon-image":new aQ(a2.layout_symbol["icon-image"]),"icon-rotate":new aQ(a2.layout_symbol["icon-rotate"]),"icon-padding":new aJ(a2.layout_symbol["icon-padding"]),"icon-keep-upright":new aJ(a2.layout_symbol["icon-keep-upright"]),"icon-offset":new aQ(a2.layout_symbol["icon-offset"]),"icon-anchor":new aQ(a2.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new aJ(a2.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new aJ(a2.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new aJ(a2.layout_symbol["text-rotation-alignment"]),"text-field":new aQ(a2.layout_symbol["text-field"]),"text-font":new aQ(a2.layout_symbol["text-font"]),"text-size":new aQ(a2.layout_symbol["text-size"]),"text-size-scale-range":new aJ(a2.layout_symbol["text-size-scale-range"]),"text-max-width":new aQ(a2.layout_symbol["text-max-width"]),"text-line-height":new aQ(a2.layout_symbol["text-line-height"]),"text-letter-spacing":new aQ(a2.layout_symbol["text-letter-spacing"]),"text-justify":new aQ(a2.layout_symbol["text-justify"]),"text-radial-offset":new aQ(a2.layout_symbol["text-radial-offset"]),"text-variable-anchor":new aJ(a2.layout_symbol["text-variable-anchor"]),"text-anchor":new aQ(a2.layout_symbol["text-anchor"]),"text-max-angle":new aJ(a2.layout_symbol["text-max-angle"]),"text-writing-mode":new aJ(a2.layout_symbol["text-writing-mode"]),"text-rotate":new aQ(a2.layout_symbol["text-rotate"]),"text-padding":new aJ(a2.layout_symbol["text-padding"]),"text-keep-upright":new aJ(a2.layout_symbol["text-keep-upright"]),"text-transform":new aQ(a2.layout_symbol["text-transform"]),"text-offset":new aQ(a2.layout_symbol["text-offset"]),"text-allow-overlap":new aJ(a2.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new aJ(a2.layout_symbol["text-ignore-placement"]),"text-optional":new aJ(a2.layout_symbol["text-optional"]),visibility:new aJ(a2.layout_symbol.visibility)})),paint:C||(C=new a1({"icon-opacity":new aQ(a2.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new aQ(a2.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new aQ(a2.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new aQ(a2.paint_symbol["text-emissive-strength"]),"icon-color":new aQ(a2.paint_symbol["icon-color"]),"icon-halo-color":new aQ(a2.paint_symbol["icon-halo-color"]),"icon-halo-width":new aQ(a2.paint_symbol["icon-halo-width"]),"icon-halo-blur":new aQ(a2.paint_symbol["icon-halo-blur"]),"icon-translate":new aJ(a2.paint_symbol["icon-translate"]),"icon-translate-anchor":new aJ(a2.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new aQ(a2.paint_symbol["icon-image-cross-fade"]),"text-opacity":new aQ(a2.paint_symbol["text-opacity"]),"text-occlusion-opacity":new aQ(a2.paint_symbol["text-occlusion-opacity"]),"text-color":new aQ(a2.paint_symbol["text-color"],{runtimeType:t3,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new aQ(a2.paint_symbol["text-halo-color"]),"text-halo-width":new aQ(a2.paint_symbol["text-halo-width"]),"text-halo-blur":new aQ(a2.paint_symbol["text-halo-blur"]),"text-translate":new aJ(a2.paint_symbol["text-translate"]),"text-translate-anchor":new aJ(a2.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new aJ(a2.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new aJ(a2.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new aJ(a2.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new aJ(a2.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new aQ(a2.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))});class cn extends ns{constructor(e,i,r,a){super(e,ca(),i,r,a),this._colorAdjustmentMatrix=eP.mat4.identity([]),this.hasInitialOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),"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"));let r=this.layout.get("text-writing-mode");if(r){let e=[];for(let i of r)0>e.indexOf(i)&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,r,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===r&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(e,i,r,a){e=tt(e),i=te(i);let n=eP.mat4.create(),o=e/3,s=1-2*o,l=.5-.5*i,h=a-r;return eP.mat4.multiply(n,[h,0,0,0,0,h,0,0,0,0,h,0,r,r,r,1],[i,0,0,0,0,i,0,0,0,0,i,0,l,l,l,1]),eP.mat4.multiply(n,n,[s,o,o,0,o,s,o,0,o,o,s,0,0,0,0,1]),n}(e,i,r,a),this._saturation=e,this._contrast=i,this._brightnessMin=r,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,r,a){var n;let o=this.layout.get(e).evaluate(i,{},r,a),s=this._unevaluatedLayout._values[e];return s.isDataDriven()||ac(s.value)||!o?o:(n=i.properties,o.replace(/{([^{}]+)}/g,(e,i)=>i in n?String(n[i]):""))}createBucket(e){return new ci(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let e of ca().paint.overridableProperties){if(!cn.hasPaintOverride(this.layout,e))continue;let i=this.paint.get(e),r=new au(new cr(i),i.property.specification,this.scope,this.options),a=null;a="constant"===i.value.kind||"source"===i.value.kind?new ap("source",r):new af("composite",r,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new aY(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&cn.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){let r=e.get("text-field"),a=ca().paint.properties[i],n=!1,o=e=>{for(let i of e)if(a.overrides&&a.overrides.hasOverride(i))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof il)o(r.value.value.sections);else if("source"===r.value.kind){let e=i=>{n||(i instanceof i_&&ip(i.value)===t8?o(i.value.sections):i instanceof iv?o(i.sections):i.eachChild(e))},i=r.value;i._styleExpression&&e(i._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,r){return{config:new ow(this,{zoom:i,lut:r}),overrideFog:!1}}}var co=nc([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function cs(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function cl(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class ch{constructor(e,i,r,a){this.context=e,this.format=r,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){let r=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:s,y:l}=i&&i.position?i.position:{x:0,y:0},h=s+r,u=l+a;this.size&&(this.size[0]!==h||this.size[1]!==u)&&(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(this.texture),this.texture=o.createTexture(),this.size=null),o.bindTexture(o.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA8&&(!i||!1!==i.premultiply));let c=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&h>0&&u>0){let e=this.useMipmap?Math.floor(Math.log2(Math.max(h,u)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,h,u),this.size=[h,u]}if(this.size){if(c)o.texSubImage2D(o.TEXTURE_2D,0,s,l,cs(this.format),cl(this.format),e);else{let i=e.data;i&&o.texSubImage2D(o.TEXTURE_2D,0,s,l,r,a,cs(this.format),cl(this.format),i)}}this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,i,r=!1){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!r?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,r,a){let{context:n}=this,{gl:o}=n;
7o.bindTexture(o.TEXTURE_2D,this.texture),i!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),this.wrapS=r),a!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,a),this.wrapT=a)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class cu{constructor(e,i){this.context=e,this.texture=i}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function cc(e,i,r,a,n,o,s,l){let h=[e,i,1,r,a,1,n,o,1],u=[s,l,1],c=eP.mat3.adjoint([],h),[d,p,f]=eP.vec3.transformMat3(u,u,c);return eP.mat3.multiply(h,h,[d,0,0,0,p,0,0,0,f])}function cd(e,i,r,a,n,o,s,l){let h=function(e,i,r,a,n,o,s,l){let h=cc(0,0,1,0,1,1,0,1),u=cc(e,i,r,a,n,o,s,l),c=eP.mat3.adjoint([],h);return eP.mat3.multiply(u,u,c)}(e,i,r,a,n,o,s,l);return[h[2]/h[8]/8192,h[5]/h[8]/8192]}function cp(e){return[e[0],Math.min(Math.max(e[1],-85.051129),85.051129)]}class cf extends tU{constructor(e,i,r,a){super(),this.id=e,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new tF("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=tC(this.map._requestManager.transformRequest(this.url,tT.Image),(i,r)=>{this._imageRequest=null,this._loaded=!0,i?this.fire(new tB(i)):r&&(this.image=r instanceof HTMLImageElement?to.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url&&(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded)),this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new cu(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new tF("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof cu||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],r=e[0][1];for(let a of e)a[1]>r&&(r=a[1]),a[1]<i&&(i=a[1]);let a=(r+i)/2;if(a>85.051129?this.onNorthPole=!0:a<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){let i=e.map(oZ.fromLngLat);this.tileID=function(e){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let o of e)i=Math.min(i,o.x),r=Math.min(r,o.y),a=Math.max(a,o.x),n=Math.max(n,o.y);let o=Math.max(0,Math.floor(-Math.log(Math.max(a-i,n-r))/Math.LN2)),s=Math.pow(2,o),l=Math.floor((i+a)/2*s);return l>1&&(l-=1),new ss(o,l,Math.floor((r+n)/2*s))}(i),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new tF("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){var i;for(let e in this.tiles){let i=this.tiles[e];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;let r=uN(new ss(0,0,0),this.map.transform.projection),a=[r.projection.project(this.coordinates[0][0],this.coordinates[0][1]),r.projection.project(this.coordinates[1][0],this.coordinates[1][1]),r.projection.project(this.coordinates[2][0],this.coordinates[2][1]),r.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){let i=e[1].x-e[0].x,r=e[1].y-e[0].y,a=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,s=e[3].y-e[2].y,l=e[0].x-e[3].x,h=e[0].y-e[3].y,u=i*n-a*r,c=a*s-o*n,d=o*h-l*s,p=l*r-i*h;return u>0&&c>0&&d>0&&p>0||u<0&&c<0&&d<0&&p<0}(a))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let n=uN(this.tileID,this.map.transform.projection),[o,s,l,h]=this.coordinates.map(e=>{let i=n.projection.project(e[0],e[1]);return uV(n,i)._round()});this.perspectiveTransform=cd(o.x,o.y,s.x,s.y,l.x,l.y,h.x,h.y);let u=this._boundsArray=new nm;u.emplaceBack(o.x,o.y,0,0),u.emplaceBack(s.x,s.y,8192,0),u.emplaceBack(h.x,h.y,0,8192),u.emplaceBack(l.x,l.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(u,co.members),this.boundsSegments=n8.simpleSegment(0,0,4,2);let c=[],[d,p,f,m]=function(e){let i=e[0][0],r=i,a=e[0][1],n=a;for(let o=1;o<e.length;o++)e[o][0]<i?i=e[o][0]:e[o][0]>r&&(r=e[o][0]),e[o][1]<a?a=e[o][1]:e[o][1]>n&&(n=e[o][1]);return[i,a,r-i,n-a]}([cp((i=this.coordinates)[0]),cp(i[1]),cp(i[2]),cp(i[3])]);{let i=new nm,[n,o,s,l]=function(e){let i=e[0].x,r=i,a=e[0].y,n=a;for(let o=1;o<e.length;o++)e[o].x<i?i=e[o].x:e[o].x>r&&(r=e[o].x),e[o].y<a?a=e[o].y:e[o].y>n&&(n=e[o].y);return[i,a,r-i,n-a]}(a),h=e=>
7[(e.x-n)/s,(e.y-o)/l],[u,_,g,y]=a.map(h),x=function(e,i,r,a,n,o,s,l){let h=cc(0,0,1,0,1,1,0,1),u=cc(e,i,r,a,n,o,s,l),c=eP.mat3.adjoint([],u);return eP.mat3.multiply(h,h,c)}(u[0],u[1],_[0],_[1],g[0],g[1],y[0],y[1]);this.elevatedGlobePerspectiveTransform=cd(u[0],u[1],_[0],_[1],g[0],g[1],y[0],y[1]);let v=(e,r)=>{c.push(e.lng);let a=Math.round((e.lng-d)/f*8192),n=Math.round((e.lat-p)/m*8192),o=h(r),s=eP.vec3.transformMat3([],[o[0],o[1],1],x),l=Math.round(s[0]/s[2]*8192),u=Math.round(s[1]/s[2]*8192);i.emplaceBack(a,n,l,u)},b=a[3].x-a[0].x,w=a[3].y-a[0].y,T=a[2].x-a[1].x,S=a[2].y-a[1].y;for(let e=0;e<65;e++){let i=e/64,n=[a[0].x+i*b,a[0].y+i*w],o=[a[1].x+i*T,a[1].y+i*S],s=o[0]-n[0],l=o[1]-n[1];for(let e=0;e<65;e++){let i=e/64,a={x:n[0]+s*i,y:n[1]+l*i,z:0};v(r.projection.unproject(a.x,a.y),a)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(i,co.members)}{this.maxLongitudeTriangleSize=0;let i=[],r=new nz,a=(e,a,n)=>{r.emplaceBack(e,a,n);let o=c[e],s=c[a],l=c[n],h=Math.min(Math.min(o,s),l),u=Math.max(Math.max(o,s),l)-h;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),i.push(h+u/2)};for(let e=0;e<64;e++)for(let i=0;i<64;i++){let r=65*e+i,n=r+1,o=r+65,s=o+1;a(r,o,n),a(n,o,s)}[i,r]=function(e,i){let r=Array.from({length:e.length},(e,i)=>i);r.sort((i,r)=>e[i]-e[r]);let a=[],n=new nz;for(let o=0;o<r.length;o++){let s=r[o];a.push(e[s]);let l=3*s,h=l+1;n.emplaceBack(i.uint16[l],i.uint16[h],i.uint16[h+1])}return[a,n]}(i,r),this.elevatedGlobeTrianglesCenterLongitudes=i,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(r)}this.elevatedGlobeSegments=n8.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,f/8192,0,m/8192,0,0,p,d,0])}prepare(){let e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;let i=this.map.painter.context,r=i.gl;!this._dirty||this.texture instanceof cu||(this.texture?this.texture.update(this.image):(this.texture=new ch(i,this.image,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored",i(null)}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){var i;let r=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!r)return null;let a=this.elevatedGlobeTrianglesCenterLongitudes,n=(i=e+180)+360*Math.round((a[0]-i)/360),o=new n8,s=(e,i)=>{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:r.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},l=.51*this.maxLongitudeTriangleSize;if(Math.abs(a[0]-n)<=l){let e=e7(a,0,a.length,n+l);return e===a.length||s(e,e9(a,e+1,a.length,n+360-l)-e),o}n<a[0]&&(n+=360);let h=e9(a,0,a.length,n-l);if(h===a.length)return s(0,a.length),o;s(0,h-0);let u=e7(a,h+1,a.length,n+l);return u!==a.length&&s(u,a.length-u),o}}class cm extends ns{constructor(e,i,r,a){super(e,{layout:R||(R=new a1({visibility:new aJ(a2.layout_raster.visibility)})),paint:L||(L=new a1({"raster-opacity":new aJ(a2.paint_raster["raster-opacity"]),"raster-color":new a0(a2.paint_raster["raster-color"]),"raster-color-mix":new aJ(a2.paint_raster["raster-color-mix"]),"raster-color-range":new aJ(a2.paint_raster["raster-color-range"]),"raster-hue-rotate":new aJ(a2.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new aJ(a2.paint_raster["raster-brightness-min"]),"raster-brightness-max":new aJ(a2.paint_raster["raster-brightness-max"]),"raster-saturation":new aJ(a2.paint_raster["raster-saturation"]),"raster-contrast":new aJ(a2.paint_raster["raster-contrast"]),"raster-resampling":new aJ(a2.paint_raster["raster-resampling"]),"raster-fade-duration":new aJ(a2.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new aJ(a2.paint_raster["raster-emissive-strength"]),"raster-array-band":new aJ(a2.paint_raster["raster-array-band"]),"raster-elevation":new aJ(a2.paint_raster["raster-elevation"]),"raster-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof cf&&(e._source.onNorthPole||e._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}
7updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;let i=this._transitionablePaint._values["raster-color"].value.expression,[r,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(a)||r===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=s6({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[r,a])}}class c_ extends ns{constructor(e,i,r,a){super(e,{layout:O||(O=new a1({visibility:new aJ(a2["layout_raster-particle"].visibility)})),paint:k||(k=new a1({"raster-particle-array-band":new aJ(a2["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new aJ(a2["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new a0(a2["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new aJ(a2["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new aJ(a2["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new aJ(a2["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new aJ(a2["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new aJ(a2["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._updateColorRamp(),this.lastInvalidatedAt=to.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;let e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=s6({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=to.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class cg extends ns{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function cy(e,i,r){let a=[0,0,1],n=eP.quat.identity([]);return eP.quat.rotateY(n,n,r?-(e*eO)+Math.PI:e*eO),eP.quat.rotateX(n,n,-(i*eO)),eP.vec3.transformQuat(a,a,n),eP.vec3.normalize(a,a)}function cx(e,i){let r=cb(e.projection,e.zoom,e.width,e.height),a=function(e,i,r,a,n){let o=new oL(r.lng-180*cw,r.lat),s=new oL(r.lng+180*cw,r.lat),l=e.project(o.lng,o.lat),h=e.project(s.lng,s.lat),u=-Math.atan2(h.y-l.y,h.x-l.x),c=oZ.fromLngLat(r);c.y=eU(c.y,-1+cw,1-cw);let d=c.toLngLat(),p=e.project(d.lng,d.lat),f=oZ.fromLngLat(d);f.x+=cw;let m=f.toLngLat(),_=e.project(m.lng,m.lat),g=cS(_.x-p.x,_.y-p.y,u),y=oZ.fromLngLat(d);y.y+=cw;let x=y.toLngLat(),v=e.project(x.lng,x.lat),b=cS(v.x-p.x,v.y-p.y,u),w=Math.abs(g.x)/Math.abs(b.y),T=eP.mat4.identity([]);eP.mat4.rotateZ(T,T,-u*(1-(n?0:a)));let S=eP.mat4.identity([]);return eP.mat4.scale(S,S,[1,1-(1-w)*a,1]),S[4]=-b.x/b.y*a,eP.mat4.rotateZ(S,S,u),eP.mat4.multiply(S,T,S
7),S}(e.projection,0,e.center,r,i),n=cv(e);return eP.mat4.scale(a,a,[n,n,1]),a}function cv(e){let i=e.projection,r=cb(e.projection,e.zoom,e.width,e.height);return Math.pow(2,cT(i,e.center)*r+(1-r)*cT(i,oL.convert(i.center)))}function cb(e,i,r,a,n=1/0){let o=e.range;if(!o)return 0;let s=Math.log(Math.min(n,Math.max(r,a))/1024)/Math.LN2;return ej(o[0]+s,o[1]+s,i)}let cw=1/4e4;function cT(e,i){let r=eU(i.lat,-85.051129,85.051129),a=new oL(i.lng-180*cw,r),n=new oL(i.lng+180*cw,r),o=e.project(a.lng,r),s=e.project(n.lng,r),l=oZ.fromLngLat(a),h=oZ.fromLngLat(n),u=s.x-o.x,c=s.y-o.y,d=h.x-l.x,p=h.y-l.y;return Math.log(Math.sqrt((d*d+p*p)/(u*u+c*c)))/Math.LN2}function cS(e,i,r){let a=Math.cos(r),n=Math.sin(r);return{x:e*a-i*n,y:e*n+i*a}}function cM(e,i,r){eP.mat4.identity(e),eP.mat4.rotateZ(e,e,i[2]*eO),eP.mat4.rotateX(e,e,i[0]*eO),eP.mat4.rotateY(e,e,i[1]*eO),eP.mat4.scale(e,e,r),eP.mat4.multiply(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function cE(e,i,r,a,n,o,s,l){let h=[r[0]-i[0],r[1]-i[1],0],u=[a[0]-i[0],a[1]-i[1],0];if(1e-12>eP.vec3.length(h)||1e-12>eP.vec3.length(u))return eP.quat.identity(e);let c=eP.vec3.cross([],h,u);return eP.vec3.normalize(c,c),eP.vec3.subtract(u,a,i),h[2]=(o-n)*l,u[2]=(s-n)*l,eP.vec3.cross(h,h,u),eP.vec3.normalize(h,h),eP.quat.rotationTo(e,c,h)}function cA(e,i,r=!1){let a=sj(i.zoom),n=function(e,i,r){let a=i.worldSize,n=[e[12],e[13],e[14]],o=oV(n[1]/a),s=oN(n[0]/a),l=eP.mat4.identity([]),h=1/ok(o)*a,u=1/ok(0)*a*oj(o,i.zoom),c=1/sN(a),d=u*c;if(r){let e=cb(i.projection,i.zoom,i.width,i.height,1024);d=c*i.projection.pixelSpaceConversion(i.center.lat,a,e)}let p=oD(o,s);eP.vec3.add(p,p,eP.vec3.scale([],eP.vec3.normalize([],p),h*d*n[2]));let f=function(e){let i=[e[0],e[1],e[2]],r=[0,1,0],a=eP.vec3.cross([],r,i);return eP.vec3.cross(r,i,a),0===eP.vec3.squaredLength(r)&&(r=[0,1,0],eP.vec3.cross(a,i,r)),eP.vec3.normalize(a,a),eP.vec3.normalize(r,r),eP.vec3.normalize(i,i),[a[0],a[1],a[2],0,r[0],r[1],r[2],0,i[0],i[1],i[2],0,e[0],e[1],e[2],1]}(p);eP.mat4.scale(l,l,[d,d,d*h]),eP.mat4.translate(l,l,[-n[0],-n[1],-n[2]]);let m=eP.mat4.multiply([],i.globeMatrix,f);return eP.mat4.multiply(m,m,l),eP.mat4.multiply(m,m,e),m}(e,i,r);return a>0?function(e,i,r){let a=(e,i,r)=>{let a=eP.vec3.length(e),n=eP.vec3.length(i),o=sC(e,i,r);return eP.vec3.scale(o,o,1/eP.vec3.length(o)*t$(a,n,r))},n=a([e[0],e[1],e[2]],[i[0],i[1],i[2]],r),o=a([e[4],e[5],e[6]],[i[4],i[5],i[6]],r),s=a([e[8],e[9],e[10]],[i[8],i[9],i[10]],r),l=sC([e[12],e[13],e[14]],[i[12],i[13],i[14]],r);return[n[0],n[1],n[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,l[0],l[1],l[2],1]}(n,function(e,i){let r=i.worldSize,a=1/ok(0)*r*oj(i.center.lat,i.zoom)/sN(r),n=1/ok(i.center.lat)*r,o=eP.mat4.identity([]);return eP.mat4.rotateY(o,o,i.center.lng*eO),eP.mat4.rotateX(o,o,i.center.lat*eO),eP.mat4.translate(o,o,[0,0,oI]),eP.mat4.scale(o,o,[a,a,a*n]),eP.mat4.translate(o,o,[i.point.x-.5*r,i.point.y-.5*r,0]),eP.mat4.multiply(o,o,e),eP.mat4.multiply(o,i.globeMatrix,o)}(e,i),a):n}function cI(e,i,r,a){let n;let o=sw.projectAabbCorners(a,r),s=Number.MAX_VALUE,l=-1;for(let e=0;e<o.length;++e){let r=o[e];r[0]=(.5*r[0]+.5)*i.width,r[1]=(.5-.5*r[1])*i.height,r[2]<s&&(l=e,s=r[2])}let h=e=>new eR(o[e][0],o[e][1]);switch(l){case 0:case 6:n=[h(1),h(5),h(4),h(7),h(3),h(2),h(1)];break;case 1:case 7:n=[h(0),h(4),h(5),h(6),h(2),h(3),h(0)];break;case 3:case 5:n=[h(1),h(0),h(4),h(7),h(6),h(2),h(1)];break;default:n=[h(1),h(5),h(6),h(7),h(3),h(0),h(1)]}if(oQ(e,n))return s}let cC=nc([{name:"a_pos_3f",components:3,type:"Float32"}]),cP=nc([{name:"a_color_3f",components:3,type:"Float32"}]),cz=nc([{name:"a_color_4f",components:4,type:"Float32"}]),cD=nc([{name:"a_uv_2f",components:2,type:"Float32"}]),cR=nc([{name:"a_normal_3f",components:3,type:"Float32"}]),cL=nc([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),cO=nc([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),ck={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class cF{constructor(e,i,r,a){this.message=(e?`${e}: `:"")+r,a&&(this.identifier=a),null!=i&&i.__line__&&(this.line=i.__line__)}}function cB(e,i){let r=-1===e.indexOf("://");try{return new URL(e,r&&i?"http://example.com":void 0),!0}catch(e){return!1}}class cN{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class cV{constructor(){this.instancedDataArray=new nj,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class cU{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(e,i){}populate(e,i,r,a){this.tileToMeter=oq(r);let n=this.layers[0]._featureFilter.needGeometry;for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of(this.lookup=new Uint8Array(this.lookupDim*this.lookupDim),e)){let e=null!=s?s:o.properties&&o.properties.hasOwnProperty("id")?o.properties.id:void 0,u=oX(o,n);if(!this.layers[0]._featureFilter.filter(new aG(this.zoom),u,r))continue;let c={id:e,sourceLayerIndex:h,index:l,geometry:n?u.geometry:oW(o,r,a),properties:o.properties,type:o.type,patterns:{}},d=this.addFeature(c,c.geometry,u);d&&i.featureIndex.insert(o,c.geometry,l,h,this.index,this.instancesPerModel[d].instancedDataArray.length,256)}this.lookup=null}update(e,i,r,a){for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i in e)r.idToFeaturesIndex.hasOwnProperty(i)&&(this.evaluate(r.features[r.idToFeaturesIndex[i]],e[i],r,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i of r.features){let a=this.layers[0],n=i.feature,o=this.canonical,s=a.paint.get("model-rotation").evaluate(n,{},o),l=a.paint.get("model-scale").evaluate(n,{},o),h=a.paint.get("model-translation").evaluate(n,{},o);eP.vec3.exactEquals(i.rotation,s)&&eP.vec3.exactEquals(i.scale,l)&&eP.vec3.exactEquals(i.translation,h)||(this.evaluate(i,i.featureStates,r,!0),e=!0)}}return e}updateReplacement(e,i,r,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;let n=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(lJ(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(let i in this.instancesPerModel){let n=this.instancesPerModel[i],s=n.instancedDataArray;for(let i of n.features){let n=i.instancedDataOffset,l=i.instancedDataCount;for(let i=0;i<l;i++){let l=16*(i+n),h=s.float32[l+0],u=h>8192,c=Math.floor(h=u?h-8192:h),d=s.float32[l+1],p=!1;for(let i of this.activeReplacements)if(!lW(i,r,ck.Model,a)&&!(i.min.x>c||c>i.max.x||i.min.y>d||d>i.max.y)&&(p=l2(l1(c,d,e.canonical,i.footprintTileId.canonical),i.footprint)))break;s.float32[l]=p?h+8192:h,o=o||p!==u}}}return o}isEmpty(){for(let e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=e.createVertexBuffer(r.
7instancedDataArray,cL.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(let e in this.instancesPerModel){let i=this.instancesPerModel[e];0!==i.instancedDataArray.length&&i.instancedDataBuffer&&i.instancedDataBuffer.destroy()}let e=this.layers[0].modelManager;if(e&&this.modelUris)for(let i of this.modelUris)e.removeModel(i,"")}addFeature(e,i,r){let a=this.layers[0],n=a.layout.get("model-id").evaluate(r,{},this.canonical);if(!n)return e1(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),n;cB(n,!1)&&(this.modelUris.includes(n)||this.modelUris.push(n)),this.instancesPerModel[n]||(this.instancesPerModel[n]=new cV);let o=this.instancesPerModel[n],s=o.instancedDataArray,l=new cN(r,s.length);for(let e of i)for(let i of e){if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)continue;let e=(this.lookupDim-1)/8192,r=this.lookupDim*(i.y*e|0)+i.x*e|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}this.instanceCount++;let a=s.length;s.resize(a+1),o.instancesEvaluatedElevation.push(0),s.float32[16*a]=i.x,s.float32[16*a+1]=i.y}return l.instancedDataCount=o.instancedDataArray.length-l.instancedDataOffset,l.instancedDataCount>0&&(e.id&&(o.idToFeaturesIndex[e.id]=o.features.length),o.features.push(l),this.evaluate(l,{},o,!1)),n}getModelUris(){return this.modelUris}evaluate(e,i,r,a){let n=this.layers[0],o=e.feature,s=this.canonical,l=e.rotation=n.paint.get("model-rotation").evaluate(o,i,s),h=e.scale=n.paint.get("model-scale").evaluate(o,i,s),u=e.translation=n.paint.get("model-translation").evaluate(o,i,s),c=n.paint.get("model-color").evaluate(o,i,s);c.a=n.paint.get("model-color-mix-intensity").evaluate(o,i,s);let d=[];this.maxVerticalOffset<u[2]&&(this.maxVerticalOffset=u[2]),this.maxScale=Math.max(Math.max(this.maxScale,h[0]),Math.max(h[1],h[2])),cM(d,l,h);let p=Math.round(100*c.a)+c.b/1.05;for(let i=0;i<e.instancedDataCount;++i){let n=e.instancedDataOffset+i,o=16*n,l=r.instancedDataArray.float32,h=0;a&&(h=l[o+6]-r.instancesEvaluatedElevation[n]);let f=0|l[o+1];l[o]=(0|l[o])+c.r/1.05,l[o+1]=f+c.g/1.05,l[o+2]=p,l[o+3]=1/(s.z>10?this.tileToMeter:oq(s,f)),l[o+4]=u[0],l[o+5]=u[1],l[o+6]=u[2]+h,l[o+7]=d[0],l[o+8]=d[1],l[o+9]=d[2],l[o+10]=d[4],l[o+11]=d[5],l[o+12]=d[6],l[o+13]=d[8],l[o+14]=d[9],l[o+15]=d[10],r.instancesEvaluatedElevation[n]=u[2]}}}ab(cU,"ModelBucket",{omit:["layers"]}),ab(cV,"PerModelAttributes"),ab(cN,"ModelFeature");
7let cj={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function cG(e,i,r,a,n,o,s,l,h,u=!1){let c=r.zoom,d=r.project(a),p=oj(a.lat,c),f=1/p;eP.mat4.identity(e),eP.mat4.translate(e,e,[d.x+s[0]*f,d.y+s[1]*f,s[2]]);let m=1,_=1,g=r.worldSize;if(u){if("mercator"===r.projection.name){let e=0;r.elevation&&(e=r.elevation.getAtPointOrZero(new oZ(d.x/g,d.y/g),0));let i=eP.vec4.transformMat4([],[d.x,d.y,e,1],r.projMatrix)[3]/r.cameraToCenterDistance;m=i,_=i*oj(r.center.lat,c)}else if("globe"===r.projection.name){let i=cA(e,r),n=eP.mat4.multiply([],r.projMatrix,i),o=[0,0,0,1];eP.vec4.transformMat4(o,o,n);let s=o[3]/r.cameraToCenterDistance,l=sj(c),h=r.projection.pixelsPerMeter(a.lat,g)*oj(a.lat,c),u=r.projection.pixelsPerMeter(r.center.lat,g)*oj(r.center.lat,c);m=s/t$(h,oU(r.center.lat),l),_=s*p/h,m*=u,_*=u}}else m=f;eP.mat4.scale(e,e,[m,m,_]);let y=[...e],x=i.orientation,v=[];if(cM(v,[x[0]+n[0],x[1]+n[1],x[2]+n[2]],o),eP.mat4.multiply(e,y,v),l&&r.elevation){let n=0,o=[];if(h&&r.elevation){n=function(e,i,r,a,n){let o=i.elevation;if(!o)return 0;let s=sw.projectAabbCorners(r,a),l=1/ok(n.lat)*i.worldSize,h=function(e,i){let r=[0,0,1],a=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(let n of a){let a=e[n.corners[0]],o=e[n.corners[1]],s=e[n.corners[2]],l=[o[0]-a[0],o[1]-a[1],i*(o[2]-a[2])],h=eP.vec3.cross(l,l,[s[0]-a[0],s[1]-a[1],i*(s[2]-a[2])]);eP.vec3.normalize(h,h),n.dotProductWithUp=eP.vec3.dot(h,r)}return a.sort((e,i)=>e.dotProductWithUp-i.dotProductWithUp),a[0].corners}(s,l),u=s[h[0]],c=s[h[1]],d=s[h[2]],p=s[h[3]],f=o.getAtPointOrZero(new oZ(u[0]/i.worldSize,u[1]/i.worldSize),0),m=o.getAtPointOrZero(new oZ(c[0]/i.worldSize,c[1]/i.worldSize),0),_=o.getAtPointOrZero(new oZ(d[0]/i.worldSize,d[1]/i.worldSize),0),g=o.getAtPointOrZero(new oZ(p[0]/i.worldSize,p[1]/i.worldSize),0),y=(f+g)/2,x=(m+_)/2;return y>x?m<_?cE(e,c,p,u,m,g,f,l):cE(e,d,u,p,_,f,g,l):f<g?cE(e,u,c,d,f,m,_,l):cE(e,p,d,c,g,_,m,l),Math.max(y,x)}(o,r,i.aabb,e,a);let s=eP.mat4.fromQuat([],o),l=eP.mat4.multiply([],s,v);eP.mat4.multiply(e,y,l)}else n=r.elevation.getAtPointOrZero(new oZ(d.x/g,d.y/g),0);0!==n&&(e[14]+=n)}}function cq(e,i,r=!1){e.uploaded||(e.gfxTexture=new ch(i,e.image,r?i.gl.R8:i.gl.RGBA8,{useMipmap:e.sampler.minFilter>=i.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function cZ(e,i,r){if(e.meshes)for(let a of e.meshes)!function(e,i,r){e.indexBuffer=i.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=i.createVertexBuffer(e.vertexArray,cC.members,!1,!0),e.normalArray&&(e.normalBuffer=i.createVertexBuffer(e.normalArray,cR.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=i.createVertexBuffer(e.texcoordArray,cD.members,!1,!0)),e.colorArray&&(e.colorBuffer=i.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?cP:cz).members,!1,!0)),e.featureArray&&(e.pbrBuffer=i.createVertexBuffer(e.featureArray,cO.members,!0)),e.segments=n8.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);let a=e.material;a.pbrMetallicRoughness.baseColorTexture&&cq(a.pbrMetallicRoughness.baseColorTexture,i),a.pbrMetallicRoughness.metallicRoughnessTexture&&cq(a.pbrMetallicRoughness.metallicRoughnessTexture,i),a.normalTexture&&cq(a.normalTexture,i),a.occlusionTexture&&cq(a.occlusionTexture,i,r),a.emissionTexture&&cq(a.emissionTexture,i)}(a,i,r);if(e.children)for(let a of e.children)cZ(a,i,r)}function cH(e){if(e.meshes)for(let i of e.meshes)i.indexArray.destroy(),i.vertexArray.destroy(),i.colorArray&&i.colorArray.destroy(),i.normalArray&&i.normalArray.destroy(),i.texcoordArray&&i.texcoordArray.destroy(),i.featureArray&&i.featureArray.destroy();if(e.children)for(let i of e.children)cH(i)}function c$(e){var i;if(e.meshes)for(let r of e.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.n
7ormalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((i=r.material).pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),i.pbrMetallicRoughness.metallicRoughnessTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),i.normalTexture&&i.normalTexture.gfxTexture&&i.normalTexture.gfxTexture.destroy(),i.emissionTexture&&i.emissionTexture.gfxTexture&&i.emissionTexture.gfxTexture.destroy(),i.occlusionTexture&&i.occlusionTexture.gfxTexture&&i.occlusionTexture.gfxTexture.destroy()));if(e.children)for(let i of e.children)c$(i)}class cW{constructor(e,i,r){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=r}static create(e,i,r){let a=r||e.findDEMTileFor(i);if(!a||!a.dem)return;let n=a.dem,o=a.tileID,s=1<<i.canonical.z-o.canonical.z;return new cW(a,n.dim/8192/s,[(i.canonical.x/s-o.canonical.x)*n.dim,(i.canonical.y/s-o.canonical.y)*n.dim])}tileCoordToPixel(e,i){let r=i*this._scale+this._offset[1];return new eR(Math.floor(e*this._scale+this._offset[0]),Math.floor(r))}getElevationAt(e,i,r,a){let n=e*this._scale+this._offset[0],o=i*this._scale+this._offset[1],s=Math.floor(n),l=Math.floor(o),h=this._dem;return a=!!a,r?t$(t$(h.get(s,l,a),h.get(s,l+1,a),o-l),t$(h.get(s+1,l,a),h.get(s+1,l+1,a),o-l),n-s):h.get(s,l,a)}getElevationAtPixel(e,i,r){return this._dem.get(e,i,!!r)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*(1/ok(e))*this._dem.stride}}let cX=new Float32Array(262144),cY=new Uint8Array(262144),cK=["","wall","door","roof","window","lamp","logo"];class cJ{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:function e(i){let r=0;if(i.meshes)for(let e of i.meshes)r=Math.max(r,e.aabb.max[2]);if(i.children)for(let a of i.children)r=Math.max(r,e(a));return r}(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new sw([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0,i=new sw([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(let r of this.node.meshes)this.node.lightMeshIndex!==e&&(r.transformedAabb=sw.applyTransformFast(r.aabb,this.node.matrix),i.encapsulate(r.transformedAabb)),e++;this.aabb=i}return this.aabb}}class cQ{constructor(e,i,r,a,n,o,s){for(let l of(this.id=r,this.layers=e,this.layerIds=this.layers.map(e=>e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=cj.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=cj.HasMapboxMeshFeatures),n&&(this.modelTraits|=cj.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[],i))this.nodesInfo.push(new cJ(l)),function e(i,r,a){if(i.meshes)for(let e of i.meshes){if(e.aabb.min[0]===1/0)continue;let n=sw.applyTransform(e.aabb,i.matrix);a.insert(r,n.min[0],n.min[1],n.max[0],n.max[1])}if(i.children)for(let n of i.children)e(n,r,a)}(l,s.featureIndexArray.length,s.grid),s.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,s.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(let r of this.getNodesInfo()){let a=r.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){let i=0!==Object.keys(e).length;if(i&&!this.stateDependentLayers.length)return;let r=i?this.stateDependentLayers:this.layers;if(!eL(e,this.states))for(let i of r)this.evaluate(i,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;let i=this.getNodesInfo();
7for(let r of i){let i=r.node;this.uploaded?this.updatePbrBuffer(i):cZ(i,e,!0)}for(let e of i)cH(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(let r of e.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),i=!0);return i}needsReEvaluation(e,i,r){let a=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;if(!this.uploaded||this.dirty||a.name!==this.projection.name||c0(r.paint.get("model-color").value,o)||c0(r.paint.get("model-color-mix-intensity").value,o)||c0(r.paint.get("model-roughness").value,o)||c0(r.paint.get("model-emissive-strength").value,o)||c0(r.paint.get("model-height-based-emissive-strength-multiplier").value,o)){for(let e of(this.projection=a,this.brightness=n,this.getNodesInfo()))e.state=null;return!0}return!1}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;let r=this.getNodesInfo(),a=this.id.canonical;for(let e of r){let r=e.feature;e.evaluatedScale=i.paint.get("model-scale").evaluate(r,{},a)}}evaluate(e,i){for(let r of this.getNodesInfo()){if(!r.node.meshes)continue;let a=r.feature,n=i&&i[a.id];if(eL(n,r.state))continue;r.state=structuredClone(n);let o=r.node.meshes&&r.node.meshes[0].featureData,s=r.evaluatedColor[2],l=r.evaluatedRMEA[2],h=this.id.canonical;if(r.hasTranslucentParts=!1,o){for(let i=0;i<cK.length;i++){let o=cK[i];o.length&&(a.properties.part=o);let s=e.paint.get("model-color").evaluate(a,n,h).toRenderColor(null),l=e.paint.get("model-color-mix-intensity").evaluate(a,n,h);r.evaluatedColor[i]=[s.r,s.g,s.b,l],r.evaluatedRMEA[i][0]=e.paint.get("model-roughness").evaluate(a,n,h),r.evaluatedRMEA[i][2]=e.paint.get("model-emissive-strength").evaluate(a,n,h),r.evaluatedRMEA[i][3]=s.a,r.emissionHeightBasedParams[i]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(a,n,h),!r.hasTranslucentParts&&s.a<1&&(r.hasTranslucentParts=!0)}delete a.properties.part,function(e,i,r){let a=e.node,n=0,o=r&cj.HasMeshoptCompression;for(let r of a.meshes){if(a.lights&&a.lightMeshIndex===n||!r.featureData)continue;r.featureArray=new nG,r.featureArray.reserve(r.featureData.length);let s=i;for(let i of r.featureData){let n;let l=o?65535&i:i>>16&65535,h=o?i>>16&65535:65535&i,u=(15&h)<8?15&h:0,c=e.evaluatedRMEA[u],d=e.evaluatedColor[u],p=e.emissionHeightBasedParams[u];if(s&&2===u&&a.lights&&(n=new nG).resize(10*a.lights.length),function(e,i,r,a,n,o,s,l){let h,u,c,d,p=(61440&i|(61440&i)>>4)>>8,f=(3840&i|(3840&i)>>4)>>4,m=240&i|(240&i)>>4;r[3]>0&&(p=t$(p,255*r[0],r[3]),f=t$(f,255*r[1],r[3]),m=t$(m,255*r[2],r[3]));let _=p<<8|f,g=m<<8|Math.floor(255*a[3]),y=Math.min(Math.round(.5*eU(a[2],0,2)*255),255)<<8|15*a[0]<<4|15*a[1],x=eU(n[0],0,1),v=eU(n[1],0,1),b=eU(n[2],0,1),w=eU(n[3],0,1);if(x!==v&&s!==o&&v!==x){let e=s-o;u=1/(e*(v-x)),c=-(o+e*x)/(e*(v-x)),d=Math.pow(10,eU(n[4],-1,1)),h=255*b<<8|255*w}else h=65535,u=0,c=1,d=1;if(e.emplaceBack(_,g,y,h,u,c,d),l){let e=l.length;l.clear();for(let i=0;i<e;i++)l.emplaceBack(_,g,y,h,u,c,d)}}(r.featureArray,l,d,c,p,r.aabb.min[2],r.aabb.max[2],n),n&&s){s=!1;let e=a.meshes[a.lightMeshIndex];e.featureArray=n,e.featureArray._trim()}}r.featureArray._trim(),n++}}(r,s!==r.evaluatedColor[2]||l!==r.evaluatedRMEA[2],this.modelTraits)}else r.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(a,n,h);r.evaluatedScale=e.paint.get("model-scale").evaluate(a,n,h),this.updatePbrBuffer(r.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,r,a){let n=e.findDEMTileFor(r);if(n&&(n.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;let i=cW.create(e,r,n);if(!i)return;for(let n of(this.modelTraits&cj.HasMapboxMeshFeatures&&this.updateDEM(e,i,r,a),this.getNodesInfo())){let e=n.node;if(!e.footprint||!e.footprint.vertices||!e.footprint.vertices.length)continue;let r=e.footprint.vertices,a=i.getElevationAt(r[0].x,r[0].y,!0,!0);for(let e=1;e<r.length;e++)a=Math.min(a,i.getElevationAt(r[e].x,r[e].y,!0,!0));e.elevation=a}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,r,a){let n=i._dem._modifiedForSources[a];if(void 0===n&&(i._dem._modifiedForSources[a]=[],n=i._dem._modifiedForSources[a]),n.includes(r.canonical))return;let o=i._dem.dim;n.push(r.canonical);let s=!1;for(let e of this.getNodesInfo()){let r=e.node;if(!r.footprint||!r.footprint.grid)continue;let a=r.footprint.grid,n=i.tileCoordToPixel(a.min.x,a.min.y),l=i.tileCoordToPixel(a.max.x,a.max.y),h=Math.min(Math.min(o-l.y,n.x),Math.min(n.y,o-l.x));if(h<0)continue;
7let u=eU(h,2,5),c=Math.max(0,n.x-u),d=Math.max(0,n.y-u),p=Math.min(l.x+u,o-1),f=Math.min(l.y+u,o-1);for(let e=d;e<=f;++e)for(let i=c;i<=p;++i)cY[e*o+i]=255;let m=0,_=0;for(let e=0;e<a.cellsY;++e)for(let r=0;r<a.cellsX;++r){if(!a.cells[e*a.cellsX+r])continue;let n=i.tileCoordToPixel(a.min.x+r/a.xScale,a.min.y+e/a.yScale),s=i.tileCoordToPixel(a.min.x+(r+1)/a.xScale,a.min.y+(e+1)/a.yScale);for(let e=n.y;e<=Math.min(s.y+1,o-1);++e)for(let r=n.x;r<=Math.min(s.x+1,o-1);++r)255===cY[e*o+r]&&(cY[e*o+r]=0,m+=i.getElevationAtPixel(r,e),_++)}let g=m/_;c=Math.max(1,n.x-u),d=Math.max(1,n.y-u),p=Math.min(l.x+u,o-2),f=Math.min(l.y+u,o-2),s=!0;for(let e=d;e<=f;++e)for(let r=c;r<=p;++r)0===cY[e*o+r]&&(cX[e*o+r]=i._dem.set(r,e,g));for(let e=1;e<u;++e){c=Math.max(1,n.x-e),d=Math.max(1,n.y-e),p=Math.min(l.x+e,o-2),f=Math.min(l.y+e,o-2);for(let r=d;r<=f;++r)for(let a=c;a<=p;++a){let n=r*o+a;if(255===cY[n]){let s=0,l=0,h=-1,c=-1;for(let i=-1;i<=1;++i)for(let n=-1;n<=1;++n){let u=(r+i)*o+a+n;if(cY[u]>=e)continue;let d=cX[u],p=Math.abs(d);p>l&&(s=d,l=p,h=n,c=i)}if(l>.1){let o=1-(e+.5*Math.abs(h*c))/u,l=i._dem.get(a,r)+s*o,d=i._dem.get(a+h,r+c),p=i._dem.get(a-h,r-c,!0);(l-d)*(l-p)>0&&(l=(d+p)/2),cX[n]=i._dem.set(a,r,l),cY[n]=e}}}}}s&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=to.now())}getNodesInfo(){return this.nodesInfo}destroy(){for(let e of this.getNodesInfo())cH(e.node),c$(e.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped()),a=this.getNodesInfo();for(let e=0;e<this.nodesInfo.length;e++){let i=a[e].node;a[e].hiddenByReplacement=!!i.footprint&&!r.find(e=>e.footprint===i.footprint)}}getHeightAtTileCoord(e,i){let r=this.getNodesInfo(),a=[],n=[0,0,0],o=eP.mat4.identity([]);for(let s=0;s<this.nodesInfo.length;s++){let l=r[s],h=l.node.meshes[0],u=h.transformedAabb;if(e<u.min[0]||i<u.min[1]||e>u.max[0]||i>u.max[1])continue;if(!0===l.node.hidden)return{height:1/0,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]};eP.mat4.invert(o,l.node.matrix),n[0]=e,n[1]=i,eP.vec3.transformMat4(n,n,o);let c=(n[0]-h.aabb.min[0])/(h.aabb.max[0]-h.aabb.min[0])*64|0,d=64*Math.min(63,(n[1]-h.aabb.min[1])/(h.aabb.max[1]-h.aabb.min[1])*64|0)+Math.min(63,c),p=h.heightmap[d];if(!(p<0&&l.node.footprint)){if(l.hiddenByReplacement)return;return{height:p,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]}}if(l.node.footprint.grid.query(new eR(e,i),new eR(e,i),a),a.length>0)return{height:void 0,maxHeight:l.feature.properties.height,hidden:l.hiddenByReplacement,verticalScale:l.evaluatedScale[2]}}}}function c0(e,i){return!e.isLightConstant&&i}function c1(e,i,r,a){let n=1<<e.z;i.lat=oV((a/8192+e.y)/n),i.lng=oN((r/8192+e.x)/n)}ab(cQ,"Tiled3dModelBucket",{omit:["layers"]}),ab(cJ,"Tiled3dModelFeature");let c2={circle:class extends ns{constructor(e,i,r,a){super(e,{layout:d||(d=new a1({"circle-sort-key":new aQ(a2.layout_circle["circle-sort-key"]),visibility:new aJ(a2.layout_circle.visibility)})),paint:p||(p=new a1({"circle-radius":new aQ(a2.paint_circle["circle-radius"]),"circle-color":new aQ(a2.paint_circle["circle-color"]),"circle-blur":new aQ(a2.paint_circle["circle-blur"]),"circle-opacity":new aQ(a2.paint_circle["circle-opacity"]),"circle-translate":new aJ(a2.paint_circle["circle-translate"]),"circle-translate-anchor":new aJ(a2.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new aJ(a2.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new aJ(a2.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new aQ(a2.paint_circle["circle-stroke-width"]),"circle-stroke-color":new aQ(a2.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new aQ(a2.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new aJ(a2.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}createBucket(e){return new oJ(e)}queryRadius(e){return se("circle-radius",this,e)+se("circle-stroke-width",this,e)+st(this.paint.get("circle-translate"))}queryIntersectsFeature(e,i,r,a,n,o,s,l){let h=sr(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(i,r)+this.paint.get("circle-stroke-width").evaluate(i,r);return sY(e,a,o,s,l,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,u)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,i,r){let a=sX(this);return{config:new ow(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}},heatmap:class extends ns{createBucket(e){return new sQ(e)}
7constructor(e,i,r,a){super(e,{layout:f||(f=new a1({visibility:new aJ(a2.layout_heatmap.visibility)})),paint:m||(m=new a1({"heatmap-radius":new aQ(a2.paint_heatmap["heatmap-radius"]),"heatmap-weight":new aQ(a2.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new aJ(a2.paint_heatmap["heatmap-intensity"]),"heatmap-color":new a0(a2.paint_heatmap["heatmap-color"]),"heatmap-opacity":new aJ(a2.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=s6({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(e){return se("heatmap-radius",this,e)}queryIntersectsFeature(e,i,r,a,n,o,s,l){let h=this.paint.get("heatmap-radius").evaluate(i,r);return sY(e,a,o,s,l,!0,!0,new eR(0,0),h)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,i,r){return"heatmap"===e?{config:new ow(this,{zoom:i,lut:r}),overrideFog:!1}:{}}},hillshade:class extends ns{constructor(e,i,r,a){super(e,{layout:_||(_=new a1({visibility:new aJ(a2.layout_hillshade.visibility)})),paint:g||(g=new a1({"hillshade-illumination-direction":new aJ(a2.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new aJ(a2.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new aJ(a2.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new aJ(a2.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new aJ(a2.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new aJ(a2.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new aJ(a2.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(e,i,r){return{overrideFog:!1}}},fill:class extends ns{constructor(e,i,r,a){super(e,{layout:y||(y=new a1({"fill-sort-key":new aQ(a2.layout_fill["fill-sort-key"]),visibility:new aJ(a2.layout_fill.visibility),"fill-elevation-reference":new aJ(a2.layout_fill["fill-elevation-reference"])})),paint:x||(x=new a1({"fill-antialias":new aJ(a2.paint_fill["fill-antialias"]),"fill-opacity":new aQ(a2.paint_fill["fill-opacity"]),"fill-color":new aQ(a2.paint_fill["fill-color"]),"fill-outline-color":new aQ(a2.paint_fill["fill-outline-color"]),"fill-translate":new aJ(a2.paint_fill["fill-translate"]),"fill-translate-anchor":new aJ(a2.paint_fill["fill-translate-anchor"]),"fill-pattern":new aQ(a2.paint_fill["fill-pattern"]),"fill-emissive-strength":new aJ(a2.paint_fill["fill-emissive-strength"]),"fill-z-offset":new aQ(a2.paint_fill["fill-z-offset"]),"fill-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}getProgramIds(){let e=this.paint.get("fill-pattern"),i=e&&e.constantOr(1),r=[i?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(i&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getDefaultProgramParams(e,i,r){return{config:new ow(this,{zoom:i,lut:r}),overrideFog:!1}}recalculate(e,i){super.recalculate(e,i);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new lx(e)}queryRadius(){return st(this.paint.get("fill-translate"))}queryIntersectsFeature(e,i,r,a,n,o){return!e.queryGeometry.isAboveHorizon&&o0(si(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a)}isTileClipped(){return!0}is3D(){return 0!==this.paint.get("fill-z-offset").constantOr(1)}},"fill-extrusion":class extends ns{constructor(e,i,r,a){super(e,{layout:w||(w=new a1({visibility:new aJ(a2["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new aJ(a2["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:T||(T=new a1({"fill-extrusion-opacity":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new aQ(a2["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new aQ(a2["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new aQ(a2["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new aQ(a2["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new aQ(a2["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new aQ(a2["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new aQ(a2["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new aQ(a2["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new aJ(a2["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new hh(e)}queryRadius(){return st(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(e,i,r,a,n,o,s,l,h){var u,c,d,p;let f=sr(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),m=this.paint.get("fill-extrusion-height").evaluate(i,r),_=this.paint.get("fill-extrusion-base").evaluate(i,r),g=[0,0],y=l&&o.elevation,x=o.elevation?o.elevation.exaggeration():1,v=e.tile.getBucket(this);if(y&&v instanceof hh){let e=v.centroidVertexArray,i=h+1;i<e.length&&(g[0]=e.geta_centroid_pos0(i),g[1]=e.geta_centroid_pos1(i))}if(0===g[0]&&1===g[1])return!1;"globe"===o.projection.name&&(a=hg([a],[new eR(0,0),new eR(8192,8192)],e.tileID.canonical).map(e=>e.polygon).flat());let[b,w]=(u=a,c=y?l:null,d=o.center.lat,p=e.tileID.canonical,"globe"===o.projection.name?function(e,i,r,a,n,o,s,l,h,u,c){let d=[],p=[],f=e.projection.upVectorScale(c,e.center.lat,e.worldSize).metersToTile,m=[0,0,0,1],_=[0,0,0,1],g=(e,i,r,a)=>{e[0]=i,e[1]=r,e[2]=a,e[3]=1},y=h_();for(let x of(r>0&&(r+=y),a+=y,i)){let i=[],y=[];for(let d of x){let p=d.x+n.x,x=d.y+n.y,v=e.projection.projectTilePoint(p,x,c),b=e.projection.upVector(c,d.x,d.y),w=r,T=a;if(s){let e=hv(p,x,r,a,s,l,h,u);w+=e.base,T+=e.top}0!==r?g(m,v.x+b[0]*f*w,v.y+b[1]*f*w,v.z+b[2]*f*w):g(m,v.x,v.y,v.z),g(_,v.x+b[0]*f*T,v.y+b[1]*f*T,v.z+b[2]*f*T),eP.vec3.transformMat4(m,m,o),eP.vec3.transformMat4(_,_,o),i.push(new lj(m[0],m[1],m[2])),y.push(new lj(_[0],_[1],_[2]))}d.push(i),p.push(y)}
7return[d,p]}(o,u,_,m,f,s,c,g,x,d,p):c?function(e,i,r,a,n,o,s,l,h){let u=[],c=[],d=[0,0,0,1];for(let p of e){let e=[],f=[];for(let u of p){let c=u.x+a.x,p=u.y+a.y,m=hv(c,p,i,r,o,s,l,h);d[0]=c,d[1]=p,d[2]=m.base,d[3]=1,eP.vec4.transformMat4(d,d,n),d[3]=Math.max(d[3],1e-5);let _=new lj(d[0]/d[3],d[1]/d[3],d[2]/d[3]);d[0]=c,d[1]=p,d[2]=m.top,d[3]=1,eP.vec4.transformMat4(d,d,n),d[3]=Math.max(d[3],1e-5);let g=new lj(d[0]/d[3],d[1]/d[3],d[2]/d[3]);e.push(_),f.push(g)}u.push(e),c.push(f)}return[u,c]}(u,_,m,f,s,c,g,x,d):function(e,i,r,a,n){let o=[],s=[],l=n[8]*i,h=n[9]*i,u=n[10]*i,c=n[11]*i,d=n[8]*r,p=n[9]*r,f=n[10]*r,m=n[11]*r;for(let i of e){let e=[],r=[];for(let o of i){let i=o.x+a.x,s=o.y+a.y,_=n[0]*i+n[4]*s+n[12],g=n[1]*i+n[5]*s+n[13],y=n[2]*i+n[6]*s+n[14],x=n[3]*i+n[7]*s+n[15],v=_+l,b=g+h,w=y+u,T=Math.max(x+c,1e-5),S=_+d,M=g+p,E=y+f,A=Math.max(x+m,1e-5);e.push(new lj(v/T,b/T,w/T)),r.push(new lj(S/A,M/A,E/A))}o.push(e),s.push(r)}return[o,s]}(u,_,m,f,s)),T=e.queryGeometry;return function(e,i,r){let a=1/0;o0(r,i)&&(a=hx(r,i[0]));for(let n=0;n<i.length;n++){let o=i[n],s=e[n];for(let e=0;e<o.length-1;e++){let i=o[e],n=[i,o[e+1],s[e+1],s[e],i];oQ(r,n)&&(a=Math.min(a,hx(r,n)))}}return a!==1/0&&a}(b,w,T.isPointQuery()?T.screenBounds:T.screenGeometry)}},line:class extends ns{constructor(e,i,r,a){let n=hB();super(e,n,i,r,a),n.layout&&(this.layout=new aK(n.layout)),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof rg,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=(A||((A=new hN(hB().paint.properties["line-width"].specification)).useIntegerZoom=!0),A).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new hP(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,i,r){let a=hk(this);return{config:new ow(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}queryRadius(e){var i,r;return i=se("line-width",this,e),((r=se("line-gap-width",this,e))>0?r+2*i:i)/2+Math.abs(se("line-offset",this,e))+st(this.paint.get("line-translate"))}queryIntersectsFeature(e,i,r,a,n,o){var s,l;if(e.queryGeometry.isAboveHorizon)return!1;let h=si(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=e.pixelToTileUnitsFactor/2*(s=this.paint.get("line-width").evaluate(i,r),(l=this.paint.get("line-gap-width").evaluate(i,r))>0?l+2*s:s),c=this.paint.get("line-offset").evaluate(i,r);return c&&(a=function(e,i){let r=[],a=new eR(0,0);for(let n=0;n<e.length;n++){let o=e[n],s=[];for(let e=0;e<o.length;e++){let r=o[e],n=o[e+1],l=0===e?a:r.sub(o[e-1])._unit()._perp(),h=e===o.length-1?a:n.sub(r)._unit()._perp(),u=l._add(h)._unit();u._mult(1/(u.x*h.x+u.y*h.y)),s.push(u._mult(i)._add(r))}r.push(s)}return r}(a,c*e.pixelToTileUnitsFactor)),function(e,i,r){for(let a=0;a<i.length;a++){let n=i[a];if(e.length>=3){for(let i=0;i<n.length;i++)if(o5(e,n[i]))return!0}if(function(e,i,r){if(e.length>1){if(o1(e,i))return!0;for(let a=0;a<i.length;a++)if(o2(i[a],e,r))return!0}for(let a=0;a<e.length;a++)if(o2(e[a],i,r))return!0;return!1}(e,n,r))return!0}return!1}(h,a,u)}isTileClipped(){return!0}isDraped(e){let i=this.layout.get("line-z-offset"),r=i.isConstant()&&!i.constantOr(0),a=this.layout.get("line-elevation-reference");return!("sea"===a||"ground"===a)&&(r||"none"!==a)}},symbol:cn,background:class extends ns{constructor(e,i,r,a){super(e,{layout:z||(z=new a1({visibility:new aJ(a2.layout_background.visibility)})),paint:D||(D=new a1({"background-pitch-alignment":new aJ(a2.paint_background["background-pitch-alignment"]),"background-color":new aJ(a2.paint_background["background-color"]),"background-pattern":new aJ(a2.paint_background["background-pattern"]),"background-opacity":new aJ(a2.paint_background["background-opacity"]),"background-emissive-strength":new aJ(a2.paint_background["background-emissive-strength"]),"background-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,i,r){return{overrideFog:!1}}is3D(){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:cm,"raster-particle":c_,sky:class extends ns{constructor(e,i,r,a){super(e,{layout:F||(F=new a1({visibility:new aJ(a2.layout_sky.visibility)})),paint:B||(B=new a1({"sky-type":new aJ(a2.paint_sky["sky-type"]),"sky-atmosphere-sun":new aJ(a2.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new aJ(a2.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new aJ(a2.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new aJ(a2.paint_sky["sky-gradient-radius"]),"sky-gradient":new a0(a2.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new aJ(a2.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new aJ(a2.paint_sky["sky-atmosphere-color"]),"sky-opacity":new aJ(a2.paint_sky["sky-opacity"]),"sky-gradient-use
7-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=s6({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){let i=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==i.azimuthal||this._lightPosition.polar!==i.polar}return!1}getCenter(e,i){if("atmosphere"===this.paint.get("sky-type")){let r=this.paint.get("sky-atmosphere-sun"),a=!r,n=e.style.light,o=n.properties.get("position");return a&&"viewport"===n.properties.get("anchor")&&e1("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?cy(o.azimuthal,90-o.polar,i):cy(r[0],90-r[1],i)}let r=this.paint.get("sky-gradient-center");return cy(r[0],90-r[1],i)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends ns{constructor(e,i,r,a){super(e,{paint:N||(N=new a1({}))},i,null)}},model:class extends ns{constructor(e,i,r,a){super(e,{layout:V||(V=new a1({visibility:new aJ(a2.layout_model.visibility),"model-id":new aQ(a2.layout_model["model-id"])})),paint:U||(U=new a1({"model-opacity":new aQ(a2.paint_model["model-opacity"]),"model-rotation":new aQ(a2.paint_model["model-rotation"]),"model-scale":new aQ(a2.paint_model["model-scale"]),"model-translation":new aQ(a2.paint_model["model-translation"]),"model-color":new aQ(a2.paint_model["model-color"]),"model-color-mix-intensity":new aQ(a2.paint_model["model-color-mix-intensity"]),"model-type":new aJ(a2.paint_model["model-type"]),"model-cast-shadows":new aJ(a2.paint_model["model-cast-shadows"]),"model-receive-shadows":new aJ(a2.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new aJ(a2.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new aQ(a2.paint_model["model-emissive-strength"]),"model-roughness":new aQ(a2.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new aQ(a2.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new aJ(a2.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new aJ(a2.paint_model["model-front-cutoff"]),"model-color-use-theme":new aQ({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new cU(e)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return e instanceof cQ?8191:0}queryIntersectsFeature(e,i,r,a,n,o){if(!this.modelManager)return!1;let s=this.modelManager,l=e.tile.getBucket(this);if(!(l&&l instanceof cU))return!1;for(let r in l.instancesPerModel){let a=l.instancesPerModel[r],n=void 0!==i.id?i.id:i.properties&&i.properties.hasOwnProperty("id")?i.properties.id:void 0;if(a.idToFeaturesIndex.hasOwnProperty(n)){let i=a.features[a.idToFeaturesIndex[n]],h=s.getModel(r,this.scope);if(!h)return!1;let u=eP.mat4.create(),c=new oL(0,0),d=l.canonical,p=Number.MAX_VALUE;for(let r=0;r<i.instancedDataCount;++r){let n=16*(i.instancedDataOffset+r),s=a.instancedDataArray.float32,l=[s[n+4],s[n+5],s[n+6]];c1(d,c,s[n],0|s[n+1]),cG(u,h,o,c,i.rotation,i.scale,l,!1,!1,!1),"globe"===o.projection.name&&(u=cA(u,o));let f=eP.mat4.multiply([],o.projMatrix,u),m=e.queryGeometry,_=cI(m.isPointQuery()?m.screenBounds:m.screenGeometry,o,f,h.aabb);null!=_&&(p=Math.min(_,p))}return p!==Number.MAX_VALUE&&p}}return!1}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){let i=this._transitionablePaint._values[e];return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof af}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends ns{constructor(e,i,r,a){super(e,{layout:v||(v=new a1({"clip-layer-types":ne
7w aJ(a2.layout_clip["clip-layer-types"]),"clip-layer-scope":new aJ(a2.layout_clip["clip-layer-scope"])})),paint:b||(b=new a1({}))},i,r,a)}recalculate(e,i){super.recalculate(e,i)}createBucket(e){return new lw(e)}isTileClipped(){return!0}is3D(){return!0}}};class c3{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{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(){this._channel=void 0,this._callback=()=>{}}}class c4{constructor(){this.tasks={},this.taskQueue=[],eX(["process"],this),this.invoker=new c3(this.process),this.nextId=0}add(e,i){let r=this.nextId++,a=function({type:e,isSymbolTile:i,zoom:r}){return r=r||0,"message"===e?0:"maybePrepare"!==e||i?"parseTile"!==e||i?"parseTile"===e&&i?300-r:"maybePrepare"===e&&i?400-r:500:200-r:100-r}(i);return 0===a?(e(),null):(this.tasks[r]={fn:e,metadata:i,priority:a,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}})}process(){{if(this.taskQueue=this.taskQueue.filter(e=>!!this.tasks[e]),!this.taskQueue.length)return;let e=this.pick();if(null===e)return;let i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}}pick(){let e=null,i=1/0;for(let r=0;r<this.taskQueue.length;r++){let a=this.tasks[this.taskQueue[r]];a.priority<i&&(i=a.priority,e=r)}if(null===e)return null;let r=this.taskQueue[e];return this.taskQueue.splice(e,1),r}remove(){this.invoker.remove()}}class c5{constructor(e,i,r){this.target=e,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},eX(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new c4}send(e,i,r,a,n=!1,o){let s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=o,this.callbacks[s]=r);let l=new Set;return this.target.postMessage({id:s,type:e,hasCallback:!!r,targetMapId:a,mustQueue:n,sourceMapId:this.mapId,data:aS(i,l)},l),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){let i=e.data,r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId)){if("<cancel>"===i.type){let e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e.cancel()}else if(i.mustQueue||e4()){let e=this.callbacks[r],a=this.scheduler.add(()=>this.processTask(r,i),e&&e.metadata||{type:"message"});a&&(this.cancelCallbacks[r]=a)}else this.processTask(r,i)}}processTask(e,i){if(delete this.cancelCallbacks[e],"<response>"===i.type){let r=this.callbacks[e];delete this.callbacks[e],r&&(i.error?r(aM(i.error)):r(null,aM(i.data)))}else{let r=new Set,a=i.hasCallback?(i,a)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:i?aS(i):null,data:aS(a,r)},r)}:()=>{},n=aM(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,n,a);else if(this.parent.getWorkerSource){let e=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,e[0],n.source,n.scope)[e[1]](n,a)}else a(Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var c6={workerUrl:"",workerClass:null,workerParams:void 0};let c8="mapboxgl_preloaded_worker_pool";class c9{constructor(){this.active={}}acquire(e,i=c9.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(null!=c6.workerClass?new c6.workerClass:new self.Worker(c6.workerUrl,c6.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[c8]}numActive(){return Object.keys(this.active).length}}c9.workerCount=2;class c7{constructor(e,i,r="Worker",a=c9.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=e$();let n=this.workerPool.acquire(this.id,a);for(let e=0;e<n.length;e++){let a=new c7.Actor(n[e],i,this.id);a.name=`${r} ${e}`,this.actors.push(a)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,r){eq(this.actors,(r,a)=>{r.send(e,i,a)},r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}
7remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}function de(){return j||(j=new c9),j}c7.Actor=c5;let dt=new tZ(0,0,0);var di=((Z=di||{})[Z.PATH_RULE_UNSPECIFIED=0]="PATH_RULE_UNSPECIFIED",Z[Z.PATH_RULE_NON_ZERO=1]="PATH_RULE_NON_ZERO",Z[Z.PATH_RULE_EVEN_ODD=2]="PATH_RULE_EVEN_ODD",Z),dr=((H=dr||{})[H.LINE_CAP_UNSPECIFIED=0]="LINE_CAP_UNSPECIFIED",H[H.LINE_CAP_BUTT=1]="LINE_CAP_BUTT",H[H.LINE_CAP_ROUND=2]="LINE_CAP_ROUND",H[H.LINE_CAP_SQUARE=3]="LINE_CAP_SQUARE",H),da=(($=da||{})[$.LINE_JOIN_UNSPECIFIED=0]="LINE_JOIN_UNSPECIFIED",$[$.LINE_JOIN_MITER=1]="LINE_JOIN_MITER",$[$.LINE_JOIN_MITER_CLIP=2]="LINE_JOIN_MITER_CLIP",$[$.LINE_JOIN_ROUND=3]="LINE_JOIN_ROUND",$[$.LINE_JOIN_BEVEL=4]="LINE_JOIN_BEVEL",$),dn=((W=dn||{})[W.PAINT_ORDER_UNSPECIFIED=0]="PAINT_ORDER_UNSPECIFIED",W[W.PAINT_ORDER_FILL_AND_STROKE=1]="PAINT_ORDER_FILL_AND_STROKE",W[W.PAINT_ORDER_STROKE_AND_FILL=2]="PAINT_ORDER_STROKE_AND_FILL",W),ds=((X=ds||{})[X.PATH_COMMAND_UNSPECIFIED=0]="PATH_COMMAND_UNSPECIFIED",X[X.PATH_COMMAND_MOVE=1]="PATH_COMMAND_MOVE",X[X.PATH_COMMAND_LINE=2]="PATH_COMMAND_LINE",X[X.PATH_COMMAND_QUAD=3]="PATH_COMMAND_QUAD",X[X.PATH_COMMAND_CUBIC=4]="PATH_COMMAND_CUBIC",X[X.PATH_COMMAND_CLOSE=5]="PATH_COMMAND_CLOSE",X),dl=((Y=dl||{})[Y.MASK_TYPE_UNSPECIFIED=0]="MASK_TYPE_UNSPECIFIED",Y[Y.MASK_TYPE_LUMINANCE=1]="MASK_TYPE_LUMINANCE",Y[Y.MASK_TYPE_ALPHA=2]="MASK_TYPE_ALPHA",Y);function dh(e,i,r){var a;1===e&&i.icons.push((a=r.readVarint()+r.pos,function(e){if(e.usvg_tree.height||(e.usvg_tree.height=e.usvg_tree.width),!e.metadata)return e;let{metadata:i}=e;if(i.content_area){let{content_area:r}=i;null==r.top&&(r.top=r.left),null==r.width&&(r.width=e.usvg_tree.width),null==r.height&&(r.height=r.width)}return i.stretch_x&&i.stretch_x.length&&du(i,"x"),i.stretch_y&&i.stretch_y.length&&du(i,"y"),e}(r.readFields(dc,{name:void 0},a))))}function du(e,i){let r=[],a=e[`stretch_${i}`],n=null;for(let e=0;e<a.length;e++)null===n?n=0===r.length?a[0]:r[r.length-1][1]+a[e]:(r.push([n,n+a[e]]),n=null);e[`stretch_${i}_areas`]=r}function dc(e,i,r){var a,n;1===e?i.name=r.readString():2===e?i.metadata=(a=r.readVarint()+r.pos,r.readFields(dd,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)):3===e&&(i.usvg_tree=(n=r.readVarint()+r.pos,r.readFields(dm,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},n)),i.data="usvg_tree")}function dd(e,i,r){var a,n;1===e?i.stretch_x=r.readPackedVarint():2===e?i.stretch_y=r.readPackedVarint():3===e?i.content_area=(a=r.readVarint()+r.pos,r.readFields(dp,{left:0},a)):4===e&&i.variables.push((n=r.readVarint()+r.pos,r.readFields(df,{name:void 0},n)))}function dp(e,i,r){1===e?i.left=r.readVarint():2===e?i.width=r.readVarint():3===e?i.top=r.readVarint():4===e&&(i.height=r.readVarint())}function df(e,i,r){1===e?i.name=r.readString():2===e&&(i.rgb_color=dT(r.readVarint()),i.value="rgb_color")}function dm(e,i,r){var a,n,o;1===e?i.width=i.height=r.readVarint():2===e?i.height=r.readVarint():3===e?i.children.push(d_(r,r.readVarint()+r.pos)):4===e?i.linear_gradients.push((a=r.readVarint()+r.pos,r.readFields(dM,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a))):5===e?i.radial_gradients.push((n=r.readVarint()+r.pos,r.readFields(dI,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},n))):7===e?i.clip_paths.push((o=r.readVarint()+r.pos,r.readFields(dC,{children:[]},o))):8===e&&i.masks.push(function(e,i){let r=e.readFields(dP,{left:0,width:20,mask_type:1,children:[]},i);return null==r.height&&(r.height=r.width),null==r.top&&(r.top=r.left),r}(r,r.readVarint()+r.pos))}function d_(e,i){return e.readFields(dg,{},i)}function dg(e,i,r){var a,n;1===e?(i.group=(a=r.readVarint()+r.pos,r.readFields(dy,{opacity:255,children:[]},a)),i.node="group"):2===e&&(i.path=(n=r.readVarint()+r.pos,r.readFields(db,{paint_order:1,commands:[],step:1,diffs:[],rule:1},n)),i.node="path")}function dy(e,i,r){1===e?i.transform=dx(r,r.readVarint()+r.pos):2===e?i.opacity=r.readVarint():5===e?i.clip_path_idx=r.readVarint():6===e?i.mask_idx=r.readVarint():7===e&&i.children.push(d_(r,r.readVarint()+r.pos))}function dx(e,i){return e.readFields(dv,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},i)}function dv(e,i,r){1===e?i.sx=r.readFloat():2===e?i.ky=r.readFloat():3===e?i.kx=r.readFloat():4===e?i.sy=r.readFloat():5===e?i.tx=r.readFloat():6===e&&(i.ty=r.readFloat())}function db(e,i,r){var a,n;1===e?i.fill=(a=r.readVarint()+r.pos,r.readFields(dw,{rgb_color:dt,paint:"rgb_color",opacity:255},a)):2===e?i.stroke=(n=r.readVarint()+r.pos,r.readFields(dS,{rgb_color:dt,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},n)):3===e?i.paint_order=r.readVarint():5===e?r.readPackedVarint(i.commands):6===e?i.step=r.readFloat():7===e?r.readPackedSVarint(i.diffs):8===e&&(i.rule=r.readVarint())}function dw(e,i,r){1===e?(i.rgb_color=dT(r.readVarint()),i.paint="rgb_color"):2===e?(i.linear_gradient_idx=r.readVarint(),i.paint="linear_gradient_idx"):3===e?(i.radial_gradient_idx=r.readVarint(),i.paint="radial_gradient_idx"):5===e&&(i.op
7acity=r.readVarint())}function dT(e){return new tZ((e>>16&255)/255,(e>>8&255)/255,(255&e)/255,1)}function dS(e,i,r){1===e?(i.rgb_color=dT(r.readVarint()),i.paint="rgb_color"):2===e?(i.linear_gradient_idx=r.readVarint(),i.paint="linear_gradient_idx"):3===e?(i.radial_gradient_idx=r.readVarint(),i.paint="radial_gradient_idx"):5===e?r.readPackedFloat(i.dasharray):6===e?i.dashoffset=r.readFloat():7===e?i.miterlimit=r.readFloat():8===e?i.opacity=r.readVarint():9===e?i.width=r.readFloat():10===e?i.linecap=r.readVarint():11===e&&(i.linejoin=r.readVarint())}function dM(e,i,r){1===e?i.transform=dx(r,r.readVarint()+r.pos):2===e?i.spread_method=r.readVarint():3===e?i.stops.push(dE(r,r.readVarint()+r.pos)):4===e?i.x1=r.readFloat():5===e?i.y1=r.readFloat():6===e?i.x2=r.readFloat():7===e&&(i.y2=r.readFloat())}function dE(e,i){return e.readFields(dA,{offset:0,opacity:255,rgb_color:dt},i)}function dA(e,i,r){1===e?i.offset=r.readFloat():2===e?i.opacity=r.readVarint():3===e&&(i.rgb_color=dT(r.readVarint()))}function dI(e,i,r){1===e?i.transform=dx(r,r.readVarint()+r.pos):2===e?i.spread_method=r.readVarint():3===e?i.stops.push(dE(r,r.readVarint()+r.pos)):4===e?i.cx=r.readFloat():5===e?i.cy=r.readFloat():6===e?i.r=r.readFloat():7===e?i.fx=r.readFloat():8===e?i.fy=r.readFloat():9===e&&(i.fr=r.readFloat())}function dC(e,i,r){1===e?i.transform=dx(r,r.readVarint()+r.pos):2===e?i.clip_path_idx=r.readVarint():3===e&&i.children.push(d_(r,r.readVarint()+r.pos))}function dP(e,i,r){1===e?i.left=i.top=r.readFloat():2===e?i.width=i.height=r.readFloat():3===e?i.top=r.readFloat():4===e?i.height=r.readFloat():5===e?i.mask_type=r.readVarint():6===e?i.mask_idx=r.readVarint():7===e&&i.children.push(d_(r,r.readVarint()+r.pos))}class dz{static calculate(e,i){let r=new Map,a=new Map;if(0===Object.keys(e).length)return r;for(let[n,o]of(i.forEach(e=>{a.set(e.name,e.rgb_color||new tZ(0,0,0))}),Object.entries(e)))a.has(n)?r.set(a.get(n).toStringPremultipliedAlpha(),o):console.warn(`Ignoring unknown image variable "${n}"`);return r}}function dD(e,i=255,r){let a=e.toStringPremultipliedAlpha(),n=r.has(a)?r.get(a).clone():e.clone();return n.a=i/255,n.toString()}function dR(e,i){if(!tn()){let r=document.createElement("canvas");return r.width=e,r.height=i,r}return new OffscreenCanvas(e,i)}function dL(e,i){let r=dz.calculate(i.params,e.metadata?e.metadata.variables:[]),a=e.usvg_tree,n=a.width,o=a.height,s=i.transform?i.transform:new DOMMatrix,l=Math.max(1,Math.round(n*s.a)),h=Math.max(1,Math.round(o*s.d)),u=new DOMMatrix([l/n,0,0,h/o,0,0]),c=dR(l,h).getContext("2d");return function e(i,r,a,n,o){for(let s of n.children)(function i(r,a,n,o,s){o.group?(r.save(),function(r,a,n,o,s){var l,h;let u=null!=o.mask_idx?n.masks[o.mask_idx]:null,c=null!=o.clip_path_idx?n.clip_paths[o.clip_path_idx]:null;if(o.transform&&(a=dN(o.transform).preMultiplySelf(a)),l=null!=c,h=null!=u,255===o.opacity&&!l&&!h)return void e(r,a,n,o,s);let d=dR(r.canvas.width,r.canvas.height),p=d.getContext("2d");c&&function e(i,r,a,n){let o;let s=dN(n.transform).preMultiplySelf(r),l=null!=n.clip_path_idx?a.clip_paths[n.clip_path_idx]:null;l&&e(i,s,a,l);let h=new Path2D;for(let e of n.children)!function e(i,r){if(i.path){let e=i.path;h.addPath(dV(e),r),e.rule===di.PATH_RULE_EVEN_ODD&&(o="evenodd")}else if(i.group){let a=i.group.transform?dN(i.group.transform).preMultiplySelf(r):r;for(let r of i.group.children)e(r,a)}}(e,s);i.clip(h,o)}(p,a,n,c),e(p,a,n,o,s),u&&function e(r,a,n,o,s){if(0===o.children.length)return;let l=null!=o.mask_idx?n.masks[o.mask_idx]:null;l&&e(r,a,n,l,s);let h=r.canvas.width,u=r.canvas.height,c=dR(h,u),d=c.getContext("2d"),p=o.width,f=o.height,m=o.left,_=o.top,g=new Path2D,y=new Path2D;for(let e of(y.rect(m,_,p,f),g.addPath(y,a),d.clip(g),o.children))i(d,a,n,e,s);let x=d.getImageData(0,0,h,u),v=x.data;if(o.mask_type===dl.MASK_TYPE_LUMINANCE)for(let e=0;e<v.length;e+=4)v[e+3]=v[e+3]/255*(.2126*v[e]+.7152*v[e+1]+.0722*v[e+2]);d.putImageData(x,0,0),r.globalCompositeOperation="destination-in",r.drawImage(c,0,0)}(p,a,n,u,s),r.globalAlpha=o.opacity/255,r.drawImage(d,0,0)}
7(r,a,n,o.group,s),r.restore()):o.path&&(r.save(),function(e,i,r,a,n){let o=dV(a);e.setTransform(i),a.paint_order===dn.PAINT_ORDER_FILL_AND_STROKE?(dO(e,r,a,o,n),dk(e,r,a,o,n)):(dk(e,r,a,o,n),dO(e,r,a,o,n))}(r,a,n,o.path,s),r.restore())})(i,r,a,s,o)}(c,u,a,a,r),c.getImageData(0,0,l,h)}function dO(e,i,r,a,n){let o;let s=r.fill;if(!s)return;let l=s.opacity/255;switch(s.paint){case"rgb_color":e.fillStyle=dD(s.rgb_color,s.opacity,n);break;case"linear_gradient_idx":e.fillStyle=dF(e,i.linear_gradients[s.linear_gradient_idx],l,n);break;case"radial_gradient_idx":e.fillStyle=dB(e,i.radial_gradients[s.radial_gradient_idx],l,n)}switch(r.rule){case di.PATH_RULE_NON_ZERO:o="nonzero";break;case di.PATH_RULE_EVEN_ODD:o="evenodd"}e.fill(a,o)}function dk(e,i,r,a,n){let o=r.stroke;if(!o)return;e.lineWidth=o.width,e.miterLimit=o.miterlimit,e.setLineDash(o.dasharray),e.lineDashOffset=o.dashoffset;let s=o.opacity/255;switch(o.paint){case"rgb_color":e.strokeStyle=dD(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":e.strokeStyle=dF(e,i.linear_gradients[o.linear_gradient_idx],s,n);break;case"radial_gradient_idx":e.strokeStyle=dB(e,i.radial_gradients[o.radial_gradient_idx],s,n)}switch(o.linejoin){case da.LINE_JOIN_MITER_CLIP:case da.LINE_JOIN_MITER:e.lineJoin="miter";break;case da.LINE_JOIN_ROUND:e.lineJoin="round";break;case da.LINE_JOIN_BEVEL:e.lineJoin="bevel"}switch(o.linecap){case dr.LINE_CAP_BUTT:e.lineCap="butt";break;case dr.LINE_CAP_ROUND:e.lineCap="round";break;case dr.LINE_CAP_SQUARE:e.lineCap="square"}e.stroke(a)}function dF(e,i,r,a){if(1===i.stops.length){let e=i.stops[0];return dD(e.rgb_color,e.opacity*r,a)}let n=dN(i.transform),{x1:o,y1:s,x2:l,y2:h}=i,u=n.transformPoint(new DOMPoint(o,s)),c=n.transformPoint(new DOMPoint(l,h)),d=e.createLinearGradient(u.x,u.y,c.x,c.y);for(let e of i.stops)d.addColorStop(e.offset,dD(e.rgb_color,e.opacity*r,a));return d}function dB(e,i,r,a){if(1===i.stops.length){let e=i.stops[0];return dD(e.rgb_color,e.opacity*r,a)}let n=dN(i.transform),{fx:o,fy:s,cx:l,cy:h}=i,u=n.transformPoint(new DOMPoint(o,s)),c=n.transformPoint(new DOMPoint(l,h)),d=e.createRadialGradient(u.x,u.y,0,c.x,c.y,i.r*((n.a+n.d)/2));for(let e of i.stops)d.addColorStop(e.offset,dD(e.rgb_color,e.opacity*r,a));return d}function dN(e){return e?new DOMMatrix([e.sx,e.ky,e.kx,e.sy,e.tx,e.ty]):new DOMMatrix}function dV(e){let i=new Path2D,r=e.step,a=e.diffs[0]*r,n=e.diffs[1]*r;i.moveTo(a,n);for(let o=0,s=2;o<e.commands.length;o++)switch(e.commands[o]){case ds.PATH_COMMAND_MOVE:a+=e.diffs[s++]*r,n+=e.diffs[s++]*r,i.moveTo(a,n);break;case ds.PATH_COMMAND_LINE:a+=e.diffs[s++]*r,n+=e.diffs[s++]*r,i.lineTo(a,n);break;case ds.PATH_COMMAND_QUAD:{let o=a+e.diffs[s++]*r,l=n+e.diffs[s++]*r;a=o+e.diffs[s++]*r,n=l+e.diffs[s++]*r,i.quadraticCurveTo(o,l,a,n);break}case ds.PATH_COMMAND_CUBIC:{let o=a+e.diffs[s++]*r,l=n+e.diffs[s++]*r,h=o+e.diffs[s++]*r,u=l+e.diffs[s++]*r;a=h+e.diffs[s++]*r,n=u+e.diffs[s++]*r,i.bezierCurveTo(o,l,h,u,a,n);break}case ds.PATH_COMMAND_CLOSE:i.closePath()}return i}class dU{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}class dj{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new s4(e,e.data)}getFromCache(e,i,r){return this.cacheMap.has(r)||this.cacheMap.set(r,new dU(150)),this.cacheMap.get(r).get(na(e.serialize(),i))}setInCache(e,i,r,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new dU(150));let n=this.cacheDependenciesMap.get(a);n.get(na(e.id,r))||n.set(na(e.id,r),new Set);let o=this.cacheMap.get(a),s=e.serialize();n.get(na(e.id,r)).add(s),o.put(na(e.serialize(),r),i)}removeImagesFromCacheByIds(e,i,r=""){if(!this.cacheMap.has(r)||!this.cacheDependenciesMap.has(r))return;let a=this.cacheMap.get(r),n=this.cacheDependenciesMap.get(r);for(let r of e)if(n.has(na(r,i))){for(let e of n.get(na(r,i)))a.delete(e);n.delete(na(r,i))}}rasterize(e,i,r,a,n=dL){let o=this.getFromCache(e,r,a);if(o)return o.clone();let s=n(i.icon,e.options),l=dj._getImage(s);return this.setInCache(e,l,r,a),l.clone()}}class dG{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){let r=this.toIdx(e,i);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function dq(e,i,r,a){let n=0,o=Number.MAX_VALUE;for(let s=0;s<3;s++)if(1e-15>Math.abs(a[s])){if(r[s]<e[s]||r[s]>i[s])return null}else{let l=1/a[s],h=(e[s]-r[s])*l,u=(i[s]-r[s])*l;if(h>u){let e=h;h=u,u=e}if(h>n&&(n=h),u<o&&(o=u),n>o)return null}return n}function dZ(e,i,r,a,n,o,s,l,h,u,c){let d=a-e,p=n-i,f=o-r,m=s-e,_=l-i,g=h-r,y=c[1]*g-c[2]*_,x=c[2]*m-c[0]*g,v=c[0]*_-c[1]*m,b=d*y+p*x+f*v;if(1e-15>Math.abs(b))return null;let w=1/b,T=u[0]-e,S=u[1]-i,M=u[2]-r,E=(T*y+S*x+M*v)*w;if(E<0||E>1)return null;let A=S*f-M*p,I=M*d-T*f,C=T*p-S*d,P=(c[0]*A+c[1]*I+c[2]*C)*w;return P<0||E+P>1?null:(m*A+_*I+g*C)*w}function dH(e,i,r,a,n,o,s,l,h){let u=1<<r,c=o-a,d=s-n;l[0]=(e+0)/u*c+a,l[1]=(i+0)/u*d+n,h[0]=(e+1)/u*c+a,h[1]=(i+1)/u*d+n}class d${constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;let i=function(e){let i=Math.ceil(Math.log2(e.dim/8)),r=[],a=Math.ceil(Math.pow(2,i)),n=1/a,o=(e,i,r,a,n)=>{let o=a?1:0;n[0]=e*r,n[1]=i*r,n[2]=(e+1)*r-o,n[3]=(i+1)*r-o}
7,s=new dG(a),l=[];for(let i=0;i<a*a;i++){o(i%a,Math.floor(i/a),n,!1,l);let r=dX(l[0],l[1],e),h=dX(l[2],l[1],e),u=dX(l[2],l[3],e),c=dX(l[0],l[3],e);s.minimums.push(Math.min(r,h,u,c)),s.maximums.push(Math.max(r,h,u,c)),s.leaves.push(1)}for(r.push(s),a/=2;a>=1;a/=2){let e=r[r.length-1];s=new dG(a);for(let i=0;i<a*a;i++){o(i%a,Math.floor(i/a),2,!0,l);let r=e.getElevation(l[0],l[1]),n=e.getElevation(l[2],l[1]),h=e.getElevation(l[2],l[3]),u=e.getElevation(l[0],l[3]),c=e.isLeaf(l[0],l[1]),d=e.isLeaf(l[2],l[1]),p=e.isLeaf(l[2],l[3]),f=e.isLeaf(l[0],l[3]),m=Math.min(r.min,n.min,h.min,u.min),_=Math.max(r.max,n.max,h.max,u.max),g=c&&d&&p&&f;s.maximums.push(_),s.minimums.push(m),s.leaves.push(_-m<=5&&g?1:0)}r.push(s)}return r}(this.dem),r=i.length-1,a=i[r];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,r,0)}raycastRoot(e,i,r,a,n,o,s=1){return dq([e,i,-100],[r,a,this.maximums[0]*s],n,o)}raycast(e,i,r,a,n,o,s=1){if(!this.nodeCount)return null;let l=this.raycastRoot(e,i,r,a,n,o,s);if(null==l)return null;let h=[],u=[],c=[],d=[],p=[{idx:0,t:l,nodex:0,nodey:0,depth:0}];for(;p.length>0;){let{idx:l,t:_,nodex:g,nodey:y,depth:x}=p.pop();if(this.leaves[l]){dH(g,y,x,e,i,r,a,c,d);let l=1<<x,h=(g+0)/l,u=(g+1)/l,p=(y+0)/l,v=(y+1)/l,b=dX(h,p,this.dem)*s,w=dX(u,p,this.dem)*s,T=dX(u,v,this.dem)*s,S=dX(h,v,this.dem)*s,M=dZ(c[0],c[1],b,d[0],c[1],w,d[0],d[1],T,n,o),E=dZ(d[0],d[1],T,c[0],d[1],S,c[0],c[
71],b,n,o),A=Math.min(null!==M?M:Number.MAX_VALUE,null!==E?E:Number.MAX_VALUE);if(A!==Number.MAX_VALUE)return A;{var f,m;let e=eP.vec3.scaleAndAdd([],n,o,_);if(dW(b,w,S,T,(e[0]-(f=c[0]))/(d[0]-f),(e[1]-(m=c[1]))/(d[1]-m))>=e[2])return _}continue}let v=0;for(let p=0;p<this._siblingOffset.length;p++){dH((g<<1)+this._siblingOffset[p][0],(y<<1)+this._siblingOffset[p][1],x+1,e,i,r,a,c,d),c[2]=-100,d[2]=this.maximums[this.childOffsets[l]+p]*s;let f=dq(c,d,n,o);if(null!=f){h[p]=f;let e=!1;for(let i=0;i<v&&!e;i++)f>=h[u[i]]&&(u.splice(i,0,p),e=!0);e||(u[v]=p),v++}}for(let e=0;e<v;e++){let i=u[e];p.push({idx:this.childOffsets[l]+i,t:h[i],nodex:(g<<1)+this._siblingOffset[i][0],nodey:(y<<1)+this._siblingOffset[i][1],depth:x+1})}}return null}_addNode(e,i,r){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,r,a,n){if(1===e[a].isLeaf(i,r))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);let o=a-1,s=e[o],l=0,h=0;for(let e=0;e<this._siblingOffset.length;e++){let a=2*i+this._siblingOffset[e][0],n=2*r+this._siblingOffset[e][1],o=s.getElevation(a,n),u=s.isLeaf(a,n),c=this._addNode(o.min,o.max,u);u&&(l|=1<<e),h||(h=c)}for(let a=0;a<this._siblingOffset.length;a++)l&1<<a||this._construct(e,2*i+this._siblingOffset[a][0],2*r+this._siblingOffset[a][1],o,h+a)}}function dW(e,i,r,a,n,o){return t$(t$(e,r,o),t$(i,a,o),n)}function dX(e,i,r){let a=r.dim,n=eU(e*a-.5,0,a-1),o=eU(i*a-.5,0,a-1),s=Math.floor(n),l=Math.floor(o),h=Math.min(s+1,a-1),u=Math.min(l+1,a-1);return dW(r.get(s,l),r.get(h,l),r.get(s,u),r.get(h,u),n-s,o-l)}let dY={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function dK(e,i,r){return(256*e*256+256*i+r)/10-1e4}function dJ(e,i,r){return 256*e+i+r/256-32768}class dQ{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,r,a=!1){if(this.uid=e,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void e1(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;let n=this.dim=i.height-2,o=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let e=0;e<n;e++)o[this._idx(-1,e)]=o[this._idx(0,e)],o[this._idx(n,e)]=o[this._idx(n-1,e)],o[this._idx(e,-1)]=o[this._idx(e,0)],o[this._idx(e,n)]=o[this._idx(e,n-1)];o[this._idx(-1,-1)]=o[this._idx(0,0)],o[this._idx(n,-1)]=o[this._idx(n-1,0)],o[this._idx(-1,n)]=o[this._idx(0,n-1)],o[this._idx(n,n)]=o[this._idx(n-1,n-1)]}let s="terrarium"===r?dJ:dK;for(let e=0;e<o.length;++e){let i=4*e;this.floatView[e]=s(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}this._timestamp=to.now()}_buildQuadTree(){this._tree=new d$(this)}get(e,i,r=!1){r&&(e=eU(e,-1,this.dim),i=eU(i,-1,this.dim));let a=this._idx(e,i);return this.floatView[a]}set(e,i,r){let a=this._idx(e,i),n=this.floatView[a];return this.floatView[a]=r,r-n}static getUnpackVector(e){return dY[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){let r=[0,0,0,0],a=dQ.getUnpackVector(i),n=Math.floor((e+a[3])/a[2]);return r[2]=n%256,n=Math.floor(n/256),r[1]=n%256,n=Math.floor(n/256),r[0]=n,r}getPixels(){return new s5({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,r){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let a=i*this.dim,n=i*this.dim+this.dim,o=r*this.dim,s=r*this.dim+this.dim;switch(i){case -1:a=n-1;break;case 1:n=a+1}switch(r){case -1:o=s-1;break;case 1:s=o+1}let l=-i*this.dim,h=-r*this.dim;for(let i=o;i<s;i++)for(let r=a;r<n;r++){let a=4*this._idx(r,i),n=4*this._idx(r+l,i+h);this.pixels[a+0]=e.pixels[n+0],this.pixels[a+1]=e.pixels[n+1],this.pixels[a+2]=e.pixels[n+2],this.pixels[a+3]=e.pixels[n+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function d0(e,i,r){var a;1===e?i.headerLength=r.readFixed32():2===e?i.x=r.readVarint():3===e?i.y=r.readVarint():4===e?i.z=r.readVarint():5===e&&i.layers.push((a=r.readVarint()+r.pos,r.readFields(d5,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)))}function d1(e,i,r){var a;1===e?(i.delta_filter=(a=r.readVarint()+r.pos,r.readFields(d2,{blockSize:0},a)),i.filter="delta_filter"):2===e?(r.readVarint(),i.filter="zigzag_filter"):3===e?(r.readVarint(),i.filter="bitshuffle_filter"):4===e&&(r.readVarint(),i.filter="byteshuffle_filter")}function d2(e,i,r){1===e&&(i.blockSize=r.readVarint())}function d3(e,i,r){1===e?(r.readVarint(),i.codec="gzip_data"):2===e?(r.readVarint(),i.codec="jpeg_image"):3===e?(r.readVarint(),i.codec="webp_image"):4===e&&(r.readVarint(),i.codec="png_image")}function d4(e,i,r){var a,n;let o=0,s=0;1===e?i.firstByte=r.readFixed64():2===e?i.lastByte=r.readFixed64():3===e?i.filters.push((a=r.readVarint()+r.pos,r.readFields(d1,{}
7,a))):4===e?i.codec=(n=r.readVarint()+r.pos,r.readFields(d3,{},n)):5===e?s=r.readFloat():6===e?o=r.readFloat():7===e?i.bands.push(r.readString()):8===e?i.offset=r.readDouble():9===e&&(i.scale=r.readDouble()),0===i.offset&&(i.offset=s),0===i.scale&&(i.scale=o)}function d5(e,i,r){var a;1===e?i.version=r.readVarint():2===e?i.name=r.readString():3===e?i.units=r.readString():4===e?i.tileSize=r.readVarint():5===e?i.buffer=r.readVarint():6===e?i.pixelFormat=r.readVarint():7===e&&i.dataIndex.push((a=r.readVarint()+r.pos,r.readFields(d4,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)))}function d6(e,i,r){if(2===e)!function(e,i,r){e.readFields(d8,r,i)}(r,r.readVarint()+r.pos,i);else if(3===e)throw Error("Not implemented")}function d8(e,i,r){if(1===e){let e=0,a=r.readVarint()+r.pos;for(;r.pos<a;)i[e++]=r.readVarint()}}ab(dQ,"DEMData"),ab(d$,"DemMinMaxQuadTree",{omit:["dem"]});var d9=Uint8Array,d7=Uint16Array,pe=Int32Array,pt=new d9([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),pi=new d9([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pr=new d9([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pa=function(e,i){for(var r=new d7(31),a=0;a<31;++a)r[a]=i+=1<<e[a-1];var n=new pe(r[30]);for(a=1;a<30;++a)for(var o=r[a];o<r[a+1];++o)n[o]=o-r[a]<<5|a;return{b:r,r:n}},pn=pa(pt,2),po=pn.b,ps=pn.r;po[28]=258,ps[258]=28;for(var pl=pa(pi,0).b,ph=new d7(32768),pu=0;pu<32768;++pu){var pc=(43690&pu)>>1|(21845&pu)<<1;ph[pu]=((65280&(pc=(61680&(pc=(52428&pc)>>2|(13107&pc)<<2))>>4|(3855&pc)<<4))>>8|(255&pc)<<8)>>1}var pd=function(e,i,r){for(var a=e.length,n=0,o=new d7(i);n<a;++n)e[n]&&++o[e[n]-1];var s,l=new d7(i);for(n=1;n<i;++n)l[n]=l[n-1]+o[n-1]<<1;s=new d7(1<<i);var h=15-i;for(n=0;n<a;++n)if(e[n])for(var u=n<<4|e[n],c=i-e[n],d=l[e[n]-1]++<<c,p=d|(1<<c)-1;d<=p;++d)s[ph[d]>>h]=u;return s},pp=new d9(288);for(pu=0;pu<144;++pu)pp[pu]=8;for(pu=144;pu<256;++pu)pp[pu]=9;for(pu=256;pu<280;++pu)pp[pu]=7;for(pu=280;pu<288;++pu)pp[pu]=8;var pf=new d9(32);for(pu=0;pu<32;++pu)pf[pu]=5;var pm=pd(pp,9),p_=pd(pf,5),pg=function(e){for(var i=e[0],r=1;r<e.length;++r)e[r]>i&&(i=e[r]);return i},py=function(e,i,r){var a=i/8|0;return(e[a]|e[a+1]<<8)>>(7&i)&r},px=function(e,i){var r=i/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&i)}
7,pv=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],pb=function(e,i,r){var a=Error(i||pv[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,pb),!r)throw a;return a},pw=new d9(0),pT="undefined"!=typeof TextDecoder&&new TextDecoder;try{pT.decode(pw,{stream:!0})}catch(e){}let pS={gzip_data:"gzip"};class pM extends Error{constructor(e){super(e),this.name="MRTError"}}let pE={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},pA={uint32:1,uint16:2,uint8:4},pI={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class pC{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){let i=this.layers[e];if(!i)throw new pM(`Layer '${e}' not found`);return i}getHeaderLength(e){let i=new Uint8Array(e),r=new DataView(e);if(13!==i[0])throw new pM("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(e){let i=new Uint8Array(e),r=this.getHeaderLength(e);if(i.length<r)throw new pM(`Expected header with length >= ${r} but got buffer of length ${i.length}`);let a=new q(i.subarray(0,r)).readFields(d0,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new pM(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);for(let e of(this.x=a.x,this.y=a.y,this.z=a.z,a.layers))this.layers[e.name]=new pP(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){let i=[],r=this.getLayer(e.layerName);for(let a of e.blockIndices){let n=r.dataIndex[a],o=n.firstByte-e.firstByte,s=n.lastByte-e.firstByte;if(r._blocksInProgress.has(a))continue;let l={layerName:r.name,firstByte:o,lastByte:s,pixelFormat:r.pixelFormat,blockIndex:a,blockShape:[n.bands.length].concat(r.bandShape),buffer:r.buffer,codec:n.codec.codec,filters:n.filters.map(e=>e.filter)};r._blocksInProgress.add(a),i.push(l)}return new pz(i,()=>{i.forEach(e=>r._blocksInProgress.delete(e.blockIndex))},(e,a)=>{if(i.forEach(e=>r._blocksInProgress.delete(e.blockIndex)),e)throw e;a.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class pP{constructor({version:e,name:i,units:r,tileSize:a,pixelFormat:n,buffer:o,dataIndex:s},l){if(this.version=e,1!==this.version)throw new pM(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=r,this.tileSize=a,this.buffer=o,this.pixelFormat=pE[n],this.dataIndex=s,this.bandShape=[a+2*o,a+2*o,pA[this.pixelFormat]],this._decodedBlocks=new dU(l?l.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return pA[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){let i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(let[r,a]of this.dataIndex.entries()){for(let[n,o]of a.bands.entries())if(o===e)return{bandIndex:i+n,blockIndex:r,blockBandIndex:n};i+=a.bands.length}break;case"number":for(let[r,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:r,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new pM(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new pM(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let i=1/0,r=-1/0,a=[],n=new Set;for(let o of e){let{blockIndex:e}=this.getBlockForBand(o);if(e<0)throw new pM(`Invalid band: ${JSON.stringify(o)}`);let s=this.dataIndex[e];a.includes(e)||a.push(e),n.add(e),i=Math.min(i,s.firstByte),r=Math.max(r,s.lastByte)}if(n.size>this.cacheSize)throw new pM(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:r,blockIndices:a}}hasBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){let{blockIndex:i,blockBandIndex:r}=this.getBlockForBand(e),a=this._decodedBlocks.get(i.toString());if(!a)throw new pM(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);let n=this.dataIndex[i],o=this.bandShape.reduce((e,i)=>e*i,1),s=r*o,l=a.subarray(s,s+o);return{data:l,bytes:new Uint8Array(l.buffer).subarray(l.byteOffset,l.byteOffset+l.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}pC.setPbf=function(e){q=e};class pz{constructor(e,i,r){this.tasks=e,this._onCancel=i,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}pC.performDecoding=function(e,i){let r=new Uint8Array(e);return Promise.all(i.tasks.map(e=>
7{let{layerName:i,firstByte:a,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:l,filters:h,codec:u}=e,c=r.subarray(a,n+1),d=new Uint32Array(s[0]*s[1]*s[2]);if("gzip_data"!==u)throw new pM(`Unhandled codec: ${u}`);return(function(e,i){var r,a;if(!globalThis.DecompressionStream&&"gzip_data"===i)return Promise.resolve(((a=function(e){31==e[0]&&139==e[1]&&8==e[2]||pb(6,"invalid gzip data");var i=e[3],r=10;4&i&&(r+=2+(e[10]|e[11]<<8));for(var a=(i>>3&1)+(i>>4&1);a>0;a-=!e[r++]);return r+(2&i)}(e))+8>e.length&&pb(6,"invalid gzip data"),function(e,i,r,a){var n=e.length;if(!n||i.f&&!i.l)return r||new d9(0);var o=!r,s=o||2!=i.i,l=i.i;o&&(r=new d9(3*n));var h,u,c=function(e){var i=r.length;if(e>i){var a=new d9(Math.max(2*i,e));a.set(r),r=a}},d=i.f||0,p=i.p||0,f=i.b||0,m=i.l,_=i.d,g=i.m,y=i.n,x=8*n;do{if(!m){d=py(e,p,1);var v=py(e,p+1,3);if(p+=3,!v){var b=e[(D=4+((p+7)/8|0))-4]|e[D-3]<<8,w=D+b;if(w>n){l&&pb(0);break}s&&c(f+b),r.set(e.subarray(D,w),f),i.b=f+=b,i.p=p=8*w,i.f=d;continue}if(1==v)m=pm,_=p_,g=9,y=5;else if(2==v){var T=py(e,p,31)+257,S=py(e,p+10,15)+4,M=T+py(e,p+5,31)+1;p+=14;for(var E=new d9(M),A=new d9(19),I=0;I<S;++I)A[pr[I]]=py(e,p+3*I,7);p+=3*S;var C=pg(A),P=(1<<C)-1,z=pd(A,C);for(I=0;I<M;){var D,R=z[py(e,p,P)];if(p+=15&R,(D=R>>4)<16)E[I++]=D;else{var L=0,O=0;for(16==D?(O=3+py(e,p,3),p+=2,L=E[I-1]):17==D?(O=3+py(e,p,7),p+=3):18==D&&(O=11+py(e,p,127),p+=7);O--;)E[I++]=L}}var k=E.subarray(0,T),F=E.subarray(T);g=pg(k),y=pg(F),m=pd(k,g),_=pd(F,y)}else pb(1);if(p>x){l&&pb(0);break}}s&&c(f+131072);for(var B=(1<<g)-1,N=(1<<y)-1,V=p;;V=p){var U=(L=m[px(e,p)&B])>>4;if((p+=15&L)>x){l&&pb(0);break}if(L||pb(2),U<256)r[f++]=U;else{if(256==U){V=p,m=null;break}var j=U-254;U>264&&(j=py(e,p,(1<<(Z=pt[I=U-257]))-1)+po[I],p+=Z);var G=_[px(e,p)&N],q=G>>4;if(G||pb(3),p+=15&G,F=pl[q],q>3){var Z=pi[q];F+=px(e,p)&(1<<Z)-1,p+=Z}if(p>x){l&&pb(0);break}s&&c(f+131072);var H=f+j;if(f<F){var $=0-F,W=Math.min(F,H);for($+f<0&&pb(3);f<W;++f)r[f]=(void 0)[$+f]}for(;f<H;++f)r[f]=r[f-F]}}i.l=m,i.p=V,i.b=f,i.f=d,m&&(d=1,i.m=g,i.d=_,i.n=y)}while(!d);return f!=r.length&&o?(h=r,(null==(u=f)||u>h.length)&&(u=h.length),new d9(h.subarray(0,u))):r.subarray(0,f)}(e.subarray(a,-8),{i:2},new d9((e[(r=e.length)-4]|e[r-3]<<8|e[r-2]<<16|e[r-1]<<24)>>>0))));let n=pS[i];if(!n)throw Error(`Unhandled codec: ${i}`);let o=new globalThis.DecompressionStream(n);return new Response(new Blob([e]).stream().pipeThrough(o)).arrayBuffer().then(e=>new Uint8Array(e))})(c,u).then(e=>((function(e,i){e.readFields(d6,i)})(new q(e),d),new pI[o](d.buffer))).then(e=>{for(let i=h.length-1;i>=0;i--)switch(h[i]){case"delta_filter":(function(e,i){if(4!==i.length)throw Error(`Expected data of dimension 4 but got ${i.length}.`);let r=i[3];for(let a=2;a>=1;a--){let n=1===a?1:0,o=2===a?1:0;for(let a=0;a<i[0];a++){let s=i[1]*a;for(let a=n;a<i[1];a++){let n=i[2]*(a+s);for(let a=o;a<i[2];a++){let o=i[3]*(a+n);for(let a=0;a<i[3];a++){let i=o+a;e[i]+=e[i-r]}}}}r*=i[a]}})(e,s);break;case"zigzag_filter":(function(e){for(let i=0,r=e.length;i<r;i++)e[i]=e[i]>>>1^-(1&e[i])})(e);break;case"bitshuffle_filter":(function(e,i){switch(i){case"uint32":return;case"uint16":for(let i=0;i<e.length;i+=2){let r=e[i],a=e[i+1];e[i]=(240&r)>>4|(61440&r)>>8|(240&a)<<4|61440&a,e[i+1]=15&r|(3840&r)>>4|(15&a)<<8|(3840&a)<<4}return;case"uint8":for(let i=0;i<e.length;i+=4){let r=e[i],a=e[i+1],n=e[i+2],o=e[i+3];e[i+0]=(192&r)>>6|(192&a)>>4|(192&n)>>2|192&o,e[i+1]=(48&r)>>4|(48&a)>>2|48&n|(48&o)<<2,e[i+2]=(12&r)>>2|12&a|(12&n)<<2|(12&o)<<4,e[i+3]=3&r|(3&a)<<2|(3&n)<<4|(3&o)<<6}return;default:throw Error(`Invalid pixel format, "${i}"`)}})(e,o);break;default:throw new pM(`Unhandled filter "${h[i]}"`)}return{layerName:i,blockIndex:l,data:e}}).catch(e=>{throw e})}))},ab(pz,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});let pD,pR,pL,pO,pk,pF=null;function pB(){return e4()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:pR||ti.DRACO_URL}function pN(){if(e4()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(pO)return pO;let e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw Error("WebAssembly not supported, cannot instantiate meshoptimizer");return pO=WebAssembly.validate(e)?ti.MESHOPT_SIMD_URL:ti.MESHOPT_URL}let pV={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},pU={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},pj={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function pG(e,i,r){let a=r.json.bufferViews.length,n=r.buffers.length;i.bufferView=a,r.json.bufferViews[a]={buffer:n,byteLength:e.byteLength},r.buffers[n]=e}let pq="KHR_draco_mesh_compression",pZ="EXT_meshopt_compression",pH=new TextDecoder("utf8");function p$(e,i){return new URL(e,i).href}function pW(e,i){let r=e.json.bufferViews[i];return new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function pX(e,i=0,r){let a={json:null,images:[],buffers:[]};if(1179937895===new Uint32Array(e,i,1)[0]){let r=new Uint32Array(e,i),n=2,o=(r[n++]>>2)-3,s=r[n++]>>2;if(n++,a.json=JSON.parse(pH.decode(r.subarray(n,n+s))),(n+=s)<o){let o=r[n++],s=i+(++n<<2);a.buffers[0]=e.slice(s,s+o)}}else a.json=JSON.parse(pH.decode(new Uint8Array(e,i)));let{buffers:n,images:o,meshes:s,extensionsUsed:l,bufferViews:h}=a.json,u=Promise.resolve();if(n){let e=[];for(let i=0;i<n.length;i++){let o=n[i];o.uri?e.push(function(e,i,r,a){return fetch(p$(e.uri,a)).then(e=>e.arrayBuffer()).then(e=>{i.buffers[r]=e})}(o,a,i,r)):a.buffers[i]||(a.buffers[i]=null)}u=Promise.all(e)}return u.then(()=>{let e=[],i=l&&l.includes(pq),n=l&&l.includes(pZ);if(i&&e.push(function(){if(!pL)return null!=pD?pD:(pD=function(e){let i,r=null;function a(){i=new Uint8Array(r.buffer)}function n(){throw Error("Unexpected Draco error.")}let o={a:{a:n,d:function(e,r,a){return i.copyWithin(e,r,r+a)},c:function(e){let n=i.length,o=Math.max(e>>>0,Math.ceil(1.2*n));try{return r.grow(Math.ceil((o-n)/65536)),a(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,o))).then(e=>{let n,o,s,l;let{Rb:h,Qb:u,P:c,T:d,X:p,Ja:f,La:m,Qa:_,Va:g,Wa:y,eb:x,jb:v,f:b,e:w,yb:T,zb:S,Ab:M,Bb:E,Db:A,Gb:I}=e.instance.exports;r=w;let C=(n=0,o=0,s=0,l=0,e=>
7{s&&(h(l),h(n),o+=s,s=n=0),n||(o+=128,n=u(o));let r=e.length+7&-8,a=n;r>=o&&(s=r,a=l=u(r));for(let r=0;r<e.length;r++)i[a+r]=e[r];return a});return a(),b(),{memory:w,_free:h,_malloc:u,Mesh:class{constructor(){this.ptr=c()}destroy(){d(this.ptr)}},Decoder:class{constructor(){this.ptr=f()}destroy(){v(this.ptr)}DecodeArrayToMesh(e,i,r){let a=C(e);return!!p(m(this.ptr,a,i,r.ptr))}GetAttributeByUniqueId(e,i){return{ptr:_(this.ptr,e.ptr,i)}}GetTrianglesUInt16Array(e,i,r){g(this.ptr,e.ptr,i,r)}GetTrianglesUInt32Array(e,i,r){y(this.ptr,e.ptr,i,r)}GetAttributeDataArrayForAllPoints(e,i,r,a,n){x(this.ptr,e.ptr,i.ptr,r,a,n)}},DT_INT8:T(),DT_UINT8:S(),DT_INT16:M(),DT_UINT16:E(),DT_UINT32:A(),DT_FLOAT32:I()}})}(fetch(pB()))).then(e=>{pL=e,pD=void 0})}()),n&&e.push(function(){if(pk)return;let e=function(e){let i;let r=WebAssembly.instantiateStreaming(e,{}).then(e=>{(i=e.instance).exports.__wasm_call_ctors()}),a={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:r,supported:!0,decodeGltfBuffer(e,r,o,s,l,h){!function(e,i,r,a,n,o,s){let l=e.exports.sbrk,h=a+3&-4,u=l(h*n),c=l(o.length),d=new Uint8Array(e.exports.memory.buffer);d.set(o,c);let p=i(u,a,n,c,o.length);if(0===p&&s&&s(u,h,n),r.set(d.subarray(u,u+a*n)),l(u-l(0)),0!==p)throw Error(`Malformed buffer data: ${p}`)}(i,i.exports[n[l]],e,r,o,s,i.exports[a[h]])}}}(fetch(pN()));return e.ready.then(()=>{pk=e})}()),o)for(let i=0;i<o.length;i++)e.push(function(e,i,r,a){return e.uri?fetch(p$(e.uri,a)).then(e=>e.blob()).then(e=>createImageBitmap(e)).then(e=>{i.images[r]=e}):void 0!==e.bufferView?createImageBitmap(new Blob([pW(i,e.bufferView)],{type:e.mimeType})).then(e=>{i.images[r]=e}):void 0}(o[i],a,i,r));return(e.length?Promise.all(e):Promise.resolve()).then(()=>{if(i&&s)for(let{primitives:e}of s)for(let i of e)!function(e,i){let r=e.extensions&&e.extensions[pq];if(!r)return;let a=new pL.Decoder,n=pW(i,r.bufferView),o=new pL.Mesh;if(!a.DecodeArrayToMesh(n,n.byteLength,o))throw Error("Failed to decode Draco mesh");let s=i.json.accessors[e.indices],l=pV[s.componentType],h=s.count*l.BYTES_PER_ELEMENT,u=pL._malloc(h);for(let n of(l===Uint16Array?a.GetTrianglesUInt16Array(o,h,u):a.GetTrianglesUInt32Array(o,h,u),pG(pL.memory.buffer.slice(u,u+h),s,i),pL._free(u),Object.keys(r.attributes))){let s=a.GetAttributeByUniqueId(o,r.attributes[n]),l=i.json.accessors[e.attributes[n]],h=pU[l.componentType],u=l.count*pj[l.type]*pV[l.componentType].BYTES_PER_ELEMENT,c=pL._malloc(u);a.GetAttributeDataArrayForAllPoints(o,s,pL[h],u,c),pG(pL.memory.buffer.slice(c,c+u),l,i),pL._free(c)}a.destroy(),o.destroy(),delete e.extensions[pq]}(i,a);if(n&&s&&h)for(let e of h)!function(e,i){if(!e.extensions||!e.extensions[pZ])return;let r=e.extensions[pZ],a=new Uint8Array(i.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),n=new Uint8Array(r.count*r.byteStride);pk.decodeGltfBuffer(n,r.count,r.byteStride,a,r.mode,r.filter),e.buffer=i.buffers.length,e.byteOffset=0,i.buffers[e.buffer]=n.buffer,delete e.extensions[pZ]}(e,a);return a})})}function pY(e,i){let r=e.json.bufferViews[i.bufferView],a=pV[i.componentType];return new a(e.buffers[r.buffer],(i.byteOffset||0)+(r.byteOffset||0),i.count*(r.byteStride&&r.byteStride!==pj[i.type]*a.BYTES_PER_ELEMENT?r.byteStride/a.BYTES_PER_ELEMENT:pj[i.type]))}function pK(e,i,r,a){let n=pV[i.componentType],o=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),s=e.json.bufferViews[i.bufferView],l=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:pj[i.type],h=r.float32,u=h.length/r.capacity;for(let e=0,r=0;e<i.count*l;e+=l,r+=u)for(let i=0;i<u;i++)h[r+i]=a[e+i]*o;r._trim()}function pJ(e){let i=function(e,i){let r=[],a=WebGL2RenderingContext;if(e.json.textures)for(let n of e.json.textures){let o={magFilter:a.LINEAR,minFilter:a.NEAREST,wrapS:a.REPEAT,wrapT:a.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),r.push({image:i[n.source],sampler:o,uploaded:!1})}return r}(e,e.images),r=function(e,i){let r=[];for(let a of e.json.meshes){let n=[];for(let r of a.primitives)n.push(function(e,i,r){let a=e.indices,n=e.attributes,o={};o.indexArray=new nz;let s=i.json.accessors[a],l=s.count/3;o.indexArray.reserve(l);let h=pY(i,s);for(let e=0;e<l;e++)o.indexArray.emplaceBack(h[3*e],h[3*e+1],h[3*e+2]);o.indexArray._trim(),o.vertexArray=new nx;let u=i.json.accessors[n.POSITION];o.vertexArray.reserve(u.count);let c=pY(i,u);for(let e=0;e<u.count;e++)o.vertexArray.emplaceBack(c[3*e],c[3*e+1],c[3*e+2]);if(o.vertexArray._trim(),o.aabb=new sw(u.min,u.max),o.centroid=function(e,i){let r=[
70,0,0],a=e.length;if(a>0){for(let n=0;n<a;n++){let a=3*e[n];r[0]+=i[a],r[1]+=i[a+1],r[2]+=i[a+2]}r[0]/=a,r[1]/=a,r[2]/=a}return r}(h,c),void 0!==n.COLOR_0){let e=i.json.accessors[n.COLOR_0],r=pj[e.type],a=pY(i,e);o.colorArray=3===r?new nx:new ny,o.colorArray.resize(e.count),pK(i,e,o.colorArray,a)}if(void 0!==n.NORMAL){o.normalArray=new nx;let e=i.json.accessors[n.NORMAL];o.normalArray.resize(e.count);let r=pY(i,e);pK(i,e,o.normalArray,r)}if(void 0!==n.TEXCOORD_0&&r.length>0){o.texcoordArray=new nN;let e=i.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);let r=pY(i,e);pK(i,e,o.texcoordArray,r)}if(void 0!==n._FEATURE_ID_RGBA4444){let e=i.json.accessors[n._FEATURE_ID_RGBA4444];i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=pY(i,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(pY(i,i.json.accessors[n._FEATURE_RGBA4444]).buffer));let d=e.material;return o.material=function(e,i){let{emissiveFactor:r=[0,0,0],alphaMode:a="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:l,doubleSided:h}=e,{baseColorFactor:u=[1,1,1,1],metallicFactor:c=1,roughnessFactor:d=1,baseColorTexture:p,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},m=s?i[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&m){let e=s.extensions.KHR_texture_transform;m.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new tZ(...u),metallicFactor:c,roughnessFactor:d,baseColorTexture:p?i[p.index]:void 0,metallicRoughnessTexture:f?i[f.index]:void 0},doubleSided:h,emissiveFactor:r,alphaMode:a,alphaCutoff:n,normalTexture:o?i[o.index]:void 0,occlusionTexture:m,emissionTexture:l?i[l.index]:void 0,defined:void 0===e.defined}}(void 0!==d?i.json.materials[d]:{defined:!1},r),o}(r,e,i));r.push(n)}return r}(e,i),{scenes:a,scene:n,nodes:o}=e.json,s=a?a[n||0].nodes:o,l=[];for(let i of s)l.push(function e(i,r,a){let{matrix:n,rotation:o,translation:s,scale:l,mesh:h,extras:u,children:c}=i,d={};if(d.matrix=n||eP.mat4.fromRotationTranslationScale([],o||[0,0,0,1],s||[0,0,0],l||[1,1,1]),void 0!==h){d.meshes=a[h];let e=d.anchor=[0,0];for(let i of d.meshes){let{min:r,max:a}=i.aabb;e[0]+=r[0]+a[0],e[1]+=r[1]+a[1]}e[0]=Math.floor(e[0]/d.meshes.length/2),e[1]=Math.floor(e[1]/d.meshes.length/2)}if(u&&(u.id&&(d.id=u.id),u.lights&&(d.lights=function(e){if(!e.length)return[];let i=function(e){let i=atob(e),r=new Uint8Array(i.length);for(let e=0;e<i.length;e++)r[e]=i.codePointAt(e);return r}(e),r=[],a=i.length/24,n=new Uint16Array(i.buffer),o=new Float32Array(i.buffer);for(let e=0;e<a;e++){let i=n[2*e*6]/30,a=n[2*e*6+1]/30,s=n[2*e*6+10]/100,l=o[6*e+1],h=o[6*e+2],u=o[6*e+3],c=o[6*e+4],d=u-l,p=c-h,f=Math.hypot(d,p);r.push({pos:[l+.5*d,h+.5*p,a],normal:[p/f,-d/f,0],width:f,height:i,depth:s,points:[l,h,u,c]})}return r}(u.lights))),c){let i=[];for(let n of c)i.push(e(r.json.nodes[n],r,a));d.children=i}return d}(o[i],e,r));return function(e,i,r){let a={},n=new Set;for(let o=0;o<e.length;o++){let e=r[i[o]];if(!e.extras)continue;let s=e.extras["mapbox:footprint:version"],l=e.extras["mapbox:footprint:id"];(s||l)&&n.add(o),"1.0.0"===s&&l&&(a[l]=o)}for(let o=0;o<e.length;o++){if(n.has(o))continue;let s=e[o],l=r[i[o]];if(!l.extras)continue;let h=null;s.id in a&&(h=function(e,i){let r=[],a=[],n=0,o=[];for(let s of e){n=r.length;let e=s.vertexArray.float32,l=s.indexArray.uint16;for(let a=0;a<s.vertexArray.length;a++)o[0]=e[3*a+0],o[1]=e[3*a+1],o[2]=e[3*a+2],eP.vec3.transformMat4(o,o,i),r.push(new eR(o[0],o[1]));for(let e=0;e<3*s.indexArray.length;e++)a.push(l[e]+n)}if(a.length%3!=0)return null;for(let e=0;e<a.length;e+=3){let i=r[a[e+0]],n=r[a[e+1]],o=r[a[e+2]];(i.x-n.x)*(o.y-n.y)-(o.x-n.x)*(i.y-n.y)>0&&([a[e+1],a[e+2]]=[a[e+2],a[e+1]])}return{vertices:r,indices:a}}(e[a[s.id]].meshes,s.matrix)),h||(h=function(e){if(!e.extras||!e.extras.ground)return null;let i=e.extras.ground;if(!i||!Array.isArray(i)||0===i.length)return null;let r=i[0];if(!r||!Array.isArray(r)||0===r.length)return null;let a=[];for(let e of r){if(!Array.isArray(e)||2!==e.length)continue;let i=e[0],r=e[1];"number"==typeof i&&"number"==typeof r&&a.push(new eR(i,r))}
7if(a.length<3)return null;a.length>1&&a[a.length-1].equals(a[0])&&a.pop();let n=0;for(let e=0;e<a.length;e++){let i=a[e],r=a[(e+1)%a.length],o=a[(e+2)%a.length];n+=(i.x-r.x)*(o.y-r.y)-(o.x-r.x)*(i.y-r.y)}n>0&&a.reverse();let o=s9(a.flatMap(e=>[e.x,e.y]),[]);return 0===o.length?null:{vertices:a,indices:o}}(l)),h&&(s.footprint=function(e){if(0===e.vertices.length||0===e.indices.length)return null;let i=new lv(e.vertices,e.indices,8,256),[r,a]=[i.min.clone(),i.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:i,min:r,max:a}}(h))}if(n.size>0){let i=Array.from(n.values()).sort((e,i)=>e-i);for(let r=i.length-1;r>=0;r--)e.splice(i[r],1)}}(l,s,e.json.nodes),l}class pQ{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){let r=e[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}let p0=["id","tile","layer","source","sourceLayer","state"];class p1{constructor(e,i,r,a,n){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=r,this._y=a,this.properties=e.properties,this.id=n}clone(){let e=new p1(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state={...this.state}),this.layer&&(e.layer={...this.layer}),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(let i of p0)void 0!==this[i]&&(e[i]=this[i]);return e}}class p2{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ax(8192,16,0),this.featureIndexArray=new n1,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,r,a,n,o=0,s=0){let l=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,a,n,o);let h=this.grid;for(let e=0;e<i.length;e++){let r=i[e],a=[1/0,1/0,-1/0,-1/0];for(let e=0;e<r.length;e++){let i=r[e];a[0]=Math.min(a[0],i.x),a[1]=Math.min(a[1],i.y),a[2]=Math.max(a[2],i.x),a[3]=Math.max(a[3],i.y)}
70!==s&&(a[0]-=s,a[1]-=s,a[2]+=s,a[3]+=s),a[0]<8192&&a[1]<8192&&a[2]>=0&&a[3]>=0&&h.insert(l,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(let e in this.vtLayers=new lU.VectorTile(new h6(this.rawTileData)).layers,this.sourceLayerCoder=new pQ(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}query(e,i){let r;let{tilespaceGeometry:a,transform:n,tileTransform:o,pixelPosMatrix:s,availableImages:l}=i;this.loadVTLayers(),this.serializedLayersCache.clear();let h=a.bufferedTilespaceBounds,u=this.grid.query(h.min.x,h.min.y,h.max.x,h.max.y,(e,i,r,n)=>o6(a.bufferedTilespaceGeometry,e,i,r,n));u.sort(p4);let c=null;n.elevation&&u.length>0&&(c=cW.create(n.elevation,this.tileID));let d={};for(let i=0;i<u.length;i++){let h=u[i];if(h===r)continue;r=h;let p=this.featureIndexArray.get(h),f=null;this.is3DTile?this.loadMatchingModelFeature(d,p,e,a,n):this.loadMatchingFeature(d,p,e,l,(e,i,r,l=0)=>(f||(f=oW(e,this.tileID.canonical,o)),i.queryIntersectsFeature(a,e,r,f,this.z,n,s,c,l)))}return d}loadMatchingFeature(e,i,r,a,n){let{featureIndex:o,bucketIndex:s,sourceLayerIndex:l,layoutVertexArrayOffset:h}=i,u=this.bucketLayerIDs[s],c=r.layers,d=Object.keys(c);if(d.length&&!function(e,i){for(let r=0;r<e.length;r++)if(i.indexOf(e[r])>=0)return!0;return!1}(d,u))return;let p=r.sourceCache,f=this.sourceLayerCoder.decode(l),m=this.vtLayers[f].feature(o),_=this.getId(m,f);for(let i=0;i<u.length;i++){let r=u[i];if(!c[r])continue;let{styleLayer:s,targets:l}=c[r],d={};void 0!==_&&(d=p.getFeatureState(s.sourceLayer,_));let f=!n||n(m,s,d,h);if(!f)continue;let g=new p1(m,this.z,this.x,this.y,_);g.tile=this.tileID.canonical,g.state=d;let y=this.serializedLayersCache.get(r);y||((y=s.serialize()).id=r,this.serializedLayersCache.set(r,y)),g.source=y.source,g.sourceLayer=y["source-layer"],g.layer=eZ({},y),g.layer.paint=p3(y.paint,s.paint,m,d,a),g.layer.layout=p3(y.layout,s.layout,m,d,a);let x=!1;for(let e of l){this.updateFeatureProperties(g,e);let{filter:i}=e;if(i){if(m.properties=g.properties,i.needGeometry){let e=oX(m,!0);if(!i.filter(new aG(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!i.filter(new aG(this.tileID.overscaledZ),m))continue}x=!0,e.targetId&&this.addFeatureVariant(g,e)}x&&this.appendToResult(e,r,o,g,f)}}loadMatchingModelFeature(e,i,r,a,n){let o=this.bucketLayerIDs[0][0],s=r.layers;if(!s[o])return;let{styleLayer:l,targets:h}=s[o];if("model"!==l.type)return;let u=a.tile,c=i.featureIndex,d=u.getBucket(l);if(!(d&&d instanceof cQ))return;let p=function(e,i,r,a){let n=e.getNodesInfo()[i];if(n.hiddenByReplacement||!n.node.meshes)return;let o=Number.MAX_VALUE,s=n.node,l=r.tile,h=a.calculatePosMatrix(l.tileID.toUnwrapped(),a.worldSize),u=n.evaluatedScale,c=0;a.elevation&&s.elevation&&(c=s.elevation*a.elevation.exaggeration()),eP.mat4.translate(h,h,[(s.anchor?s.anchor[0]:0)*(u[0]-1),(s.anchor?s.anchor[1]:0)*(u[1]-1),c]),eP.mat4.scale(h,h,u);let d=r.queryGeometry,p=d.isPointQuery()?d.screenBounds:d.screenGeometry,f=function(e){let i=eP.mat4.multiply([],h,e.matrix);eP.mat4.multiply(i,a.expandedFarZProjMatrix,i);for(let r=0;r<e.meshes.length;++r){let n=e.meshes[r];if(r===e.lightMeshIndex)continue;let s=cI(p,a,i,n.aabb);null!=s&&(o=Math.min(s,o))}if(e.children)for(let i of e.children)f(i)};if(f(s),o===Number.MAX_VALUE)return;let m=new oL(0,0);return c1(l.tileID.canonical,m,n.node.anchor[0],n.node.anchor[1]),{intersectionZ:o,position:m,feature:n.feature}}(d,c,a,n);if(!p)return;let{z:f,x:m,y:_}=u.tileID.canonical,{feature:g,intersectionZ:y,position:x}=p,v={};void 0!==g.id&&(v=r.sourceCache.getFeatureState(l.sourceLayer,g.id));let b=new p1({},f,m,_,g.id);b.tile=this.tileID.canonical,b.state=v,b.properties=g.properties,b.geometry={type:"Point",coordinates:[x.lng,x.lat]};let w=this.serializedLayersCache.get(o);w||((w=l.serialize()).id=o,this.serializedLayersCache.set(o,w)),b.source=w.source,b.sourceLayer=w["source-layer"],b.layer=eZ({},w);let T=!1;for(let e of h){this.updateFeatureProperties(b,e);let{filter:i}=e;if(i){if(g.properties=b.properties,i.needGeometry){if(!i.filter(new aG(this.tileID.overscaledZ
7),g,this.tileID.canonical))continue}else if(!i.filter(new aG(this.tileID.overscaledZ),g))continue}T=!0,e.targetId&&this.addFeatureVariant(b,e)}T&&this.appendToResult(e,o,c,b,y)}updateFeatureProperties(e,i,r){if(i.properties){let a={};for(let n in i.properties){let o=i.properties[n].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,r);null!=o&&(a[n]=o)}e.properties=a}}addFeatureVariant(e,i,r){let a={target:i.target,namespace:i.namespace};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,r,a,n){let o=e[i];void 0===o&&(o=e[i]=[]),o.push({featureIndex:r,feature:a,intersectionZ:n})}lookupSymbolFeatures(e,i,r,a,n){let o={};for(let s of(this.loadVTLayers(),e))this.loadMatchingFeature(o,{bucketIndex:i,sourceLayerIndex:r,featureIndex:s,layoutVertexArrayOffset:0},a,n);return o}loadFeature(e){let{featureIndex:i,sourceLayerIndex:r}=e;this.loadVTLayers();let a=this.sourceLayerCoder.decode(r),n=this.vtFeatures[a];if(n[i])return n[i];let o=this.vtLayers[a].feature(i);return n[i]=o,o}hasLayer(e){for(let i of this.bucketLayerIDs)for(let r of i)if(e===r)return!0;return!1}getId(e,i){let r=e.id;if(this.promoteId){let a="string"==typeof this.promoteId?this.promoteId:this.promoteId[i];null!=a&&(r=e.properties[a]),"boolean"==typeof r&&(r=Number(r))}return r}}function p3(e,i,r,a,n){return eK(e,(e,o)=>{let s=i instanceof aK?i.get(o):null;return s&&s.evaluate?s.evaluate(r,a,n):s})}function p4(e,i){return i-e}ab(p2,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let p5=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class p6{static from(e){if(!(e instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(e,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let n=p5[15&r];if(!n)throw Error("Unrecognized array type.");let[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new p6(s,o,n,e)}constructor(e,i=64,r=Float64Array,a){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let n=p5.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${r}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+l,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+l),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=i,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return function e(i,r,a,n,o,s){if(o-n<=a)return;let l=n+o>>1;(function e(i,r,a,n,o,s){for(;o>n;){if(o-n>600){let l=o-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);e(i,r,a,Math.max(n,Math.floor(a-h*c/l+d)),Math.min(o,Math.floor(a+(l-h)*c/l+d)),s)}let l=r[2*a+s],h=n,u=o;for(p8(i,r,n,a),r[2*o+s]>l&&p8(i,r,n,o);h<u;){for(p8(i,r,h,u),h++,u--;r[2*h+s]<l;)h++;for(;r[2*u+s]>l;)u--}r[2*n+s]===l?p8(i,r,n,u):p8(i,r,++u,o),u<=a&&(n=u+1),a<=u&&(o=u-1)}})(i,r,l,n,o,s),e(i,r,a,n,l-1,1-s),e(i,r,a,l+1,o,1-s)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:s}=this,l=[0,n.length-1,0],h=[];for(;l.length;){let u=l.pop()||0,c=l.pop()||0,d=l.pop()||0;if(c-d<=s){for(let s=d;s<=c;s++){let l=o[2*s],u=o[2*s+1];l>=e&&l<=r&&u>=i&&u<=a&&h.push(n[s])}continue}let p=d+c>>1,f=o[2*p],m=o[2*p+1];f>=e&&f<=r&&m>=i&&m<=a&&h.push(n[p]),(0===u?e<=f:i<=m)&&(l.push(d),l.push(p-1),l.push(1-u)),(0===u?r>=f:a>=m)&&(l.push(p+1),l.push(c),l.push(1-u))}return h}within(e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:o}=this,s=[0,a.length-1,0],l=[],h=r*r;for(;s.length;){let u=s.pop()||0,c=s.pop()||0,d=s.pop()||0;
7if(c-d<=o){for(let r=d;r<=c;r++)p7(n[2*r],n[2*r+1],e,i)<=h&&l.push(a[r]);continue}let p=d+c>>1,f=n[2*p],m=n[2*p+1];p7(f,m,e,i)<=h&&l.push(a[p]),(0===u?e-r<=f:i-r<=m)&&(s.push(d),s.push(p-1),s.push(1-u)),(0===u?e+r>=f:i+r>=m)&&(s.push(p+1),s.push(c),s.push(1-u))}return l}}function p8(e,i,r,a){p9(e,r,a),p9(i,2*r,2*a),p9(i,2*r+1,2*a+1)}function p9(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function p7(e,i,r,a){let n=e-r,o=i-a;return n*n+o*o}e.$=a5,e.A=iu,e.B=2,e.C=ug,e.D=c7,e.E=tU,e.F=uy,e.G=class extends cF{},e.H=iw,e.I=dj,e.J=tY,e.K=a3,e.L=ai,e.M=r7,e.N=at,e.O=ac,e.P=eR,e.Q=a4,e.R=tT,e.S=am,e.T=ch,e.U=ad,e.V=cF,e.W=ru,e.X=rd,e.Y=rh,e.Z=iA,e._=tq,e.a=function(e){return ti.API_CDN_URL_REGEX.test(e)},e.a$=p1,e.a0=ar,e.a1=ae,e.a2=function(e){let i=e.value,r=[];if(!i)return r;let a=iw(i);return"string"!==a?r=r.concat([new cF(e.key,i,`string expected, "${a}" found`)]):(cB(i,!0)||(r=r.concat([new cF(e.key,i,`invalid url "${i}"`)])),r)},e.a3=a2,e.a4=aH,e.a5=a1,e.a6=aJ,e.a7=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e3(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t$(e.x,i.x,r),y:t$(e.y,i.y,r),z:t$(e.z,i.z,r),azimuthal:t$(e.azimuthal,i.azimuthal,r),polar:t$(e.polar,i.polar,r)}}},e.a8=aG,e.a9=af,e.aA=oB,e.aB=class{constructor(e){this.entries={},this.scheduler=e}request(e,i,r,a){let n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){let[e,r]=n.result;return this.scheduler?this.scheduler.add(()=>{a(e,r)},i):a(e,r),()=>{}}return n.callbacks.push(a),n.cancel||(n.cancel=r((r,a)=>{for(let e of(n.result=[r,a],n.callbacks))this.scheduler?this.scheduler.add(()=>{e(r,a)},i):e(r,a);setTimeout(()=>delete this.entries[e],3e3)})),()=>{n.result||(n.callbacks=n.callbacks.filter(e=>e!==a),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.aC=na,e.aD=function(e,i,r){let a=JSON.stringify(e.request);return e.data&&(this.deduped.entries[a]={result:[null,e.data]}),this.deduped.request(a,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},i=>{let a=tA(e.request,(e,a,n,o)=>{e?i(e):a&&i(null,{vectorTile:r?void 0:new lU.VectorTile(new h6(a)),rawData:a,cacheControl:n,expires:o})});return()=>{a.cancel(),i()}},i)},e.aE=function(e){++tm>tc&&(e.getActor().send("enforceCacheSizeLimit",tu),tm=0)},e.aF=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.aG=sh,e.aH=cm,e.aI=c_,e.aJ=cf,e.aK=function(e,i){let r=document.createElement("video");r.muted=!0,r.onloadstart=function(){i(null,r)};for(let i=0;i<e.length;i++){let a=document.createElement("source");(function(e){let i=document.createElement("a");return i.href=e,i.protocol===location.protocol&&i.host===location.host})(e[i])||(r.crossOrigin="Anonymous"),a.src=e[i],r.appendChild(a)}return{cancel:()=>{}}},e.aL=cu,e.aM=function(e){return fetch(e).then(e=>e.arrayBuffer()).then(i=>pX(i,0,e))},e.aN=pJ,e.aO=class{constructor(e,i,r,a){this.id=e,this.position=null!=i?new oL(i[0],i[1]):new oL(0,0),this.orientation=null!=r?r:[0,0,0],this.nodes=a,this.uploaded=!1,this.aabb=new sw([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){if(eP.mat4.multiply(e.matrix,i,e.matrix),e.meshes)for(let i of e.meshes){let r=sw.applyTransformFast(i.aabb,e.matrix);this.aabb.encapsulate(r)}if(e.children)for(let i of e.children)this._applyTransformations(i,e.matrix)}computeBoundsAndApplyParent(){let e=eP.mat4.identity([]);for(let i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,r,a,n,o,s=!1){cG(this.matrix,this,e.transform,this.position,i,r,a,n,o,s)}upload(e){if(!this.uploaded){for(let i of this.nodes)cZ(i,e);for(let e of this.nodes)cH(e);this.uploaded=!0}}destroy(){for(let e of this.nodes)c$(e)}},e.aP=eX,e.aQ=uN,e.aR=oN,e.aS=oV,e.aT=nm,e.aU=nz,e.aV=e$,e.aW=n$,e.aX=ci,e.aY=function(){aj.isLoading()||aj.isLoaded()||"deferred"!==aV()||aU()},e.aZ=a6,e.a_=oX,e.aa=oZ,e.ab=eP,e.ac=ej,e.ad=aK,e.ae=sj,e.af=t$,e.ag=8192,e.ah=tW,e.ai=function(e){return e*eO},e.aj=tZ,e.ak=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return function([e,i]){let r=e3([1,e,i]);return{x:r.x,y:r.y,z:r.z}}(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t$(e.x,i.x,r),y:t$(e.y,i.y,r),z:t$(e.z,i.z,r)}}},e.al=function(e,i,r=0,a=!0){let n=new eR(r,r),o=e.sub(n),s=i.add(n),l=[o,new eR(s.x,o.y),s,new eR(o.x,s.y)];return a&&l.push(o.clone()),l},e.am=function(e,i){let r=[];for(let a=0;a<e.length;a++){let n=eG(a-1,-1,e.length-1),o=eG(a+1,-1,e.length-1),s=e[a],l=e[o],h=e[n].sub(s).unit(),u=l.sub(s).unit(),c=u.angleWithSep(h.x,h.y),d=h.add(u).unit().mult(-1*i/Math.sin(c/2));
7r.push(s.add(d))}return r},e.an=uV,e.ao=o6,e.ap=function(e,i,r=0){return eP.vec3.fromValues(((i.x-r)*e.scale-e.x)*8192,(i.y*e.scale-e.y)*8192,i.z*ok(oV(i.y)))},e.aq=sm,e.ar=hD,e.as=function(e){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let o of e)i=Math.min(i,o.x),r=Math.min(r,o.y),a=Math.max(a,o.x),n=Math.max(n,o.y);return{min:new eR(i,r),max:new eR(a,n)}},e.at=oF,e.au=o5,e.av=oH,e.aw=eU,e.ax=oI,e.ay=function(e,i){let r={};for(let a=0;a<i.length;a++){let n=i[a];n in e&&(r[n]=e[n])}return r},e.az=oO,e.b=function(e){return ti.API_FONTS_REGEX.test(e)},e.b$=cb,e.b0=e5,e.b1=hP,e.b2=lx,e.b3=oW,e.b4=np,e.b5=nU,e.b6=sf,e.b7=n8,e.b8=s9,e.b9=co,e.bA=l2,e.bB=uR,e.bC=uD,e.bD=uh,e.bE=p6,e.bF=eG,e.bG=e8,e.bH=function(e,i){return e/ok(i)},e.bI=function(e,i,r){e[4*i+0]=r[0],e[4*i+1]=r[1],e[4*i+2]=r[2],e[4*i+3]=r[3]},e.bJ=od,e.bK=os,e.bL=ol,e.bM=oo,e.bN=on,e.bO=oL,e.bP=u3,e.bQ=sl,e.bR=sb,e.bS=cv,e.bT=ss,e.bU=sz,e.bV=function(e,i,r,a,n,o,s,l,h){if("globe"===h.name)return sz(e,i,new ss(r,a,n),!1);let u=uN({z:r,x:a,y:n},h);return new sw([(o+u.x/u.scale)*i,u.y/u.scale*i,s],[(o+u.x2/u.scale)*i,u.y2/u.scale*i,l])},e.bW=function(e,i,r){let a=0;for(let r=0;r<2;++r)e[r]>0&&(a+=(e[r]-0)*(e[r]-0)),i[r]<0&&(a+=(0-i[r])*(0-i[r]));return a},e.bX=85.051129,e.bY=6,e.bZ=function(e){let i=eP.mat4.identity(new Float64Array(16));eP.mat4.multiply(i,e.pixelMatrix,e.globeMatrix);let r=[0,oP,0],a=[0,oI,0];return eP.vec3.transformMat4(r,r,i),eP.vec3.transformMat4(a,a,i),[r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!sq(e,new oL(e.center.lat,90)),a[0]>0&&a[0]<=e.width&&a[1]>0&&a[1]<=e.height&&!sq(e,new oL(e.center.lat,-90))]},e.b_=function(e,i){let{scale:r}=e.tileTransform,a=8192*r/(e.tileSize*Math.pow(2,i.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return eP.mat2.scale(new Float32Array(4),i.inverseAdjustmentMatrix,[a,a])},e.ba=function(e,i){let r=sj(i.zoom);if(0===r)return sI(e);let a=sD(e),n=sR(a),o=oF(a.getWest())*i.worldSize,s=oF(a.getEast())*i.worldSize,l=oB(a.getNorth())*i.worldSize,h=oB(a.getSouth())*i.worldSize,u=[o,l,0],c=[s,l,0],d=[o,h,0],p=[s,h,0],f=eP.mat4.invert([],i.globeMatrix);return eP.vec3.transformMat4(u,u,f),eP.vec3.transformMat4(c,c,f),eP.vec3.transformMat4(d,d,f),eP.vec3.transformMat4(p,p,f),n[0]=sC(n[0],d,r),n[1]=sC(n[1],p,r),n[2]=sC(n[2],c,r),n[3]=sC(n[3],u,r),sw.fromPoints(n)},e.bb=sF,e.bc=sL,e.bd=sC,e.be=nf,e.bf=sp,e.bg=pC,e.bh=h6,e.bi=tA,e.bj=function(e){let i=[];for(let r in e)i.push(e[r]);return i},e.bk=function(e,i){let r=[];for(let a in e)a in i||r.push(a);return r},e.bl=eq,e.bm=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.bn=eL,e.bo=function(e,i){let{x:r,y:a}=e.point,n=sU(r,a,e.worldSize/e._pixelsPerMercatorPixel,0,0);return eP.mat4.multiply(n,n,sB(sI(i)))},e.bp=hJ,e.bq=ue,e.br=hK,e.bs=function(e,i,r,a,n){let o=5*i+2;e.float32[o+0]=r,e.float32[o+1]=a,e.float32[o+2]=n},e.bt=u7,e.bu=u_,e.bv=oQ,e.bw=24,e.bx=lW,e.by=ck,e.bz=l1,e.c=ta,e.c$=(e,i,r,a,n,o,s,l)=>{let h=e.transform,u=h.pitch<15?hR(.07,.7,eU((14-h.zoom)/5,0,1)):.07,c="none"===r.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:hO(e,i,r,a),u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:h.calculatePixelsToTileUnitsMatrix(i),u_device_pixel_ratio:n,u_width_scale:o,u_floor_width_scale:s,u_image:0,u_tile_units_to_pixels:hL(i,h),u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toRenderColor(c?null:r.lut).toArray01(),u_emissive_strength:r.paint.get("line-emissive-strength"),u_zbias_factor:u,u_tile_to_meter:oq(i.tileID.canonical,0)}},e.c0=cx,e.c1=function(e){let i=cx(e,!0);return eP.mat2.invert([],[i[0],i[1],i[4],i[5]])},e.c2=s_,e.c3=function(e){let{x:i,y:r}=e.point,{lng:a,lat:n}=e._center;return sU(i,r,e.worldSize,a,n)},e.c4=function(e){return e*ek},e.c5=su,e.c6=5,e.c7=function(e){return eF[Math.round((e+45+360)%360/90)%4]},e.c8=45,e.c9=ok,e.cA=class extends oa{constructor(e){super(e),this.current=op}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let e=0;e<9;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}}},e.cB=eB,e.cC=function(e,i,r){let a=sj(r.zoom),n=e.style.map._antialias,o=i.options.extStandardDerivativesForceOff||e.terrain&&e.terrain.exaggeration()>0;return 0===a&&!n&&!o},e.cD=function(e){let i=e.pixelsPerMeter,r=i/(1/ok(e.center.lat)),a=eP.mat4.identity(new Float64Array(16));return eP.mat4.translate(a,a,[e.point.x,e.point.y,0]),eP.mat4.scale(a,a,[r,r,i]),Float32Array.from(a)},e.cE=sD,e.cF=function(e){return Math.round(Math.pow(Math.abs(Math.sin((e=eU(e,-80.051129,80.051129)/80.051129*90)*eO)),3)*(oC.length-1))},e.cG=function(e,i,r,a){let n=i.getNorth(),o=i.getSouth(),s=i.getWest(),l=i.getEast(),h=1<<e.z,u=l-s,c=n-o,d=u/64,p=-c/oC[r],f=[0,d,0,p,0,0,n,s,0];if(e.z>0){let e=180/a;eP.mat3.multiply(f,f,[e/u+1,0,0,0,e/c+1,0,-.5*e/d,.5*e/p,1])}return f[2]=h,f[5]=e.x,f[8]=e.y,f},e.cH=sI,e.cI=function(e,i,r){let a=eP.mat4.identity(new Float64Array(16));return eP.mat4.rotateY(a,r.globeMatrix,(i/(1<<e)-.5)*Math.PI*2),Float32Array.from(a)},e.cJ=class{isDataAvailableAtPoint(e){let i=this._source();if(this.isUsingMockSource()||!i||e.y<0||e.y>1)return!1;let r=i.getSource().maxzoom,a=1<<r,n=Math.floor(e.x),o=Math.floor((e.x-n)*a),s=Math.floor(e.y*a),l=this.findDEMTileFor(new sh(r,n,r,o,s));return!(!l||!l.dem)}
7getAtPointOrZero(e,i=0){return this.getAtPoint(e,i)||0}getAtPoint(e,i,r=!0){if(this.isUsingMockSource())return null;null==i&&(i=null);let a=this._source();if(!a||e.y<0||e.y>1)return i;let n=a.getSource().maxzoom,o=1<<n,s=Math.floor(e.x),l=e.x-s,h=new sh(n,s,n,Math.floor(l*o),Math.floor(e.y*o)),u=this.findDEMTileFor(h);if(!u||!u.dem)return i;let c=u.dem,d=1<<u.tileID.canonical.z,p=(l*d-u.tileID.canonical.x)*c.dim,f=(e.y*d-u.tileID.canonical.y)*c.dim,m=Math.floor(p),_=Math.floor(f);return(r?this.exaggeration():1)*t$(t$(c.get(m,_),c.get(m,_+1),f-_),t$(c.get(m+1,_),c.get(m+1,_+1),f-_),p-m)}getAtTileOffset(e,i,r){let a=1<<e.canonical.z;return this.getAtPointOrZero(new oZ(e.wrap+(e.canonical.x+i/8192)/a,(e.canonical.y+r/8192)/a))}getAtTileOffsetFunc(e,i,r,a){return n=>{let o=this.getAtTileOffset(e,n.x,n.y),s=a.upVector(e.canonical,n.x,n.y),l=a.upVectorScale(e.canonical,i,r).metersToTile;return eP.vec3.scale(s,s,o*l),s}}getForTilePoints(e,i,r,a){if(this.isUsingMockSource())return!1;let n=cW.create(this,e,a);return!!n&&(i.forEach(e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],r)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;let i=this.findDEMTileFor(e);if(!i||!i.dem)return null;let r=i.dem.tree,a=i.tileID,n=1<<e.canonical.z-a.canonical.z,o=e.canonical.x/n-a.canonical.x,s=e.canonical.y/n-a.canonical.y,l=0;for(let i=0;i<e.canonical.z-a.canonical.z&&!r.leaves[l];i++){let e=2*Math.floor(s*=2)+Math.floor(o*=2);l=r.childOffsets[l]+e,o%=1,s%=1}return{min:this.exaggeration()*r.minimums[l],max:this.exaggeration()*r.maximums[l]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(e,i,r){throw Error("Pure virtual method called.")}pointCoordinate(e){throw Error("Pure virtual method called.")}_source(){throw Error("Pure virtual method called.")}isUsingMockSource(){throw Error("Pure virtual method called.")}exaggeration(){throw Error("Pure virtual method called.")}findDEMTileFor(e){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){let e=this.visibleDemTiles;if(0===e.length)return null;let i=!1,r=Number.MAX_VALUE,a=Number.MIN_VALUE;for(let n of e){let e=this.getMinMaxForTile(n.tileID);e&&(r=Math.min(r,e.min),a=Math.max(a,e.max),i=!0)}return i?{min:r,max:a}:null}},e.cK=s5,e.cL=sT,e.cM=function(e,i){return[Math.pow(e[0],2.2)*i,Math.pow(e[1],2.2)*i,Math.pow(e[2],2.2)*i]},e.cN=sV,e.cO=tt,e.cP=te,e.cQ=256,e.cR=function(e,i){let r=[0,0,0],a=sF(sI(i.canonical));return eP.vec3.transformMat4(r,r,a),eP.vec3.transformMat4(r,r,e),r},e.cS=e=>({u_camera_to_center_distance:new oo(e),u_extrude_scale:new om(e),u_device_pixel_ratio:new oo(e),u_matrix:new od(e),u_inv_rot_matrix:new od(e),u_merc_center:new os(e),u_tile_id:new ol(e),u_zoom_transition:new oo(e),u_up_dir:new ol(e),u_emissive_strength:new oo(e)}),e.cT=e=>({u_matrix:new od(e),u_pixels_to_tile_units:new om(e),u_device_pixel_ratio:new oo(e),u_width_scale:new oo(e),u_floor_width_scale:new oo(e),u_units_to_pixels:new os(e),u_dash_image:new on(e),u_gradient_image:new on(e),u_image_height:new oo(e),u_texsize:new os(e),u_tile_units_to_pixels:new oo(e),u_alpha_discard_threshold:new oo(e),u_trim_offset:new os(e),u_trim_fade_range:new os(e),u_trim_color:new oh(e),u_emissive_strength:new oo(e),u_zbias_factor:new oo(e),u_tile_to_meter:new oo(e)}),e.cU=e=>({u_matrix:new od(e),u_texsize:new os(e),u_pixels_to_tile_units:new om(e),u_device_pixel_ratio:new oo(e),u_width_scale:new oo(e),u_floor_width_scale:new oo(e),u_image:new on(e),u_units_to_pixels:new os(e),u_tile_units_to_pixels:new oo(e),u_alpha_discard_threshold:new oo(e),u_trim_offset:new os(e),u_trim_fade_range:new os(e),u_trim_color:new oh(e),u_emissive_strength:new oo(e),u_zbias_factor:new oo(e),u_tile_to_meter:new oo(e)}),e.cV=nC,e.cW=hW,e.cX=hQ,e.cY=sX,e.cZ=(e,i,r,a,n,o)=>{let s;let l=e.transform,h="globe"===l.projection.name;if("map"===o.paint.get("circle-pitch-alignment")){if(h){let e=sV(l.zoom,i.canonical)*l._pixelsPerMercatorPixel;s=Float32Array.from([e,0,0,e])}else s=l.calculatePixelsToTileUnitsMatrix(r)}else s=new Float32Array([l.pixelsToGLUnits[0],0,0,l.pixelsToGLUnits[1]]);let u={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(l.projection),u_matrix:e.translatePosMatrix(i.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:to.devicePixelRatio,u_extrude_scale:s,u_inv_rot_matrix:sW,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(h){u.u_inv_rot_matrix=a,u.u_merc_center=n,u.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],u.u_zoom_transition=sj(l.zoom);let e=8192*n[0],r=8192*n[1];u.u_up_dir=l.projection.upVector(new ss(0,0,0),e,r)}return u},e.c_=hk,e.ca=oh,e.cb=function(e,i,r){let a=Math.sqrt(e*e+i*i+r*r),n=a>0?Math.acos(r/a)*ek:0,o=0!==e||0!==i?Math.atan2(-i,-e)*ek+90:0;return o<0&&(o+=360),[a,o,n]},e.cc=oq,e.cd=sw,e.ce=e3,e.cf=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.cg=function(e,i){return e.readFields(dh,{icons:[]},i)},e.ch=function(e){return e({pluginStatus:aO,pluginURL:ak}),aN.on("pluginStateChange",e),e}
7,e.ci=de,e.cj=uT,e.ck=uw,e.cl=tM,e.cm=aF,e.cn=tl,e.co=tk,e.cp=eQ,e.cq=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(0,i):e},e.cr=function(e){return e.indexOf("\x1f")>=0},e.cs=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(i+1):""},e.ct=function(e){let i=[],r=e.id;return void 0===r&&i.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&i.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&i.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),i},e.cu=function(e,i,r,a){return"custom"===e.type?new cg(e,i):new c2[e.type](e,i,r,a)},e.cv=eJ,e.cw=class extends p1{constructor(e,i){super(e._vectorTileFeature,e._z,e._x,e._y,e.id),e.state&&(this.state={...e.state}),this.target=i.target,this.namespace=i.namespace,i.properties&&(this.properties=i.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=e.source,this.sourceLayer=e.sourceLayer,this.layer=e.layer)}toJSON(){let e=super.toJSON();return e.target=this.target,e.namespace=this.namespace,e}},e.cx=aN,e.cy=tE,e.cz=ou,e.d=function(e){return ti.API_TILEJSON_REGEX.test(e)},e.d$=eK,e.d0=(e,i,r,a,n,o,s,l,h)=>{let u=e.transform,c=u.calculatePixelsToTileUnitsMatrix(i),d="none"===r.paint.get("line-trim-color-use-theme").constantOr("default"),p=u.pitch<15?hR(.07,.7,eU((14-u.zoom)/5,0,1)):.07;return{u_matrix:hO(e,i,r,a),u_pixels_to_tile_units:c,u_device_pixel_ratio:o,u_width_scale:s,u_floor_width_scale:l,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:hF(r)&&i.lineAtlasTexture?i.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:hL(i,e.transform),u_alpha_discard_threshold:0,u_trim_offset:h,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toRenderColor(d?null:r.lut).toArray01(),u_emissive_strength:r.paint.get("line-emissive-strength"),u_zbias_factor:p,u_tile_to_meter:oq(i.tileID.canonical,0)}},e.d1=eW,e.d2=s6,e.d3=h_,e.d4=sc,e.d5=hh,e.d6=2147483648,e.d7=450,e.d8=7,e.d9=.0038760859073359074,e.dA=eV,e.dB=oG,e.dC=oD,e.dD=function([e,i,r]){let a=Math.hypot(e,i,r);return new oL(Math.atan2(e,r)*ek,(.5*Math.PI-Math.acos(-i/a))*ek)},e.dE=cT,e.dF=function(e){let i=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==e6){let i=e.navigator?e.navigator.userAgent:null;e6=!!e.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return e6}(e)&&i&&(i.match("Version/15.4")||i.match("Version/15.5")||i.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.dG=function(e,i){tu=e,tc=i},e.dH=sq,e.dI=sG,e.dJ=function(e){let i=[0,0,0],r=eP.mat4.identity(new Float64Array(16));return eP.mat4.multiply(r,e.pixelMatrix,e.globeMatrix),eP.vec3.transformMat4(i,i,r),new eR(i[0],i[1])},e.dK=function(e,i,r=!1){if(aO===az||aO===aD||aO===aR)throw Error("setRTLTextPlugin cannot be called multiple times.");ak=to.resolveURL(e),aO=az,aL=i,aB(),r||aU()},e.dL=aV,e.dM=function(){de().acquire(c8)},e.dN=function(){let e=j;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(c8),j=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},e.dO=c9,e.dP=function(e){let i=tp();if(!i)return;let r=i.delete(th);e&&r.catch(e).then(()=>e())},e.dQ=c6,e.dR=pB,e.dS=function(e){pR=to.resolveURL(e),pF||(pF=new c7(de(),new tU)),pF.broadcast("setDracoUrl",pR)},e.dT=pN,e.dU=function(e){pO=to.resolveURL(e),pF||(pF=new c7(de(),new tU)),pF.broadcast("setMeshoptUrl",pO)},e.dV=ab,e.dW=s3,e.dX=2,e.dY=pQ,e.dZ=p2,e.d_=hE,e.da=nc,e.db=nq,e.dc=256,e.dd=sB,e.de=nx,e.df=nO,e.dg=nk,e.dh=function(e,i,r,a,n){return eU((e-i)/(r-i)*(n-a)+a,a,n)},e.di=r0,e.dj=oj,e.dk=class{constructor(e,i,r,a){this.context=e,this.format=a,this.size=r,this.texture=e.gl.createTexture();let[n,o,s]=this.size,{gl:l}=e;l.bindTexture(l.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),l.texImage3D(l.TEXTURE_3D,0,this.format,n,o,s,0,cs(this.format),cl(this.format),i.data)}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_3D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_3D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_3D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_3D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_3D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.dl=cA,e.dm=[1,1,1],e.dn=cW,e.dp=cj,e.dq=nE,e.dr=nN,e.ds=6371008.8,e.dt=nB,e.du=nF,e.dv=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new eR(1/0,1/0),max:new eR(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,i=!1){let r=lQ(new eR(0,0),new eR(8192,8192),e),a=[];if(i&&!lK(r,this._globalClipBounds))return a;for(let i of this._activeRegions){if(i.hiddenByOverlap||!lK(r,i))continue;let n=function(e,i,r){let a=1<<r.canonical.z,n=((i.x-r.wrap)*a-r.canonical.x)*8192,o=(i.y*a-r.canonical.y)*8192;return{min:new eR(((e.x-r.wrap)*a-r.canonical.x)*8192,(e.y*a-r.canonical.y)*8192),max:new eR(n,o)}}(i.min,i.max,e);a.push({min:n.min,max:n.max,sourceId:this._sourceIds[i.priority],footprint:i.footprint,footprintTileId:i.tileId,order:i.order,clipMask:i.clipMask,clipScope:i.clipScope})}return a}setSources(e){this._setSources(e.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{let i=[];for(let r of e.cache.getVisibleCoordinates()){let a=e.cache.getTile(r).buckets[e.layer];a&&a.updateFootprints(r.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(e){let i=e.getFootprints();if(0===i.length)return;let r=e.getOrder(),a=e.getClipMask(),n=e.getClipScope();for(let e of i){if(!e.footprint)continue;let i=lQ(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:i.min,max:i.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:r,clipMask:a,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||lX(e.min,i.min)||lX(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(e,i){let r=(e,i)=>e+i;return e.length-i.length||e.reduce(r,"").localeCompare(i.reduce(r,""))}(e.clipScope,i.clipScope));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let i=0;for(;!e&&i!==this._activeRegions.length;){let r=this._activeRegions[i],a=this._prevRegions[i];e=r.priority!==a.priority||!lY(r,a)||r.order!==a.order||r.clipMask!==a.clipMask||!eL(r.clipScope,a.
7clipScope),++i}}if(e){for(let e of(++this._updateTime,this._activeRegions))e.order!==l$&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));let e=e=>{let i=this._activeRegions;if(e>=i.length)return e;let r=i[e].priority;for(;e<i.length&&i[e].priority===r;)++e;return e};if(this._sourceIds.length>1){let i=0,r=e(0);for(;i!==r;){let a=i,n=i;for(;a!==r;){let e=this._activeRegions[a];e.hiddenByOverlap=!1;for(let i=0;i<n;i++){let r=this._activeRegions[i];if(!r.hiddenByOverlap&&e.order===l$&&lK(e,r)&&(e.hiddenByOverlap=function e(i,r,a,n){if(!i||!a)return!1;let o=i.vertices;if(!r.canonical.equals(n.canonical)||r.wrap!==n.wrap){if(a.vertices.length<i.vertices.length)return e(a,n,i,r);let s=r.canonical,l=n.canonical,h=Math.pow(2,l.z-s.z);o=i.vertices.map(e=>new eR((e.x+8192*s.x)*h-8192*l.x,(e.y+8192*s.y)*h-8192*l.y))}return l0(a,o,i.indices,0,i.indices.length,0,0)}(e.footprint,e.tileId,r.footprint,r.tileId),e.hiddenByOverlap))break}++a}r=e(i=r)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let i=e.length-1;i>=0;i--)this._addSource(e[i]);this._computeReplacement()}},e.dw=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){for(let e of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))e.destroy();for(let e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,i){let r=new np,a=new nz,n=[],o=e+1+2,s=i[0]+1,l=i[0]+1+(1+i.length),h=(e,i,r)=>{let a=e===o-1?e-2:0===e?e:e-1;return[a+=r?24575:0,i]};for(let e=0;e<o;++e)r.emplaceBack(...h(e,0,!0));for(let e=0;e<s;++e)for(let i=0;i<o;++i)r.emplaceBack(...h(i,e,0===i||i===o-1));for(let e=0;e<i.length;++e){let a=i[e];for(let e=0;e<o;++e)r.emplaceBack(...h(e,a,!0))}for(let e=0;e<i.length;++e){let s=a.length,h=i[e]+1+2,u=new nz;for(let r=0;r<h-1;r++){let n=r===h-2,s=n?o*(l-i.length+e-r):o;for(let e=0;e<o-1;e++){let i=r*o+e;0===r||n||0===e||e===o-2?(u.emplaceBack(i+1,i,i+s),u.emplaceBack(i+s,i+s+1,i+1)):(a.emplaceBack(i+1,i,i+s),a.emplaceBack(i+s,i+s+1,i+1))}}let c=n8.simpleSegment(0,s,r.length,a.length-s);for(let e=0;e<u.uint16.length;e+=3)a.emplaceBack(u.uint16[e],u.uint16[e+1],u.uint16[e+2]);let d=n8.simpleSegment(0,s,r.length,a.length-s);n.push({withoutSkirts:c,withSkirts:d})}return{vertices:r,indices:a,segments:n}}_createGrid(e){let i=this._fillGridMeshWithLods(64,oC);this._gridSegments=i.segments,this._gridBuffer=e.createVertexBuffer(i.vertices,sf.members),this._gridIndexBuffer=e.createIndexBuffer(i.indices,!0)}_createPoles(e){let i=new nz;for(let e=0;e<=64;e++)i.emplaceBack(0,e+1,e+2);this._poleIndexBuffer=e.createIndexBuffer(i,!0);let r=new nO,a=new nO,n=new nO,o=new nO;this._poleSegments=[];for(let e=0,i=0;e<5;e++){let s=360/(1<<e);r.emplaceBack(0,-oI,0,.5,0),a.emplaceBack(0,-oI,0,.5,1),n.emplaceBack(0,-oI,0,.5,.5),o.emplaceBack(0,-oI,0,.5,.5);for(let e=0;e<=64;e++){let i=e/64,l=0,h=t$(0,s,i),[u,c,d]=oz(sH,s$,h,oI);r.emplaceBack(u,c,d,i,l),a.emplaceBack(u,c,d,i,1-l);let p=h*eO;i=.5+.5*Math.sin(p),l=.5+.5*Math.cos(p),n.emplaceBack(u,c,d,i,l),o.emplaceBack(u,c,d,i,1-l)}this._poleSegments.push(n8.simpleSegment(i,0,66,64)),i+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,sd,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(a,sd,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,sd,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(o,sd,!1)}getGridBuffers(e,i){return[this._gridBuffer,this._gridIndexBuffer,i?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}getPoleBuffers(e,i){return[i?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,i?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},e.dx=l$,e.dy=eN,e.dz=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.e=ti,e.e0=ih,e.e1=ux,e.e2=function(e,i,r,a,n,o,s,l,h,u,c=1,d,p){e.createArrays(),e.tilePixelRatio=8192/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;let f=e.layers[0].layout,m=e.layers[0]._unevaluatedLayout._values,_={};
7_.scaleFactor=c,_.textSizeScaleRange=f.get("text-size-scale-range"),_.iconSizeScaleRange=f.get("icon-size-scale-range");let[g,y]=_.textSizeScaleRange,[x,v]=_.iconSizeScaleRange;if(_.textScaleFactor=eU(_.scaleFactor,g,y),_.iconScaleFactor=eU(_.scaleFactor,x,v),"composite"===e.textSizeData.kind){let{minZoom:i,maxZoom:r}=e.textSizeData;_.compositeTextSizes=[m["text-size"].possiblyEvaluate(new aG(i),l),m["text-size"].possiblyEvaluate(new aG(r),l)]}if("composite"===e.iconSizeData.kind){let{minZoom:i,maxZoom:r}=e.iconSizeData;_.compositeIconSizes=[m["icon-size"].possiblyEvaluate(new aG(i),l),m["icon-size"].possiblyEvaluate(new aG(r),l)]}_.layoutTextSize=m["text-size"].possiblyEvaluate(new aG(h+1),l),_.layoutIconSize=m["icon-size"].possiblyEvaluate(new aG(h+1),l),_.textMaxSize=m["text-size"].possiblyEvaluate(new aG(18),l);let b="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),w=f.get("text-size"),T=!1;for(let i of e.features)if(i.icon&&i.icon.nameSecondary){T=!0;break}for(let o of e.features){let h=f.get("text-font").evaluate(o,{},l).join(","),c=w.evaluate(o,{},l)*_.textScaleFactor,g=_.layoutTextSize.evaluate(o,{},l)*_.textScaleFactor,y=(_.layoutIconSize.evaluate(o,{},l),{horizontal:{},vertical:void 0}),x=o.text,v,S=[0,0];if(x){let a=x.toString(),s=24*f.get("text-letter-spacing").evaluate(o,{},l),u=24*f.get("text-line-height").evaluate(o,{},l),d=!function(e){for(let r of e){var i;if(i=r.charCodeAt(0),aE.Arabic(i)||aE["Arabic Supplement"](i)||aE["Arabic Extended-A"](i)||aE["Arabic Presentation Forms-A"](i)||aE["Arabic Presentation Forms-B"](i))return!1}return!0}(a)?0:s,p=f.get("text-anchor").evaluate(o,{},l),m=f.get("text-variable-anchor");if(!m){let e=f.get("text-radial-offset").evaluate(o,{},l);S=e?uD(p,[24*e,uP]):f.get("text-offset").evaluate(o,{},l).map(e=>24*e)}let _=b?"center":f.get("text-justify").evaluate(o,{},l),v="point"===f.get("symbol-placement"),w=v?24*f.get("text-max-width").evaluate(o,{},l):1/0,T=o=>{e.allowVerticalPlacement&&aA(a)&&(y.vertical=ur(x,i,r,n,h,w,u,p,o,d,S,ue.vertical,!0,g,c))};if(!b&&m){let e="auto"===_?m.map(e=>uR(e)):[_],a=!1;for(let o=0;o<e.length;o++){let s=e[o];if(!y.horizontal[s]){if(a)y.horizontal[s]=y.horizontal[0];else{let e=ur(x,i,r,n,h,w,u,"center",s,d,S,ue.horizontal,!1,g,c);e&&(y.horizontal[s]=e,a=1===e.positionedLines.length)}}}T("left")}else{if("auto"===_&&(_=uR(p)),v||f.get("text-writing-mode").indexOf("horizontal")>=0||!aA(a)){let e=ur(x,i,r,n,h,w,u,p,_,d,S,ue.horizontal,!1,g,c);e&&(y.horizontal[_]=e)}T(v?"left":_)}}let M=!1,E=!1;if(o.icon&&o.icon.namePrimary){let i=hX(e.iconSizeData,m["icon-size"],l,e.zoom,o)*_.iconScaleFactor*d,r=o.icon.getPrimary().scaleSelf(i).serialize(),s=a[r];s&&(v=function(e,i,r,a){let{horizontalAlign:n,verticalAlign:o}=uh(a),s=r[0]-e.displaySize[0]*n,l=r[1]-e.displaySize[1]*o;return{imagePrimary:e,imageSecondary:i,top:l,bottom:l+e.displaySize[1],left:s,right:s+e.displaySize[0]}}(n[r],o.icon.nameSecondary?n[o.icon.getSecondary().scaleSelf(i).serialize()]:void 0,f.get("icon-offset").evaluate(o,{},l),f.get("icon-anchor").evaluate(o,{},l)),M=s.sdf,E=s.usvg,void 0===e.sdfIcons?e.sdfIcons=s.sdf:e.sdfIcons!==s.sdf&&e1("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(s.pixelRatio!==e.pixelRatio||0!==f.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}let A=uO(y.horizontal)||y.vertical;e.iconsInText||(e.iconsInText=!!A&&A.iconsInText),(A||v)&&function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){var g;let y,x=o.textMaxSize.evaluate(i,{},p);void 0===x?x=s*o.textScaleFactor:x*=o.textScaleFactor;let v=e.layers[0].layout,b=v.get("icon-offset").evaluate(i,{},p),w=uO(r.horizontal)||r.vertical,T="globe"===f.name,S=s*o.textScaleFactor/24,M=e.tilePixelRatio*x/24,E=(g=e.overscaling,e.zoom>18&&g>2&&(g>>=1),Math.max(8192/(512*g),1)*v.get("symbol-spacing")),A=v.get("text-padding")*e.tilePixelRatio,I=v.get("icon-padding")*e.tilePixelRatio,C=v.get("text-max-angle")*eO,P="map"===v.get("text-rotation-alignment")&&"point"!==v.get("symbol-placement"),z="map"===v.get("icon-rotation-alignment")&&"point"!==v.get("symbol-placement"),D=v.get("symbol-placement"),R=E/2,L=v.get("icon-text-fit").evaluate(i,{},p),O=v.get("icon-text-fit-padding").evaluate(i,{},p),k="none"!==L;!1===e.hasAnyIconTextFit&&k&&(e.hasAnyIconTextFit=!0),a&&k&&(e.allowVerticalPlacement&&r.vertical&&(y=uc(a,r.vertical,L,O,b,S)),w&&(a=uc(a,w,L,O,b,S)));let F=(s,l,g)=>{if(l.x<0||l.x>=8192||l.y<0||l.y>=8192)return;let x=null;if(T){let{x:e,y:i,z:r}=f.projectTilePoint(l.x,l.y,g);x={anchor:new ud(e,i,r,0,void 0),up:f.upVector(g,l.x,l.y)}}!function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I){let C=e.addToLineVertexArray(i,a),P,z,D,R,L,O,k,F=0,B=0,N=0,V=0,U=-1,j=-1,G={},q=tk(""),Z=r?r.anchor:i,H="none"!==h.layout.get("icon-text-fit").evaluate(b,{},E),$=0,W=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")?[$,W]=h.layout.get("text-offset").evaluate(b,{},E).map(e=>24*e):($=24*h.layout.get("text-radial-offset").evaluate(b,{},E),W=uP),e.allowVerticalPlacement&&n.vertical){let e=n.vertical;if(m)O=uF(e),l&&(k=uF(l));else{let r=h.layout.get("text-rotate").evaluate(b,{},E)+90;D=uk(u,Z,i,c,d,p,e,f,r,_),l&&(R=uk(u,Z,i,c,d,p,l,y,r))}}if(o){let a=e.iconSizeData,n=S?hX(e.iconSizeData,e.layers[0]._unevaluatedLayout._values["icon-size"],E,e.zoom,b):1,s=h.layout.get("icon-rotate").evaluate(b,{},E),f=uM(o,s,T,H,S?1/n:w.iconScaleFactor),m=l?uM(l,s,T,H,w.iconScaleFactor):void 0;z=uk(u,Z,i,c,d,p,o,y,s,null,S?w.iconScaleFactor*n:1),F=4*f.length;let _=null;"source"===a.kind?(_=[128*h.layout.get("icon-size").evaluate(b,{},E)*w.iconScaleFactor])[0]>32640&&e1(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===a.kind&&((_=[128*w.compositeIconSizes[0].evaluate(b,{},E)*w.iconScaleFactor,128*w.compositeIconSizes[1].evaluate(b,{},E)*w.iconScaleFactor])[0]>32640||_[1]>32640)&&e1(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),e.addSymbols(e.icon,f,_,v,x,b,!1,r,i,C.lineStartIndex,C.lineLength,-1,M,E,A,I),U=e.icon.placedSymbolArray.length-1,m&&(B=4*m.length,e.addSymbols(e.icon,m,_,v,x,b,ue.vertical,r,i,C.lineStartIndex,C.lineLength,-1,M,E,A,I),j=e.icon.placedSymbolArray.length-1)}for(let a in n.horizontal){let o=n.horizontal[a];P||(q=tk(o.text),m?L=uF(o):P=uk(u,Z,i,c,d,p,o,f,h.layout.get("text-rotate").evaluate(b,{},E),_));let l=1===o.positionedLines.length;if(N+=uL(e,r,i,o,s,h,m,b,_,C,n.vertical?ue.horizontal:ue.horizontalOnly,l?Object.keys(n.horizontal):[a],G,U,w,M,E,A),l)break}n.vertical&&(V+=uL(e,r,i,n.vertical,s,h,m,b,_,C,ue.vertical,["vertical"],G,j,w,M,E,A));let X=-1,Y=(e,i)=>e?Math.max(e,i):i;X=Y(L,-1),X=Y(O,X);let K=(X=Y(k,X))>-1?1:0;e.glyphOffsetArray.length>=65535&&e1("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKey
7Ranges(e.symbolInstances.length,b.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,Z.x,Z.y,Z.z,G.right>=0?G.right:-1,G.center>=0?G.center:-1,G.left>=0?G.left:-1,G.vertical>=0?G.vertical:-1,U,j,q,void 0!==P?P:e.collisionBoxArray.length,void 0!==P?P+1:e.collisionBoxArray.length,void 0!==D?D:e.collisionBoxArray.length,void 0!==D?D+1:e.collisionBoxArray.length,void 0!==z?z:e.collisionBoxArray.length,void 0!==z?z+1:e.collisionBoxArray.length,R||e.collisionBoxArray.length,R?R+1:e.collisionBoxArray.length,c,N,V,F,B,K,0,$,W,X,0,H?1:0)}(e,l,x,s,r,a,n,y,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,A,P,h,0,I,z,b,i,o,u,c,d,p,m,_)};if("line"===D)for(let n of u_(i.geometry,0,0,8192,8192))for(let i of function(e,i,r,a,n,o,s,l,h){let u=a?14.399999999999999*s:0,c=um(a,n),d=c*s,p=0===e[0].x||8192===e[0].x||0===e[0].y||8192===e[0].y;return i-d<i/4&&(i=d+i/4),function e(i,r,a,n,o,s,l,h,u){let c=s/2,d=uf(i),p=0,f=r-a,m=[];for(let e=0;e<i.length-1;e++){let r=i[e],l=i[e+1],h=r.dist(l),_=l.angleTo(r);for(;f+a<p+h;){let g=((f+=a)-p)/h,y=t$(r.x,l.x,g),x=t$(r.y,l.y,g);if(y>=0&&y<u&&x>=0&&x<u&&f-c>=0&&f+c<=d){let r=new ud(y,x,0,_,e);n&&!up(i,r,s,n,o)||m.push(r)}}p+=h}return h||m.length||l||(m=e(i,p/2,a,n,o,s,l,!0,u)),m}(e,p?i/2*l%i:(c/2+48)*s*l%i,i,u,r,d,p,!1,8192)}(n,E,C,r.vertical||w,a,0,M,e.overscaling,8192))w&&function(e,i,r,a){let n=e.compareText;if(i in n){let e=n[i];for(let i=e.length-1;i>=0;i--)if(a.dist(e[i])<r)return!0}else n[i]=[];return n[i].push(a),!1}(e,w.text,R,i)||F(n,i,p);else if("line-center"===D){for(let e of i.geometry)if(e.length>1){let i=function(e,i,r,a,n,o){let s=r?14.399999999999999*o:0,l=um(r,a)*o,h=0,u=uf(e)/2;for(let r=0;r<e.length-1;r++){let a=e[r],n=e[r+1],o=a.dist(n);if(h+o>u){let c=(u-h)/o,d=new ud(t$(a.x,n.x,c),t$(a.y,n.y,c),0,n.angleTo(a),r);return!s||up(e,d,l,s,i)?d:void 0}h+=o}}(e,C,r.vertical||w,a,0,M);i&&F(e,i,p)}}else if("Polygon"===i.type)for(let e of lf(i.geometry,0)){let i=function(e,i=1,r=!1){let a=1/0,n=1/0,o=-1/0,s=-1/0,l=e[0];for(let e=0;e<l.length;e++){let i=l[e];(!e||i.x<a)&&(a=i.x),(!e||i.y<n)&&(n=i.y),(!e||i.x>o)&&(o=i.x),(!e||i.y>s)&&(s=i.y)}let h=Math.min(o-a,s-n),u=h/2,c=new iY([],uI);if(0===h)return new eR(a,n);for(let i=a;i<o;i+=h)for(let r=n;r<s;r+=h)c.push(new uC(i+u,r+u,u,e));let d=function(e){let i=0,r=0,a=0,n=e[0];for(let e=0,o=n.length,s=o-1;e<o;s=e++){let o=n[e],l=n[s],h=o.x*l.y-l.x*o.y;r+=(o.x+l.x)*h,a+=(o.y+l.y)*h,i+=3*h}return new uC(r/i,a/i,0,e)}(e),p=c.length;for(;c.length;){let a=c.pop();(a.d>d.d||!d.d)&&(d=a,r&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,p)),a.max-d.d<=i||(u=a.h/2,c.push(new uC(a.p.x-u,a.p.y-u,u,e)),c.push(new uC(a.p.x+u,a.p.y-u,u,e)),c.push(new uC(a.p.x-u,a.p.y+u,u,e)),c.push(new uC(a.p.x+u,a.p.y+u,u,e)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}(e,16);F(e[0],new ud(i.x,i.y,0,0,void 0),p)}else if("LineString"===i.type)for(let e of i.geometry)F(e,new ud(e[0].x,e[0].y,0,0,void 0),p);else if("Point"===i.type)for(let e of i.geometry)for(let i of e)F([i],new ud(i.x,i.y,0,0,void 0),p)}(e,o,y,v,a,_,g,0,S,M,E,s,l,u,p,T)}o&&e.generateCollisionDebugBuffers(h,e.collisionBoxArray,_.textScaleFactor)},e.e3=lU,e.e4=dQ,e.e5=eD,e.e6=lV,e.e7=h5,e.e8=K,e.e9=function(e){let i=0;if(1179937895!==new Uint32Array(e,0,1)[0]){let r=new Uint32Array(e,0,7),[,,a,n,o,s]=r;i=r.byteLength+n+o+s+o,(a!==e.byteLength||i>=e.byteLength)&&e1("Invalid b3dm header information.")}return pX(e,i)},e.ea=function(e,i){let r=pJ(e);for(let e of r){for(let i of e.meshes)(function(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);let i=e.vertexArray.float32,r=e.aabb.min[0]-1,a=e.aabb.min[1]-1,n=64/(e.aabb.max[0]-r+2),o=64/(e.aabb.max[1]-a+2);for(let s=0;s<i.length;s+=3){let l=i[s+2],h=(i[s+0]-r)*n|0,u=(i[s+1]-a)*o|0;l>e.heightmap[64*u+h]&&(e.heightmap[64*u+h]=l)}})(i);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(function(e,i){let r={};r.indexArray=new nz,r.indexArray.reserve(4*e.length),r.vertexArray=new nx,r.vertexArray.reserve(10*e.length),r.colorArray=new ny,r.vertexArray.reserve(10*e.length);let a=0;for(let n of e){let e=Math.min(10,Math.max(4,1.3*n.height))*i,o=[-n.normal[1],n.normal[0],0],s=Math.min(.29,.1*n.width/n.depth),l=n.width-2*n.depth*i*(s+.01),h=eP.vec3.scaleAndAdd([],n.pos,o,l/2),u=eP.vec3.scaleAndAdd([],n.pos,o,-l/2),c=[h[0],h[1],h[2]+n.height],d=[u[0],u[1],u[2]+n.height],p=eP.vec3.scaleAndAdd([],n.normal,o,s);eP.vec3.scale(p,p,e);let f=eP.vec3.scaleAndAdd([],n.normal,o,-s);eP.vec3.scale(f,f,e),eP.vec3.add(p,h,p),eP.vec3.add(f,u,f),h[2]+=.1,u[2]+=.1,r.vertexArray.emplaceBack(p[0],p[1],p[2]),r.vertexArray.emplaceBack(f[0],f[1],f[2]),r.vertexArray.emplaceBack(h[0],h[1],h[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(c[0],c[1],c[2]),r.vertexArray.emplaceBack(d[0],d[1],d[2]),r.vertexArray.emplaceBack(h[0],h[1],h[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(p[0],p[1],p[2]),r.vertexArray.emplaceBack(f[0],f[1],f[2]);let m=l/e/2;r.colorArray.emplaceBack(-m-s,-1,m,.8),r.colorArray.emplaceBack(m+s,-1,m,.8),r.colorArray.emplaceBack(-m,0,m,1.3),r.colorArray.emplaceBack(m,0,m,1.3),r.colorArray.emplaceBack(m+s,-.8,m,.7),r.colorArray.emplaceBack(m+s,-.8,m,.7),r.colorArray.emplaceBack(0,0,m,1.3),r.colorArray.emplaceBack(0,0,m,1.3),r.colorArray.emplaceBack(m+s,-1.2,m,.8),r.colorArray.emplaceBack(m+s,-1.2,m,.8),r.indexArray.emplaceBack(6+a,4+a,8+a),r.indexArray.emplaceBack(7+a,9+a,5+a),r.indexArray.emplaceBack(0+a,1+a,2+a),r.indexArray.emplaceBack(1+a,3+a,2+a),a+=10}let n={defined:!0,emissiveFactor:[0,0,0]},o={};return o.baseColorFactor=tZ.white,n.pbrMetallicRoughness=o,r.material=n,r.aabb=new sw([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}(e.lights,i)))}return r},e.eb=cQ,e.ec=c5,e.ed=aj,e.ee=function(e){tf(),null!=l&&l.then(i=>{i.keys().then(r=>{for(let a=0;a<r.length-e;a++)i.delete(r[a])})})},e.f=function(e){return 0===e.indexOf("mapbox:")},e.g=function(e,i){return tE(eZ(e,{method:"GET"}),i)},e.h=tr,e.i=function(e){return ti.API_STYLE_REGEX.test(e)&&!ta(e)},e.j=function(e){return decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},e.k=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(Number("0x"+i))))},e.l=eZ,e.m=t_,e.n=function(e,i){return tE(eZ(e,{type:"json"}),i)},e.o=tC,e.p=function(e,i){return tE(eZ(e,{method:"POST"}),i)},e.q=to,e.r=s4,e.s=function(e){try{let i=self[e];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=tn,e.u=function(){return function e(i){return i?(i^Math.random()*(16>>i/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=e1,e.x=function(){return G||(G=new c9),G},e.y=tB,e.z=tF}),a(["./shared"],function(e){function i(e){let i=e?e.url.toString():void 0;return i?performance.getEntriesByName(i):[]}function r(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(let a of e)i+=`${r(a)},`;return`${i}]`}let i="{";for(let a of Object.keys(e).sort())i+=`${a}:${r(e[a])},`;return`${i}}`}class a{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,i){this._layerConfigs={},this._layers={},this.update(e,[],i)}update(i,a,n){for(let r of(this._options=n,i))this._layerConfigs[r.id]=r,(this._layers[r.id]=e.cu(r,this.scope,null,this._options)).compileFilter(n),this.keyCache[r.id]&&delete this.keyCache[r.id];for(let e of a)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];for(let i of(this.familiesBySource={},function(i,a){let n={};for(let o=0;o<i.length;o++){let s=i[o],l=a&&a[s.id];!l&&(l=function(i){let a="";for(let n of e.bm)a+=`/${r(i[n])}`;return a}(s),"line"===s.type&&s.paint)&&function e(i){return"string"==typeof i&&"line-progress"===i||(Array.isArray(i)?i.some(e):!(!i||"object"!=typeof i)&&Object.values(i).some(e))}(s.paint["line-width"])&&(l+=`/${r(s.paint["line-width"])}`),a&&(a[s.id]=l);let h=n[l];h||(h=n[l]=[]),h.push(s)}let o=[];for(let e in n)o.push(n[e]);return o}(e.bj(this._layerConfigs),this.keyCache))){let e=i.map(e=>
7this._layers[e.id]),r=e[0];if("none"===r.visibility)continue;let a=r.source||"",n=this.familiesBySource[a];n||(n=this.familiesBySource[a]={});let o=r.sourceLayer||"_geojsonTileLayer",s=n[o];s||(s=n[o]=[]),s.push(e)}}}let n=1*e.dX;class o{constructor(i){let r={},a=[];for(let e in i){let o=i[e],s=r[e]={};for(let e in o.glyphs){let i=o.glyphs[+e];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;let r=i.metrics.localGlyph?n:1,l={x:0,y:0,w:i.bitmap.width+2*r,h:i.bitmap.height+2*r};a.push(l),s[e]=l}}let{w:o,h:s}=e.C(a),l=new e.dW({width:o||1,height:s||1});for(let a in i){let o=i[a];for(let i in o.glyphs){let s=o.glyphs[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;let h=r[a][i],u=s.metrics.localGlyph?n:1;e.dW.copy(s.bitmap,l,{x:0,y:0},{x:h.x+u,y:h.y+u},s.bitmap)}}this.image=l,this.positions=r}}e.dV(o,"GlyphAtlas");class s{constructor(i){this.tileID=new e.aG(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.lut=i.lut,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.scope=i.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.request&&i.request.collectResourceTiming,this.promoteId=i.promoteId,this.isSymbolTile=i.isSymbolTile,this.tileTransform=e.aQ(i.tileID.canonical,i.projection),this.projection=i.projection,this.worldview=i.worldview,this.localizableLayerIds=i.localizableLayerIds,this.brightness=i.brightness,this.extraShadowCaster=!!i.extraShadowCaster,this.tessellationStep=i.tessellationStep,this.scaleFactor=i.scaleFactor}parse(i,r,a,n,s){let h,u,c,d;this.status="parsing",this.data=i,this.collisionBoxArray=new e.aW;let p=new e.dY(Object.keys(i.layers).sort()),f=new e.dZ(this.tileID,this.promoteId);f.bucketLayerIDs=[];let m={},_=new e.d_(256,256),g={featureIndex:f,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:_,availableImages:a,brightness:this.brightness,scaleFactor:this.scaleFactor},y=r.familiesBySource[this.source];for(let r in y){let n=i.layers[r];if(!n)continue;let o=!1,s=!1,h=!1;for(let e of y[r])"symbol"===e[0].type?o=!0:s=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h||!0===this.isSymbolTile&&!o||!1===this.isSymbolTile&&!s)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let u=p.encode(r),c=[];for(let e=0,i=0;e<n.length;e++){let a=n.feature(e),o=f.getId(a,r);if(this.localizableLayerIds&&this.localizableLayerIds.has(r)){let e=a.properties?a.properties.worldview:null;if(this.worldview&&"string"==typeof e){if("all"===e)a.properties.$localized=!0;else{if(!e.split(",").includes(this.worldview))continue;a.properties.$localized=!0,a.properties.worldview=this.worldview}}}c.push({feature:a,id:o,index:i,sourceLayerIndex:u}),i++}for(let i of y[r]){let r=i[0];(!this.extraShadowCaster||r.is3D()&&"model"!==r.type)&&(void 0!==this.isSymbolTile&&"symbol"===r.type!==this.isSymbolTile||r.minzoom&&this.zoom<Math.floor(r.minzoom)||r.maxzoom&&this.zoom>=r.maxzoom||"none"!==r.visibility&&(l(i,this.zoom,g.brightness,a),(m[r.id]=r.createBucket({index:f.bucketLayerIDs.length,layers:i,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:u,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(c,g,this.tileID.canonical,this.tileTransform),f.bucketLayerIDs.push(i.map(i=>e.aC(i.id,i.scope)))))}}_.trim();let x={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},v=()=>{if(h)return this.status="done",s(h);if(this.extraShadowCaster)this.status="done",s(null,{buckets:e.bj(m).filter(e=>!e.isEmpty()),featureIndex:f,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:g.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(u&&c&&d){let i=new o(u),r=new e.e1(c,d,this.lut);for(let n in m){let o=m[n];o instanceof e.aX?(l(o.layers,this.zoom,g.brightness,a),e.e2(o,u,i.positions,c,r.iconPositions,this.showCollisionBoxes,a,this.tileID.canonical,this.tileZoom,this.projection,this.scaleFactor,this.pixelRatio,this.brightness)):o.hasPattern&&(o instanceof e.b1||o instanceof e.b2||o instanceof e.d5)&&(l(o.layers,this.zoom,g.brightness,a),o.addFeatures(g,this.tileID.canonical,r.patternPositions,a,this.tileTransform,this.brightness))}this.status="done",s(null,{buckets:e.bj(m).filter(e=>!e.isEmpty()),featureIndex:f,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:_,imageAtlas:r,brightness:g.brightness})}};if(!this.extraShadowCaster){let i=e.d$(g.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(i).length?n.send("getGlyphs",{uid:this.uid,stacks:i,scope:this.scope},(e,i)=>{h||(h=e,u=i,v())},void 0,!1,x):u={};let r=Object.keys(g.iconDependencies);r.length?n.send("getImages",{icons:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,i)=>{if(h)return;h=e;let r={};Object.values(i).some(e=>e.usvg)?this.rasterize(n,r,i,g.iconDependencies,()=>{c=r,v()}):(this.fillImageMap(r,g.iconDependencies,i),c=r,v())},void 0,!1,x):c={};let a=Object.keys(g.patternDependencies);a.length?n.send("getImages",{icons:a,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,i)=>{if(!h){h=e;let r={};Object.values(i).some(e=>e.usvg)?this.rasterize(n,r,i,g.patternDependencies,()=>{d=r,v()}):(this.fillImageMap(r,g.patternDependencies,i),d=r,v())}},void 0,!1,x):d={}}v()}fillImageMap(e,i,r){for(let a in r)for(let n of i[a]||[])r[n.id].usvg||(e[n.serialize()]=r[n.id])}getImageTaskQueue(e,i,r){let a={};for(let n in i)for(let o of r[n]||[]){let r=o.serialize();i[o.id].usvg?a[r]||(a[r]=o):e[r]=i[o.id]}return a}rasterize(i,r,a,n,o){let s=this.getImageTaskQueue(r,a,n);this.rasterizeTask=i.send("rasterizeImages",{scope:this.scope,imageTasks:s},(i,n)=>{if(!i)for(let i in n){let{id:o}=e.e0.deserializeFromString(i);r[i]=Object.assign({},a[o],{data:n[i]})}o()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function l(i,r,a,n){let o=new e.a8(r,{brightness:a});for(let e of i)e.recalculate(o,n)}class h extends e.E{constructor(i,r,a,n,o,s){super(),this.actor=i,this.layerIndex=r,this.availableImages=a,this.loadVectorData=o||e.aD,this.loading={},this.loaded={},this.deduped=new e.aB(i.scheduler),this.isSpriteLoaded=n,this.scheduler
7=i.scheduler,this.brightness=s}loadTile(r,a){let n=r.uid,o=r&&r.request,l=o&&o.collectResourceTiming,h=this.loading[n]=new s(r);h.abort=this.loadVectorData(r,(s,u)=>{let c=!this.loading[n];if(delete this.loading[n],h.cancelRasterize(),c||s||!u)return h.status="done",c||(this.loaded[n]=h),a(s);let d=u.rawData,p={};u.expires&&(p.expires=u.expires),u.cacheControl&&(p.cacheControl=u.cacheControl),h.vectorTile=u.vectorTile||new e.e3.VectorTile(new e.bh(d));let f=()=>{h.parse(h.vectorTile,this.layerIndex,this.availableImages,this.actor,(r,n)=>{if(r||!n)return a(r);let s={};if(l){let e=i(o);e.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(e)))}a(null,e.l({rawTileData:d.slice(0)},n,p,s))})};this.isSpriteLoaded?f():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(f,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom}):f()}),this.loaded=this.loaded||{},this.loaded[n]=h})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let o=a[n];o.scaleFactor=i.scaleFactor,o.showCollisionBoxes=i.showCollisionBoxes,o.projection=i.projection,o.brightness=i.brightness,o.tileTransform=e.aQ(i.tileID.canonical,i.projection),o.extraShadowCaster=i.extraShadowCaster,o.lut=i.lut;let s=(e,i)=>{let a=o.reloadCallback;a&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a)),r(e,i)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}else r(null,void 0)}abortTile(e,i){let r=e.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r]),i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}class u{loadTile(i,r){let{uid:a,encoding:n,rawImageData:o,padding:s}=i,l=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;r(null,new e.e4(a,l,n,s<1))}getImageData(e,i){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);let r=this.offscreenCanvasContext.getImageData(-i,-i,e.width+2*i,e.height+2*i);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),r}}e.bg.setPbf(e.bh);class c{decodeRasterArray({task:i,buffer:r},a){e.bg.performDecoding(r,i).then(e=>{a(null,e)},e=>{a(e)})}}let d=e.e3.VectorTileFeature.prototype.toGeoJSON;class p{constructor(i){this._feature=i,this.extent=e.ag,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){if(1===this._feature.type){let i=[];for(let r of this._feature.geometry)i.push([new e.P(r[0],r[1])]);return i}{let i=[];for(let r of this._feature.geometry){let a=[];for(let i of r)a.push(new e.P(i[0],i[1]));i.push(a)}return i}}toGeoJSON(e,i,r){return d.call(this,e,i,r)}}class f{constructor(i){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.ag,this.length=i.length,this._features=i}feature(e){return new p(this._features[e])}}let m=64/4096;class _{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],i){for(let r of e){let e=r.id;if(null==e)continue;let a=this.features.get(e);a&&this.updateCache(a,i),r.geometry?(a=function(e){let{id:i,geometry:r,properties:a}=e;if(!r)return;if("GeometryCollection"===r.type)throw Error("GeometryCollection not supported in dynamic mode.");let{type:n,coordinates:o}=r,s={id:i,type:1,geometry:[],tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},l=s.geometry;if("Point"===n)y(o,l,s);else if("MultiPoint"===n)for(let e of o)y(e,l,s);else if("LineString"===n)s.type=2,x(o,l,s);else if("MultiLineString"===n)s.type=2,v(o,l,s);else if("Polygon"===n)s.type=3,v(o,l,s,!0);else{if("MultiPolygon"!==n)throw Error("Input data is not a valid GeoJSON object.");for(let e of(s.type=3,o))v(e,l,s,!0)}return s}(r),this.updateCache(a,i),this.features.set(e,a)):this.features.delete(e),this.updateCache(a,i)}}updateCache(e,i){for(let{canonical:r,uid:a}of Object.values(i)){let{z:n,x:o,y:s}=r;g(e,Math.pow(2,n),o,s)&&delete i[a]}}getTile(i,r,a){let n=Math.pow(2,i),o=[];for(let i of this.features.values())g(i,n,r,a)&&o.push(function(i,r,a,n){let{id:o,type:s,geometry:l,tags:h}=i,u=[];
7if(1===s)!function(i,r,a,n,o){for(let s=0;s<i.length;s+=2){let l=Math.round(e.ag*(i[s+0]*r-a)),h=Math.round(e.ag*(i[s+1]*r-n));o.push([l,h])}}(l,r,a,n,u);else for(let i of l)(function(i,r,a,n,o){let s;let l=e.ag+128;for(let h=0;h<i.length-2;h+=2){let u=Math.round(e.ag*(i[h+0]*r-a)),c=Math.round(e.ag*(i[h+1]*r-n)),d=Math.round(e.ag*(i[h+2]*r-a)),p=Math.round(e.ag*(i[h+3]*r-n)),f=d-u,m=p-c;u<-128&&d<-128||(u<-128?(c+=Math.round((-128-u)/f*m),u=-128):d<-128&&(p=c+Math.round((-128-u)/f*m),d=-128),c<-128&&p<-128||(c<-128?(u+=Math.round((-128-c)/m*f),c=-128):p<-128&&(d=u+Math.round((-128-c)/m*f),p=-128),u>=l&&d>=l||(u>=l?(c+=Math.round((l-u)/f*m),u=l):d>=l&&(p=c+Math.round((l-u)/f*m),d=l),c>=l&&p>=l||(c>=l?(u+=Math.round((l-c)/m*f),c=l):p>=l&&(d=u+Math.round((l-c)/m*f),p=l),s&&u===s[s.length-1][0]&&c===s[s.length-1][1]||(s=[[u,c]],o.push(s)),s.push([d,p])))))}})(i,r,a,n,u);return{id:o,type:s,geometry:u,tags:h}}(i,n,r,a));return{features:o}}getFeatures(){return[...this.features.values()]}}function g({minX:e,minY:i,maxX:r,maxY:a},n,o,s){return e<(o+1+m)/n&&i<(s+1+m)/n&&r>(o-m)/n&&a>(s-m)/n}function y([i,r],a,n){let o=e.at(i),s=e.aA(r);s=s<0?0:s>1?1:s,a.push(o,s),n.minX=Math.min(n.minX,o),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,o),n.maxY=Math.max(n.maxY,s)}function x(e,i,r,a=!1,n=!1){let o=[];for(let i of e)y(i,o,r);i.push(o),a&&function(e,i){let r=0;for(let i=0,a=e.length,n=a-2;i<a;n=i,i+=2)r+=(e[i]-e[n])*(e[i+1]+e[n+1]);if(r>0===i)for(let i=0,r=e.length;i<r/2;i+=2){let a=e[i],n=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=a,e[r-1-i]=n}}(o,n)}function v(e,i,r,a=!1){for(let n=0;n<e.length;n++)x(e[n],i,r,a,0===n)}var b,w,T,S,M={exports:{}},E=function(){if(S)return M.exports;S=1;var i=e.e7(),r=function(){if(T)return w;T=1;var i=e.e5(),r=e.e6().VectorTileFeature;function a(e,i){this.options=i||{},this.features=e,this.length=e.length}function n(e,i){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=i||4096}return w=a,a.prototype.feature=function(e){return new n(this.features[e],this.options.extent)},n.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var r=0;r<e.length;r++){for(var a=e[r],n=[],o=0;o<a.length;o++)n.push(new i(a[o][0],a[o][1]));this.geometry.push(n)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,i=1/0,r=-1/0,a=1/0,n=-1/0,o=0;o<e.length;o++)for(var s=e[o],l=0;l<s.length;l++){var h=s[l];i=Math.min(i,h.x),r=Math.max(r,h.x),a=Math.min(a,h.y),n=Math.max(n,h.y)}return[i,a,r,n]},n.prototype.toGeoJSON=r.prototype.toGeoJSON,w}();function a(e){var r=new i;return function(e,i){for(var r in e.layers)i.writeMessage(3,n,e.layers[r])}(e,r),r.finish()}function n(e,i){i.writeVarintField(15,e.version||1),i.writeStringField(1,e.name||""),i.writeVarintField(5,e.extent||4096);var r,a={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<e.length;r++)a.feature=e.feature(r),i.writeMessage(2,o,a);var n=a.keys;for(r=0;r<n.length;r++)i.writeStringField(3,n[r]);var s=a.values;for(r=0;r<s.length;r++)i.writeMessage(4,h,s[r])}function o(e,i){var r=e.feature;void 0!==r.id&&i.writeVarintField(1,r.id),i.writeMessage(2,s,e),i.writeVarintField(3,r.type),i.writeMessage(4,l,r)}function s(e,i){var r=e.feature,a=e.keys,n=e.values,o=e.keycache,s=e.valuecache;for(var l in r.properties){var h=r.properties[l],u=o[l];if(null!==h){void 0===u&&(a.push(l),o[l]=u=a.length-1),i.writeVarint(u);var c=typeof h;"string"!==c&&"boolean"!==c&&"number"!==c&&(h=JSON.stringify(h));var d=c+":"+h,p=s[d];void 0===p&&(n.push(h),s[d]=p=n.length-1),i.writeVarint(p)}}}function l(e,i){for(var r=e.loadGeometry(),a=e.type,n=0,o=0,s=r.length,l=0;l<s;l++){var h=r[l],u=1;1===a&&(u=h.length),i.writeVarint((u<<3)+1);for(var c=3===a?h.length-1:h.length,d=0;d<c;d++){1===d&&1!==a&&i.writeVarint((c-1<<3)+2);var p=h[d].x-n,f=h[d].y-o;i.writeVarint(p<<1^p>>31),i.writeVarint(f<<1^f>>31),n+=p,o+=f}3===a&&i.writeVarint(15)}}function h(e,i){var r=typeof e;"string"===r?i.writeStringField(1,e):"boolean"===r?i.writeBooleanField(7,e):"number"===r&&(e%1!=0?i.writeDoubleField(3,e):e<0?i.writeSVarintField(6,e):i.writeVarintField(5,e))}return M.exports=a,M.exports.fromVectorTileJs=a,M.exports.fromGeojsonVt=function(e,i){i=i||{};var n={};for(var o in e)n[o]=new r(e[o].features,i),n[o].name=o,n[o].version=i.version,n[o].extent=i.extent;return a({layers:n})},M.exports.GeoJSONWrapper=r,M.exports}(),A=e.e8(E);let I={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},C=Math.fround||(b=new Float32Array(1),e=>(b[0]=+e,b[0]));class P{constructor(e){this.options=Object.assign(Object.create(I),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:i,minZoom:r,maxZoom:a}=this.options;i&&console.time("total time");let n=`prepare ${e.length} points`;i&&console.time(n),this.points=e;let o=[];for(let i=0;i<e.length;i++){let r=e[i];if(!r.geometry)continue;let[a,n]=r.geometry.coordinates,s=C(R(a)),l=C(L(n));o.push(s,l,1/0,i,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[a+1]=this._createTree(o);i&&console.timeEnd(n);for(let e=a;e>=r;e--){let r=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),i&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-r)}
7return i&&console.timeEnd("total time"),this}getClusters(e,i){let r=((e[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[1])),n=180===e[2]?180:((e[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,n=180;else if(r>n){let e=this.getClusters([r,a,180,o],i),s=this.getClusters([-180,a,n,o],i);return e.concat(s)}let s=this.trees[this._limitZoom(i)],l=s.range(R(r),L(o),R(n),L(a)),h=s.data,u=[];for(let e of l){let i=this.stride*e;u.push(h[i+5]>1?z(h,i,this.clusterProps):this.points[h[i+3]])}return u}getChildren(e){let i=this._getOriginId(e),r=this._getOriginZoom(e),a="No cluster with the specified id.",n=this.trees[r];if(!n)throw Error(a);let o=n.data;if(i*this.stride>=o.length)throw Error(a);let s=this.options.radius/(this.options.extent*Math.pow(2,r-1)),l=n.within(o[i*this.stride],o[i*this.stride+1],s),h=[];for(let i of l){let r=i*this.stride;o[r+4]===e&&h.push(o[r+5]>1?z(o,r,this.clusterProps):this.points[o[r+3]])}if(0===h.length)throw Error(a);return h}getLeaves(e,i,r){let a=[];return this._appendLeaves(a,e,i=i||10,r=r||0,0),a}getTile(e,i,r){let a=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,l=s/o,h=(r-l)/n,u=(r+1+l)/n,c={features:[]};return this._addTileFeatures(a.range((i-l)/n,h,(i+1+l)/n,u),a.data,i,r,n,c),0===i&&this._addTileFeatures(a.range(1-l/n,h,1,u),a.data,n,r,n,c),i===n-1&&this._addTileFeatures(a.range(0,h,l/n,u),a.data,-1,r,n,c),c.features.length?c:null}getClusterExpansionZoom(e){let i=this._getOriginZoom(e)-1;for(;i<=this.options.maxZoom;){let r=this.getChildren(e);if(i++,1!==r.length)break;e=r[0].properties.cluster_id}return i}_appendLeaves(e,i,r,a,n){for(let o of this.getChildren(i)){let i=o.properties;if(i&&i.cluster?n+i.point_count<=a?n+=i.point_count:n=this._appendLeaves(e,i.cluster_id,r,a,n):n<a?n++:e.push(o),e.length===r)break}return n}_createTree(i){let r=new e.bE(i.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<i.length;e+=this.stride)r.add(i[e],i[e+1]);return r.finish(),r.data=i,r}_addTileFeatures(e,i,r,a,n,o){for(let s of e){let e,l,h,u;let c=s*this.stride,d=i[c+5]>1;if(d)e=D(i,c,this.clusterProps),l=i[c],h=i[c+1];else{let r=this.points[i[c+3]];e=r.properties;let[a,n]=r.geometry.coordinates;l=R(a),h=L(n)}let p={type:1,geometry:[[Math.round(this.options.extent*(l*n-r)),Math.round(this.options.extent*(h*n-a))]],tags:e};void 0!==(u=d||this.options.generateId?i[c+3]:this.points[i[c+3]].id)&&(p.id=u),o.features.push(p)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,i){let{radius:r,extent:a,reduce:n,minPoints:o}=this.options,s=r/(a*Math.pow(2,i)),l=e.data,h=[],u=this.stride;for(let r=0;r<l.length;r+=u){if(l[r+2]<=i)continue;l[r+2]=i;let a=l[r],c=l[r+1],d=e.within(l[r],l[r+1],s),p=l[r+5],f=p;for(let e of d){let r=e*u;l[r+2]>i&&(f+=l[r+5])}if(f>p&&f>=o){let e,o=a*p,s=c*p,m=-1,_=(r/u<<5)+(i+1)+this.points.length;for(let a of d){let h=a*u;if(l[h+2]<=i)continue;l[h+2]=i;let c=l[h+5];o+=l[h]*c,s+=l[h+1]*c,l[h+4]=_,n&&(e||(e=this._map(l,r,!0),m=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(l,h)))}l[r+4]=_,h.push(o/f,s/f,1/0,_,-1,f),n&&h.push(m)}else{for(let e=0;e<u;e++)h.push(l[r+e]);if(f>1)for(let e of d){let r=e*u;if(!(l[r+2]<=i)){l[r+2]=i;for(let e=0;e<u;e++)h.push(l[r+e])}}}}return h}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,i,r){if(e[i+5]>1){let a=this.clusterProps[e[i+6]];return r?Object.assign({},a):a}let a=this.points[e[i+3]].properties,n=this.options.map(a);return r&&n===a?Object.assign({},n):n}}function z(e,i,r){return{type:"Feature",id:e[i+3],properties:D(e,i,r),geometry:{type:"Point",coordinates:[360*(e[i]-.5),360*Math.atan(Math.exp((180-360*e[i+1])*Math.PI/180))/Math.PI-90]}}}function D(e,i,r){let a=e[i+5],n=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a,o=e[i+6];return Object.assign(-1===o?{}:Object.assign({},r[o]),{cluster:!0,cluster_id:e[i+3],point_count:a,point_count_abbreviated:n})}function R(e){return e/360+.5}function L(e){let i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function O(e,i,r,a){let n={id:e??null,type:i,geometry:r,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===i||"MultiPoint"===i||"LineString"===i)k(n,r);else if("Polygon"===i)k(n,r[0]);else if("MultiLineString"===i)for(let e of r)k(n,e);else if("MultiPolygon"===i)for(let e of r)k(n,e[0]);return n}function k(e,i){for(let r=0;r<i.length;r+=3)e.minX=Math.min(e.minX,i[r]),e.minY=Math.min(e.minY,i[r+1]),e.maxX=Math.max(e.maxX,i[r]),e.maxY=Math.max(e.maxY,i[r+1])}function F(e,i,r,a){if(!i.geometry)return;let n=i.geometry.coordinates;if(n&&0===n.length)return;let o=i.geometry.type,s=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),l=[],h=i.id;if(r.promoteId?h=i.properties[r.promoteId]:r.generateId&&(h=a||0),"Point"===o)B(n,l);else if("MultiPoint"===o)for(let e of n)B(e,l);else if("LineString"===o)N(n,l,s,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(let r of n)N(r,l=[],s,!1),e.push(O(h,"LineString",l,i.properties));return}V(n,l,s,!1)}else if("Polygon"===o)V(n,l,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(let n of i.geometry.geometries)F(e,{id:h,geometry:n,properties:i.properties},r,a);return}throw Error("Input data is not a valid GeoJSON object.")}for(let e of n){let i=[];V(e,i,s,!0),l.push(i)}}
7e.push(O(h,o,l,i.properties))}function B(e,i){i.push(e[0]/360+.5,U(e[1]),0)}function N(e,i,r,a){let n,o,s=0;for(let r=0;r<e.length;r++){let l=e[r][0]/360+.5,h=U(e[r][1]);i.push(l,h,0),r>0&&(s+=a?(n*h-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(h-o,2))),n=l,o=h}let l=i.length-3;i[2]=1,function e(i,r,a,n){let o=n,s=r+(a-r>>1),l,h=a-r,u=i[r],c=i[r+1],d=i[a],p=i[a+1];for(let e=r+3;e<a;e+=3){let r=function(e,i,r,a,n,o){let s=n-r,l=o-a;if(0!==s||0!==l){let h=((e-r)*s+(i-a)*l)/(s*s+l*l);h>1?(r=n,a=o):h>0&&(r+=s*h,a+=l*h)}return(s=e-r)*s+(l=i-a)*l}(i[e],i[e+1],u,c,d,p);if(r>o)l=e,o=r;else if(r===o){let i=Math.abs(e-s);i<h&&(l=e,h=i)}}o>n&&(l-r>3&&e(i,r,l,n),i[l+2]=o,a-l>3&&e(i,l,a,n))}(i,0,l,r),i[l+2]=1,i.size=Math.abs(s),i.start=0,i.end=i.size}function V(e,i,r,a){for(let n=0;n<e.length;n++){let o=[];N(e[n],o,r,a),i.push(o)}}function U(e){let i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function j(e,i,r,a,n,o,s,l){if(a/=i,o>=(r/=i)&&s<a)return e;if(s<r||o>=a)return null;let h=[];for(let i of e){let e=i.geometry,o=i.type,s=0===n?i.minX:i.minY,u=0===n?i.maxX:i.maxY;if(s>=r&&u<a){h.push(i);continue}if(u<r||s>=a)continue;let c=[];if("Point"===o||"MultiPoint"===o)(function(e,i,r,a,n){for(let o=0;o<e.length;o+=3){let s=e[o+n];s>=r&&s<=a&&H(i,e[o],e[o+1],e[o+2])}})(e,c,r,a,n);else if("LineString"===o)G(e,c,r,a,n,!1,l.lineMetrics);else if("MultiLineString"===o)Z(e,c,r,a,n,!1);else if("Polygon"===o)Z(e,c,r,a,n,!0);else if("MultiPolygon"===o)for(let i of e){let e=[];Z(i,e,r,a,n,!0),e.length&&c.push(e)}if(c.length){if(l.lineMetrics&&"LineString"===o){for(let e of c)h.push(O(i.id,o,e,i.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===c.length?(o="LineString",c=c[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===c.length?"Point":"MultiPoint"),h.push(O(i.id,o,c,i.tags))}}return h.length?h:null}function G(e,i,r,a,n,o,s){let l=q(e),h=0===n?$:W,u,c,d=e.start;for(let p=0;p<e.length-3;p+=3){let f=e[p],m=e[p+1],_=e[p+2],g=e[p+3],y=e[p+4],x=0===n?f:m,v=0===n?g:y,b=!1;s&&(u=Math.sqrt(Math.pow(f-g,2)+Math.pow(m-y,2))),x<r?v>r&&(c=h(l,f,m,g,y,r),s&&(l.start=d+u*c)):x>a?v<a&&(c=h(l,f,m,g,y,a),s&&(l.start=d+u*c)):H(l,f,m,_),v<r&&x>=r&&(c=h(l,f,m,g,y,r),b=!0),v>a&&x<=a&&(c=h(l,f,m,g,y,a),b=!0),!o&&b&&(s&&(l.end=d+u*c),i.push(l),l=q(e)),s&&(d+=u)}let p=e.length-3,f=e[p],m=e[p+1],_=0===n?f:m;_>=r&&_<=a&&H(l,f,m,e[p+2]),p=l.length-3,o&&p>=3&&(l[p]!==l[0]||l[p+1]!==l[1])&&H(l,l[0],l[1],l[2]),l.length&&i.push(l)}function q(e){let i=[];return i.size=e.size,i.start=e.start,i.end=e.end,i}function Z(e,i,r,a,n,o){for(let s of e)G(s,i,r,a,n,o,!1)}function H(e,i,r,a){e.push(i,r,a)}function $(e,i,r,a,n,o){let s=(o-i)/(a-i);return H(e,o,r+(n-r)*s,1),s}function W(e,i,r,a,n,o){let s=(o-r)/(n-r);return H(e,i+(a-i)*s,o,1),s}function X(e,i){let r=[];for(let a=0;a<e.length;a++){let n;let o=e[a],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)n=Y(o.geometry,i);else if("MultiLineString"===s||"Polygon"===s)for(let e of(n=[],o.geometry))n.push(Y(e,i));else if("MultiPolygon"===s)for(let e of(n=[],o.geometry)){let r=[];for(let a of e)r.push(Y(a,i));n.push(r)}r.push(O(o.id,s,n,o.tags))}return r}function Y(e,i){let r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(let a=0;a<e.length;a+=3)r.push(e[a]+i,e[a+1],e[a+2]);return r}function K(e,i){if(e.transformed)return e;let r=1<<e.z,a=e.x,n=e.y;for(let o of e.features){let e=o.geometry,s=o.type;if(o.geometry=[],1===s)for(let s=0;s<e.length;s+=2)o.geometry.push(J(e[s],e[s+1],i,r,a,n));else for(let s=0;s<e.length;s++){let l=[];for(let o=0;o<e[s].length;o+=2)l.push(J(e[s][o],e[s][o+1],i,r,a,n));o.geometry.push(l)}}return e.transformed=!0,e}function J(e,i,r,a,n,o){return[Math.round(r*(e*a-n)),Math.round(r*(i*a-o))]}function Q(e,i,r,a,n,o){let s=a*a;if(a>0&&i.size<(n?s:a))return void(r.numPoints+=i.length/3);let l=[];for(let e=0;e<i.length;e+=3)(0===a||i[e+2]>s)&&(r.numSimplified++,l.push(i[e],i[e+1])),r.numPoints++;n&&function(e,i){let r=0;for(let i=0,a=e.length,n=a-2;i<a;n=i,i+=2)r+=(e[i]-e[n])*(e[i+1]+e[n+1]);if(r>0===i)for(let i=0,r=e.length;i<r/2;i+=2){let a=e[i],n=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=a,e[r-1-i]=n}}(l,o),e.push(l)}let ee={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class et{constructor(e,i){let r=(i=this.options=function(e,i){for(let r in i)e[r]=i[r];return e}(Object.create(ee),i)).debug;if(r&&console.time("preprocess data"),i.maxZoom<0||i.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(i.promoteId&&i.generateId)throw Error("promoteId and generateId cannot be used together.");let a=function(e,i){let r=[];if("FeatureCollection"===e.type)for(let a=0;a<e.features.length;a++)F(r,e.features[a],i,a);else F(r,"Feature"===e.type?e:{geometry:e},i);return r}(e,i);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",i.indexMaxZoom,i.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(a=function(e,i){let r=i.buffer/i.extent,a=e,n=j(e,1,-1-r,r,0,-1,2,i
7),o=j(e,1,1-r,2+r,0,-1,2,i);return(n||o)&&(a=j(e,1,-r,1+r,0,-1,2,i)||[],n&&(a=X(n,1).concat(a)),o&&(a=a.concat(X(o,-1)))),a}(a,i)).length&&this.splitTile(a,0,0,0),r&&(a.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,i,r,a,n,o,s){let l=[e,i,r,a],h=this.options,u=h.debug;for(;l.length;){a=l.pop(),r=l.pop(),i=l.pop(),e=l.pop();let c=1<<i,d=ei(i,r,a),p=this.tiles[d];if(!p&&(u>1&&console.time("creation"),p=this.tiles[d]=function(e,i,r,a,n){let o=i===n.maxZoom?0:n.tolerance/((1<<i)*n.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:r,y:a,z:i,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let i of e)(function(e,i,r,a){let n=i.geometry,o=i.type,s=[];if(e.minX=Math.min(e.minX,i.minX),e.minY=Math.min(e.minY,i.minY),e.maxX=Math.max(e.maxX,i.maxX),e.maxY=Math.max(e.maxY,i.maxY),"Point"===o||"MultiPoint"===o)for(let i=0;i<n.length;i+=3)s.push(n[i],n[i+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)Q(s,n,e,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let i=0;i<n.length;i++)Q(s,n[i],e,r,"Polygon"===o,0===i);else if("MultiPolygon"===o)for(let i=0;i<n.length;i++){let a=n[i];for(let i=0;i<a.length;i++)Q(s,a[i],e,r,!0,0===i)}if(s.length){let r=i.tags||null;if("LineString"===o&&a.lineMetrics){for(let e in r={},i.tags)r[e]=i.tags[e];r.mapbox_clip_start=n.start/n.size,r.mapbox_clip_end=n.end/n.size}let l={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:r};null!==i.id&&(l.id=i.id),e.features.push(l)}})(s,i,o,n);return s}(e,i,r,a,h),this.tileCoords.push({z:i,x:r,y:a}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,r,a,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let e=`z${i}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(p.source=e,null==n){if(i===h.indexMaxZoom||p.numPoints<=h.indexMaxPoints)continue}else{if(i===h.maxZoom||i===n)continue;if(null!=n){let e=n-i;if(r!==o>>e||a!==s>>e)continue}}if(p.source=null,0===e.length)continue;u>1&&console.time("clipping");let f=.5*h.buffer/h.extent,m=.5-f,_=.5+f,g=1+f,y=null,x=null,v=null,b=null,w=j(e,c,r-f,r+_,0,p.minX,p.maxX,h),T=j(e,c,r+m,r+g,0,p.minX,p.maxX,h);e=null,w&&(y=j(w,c,a-f,a+_,1,p.minY,p.maxY,h),x=j(w,c,a+m,a+g,1,p.minY,p.maxY,h),w=null),T&&(v=j(T,c,a-f,a+_,1,p.minY,p.maxY,h),b=j(T,c,a+m,a+g,1,p.minY,p.maxY,h),T=null),u>1&&console.timeEnd("clipping"),l.push(y||[],i+1,2*r,2*a),l.push(x||[],i+1,2*r,2*a+1),l.push(v||[],i+1,2*r+1,2*a),l.push(b||[],i+1,2*r+1,2*a+1)}}getTile(e,i,r){e=+e,i=+i,r=+r;let{extent:a,debug:n}=this.options;if(e<0||e>24)return null;let o=1<<e,s=ei(e,i=i+o&o-1,r);if(this.tiles[s])return K(this.tiles[s],a);n>1&&console.log("drilling down to z%d-%d-%d",e,i,r);let l,h=e,u=i,c=r;for(;!l&&h>0;)h--,u>>=1,c>>=1,l=this.tiles[ei(h,u,c)];return l&&l.source?(n>1&&(console.log("found parent tile z%d-%d-%d",h,u,c),console.time("drilling down")),this.splitTile(l.source,h,u,c,e,i,r),n>1&&console.timeEnd("drilling down"),this.tiles[s]?K(this.tiles[s],a):null):null}}function ei(e,i,r){return 32*((1<<e)*r+i)+e}function er(e,i){let r=e.tileID.canonical;if(!this._geoJSONIndex)return void i(null,null);let a=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!a)return void i(null,null);let n=new f(a.features),o=A(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),i(null,{vectorTile:n,rawData:o.buffer})}class ea extends h{constructor(e,i,r,a,n,o){super(e,i,r,a,er,o),n&&(this.loadGeoJSON=n),this._dynamicIndex=new _}loadData(r,a){let n=r&&r.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(r,(s,l)=>{if(s||!l)return a(s);if("object"!=typeof l)return a(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{try{var h,u;if(r.filter){let i=e.U(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));l.features=l.features.filter(e=>i.value.evaluate({zoom:0},e))}r.dynamic?("Feature"===l.type&&(l={type:"FeatureCollection",features:[l]}),r.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(l.features,this.loaded),r.cluster&&(l.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=r.cluster?new P(function({superclusterOptions:i,clusterProperties:r}){if(!r||!i)return i;let a={},n={},o={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r);for(let i of l){let[o,s]=r[i],l=e.U(s),h=e.U("string"==typeof o?[o,["accumulated"],["get",i]]:o);a[i]=l.value,n[i]=h.value}return i.map=e=>{s.properties=e;let i={};for(let e of l)i[e]=a[e].evaluate(o,s);return i},i.reduce=(e,i)=>{for(let r of(s.properties=i,l))o.accumulated=e[r],e[r]=n[r].evaluate(o,s)},i}(r)).load(l.features):r.dynamic?this._dynamicIndex:(h=l,u=r.geojsonVtOptions,new et(h,u))}catch(e){return a(e)}let s={};if(o){let e=i(n);e&&(s.resourceTiming={},s.resourceTiming[r.source]=JSON.parse(JSON.stringify(e)))}a(null,s)}})}reloadTile(e,i){let r=this.loaded;return r&&r[e.uid]?e.partial?i(null,void 0):super.reloadTile(e,i):this.loadTile(e,i)}loadGeoJSON(i,r){if(i.request)e.n(i.request,r);else{if("string"!=typeof i.data)return r(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));try{return r(null,JSON.parse(i.data))}catch(e){return r(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,i){try{i(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){i(e)}}getClusterChildren(e,i){try{i(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){i(e)}}getClusterLeaves(e,i){try{i(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){i(e)}}}class en{constructor(i,r){this.tileID=new e.aG(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=i.projection,this.brightness=r}parse(i,r,a,n){this.status="parsing";let o=new e.aG(a.tileID.overscaledZ,a.tileID.wrap,a.tileID.canonical.z,a.tileID.canonical.x,a.tileID.canonical.y),s=[],l=r.familiesBySource[a.source],h=new e.dZ(o,a.promoteId);return h.bucketLayerIDs=[],h.is3DTile=!0,e.e9(i).then(i=>{if(!i)return n(Error("Could not parse tile"));let r=e.ea(i,1/e.cc(a.tileID.canonical)),u=i.json.extensionsUsed&&i.json.extensionsUsed.includes("MAPBOX_mesh_features")||i.json.asset.extras&&i.json.asset.extras.MAPBOX_mesh_features,c=i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression"),d=new e.a8(this.zoom,{brightness:this.brightness});for(let i in l)for(let a of l[i]){let i=a[0];h.bucketLayerIDs.push(a.map(i=>e.aC(i.id,i.scope))),i.recalculate(d,[]);let n=new e.eb(a,r,o,u,c,this.brightness,h);u||(n.needsUpload=!0),s.push(n),n.evaluate(i)}this.status="done",n(null,{buckets:s,featureIndex:h,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(e=>n(Error(e.message)))}}class eo{constructor(e,i,r,a,n,o){this.actor=e,this.layerIndex=i,this.availableImages=r,this.brightness=o,this.loading={},this.loaded={}}loadTile(i,r){let a=i.uid,n=this.loading[a]=new en(i,this.brightness);e.bi(i.request,(e,o)=>{let s=!this.loading[a];return delete this.loading[a],s||e?(n.status="done",s||(this.loaded[a]=n),r(e)):o&&0!==o.byteLength?void n.parse(o,this.layerIndex,i,(e,i)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[a]=n,e||!i?r(e):r(null,i)}):(n.status="done",this.loaded[a]=n,r())})}reloadTile(e,i){let r=this.loaded,a=e.uid;if(r&&r[a]){let n=r[a];n.projection=e.projection,n.brightness=e.brightness,"parsing"===n.status?n.reloadCallback=(r,a)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,i)),i(r,a)}:"done"===n.status&&this.loadTile(e,i)}}abortTile(e,i){let r=e.uid;this.loading[r]&&delete this.loading[r],i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}class es{constructor(i){this.self=i,this.actor=new e.ec(i,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.imageRasterizer=new e.I,this.projections={},this.defaultProjection=e.bP({name:"mercator"}),this.workerSourceTypes={vector:h,geojson:ea,"batched-model":eo},this.workerSources={},this.demWorkerSources={}
7,this.self.registerWorkerSource=(e,i)=>{if(this.workerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=i},this.self.registerRTLTextPlugin=i=>{if(e.ed.isParsed())throw Error("RTL text plugin already registered.");e.ed.applyArabicShaping=i.applyArabicShaping,e.ed.processBidirectionalText=i.processBidirectionalText,e.ed.processStyledBidirectionalText=i.processStyledBidirectionalText}}clearCaches(e,i,r){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],delete this.rasterArrayWorkerSource,r()}checkIfReady(e,i,r){r()}setReferrer(e,i){this.referrer=i}spriteLoaded(i,{scope:r,isLoaded:a}){if(this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={}),this.isSpriteLoaded[i][r]=a,this.workerSources[i]&&this.workerSources[i][r])for(let n in this.workerSources[i][r]){let o=this.workerSources[i][r][n];for(let i in o){let r=o[i];r instanceof h&&(r.isSpriteLoaded=a,r.fire(new e.z("isSpriteLoaded")))}}}setImages(e,{scope:i,images:r},a){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][i]=r,this.workerSources[e]&&this.workerSources[e][i]){for(let a in this.workerSources[e][i]){let n=this.workerSources[e][i][a];for(let e in n)n[e].availableImages=r}a()}else a()}setProjection(i,r){this.projections[i]=e.bP(r)}setBrightness(e,i,r){this.brightness=i,r()}setLayers(e,i,r){this.getLayerIndex(e,i.scope).replace(i.layers,i.options),r()}updateLayers(e,i,r){this.getLayerIndex(e,i.scope).update(i.layers,i.removedIds,i.options),r()}loadTile(e,i,r){i.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source,i.scope).loadTile(i,r)}loadDEMTile(e,i,r){this.getDEMWorkerSource(e,i.source,i.scope).loadTile(i,r)}decodeRasterArray(e,i,r){this.getRasterArrayWorkerSource().decodeRasterArray(i,r)}reloadTile(e,i,r){i.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source,i.scope).reloadTile(i,r)}abortTile(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).abortTile(i,r)}removeTile(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).removeTile(i,r)}removeSource(e,i,r){if(!(this.workerSources[e]&&this.workerSources[e][i.scope]&&this.workerSources[e][i.scope][i.type]&&this.workerSources[e][i.scope][i.type][i.source]))return;let a=this.workerSources[e][i.scope][i.type][i.source];delete this.workerSources[e][i.scope][i.type][i.source],void 0!==a.removeSource?a.removeSource(i,r):r()}loadWorkerSource(e,i,r){try{this.self.importScripts(i.url),r()}catch(e){r(e.toString())}}syncRTLPluginState(i,r,a){try{e.ed.setState(r);let i=e.ed.getPluginURL();if(e.ed.isLoaded()&&!e.ed.isParsed()&&null!=i){this.self.importScripts(i);let r=e.ed.isParsed();a(r?void 0:Error(`RTL Text Plugin failed to import scripts from ${i}`),r)}}catch(e){a(e.toString())}}setDracoUrl(e,i){this.dracoUrl=i}getAvailableImages(e,i){this.availableImages[e]||(this.availableImages[e]={});let r=this.availableImages[e][i];return r||(r=[]),r}getLayerIndex(e,i){this.layerIndexes[e]||(this.layerIndexes[e]={});let r=this.layerIndexes[e][i];return r||((r=this.layerIndexes[e][i]=new a).scope=i),r}getWorkerSource(e,i,r,a){return this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][a]||(this.workerSources[e][a]={}),this.workerSources[e][a][i]||(this.workerSources[e][a][i]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),this.workerSources[e][a][i][r]||(this.workerSources[e][a][i][r]=new this.workerSourceTypes[i]({send:(i,r,a,n,o,s)=>{this.actor.send(i,r,a,e,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(e,a),this.getAvailableImages(e,a),this.isSpriteLoaded[e][a],void 0,this.brightness)),this.workerSources[e][a][i][r]}rasterizeImages(e,i,r){let{imageTasks:a,scope:n}=i,o={};for(let i in a){let{image:r,imageIdWithOptions:s}=a[i];o[i]=this.imageRasterizer.rasterize(s,r,n,e)}r(void 0,o)}removeRasterizedImages(e,i,r){let{imageIds:a,scope:n}=i;this.imageRasterizer.removeImagesFromCacheByIds(a,n,e),r()}getDEMWorkerSource(e,i,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]={}),this.demWorkerSources[e][r][i]||(this.demWorkerSources[e][r][i]=new u),this.demWorkerSources[e][r][i]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new c),this.rasterArrayWorkerSource}enforceCacheSizeLimit(i,r){e.ee(r)}getWorkerPerformanceMetrics(e,i,r){r(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new es(self)),es}),a(["./shared"],function(e){let i,r,a;var n="3.9.3";let o={create:"create",load:"load",fullLoad:"fullLoad"},s={mark(e){performance.mark(e)},measure(e,i,r){performance.measure(e,i,r)}};function l(i){let r=i.name.split("?")[0];return e.a(r)&&r.includes("mapbox-gl.js")?"javascript":e.a(r)&&r.includes("mapbox-gl.css")?"css":e.b(r)?"fontRange":e.c(r)?"sprite":e.i(r)?"style":e.d(r)?"tilejson":"other"}var h,u={},c=function(){if(h)return u;function e(e){return!i(e)}function i(i){var a;return"undefined"==typeof window||"undefined"==typeof document?"not a browser":!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,i,r=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(r);try{i=new Worker(a),e=!0}catch(i){e=!1}return i&&i.terminate(),URL.revokeObjectURL(a),e}()?"insufficient worker support":!function(){var e=document.createElement("canvas");e.width=e.height=1;var i=e.getContext("2d");if(!i)return!1;var r=i.getImageData(0,0,1,1);return r&&r.width===e.width}
7()?"insufficient Canvas/getImageData support":(void 0===r[a=i&&i.failIfMajorPerformanceCaveat]&&(r[a]=function(i){var r,a,n,o=(r=document.createElement("canvas"),(a=Object.create(e.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.getContext("webgl2",a));if(!o)return!1;try{n=o.createShader(o.VERTEX_SHADER)}catch(e){return!1}return!(!n||o.isContextLost())&&(o.shaderSource(n,"void main() {}"),o.compileShader(n),!0===o.getShaderParameter(n,o.COMPILE_STATUS))}(a)),r[a]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support")}h=1,u.supported=e,u.notSupportedReason=i;var r={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},u}();function d(e,i,r){let a=document.createElement(e);return null!=i&&(a.className=i),r&&r.appendChild(a),a}function p(e,i,r){let a=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e of Object.keys(i))a.setAttributeNS(null,e,String(i[e]));return r&&r.appendChild(a),a}let f="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,m=f&&void 0!==f.userSelect?"userSelect":"WebkitUserSelect";function _(){f&&m&&(i=f[m],f[m]="none")}function g(){f&&m&&(f[m]=i)}function y(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",y,!0)}function x(){window.addEventListener("click",y,!0),window.setTimeout(()=>{window.removeEventListener("click",y,!0)},0)}function v(e,i){let r=e.getBoundingClientRect();return T(e,r,i)}function b(e,i){let r=e.getBoundingClientRect(),a=[];for(let n=0;n<i.length;n++)a.push(T(e,r,i[n]));return a}function w(e){return void 0!==window.InstallTrigger&&2===e.button&&e.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button}function T(i,r,a){let n=i.offsetWidth===r.width?1:i.offsetWidth/r.width;return new e.P((a.clientX-r.left)*n,(a.clientY-r.top)*n)}let S="NO_ACCESS_TOKEN";class M{constructor(e,i,r){this._transformRequestFn=e,this._customAccessToken=i,this._silenceAuthErrors=!!r,this._createSkuToken()}_createSkuToken(){let e=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}normalizeStyleURL(i,r){if(!e.f(i))return i;let a=A(i);return a.params.push(`sdk=js-${n}`),a.path=`/styles/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!e.f(i))return i;let a=A(i);return a.path=`/fonts/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeModelURL(i,r){if(!e.f(i))return i;let a=A(i);return a.path=`/models/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeSourceURL(i,r,a,n){if(!e.f(i))return i;let o=A(i);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),a&&o.params.push(`language=${a}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||r)}normalizeIconsetURL(i,r){let a=A(i);return e.f(i)?(a.path=`/styles/v1${a.path}/iconset.pbf`,this._makeAPIURL(a,this._customAccessToken||r)):I(a)}normalizeSpriteURL(i,r,a,n){let o=A(i);return e.f(i)?(o.path=`/styles/v1${o.path}/sprite${r}${a}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${r}${a}`,I(o))}normalizeTileURL(i,r,a){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!e.f(i))return i;let n=A(i);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||a&&"raster"!==n.authority&&512===a?"@2x":""}${e.m.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${e.e.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${e.e.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${e.e.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${e.e.TILE_URL_VERSION}${n.path}`);let o=this._customAccessToken||function(e){for(let i of e){let e=i.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||e.e.ACCESS_TOKEN;return e.e.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(i,r){let a=A(i);if(!a.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!a.path.match(/\.[\w]+$/))return i;let n="mapbox://";a.path.match(/^\/raster\/v1\//)?n+=`raster/${a.path.replace(`/${e.e.RASTER_URL_PREFIX}/`,"")}`:a.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${a.path.replace(`/${e.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${a.path.replace(`/${e.e.TILE_URL_VERSION}/`,"")}`;let o=a.params;return r&&(o=o.filter(e=>!e.match(/^access_token=/))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(i,r){let a=!!r&&e.f(r),n=[];for(let r of i.tiles||[])e.h(r)?n.push(this.canonicalizeTileURL(r,a)):n.push(r);return n}_makeAPIURL(i,r){let a="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=A(e.e.API_URL);if(i.protocol=n.protocol,i.authority=n.authority,"http"===i.protocol){let e=i.params.indexOf("secure");e>=0&&i.params.splice(e,1)}if("/"!==n.path&&(i.path=`${n.path}${i.path}`),!e.e.REQUIRE_ACCESS_TOKEN)return I(i);if(r=r||e.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${a}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${a}`)}return i.params=i.params.filter(e=>-1===e.indexOf("access_token")),i.params.push(`access_token=${r||""}`),I(i)}}let E=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function A(e){let i=e.match(E);if(!i)throw Error("Unable to parse URL object");return{protocol:i[1],authority:i[2],path:i[3]||"/",params:i[4]?i[4].split("&"):[]}}function I(e){let i=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${i}`}let C="mapbox.eventData";function P(i){if(!i)return null;let r=i.split(".");if(!r||3!==r.length)return null;
7try{return JSON.parse(e.j(r[1]))}catch(e){return null}}class z{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){let r=P(e.e.ACCESS_TOKEN),a="";return a=r&&r.u?e.k(r.u):e.e.ACCESS_TOKEN||"",i?`${C}.${i}:${a}`:`${C}:${a}`}fetchEventData(){let i=e.s("localStorage"),r=this.getStorageKey(),a=this.getStorageKey("uuid");if(i)try{let e=localStorage.getItem(r);e&&(this.eventData=JSON.parse(e));let i=localStorage.getItem(a);i&&(this.anonId=i)}catch(i){e.w("Unable to read from LocalStorage")}}saveEventData(){let i=e.s("localStorage"),r=this.getStorageKey(),a=this.getStorageKey("uuid"),n=this.anonId;if(i&&n)try{localStorage.setItem(a,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(r,JSON.stringify(this.eventData))}catch(i){e.w("Unable to write to LocalStorage")}}processRequests(e){}postEvent(i,r,a,n){if(!e.e.EVENTS_URL)return;let o=A(e.e.EVENTS_URL);o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);let s={event:this.type,created:new Date(i).toISOString()},l=r?e.l(s,r):s,h={url:I(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=e.p(h,e=>{this.pendingRequest=null,a(e),this.saveEventData(),this.processRequests(n)})}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}let D=new class extends z{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(i,r){e.e.EVENTS_URL&&e.e.ACCESS_TOKEN&&Array.isArray(i)&&i.some(i=>e.f(i)||e.h(i))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let r=P(e.e.ACCESS_TOKEN),a=r?r.u:e.e.ACCESS_TOKEN,o=a!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),o=!0);let s=this.queue.shift();if(this.eventData.lastSuccess){let e=new Date(this.eventData.lastSuccess),i=new Date(s),r=(s-this.eventData.lastSuccess)/864e5;o=o||r>=1||r<-1||e.getDate()!==i.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:"01","enabled.telemetry":!1,userId:this.anonId},e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=a)},i):this.processRequests()}},R=D.postTurnstileEvent.bind(D),L=new class extends z{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,a,n){this.skuToken=r,this.errorCb=n,e.e.EVENTS_URL&&(a||e.e.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},a):this.errorCb(Error(S)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:a}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),e.v(this.anonId)||(this.anonId=e.u()),this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:"01",skuToken:this.skuToken,userId:this.anonId},e=>{e?this.errorCb(e):r&&(this.success[r]=!0)},i))}remove(){this.errorCb=null}},O=L.postMapLoadEvent.bind(L),k=new class extends z{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(i){let r=this.mapInstanceIdMap.get(i);return r||(r=e.u(),this.mapInstanceIdMap.set(i,r)),r}getEventId(e){let i=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,i+1),i}postStyleLoadEvent(i,r){let{map:a,style:n,importedStyles:o}=r;if(!e.e.EVENTS_URL||!i&&!e.e.ACCESS_TOKEN)return;let s=this.getMapInstanceId(a),l={mapInstanceId:s,eventId:this.getEventId(s),style:n};o.length&&(l.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:l},i)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:i,payload:r}=this.queue.shift();this.postEvent(i,r,()=>{},e)}},F=k.postStyleLoadEvent.bind(k),B=new class extends z{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){e.e.EVENTS_URL&&(i||e.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,performanceData:a}=this.queue.shift(),s=function(i){let r=performance.getEntriesByType("resource"),a=performance.getEntriesByType("mark"),s=function(e){let i={};if(e){for(let r in e)if("other"!==r)for(let a of e[r]){let e=`${r}ResolveRangeMin`,n=`${r}ResolveRangeMax`,o=`${r}RequestCount`,s=`${r}RequestCachedCount`;i[e]=Math.min(i[e]||1/0,a.startTime),i[n]=Math.max(i[n]||-1/0,a.responseEnd);let l=e=>{void 0===i[e]&&(i[e]=0),++i[e]};void 0!==a.transferSize&&0===a.transferSize&&l(s),l(o)}}return i}(function(e,i){let r={};if(e)for(let a of e){let e=i(a);void 0===r[e]&&(r[e]=[]),r[e].push(a)}return r}(r,l)),h=window.devicePixelRatio,u=navigator.connection||navigator.mozConnection||navigator.webkitConnection,c=u?u.effectiveType:void 0,d={counters:[],metadata:[],attributes:[]},p=(e,i,r)=>{null!=r&&e.push({name:i,value:r.toString()})};for(let e in s)p(d.counters,e,s[e]);if(i.interactionRange[0]!==1/0&&i.interactionRange[1]!==-1/0&&(p(d.counters,"interactionRangeMin",i.interactionRange[0]),p(d.counters,"interactionRangeMax",i.interactionRange[1])),a)for(let e of Object.keys(o)){let i=o[e],r=a.find(e=>e.name===i);
7r&&p(d.counters,i,r.startTime)}return p(d.counters,"visibilityHidden",i.visibilityHidden),p(d.attributes,"style",function(i){if(i)for(let r of i){let i=r.name.split("?")[0];if(e.i(i)){let e=i.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(r)),p(d.attributes,"terrainEnabled",i.terrainEnabled?"true":"false"),p(d.attributes,"fogEnabled",i.fogEnabled?"true":"false"),p(d.attributes,"projection",i.projection),p(d.attributes,"zoom",i.zoom),p(d.metadata,"devicePixelRatio",h),p(d.metadata,"connectionEffectiveType",c),p(d.metadata,"navigatorUserAgent",navigator.userAgent),p(d.metadata,"screenWidth",window.screen.width),p(d.metadata,"screenHeight",window.screen.height),p(d.metadata,"windowWidth",window.innerWidth),p(d.metadata,"windowHeight",window.innerHeight),p(d.metadata,"mapWidth",i.width/h),p(d.metadata,"mapHeight",i.height/h),p(d.metadata,"webglRenderer",i.renderer),p(d.metadata,"webglVendor",i.vendor),p(d.metadata,"sdkVersion",n),p(d.metadata,"sdkIdentifier","mapbox-gl-js"),d}(a);for(let e of s.metadata);for(let e of s.counters);for(let e of s.attributes);this.postEvent(r,s,()=>{},i)}},N=B.postPerformanceEvent.bind(B),V=new class extends z{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,a,n){if(!e.e.API_URL||!e.e.SESSION_PATH)return;let o=A(e.e.API_URL+e.e.SESSION_PATH);o.params.push(`sku=${r||""}`),o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);let s={url:I(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e.g(s,e=>{this.pendingRequest=null,a(e),this.saveEventData(),this.processRequests(n)})}getSessionAPI(i,r,a,n){this.skuToken=r,this.errorCb=n,e.e.SESSION_PATH&&e.e.API_URL&&(a||e.e.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},a):this.errorCb(Error(S)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;let{id:i,timestamp:r}=this.queue.shift();i&&this.success[i]||this.getSession(r,this.skuToken,e=>{e?this.errorCb(e):i&&(this.success[i]=!0)},e)}remove(){this.errorCb=null}},U=V.getSessionAPI.bind(V),j=new Set;function G(e,i){i?j.add(e):j.delete(e)}class q{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,i){this._updatedSourceCaches[e]=i,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){let i=e.scope;this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._updatedLayers[i].add(e.id),this.setDirty()}removeLayer(e){let i=e.scope;this._removedLayers[i]=this._removedLayers[i]||{},this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._removedLayers[i][e.id]=e,this._updatedLayers[i].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){let e={};for(let i in this._updatedLayers)e[i]=e[i]||{},e[i].updatedIds=Array.from(this._updatedLayers[i].values());for(let i in this._removedLayers)e[i]=e[i]||{},e[i].removedIds=Object.keys(this._removedLayers[i]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(e){this._updatedImages.add(e),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}class Z extends e.E{constructor(i){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0,this.spriteFormat=i,"raster"!==i&&e.t()&&(this.imageRasterizerDispatcher=new e.D(e.x(),this,"Image Rasterizer Worker",1))}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new e.I),this._imageRasterizer}createScope(i){this.images[i]={},this.loaded[i]=!1,this.updatedImages[i]={},this.patterns[i]={},this.callbackDispatchedThisFrame[i]={},this.atlasImage[i]=new e.r({width:1,height:1})}isLoaded(){for(let e in this.loaded)if(!this.loaded[e])return!1;return!0}setLoaded(e,i){if(this.loaded[i]!==e&&(this.loaded[i]=e,e)){for(let{ids:e,callback:r}of this.requestors)this._notify(e,i,r);this.requestors=[]}}hasImage(e,i){return!!this.getImage(e,i)}getImage(e,i){return this.images[i][e]}
7addImage(e,i,r){this._validate(e,r)&&(this.images[i][e]=r)}_validate(i,r){let a=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new e.y(Error(`Image "${i}" has invalid "stretchX" value`))),a=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new e.y(Error(`Image "${i}" has invalid "stretchY" value`))),a=!1),this._validateContent(r.content,r)||(this.fire(new e.y(Error(`Image "${i}" has invalid "content" value`))),a=!1),a}_validateStretch(e,i){if(!e)return!0;let r=0;for(let a of e){if(a[0]<r||a[1]<a[0]||i<a[1])return!1;r=a[1]}return!0}_validateContent(e,i){return!e||4===e.length&&(!!i.usvg||!(e[0]<0)&&!(i.data.width<e[0])&&!(e[1]<0)&&!(i.data.height<e[1])&&!(e[2]<0)&&!(i.data.width<e[2])&&!(e[3]<0)&&!(i.data.height<e[3]))&&!(e[2]<e[0]||e[3]<e[1])}updateImage(e,i,r){r.version=this.images[i][e].version+1,this.images[i][e]=r,this.updatedImages[i][e]=!0,this.removeFromImageRasterizerCache(e,i)}removeFromImageRasterizerCache(i,r){"raster"!==this.spriteFormat&&(e.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[i],scope:r}):this.imageRasterizer.removeImagesFromCacheByIds([i],r))}removeImage(e,i){let r=this.images[i][e];delete this.images[i][e],delete this.patterns[i][e],this.removeFromImageRasterizerCache(e,i),r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(e){return Object.keys(this.images[e])}getImages(e,i,r){let a=!0,n=!!this.loaded[i];if(!n)for(let r of e)this.images[i][r]||(a=!1);n||a?this._notify(e,i,r):this.requestors.push({ids:e,scope:i,callback:r})}rasterizeImages({scope:i,imageTasks:r},a){let n={};for(let e in r){let a=r[e],o=this.getImage(a.id,i);o&&(n[e]={image:o,imageIdWithOptions:a})}e.t()?this.imageRasterizerDispatcher.getActor().send("rasterizeImages",{imageTasks:n,scope:i},a):this.rasterizeImagesInMainThread({imageTasks:n,scope:i},a)}rasterizeImagesInMainThread(e,i){let{imageTasks:r,scope:a}=e,n={};for(let e in r){let{image:i,imageIdWithOptions:o}=r[e];n[e]=this.imageRasterizer.rasterize(o,i,a,"")}i(void 0,n)}getUpdatedImages(e){return this.updatedImages[e]}_notify(i,r,a){let n={};for(let a of i){this.images[r][a]||this.fire(new e.z("styleimagemissing",{id:a}));let i=this.images[r][a];i?n[a]={data:i.usvg?null:i.data.clone(),pixelRatio:i.pixelRatio,sdf:i.sdf,usvg:i.usvg,version:i.version,stretchX:i.stretchX,stretchY:i.stretchY,content:i.content,hasRenderCallback:!!(i.userImage&&i.userImage.render)}:e.w(`Image "${a}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}a(null,n)}getPixelSize(e){let{width:i,height:r}=this.atlasImage[e];return{width:i,height:r}}getPattern(i,r,a){let n=this.patterns[r][i],o=this.getImage(i,r);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{o.usvg&&!o.data&&(o.data=this.imageRasterizer.rasterize(e.A.from(i).getPrimary(),o,r,""));let a={w:o.data.width+2*e.B,h:o.data.height+2*e.B,x:0,y:0},n=new e.F(a,o,e.B);this.patterns[r][i]={bin:a,position:n}}return this._updatePatternAtlas(r,a),this.patterns[r][i].position}bind(i,r){let a=i.gl,n=this.atlasTexture[r];n?this.dirty&&(n.update(this.atlasImage[r]),this.dirty=!1):(n=new e.T(i,this.atlasImage[r],a.RGBA8),this.atlasTexture[r]=n),n.bind(a.LINEAR,a.CLAMP_TO_EDGE)}_updatePatternAtlas(i,r){let a=[];for(let e in this.patterns[i])a.push(this.patterns[i][e].bin);let{w:n,h:o}=e.C(a),s=this.atlasImage[i];for(let a in s.resize({width:n||1,height:o||1}),this.patterns[i]){let{bin:n,position:o}=this.patterns[i][a],l=o.padding,h=n.x+l,u=n.y+l,c=this.images[i][a].data,d=c.width,p=c.height;l=l>1?l-1:l,e.r.copy(c,s,{x:0,y:0},{x:h,y:u},{width:d,height:p},r),e.r.copy(c,s,{x:0,y:p-l},{x:h,y:u-l},{width:d,height:l},r),e.r.copy(c,s,{x:0,y:0},{x:h,y:u+p},{width:d,height:l},r),e.r.copy(c,s,{x:d-l,y:0},{x:h-l,y:u},{width:l,height:p},r),e.r.copy(c,s,{x:0,y:0},{x:h+d,y:u},{width:l,height:p},r),e.r.copy(c,s,{x:d-l,y:p-l},{x:h-l,y:u-l},{width:l,height:l},r),e.r.copy(c,s,{x:0,y:p-l},{x:h+d,y:u-l},{width:l,height:l},r),e.r.copy(c,s,{x:0,y:0},{x:h+d,y:u+p},{width:l,height:l},r),e.r.copy(c,s,{x:d-l,y:0},{x:h-l,y:u+p},{width:l,height:l},r)}this.dirty=!0}beginFrame(){for(let e in this.images)this.callbackDispatchedThisFrame[e]={}}
7dispatchRenderCallbacks(e,i){for(let r of e){if(this.callbackDispatchedThisFrame[i][r])continue;this.callbackDispatchedThisFrame[i][r]=!0;let e=this.images[i][r];(function(e){let{userImage:i}=e;return!!(i&&i.render&&i.render())&&(e.data.replace(new Uint8Array(i.data.buffer)),!0)})(e)&&this.updateImage(r,i,e)}}}function H(i){let r=i.key,a=i.value,n=i.valueSpec||{},o=i.objectElementValidators||{},s=i.style,l=i.styleSpec,h=[],u=e.H(a);if("object"!==u)return[new e.V(r,a,`object expected, ${u} found`)];for(let i in a){let u;let c=i.split(".")[0];o[c]?u=o[c]:n[c]?u=ec:o["*"]?u=o["*"]:n["*"]&&(u=ec),u?h=h.concat(u({key:(r?`${r}.`:r)+i,value:a[i],valueSpec:n[c]||n["*"],style:s,styleSpec:l,object:a,objectKey:i},a)):h.push(new e.G(r,a[i],`unknown property "${i}"`))}for(let i in n)o[i]||n[i].required&&void 0===n[i].default&&void 0===a[i]&&h.push(new e.V(r,a,`missing required property "${i}"`));return h}function $(i){let r=i.value,a=i.valueSpec,n=i.style,o=i.styleSpec,s=i.key,l=i.arrayElementValidator||ec;if("array"!==e.H(r))return[new e.V(s,r,`array expected, ${e.H(r)} found`)];if(a.length&&r.length!==a.length)return[new e.V(s,r,`array length ${a.length} expected, length ${r.length} found`)];if(a["min-length"]&&r.length<a["min-length"])return[new e.V(s,r,`array length at least ${a["min-length"]} expected, length ${r.length} found`)];let h={type:a.value,values:a.values,minimum:a.minimum,maximum:a.maximum,function:void 0};o.$version<7&&(h.function=a.function),"object"===e.H(a.value)&&(h=a.value);let u=[];for(let e=0;e<r.length;e++)u=u.concat(l({array:r,arrayIndex:e,value:r[e],valueSpec:h,style:n,styleSpec:o,key:`${s}[${e}]`},!0));return u}function W(i){let r=i.key,a=i.value,n=i.valueSpec,o=e.H(a);if("number"===o&&a!=a&&(o="NaN"),"number"!==o)return[new e.V(r,a,`number expected, ${o} found`)];if("minimum"in n){let o=n.minimum;if("array"===e.H(n.minimum)&&(o=n.minimum[i.arrayIndex]),a<o)return[new e.V(r,a,`${a} is less than the minimum value ${o}`)]}if("maximum"in n){let o=n.maximum;if("array"===e.H(n.maximum)&&(o=n.maximum[i.arrayIndex]),a>o)return[new e.V(r,a,`${a} is greater than the maximum value ${o}`)]}return[]}function X(i){let r=i.valueSpec,a=e.K(i.value.type),n,o,s,l={},h="categorical"!==a&&void 0===i.value.property,u="array"===e.H(i.value.stops)&&"array"===e.H(i.value.stops[0])&&"object"===e.H(i.value.stops[0][0]),c=H({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(i){if("identity"===a)return[new e.V(i.key,i.value,'identity function may not have a "stops" property')];let r=[],n=i.value;return r=r.concat($({key:i.key,value:n,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:d})),"array"===e.H(n)&&0===n.length&&r.push(new e.V(i.key,n,"array must have at least one stop")),r},default:function(e){return ec({key:e.key,value:e.value,valueSpec:r,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&h&&c.push(new e.V(i.key,i.value,'missing required property "property"')),"identity"===a||i.value.stops||c.push(new e.V(i.key,i.value,'missing required property "stops"')),"exponential"===a&&i.valueSpec.expression&&!e.L(i.valueSpec)&&c.push(new e.V(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(h||e.M(i.valueSpec)?h&&!e.N(i.valueSpec)&&c.push(new e.V(i.key,i.value,"zoom functions not supported")):c.push(new e.V(i.key,i.value,"property functions not supported"))),("categorical"===a||u)&&void 0===i.value.property&&c.push(new e.V(i.key,i.value,'"property" property is required')),c;function d(i){let a=[],n=i.value,h=i.key;if("array"!==e.H(n))return[new e.V(h,n,`array expected, ${e.H(n)} found`)];if(2!==n.length)return[new e.V(h,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==e.H(n[0]))return[new e.V(h,n,`object expected, ${e.H(n[0])} found`)];if(void 0===n[0].zoom)return[new e.V(h,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new e.V(h,n,"object stop key must have value")];let r=e.K(n[0].zoom);if("number"!=typeof r)return[new e.V(h,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>r)return[new e.V(h,n[0].zoom,"stop zoom values must appear in ascending order")];r!==s&&(s=r,o=void 0,l={}),a=a.concat(H({key:`${h}[0]`,value:n[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:W,value:p}}))}else a=a.concat(p({key:`${h}[0]`,value:n[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},n));return e.O(e.Q(n[1]))?a.concat([new e.V(`${h}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(ec({key:`${h}[1]`,value:n[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}
7function p(i,s){let h=e.H(i.value),u=e.K(i.value),c=null!==i.value?i.value:s;if(n){if(h!==n)return[new e.V(i.key,c,`${h} stop domain type must match previous stop domain type ${n}`)]}else n=h;if("number"!==h&&"string"!==h&&"boolean"!==h&&"number"!=typeof u&&"string"!=typeof u&&"boolean"!=typeof u)return[new e.V(i.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==h&&"categorical"!==a){let n=`number expected, ${h} found`;return e.M(r)&&void 0===a&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(i.key,c,n)]}return"categorical"!==a||"number"!==h||"number"==typeof u&&isFinite(u)&&Math.floor(u)===u?"categorical"!==a&&"number"===h&&"number"==typeof u&&"number"==typeof o&&void 0!==o&&u<o?[new e.V(i.key,c,"stop domain values must appear in ascending order")]:(o=u,"categorical"===a&&u in l?[new e.V(i.key,c,"stop domain values must be unique")]:(l[u]=!0,[])):[new e.V(i.key,c,`integer expected, found ${String(u)}`)]}}function Y(i){let r=("property"===i.expressionContext?e.S:e.U)(e.Q(i.value),i.valueSpec);if("error"===r.result)return r.value.map(r=>new e.V(`${i.key}${r.key}`,i.value,r.message));let a=r.value.expression||r.value._styleExpression.expression;if("property"===i.expressionContext&&"text-font"===i.propertyKey&&!a.outputDefined())return[new e.V(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===i.expressionContext&&"layout"===i.propertyType&&!e.W(a))return[new e.V(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===i.expressionContext)return function i(r,a){let n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(a.valueSpec&&a.valueSpec.expression)for(let e of a.valueSpec.expression.parameters)n.delete(e);if(0===n.size)return[];let o=[];return r instanceof e.Z&&n.has(r.name)?[new e.V(a.key,a.value,`["${r.name}"] expression is not supported in a filter for a ${a.object.type} layer with id: ${a.object.id}`)]:(r.eachChild(e=>{o.push(...i(e,a))}),o)}(a,i);if(i.expressionContext&&0===i.expressionContext.indexOf("cluster")){if(!e.X(a,["zoom","feature-state"]))return[new e.V(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===i.expressionContext&&!e.Y(a))return[new e.V(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function K(i){let r=i.key,a=i.value,n=i.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.K(a))&&o.push(new e.V(r,a,`expected one of [${n.values.join(", ")}], ${JSON.stringify(a)} found`)):-1===Object.keys(n.values).indexOf(e.K(a))&&o.push(new e.V(r,a,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(a)} found`)),o}function J(i){return e.$(e.Q(i.value))?Y(e.J({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):function i(r){let a=r.value,n=r.key;if("array"!==e.H(a))return[new e.V(n,a,`array expected, ${e.H(a)} found`)];let o=r.styleSpec,s,l=[];if(a.length<1)return[new e.V(n,a,"filter array must have at least 1 element")];switch(l=l.concat(K({key:`${n}[0]`,value:a[0],valueSpec:o.filter_operator,style:r.style,styleSpec:r.styleSpec})),e.K(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===e.K(a[1])&&l.push(new e.V(n,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":3!==a.length&&l.push(new e.V(n,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&"string"!==(s=e.H(a[1]))&&l.push(new e.V(`${n}[1]`,a[1],`string expected, ${s} found`));for(let i=2;i<a.length;i++)s=e.H(a[i]),"$type"===e.K(a[1])?l=l.concat(K({key:`${n}[${i}]`,value:a[i],valueSpec:o.geometry_type,style:r.style,styleSpec:r.styleSpec})):"string"!==s&&"number"!==s&&"boolean"!==s&&l.push(new e.V(`${n}[${i}]`,a[i],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let e=1;e<a.length;e++)l=l.concat(i({key:`${n}[${e}]`,value:a[e],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":s=e.H(a[1]),2!==a.length?l.push(new e.V(n,a,`filter array for "${a[0]}" operator must have 2 elements`)):"string"!==s&&l.push(new e.V(`${n}[1]`,a[1],`string expected, ${s} found`))}return l}(i)}function Q(i,r){let a;let n=i.key,o=i.style,s=i.layer,l=i.styleSpec,h=i.value,u=i.objectKey,c=l[`${r}_${i.layerType}`];if(!c)return[];let d=u.match(/^(.*)-use-theme$/);if("paint"===r&&d&&c[d[1]])return ec({key:n,value:h,valueSpec:{type:"string"},style:o,styleSpec:l});let p=u.match(/^(.*)-transition$/);if("paint"===r&&p&&c[p[1]]&&c[p[1]].transition)return ec({key:n,value:h,valueSpec:l.transition,style:o,styleSpec:l});let f=i.valueSpec||c[u];if(!f)return[new e.G(n,h,`unknown property "${u}"`)];
7if("string"===e.H(h)&&e.M(f)&&!f.tokens&&(a=/^{([^}]+)}$/.exec(h))){let i=`\`{ "type": "identity", "property": ${a?JSON.stringify(a[1]):'"_"'} }\``;return[new e.V(n,h,`"${u}" does not support interpolation syntax
8Use an identity property function instead: ${i}.`)]}let m=[];if("symbol"===i.layerType)"text-field"!==u||!o||o.glyphs||o.imports||m.push(new e.V(n,h,'use of "text-field" requires a style "glyphs" property')),"text-font"===u&&e.a0(e.Q(h))&&"identity"===e.K(h.type)&&m.push(new e.V(n,h,'"text-font" does not support identity functions'));else if("model"===i.layerType&&"paint"===r&&s&&s.layout&&s.layout.hasOwnProperty("model-id")&&e.M(f)&&(e.a1(f)||e.N(f))){let i=e.S(e.Q(h),f),r=i.value.expression||i.value._styleExpression.expression;r&&!e.X(r,["measure-light"])&&("model-emissive-strength"===u&&e.Y(r)&&e.W(r)||m.push(new e.V(n,h,`${u} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return m.concat(ec({key:i.key,value:h,valueSpec:f,style:o,styleSpec:l,expressionContext:"property",propertyType:r,propertyKey:u}))}function ee(e){return Q(e,"paint")}function et(e){return Q(e,"layout")}function ei(i){let r=[],a=i.value,n=i.key,o=i.style,s=i.styleSpec;a.type||a.ref||r.push(new e.V(n,a,'either "type" or "ref" is required'));let l=e.K(a.type),h=e.K(a.ref);if(a.id){let s=e.K(a.id);for(let l=0;l<i.arrayIndex;l++){let i=o.layers[l];e.K(i.id)===s&&r.push(new e.V(n,a.id,`duplicate layer id "${a.id}", previously used at line ${i.id.__line__}`))}}if("ref"in a){let i;["type","source","source-layer","filter","layout"].forEach(i=>{i in a&&r.push(new e.V(n,a[i],`"${i}" is prohibited for ref layers`))}),o.layers.forEach(r=>{e.K(r.id)===h&&(i=r)}),i?i.ref?r.push(new e.V(n,a.ref,"ref cannot reference another ref layer")):l=e.K(i.type):"string"==typeof h&&r.push(new e.V(n,a.ref,`ref layer "${h}" not found`))}else if("background"!==l&&"sky"!==l&&"slot"!==l){if(a.source){let i=o.sources&&o.sources[a.source],s=i&&e.K(i.type);i?"vector"===s&&"raster"===l?r.push(new e.V(n,a.source,`layer "${a.id}" requires a raster source`)):"raster"===s&&"raster"!==l?r.push(new e.V(n,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==s||a["source-layer"]?"raster-dem"===s&&"hillshade"!==l?r.push(new e.V(n,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==s||["raster","raster-particle"].includes(l)?"line"===l&&a.paint&&(
8a.paint["line-gradient"]||a.paint["line-trim-offset"])&&("geojson"!==s||!i.lineMetrics)?r.push(new e.V(n,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):"raster-particle"===l&&"raster-array"!==s&&r.push(new e.V(n,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new e.V(n,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new e.V(n,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new e.V(n,a.source,`source "${a.source}" not found`))}else r.push(new e.V(n,a,'missing required property "source"'))}return r=r.concat(H({key:n,value:a,valueSpec:s.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ec({key:`${n}.type`,value:a.type,valueSpec:s.layer.type,style:i.style,styleSpec:i.styleSpec,object:a,objectKey:"type"}),filter:i=>J(e.J({layerType:l},i)),layout:i=>H({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>et(e.J({layerType:l},i))}}),paint:i=>H({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>ee(e.J({layerType:l,layer:a},i))}})}}))}function er(i){let r=i.value,a=i.key,n=e.H(r);return"string"!==n?[new e.V(a,r,`string expected, ${n} found`)]:[]}let ea={promoteId:function({key:i,value:r}){if("string"===e.H(r))return er({key:i,value:r});{let e=[];for(let a in r)e.push(...er({key:`${i}.${a}`,value:r[a]}));return e}}};function en(i){let r=i.value,a=i.key,n=i.styleSpec,o=i.style;if(!r.type)return[new e.V(a,r,'"type" is required')];let s=e.K(r.type),l=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&(r.url||r.tiles||l.push(new e.G(a,r,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return l.concat(H({key:a,value:r,valueSpec:n[`source_${s.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:ea}));case"geojson":if(l=H({key:a,value:r,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:ea}),r.cluster)for(let e in r.clusterProperties){let[i,n]=r.clusterProperties[e],o="string"==typeof i?[i,["accumulated"],["get",e]]:i;l.push(...Y({key:`${a}.${e}.map`,value:n,expressionContext:"cluster-map"})),l.push(...Y({key:`${a}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return l;case"video":return H({key:a,value:r,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return H({key:a,value:r,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new e.V(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return K({key:`${a}.type`,value:r.type,valueSpec:{values:n.source.reduce((e,i)=>{let r=n[i];return"enum"===r.type.type&&(e=e.concat(Object.keys(r.type.values))),e},[])},style:o,styleSpec:n})}}function eo(i){let r=i.value,a=i.styleSpec,n=a.light,o=i.style,s=[],l=e.H(r);if(void 0===r)return s;if("object"!==l)return s.concat([new e.V("light",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/),h=i.match(/^(.*)-use-theme$/);s=s.concat(h&&n[h[1]]?ec({key:i,value:r[i],valueSpec:{type:"string"},style:o,styleSpec:a}):l&&n[l[1]]&&n[l[1]].transition?ec({key:i,value:r[i],valueSpec:a.transition,style:o,styleSpec:a}):n[i]?ec({key:i,value:r[i],valueSpec:n[i],style:o,styleSpec:a}):[new e.V(i,r[i],`unknown property "${i}"`)])}return s}function es(i){let r=i.value,a=[];if(!r)return a;let n=e.H(r);if("object"!==n)return a.concat([new e.V("light-3d",r,`object expected, ${n} found`)]);let o=i.styleSpec,s=o["light-3d"],l=i.key,h=i.style,u=i.style.lights;for(let i of["type","id"])if(!(i in r))return a.concat([new e.V("light-3d",r,`missing property ${i} on light`)]);if(r.type&&u)for(let n=0;n<i.arrayIndex;n++){let i=e.K(r.type),o=u[n];e.K(o.type)===i&&a.push(new e.V(l,r.id,`duplicate light type "${r.type}", previously defined at line ${o.id.__line__}`))}let c=`properties_light_${r.type}`;if(!(c in o))return a.concat([new e.V("light-3d",r,`Invalid light type ${r.type}`)]);let d=o[c];for(let n in r)if("properties"===n){let s=r[n],l=e.H(s);if("object"!==l)return a.concat([new e.V("properties",s,`object expected, ${l}
8 found`)]);for(let r in s)a=a.concat(d[r]?ec({key:r,value:s[r],valueSpec:d[r],style:h,styleSpec:o}):[new e.G(i.key,s[r],`unknown property "${r}"`)])}else{let i=n.match(/^(.*)-transition$/),l=n.match(/^(.*)-use-theme$/);a=a.concat(l&&s[l[1]]?ec({key:n,value:r[n],valueSpec:{type:"string"},style:h,styleSpec:o}):i&&s[i[1]]&&s[i[1]].transition?ec({key:n,value:r[n],valueSpec:o.transition,style:h,styleSpec:o}):s[n]?ec({key:n,value:r[n],valueSpec:s[n],style:h,styleSpec:o}):[new e.G(n,r[n],`unknown property "${n}"`)])}return a}function el(i){let r=i.value,a=i.key,n=i.style,o=i.styleSpec,s=o.terrain,l=[],h=e.H(r);if(void 0===r||"null"===h)return l;if("object"!==h)return l.concat([new e.V("terrain",r,`object expected, ${h} found`)]);for(let i in r){let a=i.match(/^(.*)-transition$/),h=i.match(/^(.*)-use-theme$/);l=l.concat(h&&s[h[1]]?ec({key:i,value:r[i],valueSpec:{type:"string"},style:n,styleSpec:o}):a&&s[a[1]]&&s[a[1]].transition?ec({key:i,value:r[i],valueSpec:o.transition,style:n,styleSpec:o}):s[i]?ec({key:i,value:r[i],valueSpec:s[i],style:n,styleSpec:o}):[new e.G(i,r[i],`unknown property "${i}"`)])}if(r.source){let i=n.sources&&n.sources[r.source],o=i&&e.K(i.type);i?"raster-dem"!==o&&l.push(new e.V(a,r.source,`terrain cannot be used with a source of type ${String(o)}, it only be used with a "raster-dem" source type`)):l.push(new e.V(a,r.source,`source "${r.source}" not found`))}else l.push(new e.V(a,r,'terrain is missing required property "source"'));return l}function eh(i){let r=i.value,a=i.style,n=i.styleSpec,o=n.fog,s=[],l=e.H(r);if(void 0===r)return s;if("object"!==l)return s.concat([new e.V("fog",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/),h=i.match(/^(.*)-use-theme$/);s=s.concat(h&&o[h[1]]?ec({key:i,value:r[i],valueSpec:{type:"string"},style:a,styleSpec:n}):l&&o[l[1]]&&o[l[1]].transition?ec({key:i,value:r[i],valueSpec:n.transition,style:a,styleSpec:n}):o[i]?ec({key:i,value:r[i],valueSpec:o[i],style:a,styleSpec:n}):[new e.G(i,r[i],`unknown property "${i}"`)])}return s}let eu={"*":()=>[],array:$,boolean:function(i){let r=i.value,a=i.key,n=e.H(r);return"boolean"!==n?[new e.V(a,r,`boolean expected, ${n} found`)]:[]},number:W,color:function(i){let r=i.key,a=i.value,n=e.H(a);return"string"!==n?[new e.V(r,a,`color expected, ${n} found`)]:null===e._.parseCSSColor(a)?[new e.V(r,a,`color expected, "${a}" found`)]:[]},enum:K,filter:J,function:X,layer:ei,object:H,source:en,model:e.a2,light:eo,"light-3d":es,terrain:el,fog:eh,string:er,formatted:function(e){return 0===er(e).length?[]:Y(e)},resolvedImage:function(e){return 0===er(e).length?[]:Y(e)},projection:function(i){let r=i.value,a=i.styleSpec,n=a.projection,o=i.style,s=[],l=e.H(r);if("object"===l)for(let e in r)s=s.concat(ec({key:e,value:r[e],valueSpec:n[e],style:o,styleSpec:a}));else"string"!==l&&(s=s.concat([new e.V("projection",r,`object or string expected, ${l} found`)]));return s},import:function(i){let{value:r,styleSpec:a}=i,{data:n,...o}=r;Object.defineProperty(o,"__line__",{value:r.__line__,enumerable:!1});let s=H(e.J({},i,{value:o,valueSpec:a.import}));return""===e.K(o.id)&&s.push(new e.V(`${i.key}.id`,o,"import id can't be an empty string")),n&&(s=s.concat(ep(n,a,{key:`${i.key}.data`}))),s}};function ec(i,r=!1){let a=i.value,n=i.valueSpec,o=i.styleSpec;if(n.expression&&e.a0(e.K(a)))return X(i);if(n.expression&&e.O(e.Q(a)))return Y(i);if(n.type&&eu[n.type]){let a=eu[n.type](i);return!0===r&&a.length>0&&"array"===e.H(i.value)?Y(i):a}return H(e.J({},i,{valueSpec:n.type?o[n.type]:n}))}function ed(i){let r=i.value,a=i.key,n=er(i);return n.length||(-1===r.indexOf("{fontstack}")&&n.push(new e.V(a,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&n.push(new e.V(a,r,'"glyphs" url must include a "{range}" token'))),n}function ep(i,r=e.a3,a={}){return ec({key:a.key||"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:ed,"*":()=>[]}})}function ef(i,r=e.a3){return eA(ep(i,r))}let em=e=>eA(en(e)),e_=e=>eA(eo(e)),eg=e=>eA(es(e)),ey=e=>eA(el(e)),ex=e=>eA(eh(e)),ev=i=>eA(function(i){let r=i.value,a=i.style,n=i.styleSpec,o=n.snow,s=[],l=e.H(r);if(void 0===r)return s;if("object"!==l)return s.concat([new e.V("snow",r,`object expected, ${l}
8 found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/);s=s.concat(l&&o[l[1]]&&o[l[1]].transition?ec({key:i,value:r[i],valueSpec:n.transition,style:a,styleSpec:n}):o[i]?ec({key:i,value:r[i],valueSpec:o[i],style:a,styleSpec:n}):[new e.G(i,r[i],`unknown property "${i}"`)])}return s}(i)),eb=i=>eA(function(i){let r=i.value,a=i.style,n=i.styleSpec,o=n.rain,s=[],l=e.H(r);if(void 0===r)return s;if("object"!==l)return s.concat([new e.V("rain",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/);s=s.concat(l&&o[l[1]]&&o[l[1]].transition?ec({key:i,value:r[i],valueSpec:n.transition,style:a,styleSpec:n}):o[i]?ec({key:i,value:r[i],valueSpec:o[i],style:a,styleSpec:n}):[new e.G(i,r[i],`unknown property "${i}"`)])}return s}(i)),ew=e=>eA(ei(e)),eT=e=>eA(J(e)),eS=e=>eA(ee(e)),eM=e=>eA(et(e)),eE=i=>eA(e.a2(i));function eA(e){return e.slice().sort((e,i)=>e.line&&i.line?e.line-i.line:0)}function eI(i,r){let a=!1;if(r&&r.length)for(let n of r)n instanceof e.G?e.w(n.message):(i.fire(new e.y(Error(n.message))),a=!0);return a}class eC extends e.E{constructor(i,a="flat"){super(),this._transitionable=new e.a4(r||(r=new e.a5({anchor:new e.a6(e.a3.light.anchor),position:new e.a7(e.a3.light.position),color:new e.a6(e.a3.light.color),intensity:new e.a6(e.a3.light.intensity)}))),this.setLight(i,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i,r={}){this._validate(e_,e,r)||(this._transitionable.setTransitionOrValue(e),this.id=i)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eI(this,i.call(ef,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.a3})))}}let eP=class extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._transitionable=new e.a4(new e.a5({source:new e.a6(e.a3.terrain.source),exaggeration:new e.a6(e.a3.terrain.exaggeration)}),a,n),this._transitionable.setTransitionOrValue(i,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(e,i){this._transitionable.setTransitionOrValue(e,i)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(i){return this._transitioning.possiblyEvaluate(new e.a8(i)).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;let i=this._transitionable._values.exaggeration;if(!i)return null;let r=i.value.expression;if(!r)return null;let a=-1,n=-1,o=1;for(let i of r.zoomStops)(o=r.evaluate(new e.a8(i)))>.01?(a=i,n=-1):n=i;return o<.01&&a>0&&n>a?[a,n]:null}isZoomDependent(){let i=this._transitionable._values.exaggeration;return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof e.a9}};function ez(i,r,a,n){let o=e.ac(45,65,a),[s,l]=eD(i,n),h=1-Math.min(1,Math.exp(-((r-s)/(l-s)*6)));return h*=h*h,(h=Math.min(1,1.00747*h))*o*i.alpha}function eD(e,i){let r=.5/Math.tan(.5*i);return[e.range[0]+r,e.range[1]+r]}function eR(i,r,a,n,o){let s=e.ab.vec3.transformMat4([],[r,a,n],o.mercatorFogMatrix);return ez(i,e.ab.vec3.length(s),o.pitch,o._fov)}function eL(i,r,a,n,o,s,l){let h=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(let i of[[a,n,0],[o,n,0],[o,s,0],[a,s,0]]){let a=e.ab.vec3.transformMat4([],i,r),n=e.ab.vec3.length(a);h=Math.min(h,n),u=Math.max(u,n)}return[ez(i,h,l.pitch,l._fov),ez(i,u,l.pitch,l._fov)]}class eO extends e.E{constructor(i,r,a,n){super();let o=new e.a5({range:new e.a6(e.a3.fog.range),color:new e.a6(e.a3.fog.color),"color-use-theme":new e.a6({type:"string","property-type":"data-constant",default:"default"}),"high-color":new e.a6(e.a3.fog["high-color"]),"high-color-use-theme":new e.a6({type:"string","property-type":"data-constant",default:"default"}),"space-color":new e.a6(e.a3.fog["space-color"]),"space-color-use-theme":new e.a6({type:"string","property-type":"data-constant",default:"default"}
8),"horizon-blend":new e.a6(e.a3.fog["horizon-blend"]),"star-intensity":new e.a6(e.a3.fog["star-intensity"]),"vertical-range":new e.a6(e.a3.fog["vertical-range"])});this._transitionable=new e.a4(o,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this._transform=r,this.properties=new e.ad(o),this.scope=a}get state(){let i=this._transform,r="globe"===i.projection.name,a=e.ae(i.zoom),n=this.properties.get("range");return{range:r?[e.af(.5,n[0],a),e.af(3,n[1],a)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,r,a={}){if(this._validate(ex,i,a))return;let n=e.l({},i);for(let i of Object.keys(e.a3.fog))void 0===n[i]&&(n[i]=e.a3.fog[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(i){if(!this._transform.projection.supportsFog)return 0;let r=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.ac(45,65,i))*r.a}getOpacityAtLatLng(i,r){return this._transform.projection.supportsFog?function(i,r,a){let n=e.aa.fromLngLat(r),o=a.elevation?a.elevation.getAtPointOrZero(n):0;return eR(i,n.x,n.y,o,a)}(this.state,i,r):0}getOpacityForTile(i){if(!this._transform.projection.supportsFog)return[1,1];let r=this._transform.calculateFogTileMatrix(i.toUnwrapped());return eL(this.state,r,0,0,e.ag,e.ag,this._transform)}getOpacityForBounds(e,i,r,a,n){return this._transform.projection.supportsFog?eL(this.state,e,i,r,a,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?eD(this.state,e):[0,1]}isVisibleOnFrustum(i){if(!this._transform.projection.supportsFog)return!1;for(let r of[4,5,6,7]){let a;let n=i.points[r];if(n[2]>=0)a=n;else{let o=i.points[r-4];a=e.ah(o,n,o[2]/(o[2]-n[2]))}if(eR(this.state,a[0],a[1],0,this._transform)>=.05)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eI(this,i.call(ef,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.a3})))}}let ek,eF,eB,eN,eV=class extends e.E{constructor(i,r,a,n){super();let o=ek||(ek=new e.a5({density:new e.a6(e.a3.snow.density),intensity:new e.a6(e.a3.snow.intensity),color:new e.a6(e.a3.snow.color),opacity:new e.a6(e.a3.snow.opacity),vignette:new e.a6(e.a3.snow.vignette),"vignette-color":new e.a6(e.a3.snow["vignette-color"]),"center-thinning":new e.a6(e.a3.snow["center-thinning"]),direction:new e.a6(e.a3.snow.direction),"flake-size":new e.a6(e.a3.snow["flake-size"])}));this._transitionable=new e.a4(o,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.ad(o),this.scope=a}get state(){let i=this.properties.get("opacity"),r=this.properties.get("color"),a=this.properties.get("direction"),n=e.ai(a[0]),o=-Math.max(e.ai(a[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],l=this.properties.get("vignette"),h=this.properties.get("vignette-color");return h.a=l,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.aj(r.r,r.g,r.b,r.a*i),direction:s,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:h}}get(){return this._transitionable.serialize()}set(i,r,a={}){if(this._validate(ev,i,a))return;let n=e.l({},i);for(let i of Object.keys(e.a3.snow))void 0===n[i]&&(n[i]=e.a3.snow[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}
8_validate(i,r,a){return(!a||!1!==a.validate)&&eI(this,i.call(ef,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.a3})))}},eU=class extends e.E{constructor(i,r,a,n){super();let o=eF||(eF=new e.a5({density:new e.a6(e.a3.rain.density),intensity:new e.a6(e.a3.rain.intensity),color:new e.a6(e.a3.rain.color),opacity:new e.a6(e.a3.rain.opacity),vignette:new e.a6(e.a3.rain.vignette),"vignette-color":new e.a6(e.a3.rain["vignette-color"]),"center-thinning":new e.a6(e.a3.rain["center-thinning"]),direction:new e.a6(e.a3.rain.direction),"droplet-size":new e.a6(e.a3.rain["droplet-size"]),"distortion-strength":new e.a6(e.a3.rain["distortion-strength"])}));this._transitionable=new e.a4(o,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.ad(o),this.scope=a}get state(){let i=this.properties.get("opacity"),r=this.properties.get("color"),a=this.properties.get("direction"),n=e.ai(a[0]),o=-Math.max(e.ai(a[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],l=this.properties.get("vignette-color");return l.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.aj(r.r,r.g,r.b,r.a*i),direction:s,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:l}}get(){return this._transitionable.serialize()}set(i,r,a={}){if(this._validate(eb,i,a))return;let n=e.l({},i);for(let i of Object.keys(e.a3.rain))void 0===n[i]&&(n[i]=e.a3.rain[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eI(this,i.call(ef,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.a3})))}};class ej extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._options=i,this.properties=new e.ad(r),this._transitionable=new e.a4(r,a,new Map(n)),this._transitionable.setTransitionOrValue(i.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,i){this._options=e,this._transitionable.setTransitionOrValue(e.properties,i)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}class eG{constructor(e,i,r,a){this.screenBounds=e,this.cameraPoint=i,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(i,r){let a,n;if(i instanceof e.P||"number"==typeof i[0]){let o=e.P.convert(i);a=[o],n=r.isPointAboveHorizon(o)}else{let o=e.P.convert(i[0]),s=e.P.convert(i[1]);a=[o,s],n=e.al(o,s).every(e=>r.isPointAboveHorizon(e))}return new eG(a,r.getCameraPoint(),n,r)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(i){return e.al(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],i)}bufferedCameraGeometry(i){let r=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.al(r,a,0,!1);return this.cameraPoint.y>a.y&&(this.cameraPoint.x>r.x&&this.cameraPoint.x<a.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=a.x?n[2]=this.cameraPoint:this.cameraPoint.x<=r.x&&(n[3]=this.cameraPoint)),e.am(n,i)}bufferedCameraGeometryGlobe(i){let r=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.al(r,a,i),o=this.cameraPoint.clone();switch(3*((o.y>r.y)+(o.y>a.y))+((o.x>r.x)+(o.x>a.x))){case 0:n[0]=o,n[4]=o.clone();break;case 1:n.splice(1,0,o);break;case 2:n[1]=o;break;case 3:n.splice(4,0,o);break;case 5:n.splice(2,0,o);break;case 6:n[3]=o;break;case 7:n.splice(3,0,o);break;case 8:n[2]=o}return n}containsTile(i,r,a,n=0){var o;let s=i.queryPadding/r._pixelsPerMercatorPixel+1,l=a?this._bufferedCameraMercator(s,r):this._bufferedScreenMercator(s,r),h=i.tileID.wrap+(l.unwrapped?n:0),u=l.polygon.map(r=>e.an(i.tileTransform,r,h));if(!e.ao(u,0,0,e.ag,e.ag))return;h=i.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);let c=this.screenGeometryMercator.polygon.map(r=>e.ap(i.tileTransform,r,h)),d=c.map(i=>new e.P(i[0],i[1])),p=r.getFreeCameraOptions().position||new e.aa(0,0,0),f=e.ap(i.tileTransform,p,h),m=c.map(i=>{let r=e.ab.vec3.sub(i,i,f);return e.ab.vec3.normalize(r,r),new e.aq(f,r)}),_=e.ar(i,1,r.zoom)*r._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:d,tilespaceRays:m,bufferedTilespaceGeometry:u,bufferedTilespaceBounds:((o=e.as(u)).min.x=e.aw(o.min.x,0,e.ag),o.min.y=e.aw(o.min.y,0,e.ag),o.max.x=e.aw(o.max.x,0,e.ag),o.max.y=e.aw(o.max.y,0,e.ag),o),tile:i,tileID:i.tileID,pixelToTileUnitsFactor:_}}_bufferedScreenMercator(e,i){let r=100*e|0;if(this._screenRaycastCache[r])return this._screenRaycastCache[r];{let a;return a="globe"===i.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),i):{polygon:this.bufferedScreenGeometry(e).map(e=>i.pointCoordinate3D(e)),unwrapped:!0},this._screenRaycastCache[r]=a,a}}_bufferedCameraMercator(e,i){let r=100*e|0;if(this._cameraRaycastCache[r])return this._cameraRaycastCache[r];{let a;return a="globe"===i.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),i):{polygon:this.bufferedCameraGeometry(e).map(e=>i.pointCoordinate3D(e)),unwrapped:!0},this._cameraRaycastCache[r]=a,a}}_projectAndResample(i,r){let a=function(i,r){let a=e.ab.mat4.multiply([],r.pixelMatrix,r.globeMatrix),n=[0,-e.ax,0,1],o=[0,e.ax,0,1],s=[0,0,0,1];e.ab.vec4.transformMat4(n,n,a),e.ab.vec4.transformMat4(o,o,a),e.ab.vec4.transformMat4(s,s,a);let l=new e.P(n[0]/n[3],n[1]/n[3]),h=new e.P(o[0]/o[3],o[1]/o[3]),u=e.au(i,l)&&n[3]<s[3],c=e.au(i,h)&&o[3]<s[3];if(!u&&!c)return null;let d=function(e,i,r){for(let a=1;a<e.length;a++){let n=eZ(i.pointCoordinate3D(e[a-1]).x),o=eZ(i.pointCoordinate3D(e[a]).x);
8if(r<0){if(n<o)return{idx:a,t:-n/(o-1-n)}}else if(o<n)return{idx:a,t:(1-n)/(o+1-n)}}return null}(i,r,u?-1:1);if(!d)return null;let{idx:p,t:f}=d,m=p>1?eq(i.slice(0,p),r):[],_=p<i.length?eq(i.slice(p),r):[];m=m.map(i=>new e.P(eZ(i.x),i.y)),_=_.map(i=>new e.P(eZ(i.x),i.y));let g=[...m];0===g.length&&g.push(_[_.length-1]);let y=e.af(g[g.length-1].y,(0===_.length?m[0]:_[0]).y,f);return g.push(...u?[new e.P(0,y),new e.P(0,0),new e.P(1,0),new e.P(1,y)]:[new e.P(1,y),new e.P(1,1),new e.P(0,1),new e.P(0,y)]),0===_.length?g.push(m[0]):g.push(..._),{polygon:g.map(i=>new e.aa(i.x,i.y)),unwrapped:!1}}(i,r);if(a)return a;let n=function(i,r){let a=!1,n=-1/0,o=0;for(let e=0;e<i.length-1;e++)i[e].x>n&&(n=i[e].x,o=e);for(let e=0;e<i.length-1;e++){let r=(o+e)%(i.length-1),n=i[r],s=i[r+1];Math.abs(n.x-s.x)>.5&&(n.x<s.x?(n.x+=1,0===r&&(i[i.length-1].x+=1)):(s.x+=1,r+1===i.length-1&&(i[0].x+=1)),a=!0)}let s=e.at(r.center.lng);return a&&s<Math.abs(s-1)&&i.forEach(e=>{e.x-=1}),{polygon:i,unwrapped:a}}(eq(i,r).map(i=>new e.P(eZ(i.x),i.y)),r);return{polygon:n.polygon.map(i=>new e.aa(i.x,i.y)),unwrapped:n.unwrapped}}}function eq(i,r){return e.av(i,e=>{let i=r.pointCoordinate3D(e);e.x=i.x,e.y=i.y},1/256)}function eZ(e){return e<0?1+e%1:e%1}function eH(i,r,a,n,o){let s=function(a,n){if(a)return o(a);if(n){if(i.url&&n.tiles&&i.tiles&&delete i.tiles,n.variants){if(!Array.isArray(n.variants))return o(Error("variants must be an array"));for(let i of n.variants){if(null==i||"object"!=typeof i||i.constructor!==Object)return o(Error("variant must be an object"));if(!Array.isArray(i.capabilities))return o(Error("capabilities must be an array"));if(1===i.capabilities.length&&"meshopt"===i.capabilities[0]){n=e.l(n,i);break}}}let a=e.ay(e.l({},n,i),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);a.tiles=r.canonicalizeTileset(a,i.url),o(null,a)}},l=function(e,i,r){if(!e)return null;if(!i&&!r)return e;r=r||e.worldview_default;let a=Object.values(e.language||{});if(0===a.length)return null;let n=Object.values(e.worldview||{});if(0===n.length)return null;let o=a.every(e=>e===i),s=n.every(e=>e===r);return o&&s?e:i in(e.language_options||{})||r in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(i.data,a,n);return l?e.q.frame(()=>s(null,l)):i.url?e.n(r.transformRequest(r.normalizeSourceURL(i.url,null,a,n),e.R.Source),s):e.q.frame(()=>{let{data:e,...r}=i;s(null,r)})}class e${constructor(i,r,a){this.bounds=e.az.convert(this.validateBounds(i)),this.minzoom=r||0,this.maxzoom=a||24}
8validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(i){let r=Math.pow(2,i.z),a=Math.floor(e.at(this.bounds.getWest())*r),n=Math.floor(e.aA(this.bounds.getNorth())*r),o=Math.ceil(e.at(this.bounds.getEast())*r),s=Math.ceil(e.aA(this.bounds.getSouth())*r);return i.x>=a&&i.x<o&&i.y>=n&&i.y<s}}class eW extends e.E{constructor(i,r,a,n){if(super(),this.id=i,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.l(this,e.ay(r,["url","scheme","tileSize","promoteId"])),this._options=e.l({type:"vector"},r),this._collectResourceTiming=!!r.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new e.aB}load(i){this._loaded=!1,this.fire(new e.z("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map.getWorldview();this._tileJSONRequest=eH(this._options,this.map._requestManager,r,a,(n,o)=>{if(this._tileJSONRequest=null,this._loaded=!0,n)r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new e.y(n));else if(o){if(e.l(this,o),this.hasWorldviews=!!o.worldview_options,o.worldview_default&&(this.worldviewDefault=o.worldview_default),o.vector_layers)for(let e of(this.vectorLayers=o.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set,o.vector_layers))this.vectorLayerIds.push(e.id),o.worldview&&o.worldview[e.source]&&this.localizableLayerIds.add(e.id);o.bounds&&(this.tileBounds=new e$(o.bounds,this.minzoom,this.maxzoom)),R(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))}i&&i(n)})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.aC(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}loadTile(i,r){let a=i.tileID.canonical.url(this.tiles,this.scheme),n=this.map._requestManager.normalizeTileURL(a),o=this.map._requestManager.transformRequest(n,e.R.Tile),s=this.map.style?this.map.style.getLut(this.scope):null,l=s?{image:s.image.clone()}:null,h={request:o,data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,lut:l,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:i.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor()};if(this.hasWorldviews&&e.f(a)&&(h.worldview=this.map.getWorldview()||this.worldviewDefault,h.localizableLayerIds=this.localizableLayerIds),h.request.collectResourceTiming=this._collectResourceTiming,i.actor&&"expired"!==i.state)"loading"===i.state?i.reloadCallback=r:i.request=i.actor.send("reloadTile",h,u.bind(this));else if(i.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)i.request=i.actor.send("loadTile",h,u.bind(this),void 0,!0);else{let r=e.aD.call({deduped:this._deduped},h,(e,r)=>{e||!r?u.call(this,e):(h.data={cacheControl:r.cacheControl,expires:r.expires,rawData:r.rawData.slice(0)},i.actor&&i.actor.send("loadTile",h,u.bind(this),void 0,!0))},!0);i.request={cancel:r}}function u(a,n){return delete i.request,i.aborted?r(null):a&&404!==a.status?r(a):(n&&n.resourceTiming&&(i.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&i.setExpiryData(n),i.loadVectorData(n,this.map.painter),e.aE(this.dispatcher),r(null),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(e,i){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class eX extends e.E{constructor(i,r,a,n){super(),this.id=i,this.dispatcher=a,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.l({type:"raster"},r),e.l(this,e.ay(r,["url","scheme","tileSize"]))}load(i){this._loaded=!1,this.fire(new e.z("dataloading",{dataType:"source"})),this._tileJSONRequest=eH(this._options,this.map._requestManager,null,null,(r,a)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new e.y(r)):a&&(e.l(this,a),a.raster_layers&&(this.rasterLayers=a.raster_layers,this.rasterLayerIds=this.rasterLayers.map(e=>e.id)),a.bounds&&(this.tileBounds=new e$(a.bounds,this.minzoom,this.maxzoom)),R(a.tiles),this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))),i&&i(r)})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.aC(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(i,r){let a=e.q.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),a,this.tileSize);i.request=e.o(this.map._requestManager.transformRequest(n,e.R.Tile),(a,n,o,s)=>(delete i.request,i.aborted?(i.state="unloaded",r(null)):a?(i.state="errored",r(a)):n?(this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:o,expires:s}),i.setTexture(n,this.map.painter),i.state="loaded",e.aE(this.dispatcher),void r(null)):r(null)))}abortTile(e,i){e.request&&(e.request.cancel(),delete e.request),i&&i()}unloadTile(i,r){i.texture&&i.texture instanceof e.T?(i.destroy(!0),i.texture&&i.texture instanceof e.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),r&&r()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class eY extends eX{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=22,this._options=e.l({type:"raster-array"},r)}triggerRepaint(e){let i=this.map.painter._terrain,r=this.map.style.getSourceCache(this.id);i&&i.enabled&&r&&i._clearRenderCacheForTile(r.id,e.tileID),this.map.triggerRepaint()}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(a,e.R.Tile);i.requestParams=n,i.actor||(i.actor=this.dispatcher.getActor()),i.request=i.fetchHeader(void 0,(e,a,n,o)=>{if(delete i.request,i.aborted)return i.state="unloaded",r(null);if(e){if(20===e.code)return;return i.state="errored",r(e)}this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:n,expires:o}),i.state="empty",r(null)})}unloadTile(i,r){let a=i.texture;a&&a instanceof e.T?(i.destroy(!0),this.map.painter.saveTileTexture(a)):(i.destroy(),i.flushQueues(),i._isHeaderLoaded=!1,delete i._mrt,delete i.textureDescriptor),i.fbo&&(i.fbo.destroy(),delete i.fbo),delete i.request,delete i.requestParams,delete i.neighboringTiles,i.state="unloaded"}prepareTile(i,r,a){i._isHeaderLoaded&&("empty"!==i.state&&(i.state="reloading"),i.fetchBand(r,a,(r,a)=>{if(r)return i.state="errored",this.fire(new e.y(r)),void this.triggerRepaint(i);a&&(i.setTexture(a,this.map.painter),i.state="loaded",this.triggerRepaint(i))}))}getInitialBand(e){if(!this.rasterLayers)return 0;let i=this.rasterLayers.find(({id:i})=>i===e),r=i&&i.fields,a=r&&r.bands&&r.bands;return a?a[0]:0}getTextureDescriptor(i,r,a){if(!i)return;let n=r.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let o=null;r instanceof e.aH?o=r.paint.get("raster-array-band"):r instanceof e.aI&&(o=r.paint.get("raster-particle-array-band"));let s=o||this.getInitialBand(n);if(null!=s){if(i.textureDescriptor){if(!i.updateNeeded(n,s)||a)return Object.assign({},i.textureDescriptor,{texture:i.texture})}else this.prepareTile(i,n,s)}}}let eK={vector:eW,raster:eX,"raster-dem":class extends eX{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=e.l({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,a){e&&(i.state="errored",r(e)),a&&(i.dem=a,i.dem.onDeserialize(),i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0,i.state="loaded",r(null))}i.request=e.o(this.map._requestManager.transformRequest(a,e.R.Tile),(function(a,o,s,l){if(delete i.request,i.aborted)i.state="unloaded",r(null);else if(a)i.state="errored",r(a);
8else if(o){this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:s,expires:l});let r=ImageBitmap&&o instanceof ImageBitmap&&e.t(),a=1-(o.width-e.aF(o.width))/2;a<1||i.neighboringTiles||(i.neighboringTiles=this._getNeighboringTiles(i.tileID));let h=r?o:e.q.getImageData(o,a),u={uid:i.uid,coord:i.tileID,source:this.id,scope:this.scope,rawImageData:h,encoding:this.encoding,padding:a};i.actor&&"expired"!==i.state||(i.actor=this.dispatcher.getActor(),i.actor.send("loadDEMTile",u,n.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(i){let r=i.canonical,a=Math.pow(2,r.z),n=(r.x-1+a)%a,o=0===r.x?i.wrap-1:i.wrap,s=(r.x+1+a)%a,l=r.x+1===a?i.wrap+1:i.wrap,h={};return h[new e.aG(i.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},h[new e.aG(i.overscaledZ,l,r.z,s,r.y).key]={backfilled:!1},r.y>0&&(h[new e.aG(i.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},h[new e.aG(i.overscaledZ,i.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},h[new e.aG(i.overscaledZ,l,r.z,s,r.y-1).key]={backfilled:!1}),r.y+1<a&&(h[new e.aG(i.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},h[new e.aG(i.overscaledZ,i.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},h[new e.aG(i.overscaledZ,l,r.z,s,r.y+1).key]={backfilled:!1}),h}},"raster-array":eY,geojson:class extends e.E{constructor(i,r,a,n){super(),this.id=i,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=a.getActor(),this.setEventedParent(n),this._data=r.data,this._options=e.l({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),void 0!==r.minzoom&&(this.minzoom=r.minzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;let o=e.ag/this.tileSize;this.workerOptions=e.l({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(void 0!==r.buffer?r.buffer:128)*o,tolerance:(void 0!==r.tolerance?r.tolerance:.375)*o,extent:e.ag,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:void 0!==r.clusterMaxZoom?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:e.ag,radius:(void 0!==r.clusterRadius?r.clusterRadius:50)*o,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter,dynamic:r.dynamic},r.workerOptions)}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(i){if(!this._options.dynamic)return this.fire(new e.y(Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof i&&("Feature"===i.type&&(i={type:"FeatureCollection",features:[i]}),"FeatureCollection"!==i.type))return this.fire(new e.y(Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof i&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){let e=new Map;for(let i of this._data.features)e.set(i.id,i);for(let r of i.features)e.set(r.id,r);this._data.features=[...e.values()]}else this._data=i;return this._updateWorkerData(!0),this}getClusterExpansionZoom(e,i){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope},i),this}getClusterChildren(e,i){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope},i),this}getClusterLeaves(e,i,r,a){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:i,offset:r},a),this}_updateWorkerData(i=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new e.z("dataloading",{dataType:"source"})),this._loaded=!1;let r=e.l({append:i},this.workerOptions);r.scope=this.scope;let a=this._data;"string"==typeof a?(r.request=this.map._requestManager.transformRequest(e.q.resolveURL(a),e.R.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(a),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,(r,a)=>{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new e.y(r));else{let r={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&a&&a.resourceTiming&&a.resourceTiming[this.id]&&(r.resourceTiming=a.resourceTiming[this.id]),i&&(this._partialReload=!0),this.fire(new e.z("data",r)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(i),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(i,r){let a=i.actor?"reloadTile":"loadTile";i.actor=this.actor;let n=this.map.style?this.map.style.getLut(this.scope):null,o=n?{image:n.image.clone()}
8:null,s=this._partialReload,l={type:this.type,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:o,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,scaleFactor:this.map.getScaleFactor(),partial:s};i.request=this.actor.send(a,l,(e,n)=>s&&!n?(i.state="loaded",r(null)):(delete i.request,i.destroy(),i.aborted?r(null):e?r(e):(i.loadVectorData(n,this.map.painter,"reloadTile"===a),r(null))),void 0,"loadTile"===a)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,i){this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.aJ{constructor(e,i,r,a){super(e,i,r,a),this.roundZoom=!0,this.type="video",this.options=i}load(){this._loaded=!1;let i=this.options;for(let r of(this.urls=[],i.urls))this.urls.push(this.map._requestManager.transformRequest(r,e.R.Source).url);e.aK(this.urls,(i,r)=>{this._loaded=!0,i?this.fire(new e.y(i)):r&&(this.video=r,this.video.loop=!0,this.video.setAttribute("playsinline",""),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(i){if(this.video){let r=this.video.seekable;i<r.start(0)||i>r.end(0)?this.fire(new e.y(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=i}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let i=this.map.painter.context,r=i.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(i,this.video,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(i)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.aJ,model:class extends e.E{constructor(e,i,r,a){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=i}load(){let i=[];for(let r in this._options.models){let a=this._options.models[r],n=e.aM(this.map._requestManager.transformRequest(a.uri,e.R.Model).url).then(i=>{if(!i)return;let n=e.aN(i),o=new e.aO(r,a.position,a.orientation,n);o.computeBoundsAndApplyParent(),this.models.push(o)}).catch(i=>{this.fire(new e.y(Error(`Could not load model ${r} from ${a.uri}: ${i.message}`)))});i.push(n)}return Promise.allSettled(i).then(()=>{this._loaded=!0,this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this.fire(new e.y(Error(`Could not load models: ${i.message}`)))})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,i){}serialize(){return{type:"model"}}},"batched-model":class extends e.E{constructor(e,i,r,a){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=i,this.tiles=this._options.tiles,this.maxzoom=i.maxzoom||19,this.minzoom=i.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=r,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(a)}onAdd(e){this.map=e,this.load()}load(i){this._loaded=!1,this.fire(new e.z("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map.getWorldview();this._tileJSONRequest=eH(this._options,this.map._requestManager,r,a,(n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&2!==a.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new e.y(n))):o&&(e.l(this,o),o.bounds&&(this.tileBounds=new e$(o.bounds,this.minzoom,this.maxzoom)),R(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))),i&&i(n)})}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(a,e.R.Tile),data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,lut:null,maxZoom:null,promoteId:null,pixelRatio:null,scaleFactor:null};if(i.actor&&"expired"!==i.state){if("loading"===i.state)i.reloadCallback=r;else{if(i.buckets){for(let e of Object.values(i.buckets))e.dirty=!0;return void(i.state="loaded")}i.request=i.actor.send("reloadTile",n,o.bind(this))}}else i.actor=this.dispatcher.getActor(),i.request=i.actor.send("loadTile",n,o.bind(this),void 0,!0);function o(e,a){return i.aborted?r(null):e&&404!==e.status?r(e):(this.map._refreshExpiredTiles&&a&&i.setExpiryData(a),i.loadModelData(a,this.map.painter),i.state="loaded",void r(null))}}serialize(){return e.l({},this._options)}},canvas:class extends e.aJ{constructor(i,r,a,n){super(i,r,a,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new e.y(new e.V(`sources.${i}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.y(new e.V(`sources.${i}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.y(new e.V(`sources.${i}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new e.y(new e.V(`sources.${i}`,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 e.y(new e.V(`sources.${i}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.y(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let i=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,i=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,i=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let r=this.map.painter.context;this.texture?!i&&!this._playing||this.texture instanceof e.aL||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(r,this.canvas,r.gl.RGBA8,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(i,r,a,n){super(),this.id=i,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=r,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.y(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.y(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new e$(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),e.l(this,e.ay(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.ay(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(i){this.map=i,this._loaded=!1,this.fire(new e.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(i),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){let{x:i,y:r,z:a}=e.canonical;return this._implementation.hasTile({x:i,y:r,z:a})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,i){let{x:r,y:a,z:n}=e.tileID.canonical,o=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:r,y:a,z:n},{signal:o.signal})).then((function(r){return delete e.request,e.aborted?(e.state="unloaded",i(null)):void 0===r?(e.state="errored",i(null)):null===r?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",i(null)):r instanceof ImageData||r instanceof HTMLCanvasElement||r instanceof ImageBitmap||r instanceof HTMLImageElement?(this.loadTileData(e,r),e.state="loaded",void i(null)):(e.state="errored",i(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(r=>{20!==r.code&&(e.state="errored",i(r))}),e.request.cancel=()=>o.abort()}loadTileData(e,i){e.setTexture(i,this.map.painter)}unloadTile(i,r){if(i.texture&&i.texture instanceof e.T?(i.destroy(!0),i.texture&&i.texture instanceof e.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),this._implementation.unloadTile){let{x:e,y:r,z:a}=i.tileID.canonical;this._implementation.unloadTile({x:e,y:r,z:a})}r&&r()}abortTile(e,i){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),i&&i()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}))}_clearTiles(){let i=e.aC(this.id,this.scope);this.map.style.clearSource(i)}
8_update(){this.fire(new e.z("data",{dataType:"source",sourceDataType:"content"}))}}},eJ=function(i,r,a,n){let o=new eK[r.type](i,r,a,n);if(o.id!==i)throw Error(`Expected Source id to be ${i} instead of ${o.id}`);return e.aP(["load","abort","unload","serialize","prepare"],o),o};function eQ(e,i){let r=e.tileID,a=i.tileID;return r.overscaledZ-a.overscaledZ||r.canonical.y-a.canonical.y||r.wrap-a.wrap||r.canonical.x-a.canonical.x}function e0(e,i){let r={};if(!i)return r;for(let a of e){let e=a.layerIds.map(e=>i.getLayer(e)).filter(Boolean);if(0!==e.length)for(let i of(a.layers=e,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(i=>e.filter(e=>e.id===i)[0])),e))r[i.fqid]=a}return r}let e1=new Uint16Array(8184);for(let e=0;e<2046;e++){let i=e+2,r=0,a=0,n=0,o=0,s=0,l=0;for(1&i?n=o=s=32:r=a=l=32;(i>>=1)>1;){let e=r+n>>1,h=a+o>>1;1&i?(n=r,o=a,r=s,a=l):(r=n,a=o,n=s,o=l),s=e,l=h}let h=4*e;e1[h+0]=r,e1[h+1]=a,e1[h+2]=n,e1[h+3]=o}let e2=new Uint16Array(2178),e3=new Uint8Array(1089),e4=new Uint16Array(1089);function e5(e){return 0===e?-.03125:32===e?.03125:0}let e6={type:2,extent:e.ag,loadGeometry:()=>[[new e.P(0,0),new e.P(e.ag+1,0),new e.P(e.ag+1,e.ag+1),new e.P(0,e.ag+1),new e.P(0,0)]]};class e8{constructor(i,r,a,n,o){this.tileID=i,this.uid=e.aV(),this.uses=0,this.tileSize=r,this.tileZoom=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(i){let r=i+this.timeAdded;r<e.q.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=e.aQ(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,a){if(this.unloadVectorData(),this.state="loaded",i){for(let n in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=e0(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){let i=this.buckets[n];if(i instanceof e.aX){if(this.hasSymbolBuckets=!0,!a)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof e.aX&&r.hasRTLText){this.hasRTLText=!0,e.aY();break}}for(let e in this.queryPadding=0,this.buckets){let i=this.buckets[e],a=r.style.getOwnLayer(e);if(!a)continue;let n=a.queryRadius(i);this.queryPadding=Math.max(this.queryPadding,n)}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas),this._lastUpdatedBrightness=i.brightness}else this.collisionBoxArray=new e.aW}unloadVectorData(){if(this.hasData()){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(e,i,r){e&&(e.resourceTiming&&(this.resourceTiming=e.resourceTiming),this.buckets={...this.buckets,...e0(e.buckets,i.style)},e.featureIndex&&(this.latestFeatureIndex=e.featureIndex))}getBucket(e){return this.buckets[e.fqid]}upload(i){for(let e in this.buckets){let r=this.buckets[e];r.uploadPending()&&r.upload(i)}let r=i.gl,a=this.imageAtlas;if(a&&!a.uploaded){let n=!!Object.keys(a.patternPositions).length;this.imageAtlasTexture=new e.T(i,a.image,r.RGBA8,{useMipmap:n}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(i,this.glyphAtlasImage,r.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new e.T(i,this.lineAtlas.image,r.R8),this.lineAtlas.uploaded=!0)}prepare(e,i,r){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,r),!i||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;let a=i.style.getBrightness();(this._lastUpdatedBrightness||a)&&(this._lastUpdatedBrightness&&a&&.001>Math.abs(this._lastUpdatedBrightness-a)||(this.updateBuckets(i,this._lastUpdatedBrightness!==a),this._lastUpdatedBrightness=a))}
8queryRenderedFeatures(i,r,a,n,o,s){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};let l=function(i,r){let a=e.ab.mat4.fromScaling([],[.5*i.width,-(.5*i.height),1]);return e.ab.mat4.translate(a,a,[1,-1,0]),e.ab.mat4.multiply(a,a,i.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(a)}(o,this.tileID);return this.latestFeatureIndex.query(i,{tilespaceGeometry:r,pixelPosMatrix:l,transform:n,availableImages:a,tileTransform:this.tileTransform})}querySourceFeatures(i,r){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;let n=a.loadVTLayers(),o=r?r.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;let l=e.aZ(r&&r.filter),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<s.length;r++){let n=s.feature(r);if(l.needGeometry){let i=e.a_(n,!0);if(!l.filter(new e.a8(this.tileID.overscaledZ),i,this.tileID.canonical))continue}else if(!l.filter(new e.a8(this.tileID.overscaledZ),n))continue;let p=a.getId(n,o),f=new e.a$(n,h,u,c,p);f.tile=d,i.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=e.b0(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let e=Date.now(),i=!1;if(this.expirationTime>e)i=!1;else if(r){if(this.expirationTime<r)i=!0;else{let a=this.expirationTime-r;a?this.expirationTime=e+Math.max(a,3e4):i=!0}}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),2147483647)}refreshFeatureState(e){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&e&&this.updateBuckets(e)}updateBuckets(i,r){if(!this.latestFeatureIndex||!i.style)return;let a=this.latestFeatureIndex.loadVTLayers(),n=i.style.listImages(),o=i.style.getBrightness();for(let s in this.buckets){if(!i.style.hasLayer(s))continue;let l=this.buckets[s],h=l.layers[0],u=h.sourceLayer||"_geojsonTileLayer",c=a[u],d=i.style.getLayerSourceCache(h),p={};d&&(p=d._state.getState(u,void 0));let f=this.imageAtlas&&this.imageAtlas.patternPositions||{},m=Object.keys(p).length>0&&!r;(!m||l.stateDependentLayers.length||r)&&l.update(p,c,n,f,m?l.stateDependentLayers:l.layers,r,o),(l instanceof e.b1||l instanceof e.b2)&&i._terrain&&i._terrain.enabled&&d&&l.programConfigurations.needsUpload&&i._terrain._clearRenderCacheForTile(d.id,this.tileID);let _=i&&i.style&&i.style.getOwnLayer(s);_&&(this.queryPadding=Math.max(this.queryPadding,_.queryRadius(l)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=e.q.now()+i}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof e.T?this.texture.update(i):(this.texture=new e.T(a,i,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(e,i){let r={};for(let e of i)r[e]=!0;this.dependencies[e]=r}hasDependency(e,i){for(let r of e){let e=this.dependencies[r];if(e){for(let r of i)if(e[r])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let a=e.b3(e6,this.tileID.canonical,this.tileTransform)[0],n=new e.b4,o=new e.b5;for(let e=0;e<a.length;e++){let{x:i,y:r}=a[e];n.emplaceBack(i,r),o.emplaceBack(e)}o.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(o),this._tileDebugBuffer=i.createVertexBuffer(n,e.b6.members),this._tileDebugSegments=e.b7.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(i,r){let a,n;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=e.b3(e6,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let a=e.aQ(i,r),n=Math.pow(2,i.z);for(let o=0;o<33;o++)for(let s=0;s<33;s++){let l=e.aR((i.x+(s+e5(s))/32)/n),h=e.aS((i.y+(o+e5(o))/32)/n),u=r.project(l,h),c=33*o+s;e2[2*c+0]=Math.round((u.x*a.scale-a.x)*e.ag),e2[2*c+1]=Math.round((u.y*a.scale-a.y)*e.ag)}e3.fill(0),e4.fill(0);for(let e=2045;e>=0;e--){let i=4*e,r=e1[i+0],a=e1[i+1],n=e1[i+2],o=e1[i+3],s=r+n>>1,l=a+o>>
81,h=s+l-a,u=l+r-s,c=33*a+r,d=33*o+n,p=33*l+s,f=Math.hypot((e2[2*c+0]+e2[2*d+0])/2-e2[2*p+0],(e2[2*c+1]+e2[2*d+1])/2-e2[2*p+1])>=16;e3[p]=e3[p]||(f?1:0),e<1022&&(e3[p]=e3[p]||e3[(a+u>>1)*33+(r+h>>1)]||e3[(o+u>>1)*33+(n+h>>1)])}let o=new e.aT,s=new e.aU,l=0;function h(i,r){let a=33*r+i;return 0===e4[a]&&(o.emplaceBack(e2[2*a+0],e2[2*a+1],i*e.ag/32,r*e.ag/32),e4[a]=++l),e4[a]-1}function u(e,i,r,a,n,o){let l=e+r>>1,c=i+a>>1;if(Math.abs(e-n)+Math.abs(i-o)>1&&e3[33*c+l])u(n,o,e,i,l,c),u(r,a,n,o,l,c);else{let l=h(e,i),u=h(r,a),c=h(n,o);s.emplaceBack(l,u,c)}}return u(0,0,32,32,32,0),u(32,32,0,0,0,32),{vertices:o,indices:s}}(this.tileID.canonical,r);a=i.vertices,n=i.indices}else{for(let{x:i,y:r}of(a=new e.aT,n=new e.aU,o))a.emplaceBack(i,r,0,0);let i=e.b8(a.int16,void 0,4);for(let e=0;e<i.length;e+=3)n.emplaceBack(i[e],i[e+1],i[e+2])}this._tileBoundsBuffer=i.createVertexBuffer(a,e.b9.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(n),this._tileBoundsSegments=e.b7.simpleSegment(0,0,a.length,n.length)}_makeGlobeTileDebugBuffers(i,r){let a;let n=r.projection;if(!n||"globe"!==n.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=e.ba(o,r),l=e.bb(s),h=e.ae(r.zoom);h>0&&(a=e.ab.mat4.invert(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,o,r,l,a,h),this._makeGlobeTileDebugTextBuffer(i,o,r,l,a,h)}_globePoint(i,r,a,n,o,s,l){let h=e.bc(i,r,a);if(s){let o=1<<a.z,u=e.at(n.center.lng),c=e.aA(n.center.lat),d=(a.x+.5)/o-u,p=0;d>.5?p=-1:d<-.5&&(p=1);let f=(i/e.ag+a.x)/o+p,m=(r/e.ag+a.y)/o;f=(f-u)*n._pixelsPerMercatorPixel+u,m=(m-c)*n._pixelsPerMercatorPixel+c;let _=[f*n.worldSize,m*n.worldSize,0];e.ab.vec3.transformMat4(_,_,s),h=e.bd(h,_,l)}return e.ab.vec3.transformMat4(h,h,o)}_makeGlobeTileDebugBorderBuffer(i,r,a,n,o,s){let l=new e.b4,h=new e.b5,u=new e.be,c=(e,i,c,d,p)=>{let f=(c-e)/(p-1),m=(d-i)/(p-1),_=l.length;for(let c=0;c<p;c++){let d=e+c*f,p=i+c*m;l.emplaceBack(d,p);let g=this._globePoint(d,p,r,a,n,o,s);u.emplaceBack(g[0],g[1],g[2]),h.emplaceBack(_+c)}},d=e.ag;c(0,0,d,0,16),c(d,0,d,d,16),c(d,d,0,d,16),c(0,d,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(h),this._tileDebugBuffer=i.createVertexBuffer(l,e.b6.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(u,e.bf.members),this._tileDebugSegments=e.b7.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(i,r,a,n,o,s){let l=e.ag/4,h=new e.b4,u=new e.aU,c=new e.be;u.reserve(32),h.reserve(25),c.reserve(25);let d=(e,i)=>25*e+i;for(let e=0;e<25;e++){let i=e*l;for(let e=0;e<25;e++){let u=e*l;h.emplaceBack(u,i);let d=this._globePoint(u,i,r,a,n,o,s);c.emplaceBack(d[0],d[1],d[2])}}for(let e=0;e<4;e++)for(let i=0;i<4;i++){let r=d(e,i),a=d(e,i+1),n=d(e+1,i),o=d(e+1,i+1);u.emplaceBack(r,a,n),u.emplaceBack(n,a,o)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(u),this._tileDebugTextBuffer=i.createVertexBuffer(h,e.b6.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(c,e.bf.members),this._tileDebugTextSegments=e.b7.simpleSegment(0,0,25,32)}destroy(i=!1){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!i&&this.texture&&this.texture instanceof e.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}e.bg.setPbf(e.bh);class e9 extends e8{constructor(e,i,r,a,n){super(e,i,r,a,n),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof e.T?this.texture.update(i,{premultiply:!1}):this.texture=new e.T(a,i,n.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(i=16384,r){let a=this._mrt=new e.bg(30),n=Object.assign({}
8,this.requestParams,{headers:{Range:"bytes=0-"+(i-1)}});return this.entireBuffer=null,this.request=e.bi(n,(e,n,o,s)=>{if(e)r(e);else try{let e=a.getHeaderLength(n);if(e>i)return void(this.request=this.fetchHeader(e,r));a.parseHeader(n),this._isHeaderLoaded=!0;let l=0;for(let e of Object.values(a.layers))l=Math.max(l,e.dataIndex[e.dataIndex.length-1].last_byte);n.byteLength>=l&&(this.entireBuffer=n),r(null,this.entireBuffer||n,o,s)}catch(e){r(e)}}),this.request}fetchBand(i,r,a){let n;let o=this._mrt;if(!this._isHeaderLoaded||!o)return void a(Error("Tile header is not ready"));let s=this.actor;if(!s)return void a(Error("Can't fetch tile band without an actor"));let l=(e,o)=>{n.complete(e,o),e?a(e):(this.updateTextureDescriptor(i,r),a(null,this.textureDescriptor&&this.textureDescriptor.img))},h=(e,i)=>{if(e)return a(e);let r=s.send("decodeRasterArray",{buffer:i,task:n},l,void 0,!0);this._workQueue.push(()=>{r&&r.cancel(),n.cancel()})},u=o.getLayer(i);if(!u)return void a(Error(`Unknown sourceLayer "${i}"`));if(u.hasDataForBand(r))return this.updateTextureDescriptor(i,r),void a(null,this.textureDescriptor?this.textureDescriptor.img:null);let c=u.getDataRange([r]);if((n=o.createDecodingTask(c))&&!n.tasks.length)a(null);else if(this.flushQueues(),this.entireBuffer)h(null,this.entireBuffer.slice(c.firstByte,c.lastByte+1));else{let i=Object.assign({},this.requestParams,{headers:{Range:`bytes=${c.firstByte}-${c.lastByte}`}}),r=e.bi(i,h);this._fetchQueue.push(()=>{r.cancel(),n.cancel()})}}updateNeeded(e,i){return(!this.textureDescriptor||this.textureDescriptor.band!==i||this.textureDescriptor.layer!==e)&&"errored"!==this.state}updateTextureDescriptor(i,r){if(!this._mrt)return;let a=this._mrt.getLayer(i);if(!a||!a.hasBand(r)||!a.hasDataForBand(r))return;let{bytes:n,tileSize:o,buffer:s,offset:l,scale:h}=a.getBandView(r),u=o+2*s,c={data:n,width:u,height:u},d=this.texture;d&&d instanceof e.T&&d.update(c,{premultiply:!1}),this.textureDescriptor={layer:i,band:r,img:c,buffer:s,offset:l,tileSize:o,format:a.pixelFormat,mix:[h,256*h,65536*h,16777216*h]}}}class e7{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(let e in this.data)for(let i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,r){let a=e.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);let n={value:i,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(e,n)},r)),this.data[a].push(n),this.order.push(a),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){let i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;let r=e.wrapped().key,a=void 0===i?0:this.data[r].indexOf(i),n=this.data[r][a];return this.data[r].splice(a,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let i=[];for(let r in this.data)for(let a of this.data[r])e(a.value)||i.push(a);for(let e of i)this.remove(e.value.tileID,e)}}class te{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,r,a){let n=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][n]=this.stateChanges[i][n]||{},e.l(this.stateChanges[i][n],a),null===this.deletedStates[i])for(let e in this.deletedStates[i]={},this.state[i])e!==n&&(this.deletedStates[i][e]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][n])for(let e in this.deletedStates[i][n]={},this.state[i][n])a[e]||(this.deletedStates[i][n][e]=null);else for(let e in a)this.deletedStates[i]&&this.deletedStates[i][n]&&null===this.deletedStates[i][n][e]&&delete this.deletedStates[i][n][e]}removeFeatureState(e,i,r){if(null===this.deletedStates[e])return;let a=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==i)null!==this.deletedStates[e][a]&&(this.deletedStates[e][a]=this.deletedStates[e][a]||{},this.deletedStates[e][a][r]=null);else if(void 0!==i){if(this.stateChanges[e]&&this.stateChanges[e][a])for(r in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][r]=null;else this.deletedStates[e][a]=null}else this.deletedStates[e]=null}getState(i,r){let a=this.state[i]||{},n=this.stateChanges[i]||{},o=this.deletedStates[i];if(null===o)return{};if(void 0!==r){let i=String(r),s=e.l({},a[i],n[i]);if(o){let e=o[r];if(null===e)return{};for(let i in e)delete s[i]}return s}let s=e.l({},a,n);if(o)for(let e in o)delete s[e];return s}initializeTileState(e,i){e.refreshFeatureState(i)}coalesceChanges(i,r){let a={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let r={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),e.l(this.state[i][a],this.stateChanges[i][a]),r[a]=this.state[i][a];a[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let r={};if(null===this.deletedStates[i])for(let e in this.state[i])r[e]={},this.state[i][e]={};else for(let e in this.deletedStates[i]){if(null===this.deletedStates[i][e])this.state[i][e]={};else if(this.state[i][e])for(let r of Object.keys(this.deletedStates[i][e]))delete this.state[i][e][r];r[e]=this.state[i][e]}a[i]=a[i]||{},e.l(a[i],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(let e in i)i[e].refreshFeatureState(r)}}class tt extends e.E{constructor(e,i,r){super(),this.id=e,this._onlySymbols=r,i.on("data",e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),i.on("error",()=>{this._sourceErrored=!0}),this._source=i,this._tiles={},this._cache=new e7(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
8,this._minTileCacheSize=i.minTileCacheSize,this._maxTileCacheSize=i.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new te,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let e in this._tiles){let i=this._tiles[e];if("loaded"!==i.state&&"errored"!==i.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,i){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,i)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){for(let i in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let r=this._tiles[i];r.upload(e),r.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return e.bj(this._tiles).map(e=>e.tileID).sort(ti).map(e=>e.key)}getRenderableIds(i,r){let a=[];for(let e in this._tiles)this._isIdRenderable(+e,i,r)&&a.push(this._tiles[e]);return i?a.sort((i,r)=>{let a=i.tileID,n=r.tileID,o=new e.P(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),s=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x}).map(e=>e.tileID.key):a.map(e=>e.tileID).sort(ti).map(e=>e.key)}hasRenderableParent(e){let i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())&&(r||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let e in this._cache.reset(),this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}_reloadTile(e,i){let r=this._tiles[e];r&&("loading"!==r.state&&(r.state=i),this._loadTile(r,this._tileLoaded.bind(this,r,e,i)))}_tileLoaded(i,r,a,n){if(n){if(i.state="errored",404!==n.status)this._source.fire(new e.y(n,{tile:i}));else{if(this._source.fire(new e.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:i})),!(i.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}}else i.timeAdded=e.q.now(),"expired"===a&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new e.z("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(e){let i=this.getRenderableIds();for(let a=0;a<i.length;a++){let n=i[a];if(e.neighboringTiles&&e.neighboringTiles[n]){let i=this.getTileByID(n);r(e,i),r(i,e)}}function r(e,i){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let r=i.tileID.canonical.x-e.tileID.canonical.x,a=i.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=i.tileID.key;0===r&&0===a||Math.abs(a)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),i.dem&&e.dem&&(e.dem.backfillBorder(i.dem,r,a),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}
8getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,r,a){for(let n in this._tiles){let o=this._tiles[n];if(a[n]||!o.hasData()||o.tileID.overscaledZ<=i||o.tileID.overscaledZ>r)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>i+1;){let e=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[e.key])&&o.hasData()&&(s=e)}let l=s;for(;l.overscaledZ>i;)if(e[(l=l.scaledTo(l.overscaledZ-1)).key]){a[s.key]=s;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){let r=this._loadedParentTiles[e.key];return r&&r.tileID.overscaledZ>=i?r:null}for(let r=e.overscaledZ-1;r>=i;r--){let i=e.scaledTo(r),a=this._getLoadedTile(i);if(a)return a}}_getLoadedTile(e){let i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,i){i=i||this._source.tileSize;let r=Math.floor((Math.ceil(e.width/i)+1)*(Math.ceil(e.height/i)+1)*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,r):r,n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(n)}handleWrapJump(e){let i=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,i){let e={};for(let r in this._tiles){let a=this._tiles[r];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+i),e[a.tileID.key]=a}for(let i in this._tiles=e,this._timers)clearTimeout(this._timers[i]),delete this._timers[i];for(let e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(i,r,a,n){if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!a)return;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};let o="batched-model"===this._source.type,s,l=this._source.maxzoom,h=this.map&&this.map.painter?this.map.painter._terrain:null;if(h&&h.sourceCache===this&&h.attenuationRange()){let e=Math.floor(h.attenuationRange()[0])-Math.log2(h.getDemUpscale());l>e&&(l=e)}if(this.used||this.usedForTerrain){if(this._source.tileID)s=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new e.aG(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y));else if(0!==this.tileCoverLift){let n=i.clone();n.tileCoverLift=this.tileCoverLift,s=n.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:l,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.minzoom<=1&&"globe"===i.projection.name&&(s.push(new e.aG(1,0,1,0,0)),s.push(new e.aG(1,0,1,1,0)),s.push(new e.aG(1,0,1,0,1)),s.push(new e.aG(1,0,1,1,1)))}else if(s=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:l,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.hasTile){let e=this._source.hasTile.bind(this._source);s=s.filter(i=>e(i))}}else s=[];if(s.length>0&&this.castsShadows&&n&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!tr(this._source.type)){let e=Math.min(i.coveringZoomLevel({tileSize:r||this._source.tileSize,roundZoom:this._source.roundZoom&&!a}),this._source.maxzoom);if(o)for(let r of i.extendTileCover(s,e))s.push(r);else for(let r of i.extendTileCover(s,e,n))this._shadowCasterTiles[r.key]=!0,s.push(r)}let u=this._updateRetainedTiles(s);if(tr(this._source.type)&&0!==s.length){let i={},r={};for(let a of Object.keys(u)){let n=u[a],o=this._tiles[a];if(!o||o.fadeEndTime&&o.fadeEndTime<=e.q.now())continue;let s=this.findLoadedParent(n,Math.max(n.overscaledZ-tt.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),i[s.tileID.key]=s.tileID),r[a]=n}let a=s[s.length-1].overscaledZ;for(let e in this._tiles){let i=this._tiles[e];if(u[e]||!i.hasData())continue;let n=i.tileID;for(;n.overscaledZ>a;){n=n.scaledTo(n.overscaledZ-1);let a=this._tiles[n.key];if(a&&a.hasData()&&r[n.key]){u[e]=i.tileID;break}}}for(let e in i)u[e]||(this._coveredTiles[e]=!0,u[e]=i[e])}for(let e in u)this._tiles[e].clearFadeHold();for(let i of e.bk(this._tiles,u)){let e=this._tiles[i];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+i)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){let i={};if(0===e.length)return i;let r={},a=e.reduce((e,i)=>
8Math.min(e,i.overscaledZ),1/0),n=e[0].overscaledZ,o=Math.max(n-tt.maxOverzooming,this._source.minzoom),s=Math.max(n+tt.maxUnderzooming,this._source.minzoom),l={};for(let r of e){let e=this._addTile(r);i[r.key]=r,e.hasData()||a<this._source.maxzoom&&(l[r.key]=r)}for(let n of(this._retainLoadedChildren(l,a,s,i),e)){let e=this._tiles[n.key];if(e.hasData())continue;if(n.canonical.z>=this._source.maxzoom){let e=n.children(this._source.maxzoom)[0],r=this.getTile(e);if(r&&r.hasData()){i[e.key]=e;continue}}else{let e=n.children(this._source.maxzoom);if(i[e[0].key]&&i[e[1].key]&&i[e[2].key]&&i[e[3].key])continue}let a=e.wasRequested();for(let s=n.overscaledZ-1;s>=o;--s){let o=n.scaledTo(s);if(r[o.key]||(r[o.key]=!0,(e=this.getTile(o))||!a||(e=this._addTile(o)),e&&(i[o.key]=o,a=e.wasRequested(),e.hasData())))break}}return i}_updateLoadedParentTileCache(){for(let e in this._loadedParentTiles={},this._tiles){let i=[],r,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){r=this._loadedParentTiles[a.key];break}i.push(a.key);let e=a.scaledTo(a.overscaledZ-1);if(r=this._getLoadedTile(e))break;a=e}for(let e of i)this._loadedParentTiles[e]=r}}_addTile(i){let r=this._tiles[i.key];if(r)return!0!==r.isExtraShadowCaster||this._shadowCasterTiles[i.key]||this._reloadTile(i.key,"reloading"),r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));let a=!!r;if(!a){let e=this.map?this.map.painter:null,a=this._source.tileSize*i.overscaleFactor();r="raster-array"===this._source.type?new e9(i,a,this.transform.tileZoom,e,this._isRaster):new e8(i,a,this.transform.tileZoom,e,this._isRaster),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,a||this._source.fire(new e.z("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let r=i.getExpiryTimeout();r&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},r))}_removeTile(e){let i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&"reloading"!==i.state||"empty"===i.state?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}clearTiles(){for(let e in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(i,r,a){let n=[],o=this.transform;if(!o)return n;let s="globe"===o.projection.name,l=e.at(o.center.lng);for(let h in this._tiles){let u;let c=this._tiles[h];if(a&&c.clearQueryDebugViz(),!c.holdingForFade()){if(s){let i=c.tileID.canonical;if(0===i.z){let r=[Math.abs(e.aw(l,...ta(i,-1))-l),Math.abs(e.aw(l,...ta(i,1))-l)];u=[0,2*r.indexOf(Math.min(...r))-1]}else{let r=[Math.abs(e.aw(l,...ta(i,-1))-l),Math.abs(e.aw(l,...ta(i,0))-l),Math.abs(e.aw(l,...ta(i,1))-l)];u=[r.indexOf(Math.min(...r))-1]}}else u=[0];for(let e of u){let a=i.containsTile(c,o,r,e);a&&n.push(a)}}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,i){let r=this.getRenderableIds(e,i).map(e=>this._tiles[e].tileID),a="globe"===this.transform.projection.name;for(let e of r)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=a?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return r}sortCoordinatesByDistance(e){let i=e.slice(),r=this.transform._camera.position,a=this.transform._camera.forward(),n={};for(let e of i){let i=1/(1<<e.canonical.z);n[e.key]=((e.canonical.x+.5)*i+e.wrap-r[0])*a[0]+((e.canonical.y+.5)*i-r[1])*a[1]-r[2]*a[2]}return i.sort((e,i)=>n[e.key]-n[i.key]),i}hasTransition(){if(this._source.hasTransition())return!0;
8if(tr(this._source.type))for(let i in this._tiles){let r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=e.q.now())return!0}return!1}setFeatureState(e,i,r){this._state.updateState(e=e||"_geojsonTileLayer",i,r)}removeFeatureState(e,i,r){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,r)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,r){let a=this._tiles[e];a&&a.setDependencies(i,r)}reloadTilesForDependencies(e,i){for(let r in this._tiles)this._tiles[r].hasDependency(e,i)&&this._reloadTile(+r,"reloading");this._cache.filter(r=>!r.hasDependency(e,i))}_preloadTiles(i,r){if(!this._sourceLoaded){let e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(i,r))};return void this._source.on("data",e)}let a=new Map,n=Array.isArray(i)?i:[i],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(let e of n){for(let i of e.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}))a.set(i.key,i);this.usedForTerrain&&e.updateElevation(!1)}let l=Array.from(a.values());e.bl(l,(e,i)=>{let r=new e8(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(r,e=>{"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),i(e,r)})},r)}}function ti(e,i){let r=Math.abs(2*e.wrap)-+(e.wrap<0),a=Math.abs(2*i.wrap)-+(i.wrap<0);return e.overscaledZ-i.overscaledZ||a-r||i.canonical.y-e.canonical.y||i.canonical.x-e.canonical.x}function tr(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function ta(e,i){let r=1<<e.z;return[e.x/r+i,(e.x+1)/r+i]}tt.maxOverzooming=10,tt.maxUnderzooming=3;class tn{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){for(let e in this.layers=[],this.style._mergedLayers){let i=this.style._mergedLayers[e];if("fill-extrusion"===i.type)this.layers.push({layer:i,visible:!1,visibilityChanged:!1});else if("model"===i.type){let e=this.style.getLayerSource(i);e&&"batched-model"===e.type&&this.layers.push({layer:i,visible:!1,visibilityChanged:!1})}}}onNewFrame(e){for(let i of(this.layersGotHidden=!1,this.layers)){let r=i.layer,a=!1;"fill-extrusion"===r.type?a=!r.isHidden(e)&&r.paint.get("fill-extrusion-opacity")>0:"model"===r.type&&(a=!r.isHidden(e)&&r.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!a&&i.visible,i.visible=a}}updateZOffset(e,i){for(let e of(this.currentBuildingBuckets=[],this.layers)){let r=e.layer,a=this.style.getLayerSourceCache(r),n=1;"fill-extrusion"===r.type&&(n=e.visible?r.paint.get("fill-extrusion-vertical-scale"):0);let o=a?a.getTile(i):null;if(!o&&a&&i.canonical.z>a.getSource().minzoom){let e=i.scaledTo(Math.min(a.getSource().maxzoom,i.overscaledZ-1));for(;e.overscaledZ>=a.getSource().minzoom&&!(o=a.getTile(e))&&0!==e.overscaledZ;)e=e.scaledTo(e.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:o?o.getBucket(r):null,tileID:o?o.tileID:i,verticalScale:n})}e.hasAnyZOffset=!1;let r=!1;for(let a=0;a<e.symbolInstances.length;a++){let n=e.symbolInstances.get(a),o=n.zOffset,s=this._getHeightAtTileOffset(i,n.tileAnchorX,n.tileAnchorY);n.zOffset=s!==Number.NEGATIVE_INFINITY?s:o,r||o===n.zOffset||(r=!0),e.hasAnyZOffset||0===n.zOffset||(e.hasAnyZOffset=!0)}r&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(i,r,a,n){let o=r,s=a;if(i.canonical.z!==n.canonical.z){let l=n.canonical,h=1/(1<<i.canonical.z-l.z);o=(r+i.canonical.x*e.ag)*h-l.x*e.ag|0,s=(a+i.canonical.y*e.ag)*h-l.y*e.ag|0}return{tileX:o,tileY:s}}_getHeightAtTileOffset(e,i,r){let a,n;for(let o=0;o<this.layers.length;++o){if("fill-extrusion"!==this.layers[o].layer.type)continue;let{bucket:s,tileID:l,verticalScale:h}=this.currentBuildingBuckets[o];if(!s)continue;let{tileX:u,tileY:c}=this._mapCoordToOverlappingTile(e,i,r,l),d=s.getHeightAtTileCoord(u,c);d&&void 0!==d.height&&(d.hidden?a=d.height:n=Math.max(d.height*h,n||0))}if(void 0!==n)return n;for(let n=0;n<this.layers.length;++n){let o=this.layers[n];if("model"!==o.layer.type||!o.visible)continue;let{bucket:s,tileID:l}=this.currentBuildingBuckets[n];if(!s)continue;let{tileX:h,tileY:u}=this._mapCoordToOverlappingTile(e,i,r,l),c=s.getHeightAtTileCoord(h,u);if(c&&!c.hidden)return void 0===c.height&&void 0!==a?Math.min(c.maxHeight,a)*c.verticalScale:c.height?c.height*c.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function to(i){i=i.slice();let r=Object.create(null);for(let e=0;e<i.length;e++)r[i[e].id]=i[e];for(let a=0;a<i.length;a++)"ref"in i[a]&&(i[a]=function(i,r){let a={};for(let e in i)"ref"!==e&&(a[e]=i[e]);
8return e.bm.forEach(e=>{e in r&&(a[e]=r[e])}),a}(i[a],r[i[a].ref]));return i}let ts={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function tl(e,i,r){r.push({command:ts.addSource,args:[e,i[e]]})}function th(e,i,r){i.push({command:ts.removeSource,args:[e]}),r[e]=!0}function tu(i,r,a,n,o,s){let l;for(l in r=r||{},i=i||{})i.hasOwnProperty(l)&&(e.bn(i[l],r[l])||a.push({command:s,args:[n,l,r[l],o]}));for(l in r)r.hasOwnProperty(l)&&!i.hasOwnProperty(l)&&(e.bn(i[l],r[l])||a.push({command:s,args:[n,l,r[l],o]}))}function tc(e){return e.id}function td(e,i){return e[i.id]=i,e}class tp{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(i){if(1===this.points.length)return this.points[0];i=e.aw(i,0,1);let r=1,a=this._distances[r],n=i*this.paddedLength+this.padding;for(;a<n&&r<this._distances.length;)a=this._distances[++r];let o=r-1,s=this._distances[o],l=a-s,h=l>0?(n-s)/l:0;return this.points[o].mult(1-h).add(this.points[r].mult(h))}}class tf{constructor(e,i,r){let a=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(i/r);for(let e=0;e<this.xCellCount*this.yCellCount;e++)a.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,r,a,n){this._forEachCell(i,r,a,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}insertCircle(e,i,r,a){this._forEachCell(i-a,r-a,i+a,r+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(r),this.circles.push(a)}_insertBoxCell(e,i,r,a,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,i,r,a,n,o){this.circleCells[n].push(o)}_query(e,i,r,a,n,o){if(r<0||e>this.width||a<0||i>this.height)return!n&&[];let s=[];if(e<=0&&i<=0&&this.width<=r&&this.height<=a){if(n)return!0;for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let i=this.circles[3*e],r=this.circles[3*e+1],a=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}return o?s.filter(o):s}return this._forEachCell(e,i,r,a,this._queryCell,s,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?s.length>0:s}_queryCircle(e,i,r,a,n){let o=e-r,s=e+r,l=i-r,h=i+r;if(s<0||o>this.width||h<0||l>this.height)return!a&&[];let u=[];return this._forEachCell(o,l,s,h,this._queryCellCircle,u,{hitTest:a,circle:{x:e,y:i,radius:r},seenUids:{box:{},circle:{}}},n),a?u.length>0:u}query(e,i,r,a,n){return this._query(e,i,r,a,!1,n)}hitTest(e,i,r,a,n){return this._query(e,i,r,a,!0,n)}hitTestCircle(e,i,r,a){return this._queryCircle(e,i,r,!0,a)}_queryCell(e,i,r,a,n,o,s,l){let h=s.seenUids,u=this.boxCells[n];if(null!==u){let n=this.bboxes;for(let c of u)if(!h.box[c]){h.box[c]=!0;let u=4*c;if(e<=n[u+2]&&i<=n[u+3]&&r>=n[u+0]&&a>=n[u+1]&&(!l||l(this.boxKeys[c]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[c],x1:n[u],y1:n[u+1],x2:n[u+2],y2:n[u+3]})}}}let c=this.circleCells[n];if(null!==c){let n=this.circles;for(let u of c)if(!h.circle[u]){h.circle[u]=!0;let c=3*u;if(this._circleAndRectCollide(n[c],n[c+1],n[c+2],e,i,r,a)&&(!l||l(this.circleKeys[u]))){if(s.hitTest)return o.push(!0),!0;{let e=n[c],i=n[c+1],r=n[c+2];o.push({key:this.circleKeys[u],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}}}}_queryCellCircle(e,i,r,a,n,o,s,l){let h=s.circle,u=s.seenUids,c=this.boxCells[n];if(null!==c){let e=this.bboxes;for(let i of c)if(!u.box[i]){u.box[i]=!0;let r=4*i;
8if(this._circleAndRectCollide(h.x,h.y,h.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!l||l(this.boxKeys[i])))return o.push(!0),!0}}let d=this.circleCells[n];if(null!==d){let e=this.circles;for(let i of d)if(!u.circle[i]){u.circle[i]=!0;let r=3*i;if(this._circlesCollide(e[r],e[r+1],e[r+2],h.x,h.y,h.radius)&&(!l||l(this.circleKeys[i])))return o.push(!0),!0}}}_forEachCell(e,i,r,a,n,o,s,l){let h=this._convertToXCellCoord(e),u=this._convertToYCellCoord(i),c=this._convertToXCellCoord(r),d=this._convertToYCellCoord(a);for(let p=h;p<=c;p++)for(let h=u;h<=d;h++)if(n.call(this,e,i,r,a,this.xCellCount*h+p,o,s,l))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,r,a,n,o){let s=a-e,l=n-i,h=r+o;return h*h>s*s+l*l}_circleAndRectCollide(e,i,r,a,n,o,s){let l=(o-a)/2,h=Math.abs(e-(a+l));if(h>l+r)return!1;let u=(s-n)/2,c=Math.abs(i-(n+u));if(c>u+r)return!1;if(h<=l||c<=u)return!0;let d=h-l,p=c-u;return d*d+p*p<=r*r}}let tm={unknown:0,flipRequired:1,flipNotRequired:2},t_=Math.tan(85*Math.PI/180);function tg(i,r,a,n,o,s,l){let h=e.ab.mat4.create();if(a){if("globe"===s.name){let i=e.bo(o,r);e.ab.mat4.multiply(h,h,i)}else{let i=e.ab.mat2.invert([],l);h[0]=i[0],h[1]=i[1],h[4]=i[2],h[5]=i[3],n||e.ab.mat4.rotateZ(h,h,o.angle)}}else e.ab.mat4.multiply(h,o.labelPlaneMatrix,i);return h}function ty(e,i,r,a,n,o,s){let l=tg(e,i,r,a,n,o,s);return"globe"===o.name&&r||(l[2]=l[6]=l[10]=l[14]=0),l}function tx(i,r,a,n,o,s,l){if(a){if("globe"===s.name){let h=tg(i,r,a,n,o,s,l);return e.ab.mat4.invert(h,h),e.ab.mat4.multiply(h,i,h),h}{let r=e.ab.mat4.clone(i),a=e.ab.mat4.identity([]);return a[0]=l[0],a[1]=l[1],a[4]=l[2],a[5]=l[3],e.ab.mat4.multiply(r,r,a),n||e.ab.mat4.rotateZ(r,r,-o.angle),r}}return o.glCoordMatrix}function tv(i,r,a,n){let o=[i,r,a,1];a?e.ab.vec4.transformMat4(o,o,n):tP(o,o,n);let s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function tb(e,i){return Math.min(.5+e/i*.5,1.5)}function tw(i,r,a,n,o,s,l,h,u,c){let d=a.transform,p=n?i.textSizeData:i.iconSizeData,f=e.bp(p,a.transform.zoom),m="globe"===d.projection.name,_=[256/a.width*2+1,256/a.height*2+1],g=n?i.text.dynamicLayoutVertexArray:i.icon.dynamicLayoutVertexArray;g.clear();let y=null;m&&(y=n?i.text.globeExtVertexArray:i.icon.globeExtVertexArray);let x=i.lineVertexArray,v=n?i.text.placedSymbolArray:i.icon.placedSymbolArray,b=a.transform.width/a.transform.height,w,T=!1;for(let n=0;n<v.length;n++){let m=v.get(n),{numGlyphs:S,writingMode:M}=m;if(M!==e.bq.vertical||T||w===e.bq.horizontal||(T=!0),w=M,(m.hidden||M===e.bq.vertical)&&!T){tC(S,g);continue}T=!1;let E=new e.P(m.tileAnchorX,m.tileAnchorY),{x:A,y:I,z:C}=d.projection.projectTilePoint(E.x,E.y,c.canonical);if(u){let[e,i,r]=u(E);A+=e,I+=i,C+=r}let P=[A,I,C,1];if(e.ab.vec4.transformMat4(P,P,r),!function(e,i){let r=e[0]/e[3],a=e[1]/e[3];return r>=-i[0]&&r<=i[0]&&a>=-i[1]&&a<=i[1]}(P,_)){tC(S,g);continue}let z=P[3],D=tb(a.transform.getCameraToCenterDistance(d.projection),z),R=e.br(p,f,m),L=l?R/D:R*D,O=tv(A,I,C,o);if(O[3]<=0){tC(S,g);continue}let k={},F=l?null:u,B=tM(m,L,!1,h,r,o,s,i.glyphOffsetArray,x,g,y,O,E,k,b,F,d.projection,c,l);T=B.useVertical,F&&B.needsFlipping&&(k={}),(B.notEnoughRoom||T||B.needsFlipping&&tM(m,L,!0,h,r,o,s,i.glyphOffsetArray,x,g,y,O,E,k,b,F,d.projection,c,l).notEnoughRoom)&&tC(S,g)}n?(i.text.dynamicLayoutVertexBuffer.updateData(g),y&&i.text.globeExtVertexBuffer&&i.text.globeExtVertexBuffer.updateData(y)):(i.icon.dynamicLayoutVertexBuffer.updateData(g),y&&i.icon.globeExtVertexBuffer&&i.icon.globeExtVertexBuffer.updateData(y))}function tT(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let{lineStartIndex:g,glyphStartIndex:y,segment:x}=l,v=y+l.numGlyphs,b=g+l.lineLength,w=i.getoffsetX(y),T=i.getoffsetX(v-1),S=tI(e*w,r,a,n,o,s,x,g,b,h,u,c,d,p,!0,f,m,_);if(!S)return null;let M=tI(e*T,r,a,n,o,s,x,g,b,h,u,c,d,p,!0,f,m,_);return M?{first:S,last:M}:null}function tS(i,r,a,n){return i===e.bq.horizontal&&Math.abs(n)>Math.abs(a)?{useVertical:!0}:i===e.bq.vertical?n>0?{needsFlipping:!0}:null:r!==tm.unknown&&(0===a||Math.abs(n/a)>t_)?r===tm.flipRequired?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function tM(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=r/24,w=i.lineOffsetX*b,T=i.lineOffsetY*b,{lineStartIndex:S,glyphStartIndex:M,numGlyphs:E,segment:A,writingMode:I,flipState:C}=i,P=S+i.lineLength,z=i=>{if(d){let[r,a,n]=i.up,o=c.length;e.bs(d,o+0,r,a,n),e.bs(d,o+1,r,a,n),e.bs(d,o+2,r,a,n),e.bs(d,o+3,r,a,n)}let[r,a,n]=i.point;e.bt(c,r,a,n,i.angle)};if(E>1){let e=tT(b,h,w,T,a,p,f,i,u,s,m,g,!1,y,x,v);if(!e)return{notEnoughRoom:!0};if(n&&!a){let[r,a,n]=e.first.point,[o,s,h]=e.last.point;[r,a]=tv(r,a,n,l),[o,s]=tv(o,s,h,l);let u=tS(I,C,(o-r)*_,s-a);if(i.flipState=u&&u.needsFlipping?tm.flipRequired:tm.flipNotRequired,u)return u}z(e.first);for(let e=M+1;e<M+E-1;e++){let i=tI(b*h.getoffsetX(e),w,T,a,p,f,A,S,P,u,s,m,g,!1,!1,y,x,v);if(!i)return c.length-=4*(e-M),{notEnoughRoom:!0};z(i)}z(e.last)}else{if(n&&!a){let r=tv(f.x,f.y,0,o),a=S+A+1,n=new e.P(u.getx(a),u.gety(a)),s=tv(n.x,n.y,0,o),l=s[3]>0?s:tA(f,n,r,1,o,void 0,y,x.canonical),h=tS(I,C,(l[0]-r[0])*_,l[1]-r[1]);if(i.flipState=h&&h.needsFlipping?tm.flipRequired:tm.flipNotRequired,h)return h}let r=tI(b*h.getoffsetX(M),w,T,a,p,f,A,S,P,u,s,m,g,!1,!1,y,x,v);if(!r)return{notEnoughRoom:!0};z(r)}return{}}function tE(e,i,r,a,n){let{x:o,y:s,z:l}=a.projectTilePoint(e.x,e.y,i);if(!n)return tv(o,s,l,r);let[h,u,c]=n(e);return tv(o+h,s+u,l+c,r)}function tA(i,r,a,n,o,s,l,h){let u=tE(i.sub(r)._unit()._add(i),h,o,l,s);return e.ab.vec3.sub(u,a,u),e.ab.vec3.normalize(u,u),e.ab.vec3.scaleAndAdd(u,a,u,n)}function tI(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x){let v=n?i-r:i+r,b=v>0?1:-1,w=0;n&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let T=h+l+(b>0?0:1)|0,S=o,M=o,E=0,A=0,I=Math.abs(v),C=[],P=[],z=s,D=z,R=()=>tA(D,z,M,I-E+1,d,f,g,y.canonical);for(;E+A<=I;){if((T+=b)<h||T>=u)return null;if(M=S,D=z,C.push(M),m&&P.push(D),z=new e.P(c.getx(T),c.gety(T)),!(S=p[T])){let e=tE(z,y.canonical,d,g,f);S=e[3]>0?p[T]=e:R()}E+=A,A=e.ab.vec3.distance(M,S)}_&&f&&(p[T]&&(S=R(),A=e.ab.vec3.distance(M,S)),p[T]=S);let L=(I-E)/A,O=z.sub(D)._mult(L)._add(D),k=e.ab.vec3.sub([],S,M),F=e.ab.vec3.scaleAndAdd([],M,k,L),B=[0,0,1],N=k[0],V=k[1];if(x&&(0!==(B=g.upVector(y.canonical,O.x,O.y))[0]||0!==B[1]||1!==B[2])){let i=[B[2],0,-B[0]],r=e.ab.vec3.cross([],B,i);e.ab.vec3.normalize(i,i),e.ab.vec3.normalize(r,r),N=e.ab.vec3.dot(k,i),V=e.ab.vec3.dot(k,r)}if(a){let i=e.ab.vec3.cross([],B,k);e.ab.vec3.normalize(i,i),e.ab.vec3.scaleAndAdd(F,F,i,a*b)}let U=w+Math.atan2(V,N);return C.push(F),m&&P.push(O),{point:F,angle:U,path:C,tilePath:P,up:B}}function tC(e,i){let r=i.length,a=r+4*e;i.resize(a),i.float32.fill(-1/0,4*r,4*a)}function tP(e,i,r){let a=i[0],n=i[1];return e[0]=r[0]*a+r[4]*n+r[12],e[1]=r[1]*a+r[5]*n+r[13],e[3]=r[3]*a+r[7]*n+r[15],e}class tz{constructor(e,i,r=new tf(e.width+200,e.height+200,25),a=new tf(e.width+200,e.height+200,25)){this.transform=e,this.grid=r,this.ignoredGrid=a,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.he
8ight+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=i}placeCollisionBox(e,i,r,a,n,o,s,l){let h=r.projectedAnchorX,u=r.projectedAnchorY,c=r.projectedAnchorZ,d=r.elevation,p=r.tileID,f=e.getProjection();if(d&&p){let[e,i,a]=f.upVector(p.canonical,r.tileAnchorX,r.tileAnchorY),n=f.upVectorScale(p.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;h+=e*d*n,u+=i*d*n,c+=a*d*n}let m=this.projectAndGetPerspectiveRatio(s,h,u,c,r.tileID,"globe"===f.name||!!d||this.transform.pitch>0,f),_=o*m.perspectiveRatio,g=(r.x1*i+a.x-r.padding)*_+m.point.x,y=(r.y1*i+a.y-r.padding)*_+m.point.y,x=(r.x2*i+a.x+r.padding)*_+m.point.x,v=(r.y2*i+a.y+r.padding)*_+m.point.y,b=m.perspectiveRatio<=.55||m.occluded;return!this.isInsideGrid(g,y,x,v)||!n&&this.grid.hitTest(g,y,x,v,l)||b?{box:[],offscreen:!1,occluded:m.occluded}:{box:[g,y,x,v],offscreen:this.isOffscreen(g,y,x,v),occluded:!1}}placeCollisionCircles(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=[],y=this.transform.elevation,x=i.getProjection(),v=y?y.getAtTileOffsetFunc(_,this.transform.center.lat,this.transform.worldSize,x):null,b=new e.P(a.tileAnchorX,a.tileAnchorY),{x:w,y:T,z:S}=x.projectTilePoint(b.x,b.y,_.canonical);if(v){let[e,i,r]=v(b);w+=e,T+=i,S+=r}let M="globe"===x.name,E=this.projectAndGetPerspectiveRatio(l,w,T,S,_,M||!!y||this.transform.pitch>0,x),{perspectiveRatio:A}=E,I=(d?s/A:s*A)/e.bw,C=tv(w,T,S,h),P=E.signedDistanceFromCamera>0?tT(I,o,a.lineOffsetX*I,a.lineOffsetY*I,!1,C,b,a,n,h,{},y&&!d?v:null,d&&!!y,x,_,d):null,z=!1,D=!1,R=!0;if(P&&!E.occluded){let i=.5*f*A+m,a=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new tp,{first:s,last:l}=P,h=s.path.length,d=[];for(let e=h-1;e>=1;e--)d.push(s.path[e]);for(let e=1;e<l.path.length;e++)d.push(l.path[e]);let _=2.5*i;u&&(d=d.map(([e,i,r],a)=>(v&&!M&&(r=v(a<h-1?s.tilePath[h-1-a]:l.tilePath[a-h+2])[2]),tv(e,i,r,u)))).some(e=>e[3]<=0)&&(d=[]);let y=[];if(d.length>0){let i=1/0,r=-1/0,o=1/0,s=-1/0;for(let e of d)i=Math.min(i,e[0]),o=Math.min(o,e[1]),r=Math.max(r,e[0]),s=Math.max(s,e[1]);r>=a.x&&i<=n.x&&s>=a.y&&o<=n.y&&(y=[d.map(i=>new e.P(i[0],i[1]))],(i<a.x||r>n.x||o<a.y||s>n.y)&&(y=e.bu(y,a.x,a.y,n.x,n.y)))}for(let e of y){o.reset(e,.25*i);let a=0;a=o.length<=.5*i?1:Math.ceil(o.paddedLength/_)+1;for(let e=0;e<a;e++){let n=e/Math.max(a-1,1),s=o.lerp(n),l=s.x+100,h=s.y+100;g.push(l,h,i,0);let u=l-i,d=h-i,f=l+i,m=h+i;if(R=R&&this.isOffscreen(u,d,f,m),D=D||this.isInsideGrid(u,d,f,m),!r&&this.grid.hitTestCircle(l,h,i,p)&&(z=!0,!c))return{circles:[],offscreen:!1,collisionDetected:z,occluded:!1}}}}return{circles:(c||!z)&&D?g:[],offscreen:R,collisionDetected:z,occluded:E.occluded}}queryRenderedSymbols(i){if(0===i.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let r=[],a=1/0,n=1/0,o=-1/0,s=-1/0;for(let l of i){let i=new e.P(l.x+100,l.y+100);a=Math.min(a,i.x),n=Math.min(n,i.y),o=Math.max(o,i.x),s=Math.max(s,i.y),r.push(i)}let l=this.grid.query(a,n,o,s).concat(this.ignoredGrid.query(a,n,o,s)),h={},u={};for(let i of l){let a=i.key;if(void 0===h[a.bucketInstanceId]&&(h[a.bucketInstanceId]={}),h[a.bucketInstanceId][a.featureIndex])continue;let n=[new e.P(i.x1,i.y1),new e.P(i.x2,i.y1),new e.P(i.x2,i.y2),new e.P(i.x1,i.y2)];e.bv(r,n)&&(h[a.bucketInstanceId][a.featureIndex]=!0,void 0===u[a.bucketInstanceId]&&(u[a.bucketInstanceId]=[]),u[a.bucketInstanceId].push(a.featureIndex))}return u}insertCollisionBox(e,i,r,a,n){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:a,collisionGroupID:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,r,a,n){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:a,collisionGroupID:n};for(let i=0;i<e.length;i+=4)o.insertCircle(s,e[i],e[i+1],e[i+2])}projectAndGetPerspectiveRatio(i,r,a,n,o,s,l){let h=[r,a,n,1],u=!1;n||this.transform.pitch>0?(e.ab.vec4.transformMat4(h,h,i),this.fogState&&o&&"globe"!==l.name&&(u=function(i,r,a,n,o,s){let l=s.calculateFogTileMatrix(o),h=[r,a,n];return e.ab.vec3.transformMat4(h,h,l),ez(i,e.ab.vec3.length(h),s.pitch,s._fov)}(this.fogState,r,a,n,o.toUnwrapped(),this.transform)>.9)):tP(h,h,i);let c=h[3];return{point:new e.P((h[0]/c+1)/2*this.transform.width+100,(-h[1]/c+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(l)/c*.5,1.5),signedDistanceFromCamera:c,occluded:s&&h[2]>c||u}}isOffscreen(e,i,r,a){return r<100||e>=this.screenRightBoundary||a<100||i>this.screenBottomBoundary}isInsideGrid(e,i,r,a){return r>=0&&e<this.gridRightBoundary&&a>=0&&i<this.gridBottomBoundary}getViewportMatrix(){let i=e.ab.mat4.identity([]);return e.ab.mat4.translate(i,i,[-100,-100,0]),i}}function tD(i,r,a){let n=r.createTileMatrix(i,i.worldSize,a.toUnwrapped());return e.ab.mat4.multiply(new Float32Array(16),i.projMatrix,n)}function tR(e,i,r){return i.name===r.projection.name?e.projMatrix:tD(r,i,e)}class tL{constructor(e,i,r,a){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):a&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class tO{constructor(e,i,r,a,n,o=!1){this.text=new tL(e?e.text:null,i,r,n),this.icon=new tL(e?e.icon:null,i,a,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class tk{constructor(e,i,r,a=!1){this.text=e,this.icon=i,this.skipFade=r,this.clipped=a}}class tF{constructor(){this.invProjMatrix=e.ab.mat4.create(),this.viewportMatrix=e.ab.mat4.create(),this.circles=[]}}class tB{constructor(e,i,r,a,n){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=n}}class tN{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:e=>e.collisionGroupID===i}}return this.collisionGroups[e]}}function tV(i,r,a,n,o){let{horizontalAlign:s,verticalAlign:l}=e.bD(i),h=e.bC(i,n);return new e.P(-(s-.5)*r+h[0]*o,-(l-.5)*a+h[1]*o)}function tU(i,r,a,n,o){let s=new e.P(i,r);return a&&s._rotate(n?o:-o),s}class tj{constructor(e,i,r,a,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new tz(this.transform,n),this.buildingIndex=o,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new tN(r),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,r,a,n,o=1){var s,l,h;let u=a.getBucket(r),c=a.latestFeatureIndex;if(!u||!c||r.fqid!==u.layerIds[0])return;let d=u.layers[0].layout,p=u.layers[0].paint,f=a.collisionBoxArray,m=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ
8),_=a.tileSize/e.ag,g=a.tileID.toUnwrapped();this.transform.setProjection(u.projection);let y=(s=a.tileID,l=u.getProjection(),h=this.transform,l.name===this.projection?h.calculateProjMatrix(s.toUnwrapped()):tD(h,l,s)),x="map"===d.get("text-pitch-alignment"),v="map"===d.get("text-rotation-alignment");r.compileFilter(r.options);let b=r.dynamicFilter(),w=r.dynamicFilterNeedsFeature(),T=this.transform.calculatePixelsToTileUnitsMatrix(a),S=ty(y,a.tileID.canonical,x,v,this.transform,u.getProjection(),T),M=null;if(x){let i=tx(y,a.tileID.canonical,x,v,this.transform,u.getProjection(),T);M=e.ab.mat4.multiply([],this.transform.labelPlaneMatrix,i)}let E=null;b&&a.latestFeatureIndex&&(E={unwrappedTileID:g,dynamicFilter:b,dynamicFilterNeedsFeature:w}),this.retainedQueryData[u.bucketInstanceId]=new tB(u.bucketInstanceId,c,u.sourceLayerIndex,u.index,a.tileID);let[A,I]=u.layers[0].layout.get("text-size-scale-range"),C=e.aw(o,A,I),[P,z]=d.get("icon-size-scale-range"),D=e.aw(o,P,z),R={bucket:u,layout:d,paint:p,posMatrix:y,textLabelPlaneMatrix:S,labelToScreenMatrix:M,clippingData:E,scale:m,textPixelRatio:_,holdingForFade:a.holdingForFade(),collisionBoxArray:f,partiallyEvaluatedTextSize:e.bp(u.textSizeData,this.transform.zoom,C),partiallyEvaluatedIconSize:e.bp(u.iconSizeData,this.transform.zoom,D),collisionGroup:this.collisionGroups.get(u.sourceID),latestFeatureIndex:a.latestFeatureIndex};if(n)for(let e of u.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n}=e;i.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n,parameters:R})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:R})}attemptAnchorPlacement(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let{textOffset0:x,textOffset1:v,crossTileID:b}=d,w=[x,v],T=tV(e,r,a,w,n),S=this.collisionIndex.placeCollisionBox(f,n,i,tU(T.x,T.y,o,s,this.transform.angle),c,l,h,u.predicate);if(_){let e=f.getSymbolInstanceIconSize(y,this.transform.zoom,d.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(f,e,_,tU(T.x,T.y,o,s,this.transform.angle),c,l,h,u.predicate).box.length)return}if(S.box.length>0){let i;return this.prevPlacement&&this.prevPlacement.variableOffsets[b]&&this.prevPlacement.placements[b]&&this.prevPlacement.placements[b].text&&(i=this.prevPlacement.variableOffsets[b].anchor),this.variableOffsets[b]={textOffset:w,width:r,height:a,anchor:e,textScale:n,prevAnchor:i},this.markUsedJustification(f,e,d,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,d),this.placedOrientations[b]=m),{shift:T,placedGlyphBoxes:S}}}placeLayerBucketPart(i,r,a,n,o=1){let{bucket:s,layout:l,paint:h,posMatrix:u,textLabelPlaneMatrix:c,labelToScreenMatrix:d,clippingData:p,textPixelRatio:f,holdingForFade:m,collisionBoxArray:_,partiallyEvaluatedTextSize:g,partiallyEvaluatedIconSize:y,collisionGroup:x,latestFeatureIndex:v}=i.parameters,b=l.get("text-optional"),w=l.get("icon-optional"),T=l.get("text-allow-overlap"),S=l.get("icon-allow-overlap"),M="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),A=l.get("symbol-z-elevate"),I=h.get("symbol-z-offset"),C="sea"===l.get("symbol-elevation-reference"),[P,z]=l.get("text-size-scale-range"),[D,R]=l.get("icon-size-scale-range"),L=e.aw(o,P,z),O=e.aw(o,D,R);this.transform.setProjection(s.projection);let k=T&&(S||!s.hasIconData()||w),F=S&&(T||!s.hasTextData()||b),B=!I.isConstant();!s.collisionArrays&&_&&s.deserializeCollisionBoxes(_),a&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,_,L,O);let N=(i,n,h)=>{let{crossTileID:_,numVerticalGlyphVertices:A}=i,P=null;if(p&&p.dynamicFilterNeedsFeature||B){let e=this.retainedQueryData[s.bucketInstanceId];P=v.loadFeature({featureIndex:i.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.s
8ourceLayerIndex,layoutVertexArrayOffset:0})}if(p&&!(0,p.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},P,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.P(i.tileAnchorX,i.tileAnchorY),this.transform.calculateDistanceTileData(p.unwrappedTileID)))return this.placements[_]=new tk(!1,!1,!1,!0),void r.add(_);let z=I.evaluate(P,{});if(r.has(_))return;if(m)return void(this.placements[_]=new tk(!1,!1,!1));let D=!1,R=!1,L=!0,O=!1,N=!1,V=null,U={box:null,offscreen:null,occluded:null},j={box:null,offscreen:null,occluded:null},G=null,q=null,Z=null,H=0,$=0,W=0;h.textFeatureIndex?H=h.textFeatureIndex:i.useRuntimeCollisionCircles&&(H=i.featureIndex),h.verticalTextFeatureIndex&&($=h.verticalTextFeatureIndex);let X=e=>{e.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;let r=this.transform.elevation;e.elevation=C?z:z+(r?r.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0),e.elevation+=i.zOffset},Y=h.textBox;if(Y){X(Y);let r=r=>{let a=e.bq.horizontal;if(s.allowVerticalPlacement&&!r&&this.prevPlacement){let e=this.prevPlacement.placedOrientations[_];e&&(this.placedOrientations[_]=e,a=e,this.markUsedOrientation(s,a,i))}return a},a=(i,r)=>{if(s.allowVerticalPlacement&&A>0&&h.verticalTextBox){for(let a of s.writingModes)if(a===e.bq.vertical?j=U=r():U=i(),U&&U.box&&U.box.length)break}else U=i()};if(l.get("text-variable-anchor")){let o=l.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[_]){let e=this.prevPlacement.variableOffsets[_];o.indexOf(e.anchor)>0&&(o=o.filter(i=>i!==e.anchor)).unshift(e.anchor)}let c=(e,r,a)=>{let l=s.getSymbolInstanceTextSize(g,i,this.transform.zoom,n),h=(e.x2-e.x1)*l+2*e.padding,c=(e.y2-e.y1)*l+2*e.padding,d=i.hasIconTextFit&&!S?r:null;d&&X(d);let p={box:[],offscreen:!1,occluded:!1},m=T?2*o.length:o.length;for(let r=0;r<m;++r){let m=this.attemptAnchorPlacement(o[r%o.length],e,h,c,l,M,E,f,u,x,r>=o.length,i,n,s,a,d,g,y);if(m&&(p=m.placedGlyphBoxes)&&p.box&&p.box.length){D=!0,V=m.shift;break}}return p};a(()=>c(Y,h.iconBox,e.bq.horizontal),()=>{let i=h.verticalTextBox;return i&&X(i),s.allowVerticalPlacement&&!(U&&U.box&&U.box.length)&&A>0&&i?c(i,h.verticalIconBox,e.bq.vertical):{box:null,offscreen:null,occluded:null}}),U&&(D=U.box,L=U.offscreen,O=U.occluded);let d=r(!(!U||!U.box));if(!D&&this.prevPlacement){let e=this.prevPlacement.variableOffsets[_];e&&(this.variableOffsets[_]=e,this.markUsedJustification(s,e.anchor,i,d))}}else{let l=(r,a)=>{let l=s.getSymbolInstanceTextSize(g,i,this.transform.zoom,n,o),h=this.collisionIndex.placeCollisionBox(s,l,r,new e.P(0,0),T,f,u,x.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(s,a,i),this.placedOrientations[_]=a),h};a(()=>l(Y,e.bq.horizontal),()=>{let i=h.verticalTextBox;return s.allowVerticalPlacement&&A>0&&i?(X(i),l(i,e.bq.vertical)):{box:null,offscreen:null,occluded:null}}),r(!!(U&&U.box&&U.box.length))}}if(D=(G=U)&&G.box&&G.box.length>0,L=G&&G.offscreen,O=G&&G.occluded,i.useRuntimeCollisionCircles){let r=s.text.placedSymbolArray.get(i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex),n=e.br(s.textSizeData,g,r),o=l.get("text-padding");q=this.collisionIndex.placeCollisionCircles(s,T,r,s.lineVertexArray,s.glyphOffsetArray,n,u,c,d,a,E,x.predicate,i.collisionCircleDiameter*n/e.bw,o,this.retainedQueryData[s.bucketInstanceId].tileID),D=T||q.circles.length>0&&!q.collisionDetected,L=L&&q.offscreen,O=q.occluded}if(h.iconFeatureIndex&&(W=h.iconFeatureIndex),h.iconBox){let r=r=>{X(r);let a=i.hasIconTextFit&&V?tU(V.x,V.y,M,E,this.transform.angle):new e.P(0,0),n=s.getSymbolInstanceIconSize(y,this.transform.zoom,i.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,n,r,a,S,f,u,x.predicate)};R=j&&j.box&&j.box.length&&h.verticalIconBox?(Z=r(h.verticalIconBox)).box.length>0:(Z=r(h.iconBox)).box.length>0,L=L&&Z.offscreen,N=Z.occluded}let K=b||0===i.numHorizontalGlyphVertices&&0===A,J=w||0===i.numIconVertices;if(K||J?J?K||(R=R&&D):D=R&&D:R=D=R&&D,D&&G&&G.box&&this.collisionIndex.insertCollisionBox(G.box,l.get("text-ignore-placement"),s.bucketInstanceId,j&&j.box&&$?$:H,x.ID),R&&Z&&this.collisionIndex.insertCollisionBox(Z.box,l.get("icon-ignore-placement"),s.bucketInstanceId,W,x.ID),q&&(D&&this.collisionIndex.insertCollisionCircles(q.circles,l.get("text-ignore-placement"),s.bucketInstanceId,H,x.ID),a)){let e=s.bucketInstanceId,i=this.collisionCircleArrays[e];void 0===i&&(i=this.collisionCircleArrays[e]=new tF);for(let e=0;e<q.circles.length;e+=4)i.circles.push(q.circles[e+0]),i.circles.push(q.circles[e+1]),i.circles.push(q.circles[e+2]),i.circles.push(q.collisionDetected?1:0)}let Q="globe"!==s.projection.name;
8k=k&&(Q||!O),F=F&&(Q||!N),this.placements[_]=new tk(D||k,R||F,L||s.justReloaded),r.add(_)};if(A&&this.buildingIndex&&(this.buildingIndex.updateZOffset(s,this.retainedQueryData[s.bucketInstanceId].tileID),s.updateZOffset()),s.sortFeaturesByY){let i=s.getSortedSymbolIndexes(this.transform.angle);for(let e=i.length-1;e>=0;--e){let r=i[e];N(s.symbolInstances.get(r),r,s.collisionArrays[r])}s.hasAnyZOffset&&e.w(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(s.hasAnyZOffset){let e=s.getSortedIndexesByZOffset();for(let i=0;i<e.length;++i){let r=e[i];N(s.symbolInstances.get(r),r,s.collisionArrays[r])}}else for(let e=i.symbolInstanceStart;e<i.symbolInstanceEnd;e++)N(s.symbolInstances.get(e),e,s.collisionArrays[e]);if(a&&s.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[s.bucketInstanceId];e.ab.mat4.invert(i.invProjMatrix,u),i.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}markUsedJustification(i,r,a,n){let{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:h,crossTileID:u}=a,c=e.bB(r),d=n===e.bq.vertical?h:"left"===c?o:"center"===c?s:"right"===c?l:-1;o>=0&&(i.text.placedSymbolArray.get(o).crossTileID=d>=0&&o!==d?0:u),s>=0&&(i.text.placedSymbolArray.get(s).crossTileID=d>=0&&s!==d?0:u),l>=0&&(i.text.placedSymbolArray.get(l).crossTileID=d>=0&&l!==d?0:u),h>=0&&(i.text.placedSymbolArray.get(h).crossTileID=d>=0&&h!==d?0:u)}markUsedOrientation(i,r,a){let n=r===e.bq.horizontal||r===e.bq.horizontalOnly?r:0,o=r===e.bq.vertical?r:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u}=a,c=i.text.placedSymbolArray;s>=0&&(c.get(s).placedOrientation=n),l>=0&&(c.get(l).placedOrientation=n),h>=0&&(c.get(h).placedOrientation=n),u>=0&&(c.get(u).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let i=this.prevPlacement,r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;let a=i?i.symbolFadeChange(e):1,n=i?i.opacities:{},o=i?i.variableOffsets:{},s=i?i.placedOrientations:{};for(let e in this.placements){let i=this.placements[e],o=n[e];o?(this.opacities[e]=new tO(o,a,i.text,i.icon,null,i.clipped),r=r||i.text!==o.text.placed||i.icon!==o.icon.placed):(this.opacities[e]=new tO(null,a,i.text,i.icon,i.skipFade,i.clipped),r=r||i.text||i.icon)}for(let e in n){let i=n[e];if(!this.opacities[e]){let n=new tO(i,a,!1,!1);n.isHidden()||(this.opacities[e]=n,r=r||i.text.placed||i.icon.placed)}}for(let e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(let e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i,r,a){let n=new Set;for(let o of i){let i=o.getBucket(e);i&&o.latestFeatureIndex&&e.fqid===i.layerIds[0]&&(this.updateBucketOpacities(i,n,o,o.collisionBoxArray,r,a,o.tileID,e.scope),i.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(i,o.tileID),i.updateZOffset()))}}updateBucketOpacities(i,r,a,n,o,s,l,h){i.hasTextData()&&i.text.opacityVertexArray.clear(),i.hasIconData()&&i.icon.opacityVertexArray.clear(),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();let u=i.layers[0].layout,c=i.layers[0].paint,d=!!i.layers[0].dynamicFilter(),p=new tO(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),m=u.get("icon-allow-overlap"),_=u.get("text-variable-anchor"),g="map"===u.get("text-rotation-alignment"),y="map"===u.get("text-pitch-alignment"),x=c.get("symbol-z-offset"),v="sea"===u.get("symbol-elevation-reference"),b=!x.isConstant(),w=new tO(null,0,f&&(m||!i.hasIconData()||u.get("icon-optional")),m&&(f||!i.hasTextData()||u.get("text-optional")),!0);!i.collisionArrays&&n&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(n);let T=(e,i,r)=>{for(let a=0;a<i/4;a++)e.opacityVertexArray.emplaceBack(r)},S=0;s&&i.updateReplacement(l,s);for(let n=0;n<i.symbolInstances.length;n++){let u=i.symbolInstances.get(n),{numHorizontalGlyphVertices:c,numVerticalGlyphVertices:f,crossTileID:m,numIconVertices:M,tileAnchorX:E,tileAnchorY:A}=u,I=null,C=this.retainedQueryData[i.bucketInstanceId];b&&u&&C&&(I=a.latestFeatureIndex.loadFeature({featureIndex:u.featureIndex,bucketIndex:C.bucketIndex,sourceLayerIndex:C.sourceLayerIndex,layoutVertexArrayOffset:0}));let P=x.evaluate(I,{}),z=r.has(m),D=this.opacities[m];z?D=p:D||(D=w,this.opacities[m]=D),r.add(m);let R=c>0||f>0,L=M>0,O=this.placedOrientations[m],k=O===e.bq.vertical,F=O===e.bq.horizontal||O===e.bq.horizontalOnly;!R&&!L||D.isHidden()||S++;let B=!1;if((R||L)&&s)for(let r of i.activeReplacements){if(e.bx(r,o,e.by.Symbol,h)||r.min.x>E||E>r.max.x||r.min.y>A||A>r.max.y)continue;let i=e.bz(E,A,l.canonical,r.footprintTileId.canonical);if(B=e.bA(i,r.footprint))break}if(R){let e=B?tZ:tq(D.text);T(i.text,c,k?tZ:e),T(i.text,f,F?tZ:e);let r=D.text.isHidden(),{leftJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:n,rightJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s}=u,l=i.text.placedSymbolArray,h=r||k?1:0;a>=0&&(l.get(a).hidden=h),n>=0&&(l.get(n).hidden=h),o>=0&&(l.get(o).hidden=h),s>=0&&(l.get(s).hidden=r||F?1:0);let d=this.variableOffsets[m];d&&this.markUsedJustification(i,d.anchor,u,O);let p=this.placedOrientations[m];p&&(this.markUsedJustification(i,"left",u,p),this.markUsedOrientation(i,p,u))}if(L){let e=B?tZ:tq(D.icon),{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=u,n=i.icon.placedSymbolArray,o=D.icon.isHidden()?1:0;r>=0&&(T(i.icon,M,k?tZ:e),n.get(r).hidden=o),a>=0&&(T(i.icon,u.numVerticalIconVertices,F?tZ:e),n.get(a).hidden=o)}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){let r=i.collisionArrays[n];if(r){let a=new e.P(0,0),n=!0;if(r.textBox||r.verticalTextBox){if(_){let e=this.variableOffsets[m];e?(a=tV(e.anchor,e.width,e.height,e.textOffset,e.textScale),g&&a._rotate(y?this.transform.angle:-this.transform.angle)):n=!1}d&&(n=!D.clipped),r.textBox&&tG(i.textCollisionBox.collisionVertexArray,D.text.placed,!n||k,P,v,a.x,a.y),r.verticalTextBox&&tG(i.textCollisionBox.collisionVertexArray,D.text.placed,!n||F,P,v,a.x,a.y)}let o=n&&!!(!F&&r.verticalIconBox);r.iconBox&&tG(i.iconCollisionBox.collisionVertexArray,D.icon.placed,o,P,v,u.hasIconTextFit?a.x:0,u.hasIconTextFit?a.y:0),r.verticalIconBox&&tG(i.iconCollisionBox.collisionVertexArray,D.icon.placed,!o,P,v,u.hasIconTextFit?a.x:0,u.hasIconTextFit?a.y:0)}}}if(i.fullyClipped=0===S,i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.o
8pacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=e.invProjMatrix,i.placementViewportMatrix=e.viewportMatrix,i.collisionCircleArray=e.circles,delete this.collisionCircleArrays[i.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){let r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}}function tG(e,i,r,a,n,o,s){e.emplaceBack(i?1:0,r?1:0,o||0,s||0,a,n?1:0),e.emplaceBack(i?1:0,r?1:0,o||0,s||0,a,n?1:0),e.emplaceBack(i?1:0,r?1:0,o||0,s||0,a,n?1:0),e.emplaceBack(i?1:0,r?1:0,o||0,s||0,a,n?1:0)}function tq(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let i=e.placed?1:0,r=Math.floor(127*e.opacity);return 33554432*r+16777216*i+131072*r+65536*i+512*r+256*i+2*r+i}let tZ=0;class tH{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,i,r,a,n,o){let s=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(s,a,e[this._currentTileIndex],this._sortAcrossTiles,o),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((e,i)=>e.sortKey-i.sortKey));this._currentPartIndex<s.length;){let e=s[this._currentPartIndex];if(i.placeLayerBucketPart(e,this._seenCrossTileIDs,r,0===e.symbolInstanceStart,o),this._currentPartIndex++,n())return!0}return!1}}class t${constructor(e,i,r,a,n,o,s,l,h){this.placement=new tj(e,n,o,s,l,h),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(i,r,a,n,o){let s=e.q.now(),l=()=>{let i=e.q.now()-s;return!this._forceFullPlacement&&i>2};for(;this._currentPlacementIndex>=0;){let s=r[i[this._currentPlacementIndex]],h=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=h)&&(!s.maxzoom||s.maxzoom>h)){let i=s.layout.get("symbol-z-elevate"),r=void 0!==s.layout.get("symbol-sort-key").constantOr(1),h=s.layout.get("symbol-z-order"),u="viewport-y"===h||"auto"===h&&!("viewport-y"!==h&&r),c=s.layout.get("text-allow-overlap")||s.layout.get("icon-allow-overlap")||s.layout.get("text-ignore-placement")||s.layout.get("icon-ignore-placement"),d=u&&c,p=this._inProgressLayer=this._inProgressLayer||new tH(s),f=e.aC(s.source,s.scope);if(p.continuePlacement(i||d?n[f]:a[f],this.placement,this._showCollisionBoxes,s,l,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let tW=512/e.ag/2;class tX{constructor(i,r,a){this.tileID=i,this.bucketInstanceId=a,this.index=new e.bE(r.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];let n=i.canonical.x*e.ag,o=i.canonical.y*e.ag;for(let e=0;e<r.length;e++){let{key:i,crossTileID:a,tileAnchorX:s,tileAnchorY:l}=r.get(e),h=Math.floor((n+s)*tW),u=Math.floor((o+l)*tW);this.index.add(h,u),this.keys.push(i),this.crossTileIDs.push(a)}this.index.finish()}findMatches(i,r,a){let n=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z),o=tW/Math.pow(2,r.canonical.z-this.tileID.canonical.z),s=r.canonical.x*e.ag,l=r.canonical.y*e.ag;
8for(let e=0;e<i.length;e++){let r=i.get(e);if(r.crossTileID)continue;let{key:h,tileAnchorX:u,tileAnchorY:c}=r,d=Math.floor((s+u)*o),p=Math.floor((l+c)*o);for(let e of this.index.range(d-n,p-n,d+n,p+n)){let i=this.crossTileIDs[e];if(this.keys[e]===h&&!a.has(i)){a.add(i),r.crossTileID=i;break}}}}}class tY{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class tK{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let i=Math.round((e-this.lng)/360);if(0!==i)for(let e in this.indexes){let r=this.indexes[e],a={};for(let e in r){let n=r[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+i),a[n.tileID.key]=n}this.indexes[e]=a}this.lng=e}addBucket(e,i,r){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<i.symbolInstances.length;e++)i.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);let a=this.usedCrossTileIDs[e.overscaledZ];for(let r in this.indexes){let n=this.indexes[r];if(Number(r)>e.overscaledZ)for(let r in n){let o=n[r];o.tileID.isChildOf(e)&&o.findMatches(i.symbolInstances,e,a)}else{let o=n[e.scaledTo(Number(r)).key];o&&o.findMatches(i.symbolInstances,e,a)}}for(let e=0;e<i.symbolInstances.length;e++){let n=i.symbolInstances.get(e);n.crossTileID||(n.crossTileID=r.generate(),a.add(n.crossTileID))}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new tX(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(let r of i.crossTileIDs)this.usedCrossTileIDs[e].delete(r)}removeStaleBuckets(e){let i=!1;for(let r in this.indexes){let a=this.indexes[r];for(let n in a)e[a[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,a[n]),delete a[n],i=!0)}return i}}class tJ{constructor(){this.layerIndexes={},this.crossTileIDs=new tY,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,r,a){let n=this.layerIndexes[e.fqid];void 0===n&&(n=this.layerIndexes[e.fqid]=new tK);let o=!1,s={};for(let l of("globe"!==a.name&&n.handleWrapJump(r),i)){let i=l.getBucket(e);i&&e.fqid===i.layerIds[0]&&(i.bucketInstanceId||(i.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(l.tileID,i,this.crossTileIDs)&&(o=!0),s[i.bucketInstanceId]=!0)}return n.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(e){let i={};for(let r in e.forEach(e=>{i[e]=!0}),this.layerIndexes)i[r]||delete this.layerIndexes[r]}}class tQ{constructor(e,i,r,a){this.blendFunction=e,this.blendColor=i,this.mask=r,this.blendEquation=a}}tQ.Replace=[1,0,1,0],tQ.disabled=new tQ(tQ.Replace,e.aj.transparent,[!1,!1,!1,!1]),tQ.unblended=new tQ(tQ.Replace,e.aj.transparent,[!0,!0,!0,!0]),tQ.alphaBlended=new tQ([1,771,1,771],e.aj.transparent,[!0,!0,!0,!0]),tQ.alphaBlendedNonPremultiplied=new tQ([770,771,770,771],e.aj.transparent,[!0,!0,!0,!0]),tQ.multiply=new tQ([774,0,774,0],e.aj.transparent,[!0,!0,!0,!0]);class t0{constructor(e,i,r){this.func=e,this.mask=i,this.range=r}}t0.ReadOnly=!1,t0.ReadWrite=!0,t0.disabled=new t0(519,t0.ReadOnly,[0,1]);class t1{constructor(e,i,r,a,n,o){this.test=e,this.ref=i,this.mask=r,this.fail=a,this.depthFail=n,this.pass=o}}t1.disabled=new t1({func:519,mask:0},0,0,7680,7680,7680);class t2{constructor(e,i,r){this.enable=e,this.mode=i,this.frontFace=r}}function t3(i,r){let a=e.bG(i,3);e.ab.mat4.fromQuat(i,r),e.bI(i,3,a)}function t4(i,r){let a=e.ab.quat.identity([]);return e.ab.quat.rotateZ(a,a,-r),e.ab.quat.rotateX(a,a,-i),a}function t5(i,r){let a=[i[0],i[1],0],n=[r[0],r[1],0];if(e.ab.vec3.length(a)>=1e-15){let i=e.ab.vec3.normalize([],a);e.ab.vec3.scale(n,i,e.ab.vec3.dot(n,i)),r[0]=n[0],r[1]=n[1]}let o=e.ab.vec3.cross([],r,i);if(1e-15>e.ab.vec3.len(o))return null;let s=Math.atan2(-o[1],o[0]);return t4(Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2]),s)}t2.disabled=new t2(!1,1029,2305),t2.backCCW=new t2(!0,1029,2305),t2.backCW=new t2(!0,1029,2304),t2.frontCW=new t2(!0,1028,2304),t2.frontCCW=new t2(!0,1028,2305);class t6{constructor(e,i){this.position=e,this.orientation=i}get position(){return this._position}set position(i){if(i){let r=i instanceof e.aa?i:new e.aa(i[0],i[1],i[2]);
8this._renderWorldCopies&&(r.x=e.bF(r.x,0,1)),this._position=r}else this._position=null}lookAtPoint(i,r){if(this.orientation=null,!this.position)return;let a=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.aa.fromLngLat(i)):0,o=e.aa.fromLngLat(i,n),s=[o.x-a.x,o.y-a.y,o.z-a.z];r||(r=[0,0,1]),r[2]=Math.abs(r[2]),this.orientation=t5(s,r)}setPitchBearing(i,r){this.orientation=t4(e.ai(i),e.ai(-r))}}class t8{constructor(i,r){this._transform=e.ab.mat4.identity([]),this.orientation=r,this.position=i}get mercatorPosition(){let i=this.position;return new e.aa(i[0],i[1],i[2])}get position(){let i=e.bG(this._transform,3);return[i[0],i[1],i[2]]}set position(i){i&&e.bI(this._transform,3,[i[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(i){this._orientation=i||e.ab.quat.identity([]),i&&t3(this._transform,this._orientation)}getPitchBearing(){let e=this.forward(),i=this.right();return{bearing:Math.atan2(-i[1],i[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,i){this._orientation=t4(e,i),t3(this._transform,this._orientation)}forward(){let i=e.bG(this._transform,2);return[-i[0],-i[1],-i[2]]}up(){let i=e.bG(this._transform,1);return[-i[0],-i[1],-i[2]]}right(){let i=e.bG(this._transform,0);return[i[0],i[1],i[2]]}getCameraToWorld(i,r){let a=new Float64Array(16);return e.ab.mat4.invert(a,this.getWorldToCamera(i,r)),a}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(i,r,a){let n=this.position;e.ab.vec3.scale(n,n,-i);let o=new Float64Array(16);return e.ab.mat4.fromScaling(o,[a,a,a]),e.ab.mat4.translate(o,o,n),o[10]*=r,o}getWorldToCamera(i,r){let a=new Float64Array(16),n=new Float64Array(4),o=this.position;return e.ab.quat.conjugate(n,this._orientation),e.ab.vec3.scale(o,o,-i),e.ab.mat4.fromQuat(a,n),e.ab.mat4.translate(a,a,o),a[1]*=-1,a[5]*=-1,a[9]*=-1,a[13]*=-1,a[8]*=r,a[9]*=r,a[10]*=r,a[11]*=r,a}getCameraToClipPerspective(i,r,a,n){let o=new Float64Array(16);return e.ab.mat4.perspective(o,i,r,a,n),o}getCameraToClipOrthographic(i,r,a,n,o,s){let l=new Float64Array(16);return e.ab.mat4.ortho(l,i,r,a,n,o,s),l}getDistanceToElevation(i,r=!1){let a=0===i?0:e.bH(i,r?e.aS(this.position[1]):this.position[1]),n=this.forward();return(a-this.position[2])/n[2]}clone(){return new t8([...this.position],[...this.orientation])}}let t9={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class t7{constructor(e=0,i=0,r=0,a=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=r,this.right=a}interpolate(i,r,a){return null!=r.top&&null!=i.top&&(this.top=e.af(i.top,r.top,a)),null!=r.bottom&&null!=i.bottom&&(this.bottom=e.af(i.bottom,r.bottom,a)),null!=r.left&&null!=i.left&&(this.left=e.af(i.left,r.left,a)),null!=r.right&&null!=i.right&&(this.right=e.af(i.right,r.right,a)),this}getCenter(i,r){let a=e.aw((this.left+i-this.right)/2,0,i),n=e.aw((this.top+r-this.bottom)/2,0,r);return new e.P(a,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new t7(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let ie=(e,i,r)=>(1-r)*e+r*i,it=e=>e*e*e*e*e;class ii{constructor(i,r,a,n,o,s,l){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=a??0,this._maxPitch=n??60,this.setProjection(s),this.setMaxBounds(l),this.width=0,this.height=0,this._center=new e.bO(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new t7,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new t8,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){let e=new ii(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForE
8xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(e,i=!1){let r=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
8xaggeration;(null==this._seaLevelZoom||r)&&this._updateCameraOnTerrain(),(e||r)&&this._constrainCamera(i),this._calcMatrices()}getProjection(){return e.ay(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};let r=this.projection?this.getProjection():void 0;this.projection=e.bP(this.projectionOptions);let a=this.getProjection(),n=!e.bn(r,a);return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){let i=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.bP({name:"mercator"});let r=i!==this.projection.name;return r&&this._calcMatrices(),r}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){let e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){let e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.bH(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return e.bF(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(i){let r=-i*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=e.ab.mat2.create(),e.ab.mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){let r=e.aw(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){let e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=e.ai(i),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){let i=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==i&&(this._unmodified=!1,this._setZoom(i),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){let e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,i=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!i||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);let r=this._elevation;i||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&r.exaggeration()&&this._centerAltitudeValidForExaggeration!==r.exaggeration()?this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*r.exaggeration():this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=r.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;let i=this._elevation,r=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],a=this.horizonLineFromTop(),n=0,o=0;for(let s=0;s<r.length;s++){let l=new e.P(r[s][0]*this.width,a+r[s][1]*(this.height-a)),h=i.pointCoordinate(l);if(!h)continue;let u=1/Math.hypot(h[0]-this._camera.position[0],h[1]-this._camera.position[1]);n+=h[3]*u,o+=u}return 0===o?NaN:n/o}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let e=this._seaLevelZoom,i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),r=this.pixelsPerMeter/this.worldSize*i,a=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom);this._setZoom(this._zoomFromMercatorZ(Math.max(a-r,n)))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}computeZoomRelativeTo(i){let r;let a=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,i.toAltitude()));r=i.z<this._camera.position[2]?[a.x,a.y,a.z]:[i.x,i.y,i.z];let n=e.ab.vec3.length(e.ab.vec3.sub([],this._camera.position,r));return e.aw(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(i){if(!this.height||!i.position&&!i.orientation)return;this._updateCameraState();let r=!1;if(i.orientation&&!e.ab.quat.exactEquals(i.orientation,this._camera.orientation)&&(r=this._setCameraOrientation(i.orientation)),i.position){let a=[i.position.x,i.position.y,i.position.z];e.ab.vec3.exactEquals(a,this._camera.position)||(this._setCameraPosition(a),r=!0)}r&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let i=this._camera.position,r=new t6;return r.position=new e.aa(i[0],i[1],i[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(i){if(!e.ab.quat.length(i))return!1;e.ab.quat.normalize(i,i);let r=e.ab.vec3.transformQuat([],[0,0,-1],i),a=e.ab.vec3.transformQuat([],[0,-1,0],i);if(a[2]<0)return!1;let n=t5(r,a);return!!n&&(this._camera.orientation=n,!0)}_setCameraPosition(i){let r=this.zoomScale(this.minZoom)*this.tileSize,a=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;i[2]=e.aw(i[2],n/a,n/r),this._camera.position=i}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,r){this._unmodified=!1,this._edgeInsets.interpolate(e,i,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){return Math.max(0,(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize)))}getVisibleUnwrappedCoordinates(i){let r=[new e.bQ(0,i)];if(this.renderWorldCopies){let a=this.pointCoordinate(new e.P(0,0)),n=this.pointCoordinate(new e.P(this.width,0)),o=this.pointCoordinate(new e.P(this.width,this.height)),s=this.pointCoordinate(new e.P(0,this.height)),l=Math.floor(Math.min(a.x,n.x,o.x,s.x)),h=Math.floor(Math.max(a.x,n.x,o.x,s.x));for(let a=l-1;a<=h+1;a++)0!==a&&r.push(new e.bQ(a,i))}return r}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(i,r,a){let n=[],o=void 0!==a,s=!o;if(s&&this.zoom<r||o&&0===a[0]&&0===a[1])return n;let l=new Set,h=(i,r,a,o,s)=>{let h=e.c5(r,i,a,o,s);l.has(h)||(n.push(new e.aG(i,r,a,o,s)),l.add(h))};for(let e=0;e<i.length;e++){let n=i[e];if(s&&n.canonical.z!==r)continue;let l=n.canonical,u=n.overscaledZ,c=n.wrap,d=1<<l.z,p=l.x+1<d,f=l.x>0,m=l.y+1<d,_=l.y>0,g=n.wrap-(f?0:1),y=n.wrap+(p?0:1),x=f?l.x-1:d-1,v=p?l.x+1:0;if(o)a[0]<0?(h(u,y,l.z,v,l.y),a[1]<0&&m&&(h(u,c,l.z,l.x,l.y+1),h(u,y,l.z,v,l.y+1)),a[1]>0&&_&&(h(u,c,l.z,l.x,l.y-1),h(u,y,l.z,v,l.y-1))):a[0]>0?(h(u,g,l.z,x,l.y),a[1]<0&&m&&(h(u,c,l.z,l.x,l.y+1),h(u,g,l.z,x,l.y+1)),a[1]>0&&_&&(h(u,c,l.z,l.x,l.y-1),h(u,g,l.z,x,l.y-1))):a[1]<0&&m?h(u,c,l.z,l.x,l.y+1):_&&h(u,c,l.z,l.x,l.y-1);else{let e=n.visibleQuadrants;1&e&&(h(u,g,l.z,x,l.y),_&&(h(u,c,l.z,l.x,l.y-1),h(u,g,l.z,x,l.y-1))),2&e&&(h(u,y,l.z,v,l.y),_&&(h(u,c,l.z,l.x,l.y-1),h(u,y,l.z,v,l.y-1))),4&e&&(h(u,g,l.z,x,l.y),m&&(h(u,c,l.z,l.x,l.y+1),h(u,g,l.z,x,l.y+1))),8&e&&(h(u,y,l.z,v,l.y),m&&(h(u,c,l.z,l.x,l.y+1),h(u,y,l.z,v,l.y+1)))}}let u=[];for(let e of n)n.some(i=>e.isChildOf(i))||u.push(e);if(n=u.filter(e=>!i.some(i=>!!(e.overscaledZ<r&&i.isChildOf(e))||e.equals(i)||e.isChildOf(i))),s){let e=1<<r,i="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),a=[e*i.x,e*i.y];n=n.filter(e=>{let i=e.canonical.x+.5-a[0],r=e.canonical.y+.5-a[1];return i*i+r*r<16})}return n}coveringTiles(i){let r,a=this.coveringZoomLevel(i),n=a,o=this.elevation&&this.elevation.exaggeration(),s=o&&!i.isTerrainDEM,l="mercator"===this.projection.name;if(void 0!==i.minzoom&&a<i.minzoom)return[];void 0!==i.maxzoom&&a>i.maxzoom&&(a=i.maxzoom);let h=this.locationCoordinate(this.center),u=this.center.lat,c=1<<a,d=[c*h.x,c*h.y,0],p="globe"===this.projection.name,f=!p,m=e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,f),_=p?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),g=c*e.bH(1,this.center.lat),y=this._camera.position[2]/e.bH(1,this.center.lat),x=[c*_.x,c*_.y,y*(f?1:g)],v=p||o,b=this.cameraToCenterDistance/i.tileSize*(i.roundZoom?1:.502),w=this.isLODDisabled(!0)?a:0;if(this._elevation&&i.isTerrainDEM)r=1e4*this._elevation.exaggeration();else if(this._elevation){let e=this._elevation.getMinMaxForVisibleTiles();r=e?e.max:this._centerAltitude}else r=this._centerAltitude;let T=i.isTerrainDEM?-r:this._elevation?this._elevation.getMinElevationBelowMSL():0,S=this.projection.isReprojectedInTileSpace?e.bS(this):1,M=i=>{let r=1/4e4,a=new e.aa(i.x+r,i.y,i.z),n=new e.aa(i.x,i.y+r,i.z),o=i.toLngLat(),s=a.toLngLat(),l=n.toLngLat(),h=this.locationCoordinate(o),u=this.locationCoordinate(s),c=this.locationCoordinate(l);return Math.sqrt(Math.hypot(u.x-h.x,u.y-h.y)*Math.hypot(c.x-h.x,c.y-h.y))*S/r},E=i=>{let a=r;return{aabb:e.bV(this,c,0,0,0,i,T,a,this.projection),zoom:0,x:0,y:0,minZ:T,maxZ:a,wrap:i,fullyVisible:!1}},A=[],I=[],C=a,P=i.reparseOverscaled?n:a,z=(y-this._centerAltitude)*g,D=e=>{if(!this._elevation||!e.tileID||!l)return;let i=this._elevation.getMinMaxForTile(e.tileID),r=e.aabb;i?(r.min[2]=i.min,r.max[2]=i.max,r.center[2]=(r.min[2]+r.max[2])/2):(e.shouldSplit=L(e),e.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=this._centerAltitude))},R=(e,i)=>{if(.707*i<e)return 1;let r=i/e;return r/(1.4144271570014144+(Math.pow(1.1,r-1.4144271570014144+1)-1)/(1.1-1)-1)},L=i=>{if(i.zoom<w)return!0;
8if(i.zoom===C)return!1;if(null!=i.shouldSplit)return i.shouldSplit;let r=i.aabb.distanceX(x),a=i.aabb.distanceY(x),o=z,h=1;if(p){o=i.aabb.distanceZ(x);let r=Math.pow(2,i.zoom),a=Math.min(Math.max(u,e.aS((i.y+1)/r)),e.aS(i.y/r)),n=e.c9(a)/e.c9(u);if(h=a===u?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,n/this._mercatorScaleRatio),this.zoom<=e.c6&&i.zoom===C-1&&n>=.9)return!0}else if(s&&(o=i.aabb.distanceZ(x)*g),this.projection.isReprojectedInTileSpace&&n<=5){let r=Math.pow(2,i.zoom),a=M(new e.aa((i.x+.5)/r,(i.y+.5)/r));h=a>.85?1:a}if(!l){let e=Math.sqrt(r*r+a*a+o*o),n=(1<<C-i.zoom)*b*h;return n*=R(Math.max(o,z),e),e<n}let c=Number.MAX_VALUE,f=0,m=i.aabb.getCorners(),_=[];for(let i of m){e.ab.vec3.sub(_,i,x),p||(s?_[2]*=g:_[2]=z);let r=e.ab.vec3.dot(_,this._camera.forward());r<c&&(c=r,f=Math.abs(_[2]))}let y=(1<<C-i.zoom)*b*h;if(y*=R(Math.max(f,z),c),c<y)return!0;let v=i.aabb.closestPoint(d);return v[0]===d[0]&&v[1]===d[1]};if(this.renderWorldCopies)for(let e=1;e<=3;e++)A.push(E(-e)),A.push(E(e));for(A.push(E(0));A.length>0;){let r=A.pop(),n=r.x,o=r.y,h=r.fullyVisible,u=()=>"globe"===this.projection.name&&(0===r.y||r.y===(1<<r.zoom)-1);if(!h){let i=v?r.aabb.intersects(m):r.aabb.intersectsFlat(m);if(0===i&&u()){let a=new e.bT(r.zoom,n,o);i=e.bU(this,c,a,!0).intersects(m)}if(0===i)continue;h=2===i}if(r.zoom!==C&&L(r))for(let i=0;i<4;i++){let a=(n<<1)+i%2,u=(o<<1)+(i>>1),d={aabb:l?r.aabb.quadrant(i):e.bV(this,c,r.zoom+1,a,u,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:a,y:u,wrap:r.wrap,fullyVisible:h,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};s&&!p&&(d.tileID=new e.aG(r.zoom+1===C?P:r.zoom+1,r.wrap,r.zoom+1,a,u),D(d)),A.push(d)}else{let s=r.zoom===C?P:r.zoom;if(i.minzoom&&i.minzoom>s)continue;let l=0;if(!h){let a=v?r.aabb.intersectsPrecise(m):r.aabb.intersectsPreciseFlat(m);if(0===a&&u()){let i=new e.bT(r.zoom,n,o);a=e.bU(this,c,i,!0).intersectsPrecise(m)}if(0===a)continue;if(i.calculateQuadrantVisibility){if(m.containsPoint(r.aabb.center))l=15;else for(let e=0;e<4;e++)0!==r.aabb.quadrant(e).intersects(m)&&(l|=1<<e)}}let p=d[0]-(.5+n+(r.wrap<<r.zoom))*(1<<a-r.zoom),f=d[1]-.5-o,_=r.tileID?r.tileID:new e.aG(s,r.wrap,r.zoom,n,o);i.calculateQuadrantVisibility&&(_.visibleQuadrants=l),I.push({tileID:_,distanceSq:p*p+f*f})}}if(this.fogCullDistSq){let a=this.fogCullDistSq,n=this.horizonLineFromTop();I=I.filter(o=>{let s=[0,0,0,1],l=[e.ag,e.ag,0,1],h=this.calculateFogTileMatrix(o.tileID.toUnwrapped());e.ab.vec4.transformMat4(s,s,h),e.ab.vec4.transformMat4(l,l,h);let u=e.ab.vec4.min([],s,l),c=e.ab.vec4.max([],s,l),d=e.bW(u,c);if(0===d)return!0;let p=!1,f=this._elevation;if(f&&d>a&&0!==n){let a;let s=this.calculateProjMatrix(o.tileID.toUnwrapped());i.isTerrainDEM||(a=f.getMinMaxForTile(o.tileID)),a||(a={min:T,max:r});let l=e.c7(this.rotation),h=[l[0]*e.ag,l[1]*e.ag,a.max];e.ab.vec3.transformMat4(h,h,s),p=(1-h[1])*this.height*.5<n}return d<a||p})}return I.sort((e,i)=>e.distanceSq-i.distanceSq).map(e=>e.tileID)}resize(e,i){this.width=e,this.height=i,this.pixelsToGLUnits=[2/e,-2/i],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(i){let r=e.aw(i.lat,-e.bX,e.bX),a=this.projection.project(i.lng,r);return new e.P(a.x*this.worldSize,a.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.bH(1,this.center.lat)/this.worldSize}setLocationAtPoint(i,r){let a,n;let o=this.centerPoint;if("globe"===this.projection.name){let e=this.worldSize;a=(r.x-o.x)/e,n=(r.y-o.y)/e}else{let e=this.pointCoordinate(r),i=this.pointCoordinate(o);a=e.x-i.x,n=e.y-i.y}let s=this.locationCoordinate(i);this.setLocation(new e.aa(s.x-a,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(i,r){let a=r?e.bH(r,i.lat):void 0,n=this.projection.project(i.lng,i.lat);return new e.aa(n.x,n.y,a)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(i,r){let a=null!=r?r:this._centerAltitude,n=[i.x,i.y,0,1],o=[i.x,i.y,1,1];e.ab.vec4.transformMat4(n,n,this.pixelMatrixInverse),e.ab.vec4.transformMat4(o,o,this.pixelMatrixInverse);let s=o[3];
8e.ab.vec4.scale(n,n,1/n[3]),e.ab.vec4.scale(o,o,1/s);let l=n[2],h=o[2];return{p0:n,p1:o,t:l===h?0:(a-l)/(h-l)}}screenPointToMercatorRay(i){let r=[i.x,i.y,0,1],a=[i.x,i.y,1,1];return e.ab.vec4.transformMat4(r,r,this.pixelMatrixInverse),e.ab.vec4.transformMat4(a,a,this.pixelMatrixInverse),e.ab.vec4.scale(r,r,1/r[3]),e.ab.vec4.scale(a,a,1/a[3]),r[2]=e.bH(r[2],this._center.lat)*this.worldSize,a[2]=e.bH(a[2],this._center.lat)*this.worldSize,e.ab.vec4.scale(r,r,1/this.worldSize),e.ab.vec4.scale(a,a,1/this.worldSize),new e.aq([r[0],r[1],r[2]],e.ab.vec3.normalize([],e.ab.vec3.sub([],a,r)))}rayIntersectionCoordinate(i){let{p0:r,p1:a,t:n}=i,o=e.bH(r[2],this._center.lat),s=e.bH(a[2],this._center.lat);return new e.aa(e.af(r[0],a[0],n)/this.worldSize,e.af(r[1],a[1],n)/this.worldSize,e.af(o,s,n))}pointCoordinate(e,i=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,i)}pointCoordinate3D(i){if(!this.elevation)return this.pointCoordinate(i);let r=this.projection.pointCoordinate3D(this,i.x,i.y);if(r)return new e.aa(r[0],r[1],r[2]);let a=0,n=this.horizonLineFromTop();if(i.y>n)return this.pointCoordinate(i);let o=.02*n,s=i.clone();for(let i=0;i<10&&n-a>o;i++){s.y=e.af(a,n,.66);let i=this.projection.pointCoordinate3D(this,s.x,s.y);i?(n=s.y,r=i):a=s.y}return r?new e.aa(r[0],r[1],r[2]):this.pointCoordinate(i)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(i){if(i.y<0||i.y>this.height||i.x<0||i.x>this.width)return!1;if(this.elevation||this.zoom>=e.bY)return!this.isPointAboveHorizon(i);let r=this.pointCoordinate(i);return r.y>=0&&r.y<=1}_coordinatePoint(i,r){let a=r&&this.elevation?this.elevation.getAtPointOrZero(i,this._centerAltitude):this._centerAltitude,n=[i.x*this.worldSize,i.y*this.worldSize,a+i.toAltitude(),1];return e.ab.vec4.transformMat4(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){let{top:i,left:r}=this._edgeInsets,a=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.P(r,i)),s=this.pointLocation3D(new e.P(n,i)),l=this.pointLocation3D(new e.P(n,a)),h=this.pointLocation3D(new e.P(r,a)),u=Math.min(o.lng,s.lng,l.lng,h.lng),c=Math.max(o.lng,s.lng,l.lng,h.lng),d=Math.min(o.lat,s.lat,l.lat,h.lat),p=Math.max(o.lat,s.lat,l.lat,h.lat),f=Math.pow(2,-this.zoom)/16*270,m="globe"===this.projection.name?1:4,_=(i,r,a,n,o)=>{let s=(i+a)/2,l=(r+n)/2,h=new e.P(s,l),{lng:g,lat:y}=this.pointLocation3D(h),x=Math.max(0,u-g,d-y,g-c,y-p);u=Math.min(u,g),c=Math.max(c,g),d=Math.min(d,y),p=Math.max(p,y),(o<m||x>f)&&(_(i,r,s,l,o+1),_(s,l,a,n,o+1))};if(_(r,i,n,i,1),_(n,i,n,a,1),_(n,a,r,a,1),_(r,a,r,i,1),"globe"===this.projection.name){let[i,r]=e.bZ(this);i?(p=90,c=180,u=-180):r&&(d=-90,c=180,u=-180)}return new e.az(new e.bO(u,d),new e.bO(c,p))}_getBoundsRectangular(i,r){let a,n,o,s;let{top:l,left:h}=this._edgeInsets,u=this.height-this._edgeInsets.bottom,c=this.width-this._edgeInsets.right,d=new e.P(h,l),p=new e.P(c,l),f=new e.P(c,u),m=new e.P(h,u),_=this.pointCoordinate(d,i),g=this.pointCoordinate(p,i),y=this.pointCoordinate(f,r),x=this.pointCoordinate(m,r);return _.y>1&&g.y>=0?_=new e.aa((1-x.y)/(((a=_).y-x.y)/(a.x-x.x))+x.x,1):_.y<0&&g.y<=1&&(_=new e.aa(-x.y/(((n=_).y-x.y)/(n.x-x.x))+x.x,0)),g.y>1&&_.y>=0?g=new e.aa((1-y.y)/(((o=g).y-y.y)/(o.x-y.x))+y.x,1):g.y<0&&_.y<=1&&(g=new e.aa(-y.y/(((s=g).y-y.y)/(s.x-y.x))+y.x,0)),(new e.az).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(g)).extend(this.coordinateLocation(x)).extend(this.coordinateLocation(y))}_getBoundsRectangularTerrain(){let e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);let i=e.visibleDemTiles.reduce((e,i)=>{if(i.dem){let r=i.dem.tree;e.min=Math.min(e.min,r.minimums[0]),e.max=Math.max(e.max,r.maximums[0])}return e},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(i.min*e.exaggeration(),i.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){let i=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,r=this.height/2-i*(1-this._horizonShift);return e?Math.max(0,r):r}getMaxBounds(){return this.maxBounds}setMaxBounds(i){this.maxBounds=i,this.minLat=-e.bX,this.maxLat=e.bX,this.minLng=-180,this.maxLng=180,i&&(this.minLat=i.getSouth(),this.maxLat=i.getNorth(),this.minLng=i.getWest(),this.maxLng=i.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.at(this.minLng)*this.tileSize,this.worldMaxX=e.at(this.maxLng)*this.tileSize,this.worldMinY=e.aA(this.maxLat)*this.tileSize,this.worldMaxY=e.aA(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,i){return this.projection.createTileMatrix(this,i,e)}calculateDistanceTileData(i){let r=i.key,a=this._distanceTileDataCache;if(a[r])return a[r];let n=i.canonical,o=1/this.height,s=this.cameraWorldSize,l=s/this.zoomScale(n.z),h=(n.x+Math.pow(2,n.z)*i.wrap)*l,u=n.y*l,c=this.point;c.x*=s/this.worldSize,c.y*=s/this.worldSize;let d=this.angle,p=Math.sin(-d),f=-Math.cos(-d);return a[r]={bearing:[p,f],center:[(c.x-h)*o,(c.y-u)*o],scale:l/e.ag*o},a[r]}calculateFogTileMatrix(i){let r=i.key,a=this._fogTileMatrixCache;if(a[r])return a[r];let n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,i);return e.ab.mat4.multiply(n,this.worldToFogMatrix,n),a[r]=new Float32Array(n),a[r]}calculateProjMatrix(i,r=!1,a=!1){let n,o;let s=i.key;if((n=a?this._expandedProjMatrixCache:r?this._alignedProjMatrixCache:this._projMatrixCache)[s])return n[s];let l=this.calculatePosMatrix(i,this.worldSize);return o=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:a?this.expandedFarZProjMatrix:r?this.alignedProjMatrix:this.projMatrix,e.ab.mat4.multiply(l,o,l),n[s]=new Float32Array(l),n[s]}calculatePixelsToTileUnitsMatrix(i){let r=i.tileID.key,a=this._pixelsToTileUnitsCache;if(a[r])return a[r];let n=e.b_(i,this);return a[r]=n,a[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){let i=1/this.worldSize,r=e.ab.mat4.fromScaling([],[i,i,i]);return e.ab.mat4.multiply(r,r,this.globeMatrix),r}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let i=this._elevation;this._updateCameraState();let r=e.bH(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(r),n=this._camera.forward(),o=e.bH(1,this._center.lat);a[2]/=o,n[2]/=o,e.ab.vec3.normalize(n,n);let s=i.raycast(a,n,i.exaggeration());if(s){let i=e.ab.vec3.scaleAndAdd([],a,n,s),r=new e.aa(i[0],i[1],e.bH(i[2],e.aS(i[1]))),l=(r.z+e.ab.vec3.length([r.x-a[0],r.y-a[1],r.z-a[2]*o]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(l),this._centerAltitude=r.toAltitude(),this._center=this.coordinateLocation(r),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(i=!1){if(!this._elevation)return;let r=this._elevation,a=e.bH(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),o=r.getAtPointOrZero(new e.aa(...n)),s=this.pixelsPerMeter/this.worldSize*o,l=this._minimumHeightOverTerrain(),h=n[2]-s;if(h<=l){if(h<0||i){let i=this.locationCoordinate(this._center,this._centerAltitude),r=[n[0],n[1],i.z-n[2]],a=e.ab.vec3.length(r);r[2]-=(l-h)/this._pixelsPerMercatorPixel;let o=e.ab.vec3.length(r);if(0===o)return;e.ab.vec3.scale(r,r,a/o*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],i.z*this._pixelsPerMercatorPixel-r[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let i="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||i){let r=this.center;return r.lat=e.aw(r.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||i)||(r.lng=e.aw(r.lng,this.minLng,this.maxLng)),this.center=r,void(this._constraining=!1)}let r=this._unmodified,{x:a,y:n}=this.point,o=0,s=a,l=n,h=this.width/2,u=this.height/2,c=this.worldMinY*this.scale,d=this.worldMaxY*this.scale;if(n-u<c&&(l=c+u),n+u>d&&(l=d-u),d-c<this.height&&(o=Math.max(o,this.height/(d-c)),l=(d+c)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let e=this.worldMinX*this.scale,i=this.worldMaxX*this.scale,r=this.worldSize/2-(e+i)/2;(s=(a+r+this.worldSize)%this.worldSize-r)-h<e&&(s=e+h),s+h>i&&(s=i-h),i-e<this.width&&(o=Math.max(o,this.width/(i-e)),s=(i+e)/2)}s===a&&l===n||(this.center=this.unproject(new e.P(s,l))),o&&(this.zoom+=this.scaleZoom(o)),this._constrainCamera(),this._unmodified=r,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){let i;if(!this.height)return;let r=this.centerOffset,a="globe"===this.projection.name,n=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=e.bH(1,this.center.lat)/e.bH(1,e.c8));let o=e.b$(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,o),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;let s="meters"===this.projection.zAxisUnit?n:1,l=this._camera.getWorldToCamera(this.worldSize,s),h=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(h[8]=-(2*r.x)/this.width,h[9]=2*r.y/this.height,this.isOrthographic){let e=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),a=e*this.aspect,n=-a,o=-e;a-=r.x,n-=r.x,e+=r.y,o+=r.y,((e,i,r,a)=>{for(let n=0;n<16;n++)e[n]=ie(i[n],r[n],a)})(i=this._camera.getCameraToClipOrthographic(n,a,o,e,this._nearZ,this._farZ),i,h,it(this.pitch>=15?1:this.pitch/15))}else i=h;let u=e.ab.mat4.mul([],h,l),c=e.ab.mat4.mul([],i,l);if(this.projection.isReprojectedInTileSpace){let i=this.locationCoordinate(this.center),r=e.ab.mat4.identity([]);e.ab.mat4.translate(r,r,[i.x*this.worldSize,i.y*this.worldSize,0]),e.ab.mat4.multiply(r,r,e.c0(this)),e.ab.mat4.translate(r,r,[-i.x*this.worldSize,-i.y*this.worldSize,0]),e.ab.mat4.multiply(c,c,r),e.ab.mat4.multiply(u,u,r),this.inverseAdjustmentMatrix=e.c1(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.ab.mat4.scale([],c,[this.worldSize,this.worldSize,this.worldSize/s,1]),this.projMatrix=c,this.invProjMatrix=e.ab.mat4.invert(new Float64Array(16),this.projMatrix),a){let i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=-(2*r.x)/this.width,i[9]=2*r.y/this.height,this.expandedFarZProjMatrix=e.ab.mat4.mul([],i,l)}else this.expandedFarZProjMatrix=this.projMatrix;let d=e.ab.mat4.invert([],i);this.frustumCorners=e.c2.fromInvProjectionMatrix(d,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a);let p=new Float32Array(16);e.ab.mat4.identity(p),e.ab.mat4.scale(p,p,[1,-1,1]),e.ab.mat4.rotateX(p,p,this._pitch),e.ab.mat4.rotateZ(p,p,this.angle);let f=e.ab.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.ab.mat4.clone(f);let m=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;f[8]=-(2*r.x)/this.width,f[9]=2*(r.y+m)/this.height,this.skyboxMatrix=e.ab.mat4.multiply(
8p,f,p);let _=this.point,g=_.x,y=_.y,x=this.width%2/2,v=this.height%2/2,b=Math.cos(this.angle),w=Math.sin(this.angle),T=g-Math.round(g)+b*x+w*v,S=y-Math.round(y)+b*v+w*x,M=new Float64Array(c);if(e.ab.mat4.translate(M,M,[T>.5?T-1:T,S>.5?S-1:S,0]),this.alignedProjMatrix=M,c=e.ab.mat4.create(),e.ab.mat4.scale(c,c,[this.width/2,-this.height/2,1]),e.ab.mat4.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=e.ab.mat4.create(),e.ab.mat4.scale(c,c,[1,-1,1]),e.ab.mat4.translate(c,c,[-1,-1,0]),e.ab.mat4.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=e.ab.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,u),this._calcFogMatrices(),this._distanceTileDataCache={},!(c=e.ab.mat4.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");if(this.pixelMatrixInverse=c,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.c3(this);let i=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.ab.vec3.transformMat4(i,i,l),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=c;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};let i=this.cameraWorldSizeForFog,r=this.cameraPixelsPerMeter,a=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[i,i,r];e.ab.vec3.scale(o,o,n),e.ab.vec3.scale(a,a,-1),e.ab.vec3.multiply(a,a,o);let s=e.ab.mat4.create();e.ab.mat4.translate(s,s,a),e.ab.mat4.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(i,r,n)}_computeCameraPosition(e){let i=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,r=this._camera.forward(),a=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*i-e/this.worldSize*this._centerAltitude;return[a.x/this.worldSize-r[0]*n,a.y/this.worldSize-r[1]*n,e/this.worldSize*this._centerAltitude-r[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(i){let r=this._maxCameraBoundsDistance()*Math.cos(this._pitch),a=this._camera.position[2],n=i[2],o=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(o=Math.min((r-a)/n,1)),this._camera.position=e.ab.vec3.scaleAndAdd([],this._camera.position,i,o),this._updateStateFromCamera()}_updateStateFromCamera(){let i=this._camera.position,r=this._camera.forward(),{pitch:a,bearing:n}=this._camera.getPitchBearing(),o=e.bH(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.ai(this._maxPitch)),l=Math.max((i[2]-o)/Math.cos(a),s),h=this._zoomFromMercatorZ(l);e.ab.vec3.scaleAndAdd(i,i,r,l),this._pitch=e.aw(a,e.ai(this.minPitch),e.ai(this.maxPitch)),this.angle=e.bF(n,-Math.PI,Math.PI),this._setZoom(e.aw(h,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.aa(i[0],i[1],i[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){let e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(i){let r=0,a=e.bY,n=0,o=1/0;for(;a-r>1e-6&&a>r;){let e=r+.5*(a-r),s=this.tileSize*Math.pow(2,e),l=this.getCameraToCenterDistance(this.projection,e,s),h=this.scaleZoom(l/(i*this.tileSize)),u=Math.abs(e-h);u<o&&(o=u,n=e),e<h?r=e:a=e}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(i,r){let a=Math.min(i.x,r.x),n=Math.max(i.x,r.x),o=Math.min(i.y,r.y),s=Math.max(i.y,r.y);if(o<this.horizonLineFromTop(!1))return!0;
8if("mercator"!==this.projection.name)return!1;let l=[new e.P(a,o),new e.P(n,s),new e.P(a,s),new e.P(n,o)],h=this.renderWorldCopies?-3:0,u=this.renderWorldCopies?4:1;for(let e of l){let i=this.pointRayIntersection(e);if(i.t<0)return!0;let r=this.rayIntersectionCoordinate(i);if(r.x<h||r.y<0||r.x>u||r.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.c4(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(i,r){let a=e.ab.vec3.length(e.ab.vec3.sub([],this._camera.position,i)),n=this._zoomFromMercatorZ(a)+r;return a-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){let i=function([i,r,a],n){let o=[i,r,a,1];e.ab.vec4.transformMat4(o,o,n);let s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(i[0],i[1])}{let i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,i))}}getCameraToCenterDistance(i,r=this.zoom,a=this.worldSize){let n=e.b$(i,r,this.width,this.height,1024),o=i.pixelSpaceConversion(this.center.lat,a,n),s=.5/Math.tan(.5*this._fov)*this.height*o;return this.isOrthographic&&(s=ie(1,s,it(this.pitch>=15?1:this.pitch/15))),s}getWorldToCameraMatrix(){let i=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.ab.mat4.multiply(i,i,this.globeMatrix),i}getFrustum(i){return e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,"meters"===this.projection.zAxisUnit)}}let ir=(i,r)=>{if(r>0&&i.terrain&&e.w("Cutoff is currently disabled on terrain"),r<=0||i.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let a=i.transform,n=Math.max(Math.abs(a._zoom-(i.minCutoffZoom-1)),1),o=a.isLODDisabled(!1)?e.ac(60,45,a.pitch):e.ac(30,15,a.pitch),s=a._farZ-a._nearZ,l=r*a.height,h=((1-o)*a.cameraToCenterDistance+o*(a._farZ+l))*n;return{shouldRenderCutoff:o<1,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(h-a._nearZ)/s,(h-l-a._nearZ)/s]}}},ia={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class io{constructor(e,i){this.aabb=e,this.lastCascade=i}}class is{add(e,i){let r=this.receivers[e.key];void 0!==r?(r.aabb.min[0]=Math.min(r.aabb.min[0],i.min[0]),r.aabb.min[1]=Math.min(r.aabb.min[1],i.min[1]),r.aabb.min[2]=Math.min(r.aabb.min[2],i.min[2]),r.aabb.max[0]=Math.max(r.aabb.max[0],i.max[0]),r.aabb.max[1]=Math.max(r.aabb.max[1],i.max[1]),r.aabb.max[2]=Math.max(r.aabb.max[2],i.max[2])):this.receivers[e.key]=new io(i,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(i,r,a){let n=e.cd.fromPoints(i.points),o=0;for(let i in this.receivers){let s=this.receivers[i];if(!s||!n.intersectsAabb(s.aabb))continue;s.aabb.min=n.closestPoint(s.aabb.min),s.aabb.max=n.closestPoint(s.aabb.max);let l=s.aabb.getCorners();for(let i=0;i<a.length;i++){let n=!0;for(let o of l){let s=[o[0]*r,o[1]*r,o[2]];if(e.ab.vec3.transformMat4(s,s,a[i].matrix),s[0]<-1||s[0]>1||s[1]<-1||s[1]>1){n=!1;break}}if(s.lastCascade=i,o=Math.max(o,i),n)break}}return o+1}}class il{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new is,this._depthMode=new t0(e.context.gl.LEQUAL,t0.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,e.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),e.tp.registerParameter(ia,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(ia,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),e.tp.registerParameter(ia,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),e.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(let e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(i,r){let a=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!r||!r.properties)return;let n=r.properties.get("shadow-intensity");if(!r.shadowsEnabled()||n<=0||(this._shadowLayerCount=a.style.order.reduce((e,r)=>{let n=a.style._mergedLayers[r];return e+(n.hasShadowPass()&&!n.isHidden(i.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;let o=a.context,s=ia.shadowMapResolution,l=ia.shadowMapResolution;if(0===this._cascades.length||ia.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let i=0;i<ia.cascadeCount;++i){let i=a._shadowMapDebug,r=o.gl,n=o.createFramebuffer(s,l,i,"texture"),h=new e.T(o,{width:s,height:l,data:null},r.DEPTH_COMPONENT16);if(n.depthAttachment.set(h.texture),i){let i=new e.T(o,{width:s,height:l,data:null},r.RGBA8);n.colorAttachment.set(i.texture)}this._cascades.push({framebuffer:n,texture:h,matrix:[],far:0,boundingSphereRadius:0,frustum:new e.bR,scale:0})}}this.shadowDirection=iu(r);let h=0;if(i.elevation){let e=i.elevation,r=[1e4,-1e4];e.visibleDemTiles.filter(e=>
8e.dem).forEach(e=>{let i=e.dem.tree;r[0]=Math.min(r[0],i.minimums[0]),r[1]=Math.max(r[1],i.maximums[0])}),1e4!==r[0]&&(h=(r[1]-r[0])*e.exaggeration())}let u=1.5*i.cameraToCenterDistance,c=3*u,d=new Float64Array(16);for(let r=0;r<this._cascades.length;++r){let a=this._cascades[r],n=i.height/50,o=1;1===ia.cascadeCount?o=c:0===r?o=u:(n=u,o=c);let[s,l]=function(i,r,a,n,o,s){let l,h;let u=i.zoom,c=i.scale,d=i.worldSize,p=1/d,f=i.aspect,m=Math.sqrt(1+f*f)*Math.tan(.5*i.fovX),_=m*m,g=n-a,y=n+a;_>g/y?(l=n,h=n*m):(l=.5*y*(1+_),h=.5*Math.sqrt(g*g+2*(n*n+a*a)*_+y*y*_*_));let x=i.projection.pixelsPerMeter(i.center.lat,d),v=i._camera.getCameraToWorldMercator(),b=[0,0,-l*p];e.ab.vec3.transformMat4(b,b,v);let w=h*p,T=i._edgeInsets;if(!(0===T.left&&0===T.top&&0===T.right&&0===T.bottom||T.left===T.right&&T.top===T.bottom)){let r=i._camera.getWorldToCamera(i.worldSize,"meters"===i.projection.zAxisUnit?x:1),o=i._camera.getCameraToClipPerspective(i._fov,i.width/i.height,a,n);o[8]=-(2*i.centerOffset.x)/i.width,o[9]=2*i.centerOffset.y/i.height;let s=new Float64Array(16);e.ab.mat4.mul(s,o,r);let l=new Float64Array(16);for(let r of(e.ab.mat4.invert(l,s),e.bR.fromInvProjectionMatrix(l,d,u,!0).points)){let a=(r[0]/=c,r[1]/=c,r[2]=e.bH(r[2],i._center.lat),r);w=Math.max(w,e.ab.vec3.len(e.ab.vec3.subtract([],b,a)))}}w*=o/(o-1);let S=Math.acos(r[2]),M=Math.atan2(-r[0],-r[1]),E=new t8;E.position=b,E.setPitchBearing(S,M);let A=E.getWorldToCamera(d,x),I=w*d,C=Math.min(-(i._mercatorZfromZoom(17)*d*2),-2*I),P=E.getCameraToClipOrthographic(-I,I,-I,I,C,(I+s*x)/r[2]),z=new Float64Array(16);e.ab.mat4.multiply(z,P,A);let D=e.ab.vec3.fromValues(Math.floor(1e6*b[0])/1e6*d,Math.floor(1e6*b[1])/1e6*d,0),R=.5*o,L=[0,0,0];e.ab.vec3.transformMat4(L,D,z),e.ab.vec3.scale(L,L,R);let O=[Math.floor(L[0]),Math.floor(L[1]),Math.floor(L[2])],k=[0,0,0];e.ab.vec3.sub(k,L,O),e.ab.vec3.scale(k,k,-1/R);let F=new Float64Array(16);return e.ab.mat4.identity(F),e.ab.mat4.translate(F,F,k),e.ab.mat4.multiply(z,F,z),[z,I]}(i,this.shadowDirection,n,o,ia.shadowMapResolution,h);a.scale=i.scale,a.matrix=s,a.boundingSphereRadius=l,e.ab.mat4.invert(d,a.matrix
8),a.frustum=e.bR.fromInvProjectionMatrix(d,1,0,!0),a.far=o}let p=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[p].far,this._cascades[p].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/ia.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=ia.shadowMapResolution,this._uniformValues.u_shadowmap_0=t9.ShadowMap0,this._uniformValues.u_shadowmap_1=t9.ShadowMap0+1,this._groundShadowTiles=a.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});let f=a.transform.elevation;for(let e of this._groundShadowTiles){let i={min:0,max:0};if(f){let r=f.getMinMaxForTile(e);r&&(i=r)}this.addShadowReceiver(e.toUnwrapped(),i.min,i.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(e){this._enabled=e}drawShadowPass(i,r){if(!this.enabled)return;let a=this.painter,n=a.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(a.transform.getFrustum(0),a.transform.worldSize,this._cascades),n.viewport.set([0,0,ia.shadowMapResolution,ia.shadowMapResolution]);for(let o=0;o<this._numCascadesToRender;++o)for(let s of(a.currentShadowCascade=o,n.bindFramebuffer.set(this._cascades[o].framebuffer.framebuffer),n.clear({color:e.aj.white,depth:1}),i.order)){let e=i._mergedLayers[s];if(!e.hasShadowPass()||e.isHidden(a.transform.zoom))continue;let n=i.getLayerSourceCache(e),o=n?r[n.id]:void 0;("model"===e.type||o&&o.length)&&a.renderLayer(a,n,e,o)}a.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;let e=this.painter,i=e.style,r=e.context,a=i.directionalLight,n=i.ambientLight;if(!a||!n)return;let o=[],s=ir(e,e.longestCutoffRange);s.shouldRenderCutoff&&o.push("RENDER_CUTOFF"),o.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&o.push("NORMAL_OFFSET");let l=ic(i,a,n),h=new t0(r.gl.LEQUAL,t0.ReadOnly,e.depthRangeFor3D);for(let i of this._groundShadowTiles){let a=i.toUnwrapped(),n=e.isTileAffectedByFog(i),u=e.getOrCreateProgram("groundShadow",{defines:o,overrideFog:n});this.setupShadows(a,u),e.uploadCommonUniforms(r,u,a,null,s);let c={u_matrix:e.transform.calculateProjMatrix(a),u_ground_shadow_factor:l};u.draw(e,r.gl.TRIANGLES,h,t1.disabled,tQ.multiply,t2.disabled,c,"ground_shadow",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,{},e.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?tQ.unblended:tQ.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(i){let r=this.painter.transform,a=r.calculatePosMatrix(i,r.worldSize);return e.ab.mat4.multiply(a,this._cascades[this.painter.currentShadowCascade].matrix,a),Float32Array.from(a)}calculateShadowPassMatrixFromMatrix(i){return e.ab.mat4.multiply(i,this._cascades[this.painter.currentShadowCascade].matrix,i),Float32Array.from(i)}setupShadows(i,r,a,n=0){if(!this.enabled)return;let o=this.painter.transform,s=this.painter.context,l=s.gl,h=this._uniformValues,u=new Float64Array(16),c=o.calculatePosMatrix(i,o.worldSize);for(let i=0;i<this._cascades.length;i++)e.ab.mat4.multiply(u,this._cascades[i].matrix,c),h[0===i?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(u),s.activeTexture.set(l.TEXTURE0+t9.ShadowMap0+i),this._cascades[i].texture.bind(l.NEAREST,l.CLAMP_TO_EDGE);if(this.useNormalOffset=!!a,this.useNormalOffset){let r=e.cc(i.canonical),s=2/o.tileSize*e.ag/ia.shadowMapResolution,l=s*this._cascades[0].boundingSphereRadius,u=s*this._cascades[this._cascades.length-1].boundingSphereRadius,c=("vector-tile"===a?1:3)/Math.pow(2,n-i.canonical.z-(1-o.zoom+Math.floor(o.zoom)));h.u_shadow_normal_offset=[r,l*c,u*c],h.u_shadow_bias=[6e-5,.0012,.012]}else h.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(s,h)}setupShadowsFromMatrix(i,r,a=!1){if(!this.enabled)return;let n=this.painter.context,o=n.gl,s=this._uniformValues,l=new Float64Array(16);for(let r=0;r<ia.cascadeCount;r++)e.ab.mat4.multiply(l,this._cascades[r].matrix,i),s[0===r?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(l),n.activeTexture.set(o.TEXTURE0+t9.ShadowMap0+r),this._cascades[r].texture.bind(o.NEAREST,o.CLAMP_TO_EDGE);if(this.useNormalOffset=a,a){let e=ia.normalOffset;s.u_shadow_normal_offset=[1,e,e],s.u_shadow_bias=[6e-5,.0012,.012]}else s.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(n,s)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(i,r,a,n){if(n[2]>=0)return{};let o=(function(i,r,a){let n=a/(1<<i.canonical.z);return new e.cd([i.canonical.x*n+i.wrap*a,i.canonical.y*n+i.wrap*a,0],[(i.canonical.x+1)*n+i.wrap*a,(i.canonical.y+1)*n+i.wrap*a,r])})(i,r,a).getCorners(),s=-(r/n[2]);n[0]<0?(e.ab.vec3.add(o[0],o[0],[n[0]*s,0,0]),e.ab.vec3.add(o[3],o[3],[n[0]*s,0,0])):n[0]>0&&(e.ab.vec3.add(o[1],o[1],[n[0]*s,0,0]),e.ab.vec3.add(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(e.ab.vec3.add(o[0],o[0],[0,n[1]*s,0]),e.ab.vec3.add(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(e.ab.vec3.add(o[2],o[2],[0,n[1]*s,0]),e.ab.vec3.add(o[3],o[3],[0,n[1]*s,0]));let l={};return l.vertices=o,l.planes=[ih(o[1],o[0],o[4]),ih(o[2],o[1],o[5]),ih(o[3],o[2],o[6]),ih(o[0],o[3],o[7])],l}addShadowReceiver(i,r,a){this._receivers.add(i,e.cd.fromTileIdAndHeight(i,r,a))}getMaxCascadeForTile(e){let i=this._receivers.get(e);return i&&i.lastCascade?i.lastCascade:0}}function ih(i,r,a){let n=e.ab.vec3.sub([],a,r),o=e.ab.vec3.sub([],i,r),s=e.ab.vec3.cross([],n,o),l=e.ab.vec3.length(s);return 0===l?[0,0,1,0]:(e.ab.vec3.scale(s,s,1/l),[s[0],s[1],s[2],-e.ab.vec3.dot(s,r)])}function iu(i){let r=i.properties.get("direction"),a=e.cb(r.x,r.y,r.z);
8a[2]=e.aw(a[2],0,75);let n=e.ce([a[0],a[1],a[2]]);return e.ab.vec3.fromValues(n.x,n.y,n.z)}function ic(i,r,a){let n="none"===r.properties.get("color-use-theme"),o=r.properties.get("color"),s=r.properties.get("intensity"),l=r.properties.get("direction"),h=[l.x,l.y,l.z],u="none"===a.properties.get("color-use-theme"),c=a.properties.get("color"),d=a.properties.get("intensity"),p=Math.max(e.ab.vec3.dot([0,0,1],h),0),f=[0,0,0];e.ab.vec3.scale(f,c.toRenderColor(u?null:i.getLut(r.scope)).toArray01Linear().slice(0,3),d);let m=[0,0,0];return e.ab.vec3.scale(m,o.toRenderColor(n?null:i.getLut(a.scope)).toArray01Linear().slice(0,3),p*s),e.cf([f[0]>0?f[0]/(f[0]+m[0]):0,f[1]>0?f[1]/(f[1]+m[1]):0,f[2]>0?f[2]/(f[2]+m[2]):0])}class id extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.numModelsLoading={}}loadModel(i,r){return e.aM(this.requestManager.transformRequest(r,e.R.Model).url).then(r=>{if(!r)return;let a=e.aN(r),n=new e.aO(i,void 0,void 0,a);return n.computeBoundsAndApplyParent(),n}).catch(a=>{if(a&&404===a.status)return null;this.fire(new e.y(Error(`Could not load model ${i} from ${r}: ${a.message}`)))})}load(i,r){this.models[r]||(this.models[r]={});let a=Object.keys(i);this.numModelsLoading[r]=(this.numModelsLoading[r]||0)+a.length;let n=[];for(let e of a)n.push(this.loadModel(e,i[e]));Promise.allSettled(n).then(i=>{for(let e=0;e<i.length;e++){let{status:n,value:o}=i[e];"fulfilled"===n&&o&&(this.models[r][a[e]]={model:o,numReferences:1})}this.numModelsLoading[r]-=a.length,this.fire(new e.z("data",{dataType:"style"}))}).catch(i=>{this.fire(new e.y(Error(`Could not load models: ${i.message}`)))})}isLoaded(){for(let e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,i){return!!this.getModel(e,i)}getModel(e,i){return this.models[i]||(this.models[i]={}),this.models[i][e]?this.models[i][e].model:void 0}
8addModel(e,i,r){this.models[r]||(this.models[r]={}),this.hasModel(e,r)&&this.models[r][e].numReferences++,this.load({[e]:this.requestManager.normalizeModelURL(i)},r)}addModels(e,i){this.models[i]||(this.models[i]={});let r={};for(let a in e)this.models[i][a]={},r[a]=this.requestManager.normalizeModelURL(e[a]);this.load(r,i)}addModelsFromBucket(e,i){this.models[i]||(this.models[i]={});let r={};for(let a of e)this.hasModel(a,i)?this.models[i][a].numReferences++:r[a]=this.requestManager.normalizeModelURL(a);this.load(r,i)}removeModel(e,i){if(this.models[i]&&this.models[i][e]&&(this.models[i][e].numReferences--,0===this.models[i][e].numReferences)){let r=this.models[i][e].model;delete this.models[i][e],r.destroy()}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,i){for(let r in this.models[i]||(this.models[i]={}),this.models[i])this.models[i][r].model&&this.models[i][r].model.upload(e.context)}}let ip=new e.a5({data:new e.a6(e.a3.colorTheme.data)}),im={"mbx-indoor-active-floorplans":{default:["literal",[]]},"mbx-indoor-underground":{default:["literal",!1]},"mbx-indoor-loaded-levels":{default:["literal",[]]},"mbx-indoor-level-height":{default:["literal",{}]},"mbx-indoor-level-base":{default:["literal",{}]},"mbx-indoor-level-selected":{default:["literal",{}]},"mbx-indoor-level-overlapped":{default:["literal",{}]}};function i_(e){return Object.assign(e=e||{},im)}class ig extends e.E{constructor(i){super(),this.mergeFloors=!0,this._scope=void 0,this._queryFeatureSetId=void 0,this._buildingEntryFeatureSetId=void 0,this._selectedFloorplan=void 0,this._indoorData=void 0,this._selectedLevel=void 0,this._floorplanStates={},e.aP(["_onLoad","_onMove","_checkFloorplanVisible"],this),this._map=i,this._checkFloorplanVisible(!0),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=void 0}_onLoad(){this._map.style.forEachFragmentStyle(i=>{i.stylesheet.indoor&&(this._queryFeatureSetId?this.fire(new e.y(Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._queryFeatureSetId=i.stylesheet.indoor.floorplanFeaturesetId,this._buildingEntryFeatureSetId=i.stylesheet.indoor.buildingFeaturesetId,this._scope=i.scope))}),this._queryFeatureSetId&&this._buildingEntryFeatureSetId&&this._map.addInteraction("mbx-indoor-buildingclick",{type:"click",target:{featuresetId:this._buildingEntryFeatureSetId,importId:this._scope},handler:e=>(e.feature&&e.feature.properties.floorplan&&this.selectFloorplan(e.feature.properties.floorplan),!0)}),this._checkFloorplanVisible(!0)}_onMove(){this._checkFloorplanVisible(!1)}_checkFloorplanVisible(i){if(!this._queryFeatureSetId||!this._map.isStyleLoaded()||this._map.transform.zoom<13)return;this._indoorData&&!function(e,i){let[r,a]=e,{center:n,radius:o}=i,[s,l]=n,h=Math.abs(r-s);return Math.sqrt((h>180?360-h:h)**2+(a-l)**2)<=o}([this._map.getCenter().lng,this._map.getCenter().lat],this._indoorData.circumCircle)&&(this._indoorData=void 0,this._selectedFloorplan=void 0,this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[]]),this.fire(new e.z("floorplangone")));let r={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},a=new e.P(this._map.transform.width/2,this._map.transform.height/2),n=[new e.P(0,0),new e.P(this._map.transform.width,this._map.transform.height)],o=this._map.queryRenderedFeatures(i?n:a,r);o.length>0&&(this._selectedFloorplan&&o[0].properties.id===this._selectedFloorplan.properties.id||(this._selectedFloorplan=o[0],this._floorplanSelected(!1)))}_floorplanSelected(i){let r;this._indoorData=JSON.parse(this._selectedFloorplan.properties["indoor-data"]),this._indoorData.id=this._selectedFloorplan.properties.id,this._indoorData.circumCircle=function(e){let[[i,r],[a,n]]=e,o=(a-i+360)%360,s=o>180?360-o:o;return{center:[(i+s/2+360)%360,(r+n)/2],radius:Math.sqrt(s**2+(n-r)**2)/2}}
8(this._indoorData.extent),this._floorplanStates[this._indoorData.id]||(this._floorplanStates[this._indoorData.id]={});let a=this._floorplanStates[this._indoorData.id].selectedBuilding,n=this._floorplanStates[this._indoorData.id].selectedLevel;if(this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",this._indoorData.floorplanIDs),this._selectedLevel)for(let e of this._indoorData.levels)e.id===this._selectedLevel.id&&(r=e.id);if(this.fire(new e.z("floorplanselected",{buildings:this._indoorData.buildings,levels:this._indoorData.levels,selectedLevelId:r})),a){let e=this._indoorData.buildings.find(e=>e.id===a);this._buildingSelected(e,!1)}else this._indoorData.buildings.length>0&&this._buildingSelected(this._indoorData.buildings[0],!1);if(n){let e=this._indoorData.levels.find(e=>e.id===n);this._updateLevels(e,i)}else i&&this._indoorData["default-levels"].length>0&&this.selectLevel(this._indoorData["default-levels"][0])}_buildingSelected(i,r){r&&i&&i.extent&&this._map.fitBounds(i.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),this._floorplanStates[this._indoorData.id].selectedBuilding=i?i.id:void 0;let a=this._indoorData.levels.filter(e=>i.levels.includes(e.id));this.fire(new e.z("buildingselected",{buildingId:i.id,levels:a}))}_levelSelected(i){if("overview"===i)this._updateLevels(void 0,!0);else{let e=this._indoorData.levels.find(e=>e.id===i);this._updateLevels(e,!0)}this.fire(new e.z("levelselected",{levelId:"overview"===i?void 0:i}))}_updateLevels(e,i){if(!e)return this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",[]]),this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._floorplanStates[this._indoorData.id].selectedLevel=void 0,void(i&&this._indoorData.extent&&this._map.fitBounds(this._indoorData.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}));function r(e){let i=e.indexOf("/floor/");if(-1===i)return e;let r=i+7,a=e.indexOf("/",r);return -1===a?e.slice(r):e.slice(r,a)}this._selectedLevel=e,this._floorplanStates[this._indoorData.id].selectedLevel=e?e.id:void 0;let a=[],n={},o={},s={},l={};for(let i of this._indoorData.levels)if(a.push(i.id),n[i.id]=i.height,o[i.id]=i.base,e){if(this.mergeFloors){let a=r(e.id),n=r(i.id);s[i.id]=n===a?"true":"false"}else s[i.id]=i.id===e.id?"true":"false";l[i.id]=i.base<e.base?"true":"false"}else l[i.id]=!0;if(this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",a]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-height",["literal",n]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-base",["literal",o]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",s]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-overlapped",["literal",l]),e&&(this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!!e.isUnderground),i&&e.extent)){let i=this._map.cameraForBounds(e.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),r=this._map.getZoom(),a=i.zoom?Math.abs(r-i.zoom):0;this._map.fitBounds(e.extent,a>=1?{pitch:this._map.getPitch(),bearing:this._map.getBearing()}:{pitch:this._map.getPitch(),bearing:this._map.getBearing(),zoom:r})}}selectFloorplan(i){let r={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},a=[new e.P(0,0),new e.P(this._map.transform.width,this._map.transform.height)],n=this._map.queryRenderedFeatures(a,r);if(n.length>0){for(let e of n)if(JSON.parse(e.properties["indoor-data"]).floorplanIDs.includes(i)){this._selectedFloorplan=e,this._floorplanSelected(!0);break}}}selectBuilding(e){let i=this._indoorData.buildings.find(i=>i.id===e);this._buildingSelected(i,!0)}selectLevel(e){this._levelSelected(e)}}let iy=(e,i)=>eI(e,i&&i.filter(e=>"source.canvas"!==e.identifier)),ix=e.ay(ts,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport"]),iv=e.ay(ts,["setCenter","setZoom","setBearing","setP
8itch"]),ib=new Set(["background","sky","slot","custom"]),iw={version:8,layers:[],sources:{}},iT={duration:300,delay:0};class iS extends e.E{constructor(i,r={}){super(),this.map=i,this.scope=r.scope||"",this.globalId=null,this.fragments=[],this.importDepth=r.importDepth||0,this.importsCache=r.importsCache||new Map,this.resolvedImports=r.resolvedImports||new Set,this.transition=e.l({},iT),this._buildingIndex=new tn(this),this.crossTileSymbolIndex=new tJ,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=r.styleChanges||new q,this.dispatcher=r.dispatcher?r.dispatcher:new e.D(e.ci(),this),r.imageManager?this.imageManager=r.imageManager:(this.imageManager=new Z(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=r.glyphManager?r.glyphManager:new e.cj(i._requestManager,r.localFontFamily?e.ck.all:r.localIdeographFontFamily?e.ck.ideographs:e.ck.none,r.localFontFamily||r.localIdeographFontFamily),r.modelManager?this.modelManager=r.modelManager:(this.modelManager=new id(i._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=r.configOptions?r.configOptions:new Map,this._configDependentLayers=r.configDependentLayers?r.configDependentLayers:new Set,this._config=r.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:r.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=r.initialConfig,this.dispatcher.broadcast("setReferrer",e.cl());let a=this;this._rtlTextPluginCallback=iS.registerForPluginStateChange(i=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:i.pluginStatus,pluginURL:i.pluginURL},(i,r)=>{if(e.cm(i),r&&r.every(e=>e))for(let e in a._sourceCaches){let i=a._sourceCaches[e],r=i.getSource().type;"vector"!==r&&"geojson"!==r||i.reload()}})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let i=this.getOwnSource(e.sourceId);if(i&&i.vectorLayerIds)for(let e in this._layers){let r=this._layers[e];r.source===i.id&&this._validateLayer(r)}})}load(e){return e&&("string"==typeof e?this.loadURL(e):this.loadJSON(e)),this}_getGlobalId(i){if(!i)return null;if("string"==typeof i){if(e.f(i))return i;let r=e.cn(i);if(!r.startsWith("http"))try{return new URL(r,location.href).toString()}catch(e){}return r}return`json://${e.co(JSON.stringify(i))}`}_diffStyle(i,r,a){this.globalId=this._getGlobalId(i);let n=(e,i)=>{try{i(null,this.setState(e,a))}catch(e){i(e,!1)}};if("string"==typeof i){let a=this.map._requestManager.normalizeStyleURL(i),o=this.map._requestManager.transformRequest(a,e.R.Style);e.n(o,(i,a)=>{i?this.fire(new e.y(i)):a&&n(a,r)})}else"object"==typeof i&&n(i,r)}loadURL(i,r={}){this.fire(new e.z("dataloading",{dataType:"style"}));let a="boolean"==typeof r.validate?r.validate:!e.f(i);this.globalId=this._getGlobalId(i),i=this.map._requestManager.normalizeStyleURL(i,r.accessToken),this.resolvedImports.add(i);let n=this.importsCache.get(i);if(n)return this._load(n,a);let o=this.map._requestManager.transformRequest(i,e.R.Style);this._request=e.n(o,(r,n)=>{if(this._request=null,r)this.fire(new e.y(r));else if(n)return this.importsCache.set(i,n),this._load(n,a)})}loadJSON(i,r={}){this.fire(new e.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(i),this._request=e.q.frame(()=>{this._request=null,this._load(i,!1!==r.validate)})}loadEmpty(){this.fire(new e.z("dataloading",{dataType:"style"})),this._load(iw,!1)}_loadImports(i,r,a){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();let n=[];for(let e of i){let i=this._createFragmentStyle(e),o=new Promise(e=>{i.once("style.import.load",e),i.once("error",e)}).then(()=>this.mergeAll());if(n.push(o),this.resolvedImports.has(e.url)){i.loadEmpty();continue}let s=e.data||this.importsCache.get(e.url);s?(i.loadJSON(s,{validate:r}),this._isInternalStyle(s)&&(i.globalId=null)):e.url?i.loadURL(e.url,{validate:r}):i.loadEmpty();let l={style:i,id:e.id,config:e.config};if(a){let e=this.fragments.findIndex(({id:e})=>e===a);this.fragments=this.fragments.slice(0,e).concat(l).concat(this.fragments.slice(e))}else this.fragments.push(l)}return Promise.allSettled(n)}getImportGlobalIds(e=this,i=new Set){for(let r of e.fragments)r.style.globalId&&i.add(r.style.globalId),this.getImportGlobalIds(r.style,i);return[...i.values()]}_createFragmentStyle(i){let r;let a=this.scope?e.aC(i.id,this.scope):i.id,n=this._initialConfig&&this._initialConfig[a];(i.config||n)&&(r=e.l({},i.config,n));let o=new iS(this.map,{scope:a,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:r,configOptions:this.options,colorThemeOverride:i["color-theme"],configDependentLayers:this._configDependentLayers});return o.setEventedParent(this.map,{style:o}),o}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(i,r){let a=i.indoor?i_(i.schema):i.schema;if(this._isInternalStyle(i)){let a=e.l({},iw,{imports:[{id:"basemap",data:i,url:""}]});return void this._load(a,r)}if(this.updateConfig(this._config,a),r&&iy(this,ef(i)))return;this._loaded=!0,this.stylesheet=e.cp(i);let n=()=>{for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1,isInitialLoad:!0});i.sprite?this._loadIconset(i.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(i.glyphs,this.scope);
8let a=to(this.stylesheet.layers);if(this._order=a.map(e=>e.id),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights){if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){let e=this.stylesheet.lights[0];this.light=new eC(e.properties,e.id)}else this.setLights(this.stylesheet.lights)}for(let i of(this.light||(this.light=new eC(this.stylesheet.light)),this._layers={},a)){let r=e.cu(i,this.scope,this._styleColorTheme.lut,this.options);0!==r.configDependencies.size&&this._configDependentLayers.add(r.fqid),r.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=r;let a=this.getOwnLayerSourceCache(r),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&r.canCastShadows()&&n&&(a.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);let n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(n,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.z("data",{dataType:"style"}));let o=this.isRootStyle();i.imports?this._loadImports(i.imports,r).then(()=>{this._reloadImports(),this.fire(new e.z(o?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new e.z(o?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];let o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(o){let i=this._evaluateColorThemeData(o);this._loadColorTheme(i).then(()=>{n()}).catch(i=>{e.w(`Couldn't load color theme from the stylesheet: ${i}`),n()})}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}mergeAll(){let i,r,a,n,o,s,l,h,u,c;let d={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(e=>{if(e.stylesheet){if(null!=e.light&&(i=e.light),e.stylesheet.lights)for(let i of e.stylesheet.lights)"ambient"===i.type&&null!=e.ambientLight&&(r=e.ambientLight),"directional"===i.type&&null!=e.directionalLight&&(a=e.directionalLight);n=this._prioritizeTerrain(n,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(o=e.fog),e.stylesheet.snow&&null!=e.snow&&(s=e.snow),e.stylesheet.rain&&null!=e.rain&&(l=e.rain),null!=e.stylesheet.camera&&(c=e.stylesheet.camera),null!=e.stylesheet.projection&&(h=e.stylesheet.projection),null!=e.stylesheet.transition&&(u=e.stylesheet.transition),d[e.scope]=e._styleColorTheme}}),this.light=i,this.ambientLight=r,this.directionalLight=a,this.fog=o,this.snow=s,this.rain=l,this._styleColorThemeForScope=d,null===n?delete this.terrain:this.terrain=n,this.camera=c||{"camera-projection":"perspective"},this.projection=h||{name:"mercator"},this.transition=e.l({},iT,u),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){let i=r=>{for(let e of r.fragments)i(e.style);e(r)};i(this)}_prioritizeTerrain(e,i,r){let a=e&&0===e.drapeRenderMode;return null===r?i&&0===i.drapeRenderMode?i:a?e:null:null!=i&&(!e||a||i&&1===i.drapeRenderMode)?i:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(i=>{e=this._prioritizeTerrain(e,i.terrain,i.stylesheet.terrain)}),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle(i=>{null!=i.stylesheet.projection&&(e=i.stylesheet.projection)}),this.projection=e||{name:"mercator"}}mergeSources(){let i={},r={},a={};this.forEachFragmentStyle(n=>{for(let r in n._sourceCaches)i[e.aC(r,n.scope)]=n._sourceCaches[r];for(let i in n._otherSourceCaches)r[e.aC(i,n.scope)]=n._otherSourceCaches[i];for(let i in n._symbolSourceCaches)a[e.aC(i,n.scope)]=n._symbolSourceCaches[i]}),this._mergedSourceCaches=i,this._mergedOtherSourceCaches=r,this._mergedSymbolSourceCaches=a}mergeLayers(){let i={},r=[],a={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(a=>{for(let n of a._order){let o=a._layers[n];if("slot"===o.type){let r=e.cq(n);if(i[r])continue;i[r]=[]}o.slot&&i[o.slot]?i[o.slot].push(o):r.push(o)}}),this._mergedOrder=[];let n=(r=[])=>{for(let o of r)if("slot"===o.type){let r=e.cq(o.id);i[r]&&n(i[r]),this._mergedSlots.push(r)}else{let i=e.aC(o.id,o.scope);this._mergedOrder.push(i),a[i]=o,o.is3D()&&(this._has3DLayers=!0),"circle"===o.type&&(this._hasCircleLayers=!0),"symbol"===o.type&&(this._hasSymbolLayers=!0),"clip"===o.type&&(this._clipLayerPresent=!0)}};n(r),this._mergedOrder.sort((e,i)=>{let r=a[e],n=a[i];return r.hasInitialOcclusionOpacityProperties?n.is3D()?1:0:r.is3D()&&n.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=a,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=e.l({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(i){return i.data?(function(i,r,a){let n=e.l({},r);for(let i of Object.keys(e.a3.colorTheme))void 0===n[i]&&(n[i]=e.a3.colorTheme[i].default);let o=new e.a4(ip,i,new Map(a));return o.setTransitionOrValue(n,a),o.untransitioned().possiblyEvaluate(new e.a8(0))})(this.scope,i,this.options).get("data"):null}_loadColorTheme(i){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;let r=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((a,n)=>{let o="data:image/png;base64,";if(!i||0===i.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void a();let s=i;s.startsWith(o)||(s=o+s);let l="mapbox-reserved-lut",h=new Image;h.src=s,h.onerror=()=>{this._styleColorTheme.lutLoading=!1,n(Error("Failed to load image data"))},h.onload=()=>
8{if(this._styleColorTheme.lutLoadingCorrelationID!==r)return void a();this._styleColorTheme.lutLoading=!1;let{width:o,height:s,data:u}=e.q.getImageData(h);if(s>32)return void n(Error("The height of the image must be less than or equal to 32 pixels."));if(o!==s*s)return void n(Error("The width of the image must be equal to the height squared."));this.getImage(l)&&this.removeImage(l),this.addImage(l,{data:new e.r({width:o,height:s},u),pixelRatio:1,sdf:!1,usvg:!1,version:0});let c=this.imageManager.getImage(l,this.scope);c?(this._styleColorTheme.lut={image:c.data,data:i},a()):n(Error("Missing LUT image."))}})}getLut(e){let i=this._styleColorThemeForScope[e];return i?i.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(i){this._spriteRequest=function(i,r,a){let n,o,s;let l=e.q.devicePixelRatio>1?"@2x":"",h=e.n(r.transformRequest(r.normalizeSpriteURL(i,l,".json"),e.R.SpriteJSON),(e,i)=>{h=null,s||(s=e,n=i,c())}),u=e.o(r.transformRequest(r.normalizeSpriteURL(i,l,".png"),e.R.SpriteImage),(e,i)=>{u=null,s||(s=e,o=i,c())});function c(){if(s)a(s);else if(n&&o){let i=e.q.getImageData(o),r={};for(let a in n){let{width:o,height:s,x:l,y:h,sdf:u,pixelRatio:c,stretchX:d,stretchY:p,content:f}=n[a],m=new e.r({width:o,height:s});e.r.copy(i,m,{x:l,y:h},{x:0,y:0},{width:o,height:s},null),r[a]={data:m,pixelRatio:c,sdf:u,stretchX:d,stretchY:p,content:f,usvg:!1}}a(null,r)}}return{cancel(){h&&(h.cancel(),h=null),u&&(u.cancel(),u=null)}}}(i,this.map._requestManager,(i,r)=>{if(this._spriteRequest=null,i)this.fire(new e.y(i));else if(r)for(let e in r)this.imageManager.addImage(e,this.scope,r[e]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.z("data",{dataType:"style"}))})}_loadIconset(i){var r,a;if(!e.f(i)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(i);let n="auto"===this.map._spriteFormat;this._spriteRequest=(a=(r,a)=>{if(this._spriteRequest=null,r)n?this._loadSprite(i):this.fire(new e.y(r));else if(a)for(let e in a)this.imageManager.addImage(e,this.scope,a[e]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.z("data",{dataType:"style"}))},e.bi((r=this.map._requestManager).transformRequest(r.normalizeIconsetURL(i),e.R.Iconset),(i,r)=>{if(i)return void a(i);let n={};for(let i of e.cg(new e.bh(r)).icons){let r={version:1,pixelRatio:e.q.devicePixelRatio,content:function(e){if(!e.metadata||!e.metadata.content_area)return;let{left:i,top:r,width:a,height:n}=e.metadata.content_area;return[i,r,i+a,r+n]}(i),stretchX:i.metadata?i.metadata.stretch_x_areas:void 0,stretchY:i.metadata?i.metadata.stretch_y_areas:void 0,sdf:!1,usvg:!0,icon:i};n[i.name]=r}a(null,n)}))}_validateLayer(i){let r=this.getOwnSource(i.source);if(!r)return;let a=i.sourceLayer;a&&("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(a))&&this.fire(new e.y(Error(`Source layer "${a}" does not exist on source "${r.id}" as specified by style layer "${i.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(let e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(let{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((e,i)=>{let r=this.fragments[i];return r&&r.style&&(e.data=r.style.serialize()),e})}_serializeSources(){let e={};for(let i in this._sourceCaches){let r=this._sourceCaches[i].getSource();e[r.id]||(e[r.id]=r.serialize())}return e}_serializeLayers(e){let i=[];for(let r of e){let e=this._layers[r];e&&"custom"!==e.type&&i.push(e.serialize())}return i}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(let e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}_checkLayer(i){let r=this.getOwnLayer(i);if(r)return r;this.fire(new e.y(Error(`The layer '${i}' does not exist in the map's style.`)))}_checkSource(i){let r=this.getOwnSource(i);if(r)return r;this.fire(new e.y(Error(`The source '${i}' does not exist in the map's style.`)))}precompilePrograms(e,i){let r=this.map.painter;if(r)for(let a=e.minzoom||0;a<(e.maxzoom||25.5);a++){let a=e.getProgramIds();if(a)for(let n of a){let a=e.getDefaultProgramParams(n,i.zoom,this._styleColorTheme.lut);a&&(r.style=this,this.fog&&(r._fogVisible=!0,a.overrideFog=!0,r.getOrCreateProgram(n,a)),r._fogVisible=!1,a.overrideFog=!1,r.getOrCreateProgram(n,a),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(a.overrideRtt=!0,r.getOrCreateProgram(n,a)))}}}update(i){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(i),this.directionalLight&&this.directionalLight.recalculate(i);let r=this.calculateLightsBrightness();i.brightness=r||0,r!==this._brightness&&(this._brightness=r,this.dispatcher.broadcast("setBrightness",r));let a=this._changes.isDirty(),n=!1;if(this._changes.isDirty()){let e=this._changes.getLayerUpdatesByScope();for(let i in e){let{updatedIds:r,removedIds:a}=e[i];(r||a)&&(this._updateWorkerLayers(i,r,a),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(i),this.light&&this.light.updateTransitions(i),this.ambientLight&&this.ambientLight.updateTransitions(i),this.directionalLight&&this.directionalLight.updateTransitions(i),this.fog&&this.fog.updateTransitions(i),this.snow&&this.snow.updateTransitions(i),this.rain&&this.rain.updateTransitions(i),this._changes.reset()}let o={};for(let e in this._mergedSourceCaches){let i=this._mergedSourceCaches[e];o[e]=i.used,i.used=!1,i.tileCoverLift=0}for(let e of this._mergedOrder){let r=this._mergedLayers[e];if(r.recalculate(i,this._availableImages),!r.isHidden(i.zoom)){let e=this.getLayerSourceCache(r);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,r.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
8{this.precompilePrograms(r,i)}):this.precompilePrograms(r,i))}for(let i in this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&n&&this.mergeLayers(),o){let r=this._mergedSourceCaches[i];o[i]!==r.used&&r.getSource().fire(new e.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:r.getSource().id}))}this.light&&this.light.recalculate(i),this.terrain&&this.terrain.recalculate(i),this.fog&&this.fog.recalculate(i),this.snow&&this.snow.recalculate(i),this.rain&&this.rain.recalculate(i),this.z=i.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),a&&this.fire(new e.z("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=this._changes.getUpdatedImages();if(e.length){for(let i in this._sourceCaches)this._sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],e);this._changes.resetUpdatedImages()}}_updateWorkerLayers(e,i,r){let a=this.getFragmentStyle(e);a&&this.dispatcher.broadcast("updateLayers",{layers:i?a._serializeLayers(i):[],scope:e,removedIds:r||[],options:a.options})}setState(i,r){if(this._checkLoaded(),iy(this,ef(i)))return!1;(i=e.cp(i)).layers=to(i.layers);let a=(function(i,r){if(!i)return[{command:ts.setStyle,args:[r]}];let a=[];try{if(!e.bn(i.version,r.version)||(e.bn(i.center,r.center)||a.push({command:ts.setCenter,args:[r.center]}),e.bn(i.zoom,r.zoom)||a.push({command:ts.setZoom,args:[r.zoom]}),e.bn(i.bearing,r.bearing)||a.push({command:ts.setBearing,args:[r.bearing]}),e.bn(i.pitch,r.pitch)||a.push({command:ts.setPitch,args:[r.pitch]}),e.bn(i.sprite,r.sprite)||a.push({command:ts.setSprite,args:[r.sprite]}),e.bn(i.glyphs,r.glyphs)||a.push({command:ts.setGlyphs,args:[r.glyphs]}),e.bn(i.imports,r.imports)||function(i=[],r=[],a){let n,o,s,l;r=r||[];let h=(i=i||[]).map(tc),u=r.map(tc),c=i.reduce(td,{}),d=r.reduce(td,{}),p=h.slice();for(n=0,o=0;n<h.length;n++)s=h[n],d.hasOwnProperty(s)?o++:(a.push({command:ts.removeImport,args:[s]}),p.splice(p.indexOf(s,o),1));for(n=0,o=0;n<u.length;n++)s=u[u.length-1-n],p[p.length-1-n]!==s&&(c.hasOwnProperty(s)?(a.push({command:ts.removeImport,args:[s]}),p.splice(p.lastIndexOf(s,p.length-o),1)):o++,l=p[p.length-n],a.push({command:ts.addImport,args:[d[s],l]}),p.splice(p.length-n,0,s));for(let i of r){let r=c[i.id];r&&!e.bn(r,i)&&a.push({command:ts.updateImport,args:[i.id,i]})}}(i.imports,r.imports,a),e.bn(i.transition,r.transition)||a.push({command:ts.setTransition,args:[r.transition]}),e.bn(i.light,r.light)||a.push({command:ts.setLight,args:[r.light]}),e.bn(i.fog,r.fog)||a.push({command:ts.setFog,args:[r.fog]}),e.bn(i.snow,r.snow)||a.push({command:ts.setSnow,args:[r.snow]}),e.bn(i.rain,r.rain)||a.push({command:ts.setRain,args:[r.rain]}),e.bn(i.projection,r.projection)||a.push({command:ts.setProjection,args:[r.projection]}),e.bn(i.lights,r.lights)||a.push({command:ts.setLights,args:[r.lights]}),e.bn(i.camera,r.camera)||a.push({command:ts.setCamera,args:[r.camera]}),!e.bn(i["color-theme"],r["color-theme"])))return[{command:ts.setStyle,args:[r]}];let n={},o=[];!function(i,r,a,n){let o;for(o in r=r||{},i=i||{})i.hasOwnProperty(o)&&(r.hasOwnProperty(o)||th(o,a,n));for(o in r){var s,l;if(!r.hasOwnProperty(o))continue;let h=r[o];i.hasOwnProperty(o)?e.bn(i[o],h)||("geojson"===i[o].type&&"geojson"===h.type&&function(i,r,a){let n;for(n in i[a])if(i[a].hasOwnProperty(n)&&"data"!==n&&!e.bn(i[a][n],r[a][n]))return!1;for(n in r[a])if(r[a].hasOwnProperty(n)&&"data"!==n&&!e.bn(i[a][n],r[a][n]))return!1;return!0}(i,r,o)?a.push({command:ts.setGeoJSONSourceData,args:[o,h.data]}):(s=o,l=r,th(s,a,n),tl(s,l,a))):tl(o,r,a)}}(i.sources,r.sources,o,n);let s=[];i.layers&&i.layers.forEach(e=>{e.source&&n[e.source]?a.push({command:ts.removeLayer,args:[e.id]}):s.push(e)});let l=i.terrain;l&&n[l.source]&&(a.push({command:ts.setTerrain,args:[void 0]}),l=void 0),a=a.concat(o),e.bn(l,r.terrain)||a.push({command:ts.setTerrain,args:[r.terrain]}),function(i,r,a){let n,o,s,l,h,u,c;r=r||[];let d=(i=i||[]).map(tc),p=r.map(tc),f=i.reduce(td,{}),m=r.reduce(td,{}),_=d.slice(),g=Object.create(null);for(n=0,o=0;n<d.length;n++)s=d[n],m.hasOwnProperty(s)?o++:(a.push({command:ts.removeLayer,args:[s]}),_.splice(_.indexOf(s,o),1));for(n=0,o=0;n<p.length;n++)s=p[p.length-1-n],_[_.length-1-n]!==s&&(f.hasOwnProperty(s)?(a.push({command:ts.removeLayer,args:[s]}),_.splice(_.lastIndexOf(s,_.length-o),1)):o++,u=_[_.length-n],a.push({command:ts.addLayer,args:[m[s],u]}),_.splice(_.length-n,0,s),g[s]=!0);for(n=0;n<p.length;n++)if(l=f[s=p[n]],h=m[s],!g[s]&&!e.bn(l,h)){if(e.bn(l.source,h.source)&&e.bn(l["source-layer"],h["source-layer"])&&e.bn(l.type,h.type)){for(c in tu(l.layout,h.layout,a,s,null,ts.setLayoutProperty),tu(l.paint,h.paint,a,s,null,ts.setPaintProperty),e.bn(l.slot,h.slot)||a.push({command:ts.setSlot,args:[s,h.slot]}),e.bn(l.filter,h.filter)||a.push({command:ts.setFilter,args:[s,h.filter]}),e.bn(l.minzoom,h.minzoom)&&e.bn(l.maxzoom,h.maxzoom)||a.push({command:ts.setLayerZoomRange,args:[s,h.minzoom,h.maxzoom]}),l)l.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&"slot"!==c&&(0===c.indexOf("paint.")?tu(l[c],h[c],a,s,c.slice(6),ts.setPaintProperty):e.bn(l[c],h[c])||a.push({command:ts.setLayerProperty,args:[s,c,h[c]]}));for(c in h)h.hasOwnProperty(c)&&!l.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&"slot"!==c&&(0===c.indexOf("paint.")?tu(l[c],h[c],a,s,c.slice(6),ts.setPaintProperty):e.bn(l[c],h[c])||a.push({command:ts.setLayerProperty,args:[s,c,h[c]]}))}else a.push({command:ts.removeLayer,args:[s]}),u=_[_.lastIndexOf(s)+1],a.push({command:ts.addLayer,args:[h,u]})}}(s,r.layers,a)}catch(e){console.warn("Unable to compute style diff:",e),a=[{command:ts.setStyle,args:[r]}]}return a})(this.serialize(),i).filter(e=>!(e.command in iv));if(0===a.length)return!1;let n=a.filter(e=>!(e.command in ix));if(n.length>0)throw Error(`Unimplemented: ${n.map(e=>e.command).join(", ")}.`);let o=[];
8return a.forEach(e=>{o.push(this[e.command].apply(this,e.args))}),r&&Promise.all(o).then(r),this.stylesheet=i,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(i,r){return this.getImage(i)?this.fire(new e.y(Error("An image with this name already exists."))):(this.imageManager.addImage(i,this.scope,r),this._afterImageUpdated(i),this)}updateImage(e,i,r=!1){this.imageManager.updateImage(e,this.scope,i),r&&this._afterImageUpdated(e)}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(i){return this.getImage(i)?(this.imageManager.removeImage(i,this.scope),this._afterImageUpdated(i),this):this.fire(new e.y(Error("No image with this name exists.")))}_afterImageUpdated(i){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(i),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new e.z("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,i,r={}){return this._checkLoaded(),this._validate(eE,`models.${e}`,i,null,r)||(this.modelManager.addModel(e,i,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(i){return this.hasModel(i)?(this.modelManager.removeModel(i,this.scope),this):this.fire(new e.y(Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(i,r,a={}){if(this._checkLoaded(),void 0!==this.getOwnSource(i))throw Error(`There is already a source with ID "${i}".`);if(!r.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(em,`sources.${i}`,r,null,a))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let n=eJ(i,r,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id}));let o=i=>{let r=(i?"symbol:":"other:")+n.id,a=e.aC(r,this.scope),o=this._sourceCaches[r]=new tt(a,n,i);(i?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=o,o.onAdd(this.map)};o(!1),"vector"!==r.type&&"geojson"!==r.type||o(!0),n.onAdd&&n.onAdd(this.map),a.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(i){this._checkLoaded();let r=this.getOwnSource(i);if(!r)throw Error("There is no source with this ID");for(let r in this._layers)if(this._layers[r].source===i)return this.fire(new e.y(Error(`Source "${i}" cannot be removed while layer "${r}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===i)return this.fire(new e.y(Error(`Source "${i}" cannot be removed while terrain is using it.`)));for(let r of this.getOwnSourceCaches(i)){let i=e.cq(r.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(r.id),r.fire(new e.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:r.getSource().id})),r.setEventedParent(null),r.clearTiles()}return delete this._otherSourceCaches[i],delete this._symbolSourceCaches[i],this.mergeSources(),r.setEventedParent(null),r.onRemove&&r.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,i){this._checkLoaded(),this.getOwnSource(e).setData(i),this._changes.setDirty()}getOwnSource(e){let i=this.getOwnSourceCache(e);return i&&i.getSource()}getOwnSources(){let e=[];for(let i in this._otherSourceCaches){let r=this.getOwnSourceCache(i);r&&e.push(r.getSource())}return e}areTilesLoaded(){let e=this._mergedSourceCaches;for(let i in e){let r=e[i]._tiles;for(let e in r){let i=r[e];if("loaded"!==i.state&&"errored"!==i.state)return!1}}return!0}setLights(i){if(this._checkLoaded(),!i)return delete this.ambientLight,void delete this.directionalLight;let r=this._getTransitionParameters();for(let a of i){if(this._validate(eg,"lights",a))return;switch(a.type){case"ambient":if(this.ambientLight){let e=this.ambientLight;
8e.set(a),e.updateTransitions(r)}else this.ambientLight=new ej(a,eB||(eB=new e.a5({color:new e.a6(e.a3.properties_light_ambient.color),"color-use-theme":new e.a6({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a6(e.a3.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){let e=this.directionalLight;e.set(a),e.updateTransitions(r)}else this.directionalLight=new ej(a,eN||(eN=new e.a5({direction:new e.ak(e.a3.properties_light_directional.direction),color:new e.a6(e.a3.properties_light_directional.color),"color-use-theme":new e.a6({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a6(e.a3.properties_light_directional.intensity),"cast-shadows":new e.a6(e.a3.properties_light_directional["cast-shadows"]),"shadow-quality":new e.a6(e.a3.properties_light_directional["shadow-quality"]),"shadow-intensity":new e.a6(e.a3.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}let a=new e.a8(this.z||0,r);this.ambientLight&&this.ambientLight.recalculate(a),this.directionalLight&&this.directionalLight.recalculate(a),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){let i=this.directionalLight,r=this.ambientLight;if(!i||!r)return;let a=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=i.properties.get("color").toRenderColor(null).toArray01(),o=i.properties.get("intensity"),s=i.properties.get("direction"),l=1-e.cb(s.x,s.y,s.z)[2]/90,h=a(n)*o*l,u=r.properties.get("color").toRenderColor(null).toArray01(),c=r.properties.get("intensity");return Number(((h+a(u)*c)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;let e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(i){if(!i)return this;if(e.cr(i)){let r=e.cs(i),a=this.fragments.find(({id:e})=>e===r);if(!a)throw Error(`Style import '${i}' not found`);let n=e.cq(i);return a.style.getFragmentStyle(n)}{let e=this.fragments.find(({id:e})=>e===i);if(!e)throw Error(`Style import '${i}' not found`);return e.style}}setFeaturesetSelectors(i){if(!i)return;let r={},a=(e,i="")=>`${e}::${i}`;for(let n in this.featuresetSelectors={},i){let o=this.featuresetSelectors[n]=[];for(let s of i[n].selectors){let i;if(s.featureNamespace){let i=this.getOwnLayer(s.layer);if(!i){e.w(`Layer is undefined for selector: ${s.layer}`);continue}let o=a(i.source,i.sourceLayer);if(o in r&&r[o]!==s.featureNamespace){e.w(`"featureNamespace ${s.featureNamespace} of featureset ${n}'s selector is not associated to the same source, skip this selector`);continue}r[o]=s.featureNamespace}if(s.properties)for(let r in s.properties){let a=e.U(s.properties[r]);"success"===a.result&&((i=i||{})[r]=a.value)}o.push({layerId:s.layer,namespace:s.featureNamespace,properties:i})}}}getFeaturesetDescriptors(e){let i=this.getFragmentStyle(e);if(!i||!i.stylesheet.featuresets)return[];let r=[];for(let e in i.stylesheet.featuresets)r.push({featuresetId:e,importId:i.scope?i.scope:void 0});return r}getFeaturesetLayers(i,r){let a=this.getFragmentStyle(r),n=a.stylesheet.featuresets;if(!n||!n[i])return this.fire(new e.y(Error(`The featureset '${i}' does not exist in the map's style and cannot be queried.`))),[];let o=[];for(let e of n[i].selectors){let i=a.getOwnLayer(e.layer);i&&o.push(i)}return o}getConfigProperty(i,r){let a=this.getFragmentStyle(i);if(!a)return null;let n=e.aC(r,a.scope),o=a.options.get(n),s=o?o.value||o.default:null;return s?s.serialize():null}setConfigProperty(i,r,a){let n;let o=this.getFragmentStyle(i);if(!o)return;let s=o.stylesheet.indoor?i_(o.stylesheet.schema):o.stylesheet.schema;if(!s||!s[r])return;let l=e.U(a);if("success"!==l.result)return void iy(this,l.value);let h=l.value.expression,u=e.aC(r,o.scope),c=o.options.get(u);if(!c)return;let{minValue:d,maxValue:p,stepValue:f,type:m,values:_}=s[r],g=e.U(s[r].default);"success"===g.result&&(n=g.value.expression),n?(this.options.set(u,{...c,value:h,default:n,minValue:d,maxValue:p,stepValue:f,type:m,values:_}),this.updateConfigDependencies(r)):this.fire(new e.y(Error(`No schema defined for the config option "${r}" in the "${i}" fragment.`)))}getConfig(i){let r=this.getFragmentStyle(i);if(!r)return null;let a=r.stylesheet.schema;if(!a)return null;let n={};for(let i in a){let a=e.aC(i,r.scope),o=r.options.get(a),s=o?o.value||o.default:null;n[i]=s?s.serialize():null}return n}setConfig(e,i){let r=this.getFragmentStyle(e);r&&(r.updateConfig(i,r.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){let i=this.getFragmentStyle(e);return i?i.stylesheet.schema:null}setSchema(e,i){let r=this.getFragmentStyle(e);r&&(r.stylesheet.schema=i,r.updateConfig(r._config,i),this.updateConfigDependencies())}updateConfig(i,r){if(this._config=i,i||r){if(r)for(let a in r){let n,o;let s=e.U(r[a].default);if("success"===s.result&&(n=s.value.expression),i&&void 0!==i[a]){let r=e.U(i[a]);"success"===r.result&&(o=r.value.expression)}let{minValue:l,maxValue:h,stepValue:u,type:c,values:d}=r[a];if(n){let i=e.aC(a,this.scope);this.options.set(i,{default:n,value:o,minValue:l,maxValue:h,stepValue:u,type:c,values:d})}
8else this.fire(new e.y(Error(`No schema defined for config option "${a}".`)))}else this.fire(new e.y(Error("Attempting to set config for a style without schema.")))}}updateConfigDependencies(e){for(let i of this._configDependentLayers){let r=this.getLayer(i);if(r){if(e&&!r.configDependencies.has(e))continue;r.possiblyEvaluateVisibility(),this._updateLayer(r)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(e=>{let i=e._styleColorTheme.colorThemeOverride?e._styleColorTheme.colorThemeOverride:e._styleColorTheme.colorTheme;if(i){let r=e._evaluateColorThemeData(i);(!e._styleColorTheme.lut&&""!==r||e._styleColorTheme.lut&&r!==e._styleColorTheme.lut.data)&&e.setColorTheme(i)}}),this._changes.setDirty()}addLayer(i,r,a={}){let n;this._checkLoaded();let o=i.id;if(this._layers[o])return void this.fire(new e.y(Error(`Layer with i
8d "${o}" already exists on this map`)));if("custom"===i.type){if(iy(this,e.ct(i)))return;n=e.cu(i,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof i.source&&(this.addSource(o,i.source),i=e.cp(i),i=e.l(i,{source:o})),this._validate(ew,`layers.${o}`,i,{arrayIndex:-1},a))return;n=e.cu(i,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(n),n.setEventedParent(this,{layer:{id:o}})}0!==n.configDependencies.size&&this._configDependentLayers.add(n.fqid);let s=this._order.length;if(r){let i=this._order.indexOf(r);if(-1===i)return void this.fire(new e.y(Error(`Layer with id "${r}" does not exist on this map.`)));n.slot===this._layers[r].slot?s=i:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=n;let l=this.getOwnLayerSourceCache(n),h=!!this.directionalLight&&this.directionalLight.shadowsEnabled();l&&n.canCastShadows()&&h&&(l.castsShadows=!0);let u=this._changes.getRemovedLayer(n);if(u&&n.source&&l&&"custom"!==n.type){this._changes.discardLayerRemoval(n);let i=e.aC(n.source,n.scope);u.type!==n.type?this._changes.updateSourceCache(i,"clear"):(this._changes.updateSourceCache(i,"reload"),l.pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map),n.scope=this.scope,this.mergeLayers()}moveLayer(i,r){this._checkLoaded();let a=this._checkLayer(i);if(!a||i===r)return;let n=this._order.indexOf(i);this._order.splice(n,1);let o=this._order.length;if(r){let i=this._order.indexOf(r);
8if(-1===i)return void this.fire(new e.y(Error(`Layer with id "${r}" does not exist on this map.`)));a.slot===this._layers[r].slot?o=i:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(o,0,i),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();let i=this._checkLayer(e);if(!i)return;i.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),delete this._layers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(i.fqid),this._changes.removeLayer(i);let a=this.getOwnLayerSourceCache(i);if(a&&a.castsShadows){let e=!1;for(let r in this._layers)if(this._layers[r].source===i.source&&this._layers[r].canCastShadows()){e=!0;break}a.castsShadows=e}i.onRemove&&i.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(let i in this._layers)if(this._layers[i].type===e)return!0;return!1}setLayerZoomRange(e,i,r){this._checkLoaded();let a=this._checkLayer(e);a&&(a.minzoom===i&&a.maxzoom===r||(null!=i&&(a.minzoom=i),null!=r&&(a.maxzoom=r),this._updateLayer(a)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,i){this._checkLoaded();let r=this._checkLayer(e);r&&r.slot!==i&&(r.slot=i,this._updateLayer(r))}setFilter(i,r,a={}){this._checkLoaded();let n=this._checkLayer(i);if(n&&!e.bn(n.filter,r))return null==r?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(eT,`layers.${n.id}.filter`,r,{layerType:n.type},a)||(n.filter=e.cp(r),this._updateLayer(n)))}getFilter(i){let r=this._checkLayer(i);if(r)return e.cp(r.filter)}setLayoutProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);if(o&&!e.bn(o.getLayoutProperty(r),a)){if(null!=a&&(!n||!1!==n.validate)&&iy(o,eM.call(ef,{key:`layers.${i}.layout.${r}`,layerType:o.type,objectKey:r,value:a,styleSpec:e.a3,style:{glyphs:!0,sprite:!0}})))return;o.setLayoutProperty(r,a),0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),this._updateLayer(o)}}getLayoutProperty(e,i){let r=this._checkLayer(e);if(r)return r.getLayoutProperty(i)}setPaintProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);if(!o||e.bn(o.getPaintProperty(r),a)||null!=a&&(!n||!1!==n.validate)&&iy(o,eS.call(ef,{key:`layers.${i}.paint.${r}`,layerType:o.type,objectKey:r,value:a,styleSpec:e.a3})))return;let s=o.setPaintProperty(r,a);0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),s&&this._updateLayer(o),this._changes.updatePaintProperties(o)}getPaintProperty(e,i){let r=this._checkLayer(e);if(r)return r.getPaintProperty(i)}setFeatureState(i,r){if(this._checkLoaded(),"target"in i){if("featuresetId"in i.target){let{featuresetId:e,importId:a}=i.target,n=this.getFragmentStyle(a);for(let{source:a,sourceLayer:o}of n.getFeaturesetLayers(e))n.setFeatureState({id:i.id,source:a,sourceLayer:o},r)}else if("layerId"in i.target){let{layerId:e}=i.target,a=this.getLayer(e);this.setFeatureState({id:i.id,source:a.source,sourceLayer:a.sourceLayer},r)}return}let a=i.source,n=i.sourceLayer,o=this._checkSource(a);if(!o)return;let s=o.type;if("geojson"===s&&n)return void this.fire(new e.y(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new e.y(Error("The sourceLayer parameter must be provided for vector source types.")));for(let o of(void 0===i.id&&this.fire(new e.y(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)))o.setFeatureState(n,i.id,r)}removeFeatureState(i,r){if(this._checkLoaded(),"target"in i){if("featuresetId"in i.target){let{featuresetId:e,importId:a}=i.target,n=this.getFragmentStyle(a);for(let{source:a,sourceLayer:o}of n.getFeaturesetLayers(e))n.removeFeatureState({id:i.id,source:a,sourceLayer:o},r)}else if("layerId"in i.target){let{layerId:e}=i.target,a=this.getLayer(e);this.removeFeatureState({id:i.id,source:a.source,sourceLayer:a.sourceLayer},r)}return}let a=i.source,n=this._checkSource(a);if(!n)return;let o=n.type,s="vector"===o?i.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new e.y(Error("The sourceLayer parameter must be provided for vector source types.")));if(r&&"string"!=typeof i.id&&"number"!=typeof i.id)return void this.fire(new e.y(Error("A feature id is required to remove its specific state property.")));for(let e of this.getOwnSourceCaches(a))e.removeFeatureState(s,i.id,r)}getFeatureState(i){if(this._checkLoaded(),"target"in i){let r;if("featuresetId"in i.target){let{featuresetId:a,importId:n}=i.target,o=this.getFragmentStyle(n);for(let{source:n,sourceLayer:s}of o.getFeaturesetLayers(a)){let a=o.getFeatureState({id:i.id,source:n,sourceLayer:s});if(a&&!r)r=a;else if(!e.bn(r,a))return void this.fire(new e.y(Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in i.target){let{layerId:e}=i.target,a=this.getLayer(e);r=this.getFeatureState({id:i.id,source:a.source,sourceLayer:a.sourceLayer})}return r}let r=i.source,a=i.sourceLayer,n=this._checkSource(r);if(n){if("vector"!==n.type||a)return void 0===i.id&&this.fire(new e.y(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(r)[0].getFeatureState(a,i.id);this.fire(new e.y(Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(i){return this.stylesheet.transition=e.l({},this.stylesheet.transition,i),this.transition=this.stylesheet.transition,this}getTransition(){return e.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();let i=this.getTerrain(),r=i&&this.terrain&&this.terrain.scope===this.scope?i:this.stylesheet.terrain;return e.cv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:r,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},e=>void 0!==e)}_updateFilteredLayers(e){for(let i of Object.values(this._mergedLayers))e(i)&&this._updateLayer(i)}_updateLayer(i){this._changes.updateLayer(i);let r=this.getLayerSourceCache(i),a=e.aC(i.source,i.scope),n=this._changes.getUpd
8atedSourceCaches();i.source&&!n[a]&&r&&"raster"!==r.getSource().type&&(this._changes.updateSourceCache(a,"reload"),r.pause()),i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){let i=e=>this._mergedLayers[e].is3D(),r=this.order,a={},n=[];for(let o=r.length-1;o>=0;o--){let s=r[o];if(i(s))for(let i of(a[s]=o,e)){let e=i[s];if(e)for(let i of e)n.push(i)}}n.sort((e,i)=>i.intersectionZ-e.intersectionZ);let o=[];for(let s=r.length-1;s>=0;s--){let l=r[s];if(i(l))for(let e=n.length-1;e>=0;e--){let i=n[e].feature;if(i.layer&&a[i.layer.id]<s)break;o.push(i),n.pop()}else for(let i of e){let e=i[l];if(e)for(let i of e)o.push(i.feature)}}return o}queryRenderedFeatures(i,r,a){let n;r&&!Array.isArray(r)&&r.filter&&(this._validate(eT,"queryRenderedFeatures.filter",r.filter,null,r),n=e.aZ(r.filter));let o={},s=e=>{if(ib.has(e.type))return;let i=this.getOwnLayerSourceCache(e),r=o[i.id]=o[i.id]||{sourceCache:i,layers:{},has3DLayers:!1};e.is3D()&&(r.has3DLayers=!0),r.layers[e.fqid]=r.layers[e.fqid]||{styleLayer:e,targets:[]},r.layers[e.fqid].targets.push({filter:n})};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new e.y(Error("parameters.layers must be an Array."))),[];for(let i of r.layers){let r=this._layers[i];if(!r)return this.fire(new e.y(Error(`The layer '${i}' does not exist in the map's style and cannot be queried for features.`))),[];s(r)}}else for(let e in this._layers)s(this._layers[e]);let l=this._queryRenderedFeatures(i,o,a),h=this._flattenAndSortRenderedFeatures(l),u=[];for(let i of h)e.cs(i.layer.id)===this.scope&&u.push(i);return u}queryRenderedFeatureset(i,r,a){let n;r&&!Array.isArray(r)&&r.filter&&(this._validate(eT,"queryRenderedFeatures.filter",r.filter,null,r),n=e.aZ(r.filter));let o="mock",s=[];if(r&&r.target)s.push({...r,targetId:o,filter:n});else{for(let e of this.getFeaturesetDescriptors())s.push({targetId:o,filter:n,target:e});for(let{style:e}of this.fragments)for(let i of e.getFeaturesetDescriptors())s.push({targetId:o,filter:n,target:i})}let l=this.queryRenderedTargets(i,s,a),h=[];for(let i of l)for(let r of i.variants[o])h.push(new e.cw(i,r));return h}queryRenderedTargets(i,r,a){let n={},o=(e,i,r,a)=>{let o=n[i.id]=n[i.id]||{sourceCache:i,layers:{},has3DLayers:!1};o.layers[e.fqid]=o.layers[e.fqid]||{styleLayer:e,targets:[]},e.is3D()&&(o.has3DLayers=!0),o.layers[e.fqid].targets.push(a?{...r,namespace:a.namespace,properties:a.properties}:r)};for(let i of r)if("featuresetId"in i.target){let{featuresetId:r,importId:a}=i.target,n=this.getFragmentStyle(a),s=n.featuresetSelectors[r];if(!s){this.fire(new e.y(Error(`The featureset '${r}' does not exist in the map's style and cannot be queried for features.`)));continue}for(let e of s){let r=n.getOwnLayer(e.layerId);r&&!ib.has(r.type)&&o(r,n.getOwnLayerSourceCache(r),i,e)}}else if("layerId"in i.target){let{layerId:e}=i.target,r=this.getLayer(e);if(!r||ib.has(r.type))continue;o(r,this.getLayerSourceCache(r),i)}let s=this._queryRenderedFeatures(i,n,a);return this._flattenAndSortRenderedFeatures(s)}_queryRenderedFeatures(e,i,r){let a=[],n=!!this.map._showQueryGeometry,o=eG.createFromScreenPoints(e,r);for(let e in i){let s=function(e,i,r,a,n=!1){let o=i.sourceCache.transform,s=i.sourceCache.tilesIn(e,i.has3DLayers,n);s.sort(eQ);let l=[];for(let e of s){let s=e.tile.queryRenderedFeatures(i,e,r,a,o,n);Object.keys(s).length&&l.push({wrappedTileID:e.tile.tileID.wrapped().key,queryResults:s})}return 0===l.length?{}:function(e){let i={},r={};for(let a of e){let e=a.queryResults,n=a.wrappedTileID,o=r[n]=r[n]||{};for(let r in e){let a=e[r],n=o[r]=o[r]||{},s=i[r]=i[r]||[];for(let e of a)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return i}(l)}(o,i[e],this._availableImages,r,n);Object.keys(s).length&&a.push(s)}if(this.placement)for(let e in i){if(!i[e].sourceCache._onlySymbols)continue;let r=function(e,i,r,a,n){let o={},s=a.queryRenderedSymbols(e),l=[];for(let e of Object.keys(s).map(Number))l.push(n[e]);for(let e of(l.sort(eQ),l)){let a=e.featureIndex.lookupSymbolFeatures(s[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,i,r);for(let i in a){let r=o[i]=o[i]||[],n=a[i];for(let i of(n.sort((i,r)=>{let a=e.featureSortOrder;if(a){let e=a.indexOf(i.featureIndex);return a.indexOf(r.featureIndex)-e}return r.featureIndex-i.featureIndex}),n))r.push(i)}}return o}(o.screenGeometry,i[e],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData);Object.keys(r).length&&a.push(r)}return a}querySourceFeatures(e,i){let r=i&&i.filter;
8r&&this._validate(eT,"querySourceFeatures.filter",r,null,i);let a=[];for(let r of this.getOwnSourceCaches(e))a=a.concat(function(e,i){let r=e.getRenderableIds().map(i=>e.getTileByID(i)),a=[],n={};for(let e=0;e<r.length;e++){let o=r[e],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(a,i))}return a}(r,i));return a}addSourceType(e,i,r){return iS.getSourceType(e)?r(Error(`A source type called "${e}" already exists.`)):(iS.setSourceType(e,i),i.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:i.workerSourceURL},r):r(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(i,r,a={}){this._checkLoaded();let n=this.light.getLight(),o=!1;for(let r in i)if(!e.bn(i[r],n[r])){o=!0;break}if(!o)return;let s=this._getTransitionParameters();this.light.setLight(i,r,a),this.light.updateTransitions(s)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(i,r=1){if(this._checkLoaded(),!i)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===r&&delete this.terrain,null===i?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let a=i,n=null==i.source;if(1===r){if(this.disableElevatedTerrain)return;if("object"==typeof a.source){let i="terrain-dem-src";this.addSource(i,a.source),a=e.cp(a),a=e.l(a,{source:i})}let i=e.l({},a),r={};if(this.terrain&&n){i.source=this.terrain.get().source;let e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(r.style=e.serialize())}if(this._validate(ey,"terrain",i,r))return}if(this.terrain&&(this.terrain.scope===this.scope||n)&&(!this.terrain||r===this.terrain.drapeRenderMode)){let r=this.terrain,n=r.get();for(let i of Object.keys(e.a3.terrain))!a.hasOwnProperty(i)&&e.a3.terrain[i].default&&(a[i]=e.a3.terrain[i].default);for(let a in i)if(!e.bn(i[a],n[a])){r.set(i,this.options),this.stylesheet.terrain=i;let a=this._getTransitionParameters({duration:0});r.updateTransitions(a),this.fire(new e.z("data",{dataType:"style"}));break}}else{if(!a)return;this._createTerrain(a,r),this.fire(new e.z("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){let i=this.fog=new eO(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_createSnow(e){let i=this.snow=new eV(e,this.map.transform,this.scope,this.options);this.stylesheet.snow=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_createRain(e){let i=this.rain=new eU(e,this.map.transform,this.scope,this.options);this.stylesheet.rain=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let e of this.map._markers)e._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(i){if(this._checkLoaded(),!i)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){let r=this.fog;if(!e.bn(r.get(),i)){r.set(i,this.options),this.stylesheet.fog=r.get();let e=this._getTransitionParameters({duration:0});r.updateTransitions(e)}}else this._createFog(i);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(i){if(this._checkLoaded(),!i)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){let r=this.snow;if(!e.bn(r.get(),i)){r.set(i,this.options),this.stylesheet.snow=r.get();let e=this._getTransitionParameters({duration:0});r.updateTransitions(e)}}else this._createSnow(i);
8this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(i){if(this._checkLoaded(),!i)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){let r=this.rain;if(!e.bn(r.get(),i)){r.set(i,this.options),this.stylesheet.rain=r.get();let e=this._getTransitionParameters({duration:0});r.updateTransitions(e)}}else this._createRain(i);this._markersNeedUpdate=!0}_reloadColorTheme(){let i=()=>{for(let e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(let e in this._sourceCaches)this._sourceCaches[e].clearTiles()},r=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!r)return this._styleColorTheme.lut=null,void i();let a=this._evaluateColorThemeData(r);this._loadColorTheme(a).then(()=>{this.fire(new e.z("colorthemeset")),i()}).catch(i=>{e.w(`Couldn't set color theme: ${i}`)})}setColorTheme(i){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&e.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=i,this._reloadColorTheme()}setImportColorTheme(e,i){let r=this.getFragmentStyle(e);r&&(r._styleColorTheme.colorThemeOverride=i,r._reloadColorTheme())}_getTransitionParameters(i){return{now:e.q.now(),transition:e.l(this.transition,i)}}updateDrapeFirstLayers(){if(!this.terrain)return;let e=[],i=[];for(let r of this._mergedOrder)this.isLayerDraped(this._mergedLayers[r])?e.push(r):i.push(r);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...i)}_createTerrain(e,i){let r=this.terrain=new eP(e,i,this.scope,this.options);1===i&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_force3DLayerUpdate(){for(let e in this._layers){let i=this._layers[e];"fill-extrusion"===i.type&&this._updateLayer(i)}}_forceSymbolLayerUpdate(){for(let e in this._layers){let i=this._layers[e];"symbol"===i.type&&this._updateLayer(i)}}_validate(i,r,a,n,o={}){if(o&&!1===o.validate)return!1;let s=e.l({},this.serialize());return iy(this,i.call(ef,e.l({key:r,style:s,value:a,styleSpec:e.a3},n)))}_remove(){for(let i in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.cx.off("pluginStateChange",this._rtlTextPluginCallback),this._mergedLayers)this._mergedLayers[i].setEventedParent(null);for(let e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}
8clearSource(e){for(let i of this.getSourceCaches(e))i.clearTiles()}clearSources(){for(let e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}reloadSource(e){for(let i of this.getSourceCaches(e))i.resume(),i.reload()}reloadSources(){for(let e of this.getSources())e.reload&&e.reload()}updateSources(e){let i;for(let r in this.directionalLight&&(i=iu(this.directionalLight)),this._mergedSourceCaches)this._mergedSourceCaches[r].update(e,void 0,void 0,i)}_generateCollisionBoxes(){for(let e in this._sourceCaches){let i=this._sourceCaches[e];i.resume(),i.reload()}}_updatePlacement(i,r,a,n,o,s,l=!1){let h=!1,u=!1,c={},d={};for(let i of this._mergedOrder){let a=this._mergedLayers[i];if("symbol"!==a.type)continue;let n=e.aC(a.source,a.scope),o=c[n];if(!o){let e=this.getLayerSourceCache(a);if(!e)continue;let i=e.getRenderableIds(!0).map(i=>e.getTileByID(i));d[n]=i.slice(),o=c[n]=i.sort((e,i)=>i.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(i.tileID)?-1:1))}let s=this.crossTileSymbolIndex.addLayer(a,o,r.center.lng,r.projection);h=h||s}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),l=l||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.z("neworder")),(l||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.q.now(),r.zoom))&&(this.pauseablePlacement=new t$(r,this._mergedOrder,l,a,n,o,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,c,d,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.q.now()),u=!0),h&&this.pauseablePlacement.placement.setStale()),u||h){this._buildingIndex.onNewFrame(r.zoom);for(let i=0;i<this._mergedOrder.length;i++){let r=this._mergedLayers[this._mergedOrder[i]];if("symbol"!==r.type)continue;let a=this.isLayerClipped(r);this.placement.updateLayerOpacities(r,c[e.aC(r.source,r.scope)],i,a?s:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.q.now())}}_releaseSymbolFadeTiles(){for(let e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}addImport(i,r){this._checkLoaded();let a=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==a.findIndex(({id:e})=>e===i.id))return void this.fire(new e.y(Error(`Import with id '${i.id}' already exists in the map's style.`)));if(!r)return a.push(i),this._loadImports([i],!0);let n=a.findIndex(({id:e})=>e===r);return -1===n&&this.fire(new e.y(Error(`Import with id "${r}" does not exist on this map.`))),this.stylesheet.imports=a.slice(0,n).concat(i).concat(a.slice(n)),this._loadImports([i],!0,r)}updateImport(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);return -1===n||("string"==typeof r?this.setImportUrl(i,r):(r.url&&r.url!==a[n].url&&this.setImportUrl(i,r.url),e.bn(r.config,a[n].config)||this.setImportConfig(i,r.config),e.bn(r.data,a[n].data)||this.setImportData(i,r.data))),this}moveImport(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(e);if(-1===a)return this;let n=this.getImportIndex(i);if(-1===n)return this;let o=r[a],s=this.fragments[a];return r=r.filter(({id:i})=>i!==e),this.fragments=this.fragments.filter(({id:i})=>i!==e),this.stylesheet.imports=r.slice(0,n).concat(o).concat(r.slice(n)),this.fragments=this.fragments.slice(0,n).concat(s).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(e);if(-1===a)return this;r[a].url=i;let n=this.fragments[a];return n.style=this._createFragmentStyle(r[a]),n.style.on("style.import.load",()=>this.mergeAll()),n.style.loadURL(i),this}setImportData(e,i){this._checkLoaded();let r=this.getImportIndex(e),a=this.stylesheet.imports||[];return -1===r?this:i?(this.fragments[r].style.setState(i),this._reloadImports(),this):(delete a[r].data,this.setImportUrl(e,a[r].url))}setImportConfig(e,i){this._checkLoaded();let r=this.getImportIndex(e),a=this.stylesheet.imports||[];if(-1===r)return this;i?a[r].config=i:delete a[r].config;let n=this.fragments[r],o=n.style.stylesheet&&n.style.stylesheet.schema;return n.config=i,n.style.updateConfig(i,o),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();let i=this.stylesheet.imports||[],r=this.getImportIndex(e);-1!==r&&(i.splice(r,1),this.fragments[r].style._remove(),this.fragments.splice(r,1),this._reloadImports())}getImportIndex(i){let r=(this.stylesheet.imports||[]).findIndex(e=>e.id===i);return -1===r&&this.fire(new e.y(Error(`Import '${i}' does not exist in the map's style and cannot be updated.`))),r}getLayer(e){return this._mergedLayers[e]}getSources(){let e=[];for(let i in this._mergedOtherSourceCaches){let r=this._mergedOtherSourceCaches[i];r&&e.push(r.getSource())}return e}getSource(e,i){let r=this.getSourceCache(e,i);return r&&r.getSource()}getLayerSource(e){let i=this.getLayerSourceCache(e);return i&&i.getSource()}getSourceCache(i,r){let a=e.aC(i,r);return this._mergedOtherSourceCaches[a]}getLayerSourceCache(i){let r=e.aC(i.source,i.scope);return"symbol"===i.type?this._mergedSymbolSourceCaches[r]:this._mergedOtherSourceCaches[r]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);let i=[];return this._mergedOtherSourceCaches[e]&&i.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&i.push(this._mergedSymbolSourceCaches[e]),i}
8updateSourceCaches(){let e=this._changes.getUpdatedSourceCaches();for(let i in e){let r=e[i];"reload"===r?this.reloadSource(i):"clear"===r&&this.clearSource(i)}}updateLayers(e){for(let i of this._changes.getUpdatedPaintProperties()){let r=this.getLayer(i);r&&r.updateTransitions(e)}}getImages(e,i,r){this.imageManager.getImages(i.icons,i.scope,r),this._updateTilesForChangedImages();let a=e=>{e&&e.setDependencies(i.tileID.key,i.type,i.icons)};a(this._otherSourceCaches[i.source]),a(this._symbolSourceCaches[i.source])}rasterizeImages(e,i,r){this.imageManager.rasterizeImages(i,r)}getGlyphs(e,i,r){this.glyphManager.getGlyphs(i.stacks,i.scope,r)}getResource(i,r,a){return e.cy(r,a)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){let i=[];return this._otherSourceCaches[e]&&i.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&i.push(this._symbolSourceCaches[e]),i}_isSourceCacheLoaded(i){let r=this.getOwnSourceCaches(i);return 0===r.length?(this.fire(new e.y(Error(`There is no source with ID '${i}'`))),!1):r.every(e=>e.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,i){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type)return!1;let r="fill-extrusion"===e.type&&"building"===e.sourceLayer;if(e.is3D()){if(r||i&&"batched-model"===i.type||"model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(e=>{e.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}iS.getSourceType=function(e){return eK[e]},iS.setSourceType=function(e,i){eK[e]=i},iS.registerForPluginStateChange=e.ch;var iM="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",iE="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",iA="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;
8float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\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 vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",iI="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out 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;}",iC="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;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;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);}
8float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat 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=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat 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=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;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;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-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
8size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION",iP="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",iz="highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
8vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {\n#ifdef FOG_DITHERING\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\n#else\nreturn color;\n#endif\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",iD="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",iR="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",iL="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
8\n#endif//RENDER_SHADOWS",iO="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef TEXTURE_GATHER\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz/=light_view_pos0.w;vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";let ik=[];iU(iM,ik),iU(iA,ik),iU(iE,ik);let iF={"_prelude_fog.vertex.glsl":iP,"_prelude_terrain.vertex.glsl":iC,"_prelude_shadow.vertex.glsl":iL,"_prelude_fog.fragment.glsl":iz,"_prelude_shadow.fragment.glsl":iO,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
8));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":iD,"_prelude_raster_particle.glsl":iR},iB={};ij("",iC),ij(iz,iP),ij(iO,iL),ij(iD,""),ij(iR,"");let iN=ij(iE,iA);var iV={background:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in 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\nuniform float u_emissive_strength;void 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 blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float opacity_t=smoothstep((1.0-blur_positive)*antialiased_blur,blur_positive*antialiased_blur,extrude_length-1.0)-smoothstep(0.0,antialiasblur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius
8/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\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 mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec3 v_data;out 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,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\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);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 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,radiu
8s,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;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,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\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);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:ij("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:ij('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in 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);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout 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;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:ij("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:ij("in float v_placed;in 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);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),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=projectedPoint;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;}'),collisionCircle:ij("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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);}"),debug:ij("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout 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;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
8);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),fill:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\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);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radiu
8s;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,h);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radiu
8s;out float v_has_floodlight;\n#endif\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;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));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
8\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:ij("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;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;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
8),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;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=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
8\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:ij('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:ij("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
8\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:ij("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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;}"),hillshade:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(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);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
8float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec2 a_z_offset_width;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\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 border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\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 border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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;\n#ifdef VARIABLE_LINE_WIDTH\nhalfwidth=(u_width_scale*a_z_offset_width.y)/2.0;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\noffset=-1.0*offset*u_width_scale;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
8vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\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=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nuniform float u_emissive_strength;\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec2 a_z_offset_width;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec4 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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);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=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\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=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nfloat a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
8if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:ij("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:ij("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:ij('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
8vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return  clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:ij('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\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\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform 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_elevation_from_sea;uniform bool u_pitch_with_map;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 vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\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\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];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;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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 font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\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\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+(u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#else\nz+=u_pitch_with_map ? (u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 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));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#endif\n}'),terrainRaster:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:ij("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:ij('#include "_prelude_fog.fragment.glsl"\nin 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;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))/(e
8nd-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=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',iI),skyboxGradient:ij('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',iI),skyboxCapture:ij
vendor: 3,689 bytes, line 8
8("\nin 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;precision highp float;\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;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out 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;
8v_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);}"),globeRaster:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:ij('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
8vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;\n#ifndef NATIVE\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\n#endif\nglFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
8Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
8Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
8y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
8\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:ij("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
8rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:ij("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:ij("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:ij("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
8pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),vignette:ij("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:ij("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function iU(e,i){for(let r of e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n"))if("#"===(r=r.trim())[0]&&r.includes("if")&&!r.includes("endif"))for(let e of(r=r.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim()).split(" "))i.includes(e)||i.push(e)}function ij(e,i){let r=/#include\s+"([^"]+)"/g,a=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,n=i.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&&(n=[...new Set(n=n.map(e=>{let i=e.split(" ");return i[i.length-1]}))]);let o={},s=[],l=[];if(e=e.replace(r,(e,i)=>(l.push(i),"")),(i=i.replace(r,(e,i)=>(s.push(i),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let h=[...ik];for(let r of(iU(e,h),iU(i,h),[...s,...l]))iF[r]||console.error(`Undefined include: ${r}`),iB[r]||(iB[r]=[],iU(iF[r],iB[r])),h=[...h,...iB[r]];return{fragmentSource:e=e.replace(a,(e,i,r,a,n)=>(o[n]=!0,"define"===i?`
9#ifndef HAS_UNIFORM_u_${n}
10in ${r} ${a} ${n};
11#else
12uniform ${r} ${a} u_${n};
13#endif
14`:"initialize"===i?`
15#ifdef HAS_UNIFORM_u_${n}
16    ${r} ${a} ${n} = u_${n};
17#endif
18`:"define-attribute"===i?`
19#ifdef HAS_ATTRIBUTE_a_${n}
20    in ${r} ${a} ${n};
21#endif
22`:"initialize-attribute"===i?"":void 0)),vertexSource:i=i.replace(a,(e,i,r,a,n)=>{let s="float"===a?"vec2":a,l=n.match(/color/)?"color":s;return"define-attribute-vertex-shader-only"===i?`
23#ifdef HAS_ATTRIBUTE_a_${n}
24in ${r} ${a} a_${n};
25#endif
26`:o[n]?"define"===i?`
27#ifndef HAS_UNIFORM_u_${n}
28uniform lowp float u_${n}_t;
29in ${r} ${s} a_${n};
30out ${r} ${a} ${n};
31#else
32uniform ${r} ${a} u_${n};
33#endif
34`:"initialize"===i?"vec4"===l?`
35#ifndef HAS_UNIFORM_u_${n}
36    ${n} = a_${n};
37#else
38    ${r} ${a} ${n} = u_${n};
39#endif
40`:`
41#ifndef HAS_UNIFORM_u_${n}
42    ${n} = unpack_mix_${l}(a_${n}, u_${n}_t);
43#else
44    ${r} ${a} ${n} = u_${n};
45#endif
46`:"define-attribute"===i?`
47#ifdef HAS_ATTRIBUTE_a_${n}
48    in ${r} ${a} a_${n};
49    out ${r} ${a} ${n};
50#endif
51`:"initialize-attribute"===i?`
52#ifdef HAS_ATTRIBUTE_a_${n}
53    ${n} = a_${n};
54#endif
55`:void 0:"define"===i?`
56#ifndef HAS_UNIFORM_u_${n}
57uniform lowp float u_${n}_t;
58in ${r} ${s} a_${n};
59#else
60uniform ${r} ${a} u_${n};
61#endif
62`:"define-instanced"===i?"mat4"===l?`
63#ifdef INSTANCED_ARRAYS
64in vec4 a_${n}0;
65in vec4 a_${n}1;
66in vec4 a_${n}2;
67in vec4 a_${n}3;
68#else
69uniform ${r} ${a} u_${n};
70#endif
71`:`
72#ifdef INSTANCED_ARRAYS
73in ${r} ${s} a_${n};
74#else
75uniform ${r} ${a} u_${n};
76#endif
77`:"initialize-attribute-custom"===i?`
78#ifdef HAS_ATTRIBUTE_a_${n}
79    ${r} ${a} ${n} = a_${n};
80#endif
81`:"vec4"===l?`
82#ifndef HAS_UNIFORM_u_${n}
83    ${r} ${a} ${n} = a_${n};
84#else
85    ${r} ${a} ${n} = u_${n};
86#endif
87`:`
88#ifndef HAS_UNIFORM_u_${n}
89    ${r} ${a} ${n} = unpack_mix_${l}(a_${n}, u_${n}_t);
90#else
91    ${r} ${a} ${n} = u_${n};
92#endif
93`}),staticAttributes:n,usedDefines:h,vertexIncludes:s,fragmentIncludes:l}}class iG{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,i,r,a,n,o,s,l){this.context=e;let h=this.boundPaintVertexBuffers.length!==a.length;for(let e=0;!h&&e<a.length;e++)this.boundPaintVertexBuffers[e]!==a[e]&&(h=!0);let u=this.boundDynamicVertexBuffers.length!==s.length;for(let e=0;!u&&e<s.length;e++)this.boundDynamicVertexBuffers[e]!==s[e]&&(u=!0);if(!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||h||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==o)this.freshBind(i,r,a,n,o,s,l);else{for(let r of(e.bindVertexArrayOES.set(this.vao),s))r&&(r.bind(),l&&r.instanceCount&&r.setVertexAttribDivisor(e.gl,i,l));n&&n.dynamicDraw&&n.bind()}}freshBind(e,i,r,a,n,o,s){let l=e.numAttributes,h=this.context,u=h.gl;for(let s of(this.vao&&this.destroy(),this.vao=h.gl.createVertexArray(),h.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=a,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=o,i.enableAttributes(u,e),i.bind(),i.setVertexAttribPointers(u,e,n),r))s.enableAttributes(u,e),s.bind(),s.setVertexAttribPointers(u,e,n);for(let i of o)i&&(i.enableAttributes(u,e),i.bind(),i.setVertexAttribPointers(u,e,n),s&&i.instanceCount&&i.setVertexAttribDivisor(u,e,s));a&&a.bind(),h.currentNumAttributes=l}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function iq(i,r,a){if(!r.needsDEMTextureUpload)return;let n=i.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||i.getTileTexture(a.stride);let s=a.getPixels();r.demTexture?r.demTexture.update(s,{premultiply:!1}):r.demTexture=new e.T(n,s,o.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}class iZ{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class iH extends iZ{getDefault(){return e.aj.transparent}set(e){let i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class i$ extends iZ{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class iW extends iZ{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}
93class iX extends iZ{getDefault(){return[!0,!0,!0,!0]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class iY extends iZ{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class iK extends iZ{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class iJ extends iZ{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class iQ extends iZ{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class i0 extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class i1 extends iZ{getDefault(){return[0,1]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class i2 extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class i3 extends iZ{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class i4 extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class i5 extends iZ{getDefault(){let e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class i6 extends iZ{getDefault(){return e.aj.transparent}set(e){let i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class i8 extends iZ{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class i9 extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class i7 extends iZ{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class re extends iZ{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let rt=class extends iZ{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class ri extends iZ{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class rr extends iZ{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ra extends iZ{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class rn extends iZ{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ro extends iZ{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class rs extends iZ{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class rl extends iZ{getDefault(){return null}set(e){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class rh extends iZ{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class ru extends iZ{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class rc extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class rd extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class rp extends iZ{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class rf extends rp{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class rm extends rp{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,this.attachment(),i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class r_ extends rp{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,this.attachment(),i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class rg extends rm{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}let ry=(e,i,r)=>({u_matrix:e,u_image0:0,u_skirt_height:i,u_ground_shadow_factor:r}),rx=(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:i,u_normalize_matrix:Float32Array.from(a),u_merc_matrix:r,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_frustum_tl:s,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:d,u_viewport:p,u_grid_matrix:_?Float32Array.from(_):new Float32Array(9),u_skirt_height:f,u_far_z_cutoff:m});function rv(e,i){return null!=e&&null!=i&&!(!e.hasData()||!i.hasData())&&null!=e.demTexture&&null!=i.demTexture&&e.tileID.key!==i.tileID.key}let rb=new class{constructor(){this.operations={}}newMorphing(e,i,r,a,n){if(e in this.operations){let i=this.operations[e];i.to.tileID.key!==r.tileID.key&&(i.queued=r)}else this.operations[e]={startTime:a,phase:0,duration:n,from:i,to:r,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;let i=this.operations[e];return{from:i.from,to:i.to,phase:i.phase}}update(e){for(let i in this.operations){let r=this.operations[i];for(r.phase=(e-r.startTime)/r.duration;r.phase>
93=1||!this._validOp(r);)if(!this._nextOp(r,e)){delete this.operations[i];break}}}_nextOp(e,i){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=i,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},rw={0:null,1:"TERRAIN_VERTEX_MORPHING"};function rT(e,i,r){return 0===i?0:6*Math.pow(1.5,22-e)*Math.max(i,1)*(i<1&&514===r?.25/i:1)}let rS=e=>({u_matrix:e});function rM(i,r,a,n,o){if(o>0){let s=e.q.now(),l=(s-i.timeAdded)/o,h=r?(s-r.timeAdded)/o:-1,u=a.getSource(),c=n.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),d=!r||Math.abs(r.tileID.overscaledZ-c)>Math.abs(i.tileID.overscaledZ-c),p=d&&i.refreshedUponExpiration?1:e.aw(d?l:1-h,0,1);return i.refreshedUponExpiration&&l>=1&&(i.refreshedUponExpiration=!1),r?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}class rE extends tt{constructor(i){let r=eJ("mock-dem",{type:"raster-dem",maxzoom:i.transform.maxZoom},new e.D(e.ci(),null),i.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,i){e.state="loaded",i(null)}}class rA extends tt{constructor(i){let r=eJ("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new e.D(e.ci(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,i,r){if(e.freezeTileCoverage)return;this.transform=e;let a=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((i,r)=>{if(i[r.key]="",!this._tiles[r.key]){let i=new e8(r,this._source.tileSize*r.overscaleFactor(),e.tileZoom);i.state="loaded",this._tiles[r.key]=i}return i},{});for(let e in this._tiles)e in a||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){let i=this.proxyCachedFBO[e];if(void 0!==i){let r=Object.values(i);this.renderCachePool.push(...r),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach(e=>e.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class rI extends e.aG{constructor(e,i,r){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=i,this.projMatrix=r}}class rC extends e.cJ{constructor(i,r){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},i.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=i,this.terrainTileForTile={},this.prevTerrainTileForTile={};let[a,n,o]=function(i){let r=new e.b4,a=new e.aU;r.reserve(17161),a.reserve(33800);let n=e.ag/128,o=e.ag+n/2,s=o+n;for(let i=-n;i<s;i+=n)for(let a=-n;a<s;a+=n){let n=a<0||a>o||i<0||i>o?24575:0,s=e.aw(Math.round(a),0,e.ag),l=e.aw(Math.round(i),0,e.ag);r.emplaceBack(s+n,l)}let l=(e,i)=>{let r=131*i+e;a.emplaceBack(r+1,r,r+131),a.emplaceBack(r+131,r+131+1,r+1)};for(let e=1;e<129;e++)for(let i=1;i<129;i++)l(i,e);return[0,129].forEach(e=>{for(let i=0;i<130;i++)l(i,e),l(e,i)}),[r,a,32768]}(),s=i.context;this.gridBuffer=s.createVertexBuffer(a,e.b6.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.b7.simpleSegment(0,0,a.length,n.length),this.gridNoSkirtSegments=e.b7.simpleSegment(0,0,a.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new rA(r.map),this.orthoMatrix=e.ab.mat4.create(),e.ab.mat4.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.ag,0,e.ag,0,1);let l=s.gl;this._overlapStencilMode=new t1({func:l.GEQUAL,mask:255},0,255,l.KEEP,l.KEEP,l.REPLACE),this._previousZoom=i.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=r,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new rE(r.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(i,r,a){if(i&&i.terrain){this._style!==i&&(this.style=i,this._evaluationZoom=void 0);let n=i.terrain.properties,o=0===i.terrain.drapeRenderMode,s=i.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.q.now();let l=i.terrain&&i.terrain.scope,h=n.get("source"),u=o?this._mockSourceCache:i.getSourceCache(h,l);if(!u)return void e.w(`Couldn't find terrain source "${h}".`);if(this.sourceCache=u,this._attenuationRange=i.terrain.getAttenuationRange(),this._exaggeration=s?this.calculateExaggeration(r):n.get("exaggeration"),!r.projection.requiresDraping&&s&&0===this._exaggeration)return void this._disable();this.enabled=!0;let c=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
94This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let i=this.getScaledDemTileSize();this.sourceCache.update(r,i,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,c(),this._initializing=!0),c(),r.updateElevation(!0,a),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(r),this._emptyDEMTextureDirty=!0,this._previousZoom=r.zoom}else this._disable()}calculateExaggeration(i){if(this._attenuationRange&&i.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(i.zoom);let r=this._previousCameraAltitude,a=i.getFreeCameraOptions().position.z/i.pixelsPerMeter*i.worldSize;this._previousCameraAltitude=a;let n=null!=r?a-r:Number.MAX_VALUE;if(2>Math.abs(n))return this._exaggeration;let o=i.zoom,s=this._style.terrain;if(!this._previousUpdateTimestamp)return s.getExaggeration(o);let l=o-this._previousZoom,h=this._previousUpdateTimestamp,u=o;null!=this._evaluationZoom&&(Math.abs(o-(u=this._evaluationZoom))>.5&&(l=.5*(o-u+l)),l*n<0&&(u+=l)),this._evaluationZoom=u;let c=s.getExaggeration(u),d=c===s.getExaggeration(Math.max(0,u-.1));if(d&&.01>Math.abs(c-this._exaggeration))return c;
94let p=Math.min(.1,.00375*(this._updateTimestamp-h));return(d||c<.1||1e-4>Math.abs(l))&&(p=Math.min(.2,4*p)),e.af(this._exaggeration,c,p)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(let e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(e=>e.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){let e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(i){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let r=this.proxySourceCache,a=this.painter.transform;this._initializing&&(this._initializing=0===a._centerAltitude&&-1===this.getAtPointOrZero(e.aa.fromLngLat(a.center),-1),this._emptyDEMTextureDirty=!this._initializing);let n=this.proxyCoords=r.getIds().map(e=>{let i=r.getTileByID(e).tileID;return i.projMatrix=a.calculateProjMatrix(i.toUnwrapped()),i});!function(i,r){let a=r.transform.pointCoordinate(r.transform.getCameraPoint()),n=new e.P(a.x,a.y);i.sort((i,r)=>{if(r.overscaledZ-i.overscaledZ)return r.overscaledZ-i.overscaledZ;let a=new e.P(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),o=new e.P(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),s=n.mult(1<<i.canonical.z);return s.x-=.5,s.y-=.5,s.distSqr(a)-s.distSqr(o)})}(n,this.painter);let o=this.proxyToSource||{};this.proxyToSource={},n.forEach(e=>{this.proxyToSource[e.key]={}}),this.terrainTileForTile={};let s=this._style._mergedSourceCaches;for(let e in s){let r=s[e];if(!r.used||(r!==this.sourceCache&&this.resetTileLookupCache(r.id),this._setupProxiedCoordsForOrtho(r,i[e],o),r.usedForTerrain))continue;let a=i[e];r.getSource().reparseOverscaled&&this._assignTerrainTiles(a)}this.proxiedCoords[r.id]=n.map(e=>new rI(e,e.key,this.orthoMatrix)),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1;let l={};for(let e of(this._visibleDemTiles=[],this.proxyCoords)){let i=this.terrainTileForTile[e.key];if(!i)continue;let r=i.tileID.key;r in l||(this._visibleDemTiles.push(i),l[r]=r)}}_assignTerrainTiles(e){this._initializing||e.forEach(e=>{if(this.terrainTileForTile[e.key])return;let i=this._findTileCoveringTileID(e,this.sourceCache);i&&(this.terrainTileForTile[e.key]=i)})}_prepareDEMTextures(){let e=this.painter.context,i=e.gl;for(let r in this.terrainTileForTile){let a=this.terrainTileForTile[r],n=a.dem;n&&(!a.demTexture||a.needsDEMTextureUpload)&&(e.activeTexture.set(i.TEXTURE1),iq(this.painter,a,n))}}_prepareDemTileUniforms(e,i,r,a){if(!i||null==i.demTexture)return!1;let n=e.tileID.canonical,o=Math.pow(2,i.tileID.canonical.z-n.z),s=a||"";return r[`u_dem_tl${s}`]=[n.x*o%1,n.y*o%1],r[`u_dem_scale${s}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0,i=this._visibleDemTiles.reduce((i,r)=>{if(!r.dem)return i;let a=r.dem.tree.minimums[0];return a>0&&e++,i+a},0);return e?i/e:0}_updateEmptyDEMTexture(){let i=this.painter.context,r=i.gl;i.activeTexture.set(r.TEXTURE2);let a=this._getLoadedAreaMinimum(),n=new e.cK({width:1,height:1},new Float32Array([a]));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(n,{premultiply:!1}):o=this._emptyDEMTexture=new e.T(i,n,r.R32F,{premultiply:!1}),o}setupElevationDraw(i,r,a){var n;let o=this.painter.context,s=o.gl,l={u_dem:2,u_dem_prev:4,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_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-.0001,u_exaggeration:0};l.u_exaggeration=this.exaggeration();let h=null,u=null,c=1;if(a&&a.morphing&&this._useVertexMorphing){let e=a.morphing.srcDemTile,r=a.morphing.dstDemTile;
94c=a.morphing.phase,e&&r&&(this._prepareDemTileUniforms(i,e,l,"_prev")&&(u=e),this._prepareDemTileUniforms(i,r,l)&&(h=r))}let d=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?s.LINEAR:s.NEAREST,p=null;if(this.enabled?u&&h?(p=h.demTexture,o.activeTexture.set(s.TEXTURE4),u.demTexture.bind(d(u),s.CLAMP_TO_EDGE),l.u_dem_lerp=c):(h=this.terrainTileForTile[i.tileID.key],p=this._prepareDemTileUniforms(i,h,l)?h.demTexture:this.emptyDEMTexture):p=this.emptyDEMTexture,o.activeTexture.set(s.TEXTURE2),p&&(l.u_dem_size=1===(n=p).size[0]?1:n.size[0]-2,p.bind(d(h),s.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(a&&a.useDepthForOcclusion,r,l),a&&a.useMeterToDem&&h){let i=(1<<h.tileID.canonical.z)*e.bH(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;l.u_meter_to_dem=i}if(a&&a.labelPlaneMatrixInv&&(l.u_label_plane_matrix_inv=a.labelPlaneMatrixInv),r.setTerrainUniformValues(o,l),"globe"===this.painter.transform.projection.name){let e=this.globeUniformValues(this.painter.transform,i.tileID.canonical,a&&a.useDenormalizedUpVectorScale);r.setGlobeUniformValues(o,e)}}globeUniformValues(i,r,a){let n=i.projection;return{u_tile_tl_up:n.upVector(r,0,0),u_tile_tr_up:n.upVector(r,e.ag,0),u_tile_br_up:n.upVector(r,e.ag,e.ag),u_tile_bl_up:n.upVector(r,0,e.ag),u_tile_up_scale:a?e.cL(1):n.upVectorScale(r,i.center.lat,i.worldSize).metersToTile}}renderToBackBuffer(i){let r=this.painter,a=this.painter.context;0!==i.length&&(a.bindFramebuffer.set(null),a.viewport.set([0,0,r.width,r.height]),r.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(i,r,a,n,o){if("globe"===i.transform.projection.name)!function(i,r,a,n,o){let s,l;let h=i.context,u=h.gl,c=i.transform,d=e.cC(i,h,c),p=(e,r)=>{if(l===r)return;let a=[rw[r],"PROJECTION_GLOBE_VIEW"];d&&a.push("CUSTOM_ANTIALIASING");let n=i.isTileAffectedByFog(e);s=i.getOrCreateProgram("globeRaster",{defines:a,overrideFog:n}),l=r},f=i.colorModeForRenderPass(),m=new t0(u.LEQUAL,t0.ReadWrite,i.depthRangeFor3D);rb.update(o);let _=e.cD(c),g=[e.at(c.center.lng),e.aA(c.center.lat)],y=i.globeSharedBuffers,x=[c.width*e.q.devicePixelRatio,c.height*e.q.devicePixelRatio],v=Float32Array.from(c.globeMatrix),b={useDenormalizedUpVectorScale:!0};{let c=i.transform,d=rT(c.zoom,r.exaggeration(),r.sourceCache._source.tileSize);l=-1;let w=u.TRIANGLES;for(let l of n){let n=a.getTile(l),T=t1.disabled,S=r.prevTerrainTileForTile[l.key],M=r.terrainTileForTile[l.key];rv(S,M)&&rb.newMorphing(l.key,S,M,o,250),h.activeTexture.set(u.TEXTURE0),n.texture&&n.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let E=rb.getMorphValuesForProxy(l.key),A=E?1:0;E&&e.J(b,{morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:e.cB(E.phase)}});let I=e.cE(l.canonical),C=e.cF(I.getCenter().lat),P=e.cG(l.canonical,I,C,c.worldSize/c._pixelsPerMercatorPixel),z=e.bb(e.cH(l.canonical)),D=rx(c.expandedFarZProjMatrix,v,_,z,e.ae(c.zoom),g,c.frustumCorners.TL,c.frustumCorners.TR,c.frustumCorners.BR,c.frustumCorners.BL,c.globeCenterInViewSpace,c.globeRadius,x,d,c._farZ,P);if(p(l,A),s&&(r.setupElevationDraw(n,s,b),i.uploadCommonUniforms(h,s,l.toUnwrapped()),y)){let[e,r,a]=y.getGridBuffers(C,0!==d);s.draw(i,w,m,T,f,t2.backCCW,D,"globe_raster",e,r,a)}}}if(y&&(i.renderDefaultNorthPole||i.renderDefaultSouthPole)){let o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let l of(d&&o.push("CUSTOM_ANTIALIASING"),s=i.getOrCreateProgram("globeRaster",{defines:o}),n)){let{x:n,y:o,z:d}=l.canonical,p=0===o,_=o===(1<<d)-1,[v,w,T,S]=y.getPoleBuffers(d,!1);if(S&&(p||_)){let o=a.getTile(l);h.activeTexture.set(u.TEXTURE0),o.texture&&o.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let y=e.cI(d,n,c),M=e.bb(e.cH(l.canonical)),E=(e,r)=>e.draw(i,u.TRIANGLES,m,t1.disabled,f,t2.disabled,rx(c.expandedFarZProjMatrix,y,y,M,0,g,c.frustumCorners.TL,c.frustumCorners.TR,c.frustumCorners.BR,c.frustumCorners.BL,c.globeCenterInViewSpace,c.globeRadius,x,0,c._farZ),"globe_pole_raster",r,T,S);r.setupElevationDraw(o,s,b),i.uploadCommonUniforms(h,s,l.toUnwrapped()),p&&i.renderDefaultNorthPole&&E(s,v),_&&i.renderDefaultSouthPole&&(y=e.ab.mat4.scale(e.ab.mat4.create(),y,[1,-1,1]),E(s,w))}}}}(i,r,a,n,o);else{let s,l;let h=i.context,u=h.gl,c=i.shadowRenderer,d=ir(i,i.longestCutoffRange),p=e=>{if(l===e)return;let r=[];r.push(rw[e]),d.shouldRenderCutoff&&r.push("RENDER_CUTOFF"),c&&(r.push("RENDER_SHADOWS","DEPTH_TEXTURE"),c.useNormalOffset&&r.push("NORMAL_OFFSET")),s=i.getOrCreateProgram("terrainRaster",{defines:r}),l=e},f=i.colorModeForRenderPass(),m=new t0(u.LEQUAL,t0.ReadWrite,i.depthRangeFor3D);rb.update(o);let _=i.transform,g=rT(_.zoom,r.exaggeration(),r.sourceCache._source.tileSize),y=[0,0,0];if(c){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(y=ic(i.style,e,r))}{l=-1;let x=u.TRIANGLES,[v,b]=[r.gridIndexBuffer,r.gridSegments];for(let l of n){let n;let w=a.getTile(l),T=t1.disabled,S=r.prevTerrainTileForTile[l.key],M=r.terrainTileForTile[l.key];rv(S,M)&&rb.newMorphing(l.key,S,M,o,250),h.activeTexture.set(u.TEXTURE0),w.texture&&w.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let E=rb.getMorphValuesForProxy(l.key),A=E?1:0;E&&(n={morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:e.cB(E.phase)}});let I=ry(l.projMatrix,!function(e,i){let r=1<<e.z;return!i&&(0===e.x||e.x===r-1)||0===e.y||e.y===r-1}(l.canonical,_.renderWorldCopies)?g:g/10,y);if(p(A),!s)continue;r.setupElevationDraw(w,s,n);let C=l.toUnwrapped();c&&c.setupShadows(C,s),i.uploadCommonUniforms(h,s,C,null,d),s.draw(i,x,m,T,f,t2.backCCW,I,"terrain_raster",r.gridBuffer,v,b)}}}}(r,this,this.proxySourceCache,i,this._updateTimestamp),this.renderingToTexture=!0,r.gpuTimingDeferredRenderEnd(),i.splice(0,i.length))}renderBatch(i){if(0===this._drapedRenderBatches.length)return i+1;this.renderingToTexture=!0;let r=this.painter,a=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),l=r.style.order,h=[],u=0;for(let c of o){let o;let d=n.getTileByID(c.proxyTileKey),p=n.proxyCachedFBO[c.key]?n.proxyCachedFBO[c.key][i]:void 0,f=void 0!==p?n.renderCache[p]:this.pool[u++],m=void 0!==p;if(d.texture=f.tex,m&&!f.dirty){h.push(d.tileID);continue}a.bindFramebuffer.set(f.fb.framebuffer),this.renderedToTile=!1,f.dirty&&(a.clear({color:e.aj.transparent,stencil:0}),f.dirty=!1);for(let e=s.start;e<=s.end;++e){let i=r.style._mergedLayers[l[e]];if(i.isHidden(r.transform.zoom))continue;let n=r.style.getLayerSourceCache(i),s=n?this.proxyToSource[c.key][n.id]:[c];s&&(a.viewport.set([0,0,f.fb.width,f.fb.height]),o!==(n?n.id:null)&&(this._setupStencil(f,s,i,n),o=n?n.id:null),r.renderLayer(r,n,i,s)
94)}if(0===this._drapedRenderBatches.length)for(let e of this._pendingGroundEffectLayers){let i=r.style._mergedLayers[l[e]];if(i.isHidden(r.transform.zoom))continue;let n=r.style.getLayerSourceCache(i),s=n?this.proxyToSource[c.key][n.id]:[c];s&&(a.viewport.set([0,0,f.fb.width,f.fb.height]),o!==(n?n.id:null)&&(this._setupStencil(f,s,i,n),o=n?n.id:null),r.renderLayer(r,n,i,s))}this.renderedToTile?(f.dirty=!0,h.push(d.tileID)):m||--u,5===u&&(u=0,this.renderToBackBuffer(h))}return this.renderToBackBuffer(h),this.renderingToTexture=!1,a.bindFramebuffer.set(null),a.viewport.set([0,0,r.width,r.height]),s.end+1}postRender(){}isLayerOrderingCorrect(e){let i=e.order.length,r=-1,a=i;for(let n=0;n<i;++n)this._style.isLayerDraped(e._mergedLayers[e.order[n]])?r=Math.max(r,n):a=Math.min(a,n);return a>r}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter(e=>e.dem).forEach(i=>{e=Math.min(e,i.dem.tree.minimums[0])}),0===e?e:(e-30)*this._exaggeration}raycast(e,i,r){if(!this._visibleDemTiles)return null;let a=this._visibleDemTiles.filter(e=>e.dem).map(a=>{let n=a.tileID,o=1<<n.overscaledZ,{x:s,y:l}=n.canonical,h=s/o,u=(s+1)/o,c=l/o,d=(l+1)/o;return{minx:h,miny:c,maxx:u,maxy:d,t:a.dem.tree.raycastRoot(h,c,u,d,e,i,r),tile:a}});for(let n of(a.sort((e,i)=>(null!==e.t?e.t:Number.MAX_VALUE)-(null!==i.t?i.t:Number.MAX_VALUE)),a)){if(null==n.t)break;let a=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,i,r);if(null!=a)return a}return null}_createFBO(){let i=this.painter.context,r=i.gl,a=this.drapeBufferSize;i.activeTexture.set(r.TEXTURE0);let n=new e.T(i,{width:a[0],height:a[1],data:null},r.RGBA8);n.bind(r.LINEAR,r.CLAMP_TO_EDGE);let o=i.createFramebuffer(a[0],a[1],!0,null);return o.colorAttachment.set(n.texture),o.depthAttachment=new rg(i,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=i.createRenderbuffer(i.gl.DEPTH_STENCIL,a[0],a[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),i.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),i.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax),{fb:o,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(let e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return!0;return this._style.order.some(e=>{let i=this._style._mergedLayers[e],r=i.isHidden(this.painter.transform.zoom);return"hillshade"===i.type||"custom"===i.type?!r&&i.shouldRedrape():!r&&i.hasTransition()})}_clearLineLayersFromRenderCache(){let i=!1;for(let e of this._style.getSources())if(e instanceof eW){i=!0;break}if(!i)return;let r={};for(let i=0;i<this._style.order.length;++i){let a=this._style._mergedLayers[this._style.order[i]],n=this._style.getLayerSourceCache(a);if(n&&!r[n.id]&&!a.isHidden(this.painter.transform.zoom)&&"line"===a.type&&a.widthExpression() instanceof e.a9)for(let e of(r[n.id]=!0,this.proxyCoords)){let i=this.proxyToSource[e.key][n.id];if(i)for(let e of i)this._clearRenderCacheForTile(n.id,e)}}}_clearRasterLayersFromRenderCache(){let e=!1;for(let i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i]._source instanceof eX){e=!0;break}if(!e)return;let i={};for(let e=0;e<this._style.order.length;++e){let r=this._style._mergedLayers[this._style.order[e]],a=this._style.getLayerSourceCache(r);if(!a||i[a.id]||r.isHidden(this.painter.transform.zoom)||"raster"!==r.type)continue;let n=r.paint.get("raster-fade-duration");for(let e of this.proxyCoords){let i=this.proxyToSource[e.key][a.id];if(i)for(let e of i){let i=rM(a.getTile(e),a.findLoadedParent(e,0),a,this.painter.transform,n);(1!==i.opacity||0!==i.mix)&&this._clearRenderCacheForTile(a.id,e)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();let i=this._style.order,r=i.length;if(0===r)return;let a=[];this._pendingGroundEffectLayers=[];let n,o=0,s=this._style._mergedLayers[i[o]];for(;!this._style.isLayerDraped(s)&&s.isHidden(this.painter.transform.zoom)&&++o<r;)s=this._style._mergedLayers[i[o]];for(;o<r;++o){let e=this._style._mergedLayers[i[o]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===n&&(n=o):("fill-extrusion"===e.type&&this._pendingGroundEffectLayers.push(o),void 0!==n&&(a.push({start:n,end:o-1}),n=void 0)))}if(void 0!==n&&a.push({start:n,end:o-1}),0!==a.length){let i=a[a.length-1];this._pendingGroundEffectLayers.every(e=>e>i.end)||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=a}_setupRenderCache(e){let i=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,i.renderCache.length>i.renderCachePool.length){let e=Object.values(i.proxyCachedFBO);i.proxyCachedFBO={};for(let r=0;r<e.length;++r){let a=Object.values(e[r]);i.renderCachePool.push(...a)}}return}this._clearRasterLayersFromRenderCache();let r=this.proxyCoords,a=this._tilesDirty;for(let n=r.length-1;n>=0;n--){let o=r[n];if(i.getTileByID(o.key),void 0!==i.proxyCachedFBO[o.key]){let r=e[o.key],n=this.proxyToSource[o.key],s=0;for(let e in n){let i=n[e],o=r[e];if(!o||o.length!==i.length||i.some((i,r)=>i!==o[r]||a[e]&&a[e].hasOwnProperty(i.key))){s=-1;break}++s}for(let e in i.proxyCachedFBO[o.key])i.renderCache[i.proxyCachedFBO[o.key][e]].dirty=s<0||s!==Object.values(r).length}}let n=[...this._drapedRenderBatches];for(let e of(n.sort((e,i)=>i.end-i.start-(e.end-e.start)),n))for(let a of r){if(i.proxyCachedFBO[a.key])continue;let r=i.renderCachePool.pop();void 0===r&&i.renderCache.length<50&&(r=i.renderCache.length,i.renderCache.push(this._createFBO())),void 0!==r&&(i.proxyCachedFBO[a.key]={},i.proxyCachedFBO[a.key][e.start]=r,i.renderCache[r].dirty=!0)}this._tilesDirty={}}_setupStencil(e,i,r,a){let n;if(!a||!this._sourceTilesOverlap[a.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let o=this.painter.context,s=o.gl;if(i.length<=1)return void(this._overlapStencilType=!1);if(r.isTileClipped())n=i.length,this._overlapStencilMode.test={func:s.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(i[0].overscaledZ>
94i[i.length-1].overscaledZ))return void(this._overlapStencilType=!1);n=1,this._overlapStencilMode.test={func:s.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+n>255&&(o.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=n,this._overlapStencilMode.ref=this._stencilRef,r.isTileClipped()&&this._renderTileClippingMasks(i,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):t1.disabled}_renderTileClippingMasks(e,i){let r=this.painter,a=this.painter.context,n=a.gl;r._tileClippingMaskIDs={},a.setColorMode(tQ.disabled),a.setDepthMode(t0.disabled);let o=r.getOrCreateProgram("clippingMask");for(let a of e){let e=r._tileClippingMaskIDs[a.key]=--i;o.draw(r,n.TRIANGLES,t0.disabled,new t1({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),tQ.disabled,t2.disabled,rS(a.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(i){let r=this.painter.transform;if(i.x<0||i.x>r.width||i.y<0||i.y>r.height)return null;let a=[i.x,i.y,1,1];e.ab.vec4.transformMat4(a,a,r.pixelMatrixInverse),e.ab.vec4.scale(a,a,1/a[3]),a[0]/=r.worldSize,a[1]/=r.worldSize;let n=r._camera.position,o=e.bH(1,r.center.lat),s=[n[0],n[1],n[2]/o,0],l=e.ab.vec3.subtract([],a.slice(0,3),s);e.ab.vec3.normalize(l,l);let h=this.raycast(s,l,this._exaggeration);return null!==h&&h?(e.ab.vec3.scaleAndAdd(s,s,l,h),s[3]=s[2],s[2]*=o,s):null}_setupProxiedCoordsForOrtho(i,r,a){if(i.getSource() instanceof e.aJ)return this._setupProxiedCoordsForImageSource(i,r,a);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};let n=this.proxiedCoords[i.id]=[],o=this.proxyCoords;for(let e=0;e<o.length;e++){let r=o[e],s=this._findTileCoveringTileID(r,i);if(s){let e=this._createProxiedId(r,s,a[r.key]&&a[r.key][i.id]);n.push(e),this.proxyToSource[r.key][i.id]=[e]}}let s=!1,l=new Set;for(let e=0;e<r.length;e++){let o=i.getTile(r[e]);if(!o||!o.hasData())continue;let h=this._findTileCoveringTileID(o.tileID,this.proxySourceCache);if(h&&h.tileID.canonical.z!==o.tileID.canonical.z){let e=this.proxyToSource[h.tileID.key][i.id],r=this._createProxiedId(h.tileID,o,a[h.tileID.key]&&a[h.tileID.key][i.id]);e?e.splice(e.length-1,0,r):this.proxyToSource[h.tileID.key][i.id]=[r];let u=this.proxyToSource[h.tileID.key][i.id];l.has(u)||l.add(u),n.push(r),s=!0}}if(this._sourceTilesOverlap[i.id]=s,s&&this._debugParams.sortTilesHiZFirst)for(let e of l)e.sort((e,i)=>i.overscaledZ-e.overscaledZ)}
94_setupProxiedCoordsForImageSource(i,r,a){if(!i.getSource().loaded())return;let n=this.proxiedCoords[i.id]=[],o=this.proxyCoords,s=i.getSource(),l=s.tileID;if(!l)return;let h=new e.P(l.x,l.y)._div(1<<l.z),u=s.coordinates.map(e.aa.fromLngLat).reduce((e,i)=>(e.min.x=Math.min(e.min.x,i.x-h.x),e.min.y=Math.min(e.min.y,i.y-h.y),e.max.x=Math.max(e.max.x,i.x-h.x),e.max.y=Math.max(e.max.y,i.y-h.y),e),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(i,r)=>{let a=i.wrap+i.canonical.x/(1<<i.canonical.z),n=i.canonical.y/(1<<i.canonical.z),o=e.ag/(1<<i.canonical.z),s=r.wrap+r.canonical.x/(1<<r.canonical.z),l=r.canonical.y/(1<<r.canonical.z);return a+o<s+u.min.x||a>s+u.max.x||n+o<l+u.min.y||n>l+u.max.y};for(let e=0;e<o.length;e++){let s=o[e];for(let e=0;e<r.length;e++){let o=i.getTile(r[e]);if(!o||!o.hasData()||c(s,o.tileID))continue;let l=this._createProxiedId(s,o,a[s.key]&&a[s.key][i.id]),h=this.proxyToSource[s.key][i.id];h?h.push(l):this.proxyToSource[s.key][i.id]=[l],n.push(l)}}}_createProxiedId(i,r,a){let n=this.orthoMatrix;if(a){let e=a.find(e=>e.key===r.tileID.key);if(e)return e}if(r.tileID.key!==i.key){let a,o,s;let l=i.canonical.z-r.tileID.canonical.z;n=e.ab.mat4.create();let h=r.tileID.wrap-i.wrap<<i.overscaledZ;l>0?(o=(a=e.ag>>l)*((r.tileID.canonical.x<<l)-i.canonical.x+h),s=a*((r.tileID.canonical.y<<l)-i.canonical.y)):(a=e.ag<<-l,o=e.ag*(r.tileID.canonical.x-(i.canonical.x+h<<-l)),s=e.ag*(r.tileID.canonical.y-(i.canonical.y<<-l))),e.ab.mat4.ortho(n,0,a,0,a,0,1),e.ab.mat4.translate(n,n,[o,s,0])}return new rI(r.tileID,i.key,n)}_findTileCoveringTileID(i,r){let a=r.getTile(i);if(a&&a.hasData())return a;let n=this._findCoveringTileCache[r.id],o=n[i.key];if((a=o?r.getTileByID(o):null)&&a.hasData()||null===o)return a;let s=a?a.tileID:i,l=s.overscaledZ,h=r.getSource().minzoom,u=[];if(!o){let n=r.getSource().maxzoom;if(i.canonical.z>=n){let a=i.canonical.z-n;r.getSource().reparseOverscaled?(l=Math.max(i.canonical.z+2,r.transform.tileZoom),s=new e.aG(l,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a)):0!==a&&(l=n,s=new e.aG(l,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a))}s.key!==i.key&&(u.push(s.key),a=r.getTile(s))}let c=e=>{u.forEach(i=>{n[i]=e}),u.length=0};for(l-=1;l>=h&&(!a||!a.hasData());l--){a&&c(a.tileID.key);let e=s.calculateScaledKey(l);if((a=r.getTileByID(e))&&a.hasData())break;let i=n[e];if(null===i)break;void 0===i?u.push(e):a=r.getTileByID(i)}return c(a?a.tileID.key:null),a&&a.hasData()?a:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,i){let r=this._tilesDirty[e];r||(r=this._tilesDirty[e]={}),r[i.key]=!0}}let rP=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],rz=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","model","symbol"];class rD{static cacheKey(e,i,r,a){let n=`${i}${a?a.cacheKey:""}`;for(let i of r)e.usedDefines.includes(i)&&(n+=`/${i}`);return n}constructor(i,r,a,n,o,s){let l=i.gl;this.program=l.createProgram(),this.configuration=n,this.name=r,this.fixedDefines=[...s];let h=n?n.getBinderAttributes():[],u=(a.staticAttributes||[]).concat(h),c=n?n.defines():[];c=c.concat(s.map(e=>`#define ${e}`));let d="#version 300 es\n",p=d+c.concat("precision mediump float;",iM,iN.fragmentSource).join("\n");for(let e of a.fragmentIncludes)p+=`
95${iF[e]}`;p+=`
96${a.fragmentSource}`;let f=d+c.concat("precision highp float;",iM,iN.vertexSource).join("\n");for(let e of a.vertexIncludes)f+=`
97${iF[e]}`;this.forceManualRenderingForInstanceIDShaders=i.forceManualRenderingForInstanceIDShaders&&-1!==a.vertexSource.indexOf("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&(f+="\nuniform int u_instanceID;\n"),f+=`
98${a.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(f=f.replaceAll("gl_InstanceID","u_instanceID"));let m=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(m,p),l.compileShader(m),l.attachShader(this.program,m);let _=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(_,f),l.compileShader(_),l.attachShader(this.program,_),this.attributes={},this.numAttributes=u.length;for(let e=0;e<this.numAttributes;e++)if(u[e]){let i=u[e].startsWith("a_")?u[e]:`a_${u[e]}`;l.bindAttribLocation(this.program,e,i),this.attributes[i]=e}l.linkProgram(this.program),l.deleteShader(_),l.deleteShader(m),this.fixedUniforms=o(i),this.binderUniforms=n?n.getUniforms(i):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms={u_instanceID:new e.bN(i)}),(s.includes("TERRAIN")||-1!==r.indexOf("symbol")||-1!==r.indexOf("circle"))&&(this.terrainUniforms={u_dem:new e.bN(i),u_dem_prev:new e.bN(i),u_dem_tl:new e.bK(i),u_dem_scale:new e.bM(i),u_dem_tl_prev:new e.bK(i),u_dem_scale_prev:new e.bM(i),u_dem_size:new e.bM(i),u_dem_lerp:new e.bM(i),u_exaggeration:new e.bM(i),u_depth:new e.bN(i),u_depth_size_inv:new e.bK(i),u_depth_range_unpack:new e.bK(i),u_occluder_half_size:new e.bM(i),u_occlusion_depth_offset:new e.bM(i),u_meter_to_dem:new e.bM(i),u_label_plane_matrix_inv:new e.bJ(i)}),s.includes("GLOBE")&&(this.globeUniforms={u_tile_tl_up:new e.bL(i),u_tile_tr_up:new e.bL(i),u_tile_br_up:new e.bL(i),u_tile_bl_up:new e.bL(i),u_tile_up_scale:new e.bM(i)}),s.includes("FOG")&&(this.fogUniforms={u_fog_matrix:new e.bJ(i),u_fog_range:new e.bK(i),u_fog_color:new e.ca(i),u_fog_horizon_blend:new e.bM(i),u_fog_vertical_limit:new e.bK(i),u_fog_temporal_offset:new e.bM(i),u_frustum_tl:new e.b
98L(i),u_frustum_tr:new e.bL(i),u_frustum_br:new e.bL(i),u_frustum_bl:new e.bL(i),u_globe_pos:new e.bL(i),u_globe_radius:new e.bM(i),u_globe_transition:new e.bM(i),u_is_globe:new e.bN(i),u_viewport:new e.bK(i)}),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms={u_cutoff_params:new e.ca(i)}),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms={u_lighting_ambient_color:new e.bL(i),u_lighting_directional_dir:new e.bL(i),u_lighting_directional_color:new e.bL(i),u_ground_radiance:new e.bL(i)}),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms={u_light_matrix_0:new e.bJ(i),u_light_matrix_1:new e.bJ(i),u_fade_range:new e.bK(i),u_shadow_normal_offset:new e.bL(i),u_shadow_intensity:new e.bM(i),u_shadow_texel_size:new e.bM(i),u_shadow_map_resolution:new e.bM(i),u_shadow_direction:new e.bL(i),u_shadow_bias:new e.bL(i),u_shadowmap_0:new e.bN(i),u_shadowmap_1:new e.bN(i)})}}setTerrainUniformValues(e,i){if(!this.terrainUniforms)return;let r=this.terrainUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a]&&r[a].set(this.program,a,i[a])}setGlobeUniformValues(e,i){if(!this.globeUniforms)return;let r=this.globeUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a]&&r[a].set(this.program,a,i[a])}setFogUniformValues(e,i){if(!this.fogUniforms)return;let r=this.fogUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setCutoffUniformValues(e,i){if(!this.cutoffUniforms)return;let r=this.cutoffUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setLightsUniformValues(e,i){if(!this.lightsUniforms)return;let r=this.lightsUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setShadowUniformValues(e,i){if(this.failedToCreate||!this.shadowUniforms)return;let r=this.shadowUniforms;for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}_drawDebugWireframe(i,r,a,n,o,s,l,h,u,c){let d=i.options.wireframe;if(!1===d.terrain&&!1===d.layers2D&&!1===d.layers3D)return;let p=i.context;if(!(!(!d.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!d.layers2D||i._terrain&&i._terrain.renderingToTexture||!rP.includes(this.name))||!(!d.layers3D||!rz.includes(this.name))))return;let f=p.gl,m=i.wireframeDebugCache.getLinesFromTrianglesBuffer(i.frameCounter,o,p);if(!m)return;let _=[...this.fixedDefines];_.push("DEBUG_WIREFRAME");let g=i.getOrCreateProgram(this.name,{config:this.configuration,defines:_});p.program.set(g.program);let y=(e,i,r)=>{if(i[e]&&r[e])for(let a in i[e])r[e][a]&&r[e][a].set(r.program,a,i[e][a].current)};u&&u.setUniforms(g.program,p,g.binderUniforms,l,{zoom:h}),y("fixedUniforms",this,g),y("terrainUniforms",this,g),y("globeUniforms",this,g),y("fogUniforms",this,g),y("lightsUniforms",this,g),y("shadowUniforms",this,g),m.bind(),p.setColorMode(new tQ([f.ONE,f.ONE_MINUS_SRC_ALPHA,f.ZERO,f.ONE],e.aj.transparent,[!0,!0,!0,!1])),p.setDepthMode(new t0(r.func===f.LESS?f.LEQUAL:r.func,t0.ReadOnly,r.range)),p.setStencilMode(t1.disabled);let x=3*s.primitiveLength*2,v=3*s.primitiveOffset*4;if(this.forceManualRenderingForInstanceIDShaders){let e=c||1;for(let i=0;i<e;++i)g.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",i),f.drawElements(f.LINES,x,f.UNSIGNED_SHORT,v)}else c&&c>1?f.drawElementsInstanced(f.LINES,x,f.UNSIGNED_SHORT,v,c):f.drawElements(f.LINES,x,f.UNSIGNED_SHORT,v);o.bind(),p.program.set(this.program),p.setDepthMode(r),p.setStencilMode(a),p.setColorMode(n)}checkUniforms(e,i,r){if(this.fixedDefines.includes(i)){for(let a of Object.keys(r))if(!r[a].initialized)throw Error(`Program '${this.name}', from draw '${e}': uniform ${a} not set but required by ${i} being defined`)}}draw(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=e.context,y=g.gl;if(this.failedToCreate)return;for(let e of(g.program.set(this.program),g.setDepthMode(r),g.setStencilMode(a),g.setColorMode(n),g.setCullFace(o),Object.keys(this.fixedUniforms)))this.fixedUniforms[e].set(this.program,e,s[e]);f&&f.setUniforms(this.program,g,this.binderUniforms,d,{zoom:p});let x={[y.POINTS]:1,[y.LINES]:2,[y.TRIANGLES]:3,[y.LINE_STRIP]:1}[i];this.checkUniforms(l,"RENDER_SHADOWS",this.shadowUniforms);let v=_&&_>0?1:void 0;for(let o of c.get()){let s=o.vaos||(o.vaos={});if((s[l]||(s[l]=new iG)).bind(g,this,h,f?f.getPaintVertexBuffers():[],u,o.vertexOffset,m||[],v),this.forceManualRenderingForInstanceIDShaders){let e=_||1;for(let r=0;r<e;++r)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",r),u?y.drawElements(i,o.primitiveLength*x,y.UNSIGNED_SHORT,o.primitiveOffset*x*2):y.drawArrays(i,o.vertexOffset,o.vertexLength)}else _&&_>1?y.drawElementsInstanced(i,o.primitiveLength*x,y.UNSIGNED_SHORT,o.primitiveOffset*x*2,_):u?y.drawElements(i,o.primitiveLength*x,y.UNSIGNED_SHORT,o.primitiveOffset*x*2):y.drawArrays(i,o.vertexOffset,o.vertexLength);i===y.TRIANGLES&&u&&this._drawDebugWireframe(e,r,a,n,u,o,d,p,f,_)}
98}}function rR(i,r){let a=Math.pow(2,r.tileID.overscaledZ),n=r.tileSize*Math.pow(2,i.transform.tileZoom)/a,o=n*(r.tileID.canonical.x+r.tileID.wrap*a),s=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.ar(r,1,i.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}let rL={terrain:0,flat:1},rO=e.ab.mat4.create(),rk=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x)=>{let v=r.style.light,b=v.properties.get("position"),w=[b.x,b.y,b.z],T=e.ab.mat3.create();"viewport"===v.properties.get("anchor")&&(e.ab.mat3.fromRotation(T,-r.transform.angle),e.ab.vec3.transformMat3(w,w,T));let S=v.properties.get("color"),M=r.transform,E={u_matrix:i,u_lightpos:w,u_lightintensity:v.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+a,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rO,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:rL[c],u_base_type:rL[d],u_ao:o,u_edge_radius:s,u_width_scale:l,u_flood_light_color:_,u_vertical_scale:g,u_flood_light_intensity:y,u_ground_shadow_factor:x};return"globe"===M.projection.name&&(E.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],E.u_zoom_transition=p,E.u_inv_rot_matrix=m,E.u_merc_center=f,E.u_up_dir=M.projection.upVector(new e.bT(0,0,0),f[0]*e.ag,f[1]*e.ag),E.u_height_lift=u),E},rF=(e,i,r,a,n,o)=>({u_matrix:e,u_edge_radius:i,u_width_scale:r,u_vertical_scale:a,u_height_type:rL[n],u_base_type:rL[o]}),rB=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y)=>{let x=rk(i,r,a,n,o,s,l,h,c,d,p,f,m,_,g,y,1,[0,0,0]),v={u_height_factor:-Math.pow(2,h.overscaledZ)/u.tileSize/8};return e.l(x,rR(r,u),v)},rN=(e,i)=>({u_matrix:e,u_emissive_strength:i}),rV=(i,r,a,n)=>e.l(rN(i,r),rR(a,n)),rU=(e,i,r)=>({u_matrix:e,u_world:r,u_emissive_strength:i}),rj=(i,r,a,n,o)=>e.l(rV(i,r,a,n),{u_world:o}),rG=(i,r,a,n)=>{let o=e.ag/a.tileSize;return{u_matrix:i,u_camera_to_center_distance:r.getCameraToCenterDistance(n),u_extrude_scale:[r.pixelsToGLUnits[0]/o,r.pixelsToGLUnits[1]/o]}},rq=(e,i,r=1)=>({u_matrix:e,u_color:i.toRenderColor(null),u_overlay:0,u_overlay_scale:r}),rZ=e.ab.mat4.create(),rH=(i,r,a,n,o,s,l)=>{let h=i.transform,u="globe"===h.projection.name,c=u?e.cN(h.zoom,r.canonical)*h._pixelsPerMercatorPixel:e.ar(a,1,s),d={u_matrix:r.projMatrix,u_extrude_scale:c,u_intensity:l,u_inv_rot_matrix:rZ,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(u){d.u_inv_rot_matrix=n,d.u_merc_center=o,d.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],d.u_zoom_transition=e.ae(h.zoom);let i=o[0]*e.ag,a=o[1]*e.ag;d.u_up_dir=h.projection.upVector(new e.bT(0,0,0),i,a)}return d};function r$(e,[i,r,a,n],[o,s]){if(o===s)return[0,0,0,0];let l=255*(e-1)/(e*(s-o));return[i*l,r*l,a*l,n*l]}function rW(e,i,[r,a]){return r===a?0:.5/e+(i-r)*(e-1)/(e*(a-r))}let rX=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)=>({u_matrix:i,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:c,u_fade_t:d.mix,u_opacity:d.opacity*p.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:p.paint.get("raster-brightness-min"),u_brightness_high:p.paint.get("raster-brightness-max"),u_saturation_factor:e.cO(p.paint.get("raster-saturation")),u_contrast_factor:e.cP(p.paint.get("raster-contrast")),u_spin_weights:function(e){let i=Math.sin(e*=Math.PI/180),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*i-r+1)/3,(Math.sqrt(3)*i-r+1)/3]}(p.paint.get("raster-hue-rotate")),u_perspective_transform:f,u_raster_elevation:m,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:u,u_colorization_mix:r$(e.cQ,g,x),u_colorization_offset:rW(e.cQ,y,x),u_color_ramp:_,u_texture_offset:[b/(v+2*b),v/(v+2*b)],u_texture_res:[v+2*b,v+2*b],u_emissive_strength:w}),rY=(e,i,r,a,n,o,s,l,h,u,c,d)=>({u_matrix:e,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:a,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:u,u_fade_t:c.mix,u_opacity:c.opacity,u_image0:0,u_image1:1,u_raster_elevation:d,u_zoom_transition:s,u_merc_center:l,u_cutoff_params:h}),rK=(e,i,r,a,n,o,s,l,h,u)=>({u_particle_texture:e,u_particle_texture_side_len:i,u_tile_offset:r,u_velocity:a,u_color_ramp:o,u_velocity_res:n,u_max_speed:s,u_uv_offset:l,u_data_scale:[255*h[0],255*h[1]],u_data_offset:u,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),rJ=(e,i,r,a,n,o,s,l,h,u)=>({u_particle_texture:e,u_particle_texture_side_len:i,u_velocity:r,u_velocity_res:a,u_max_speed:n,u_speed_factor:o,u_reset_rate:s,u_rand_seed:Math.random(),u_uv_offset:l,u_data_scale:[255*h[0],255*h[1]],u_data_offset:u,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),rQ=e.ab.mat4.create(),r0=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T)=>{let S=o.transform,M={u_is_size_zoom_constant:+("constant"===i||"source"===i),u_is_size_feature_constant:+("constant"===i||"camera"===i),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:S.getCameraToCenterDistance(v),u_rotate_symbol:+a,u_aspect_ratio:S.width/S.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:l,u_coord_matrix:h,u_is_text:+c,u_elevation_from_sea:u?1:0,u_pitch_with_map:+n,u_texsize:d,u_texsize_icon:p,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rQ,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:rQ,u_up_vector:[0,-1,0],u_color_adj_mat:b,u_icon_transition:w||0,u_gamma_scale:n?o.transform.getCameraToCenterDistance(v)*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.q.devicePixelRatio,u_is_halo:+f,u_scale_factor:T||1};return"globe"===v.name&&(M.u_tile_id=[m.canonical.x,m.canonical.y,1<<m.canonical.z],M.u_zoom_transition=_,M.u_inv_rot_matrix=y,M.u_merc_center=g,M.u_camera_forward=S._camera.forward(),M.u_ecef_origin=e.cR(S.globeMatrix,m.toUnwrapped()),M.u_tile_matrix=Float32Array.from(S.globeMatrix),M.u_up_vector=x),M},r1=(e,i,r,a)=>({u_matrix:e,u_emissive_strength:i,u_opacity:r,u_color:a}),r2=(i,r,a,n,o,s,l,h,u)=>e.l(function(i,r,a,n,o,s){let{width:l,height:h}=n.imageManager.getPixelSize(r),u=Math.pow(2,s.tileID.overscaledZ
98),c=s.tileSize*Math.pow(2,n.transform.tileZoom)/u,d=c*(s.tileID.canonical.x+s.tileID.wrap*u),p=c*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:a.tl,u_pattern_br:a.br,u_texsize:[l,h],u_pattern_size:a.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/e.ar(s,1,n.transform.tileZoom),1/e.ar(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}}(0,s,l,n,h,u),{u_matrix:i,u_emissive_strength:r,u_opacity:a}),r3=new Float32Array(e.ab.mat4.identity([])),r4=(i,r,a,n,o,s,l,h,u,c,d,p,f,m=[0,0,0],_)=>{let g=o.style.light,y=g.properties.get("position"),x=[-y.x,-y.y,y.z],v=e.ab.mat3.create();"viewport"===g.properties.get("anchor")&&(e.ab.mat3.fromRotation(v,-o.transform.angle),e.ab.vec3.transformMat3(x,x,v));let b="MASK"===d.alphaMode,w=g.properties.get("color").toRenderColor(null),T=f.paint.get("model-ambient-occlusion-intensity"),S=f.paint.get("model-color").constantOr(e.aj.white).toRenderColor(null),M=f.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:i,u_lighting_matrix:r,u_normal_matrix:a,u_node_matrix:n||r3,u_lightpos:x,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_camera_pos:m,u_opacity:s,u_baseTextureIsAlpha:0,u_alphaMask:+b,u_alphaCutoff:d.alphaCutoff,u_baseColorFactor:[l.r,l.g,l.b,l.a],u_emissiveFactor:[h[0],h[1],h[2],1],u_metallicFactor:u,u_roughnessFactor:c,u_baseColorTexture:t9.BaseColor,u_metallicRoughnessTexture:t9.MetallicRoughness,u_normalTexture:t9.Normal,u_occlusionTexture:t9.Occlusion,u_emissionTexture:t9.Emission,u_lutTexture:t9.LUT,u_color_mix:[S.r,S.g,S.b,M],u_aoIntensity:T,u_emissive_strength:p,u_occlusionTextureTransform:_||[0,0,0,0]}},r5=(e,i=r3,r=r3)=>({u_matrix:e,u_instance:i,u_node_matrix:r}),r6={fillExtrusion:i=>({u_matrix:new e.bJ(i),u_lightpos:new e.bL(i),u_lightintensity:new e.bM(i),u_lightcolor:new e.bL(i),u_vertical_gradient:new e.bM(i),u_opacity:new e.bM(i),u_edge_radius:new e.bM(i),u_width_scale:new e.bM(i),u_ao:new e.bK(i),u_height_type:new e.bN(i),u_base_type:new e.bN(i),u_tile_id:new e.bL(i),u_zoom_transition:new e.bM(i),u_inv_rot_matrix:new e.bJ(i),u_merc_center:new e.bK(i),u_up_dir:new e.bL(i),u_height_lift:new e.bM(i),u_flood_light_color:new e.bL(i),u_vertical_scale:new e.bM(i),u_flood_light_intensity:new e.bM(i),u_ground_shadow_factor:new e.bL(i)}),fillExtrusionDepth:i=>({u_matrix:new e.bJ(i),u_edge_radius:new e.bM(i),u_width_scale:new e.bM(i),u_vertical_scale:new e.bM(i),u_height_type:new e.bN(i),u_base_type:new e.bN(i)}),fillExtrusionPattern:i=>({u_matrix:new e.bJ(i),u_lightpos:new e.bL(i),u_lightintensity:new e.bM(i),u_lightcolor:new e.bL(i),u_vertical_gradient:new e.bM(i),u_height_factor:new e.bM(i),u_edge_radius:new e.bM(i),u_width_scale:new e.bM(i),u_ao:new e.bK(i),u_height_type:new e.bN(i),u_base_type:new e.bN(i),u_tile_id:new e.bL(i),u_zoom_transition:new e.bM(i),u_inv_rot_matrix:new e.bJ(i),u_merc_center:new e.bK(i),u_up_dir:new e.bL(i),u_height_lift:new e.bM(i),u_image:new e.bN(i),u_texsize:new e.bK(i),u_pixel_coord_upper:new e.bK(i),u_pixel_coord_lower:new e.bK(i),u_tile_units_to_pixels:new e.bM(i),u_opacity:new e.bM(i)}),fillExtrusionGroundEffect:i=>({u_matrix:new e.bJ(i),u_opacity:new e.bM(i),u_ao_pass:new e.bM(i),u_meter_to_tile:new e.bM(i),u_ao:new e.bK(i),u_flood_light_intensity:new e.bM(i),u_flood_light_color:new e.bL(i),u_attenuation:new e.bM(i),u_edge_radius:new e.bM(i),u_fb:new e.bN(i),u_fb_size:new e.bM(i),u_dynamic_offset:new e.bM(i)}),fill:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i)}),fillPattern:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_image:new e.bN(i),u_texsize:new e.bK(i),u_pixel_coord_upper:new e.bK(i),u_pixel_coord_lower:new e.bK(i),u_tile_units_to_pixels:new e.bM(i)}),fillOutline:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_world:new e.bK(i)}),fillOutlinePattern:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_world:new e.bK(i),u_image:new e.bN(i),u_texsize:new e.bK(i),u_pixel_coord_upper:new e.bK(i),u_pixel_coord_lower:new e.bK(i),u_tile_units_to_pixels:new e.bM(i)}),circle:e.cS,collisionBox:i=>({u_matrix:new e.bJ(i),u_camera_to_center_distance:new e.bM(i),u_extrude_scale:new e.bK(i)}),collisionCircle:i=>({u_matrix:new e.bJ(i),u_inv_matrix:new e.bJ(i),u_camera_to_center_distance:new e.bM(i),u_viewport_size:new e.bK(i)}),debug:i=>({u_color:new e.cz(i),u_matrix:new e.bJ(i),u_overlay:new e.bN(i),u_overlay_scale:new e.bM(i)}),clippingMask:i=>({u_matrix:new e.bJ(i)}),heatmap:i=>({u_extrude_scale:new e.bM(i),u_intensity:new e.bM(i),u_matrix:new e.bJ(i),u_inv_rot_matrix:new e.bJ(i),u_merc_center:new e.bK(i),u_tile_id:new e.bL(i),u_zoom_transition:new e.bM(i),u_up_dir:new e.b
98L(i)}),heatmapTexture:i=>({u_image:new e.bN(i),u_color_ramp:new e.bN(i),u_opacity:new e.bM(i)}),hillshade:i=>({u_matrix:new e.bJ(i),u_image:new e.bN(i),u_latrange:new e.bK(i),u_light:new e.bK(i),u_shadow:new e.cz(i),u_highlight:new e.cz(i),u_emissive_strength:new e.bM(i),u_accent:new e.cz(i)}),hillshadePrepare:i=>({u_matrix:new e.bJ(i),u_image:new e.bN(i),u_dimension:new e.bK(i),u_zoom:new e.bM(i)}),line:e.cT,linePattern:e.cU,raster:i=>({u_matrix:new e.bJ(i),u_normalize_matrix:new e.bJ(i),u_globe_matrix:new e.bJ(i),u_merc_matrix:new e.bJ(i),u_grid_matrix:new e.cA(i),u_tl_parent:new e.bK(i),u_scale_parent:new e.bM(i),u_fade_t:new e.bM(i),u_opacity:new e.bM(i),u_image0:new e.bN(i),u_image1:new e.bN(i),u_brightness_low:new e.bM(i),u_brightness_high:new e.bM(i),u_saturation_factor:new e.bM(i),u_contrast_factor:new e.bM(i),u_spin_weights:new e.bL(i),u_perspective_transform:new e.bK(i),u_raster_elevation:new e.bM(i),u_zoom_transition:new e.bM(i),u_merc_center:new e.bK(i),u_cutoff_params:new e.ca(i),u_colorization_mix:new e.ca(i),u_colorization_offset:new e.bM(i),u_color_ramp:new e.bN(i),u_texture_offset:new e.bK(i),u_texture_res:new e.bK(i),u_emissive_strength:new e.bM(i)}),rasterParticle:i=>({u_matrix:new e.bJ(i),u_normalize_matrix:new e.bJ(i),u_globe_matrix:new e.bJ(i),u_merc_matrix:new e.bJ(i),u_grid_matrix:new e.cA(i),u_tl_parent:new e.bK(i),u_scale_parent:new e.bM(i),u_fade_t:new e.bM(i),u_opacity:new e.bM(i),u_image0:new e.bN(i),u_image1:new e.bN(i),u_raster_elevation:new e.bM(i),u_zoom_transition:new e.bM(i),u_merc_center:new e.bK(i),u_cutoff_params:new e.ca(i)}),rasterParticleTexture:i=>({u_texture:new e.bN(i),u_opacity:new e.bM(i)}),rasterParticleDraw:i=>({u_particle_texture:new e.bN(i),u_particle_texture_side_len:new e.bM(i),u_tile_offset:new e.bK(i),u_velocity:new e.bN(i),u_color_ramp:new e.bN(i),u_velocity_res:new e.bK(i),u_max_speed:new e.bM(i),u_uv_offset:new e.bK(i),u_data_scale:new e.bK(i),u_data_offset:new e.bM(i),u_particle_pos_scale:new e.bM(i),u_particle_pos_offset:new e.bK(i)}),rasterParticleUpdate:i=>({u_particle_texture:new e.bN(i),u_particle_texture_side_len:new e.bM(i),u_velocity:new e.bN(i),u_velocity_res:new e.bK(i),u_max_speed:new e.bM(i),u_speed_factor:new e.bM(i),u_reset_rate:new e.bM(i),u_rand_seed:new e.bM(i),u_uv_offset:new e.bK(i),u_data_scale:new e.bK(i),u_data_offset:new e.bM(i),u_particle_pos_scale:new e.bM(i),u_particle_pos_offset:new e.bK(i)}),symbol:i=>({u_is_size_zoom_constant:new e.bN(i),u_is_size_feature_constant:new e.bN(i),u_size_t:new e.bM(i),u_size:new e.bM(i),u_camera_to_center_distance:new e.bM(i),u_rotate_symbol:new e.bN(i),u_aspect_ratio:new e.bM(i),u_fade_change:new e.bM(i),u_matrix:new e.bJ(i),u_label_plane_matrix:new e.bJ(i),u_coord_matrix:new e.bJ(i),u_is_text:new e.bN(i),u_elevation_from_sea:new e.bN(i),u_pitch_with_map:new e.bN(i),u_texsize:new e.bK(i),u_texsize_icon:new e.bK(i),u_texture:new e.bN(i),u_texture_icon:new e.bN(i),u_gamma_scale:new e.bM(i),u_device_pixel_ratio:new e.bM(i),u_tile_id:new e.bL(i),u_zoom_transition:new e.bM(i),u_inv_rot_matrix:new e.bJ(i),u_merc_center:new e.bK(i),u_camera_forward:new e.bL(i),u_tile_matrix:new e.bJ(i),u_up_vector:new e.bL(i),u_ecef_origin:new e.bL(i),u_is_halo:new e.bN(i),u_icon_transition:new e.bM(i),u_color_adj_mat:new e.bJ(i),u_scale_factor:new e.bM(i)}),background:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_opacity:new e.bM(i),u_color:new e.cz(i)}),backgroundPattern:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_opacity:new e.bM(i),u_image:new e.bN(i),u_pattern_tl:new e.bK(i),u_pattern_br:new e.bK(i),u_texsize:new e.bK(i),u_pattern_size:new e.bK(i),u_pixel_coord_upper:new e.bK(i),u_pixel_coord_lower:new e.bK(i),u_pattern_units_to_pixels:new e.bK(i)}),terrainRaster:i=>({u_matrix:new e.bJ(i),u_image0:new e.bN(i),u_skirt_height:new e.bM(i),u_ground_shadow_factor:new e.bL(i)}),skybox:i=>({u_matrix:new e.bJ(i),u_sun_direction:new e.bL(i),u_cubemap:new e.bN(i),u_opacity:new e.bM(i),u_temporal_offset:new e.bM(i)}),skyboxGradient:i=>({u_matrix:new e.bJ(i),u_color_ramp:new e.bN(i),u_center_direction:new e.bL(i),u_radius:new e.bM(i),u_opacity:new e.bM(i),u_temporal_offset:new e.bM(i)}),skyboxCapture:i=>({u_matrix_3f:new e.cA(i),u_sun_direction:new e.bL(i),u_sun_intensity:new e.bM(i),u_color_tint_r:new e.ca(i),u_color_tint_m:new e.ca(i),u_luminance:new e.bM(i)}),globeRaster:i=>({u_proj_matrix:new e.bJ(i),u_globe_matrix:new e.bJ(i),u_normalize_matrix:new e.bJ(i),u_merc_matrix:new e.bJ(i),u_zoom_transition:new e.bM(i),u_merc_center:new e.bK(i),u_image0:new e.bN(i),u_grid_matrix:new e.cA(i),u_skirt_height:new e.bM(i),u_far_z_cutoff:new e.bM(i),u_frustum_tl:new e.b
98L(i),u_frustum_tr:new e.bL(i),u_frustum_br:new e.bL(i),u_frustum_bl:new e.bL(i),u_globe_pos:new e.bL(i),u_globe_radius:new e.bM(i),u_viewport:new e.bK(i)}),globeAtmosphere:i=>({u_frustum_tl:new e.bL(i),u_frustum_tr:new e.bL(i),u_frustum_br:new e.bL(i),u_frustum_bl:new e.bL(i),u_horizon:new e.bM(i),u_transition:new e.bM(i),u_fadeout_range:new e.bM(i),u_color:new e.ca(i),u_high_color:new e.ca(i),u_space_color:new e.ca(i),u_temporal_offset:new e.bM(i),u_horizon_angle:new e.bM(i)}),model:i=>({u_matrix:new e.bJ(i),u_lighting_matrix:new e.bJ(i),u_normal_matrix:new e.bJ(i),u_node_matrix:new e.bJ(i),u_lightpos:new e.bL(i),u_lightintensity:new e.bM(i),u_lightcolor:new e.bL(i),u_camera_pos:new e.bL(i),u_opacity:new e.bM(i),u_baseColorFactor:new e.ca(i),u_emissiveFactor:new e.ca(i),u_metallicFactor:new e.bM(i),u_roughnessFactor:new e.bM(i),u_baseTextureIsAlpha:new e.bN(i),u_alphaMask:new e.bN(i),u_alphaCutoff:new e.bM(i),u_baseColorTexture:new e.bN(i),u_metallicRoughnessTexture:new e.bN(i),u_normalTexture:new e.bN(i),u_occlusionTexture:new e.bN(i),u_emissionTexture:new e.bN(i),u_lutTexture:new e.bN(i),u_color_mix:new e.ca(i),u_aoIntensity:new e.bM(i),u_emissive_strength:new e.bM(i),u_occlusionTextureTransform:new e.ca(i)}),modelDepth:i=>({u_matrix:new e.bJ(i),u_instance:new e.bJ(i),u_node_matrix:new e.bJ(i)}),groundShadow:i=>({u_matrix:new e.bJ(i),u_ground_shadow_factor:new e.bL(i)}),stars:i=>({u_matrix:new e.bJ(i),u_up:new e.bL(i),u_right:new e.bL(i),u_intensity_multiplier:new e.bM(i)}),snowParticle:i=>({u_modelview:new e.bJ(i),u_projection:new e.bJ(i),u_time:new e.bM(i),u_cam_pos:new e.bL(i),u_velocityConeAperture:new e.bM(i),u_velocity:new e.bM(i),u_horizontalOscillationRadius:new e.bM(i),u_horizontalOscillationRate:new e.bM(i),u_boxSize:new e.bM(i),u_billboardSize:new e.bM(i),u_simpleShapeParameters:new e.bK(i),u_screenSize:new e.bK(i),u_thinningCenterPos:new e.bK(i),u_thinningShape:new e.bL(i),u_thinningAffectedRatio:new e.bM(i),u_thinningParticleOffset:new e.bM(i),u_particleColor:new e.ca(i),u_direction:new e.bL(i)}),rainParticle:i=>({u_modelview:new e.bJ(i),u_projection:new e.bJ(i),u_time:new e.bM(i),u_cam_pos:new e.bL(i),u_texScreen:new e.bN(i),u_velocityConeAperture:new e.bM(i),u_velocity:new e.bM(i),u_boxSize:new e.bM(i),u_rainDropletSize:new e.bK(i),u_distortionStrength:new e.bM(i),u_rainDirection:new e.bL(i),u_color:new e.ca(i),u_screenSize:new e.bK(i),u_thinningCenterPos:new e.bK(i),u_thinningShape:new e.bL(i),u_thinningAffectedRatio:new e.bM(i),u_thinningParticleOffset:new e.bM(i),u_shapeDirectionalPower:new e.bM(i),u_shapeNormalPower:new e.bM(i),u_mode:new e.bM(i)}),vignette:i=>({u_vignetteShape:new e.bL(i),u_vignetteColor:new e.ca(i)}),occlusion:i=>({u_matrix:new e.bJ(i),u_anchorPos:new e.bL(i),u_screenSizePx:new e.bK(i),u_occluderSizePx:new e.bK(i),u_color:new e.ca(i)})};class r8{constructor(e,i,r,a){this.id=r8.uniqueIdxCounter,r8.uniqueIdxCounter++,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||a||i.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=r8.uniqueIdxCounter,r8.uniqueIdxCounter++;let i=this.context.gl;this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}r8.uniqueIdxCounter=0;let r9={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class r7{constructor(e,i,r,a,n,o){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=a,this.instanceCount=o,this.context=e;let s=e.gl;this.buffer=s.createBuffer(),e.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||i.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){let i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}
98enableAttributes(e,i){for(let r=0;r<this.attributes.length;r++){let a=i.attributes[this.attributes[r].name];void 0!==a&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,i,r){for(let a=0;a<this.attributes.length;a++){let n=this.attributes[a],o=i.attributes[n.name];void 0!==o&&e.vertexAttribPointer(o,n.components,e[r9[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}setVertexAttribDivisor(e,i,r){for(let a=0;a<this.attributes.length;a++){let n=i.attributes[this.attributes[a].name];void 0!==n&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(n,r)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ae{constructor(e,i,r,a,n){this.context=e,this.width=i,this.height=r;let o=this.framebuffer=e.gl.createFramebuffer();a&&(this.colorAttachment=new rf(e,o)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new rm(e,o):new r_(e,o))}destroy(){let e=this.context.gl;if(this.colorAttachment){let i=this.colorAttachment.get();i&&e.deleteTexture(i)}if(this.depthAttachment&&this.depthAttachmentType){if("renderbuffer"===this.depthAttachmentType){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}else{let i=this.depthAttachment.get();i&&e.deleteTexture(i)}}e.deleteFramebuffer(this.framebuffer)}}class at{constructor(e,i){this.gl=e,this.clearColor=new iH(this),this.clearDepth=new i$(this),this.clearStencil=new iW(this),this.colorMask=new iX(this),this.depthMask=new iY(this),this.stencilMask=new iK(this),this.stencilFunc=new iJ(this),this.stencilOp=new iQ(this),this.stencilTest=new i0(this),this.depthRange=new i1(this),this.depthTest=new i2(this),this.depthFunc=new i3(this),this.blend=new i4(this),this.blendFunc=new i5(this),this.blendColor=new i6(this),this.blendEquation=new i8(this),this.cullFace=new i9(this),this.cullFaceSide=new i7(this),this.frontFace=new re(this),this.program=new rt(this),this.activeTexture=new ri(this),this.viewport=new rr(this),this.bindFramebuffer=new ra(this),this.bindRenderbuffer=new rn(this),this.bindTexture=new ro(this),this.bindVertexBuffer=new rs(this),this.bindElementBuffer=new rl(this),this.bindVertexArrayOES=new rh(this),this.pixelStoreUnpack=new ru(this),this.pixelStoreUnpackPremultiplyAlpha=new rc(this),this.pixelStoreUnpackFlipY=new rd(this),this.options=i?{...i}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=i&&!!i.forceManualRenderingForInstanceIDShaders||this.renderer&&-1!==this.renderer.indexOf("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,i,r){return new r8(this,e,i,r)}createVertexBuffer(e,i,r,a,n){return new r7(this,e,i,r,a,n)}createRenderbuffer(e,i,r){let a=this.gl,n=a.createRenderbuffer();return this.bindRenderbuffer.set(n),a.renderbufferStorage(a.RENDERBUFFER,e,i,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,i,r,a){return new ae(this,e,i,r,a)}clear({color:e,depth:i,stencil:r,colorMask:a}){let n=this.gl,o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(a||[!0,!0,!0,!0])),void 0!==i&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(i){e.bn(i.blendFunction,tQ.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor),i.blendEquation?this.blendEquation.set(i.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(i.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}function ai(i,r,n,o,s,l,h){let u=i.context,c=u.gl,d=i.transform,p=i.getOrCreateProgram("collisionBox"),f=[],m=0,_=0;for(let a=0;a<o.length;a++){let u=o[a],g=r.getTile(u),y=g.getBucket(n);if(!y)continue;let x=function(e,i,r){if(i.projection.name===r.projection.name)return e.projMatrix;let a=r.clone();return a.setProjection(i.projection),tD(a,i.getProjection(),e)}(u,y,d),v=x;0===s[0]&&0===s[1]||(v=i.translatePosMatrix(x,g,s,l));let b=h?y.textCollisionBox:y.iconCollisionBox,w=y.collisionCircleArray;
98if(w.length>0){let i=e.ab.mat4.create(),r=v;e.ab.mat4.mul(i,y.placementInvProjMatrix,d.glCoordMatrix),e.ab.mat4.mul(i,i,y.placementViewportMatrix),f.push({circleArray:w,circleOffset:_,transform:r,invTransform:i,projection:y.getProjection()}),m+=w.length/4,_=m}b&&(i.terrain&&i.terrain.setupElevationDraw(g,p),p.draw(i,c.LINES,t0.disabled,t1.disabled,i.colorModeForRenderPass(),t2.disabled,rG(v,d,g,y.getProjection()),n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,null,d.zoom,null,[b.collisionVertexBuffer,b.collisionVertexBufferExt]))}if(!h||!f.length)return;let g=i.getOrCreateProgram("collisionCircle"),y=new e.cV;y.resize(4*m),y._trim();let x=0;for(let e of f)for(let i=0;i<e.circleArray.length/4;i++){let r=4*i,a=e.circleArray[r+0],n=e.circleArray[r+1],o=e.circleArray[r+2],s=e.circleArray[r+3];y.emplace(x++,a,n,o,s,0),y.emplace(x++,a,n,o,s,1),y.emplace(x++,a,n,o,s,2),y.emplace(x++,a,n,o,s,3)}(!a||a.length<2*m)&&(a=function(i){let r=2*i,a=new e.aU;a.resize(r),a._trim();for(let e=0;e<r;e++){let i=6*e;a.uint16[i+0]=4*e+0,a.uint16[i+1]=4*e+1,a.uint16[i+2]=4*e+2,a.uint16[i+3]=4*e+2,a.uint16[i+4]=4*e+3,a.uint16[i+5]=4*e+0}return a}(m));let v=u.createIndexBuffer(a,!0),b=u.createVertexBuffer(y,e.cW.members,!0);for(let r of f){let a={u_matrix:r.transform,u_inv_matrix:r.invTransform,u_camera_to_center_distance:d.getCameraToCenterDistance(r.projection),u_viewport_size:[d.width,d.height]};g.draw(i,c.TRIANGLES,t0.disabled,t1.disabled,i.colorModeForRenderPass(),t2.disabled,a,n.id,b,v,e.b7.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,d.zoom)}b.destroy(),v.destroy()}let ar=e.ab.mat4.create();function aa(i){let r=i._camera.getWorldToCamera(i.worldSize,1),a=e.ab.mat4.multiply([],r,i.globeMatrix);e.ab.mat4.invert(a,a);let n=[0,0,0],o=[0,1,0,0];return e.ab.vec4.transformMat4(o,o,a),n[0]=o[0],n[1]=o[1],n[2]=o[2],e.ab.vec3.normalize(n,n),n}function an(i,r,a,n,o,s,l={}){let h=a.paint.get("icon-translate"),u=a.paint.get("text-translate"),c=a.paint.get("icon-translate-anchor"),d=a.paint.get("text-translate-anchor"),p=a.layout.get("icon-rotation-alignment"),f=a.layout.get("text-rotation-alignment"),m=a.layout.get("icon-pitch-alignment"),_=a.layout.get("text-pitch-alignment"),g=a.layout.get("icon-keep-upright"),y=a.layout.get("text-keep-upright"),x=a.paint.get("icon-color-saturation"),v=a.paint.get("icon-color-contrast"),b=a.paint.get("icon-color-brightness-min"),w=a.paint.get("icon-color-brightness-max"),T="sea"===a.layout.get("symbol-elevation-reference"),S=i.context,M=S.gl,
98E=i.transform,A="map"===p,I="map"===f,C="map"===m,P="map"===_,z=void 0!==a.layout.get("symbol-sort-key").constantOr(1),D=!1,R=i.depthModeForSublayer(0,t0.ReadOnly),L=[e.at(E.center.lng),e.aA(E.center.lat)],O=a.layout.get("text-variable-anchor"),k="globe"===E.projection.name,F=[],B=[0,-1,0];for(let o of n){let n=r.getTile(o),s=n.getBucket(a);if(!s||"mercator"===s.projection.name&&k||s.fullyClipped)continue;let p="globe"===s.projection.name,f=p?e.ae(E.zoom):0,m=tR(o,s.getProjection(),E),_=E.calculatePixelsToTileUnitsMatrix(n),S=O&&s.hasTextData(),R=s.hasIconTextFit()&&S&&s.hasIconData(),N=s.getProjection().createInversionMatrix(E,o.canonical),V=e=>{E.depthOcclusionForSymbolsAndCircles&&(a.hasInitialOcclusionOpacityProperties||i.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},U=()=>{let r=A&&"point"!==a.layout.get("symbol-placement"),l=[];V(l);let u=r||R,d=a.paint.get("icon-image-cross-fade").constantOr(0);i.terrainRenderModeElevated()&&C&&l.push("PITCH_WITH_MAP_TERRAIN"),p&&(l.push("PROJECTION_GLOBE_VIEW"),u&&l.push("PROJECTED_POS_ON_VIEWPORT")),d>0&&l.push("ICON_TRANSITION"),s.icon.zOffsetVertexBuffer&&l.push("Z_OFFSET"),0===x&&0===v&&0===b&&1===w||l.push("COLOR_ADJUSTMENT"),s.sdfIcons&&l.push("RENDER_SDF");let y=s.icon.programConfigurations.get(a.id),S=i.getOrCreateProgram("symbol",{config:y,defines:l}),I=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],P=s.iconSizeData,z=e.bp(P,E.zoom),D=C||0!==E.pitch,O=tg(m,n.tileID.canonical,C,A,E,s.getProjection(),_),F=tx(m,n.tileID.canonical,C,A,E,s.getProjection(),_),U=i.translatePosMatrix(F,n,h,c,!0),j=i.translatePosMatrix(m,n,h,c),G=u?ar:O,q=A&&!C&&!r,Z=B;(k||E.mercatorFromTransition)&&!A&&(Z=aa(E));let H=p?Z:B,$=a.getColorAdjustmentMatrix(x,v,b,w),W=r0(P.kind,z,q,C,i,j,G,U,T,!1,I,[0,0],!0,o,f,L,N,H,s.getProjection(),$,d),X=n.imageAtlasTexture?n.imageAtlasTexture:null,Y=1!==a.layout.get("icon-size").constantOr(0)||s.iconsNeedLinear,K=s.sdfIcons||i.options.rotating||i.options.zooming||Y||D?M.LINEAR:M.NEAREST,J=s.sdfIcons&&0!==a.paint.get("icon-halo-width").constantOr(1),Q=i.terrain&&C&&r?e.ab.mat4.invert(e.ab.mat4.create(),O):ar;if(r&&s.icon){let e=E.elevation,r=e?e.getAtTileOffsetFunc(o,E.center.lat,E.worldSize,s.getProjection()):null,a=ty(m,n.tileID.canonical,C,A,E,s.getProjection(),_);tw(s,m,i,!1,a,F,C,g,r,o)}return{program:S,buffers:s.icon,uniformValues:W,atlasTexture:X,atlasTextureIcon:null,atlasInterpolation:K,atlasInterpolationIcon:null,isSDF:s.sdfIcons,hasHalo:J,tile:n,labelPlaneMatrixInv:Q}},j=()=>{let r=I&&"point"!==a.layout.get("symbol-placement"),l=[],h=r||O||R;i.terrainRenderModeElevated()&&P&&l.push("PITCH_WITH_MAP_TERRAIN"),p&&(l.push("PROJECTION_GLOBE_VIEW"),h&&l.push("PROJECTED_POS_ON_VIEWPORT")),s.text.zOffsetVertexBuffer&&l.push("Z_OFFSET"),s.iconsInText&&l.push("RENDER_TEXT_AND_SYMBOL"),l.push("RENDER_SDF"),V(l);let c=s.text.programConfigurations.get(a.id),g=i.getOrCreateProgram("symbol",{config:c,defines:l}),x,v=[0,0],b=null,w=s.textSizeData;s.iconsInText&&(v=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],b=n.imageAtlasTexture?n.imageAtlasTexture:null,x=P||0!==E.pitch||i.options.rotating||i.options.zooming||"composite"===w.kind||"camera"===w.kind?M.LINEAR:M.NEAREST);let S=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],A=a.layout.get("text-size-scale-range"),C=e.aw(i.scaleFactor,A[0],A[1]),z=e.bp(w,E.zoom,C),D=tg(m,n.tileID.canonical,P,I,E,s.getProjection(),_),F=tx(m,n.tileID.canonical,P,I,E,s.getProjection(),_),U=i.translatePosMatrix(F,n,u,d,!0),j=i.translatePosMatrix(m,n,u,d),G=h?ar:D,q=I&&!P&&!r,Z=B;(k||E.mercatorFromTransition)&&!I&&(Z=aa(E));let H=r0(w.kind,z,q,P,i,j,G,U,T,!0,S,v,!0,o,f,L,N,p?Z:B,s.getProjection(),null,null,C),$=n.glyphAtlasTexture?n.glyphAtlasTexture:null,W=M.LINEAR,X=0!==a.paint.get("text-halo-width").constantOr(1),Y=i.terrain&&P&&r?e.ab.mat4.invert(e.ab.mat4.create(),D):ar;if(r&&s.text){let e=E.elevation,r=e?e.getAtTileOffsetFunc(o,E.center.lat,E.worldSize,s.getProjection()):null,a=ty(m,n.tileID.canonical,P,I,E,s.getProjection(),_);tw(s,m,i,!0,a,F,P,y,r,o)}return{program:g,buffers:s.text,uniformValues:H,atlasTexture:$,atlasTextureIcon:b,atlasInterpolation:W,atlasInterpolationIcon:x,isSDF:!0,hasHalo:X,tile:n,labelPlaneMatr
98ixInv:Y}},G=s.icon.segments.get().length,q=s.text.segments.get().length,Z=G&&!l.onlyText?U():null,H=q&&!l.onlyIcons?j():null,$=a.paint.get("icon-opacity").constantOr(1),W=a.paint.get("text-opacity").constantOr(1);if(z&&s.canOverlap){D=!0;let i=$&&!l.onlyText?s.icon.segments.get():[],r=W&&!l.onlyIcons?s.text.segments.get():[];for(let r of i)F.push({segments:new e.b7([r]),sortKey:r.sortKey,state:Z});for(let i of r)F.push({segments:new e.b7([i]),sortKey:i.sortKey,state:H})}else l.onlyText||F.push({segments:$?s.icon.segments:new e.b7([]),sortKey:0,state:Z}),l.onlyIcons||F.push({segments:W?s.text.segments:new e.b7([]),sortKey:0,state:H})}for(let e of(D&&F.sort((e,i)=>e.sortKey-i.sortKey),F)){let r=e.state;if(r){if(i.terrain?i.terrain.setupElevationDraw(r.tile,r.program,{useDepthForOcclusion:E.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:r.labelPlaneMatrixInv}):i.setupDepthForOcclusion(E.depthOcclusionForSymbolsAndCircles,r.program),S.activeTexture.set(M.TEXTURE0),r.atlasTexture&&r.atlasTexture.bind(r.atlasInterpolation,M.CLAMP_TO_EDGE,!0),r.atlasTextureIcon&&(S.activeTexture.set(M.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,M.CLAMP_TO_EDGE,!0)),i.uploadCommonLightUniforms(i.context,r.program),r.hasHalo){let n=r.uniformValues;n.u_is_halo=1,ao(r.buffers,e.segments,a,i,r.program,R,o,s,n,2),n.u_is_halo=0}else{if(r.isSDF){let n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,ao(r.buffers,e.segments,a,i,r.program,R,o,s,n,1)),n.u_is_halo=0}ao(r.buffers,e.segments,a,i,r.program,R,o,s,r.uniformValues,1)}}}}function ao(e,i,r,a,n,o,s,l,h,u){let c=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];n.draw(a,a.context.gl.TRIANGLES,o,s,l,t2.disabled,h,r.id,e.layoutVertexBuffer,e.indexBuffer,i,r.paint,a.transform.zoom,e.programConfigurations.get(r.id),c,u)}function as(i,r,a,n,o,s,l){let h,u,c,d,p;let f=i.context.gl,m=a.paint.get("fill-pattern"),_=a.is3D(),g=_?i.stencilModeFor3D():t1.disabled,y=m&&m.constantOr(1);for(let x of(l?(u=y&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=f.LINES):(u=y?"fillPattern":"fill",h=f.TRIANGLES),n)){let n=r.getTile(x);if(y&&!n.patternsLoaded())continue;let v=n.getBucket(a);if(!v)continue;i.prepareDrawTile();let b=v.programConfigurations.get(a.id),w=i.isTileAffectedByFog(x),T=i.getOrCreateProgram(u,{config:b,overrideFog:w});y&&(i.context.activeTexture.set(f.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),b.updatePaintBuffers());let S=m.constantOr(null);if(S&&n.imageAtlas){let i=n.imageAtlas,r=e.A.from(S),a=i.patternPositions[r.getSerializedPrimary()];a&&b.setConstantPatternPositions(a)}let M=i.translatePosMatrix(x.projMatrix,n,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor")),E=a.paint.get("fill-emissive-strength");if(l){d=v.indexBuffer2,p=v.segments2;let e=i.terrain&&i.terrain.renderingToTexture?i.terrain.drapeBufferSize:[f.drawingBufferWidth,f.drawingBufferHeight];c="fillOutlinePattern"===u&&y?rj(M,E,i,n,e):rU(M,E,e)}else d=v.indexBuffer,p=v.segments,c=y?rV(M,E,i,n):rN(M,E);i.uploadCommonUniforms(i.context,T,x.toUnwrapped()),T.draw(i,h,o,_?g:i.stencilModeForClipping(x),s,t2.disabled,c,a.id,v.layoutVertexBuffer,d,p,a.paint,i.transform.zoom,b,void 0)}}function al(i,r,a,n,o,s,l,h){let u;a.resetLayerRenderingStats(i);let c=i.context,d=c.gl,p=i.transform,f=a.paint.get("fill-extrusion-pattern"),m=f.constantOr(1),_=a.paint.get("fill-extrusion-opacity"),g=i.style.enable3dLights(),y=a.paint.get(g&&!m?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),x=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),y],v=a.layout.get("fill-extrusion-edge-radius"),b=v>0&&!a.paint.get("fill-extrusion-rounded-roof"),w=b?0:v,T="globe"===p.projection.name?e.d3():0,S="globe"===p.projection.name,M=S?e.ae(p.zoom):0,E=[e.at(p.center.lng),e.aA(p.center.lat)],A="none"===a.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),I=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(A?null:a.lut).toArray01().slice(0,3),C=a.paint.get("fill-extrusion-flood-light-intensity"),P=a.paint.get("fill-extrusion-vertical-scale"),z=0!==a.paint.get("fill-extrusion-line-width").constantOr(1),D=a.paint.get("fill-extrusion-height-alignment"),R=a.paint.get("fill-extrusion-base-alignment"),L=ir(i,a.paint.get("fill-extrusion-cutoff-fade-range")),O=[];S&&O.push("PROJECTION_GLOBE_VIEW"),x[0]>0&&O.push("FAUX_AO"),b&&O.push("ZERO_ROOF_RADIUS"),h&&O.push("HAS_CENTROID"),C>0&&O.push("FLOOD_LIGHT"),L.shouldRenderCutoff&&O.push("RENDER_CUTOFF"),z&&O.push("RENDER_WALL_MODE");let k="shadow"===i.renderPass,F=i.shadowRenderer;i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!0);let B=[0,0,0];if(F){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(B=ic(i.style,e,r)),k||(O.push("RENDER_SHADOWS","DEPTH_TEXTURE"),F.useNormalOffset&&O.push("NORMAL_OFFSET")),u=O.concat(["SHADOWS_SINGLE_CASCADE"])}let N=k&&F?"fillExtrusionDepth":m?"fillExtrusionPattern":"fillExtrusion",V=a.getLayerRenderingStats();for(let g of n){let n;let y=r.getTile(g),v=y.getBucket(a);if(!v||v.projection.name!==p.projection.name)continue;let b=!1;F&&(b=0===F.getMaxCascadeForTile(g.toUnwrapped()));let A=i.isTileAffectedByFog(g),U=v.programConfigurations.get(a.id),j=i.getOrCreateProgram(N,{config:U,defines:b?u:O,overrideFog:A});if(i.terrain&&i.terrain.setupElevationDraw(y,j,{useMeterToDem:!0}),!v.centroidVertexBuffer){let e=j.attributes.a_centroid_pos;void 0!==e&&d.vertexAttrib2f(e,0,0)}!k&&F&&F.setupShadows(y.tileID.toUnwrapped(),j,"vector-tile",y.tileID.overscaledZ
98),m&&(i.context.activeTexture.set(d.TEXTURE0),y.imageAtlasTexture&&y.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),U.updatePaintBuffers());let G=f.constantOr(null);if(G&&y.imageAtlas){let i=y.imageAtlas,r=e.A.from(G),a=i.patternPositions[r.getSerializedPrimary()];a&&U.setConstantPatternPositions(a)}let q=a.paint.get("fill-extrusion-vertical-gradient"),Z=1/v.tileToMeter;if(k&&F){if(function(i,r,a){let n=a.transform,o=a.shadowRenderer;if(!o)return!0;let s=i.toUnwrapped(),l=n.tileSize*o._cascades[a.currentShadowCascade].scale,h=r.maxHeight;if(n.elevation){let e=n.elevation.getMinMaxForTile(i);e&&(h+=e.max)}let u=[...o.shadowDirection];u[2]=-u[2];let c=o.computeSimplifiedTileShadowVolume(s,h,l,u);if(!c)return!1;let d=[au,ac,ad,u,[u[0],0,u[2]],[0,u[1],u[2]]],p="globe"===n.projection.name,f=n.scaleZoom(l),m=e.bR.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,f,!p),_=o.getCurrentCascadeFrustum();return 0===m.intersectsPrecise(c.vertices,c.planes,d)||0===_.intersectsPrecise(c.vertices,c.planes,d)}(y.tileID,v,i))continue;n=rF(F.calculateShadowPassMatrixFromTile(y.tileID.toUnwrapped()),w,Z,P,D,R)}else{let e=i.translatePosMatrix(g.expandedProjMatrix,y,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),r=p.projection.createInversionMatrix(p,g.canonical);n=m?rB(e,i,q,_,x,w,Z,g,y,T,D,R,M,E,r,I,P):rk(e,i,q,_,x,w,Z,g,T,D,R,M,E,r,I,P,C,B)}i.uploadCommonUniforms(c,j,g.toUnwrapped(),null,L);let H=v.segments;if("mercator"===p.projection.name&&!k&&!(H=v.getVisibleSegments(y.tileID,i.terrain,i.transform.getFrustum(0))).get().length)continue;if(V){if(k)for(let e of H.get())V.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(let e of H.get())V.numRenderedVerticesInTransparentPass+=e.primitiveLength}let $=[];(i.terrain||h)&&$.push(v.centroidVertexBuffer),S&&$.push(v.layoutVertexExtBuffer),z&&$.push(v.wallVertexBuffer),j.draw(i,c.gl.TRIANGLES,o,s,l,t2.backCCW,n,a.id,v.layoutVertexBuffer,v.indexBuffer,H,a.paint,i.transform.zoom,U,$)}i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!1)}function ah(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=i.context,w=b.gl,T=i.transform,S=i.transform.zoom,M=[],E=ir(i,a.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===c?(M.push("CLEAR_SUBPASS"),v&&(M.push("CLEAR_FROM_TEXTURE"),b.activeTexture.set(w.TEXTURE0),v.bind(w.LINEAR,w.CLAMP_TO_EDGE))):"sdf"===c&&M.push("SDF_SUBPASS"),y&&M.push("HAS_CENTROID"),E.shouldRenderCutoff&&M.push("RENDER_CUTOFF");let A=a.layout.get("fill-extrusion-edge-radius"),I=(e,r,n,c,x)=>{let w=r.programConfigurations.get(a.id),T=i.isTileAffectedByFog(e),I=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:w,defines:M,overrideFog:T}),C={u_matrix:c,u_opacity:d,u_ao_pass:u?1:0,u_meter_to_tile:x,u_ao:[p,f*x],u_flood_light_intensity:m,u_flood_light_color:_,u_attenuation:g,u_edge_radius:S>=17?0:A*x,u_fb:0,u_fb_size:v?v.size[0]:0,u_dynamic_offset:1},P=[];y&&P.push(r.hiddenByLandmarkVertexBuffer),i.uploadCommonUniforms(b,I,e.toUnwrapped(),null,E),I.draw(i,b.gl.TRIANGLES,o,s,l,h,C,a.id,r.vertexBuffer,r.indexBuffer,n,a.paint,S,w,P)};for(let o of n){let n=r.getTile(o),s=n.getBucket(a);if(!s||s.projection.name!==T.projection.name||!s.groundEffect||s.groundEffect&&!s.groundEffect.hasData())continue;let l=s.groundEffect,h=1/s.tileToMeter;{let e=i.translatePosMatrix(o.projMatrix,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),r=l.getDefaultSegment();I(o,l,r,e,h)}if(x)for(let s=0;s<4;s++){let l,u;let c=e.d4[s](o),d=r.getTile(c);if(!d)continue;let p=d.getBucket(a);if(!p||p.projection.name!==T.projection.name||!p.groundEffect||p.groundEffect&&!p.groundEffect.hasData())continue;let f=p.groundEffect;0===s?(l=[-e.ag,0,0],u=1):1===s?(l=[e.ag,0,0],u=0):2===s?(l=[0,-e.ag,0],u=3):(l=[0,e.ag,0],u=2);let m=f.regionSegments[u];if(!m)continue;let _=new Float32Array(16);e.ab.mat4.translate(_,o.projMatrix,l),I(o,f,m,i.translatePosMatrix(_,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),h)}}}let au=[1,0,0],ac=[0,1,0],ad=[0,0,1];function ap(i){return[i[0]*e.d9,i[1]*e.d9,i[2]*e.d9,0]}function af(i,r,a,n,o,s,l,h,u){let c,d,p,f,m,_,g,y;
98let x=n.getSource(),v=a.globeSharedBuffers;if(!v||(r&&(c=n.getTile(r)),x instanceof e.aJ?(d=x.texture,p=e.cI(0,0,a.transform)):c&&r&&(d=c.texture,p=e.cI(r.canonical.z,r.canonical.x,a.transform)),!d||!p))return;i||(p=e.ab.mat4.scale(e.ab.mat4.create(),p,[1,-1,1]));let b=a.context,w=b.gl,T="nearest"===o.paint.get("raster-resampling")?w.NEAREST:w.LINEAR,S=a.colorModeForDrapableLayerRenderPass(s),M=l.defines;M.push("GLOBE_POLES");let E=new t0(w.LEQUAL,t0.ReadWrite,a.depthRangeFor3D),A=Float32Array.from(a.transform.expandedFarZProjMatrix),I=Float32Array.from(e.bb(e.cH(new e.bT(0,0,0))));a.terrain&&a.terrain.prepareDrawTile(),b.activeTexture.set(w.TEXTURE0),d.bind(T,w.CLAMP_TO_EDGE),b.activeTexture.set(w.TEXTURE1),d.bind(T,w.CLAMP_TO_EDGE),d.useMipmap&&b.extTextureFilterAnisotropic&&a.transform.pitch>20&&w.texParameterf(w.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);let[C,P,z,D]=r?v.getPoleBuffers(r.canonical.z,!1):v.getPoleBuffers(0,!0),R=o.paint.get("raster-elevation");i?(f=C,a.renderDefaultNorthPole=0!==R):(f=P,a.renderDefaultSouthPole=0!==R);let L=ap(l.mix),O=(m=p,_=e.ae(a.transform.zoom),g=l.offset,y=l.range,rX(A,I,m,new Float32Array(16),new Float32Array(9),[0,0],_,[0,0],[0,0,0,0],1,{opacity:1,mix:0},o,[0,0],R,2,L,g,y,1,0,s)),k=a.getOrCreateProgram("raster",{defines:M});a.uploadCommonUniforms(b,k,null),k.draw(a,w.TRIANGLES,E,u,S,h,O,o.id,f,z,D)}var am=e.da([{name:"a_index",type:"Int16",components:1}]);class a_{constructor(i,r,a,n){let o={width:a[0],height:a[1],data:null},s=i.gl;this.targetColorTexture=new e.T(i,o,s.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new e.T(i,o,s.RGBA8,{useMipmap:!1}),this.context=i,this.updateParticleTexture(r,n),this.lastInvalidatedAt=0}updateParticleTexture(i,r){if(this.particleTextureDimension===r.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());let a=this.context.gl,n=r.width*r.height;this.particleTexture0=new e.T(this.context,r,a.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,r,a.RGBA8,{premultiply:!1,useMipmap:!1});let o=new e.db;o.reserve(n);for(let e=0;e<n;e++)o.emplaceBack(e);this.particleIndexBuffer=this.context.createVertexBuffer(o,am.members,!0),this.particleSegment=e.b7.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=r.width}update(i){return!(this.lastInvalidatedAt<i&&(this.lastInvalidatedAt=e.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}let ag=new e.aj(1,0,0,1),ay=new e.aj(0,1,0,1),ax=new e.aj(0,0,1,1),av=new e.aj(1,0,1,1),ab=new e.aj(0,1,1,1);function aw(i,r,a,n,o,s,l){let h=i.context,u=i.transform,c=h.gl,d="globe"===u.projection.name,p=e.ab.mat4.clone(a.projMatrix);if(d&&e.ae(u.zoom)>0){let i=e.ba(a.canonical,u),r=e.dd(i);p=e.ab.mat4.multiply(new Float32Array(16),u.globeMatrix,r),e.ab.mat4.multiply(p,u.projMatrix,p)}let f=e.ab.mat4.create();f[12]+=2*o/(e.q.devicePixelRatio*u.width),f[13]+=2*s/(e.q.devicePixelRatio*u.height),e.ab.mat4.multiply(p,f,p);let m=i.getOrCreateProgram("debug",{defines:d?["PROJECTION_GLOBE_VIEW"]:[]}),_=r.getTileByID(a.key);i.terrain&&i.terrain.setupElevationDraw(_,m);let g=t0.disabled,y=t1.disabled,x=i.colorModeForRenderPass(),v="$debug";h.activeTexture.set(c.TEXTURE0),i.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),d?_._makeGlobeTileDebugBuffers(i.context,u):_._makeDebugTileBoundsBuffers(i.context,u.projection);let b=_._tileDebugBuffer||i.debugBuffer,w=_._tileDebugIndexBuffer||i.debugIndexBuffer,T=_._tileDebugSegments||i.debugSegments;if(m.draw(i,c.LINE_STRIP,g,y,x,t2.disabled,rq(p,n),v,b,w,T,null,null,null,[_._globeTileDebugBorderBuffer]),l){let e=_.latestRawTileData,r=Math.floor((e&&e.byteLength||0)/1024),n=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(n+=` => ${a.overscaledZ}`),function(e,i){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,a=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(i,5,5),n.strokeText(i,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(i,n+=` ${_.state} ${r}kb`)}
98let S=512/Math.min(r.getTile(a).tileSize,512)*(a.overscaledZ/u.zoom)*.5,M=_._tileDebugTextBuffer||i.debugBuffer,E=_._tileDebugTextIndexBuffer||i.quadTriangleIndexBuffer,A=_._tileDebugTextSegments||i.debugSegments;m.draw(i,c.TRIANGLES,g,y,tQ.alphaBlended,t2.disabled,rq(p,e.aj.transparent,S),v,M,E,A,null,null,null,[_._globeTileDebugTextBuffer])}function aT(e,i,r,a){aM(e,0,i+r/2,e.transform.width,r,a)}function aS(e,i,r,a){aM(e,i-r/2,0,r,e.transform.height,a)}function aM(i,r,a,n,o,s){let l=i.context,h=l.gl;h.enable(h.SCISSOR_TEST),h.scissor(r*e.q.devicePixelRatio,a*e.q.devicePixelRatio,n*e.q.devicePixelRatio,o*e.q.devicePixelRatio),l.clear({color:s}),h.disable(h.SCISSOR_TEST)}let{members:aE}=e.da([{name:"a_pos_3f",components:3,type:"Float32"}]);function aA(e,i,r,a){e.emplaceBack(i,r,a)}class aI{constructor(i){this.vertexArray=new e.de,this.indices=new e.aU,aA(this.vertexArray,-1,-1,1),aA(this.vertexArray,1,-1,1),aA(this.vertexArray,-1,1,1),aA(this.vertexArray,1,1,1),aA(this.vertexArray,-1,-1,-1),aA(this.vertexArray,1,-1,-1),aA(this.vertexArray,-1,1,-1),aA(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=i.createVertexBuffer(this.vertexArray,aE),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=e.b7.simpleSegment(0,0,36,12)}}function aC(i,r,a,n,o,s){let l=i.context.gl,h=r.paint.get("sky-atmosphere-color"),u=r.paint.get("sky-atmosphere-halo-color"),c=r.paint.get("sky-atmosphere-sun-intensity"),d={u_matrix_3f:e.ab.mat3.fromMat4(e.ab.mat3.create(),n),u_sun_direction:o,u_sun_intensity:c,u_color_tint_r:[h.r,h.g,h.b,h.a],u_color_tint_m:[u.r,u.g,u.b,u.a],u_luminance:5e-5};l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_CUBE_MAP_POSITIVE_X+s,r.skyboxTexture,0),a.draw(i,l.TRIANGLES,t0.disabled,t1.disabled,tQ.unblended,t2.frontCW,d,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}let aP=e.da([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class az{constructor(i){let r=new e.df;r.emplaceBack(-1,1,1,0,0),r.emplaceBack(1,1,1,1,0),r.emplaceBack(1,-1,1,1,1),r.emplaceBack(-1,-1,1,0,1);let a=new e.aU;a.emplaceBack(0,1,2),a.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(r,aP.members),this.indexBuffer=i.createIndexBuffer(a),this.segments=e.b7.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let aD=e.da([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class aR{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class aL{constructor(i){this.colorModeAlphaBlendedWriteRGB=new tQ([1,771,1,771],e.aj.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new tQ([1,0,1,0],e.aj.transparent,[!1,!1,!1,!0]),this.params=new aR,this.updateNeeded=!0,i.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),i.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(i){let r=i.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new az(r);let i=this.params.sizeRange,a=this.params.intensityRange,n=function(i){let r=e.di(30),a=[];for(let n=0;n<i;++n){let i=2*Math.PI*r(),n=Math.acos(1-2*r())-.5*Math.PI;a.push(e.ab.vec3.fromValues(Math.cos(n)*Math.cos(i),Math.cos(n)*Math.sin(i),Math.sin(n)))}return a}(this.params.starsCount),o=e.di(300),s=new e.dg,l=new e.aU,h=0;for(let r=0;r<n.length;++r){let u=e.ab.vec3.scale([],n[r],200),c=Math.max(0,1+.01*i*(1*o()-.5)),d=Math.max(0,1+.01*a*(1*o()-.5));s.emplaceBack(u[0],u[1],u[2],-1,-1,c,d),s.emplaceBack(u[0],u[1],u[2],1,-1,c,d),s.emplaceBack(u[0],u[1],u[2],1,1,c,d),s.emplaceBack(u[0],u[1],u[2],-1,1,c,d),l.emplaceBack(h+0,h+1,h+2),l.emplaceBack(h+0,h+2,h+3),h+=4}this.starsVx=r.createVertexBuffer(s,aD.members),this.starsIdx=r.createIndexBuffer(l),this.starsSegments=e.b7.simpleSegment(0,0,s.length,l.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(i,r){let a=i.context,n=a.gl,o=i.transform,s=new t0(n.LEQUAL,t0.ReadOnly,[0,1]),l=e.ae(o.zoom),h=i.style.getLut(r.scope),u="none"===r.properties.get("color-use-theme"),c=r.properties.get("color").toRenderColor(u?null:h).toArray01(),d="none"===r.properties.get("high-color-use-theme"),p=r.properties.get("high-color").toRenderColor(d?null:h).toArray01(),f="none"===r.properties.get("space-color-use-theme"),m=r.properties.get("space-color").toRenderColor(f?null:h).toArray01PremultipliedAlpha(),_=e.dh(r.properties.get("horizon-blend"),0,1,5e-4,.25),g=e.cC(i,a,o)&&5e-4===_?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,y=i.frameCounter/1e3%1,x=e.ab.vec3.length(o.globeCenterInViewSpace),v=Math.acos(Math.sqrt(Math.pow(x,2)-Math.pow(g,2))/x),b=e=>{let r,h,u;let d="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];e&&d.push("ALPHA_PASS");let f=i.getOrCreateProgram("globeAtmosphere",{defines:d}),g=(r=o.frustumCorners.TL,h=o.frustumCorners.TR,u=o.frustumCorners.BR,{u_frustum_tl:r,u_frustum_tr:h,u_frustum_br:u,u_frustum_bl:o.frustumCorners.BL,u_horizon:o.frustumCorners.horizon,u_transition:l,u_fadeout_range:_,u_color:c,u_high_color:p,u_space_color:m,u_temporal_offset:y,u_horizon_angle:v});i.uploadCommonUniforms(a,f);let x=this.atmosphereBuffer;x&&f.draw(i,n.TRIANGLES,s,t1.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,t2.backCW,g,e?"atmosphere_glow_alpha":"atmosphere_glow",x.vertexBuffer,x.indexBuffer,x.segments)};b(!1),b(!0)}drawStars(i,r){let a=e.aw(r.properties.get("star-intensity"),0,1);if(0===a)return;let n=i.context,o=n.gl,s=i.transform,l=i.getOrCreateProgram("stars"),h=e.ab.quat.identity([]);e.ab.quat.rotateX(h,h,-s._pitch),e.ab.quat.rotateZ(h,h,-s.angle),e.ab.quat.rotateX(h,h,e.ai(s._center.lat)),e.ab.quat.rotateY(h,h,-e.ai(s._center.lng));let u=e.ab.mat4.fromQuat(new Float32Array(16),h),c=e.ab.mat4.multiply([],s.starsProjMatrix,u),d=e.ab.mat3.fromMat4([],u),p=e.ab.mat3.invert([],d),f=[0,1,0];e.ab.vec3.transformMat3(f,f,p),e.ab.vec3.scale(f,f,this.params.sizeMultiplier);let m=[1,0,0];e.ab.vec3.transformMat3(m,m,p),e.ab.vec3.scale(m,m,this.params.sizeMultiplier);let _={u_matrix:Float32Array.from(c),u_up:f,u_right:m,u_intensity_multiplier:a};i.uploadCommonUniforms(n,l),this.starsVx&&this.starsIdx&&l.draw(i,o.TRIANGLES,t0.disabled,t1.disabled,this.colorModeAlphaBlendedWriteRGB,t2.disabled,_,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function aO(i,r){let a=[...i],n=r.cameraWorldSizeForFog/r.worldSize,o=e.ab.mat4.identity([]);return e.ab.mat4.scale(o,o,[n,n,1]),e.ab.mat4.multiply(a,o,a),e.ab.mat4.multiply(a,r.worldToFogMatrix,a),a}function ak(i,r,a,n,o){let s=a.material,l=n.context,{baseColorTexture:h,metallicRoughnessTexture:u}=s.pbrMetallicRoughness,{normalTexture:c,occlusionTexture:d,emissionTexture:p}=s;function f(e,r,a){if(e&&(i.push(r),l.activeTexture.set(l.gl.TEXTURE0+a),e.gfxTexture)){let{minFilter:i,magFilter:r,wrapS:a,wrapT:n}=e.sampler;e.gfxTexture.bindExtraParam(i,r,a,n)}}f(h,"HAS_TEXTURE_u_baseColorTexture",t9.BaseColor),f(u,"HAS_TEXTURE_u_metallicRoughnessTexture",t9.MetallicRoughness),f(c,"HAS_TEXTURE_u_normalTexture",t9.Normal),f(d,"HAS_TEXTURE_u_occlusionTexture",t9.Occlusion),f(p,"HAS_TEXTURE_u_emissionTexture",t9.Emission),o&&(o.texture||(o.texture=new e.dk(n.context,o.image,[o.image.height,o.image.height,o.image.height],l.gl.RGBA8)),l.activeTexture.set(l.gl.TEXTURE0+t9.LUT),o.texture&&o.texture.bind(l.gl.LINEAR,l.gl.CLAMP_TO_EDGE),i.push("APPLY_LUT_ON_GPU")),a.texcoordBuffer&&(i.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(a.texcoordBuffer)),a.colorBuffer&&(i.push(12===a.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(a.colorBuffer)),a.normalBuffer&&(i.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(a.normalBuffer)),a.pbrBuffer&&(i.push("HAS_ATTRIBUTE_a_pbr"),i.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(a.pbrBuffer)),"OPAQUE"!==s.alphaMode&&"MASK"!==s.alphaMode||i.push("UNPREMULT_TEXTURE_IN_SHADER"),s.defined||i.push("DIFFUSE_SHADED"),i.push("USE_STANDARD_DERIVATIVES");let m=n.shadowRenderer;m&&(i.push("RENDER_SHADOWS","DEPTH_TEXTURE"),m.useNormalOffset&&i.push("NORMAL_OFFSET"))}function aF(i,r,a,n,o,s){let l;let h=a.paint.get("model-opacity").constantOr(1),u=r.context,c=new t0(r.context.gl.LEQUAL,t0.ReadWrite,r.depthRangeFor3D),d=r.transform,p=i.mesh,f=p.material,m=f.pbrMetallicRoughness,_=r.style.fog;l="pixels"===r.transform.projection.zAxisUnit?[...i.nodeModelMatrix]:e.ab.mat4.multiply([],n.zScaleMatrix,i.nodeModelMatrix),e.ab.mat4.multiply(l,n.negCameraPosMatrix,l);let g=e.ab.mat4.invert([],l);e.ab.mat4.transpose(g,g);
98let y="none"===a.paint.get("model-color-use-theme").constantOr("default"),x=a.paint.get("model-emissive-strength").constantOr(0),v=r4(new Float32Array(i.worldViewProjection),new Float32Array(l),new Float32Array(g),null,r,h,m.baseColorFactor.toRenderColor(null),f.emissiveFactor,m.metallicFactor,m.roughnessFactor,f,x,a),b={defines:[]},w=[],T=r.shadowRenderer;T&&(T.useNormalOffset=!1),ak(b.defines,w,p,r,y?null:a.lut);let S=null;if(_){let e=aO(i.nodeModelMatrix,r.transform);if(S=new Float32Array(e),"globe"!==d.projection.name){let i=p.aabb.min,r=p.aabb.max,[a,n]=_.getOpacityForBounds(e,i[0],i[1],r[0],r[1]);b.overrideFog=a>=.05||n>=.05}}let M=ir(r,a.paint.get("model-cutoff-fade-range"));M.shouldRenderCutoff&&b.defines.push("RENDER_CUTOFF");let E=r.getOrCreateProgram("model",b);r.uploadCommonUniforms(u,E,null,S,M),"shadow"!==r.renderPass&&T&&T.setupShadowsFromMatrix(i.nodeModelMatrix,E),E.draw(r,u.gl.TRIANGLES,c,o,s,p.material.doubleSided?t2.disabled:t2.backCCW,v,a.id,p.vertexBuffer,p.indexBuffer,p.segments,a.paint,r.transform.zoom,void 0,w)}function aB(e,i,r,a){let n=r.shadowRenderer;if(!n)return;let o=n.getShadowPassDepthMode(),s=n.getShadowPassColorMode(),l=r5(n.calculateShadowPassMatrixFromMatrix(i));r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,o,t1.disabled,s,t2.backCCW,l,a.id,e.vertexBuffer,e.indexBuffer,e.segments,a.paint,r.transform.zoom,void 0,void 0)}let aN={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.cd([0,0,0],[e.ag,e.ag,0])},aV=[1,-1,1];class aU{}class aj{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(i,r,a){{let e=this._storage.get(r.id);if(e)return e.lastUsedFrameIdx=i,e.buf}let n=a.gl,o=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),s=new ArrayBuffer(o),l=new Int16Array(s);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(s));let h=new e.dq;for(let e=0;e<o/2;e+=3){let i=l[e],r=l[e+1],a=l[e+2];h.emplaceBack(i,r),h.emplaceBack(r,a),h.emplaceBack(a,i)}let u=a.bindVertexArrayOES.current,c=new aU;return c.buf=new r8(a,h),c.lastUsedFrameIdx=i,this._storage.set(r.id,c),a.bindVertexArrayOES.set(u),c.buf}update(e){for(let[i,r]of this._storage)e-r.lastUsedFrameIdx>30&&(r.buf.destroy(),this._storage.delete(i))}destroy(){for(let[e,i]of this._storage)i.buf.destroy(),this._storage.delete(e)}}class aG{constructor(e){this.occluderSize=30,this.depthOffset=-.0001,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}let aq=e.da([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class aZ{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class aH{constructor(e,i){this.revealStart=11,this.revealRange=2,e.registerParameter(this,[...i,"Reveal"],"revealStart",{min:0,max:17,step:.05}
98),e.registerParameter(this,[...i,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}let a$=e.da([{type:"Float32",name:"a_pos_2f",components:2}]);class aW{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(i,r){var a;let n=i.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){let r=new e.dr,a=new e.aU;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1),a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),this.vignetteVx=i.context.createVertexBuffer(r,a$.members),this.vignetteIdx=i.context.createIndexBuffer(a)}let o=e.b7.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){i.uploadCommonUniforms(i.context,n);let e={u_vignetteShape:(a={vignetteShape:[r.start,r.range,Math.pow(10,r.fadePower)],vignetteColor:[r.color.r,r.color.g,r.color.b,r.color.a*r.strength]}).vignetteShape,u_vignetteColor:a.vignetteColor};n.draw(i,i.context.gl.TRIANGLES,t0.disabled,t1.disabled,tQ.alphaBlended,t2.disabled,e,"vignette",this.vignetteVx,this.vignetteIdx,o,{})}}}class aX{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(i,r){let a=i.getFreeCameraOptions().position,n=a.toAltitude(),o=a.toLngLat(),s=e.ai(o.lng),l=e.ai(o.lat),h=i.pixelsPerMeter/r,u=s*e.ds,c=e.ds*Math.log(Math.tan(Math.PI/4+l/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{let e=-this._offsetYPrev+c,i=-this._elevationPrev+n;this._accumulatedOffsetX+=(-this._offsetXPrev+u)*h,this._accumulatedOffsetY+=e*h,this._accumulatedElevation+=i*h,this._offsetXPrev=u,this._offsetYPrev=c,this._elevationPrev=n}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function aY(e,i){return[-(e[0]-Math.floor(e[0]/i)*i),-(e[1]-Math.floor(e[1]/i)*i),-(e[2]-Math.floor(e[2]/i)*i)]}function aK(i){let r=e.di(1323123451230),a=[];for(let n=0;n<i;++n){let i=2*r()-1,n=2*r()-1,o=2*r()-1;a.push(e.ab.vec3.fromValues(i,n,o))}return a}function aJ(i,r,a,n,o){let s=e.aw((o-a)/(n-a),0,1);return(1-s)*i+s*r}class aQ{constructor(e){this._movement=new aX,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new aW,this._ppmScaleFactor=e}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(i,r){let a=i.transform;this._movement.update(a,this._ppmScaleFactor);let n=a.starsProjMatrix,o=e.ab.quat.identity([]);e.ab.quat.rotateX(o,o,e.ai(90)-a._pitch),e.ab.quat.rotateZ(o,o,-a.angle);let s=e.ab.mat4.fromQuat(new Float32Array(16),o),l=e.ab.mat4.fromValues(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),h=e.ab.mat4.transpose([],l),u=e.ab.mat4.multiply([],h,s),c=Date.now()/1e3;return this._accumulatedTimeFromStart+=(c-this._prevTime)*r,this._prevTime=c,{projectionMatrix:n,modelviewMatrix:u}}}class a0 extends aQ{constructor(e){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new aH(e.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(i){let r=i.context;if(!this.particlesVx){let i=aK(this.particlesCount),a=new e.dt,n=new e.aU,o=0,s=e.di(1323123451230);for(let e=0;e<i.length;++e){let r=i[e],l=[2*s()-1,s(),s(),s()];a.emplaceBack(r[0],r[1],r[2],-1,-1,...l),a.emplaceBack(r[0],r[1],r[2],1,-1,...l),a.emplaceBack(r[0],r[1],r[2],1,1,...l),a.emplaceBack(r[0],r[1],r[2],-1,1,...l),n.emplaceBack(o+0,o+1,o+2),n.emplaceBack(o+0,o+2,o+3),o+=4}this.particlesVx=r.createVertexBuffer(a,aq.members),this.particlesIdx=r.createIndexBuffer(n)}}draw(i){if(!this._params.overrideStyleParameters&&!i.style.rain)return;let r=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},a=i.transform.zoom;if(r.revealStart>a)return;let n=aJ(0,1,r.revealStart,r.revealStart+r.revealRange,a);if(!this.particlesVx||!this.particlesIdx)return;let o=structuredClone(this._params),s=[-o.direction.x,o.direction.y,-100];e.ab.vec3.normalize(s,s);
98let l=structuredClone(this._vignetteParams);l.strength*=n,o.overrideStyleParameters||(o.intensity=i.style.rain.state.density,o.timeFactor=i.style.rain.state.intensity,o.color=structuredClone(i.style.rain.state.color),s=structuredClone(i.style.rain.state.direction),o.screenThinning.intensity=i.style.rain.state.centerThinning,o.dropletSizeX=i.style.rain.state.dropletSize[0],o.dropletSizeYScale=i.style.rain.state.dropletSize[1]/i.style.rain.state.dropletSize[0],o.distortionStrength=100*i.style.rain.state.distortionStrength,l.strength=1,l.color=structuredClone(i.style.rain.state.vignetteColor));let h=this.updateOnRender(i,o.timeFactor),u=i.context,c=u.gl,d=i.transform;this.screenTexture&&this.screenTexture.size[0]===i.width&&this.screenTexture.size[1]===i.height||(this.screenTexture=new e.T(u,{width:i.width,height:i.height,data:null},c.RGBA8)),o.distortionStrength>0&&(u.activeTexture.set(c.TEXTURE0),this.screenTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,0,0,i.width,i.height));let p=i.getOrCreateProgram("rainParticle");i.uploadCommonUniforms(u,p),u.activeTexture.set(c.TEXTURE0),this.screenTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let f=[o.color.r,o.color.g,o.color.b,o.color.a],m=(r,a)=>{var l;let u=aY(this._movement.getPosition(),r),m=o.dropletSizeX,_=o.dropletSizeX*o.dropletSizeYScale,g=i.width/2,y=i.height/2,x=aJ(0,o.screenThinning.start,0,1,o.screenThinning.intensity),v=aJ(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),b=aJ(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),w=(l={modelview:h.modelviewMatrix,projection:h.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:u,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,boxSize:r,rainDropletSize:[m,_],distortionStrength:o.distortionStrength,rainDirection:s,color:f,screenSize:[d.width,d.height],thinningCenterPos:[g,y],thinningShape:[x,v,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:b,shapeDirectionalPower:o.shapeDirPower,shapeNormalPower:o.shapeNormalPower,mode:a?0:1},{u_modelview:Float32Array.from(l.modelview),u_projection:Float32Array.from(l.projection),u_time:l.time,u_cam_pos:l.camPos,u_texScreen:0,u_velocityConeAperture:l.velocityConeAperture,u_velocity:l.velocity,u_boxSize:l.boxSize,u_rainDropletSize:l.rainDropletSize,u_distortionStrength:l.distortionStrength,u_rainDirection:l.rainDirection,u_color:l.color,u_screenSize:l.screenSize,u_thinningCenterPos:l.thinningCenterPos,u_thinningShape:l.thinningShape,u_thinningAffectedRatio:l.thinningAffectedRatio,u_thinningParticleOffset:l.thinningParticleOffset,u_shapeDirectionalPower:l.shapeDirectionalPower,u_shapeNormalPower:l.shapeNormalPower,u_mode:l.mode}),T=Math.round(n*o.intensity*this.particlesCount),S=e.b7.simpleSegment(0,0,4*T,2*T);p.draw(i,c.TRIANGLES,t0.disabled,t1.disabled,tQ.alphaBlended,t2.disabled,w,"rain_particles",this.particlesVx,this.particlesIdx,S,{})};o.distortionStrength>0&&m(o.boxSize,!0),m(o.boxSize,!1),this._vignette.draw(i,l)}}let a1=e.da([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class a2 extends aQ{constructor(e){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new aH(e.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(i){let r=i.context;if(!this.particlesVx){let i=aK(this.particlesCount),a=new e.du,n=new e.aU,o=0,s=e.di(1323123451230);for(let e=0;e<i.length;++e){let r=i[e],l=s(),h=s(),u=s(),c=[e/i.length,l,h,u],d=[s(),s()];a.emplaceBack(r[0],r[1],r[2],-1,-1,...c,...d),a.emplaceBack(r[0],r[1],r[2],1,-1,...c,...d),a.emplaceBack(r[0],r[1],r[2],1,1,...c,...d),a.emplaceBack(r[0],r[1],r[2],-1,1,...c,...d),n.emplaceBack(o+0,o+1,o+2),n.emplaceBack(o+0,o+2,o+3),o+=4}this.particlesVx=r.createVertexBuffer(a,a1.members),this.particlesIdx=r.createIndexBuffer(n)}}draw(i){if(!this._params.overrideStyleParameters&&!i.style.snow)return;let r=structuredClone(this._params),a=[-r.direction.x,r.direction.y,-100];e.ab.vec3.normalize(a,a);
98let n=structuredClone(this._vignetteParams),o=r.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},s=i.transform.zoom;if(o.revealStart>s)return;let l=aJ(0,1,o.revealStart,o.revealStart+o.revealRange,s);n.strength*=l,r.overrideStyleParameters||(r.intensity=i.style.snow.state.density,r.timeFactor=i.style.snow.state.intensity,r.color=structuredClone(i.style.snow.state.color),a=structuredClone(i.style.snow.state.direction),r.screenThinning.intensity=i.style.snow.state.centerThinning,r.billboardSize=2.79*i.style.snow.state.flakeSize,n.strength=1,n.color=structuredClone(i.style.snow.state.vignetteColor));let h=this.updateOnRender(i,r.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;let u=i.context,c=u.gl,d=i.transform,p=i.getOrCreateProgram("snowParticle");i.uploadCommonUniforms(u,p),((r,n,o)=>{var s;let u=aY(this._movement.getPosition(),r),f=d.width/2,m=d.height/2,_=aJ(0,o.screenThinning.start,0,1,o.screenThinning.intensity),g=aJ(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),y=aJ(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),x=(s={modelview:h.modelviewMatrix,projection:h.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:u,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,horizontalOscillationRadius:o.horizontalOscillationRadius,horizontalOscillationRate:o.horizontalOscillationRate,boxSize:r,billboardSize:1*o.billboardSize,simpleShapeParameters:[o.shapeFadeStart,o.shapeFadePower],screenSize:[d.width,d.height],thinningCenterPos:[f,m],thinningShape:[_,g,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:y,color:[o.color.r,o.color.g,o.color.b,o.color.a],direction:a},{u_modelview:Float32Array.from(s.modelview),u_projection:Float32Array.from(s.projection),u_time:s.time,u_cam_pos:s.camPos,u_velocityConeAperture:s.velocityConeAperture,u_velocity:s.velocity,u_horizontalOscillationRadius:s.horizontalOscillationRadius,u_horizontalOscillationRate:s.horizontalOscillationRate,u_boxSize:s.boxSize,u_billboardSize:s.billboardSize,u_simpleShapeParameters:s.simpleShapeParameters,u_screenSize:s.screenSize,u_thinningCenterPos:s.thinningCenterPos,u_thinningShape:s.thinningShape,u_thinningAffectedRatio:s.thinningAffectedRatio,u_thinningParticleOffset:s.thinningParticleOffset,u_particleColor:s.color,u_direction:s.direction}),v=Math.round(l*o.intensity*this.particlesCount),b=e.b7.simpleSegment(0,0,4*v,2*v);this.particlesVx&&this.particlesIdx&&p.draw(i,c.TRIANGLES,t0.disabled,t1.disabled,tQ.alphaBlended,t2.disabled,x,"snow_particles",this.particlesVx,this.particlesIdx,b,{})})(r.boxSize,0,r),this._vignette.draw(i,n)}}let a3={symbol:function(i,r,a,n,o){if("translucent"!==i.renderPass)return;let s=t1.disabled,l=i.colorModeForRenderPass(),h=a.layout.get("text-variable-anchor"),u=a.layout.get("text-size-scale-range"),c=e.aw(i.scaleFactor,u[0],u[1]);h&&function(i,r,a,n,o,s,l,h){let u=r.transform,c="map"===o,d="map"===s;for(let r of i){let i=n.getTile(r),o=i.getBucket(a);if(!o||!o.text||!o.text.segments.get().length)continue;let s=e.bp(o.textSizeData,u.zoom,h),p=tR(r,o.getProjection(),u),f=u.calculatePixelsToTileUnitsMatrix(i),m=tg(p,i.tileID.canonical,d,c,u,o.getProjection(),f),_=o.hasIconTextFit()&&o.hasIconData();if(s){let a=Math.pow(2,u.zoom-i.tileID.overscaledZ);!function(i,r,a,n,o,s,l,h,u,c,d){let p=i.text.placedSymbolArray,f=i.text.dynamicLayoutVertexArray,m=i.icon.dynamicLayoutVertexArray,_={},g=i.getProjection(),y=tR(h,g,s),x=s.elevation,v=g.upVectorScale(h.canonical,s.center.lat,s.worldSize).metersToTile;f.clear();for(let m=0;m<p.length;m++){let b=p.get(m),{tileAnchorX:w,tileAnchorY:T,numGlyphs:S}=b,M=b.hidden||!b.crossTileID||i.allowVerticalPlacement&&!b.placedOrientation?null:n[b.crossTileID];if(M){let n=0,p=0,m=0;if(x){let e=x?x.getAtTileOffset(h,w,T):0,[i,r,a]=g.upVector(h.canonical,w,T);n=e*i*v,p=e*r*v,m=e*a*v}let[E,A,I,C]=tv(b.projectedAnchorX+n,b.projectedAnchorY+p,b.projectedAnchorZ+m,a?y:l),P=tb(s.getCameraToCenterDistance(g),C),z=o.evaluateSizeForFeature(i.textSizeData,c,b)*P/e.bw;a&&(z*=i.tilePixelRatio/u);let D=function({width:i,height:r,anchor:a,textOffset:n,textScale:o},s){let{horizontalAlign:l,verticalAlign:h}=e.bD(a),u=e.bC(a,n);return new e.P((-(l-.5)*i/o+u[0])*s,(-(h-.5)*r/o+u[1])*s)}(M,z);a?({x:E,y:A,z:I}=g.projectTilePoint(w+D.x,T+D.y,h.canonical),[E,A,I]=tv(E+n,A+p,I+m,l)):(r&&D._rotate(-s.angle),E+=D.x,A
98+=D.y,I=0);let R=i.allowVerticalPlacement&&b.placedOrientation===e.bq.vertical?Math.PI/2:0;for(let i=0;i<S;i++)e.bt(f,E,A,I,R);d&&b.associatedIconIndex>=0&&(_[b.associatedIconIndex]={x:E,y:A,z:I,angle:R})}else tC(S,f)}if(d){m.clear();let r=i.icon.placedSymbolArray;for(let i=0;i<r.length;i++){let a=r.get(i),{numGlyphs:n}=a,o=_[i];if(a.hidden||!o)tC(n,m);else{let{x:i,y:r,z:a,angle:s}=o;for(let o=0;o<n;o++)e.bt(m,i,r,a,s)}}i.icon.dynamicLayoutVertexBuffer.updateData(m)}i.text.dynamicLayoutVertexBuffer.updateData(f)}(o,c,d,l,e.cX,u,m,r,a,s,_)}}}(n,i,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),o,c);let d=0!==a.paint.get("icon-opacity").constantOr(1),p=0!==a.paint.get("text-opacity").constantOr(1);void 0!==a.layout.get("symbol-sort-key").constantOr(1)&&(d||p)?an(i,r,a,n,s,l):(d&&an(i,r,a,n,s,l,{onlyIcons:!0}),p&&an(i,r,a,n,s,l,{onlyText:!0})),r.map.showCollisionBoxes&&(ai(i,r,a,n,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),ai(i,r,a,n,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(i,r,a,n){if("translucent"!==i.renderPass)return;let o=a.paint.get("circle-opacity"),s=a.paint.get("circle-stroke-width"),l=a.paint.get("circle-stroke-opacity"),h=void 0!==a.layout.get("circle-sort-key").constantOr(1),u=a.paint.get("circle-emissive-strength");if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===l.constantOr(1)))return;let c=i.context,d=c.gl,p=i.transform,f=i.depthModeForSublayer(0,t0.ReadOnly),m=t1.disabled,_=i.colorModeForDrapableLayerRenderPass(u),g="globe"===p.projection.name,y=[e.at(p.center.lng),e.aA(p.center.lat)],x=[];for(let o=0;o<n.length;o++){let s=n[o],l=r.getTile(s),u=l.getBucket(a);if(!u||u.projection.name!==p.projection.name)continue;let c=u.programConfigurations.get(a.id),d=e.cY(a),f=i.isTileAffectedByFog(s);g&&d.push("PROJECTION_GLOBE_VIEW"),d.push("DEPTH_D24"),i.terrain&&p.depthOcclusionForSymbolsAndCircles&&d.push("DEPTH_OCCLUSION");let m=i.getOrCreateProgram("circle",{config:c,defines:d,overrideFog:f}),_=u.layoutVertexBuffer,v=u.globeExtVertexBuffer,b=u.indexBuffer,w=p.projection.createInversionMatrix(p,s.canonical),T={programConfiguration:c,program:m,layoutVertexBuffer:_,globeExtVertexBuffer:v,indexBuffer:b,uniformValues:e.cZ(i,s,l,w,y,a),tile:l};if(h)for(let i of u.segments.get())x.push({segments:new e.b7([i]),sortKey:i.sortKey,state:T});else x.push({segments:u.segments,sortKey:0,state:T})}h&&x.sort((e,i)=>e.sortKey-i.sortKey);let v={useDepthForOcclusion:p.depthOcclusionForSymbolsAndCircles};for(let e of x){let{programConfiguration:r,program:n,layoutVertexBuffer:o,globeExtVertexBuffer:s,indexBuffer:l,uniformValues:h,tile:u}=e.state,g=e.segments;i.terrain&&i.terrain.setupElevationDraw(u,n,v),i.uploadCommonUniforms(c,n,u.tileID.toUnwrapped()),n.draw(i,d.TRIANGLES,f,m,_,t2.disabled,h,a.id,o,l,g,a.paint,p.zoom,r,[s])}},heatmap:function(i,r,a,n){if(0!==a.paint.get("heatmap-opacity")){if("offscreen"===i.renderPass){let o=i.context,s=o.gl,l=t1.disabled,h=new tQ([s.ONE,s.ONE,s.ONE,s.ONE],e.aj.transparent,[!0,!0,!0,!0]);(function(e,i,r,a){let n=e.gl,o=i.width*a,s=i.height*a;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,o,s]);let l=r.heatmapFbo;if(!l||l&&(l.width!==o||l.height!==s)){l&&l.destroy();let i=n.createTexture();n.bindTexture(n.TEXTURE_2D,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
98INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),l=r.heatmapFbo=e.createFramebuffer(o,s,!0,null),function(e,i,r,a,n,o){let s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,n,o,0,s.RGBA,e.extRenderToTextureHalfFloat?s.HALF_FLOAT:s.UNSIGNED_BYTE,null),a.colorAttachment.set(r)}(e,0,i,l,o,s)}else n.bindTexture(n.TEXTURE_2D,l.colorAttachment.get()),e.bindFramebuffer.set(l.framebuffer)})(o,i,a,"globe"===i.transform.projection.name?.5:.25),o.clear({color:e.aj.transparent});let u=i.transform,c="globe"===u.projection.name,d=c?["PROJECTION_GLOBE_VIEW"]:[],p=c?t2.frontCCW:t2.disabled,f=[e.at(u.center.lng),e.aA(u.center.lat)];for(let e=0;e<n.length;e++){let m=n[e];if(r.hasRenderableParent(m))continue;let _=r.getTile(m),g=_.getBucket(a);if(!g||g.projection.name!==u.projection.name)continue;let y=i.isTileAffectedByFog(m),x=g.programConfigurations.get(a.id),v=i.getOrCreateProgram("heatmap",{config:x,defines:d,overrideFog:y}),{zoom:b}=i.transform;i.terrain&&i.terrain.setupElevationDraw(_,v),i.uploadCommonUniforms(o,v,m.toUnwrapped());let w=u.projection.createInversionMatrix(u,m.canonical);v.draw(i,s.TRIANGLES,t0.disabled,l,h,p,rH(i,m,_,w,f,b,a.paint.get("heatmap-intensity")),a.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,a.paint,i.transform.zoom,x,c?[g.globeExtVertexBuffer]:null)}o.viewport.set([0,0,i.width,i.height])}else"translucent"===i.renderPass&&(i.context.setColorMode(i.colorModeForRenderPass()),function(i,r){let a=i.context,n=a.gl,o=r.heatmapFbo;if(!o)return;a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),a.activeTexture.set(n.TEXTURE1);let s=r.colorRampTexture;s||(s=r.colorRampTexture=new e.T(a,r.colorRamp,n.RGBA8)),s.bind(n.LINEAR,n.CLAMP_TO_EDGE),i.getOrCreateProgram("heatmapTexture").draw(i,n.TRIANGLES,t0.disabled,t1.disabled,i.colorModeForRenderPass(),t2.disabled,{u_image:0,u_color_ramp:1,u_opacity:r.paint.get("heatmap-opacity")},r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom)}(i,a))}},line:function(i,r,a,n){let o;if("translucent"!==i.renderPass)return;let s=a.paint.get("line-opacity"),l=a.paint.get("line-width");if(0===s.constantOr(1)||0===l.constantOr(1))return;let h=a.paint.get("line-emissive-strength"),u=a.paint.get("line-occlusion-opacity"),c=a.layout.get("line-elevation-reference"),d="meters"===a.layout.get("line-width-unit"),p="sea"===c,f=i.context,m=f.gl,_=!a.isDraped();if(_&&"globe"===i.transform.projection.name)return;let g=a.layout.get("line-cross-slope"),y=_?new t0(i.depthOcclusion?m.GREATER:m.LEQUAL,t0.ReadOnly,i.depthRangeFor3D):i.depthModeForSublayer(0,t0.ReadOnly),x=i.colorModeForDrapableLayerRenderPass(h),v=i.terrain&&i.terrain.renderingToTexture,b=v?1:e.q.devicePixelRatio,w=a.paint.get("line-dasharray"),T=w.constantOr(1),S=a.layout.get("line-cap"),M=w.constantOr(null),E=S.constantOr(null),A=a.paint.get("line-pattern"),I=A.constantOr(1),C=A.constantOr(null),P=a.paint.get("line-opacity").constantOr(1),z=!I&&1!==P||i.depthOcclusion&&u>0&&u<1,D=a.paint.get("line-gradient"),R=I?"linePattern":"line",L=e.c_(a);if(v&&i.terrain&&i.terrain.clipOrMaskOverlapStencilType()&&(z=!1),0!==u&&i.depthOcclusion){let i=a.paint._values["line-opacity"];i&&i.value&&"constant"===i.value.kind?o=i.value:e.w(`Occlusion opacity for layer ${a.id} is supported only when line-opacity isn't data-driven.`)}if(_&&(i.forceTerrainMode=!0),!_&&0!==u&&i.terrain&&!v)return void e.w(`Occlusion opacity for layer ${a.id} is supported on terrain only if the layer has line-z-offset enabled.`);let O=z&&_?i.stencilModeFor3D():t1.disabled;for(let s of(_&&(L.push("ELEVATED"),void 0!==g&&L.push(g<1?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),p&&L.push("ELEVATION_REFERENCE_SEA")),"constant"!==l.value.kind&&!1===l.value.isLineProgressConstant&&L.push("VARIABLE_LINE_WIDTH"),n)){let n=r.getTile(s);if(I&&!n.patternsLoaded())continue;let l=n.getBucket(a);if(!l)continue;i.prepareDrawTile();let h=l.programConfigurations.get(a.id),c=i.isTileAffectedByFog(s),g=i.getOrCreateProgram(R,{config:h,defines:L,overrideFog:c,overrideRtt:!_&&void 0});if(C&&n.imageAtlas){let i=e.A.from(C),r=n.imageAtlas.patternPositions[i.getSerializedPrimary()];r&&h.setConstantPatternPositions(r)}if(!I&&M&&E&&n.lineAtlas){let e=n.lineAtlas.getDash(M,E);e&&h.setConstantPatternPositions(e)}let[w,S]=a.paint.get("line-trim-offset");("round"===E||"square"===E)&&w!==S&&(0===w&&(w-=1),1===S&&(S+=1));let A=v?s.projMatrix:null,k=d?1/l.tileToMeter/e.ar(n,1,i.transform.zoom):1,F=d?1/l.tileToMeter/e.ar(n,1,Math.floor(i.transform.zoom)):1,B=I?e.c$(i,n,a,A,b,k,F,[w,S]):e.d0(i,n,a,A,l.lineClipsArray.length,b,k,F,[w,S]);if(D){let n=l.gradients[a.id],o=n.texture;if(a.gradientVersion!==n.version){let h=256;if(a.stepInterpolant){let a=r.getSource().maxzoom,n=s.canonical.z===a?Math.
98ceil(1<<i.transform.maxZoom-s.canonical.z):1;h=e.aw(e.d1(l.maxLineLength/e.ag*1024*n),256,f.maxTextureSize)}n.gradient=e.d2({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:h,image:n.gradient||void 0,clips:l.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(f,n.gradient,m.RGBA8),n.version=a.gradientVersion,o=n.texture}f.activeTexture.set(m.TEXTURE1),o.bind(a.stepInterpolant?m.NEAREST:m.LINEAR,m.CLAMP_TO_EDGE)}T&&(f.activeTexture.set(m.TEXTURE0),n.lineAtlasTexture&&n.lineAtlasTexture.bind(m.LINEAR,m.REPEAT),h.updatePaintBuffers()),I&&(f.activeTexture.set(m.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),h.updatePaintBuffers()),_&&!p&&i.terrain.setupElevationDraw(n,g),i.uploadCommonUniforms(f,g,s.toUnwrapped());let N=e=>{null!=o&&(o.value=P*u),g.draw(i,m.TRIANGLES,y,e,x,t2.disabled,B,a.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,a.paint,i.transform.zoom,h,[l.layoutVertexBuffer2,l.patternVertexBuffer,l.zOffsetVertexBuffer]),null!=o&&(o.value=P)};if(z&&!_){let e=i.stencilModeForClipping(s).ref;0===e&&v&&f.clear({stencil:0});let r={func:m.EQUAL,mask:255};B.u_alpha_discard_threshold=.8,N(new t1(r,e,255,m.KEEP,m.KEEP,m.INVERT)),B.u_alpha_discard_threshold=0,N(new t1(r,e,255,m.KEEP,m.KEEP,m.KEEP))}else z&&_&&(B.u_alpha_discard_threshold=.001),N(_?O:i.stencilModeForClipping(s))}_&&(i.forceTerrainMode=!1),z&&(i.resetStencilClippingMasks(),v&&f.clear({stencil:0})),0===u||i.depthOcclusion||v||i.layersWithOcclusionOpacity.push(i.currentLayer)},fill:function(i,r,a,n){let o=a.paint.get("fill-color"),s=a.paint.get("fill-opacity"),l=a.is3D(),h=new t0(i.context.gl.LEQUAL,t0.ReadWrite,i.depthRangeFor3D);if(0===s.constantOr(1))return;let u=a.paint.get("fill-emissive-strength"),c=i.colorModeForDrapableLayerRenderPass(u),d=a.paint.get("fill-pattern"),p=i.opaquePassEnabledForLayer()&&!d.constantOr(1)&&1===o.constantOr(e.aj.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(i.renderPass===p){let e=l?h:i.depthModeForSublayer(1,"opaque"===i.renderPass?t0.ReadWrite:t0.ReadOnly);as(i,r,a,n,e,c,!1)}if(!l&&"translucent"===i.renderPass&&a.paint.get("fill-antialias")){let e=l?h:i.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,t0.ReadOnly);as(i,r,a,n,e,c,!0)}},"fill-extrusion":function(i,r,a,n){let o=a.paint.get("fill-extrusion-opacity"),s=i.context,l=s.gl,h=i.terrain,u=h&&h.renderingToTexture;if(0===o)return;let c=i.conflationActive&&i.style.isLayerClipped(a,r.getSource()),d=i.style.order.indexOf(a.fqid);if(c&&function(e,i,r,a,n){for(let o of a){let a=i.getTile(o).getBucket(r);a&&(a.updateReplacement(o,e.replacementSource,n),a.uploadCentroid(e.context))}}(i,r,a,n,d),h||c)for(let o of n){let n=r.getTile(o).getBucket(a);n&&function(i,r,a,n,o,s,l){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();let h=s?s.findDEMTileFor(a):null;if(!(h&&h.dem||l))return;s&&h&&h.dem&&n.selfDEMTileTimestamp!==h.dem._timestamp&&(n.borderDoneWithNeighborZ=[-1,-1,-1,-1],n.selfDEMTileTimestamp=h.dem._timestamp);let u=i=>new e.P(Math.ceil((i+e.d7)*e.d8),0),c=e=>{let i=r.getSource().minzoom,a=e=>{let i=r.getTileByID(e);if(i&&i.hasData())return i.getBucket(o)};
98for(let r of[0,-1,1]){if(e.overscaledZ+r<i)continue;let n=a(e.calculateScaledKey(e.overscaledZ+r));if(n)return n}},d=[0,0,0],p=(i,r)=>(d[0]=Math.min(i.min.y,r.min.y),d[1]=Math.max(i.max.y,r.max.y),d[2]=e.ag-r.min.x>i.max.x?r.min.x-e.ag:i.max.x,d),f=(i,r)=>(d[0]=Math.min(i.min.x,r.min.x),d[1]=Math.max(i.max.x,r.max.x),d[2]=e.ag-r.min.y>i.max.y?r.min.y-e.ag:i.max.y,d),m=[(e,i)=>p(e,i),(e,i)=>p(i,e),(e,i)=>f(e,i),(e,i)=>f(i,e)],_=(i,r,n,o,l,u,c)=>{if(!s)return 0;let d=[[u?n:i,u?i:n,0],[u?n:r,u?r:n,0]],p=c<0?e.ag+c:c,f=[u?p:(i+r)/2,u?(i+r)/2:p,0];return 0===n&&c<0||0!==n&&c>0?s.getForTilePoints(l,[f],!0,o):d.push(f),s.getForTilePoints(a,d,!0,h),Math.max(d[0][2],d[1][2],f[2])/s.exaggeration()};for(let i=0;i<4;i++){let r=n.borderFeatureIndices[i];if(0===r.length)continue;let o=e.d4[i](a),h=c(o);if(!(h&&h instanceof e.d5))continue;let d=s?s.findDEMTileFor(o):null;if(!(d&&d.dem||l)||(s&&d&&d.dem&&n.borderDEMTileTimestamp[i]!==d.dem._timestamp&&(n.borderDoneWithNeighborZ[i]=-1,n.borderDEMTileTimestamp[i]=d.dem._timestamp),n.borderDoneWithNeighborZ[i]===h.canonical.z))continue;0===h.centroidVertexArray.length&&h.createCentroidsBuffer();let p=(i<2?1:5)-i,f=h.borderDoneWithNeighborZ[p]!==n.canonical.z,g=h.borderFeatureIndices[p],y=0;if(n.canonical.z!==h.canonical.z){for(let e of r)n.showCentroid(n.featuresOnBorder[e]);if(f)for(let e of g)h.showCentroid(h.featuresOnBorder[e]);n.borderDoneWithNeighborZ[i]=h.canonical.z,h.borderDoneWithNeighborZ[p]=n.canonical.z}for(let a of r){let r;let s=n.featuresOnBorder[a],c=n.centroidData[s.centroidDataIndex],f=s.borders[i];for(;y<g.length;){let e=(r=h.featuresOnBorder[g[y]]).borders[p];if(e[1]>f[0]+3||e[0]>f[0]-3)break;h.showCentroid(r),y++}if(r&&y<g.length){let a=y,x=0;for(;!(r.borders[p][0]>f[1]-3)&&(x++,++y!==g.length);)r=h.featuresOnBorder[g[y]];r=h.featuresOnBorder[g[a]];let v=!1;if(x>=1){let e=r.borders[p];3>Math.abs(f[0]-e[0])&&3>Math.abs(f[1]-e[1])&&(x=1,v=!0,y=a+1)}else if(0===x){n.showCentroid(s);continue}let b=h.centroidData[r.centroidDataIndex];l&&v&&((c.flags|b.flags)&e.d6?(c.flags|=e.d6,b.flags|=e.d6):(c.flags&=~e.d6,b.flags&=~e.d6));let w=s.intersectsCount()>1||r.intersectsCount()>1;if(x>1)y=a,c.centroidXY=b.centroidXY=new e.P(0,0);else if(d&&d.dem&&!w){let r=m[i](c,b),a=i%2?e.ag-1:0,n=_(r[0],Math.min(e.ag-1,r[1]),a,d,o,i<2,r[2]);c.centroidXY=b.centroidXY=u(n)}else w?c.centroidXY=b.centroidXY=new e.P(0,0):(c.centroidXY=n.encodeBorderCentroid(s),b.centroidXY=h.encodeBorderCentroid(r));n.writeCentroidToBuffer(c),h.writeCentroidToBuffer(b)}else n.showCentroid(s)}n.borderDoneWithNeighborZ[i]=h.canonical.z,h.borderDoneWithNeighborZ[p]=n.canonical.z}(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(i)}(i.context,r,o,n,a,h,c)}if("shadow"===i.renderPass&&i.shadowRenderer){let s=i.shadowRenderer;if(h&&o<.65&&a._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.a9)return;let l=s.getShadowPassDepthMode(),u=s.getShadowPassColorMode();al(i,r,a,n,l,t1.disabled,u,c)}else if("translucent"===i.renderPass){let d=!a.paint.get("fill-extrusion-pattern").constantOr(1),p=a.paint.get("fill-extrusion-color").constantOr(e.aj.white);if(!u&&0!==p.a){let e=new t0(i.context.gl.LEQUAL,t0.ReadWrite,i.depthRangeFor3D);1===o&&d?al(i,r,a,n,e,t1.disabled,tQ.unblended,c):(al(i,r,a,n,e,t1.disabled,tQ.disabled,c),al(i,r,a,n,e,i.stencilModeFor3D(),i.colorModeForRenderPass(),c),i.resetStencilClippingMasks())}if(i.style.enable3dLights()&&d&&(!h&&"globe"!==i.transform.projection.name||u)){let o=a.paint.get("fill-extrusion-opacity"),d=a.paint.get("fill-extrusion-ambient-occlusion-intensity"),p=a.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),f=a.paint.get("fill-extrusion-flood-light-intensity"),m="none"===a.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),_=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(m?null:a.lut).toArray01().slice(0,3),g=d>0&&p>0,y=f>0,x=(e,i,r)=>(1-r)*e+r*i,v=s=>{let h=i.depthModeForSublayer(1,t0.ReadOnly,l.LEQUAL,!0),u=x(.1,3,a.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation")),m=i._showOverdrawInspector;m||ah(i,r,a,n,h,new t1({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),new tQ([l.ONE,l.ONE,l.ONE,l.ONE],e.aj.transparent,[!1,!1,!1,!0],l.MIN),t2.disabled,s,"sdf",o,d,p,f,_,u,c,!1);{let g=m?t1.disabled:new t1({func:l.EQUAL,mask:255}
98,255,255,l.KEEP,l.DECR,l.DECR),y=m?i.colorModeForRenderPass():new tQ([l.ONE_MINUS_DST_ALPHA,l.DST_ALPHA,l.ONE,l.ONE],e.aj.transparent,[!0,!0,!0,!0]);ah(i,r,a,n,h,g,y,t2.disabled,s,"color",o,d,p,f,_,u,c,!1)}};if(u){let u=(s,h,u)=>{let m=i.depthModeForSublayer(1,t0.ReadOnly,l.LEQUAL,!1),g=x(.1,3,a.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"));{let u=new tQ([l.ONE,l.ONE,l.ONE,l.ONE],e.aj.transparent,[!1,!1,!1,!0]);ah(i,r,a,n,m,t1.disabled,u,t2.disabled,s,"clear",o,d,p,f,_,g,c,h)}ah(i,r,a,n,m,new t1({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),new tQ([l.ONE,l.ONE,l.ONE,l.ONE],e.aj.transparent,[!1,!1,!1,!0],l.MIN),t2.disabled,s,"sdf",o,d,p,f,_,g,c,h);{let u=s?l.ZERO:l.ONE_MINUS_DST_ALPHA;ah(i,r,a,n,m,new t1({func:l.EQUAL,mask:255},255,255,l.KEEP,l.DECR,l.DECR),new tQ([u,l.DST_ALPHA,l.ONE_MINUS_DST_ALPHA,l.ZERO],e.aj.transparent,[!0,!0,!0,!0]),t2.disabled,s,"color",o,d,p,f,_,g,c,h)}{let y=new tQ([l.ONE,l.ONE,l.ONE,s?l.ZERO:l.ONE],e.aj.transparent,[!1,!1,!1,!0],s?l.FUNC_ADD:l.MAX);ah(i,r,a,n,m,t1.disabled,y,t2.disabled,s,"clear",o,d,p,f,_,g,c,h,u)}};if(g||y){let r;if(i.prepareDrawTile(),h){let i=h.drapeBufferSize[0],a=h.drapeBufferSize[1];(r=h.framebufferCopyTexture)&&(!r||r.size[0]===i&&r.size[1]===a)||(r&&r.destroy(),r=h.framebufferCopyTexture=new e.T(s,new e.r({width:i,height:a}),l.RGBA8)),r.bind(l.LINEAR,l.CLAMP_TO_EDGE),l.copyTexSubImage2D(l.TEXTURE_2D,0,0,0,0,0,i,a)}g&&u(!0,!1,r),y&&u(!1,!0,r)}}else g&&v(!0),y&&v(!1),(g||y)&&i.resetStencilClippingMasks()}}},hillshade:function(i,r,a,n){if("offscreen"!==i.renderPass&&"translucent"!==i.renderPass||i.style.disableElevatedTerrain)return;let o=i.context,s=i.terrain&&i.terrain.renderingToTexture,[l,h]="translucent"!==i.renderPass||s?[{},n]:i.stencilConfigForOverlap(n);for(let n of h){let o=r.getTile(n);if(o.needsHillshadePrepare&&"offscreen"===i.renderPass)!function(i,r,a){let n=i.context,o=n.gl;if(!r.dem)return;let s=r.dem;if(n.activeTexture.set(o.TEXTURE1),iq(i,r,s),!r.demTexture)return;r.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);let l=s.dim;n.activeTexture.set(o.TEXTURE0);let h=r.hillshadeFBO;if(!h){let i=new e.T(n,{width:l,height:l,data:null},o.RGBA8);i.bind(o.LINEAR,o.CLAMP_TO_EDGE),(h=r.hillshadeFBO=n.createFramebuffer(l,l,!0,"renderbuffer")).colorAttachment.set(i.texture)}n.bindFramebuffer.set(h.framebuffer),n.viewport.set([0,0,l,l]);let{tileBoundsBuffer:u,tileBoundsIndexBuffer:c,tileBoundsSegments:d}=i.getMercatorTileBoundsBuffers(),p=[];i.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT"),i.getOrCreateProgram("hillshadePrepare",{defines:p}).draw(i,o.TRIANGLES,t0.disabled,t1.disabled,tQ.unblended,t2.disabled,((i,r)=>{let a=r.stride,n=e.ab.mat4.create();return e.ab.mat4.ortho(n,0,e.ag,-e.ag,0,0,1),e.ab.mat4.translate(n,n,[0,-e.ag,0]),{u_matrix:n,u_image:1,u_dimension:[a,a],u_zoom:i.overscaledZ}})(r.tileID,s),a.id,u,c,d),r.needsHillshadePrepare=!1}(i,o,a);else if("translucent"===i.renderPass){let r=i.depthModeForSublayer(0,t0.ReadOnly),h=a.paint.get("hillshade-emissive-strength"),u=i.colorModeForDrapableLayerRenderPass(h),c=s&&i.terrain?i.terrain.stencilModeForRTTOverlap(n):l[n.overscaledZ];!function(i,r,a,n,o,s,l){let h=i.context,u=h.gl,c=a.hillshadeFBO;if(!c)return;i.prepareDrawTile();let d=i.isTileAffectedByFog(r),p=i.getOrCreateProgram("hillshade",{overrideFog:d});h.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,c.colorAttachment.get());let f=((i,r,a,n)=>{let o=a.paint.get("hillshade-shadow-color"),s="none"===a.paint.get("hillshade-shadow-color-use-theme").constantOr("default"),l=a.paint.get("hillshade-highlight-color"),h="none"===a.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),u=a.paint.get("hillshade-accent-color"),c="none"===a.paint.get("hillshade-accent-color-use-theme").constantOr("default"),d=a.paint.get("hillshade-emissive-strength"),p=e.ai(a.paint.get("hillshade-illumination-direction"));if("viewport"===a.paint.get("hillshade-illumination-anchor"))p-=i.transform.angle;else if(i.style&&i.style.enable3dLights()&&i.style.directionalLight){let r=i.style.directionalLight.properties.get("direction"),a=e.cb(r.x,r.y,r.z);p=e.ai(a[1])}let f=!i.options.moving;return{u_matrix:n||i.transform.calculateProjMatrix(r.tileID.toUnwrapped(),f),u_image:0,u_latrange:function(i,r){let a=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new e.aa(0,n/a).toLngLat().lat,new e.aa(0,(n+1)/a).toLngLat().lat]}(0,r.tileID),u_light:[a.paint.get("hillshade-exaggeration"),p],u_shadow:o.toRenderColor(s?null:a.lut),u_highlight:l.toRenderColor(h?null:a.lut),u_emissive_strength:d,u_accent:u.toRenderColor(c?null:a.lut)}})(i,a,n,i.terrain?r.projMatrix:null);i.uploadCommonUniforms(h,p,r.toUnwrapped());let{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=i.getTileBoundsBuffers(a);p.draw(i,u.TRIANGLES,o,s,l,t2.disabled,f,n.id,m,_,g)}(i,n,o,a,r,c,u)}}o.viewport.set([0,0,i.width,i.height]),i.resetStencilClippingMasks()}
98,raster:function(i,r,a,n,o,s){if("translucent"!==i.renderPass||0===a.paint.get("raster-opacity"))return;let l="globe"===i.transform.projection.name,h=0!==a.paint.get("raster-elevation"),u=h&&l;if(i.renderElevatedRasterBackface&&!u)return;let c=i.context,d=c.gl,p=r.getSource(),f=function(i,r,a,n){let o=r.paint.get("raster-color"),s="raster-array"===i.type,l=[],h=r.paint.get("raster-resampling"),u=r.paint.get("raster-color-mix"),c=r.paint.get("raster-color-range"),d=[u[0],u[1],u[2],0],p=u[3],f="nearest"===h?n.NEAREST:n.LINEAR;if(s&&(l.push("RASTER_ARRAY"),o||l.push("RASTER_COLOR"),"linear"===h&&l.push("RASTER_ARRAY_LINEAR"),f=n.NEAREST,!c&&i.rasterLayers)){let e=i.rasterLayers.find(({id:e})=>e===r.sourceLayer);e&&e.fields&&e.fields.range&&(c=e.fields.range)}if(c=c||[0,1],o){l.push("RASTER_COLOR"),a.activeTexture.set(n.TEXTURE2),r.updateColorRamp(c);let i=r.colorRampTexture;i||(i=r.colorRampTexture=new e.T(a,r.colorRamp,n.RGBA8)),i.bind(n.LINEAR,n.CLAMP_TO_EDGE)}return{mix:d,range:c,offset:p,defines:l,resampling:f}}(p,a,c,d);if(p instanceof e.aJ&&!n.length&&!l)return;let m=a.paint.get("raster-emissive-strength"),_=i.colorModeForDrapableLayerRenderPass(m),g=i.terrain&&i.terrain.renderingToTexture,y=!i.options.moving,x="nearest"===a.paint.get("raster-resampling")?d.NEAREST:d.LINEAR;if(p instanceof e.aJ&&!n.length&&(p.onNorthPole||p.onSouthPole)){let e=h?i.stencilModeFor3D():t1.disabled;return void af(!!p.onNorthPole,null,i,r,a,m,f,t2.disabled,e)}if(!n.length)return;let[v,b]=p instanceof e.aJ||g?[{},n]:i.stencilConfigForOverlap(n),w=b[b.length-1].overscaledZ;u&&f.defines.push("PROJECTION_GLOBE_VIEW"),h&&f.defines.push("RENDER_CUTOFF");let T=(n,o,b)=>{for(let T of n){let n,S,M,E,A;let I=T.toUnwrapped(),C=r.getTile(T);if(g&&(!C||!C.hasData()))continue;c.activeTexture.set(d.TEXTURE0);let P=function(e,i,r,a){if(e)return i instanceof eY&&e instanceof e9?i.getTextureDescriptor(e,r,!0):{texture:e.texture,mix:ap(a.mix),offset:a.offset,buffer:0,tileSize:1}}(C,p,a,f);if(!P||!P.texture)continue;let{texture:z,mix:D,offset:R,tileSize:L,buffer:O}=P;g?(n=t0.disabled,S=T.projMatrix):h?(n=new t0(d.LEQUAL,t0.ReadWrite,i.depthRangeFor3D),S=l?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(I,y)):(n=i.depthModeForSublayer(T.overscaledZ-w,1===a.paint.get("raster-opacity")?t0.ReadWrite:t0.ReadOnly,d.LESS),S=i.transform.calculateProjMatrix(I,y));let k=i.terrain&&g?i.terrain.stencilModeForRTTOverlap(T):v[T.overscaledZ],F=s?0:a.paint.get("raster-fade-duration");C.registerFadeDuration(F);let B=r.findLoadedParent(T,0),N=rM(C,B,r,i.transform,F);i.terrain&&i.terrain.prepareDrawTile(),c.activeTexture.set(d.TEXTURE0),z.bind(x,d.CLAMP_TO_EDGE),c.activeTexture.set(d.TEXTURE1),B?(B.texture&&B.texture.bind(x,d.CLAMP_TO_EDGE),M=Math.pow(2,B.tileID.overscaledZ-C.tileID.overscaledZ),E=[C.tileID.canonical.x*M%1,C.tileID.canonical.y*M%1]):z.bind(x,d.CLAMP_TO_EDGE),z.useMipmap&&c.extTextureFilterAnisotropic&&i.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax);let V=i.transform,U=h?function(e){let i=e._nearZ,r=e.projection.farthestPixelDistance(e),a=r-i,n=.2*e.height,o=i+n;return[i,r,(o-n-i)/a,(o-i)/a]}(V):[0,0,0,0],j,G,q,Z,H,$=0;if(u&&p instanceof e.aJ&&p.coordinates.length>3)j=Float32Array.from(e.bb(e.cH(new e.bT(0,0,0)))),G=Float32Array.from(V.globeMatrix),q=Float32Array.from(e.cD(V)),Z=[e.at(V.center.lng),e.aA(V.center.lat)],A=p.elevatedGlobePerspectiveTransform,H=p.elevatedGlobeGridMatrix||new Float32Array(9);else if(u){let i=e.cE(T.canonical);$=e.cF(i.getCenter().lat),j=Float32Array.from(e.bb(e.cH(T.canonical))),G=Float32Array.from(V.globeMatrix),q=Float32Array.from(e.cD(V)),Z=[e.at(V.center.lng),e.aA(V.center.lat)],A=[0,0],H=Float32Array.from(e.cG(T.canonical,i,$,V.worldSize/V._pixelsPerMercatorPixel))}else A=p instanceof e.aJ?p.perspectiveTransform:[0,0],j=new Float32Array(16),G=new Float32Array(9),q=new Float32Array(16),Z=[0,0],H=new Float32Array(9);let W=rX(S,j,G,q,H,E||[0,0],e.ae(i.transform.zoom),Z,U,M||1,N,a,A,h?a.paint.get("raster-elevation"):0,2,D,R,f.range,L,O,m),X=i.isTileAffectedByFog(T),Y=i.getOrCreateProgram("raster",{defines:f.defines,overrideFog:X});if(i.uploadCommonUniforms(c,Y,I),p instanceof e.aJ){let r=p.elevatedGlobeVertexBuffer,s=p.elevatedGlobeIndexBuffer;if(g||!l)p.boundsBuffer&&p.boundsSegments&&Y.draw(i,d.TRIANGLES,n,t1.disabled,_,t2.disabled,W,a.id,p.boundsBuffer,i.quadTriangleIndexBuffer,p.boundsSegments);else if(r&&s){let l=V.zoom<=e.c6?p.elevatedGlobeSegments:p.getSegmentsForLongitude(V.center.lng);l&&Y.draw(i,d.TRIANGLES,n,t1.disabled,_,o,W,a.id,r,s,l)}}else if(u){n=new t0(d.LEQUAL,t0.ReadOnly,i.depthRangeFor3D);let e=i.globeSharedBuffers;if(e){let[r,s,l]=e.getGridBuffers($,!1);Y.draw(i,d.TRIANGLES,n,b||k,i.colorModeForRenderPass(),o,W,a.id,r,s,l)}}else{let{tileBoundsBuffer:e,tileBoundsIndexBuffer:r,tileBoundsSegments:o}=i.getTileBoundsBuffers(C);Y.draw(i,d.TRIANGLES,n,k,_,t2.disabled,W,a.id,e,r,o)}}if(!(p instanceof e.aJ)&&u)for(let e of n){let n=e.canonical.y===(1<<e.canonical.z)-1;0===e.canonical.y&&af(!0,e,i,r,a,m,f,o,b||t1.disabled),n&&af(!1,e,i,r,a,m,f,o===t2.frontCW?t2.backCW:t2.frontCW,b||t1.disabled)}};u?T(b,i.renderElevatedRasterBackface?t2.backCW:t2.frontCW,i.stencilModeFor3D()):T(b,t2.disabled,void 0),i.resetStencilClippingMasks()},"raster-particle":function(i,r,a,n,o,s){"offscreen"===i.renderPass&&function(i,r,a,n){if(!n.length)return;let o=i.context,s=o.gl,l=r.getSource();if(!(l instanceof eY))return;let h=Math.ceil(Math.sqrt(a.paint.get("raster-particle-count"))),u=a.particlePositionRGBAImage;if(!u||u.width!==h){let i=function(e){let i=e*e,r=new Uint8Array(4*i),a=function(e){return e|=0,((e
98=Math.imul((e=Math.imul((e=Math.imul(2747636419^e,2654435769))^e>>>16,2654435769))^e>>>16,2654435769))>>>0)/4294967296},n=1/1.1;for(let e=0;e<i;e++){let i=n*(a(2*e+0)+.05),o=n*(a(2*e+1)+.05),s=255*i%1,l=255*o%1,h=o-l/255;r[4*e+0]=255*(i-s/255),r[4*e+1]=255*s,r[4*e+2]=255*h,r[4*e+3]=255*l}return r}(h);u=a.particlePositionRGBAImage=new e.r({width:h,height:h},i)}let c=a.particleFramebuffer;c?c.width!==h&&(c.destroy(),c=a.particleFramebuffer=o.createFramebuffer(h,h,!0,null)):c=a.particleFramebuffer=o.createFramebuffer(h,h,!0,null);let d=[];for(let i of n){let n=r.getTile(i);if(!(n instanceof e9))continue;let s=function(i,r,a){if(!i)return null;let n=r.getTextureDescriptor(i,a,!0);if(!n)return null;let{texture:o,mix:s,offset:l,tileSize:h,buffer:u,format:c}=n;if(!o||!c)return null;let d=!1;return"uint32"===c&&(d=!0,s[3]=0,s=r$(e.dc,s,[0,a.paint.get("raster-particle-max-speed")]),l=rW(e.dc,l,[0,a.paint.get("raster-particle-max-speed")])),{texture:o,textureOffset:[u/(h+2*u),h/(h+2*u)],tileSize:h,scalarData:d,scale:s,offset:l,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[c]]}}(n,l,a);if(!s)continue;let c=[n.tileSize,n.tileSize],p=a.tileFramebuffer;p||(p=a.tileFramebuffer=o.createFramebuffer(c[0],c[1],!0,null));let f=n.rasterParticleState;f||(f=n.rasterParticleState=new a_(o,i,c,u));let m=f.update(a.lastInvalidatedAt);f.particleTextureDimension!==h&&f.updateParticleTexture(i,u);let _=f.targetColorTexture;f.targetColorTexture=f.backgroundColorTexture,f.backgroundColorTexture=_;let g=f.particleTexture0;f.particleTexture0=f.particleTexture1,f.particleTexture1=g,d.push([i,s,f,m])}if(0===d.length)return;let p=e.q.now(),f=a.previousDrawTimestamp?.001*(p-a.previousDrawTimestamp):.0167;if(a.previousDrawTimestamp=p,a.hasColorMap()){o.activeTexture.set(s.TEXTURE0+2);let i=a.colorRampTexture;i||(i=a.colorRampTexture=new e.T(o,a.colorRamp,s.RGBA8)),i.bind(s.LINEAR,s.CLAMP_TO_EDGE)}o.bindFramebuffer.set(a.tileFramebuffer.framebuffer),function(i,r,a){var n;let o=i.context,s=o.gl,l=r.tileFramebuffer;o.activeTexture.set(s.TEXTURE0);let h={u_texture:0,u_opacity:1.05*(n=r.paint.get("raster-particle-fade-opacity-factor"))/(n+.05)},u=i.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});for(let n of a){let[,,a,c]=n;l.colorAttachment.set(a.targetColorTexture.texture),o.viewport.set([0,0,l.width,l.height]),o.clear({color:e.aj.transparent}),c&&(a.backgroundColorTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),u.draw(i,s.TRIANGLES,t0.disabled,t1.disabled,tQ.alphaBlended,t2.disabled,h,r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments))}}(i,a,d),function(i,r,a,n){let o=i.context,s=o.gl,l=a.tileFramebuffer,h="globe"===i.transform.projection.name,u=a.paint.get("raster-particle-max-speed");for(let c of n){let[n,d,p]=c;o.activeTexture.set(s.TEXTURE0+0),d.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),l.colorAttachment.set(p.targetColorTexture.texture);let f=i.getOrCreateProgram("rasterParticleDraw",{defines:d.defines,overrideFog:!1});o.activeTexture.set(s.TEXTURE0+1);let m=d.scalarData?[]:[0,1,2,3].map(i=>e.d4[i](n));m.push(n);let _=n.canonical.x,g=n.canonical.y;for(let e of m){let o=r.getTile(h?e.wrapped():e);if(!o)continue;let l=o.rasterParticleState;if(!l)continue;let c=e.canonical.x+(1<<e.canonical.z)*(e.wrap-n.wrap),p=e.canonical.y;l.particleTexture0.bind(s.NEAREST,s.CLAMP_TO_EDGE);let m=rK(1,l.particleTexture0.size[0],[c-_,p-g],0,d.texture.size,2,u,d.textureOffset,d.scale,d.offset);f.draw(i,s.POINTS,t0.disabled,t1.disabled,tQ.alphaBlended,t2.disabled,m,a.id,l.particleIndexBuffer,void 0,l.particleSegment)}}}(i,r,a,d),o.bindFramebuffer.set(a.particleFramebuffer.framebuffer),function(i,r,a,n){let o=i.context,s=o.gl,l=r.paint.get("raster-particle-max-speed"),h=n*r.paint.get("raster-particle-speed-factor")*.15,u=Math.pow(.01+1*r.paint.get("raster-particle-reset-rate-factor"),6),c=r.particleFramebuffer;for(let n of(o.viewport.set([0,0,c.width,c.height]),a)){let[,a,d]=n;o.activeTexture.set(s.TEXTURE0+0),a.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE0+1);let p=d.particleTexture0;p.bind(s.NEAREST,s.CLAMP_TO_EDGE);let f=rJ(1,p.size[0],0,a.texture.size,l,h,u,a.textureOffset,a.scale,a.offset);c.colorAttachment.set(d.particleTexture1.texture),o.clear({color:e.aj.transparent}),i.getOrCreateProgram("rasterParticleUpdate",{defines:a.defines}).draw(i,s.TRIANGLES,t0.disabled,t1.disabled,tQ.unblended,t2.disabled,f,r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments)}}(i,a,d,f)}(i,r,a,n),"translucent"===i.renderPass&&(function(i,r,a,n,o){let s=i.context,l=s.gl,h=r.getSource().tileSize,u=5*(1-e.ac(e.bY,e.bY+1,i.transform.zoom))*h+a.paint.get("raster-particle-elevation"),c=!i.options.moving,d="globe"===i.transform.projection.name;if(!n.length)return;let[p,f]=i.stencilConfigForOverlap(n),m=[];d&&m.push("PROJECTION_GLOBE_VIEW");let _=i.stencilModeFor3D();for(let n of f){let o,h,f,g,y,x,v;let b=n.toUnwrapped(),w=r.getTile(n);if(!w.rasterParticleState)continue;let T=w.rasterParticleState;w.registerFadeDuration(100);let S=r.findLoadedParent(n,0),M=rM(w,S,r,i.transform,100);i.terrain&&i.terrain.prepareDrawTile(),s.activeTexture.set(l.TEXTURE0),T.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE1),S&&S.rasterParticleState?(S.rasterParticleState.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),o=Math.pow(2,S.tileID.overscaledZ-w.tileID.overscaledZ
98),h=[w.tileID.canonical.x*o%1,w.tileID.canonical.y*o%1]):T.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE);let E=d?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(b,c),A=i.transform,I=function(e){let i=e._nearZ,r=e.projection.farthestPixelDistance(e),a=r-i,n=.2*e.height,o=i+n;return[i,r,(o-n-i)/a,(o-i)/a]}(A),C=e.cE(n.canonical),P=e.cF(C.getCenter().lat);d?(f=Float32Array.from(e.bb(e.cH(n.canonical))),g=Float32Array.from(A.globeMatrix),y=Float32Array.from(e.cD(A)),x=[e.at(A.center.lng),e.aA(A.center.lat)],v=Float32Array.from(e.cG(n.canonical,C,P,A.worldSize/A._pixelsPerMercatorPixel))):(f=new Float32Array(16),g=new Float32Array(9),y=new Float32Array(16),x=[0,0],v=new Float32Array(9));let z=rY(E,f,g,y,v,h||[0,0],e.ae(i.transform.zoom),x,I,o||1,M,u),D=i.isTileAffectedByFog(n),R=i.getOrCreateProgram("rasterParticle",{defines:m,overrideFog:D});if(i.uploadCommonUniforms(s,R,b),d){let e=new t0(l.LEQUAL,t0.ReadOnly,i.depthRangeFor3D),r=i.globeSharedBuffers;if(r){let[n,o,s]=r.getGridBuffers(P,!1);R.draw(i,l.TRIANGLES,e,_,tQ.alphaBlended,i.renderElevatedRasterBackface?t2.frontCCW:t2.backCCW,z,a.id,n,o,s)}}else{let e=i.depthModeForSublayer(0,t0.ReadOnly),r=p[n.overscaledZ],{tileBoundsBuffer:o,tileBoundsIndexBuffer:s,tileBoundsSegments:h}=i.getTileBoundsBuffers(w);R.draw(i,l.TRIANGLES,e,r,tQ.alphaBlended,t2.disabled,z,a.id,o,s,h)}}i.resetStencilClippingMasks()}(i,r,a,n),i.style.map.triggerRepaint())},background:function(i,r,a,n){let o;let s=a.paint.get("background-color"),l="none"===a.paint.get("background-color-use-theme").constantOr("default"),h=a.paint.get("background-opacity"),u=a.paint.get("background-emissive-strength"),c="viewport"===a.paint.get("background-pitch-alignment");if(0===h)return;let d=i.context,p=d.gl,f=i.transform,m=f.tileSize,_=a.paint.get("background-pattern");if(void 0!==_&&(null===_||!(o=i.imageManager.getPattern(_.toString(),a.scope,i.style.getLut(a.scope)))))return;let g=!_&&1===s.a&&1===h&&i.opaquePassEnabledForLayer()?"opaque":"translucent";if(i.renderPass!==g)return;let y=t1.disabled,x=i.depthModeForSublayer(0,"opaque"===g?t0.ReadWrite:t0.ReadOnly),v=i.colorModeForDrapableLayerRenderPass(u),b=_?"backgroundPattern":"background",w,T=n;if(T||(T=Object.values(w=i.getBackgroundTiles()).map(e=>e.tileID)),_&&(d.activeTexture.set(p.TEXTURE0),i.imageManager.bind(i.context,a.scope)),c){let r=i.getOrCreateProgram(b,{overrideFog:!1,overrideRtt:!0}),n=new Float32Array(e.ab.mat4.identity([])),d=new e.aG(0,0,0,0,0),f=_?r2(n,u,h,i,0,a.scope,o,c,{tileID:d,tileSize:m}):r1(n,u,h,s.toRenderColor(l?null:a.lut));r.draw(i,p.TRIANGLES,x,y,v,t2.disabled,f,a.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments)}else for(let e of T){let g=i.isTileAffectedByFog(e),T=i.getOrCreateProgram(b,{overrideFog:g}),S=e.toUnwrapped(),M=n?e.projMatrix:i.transform.calculateProjMatrix(S);i.prepareDrawTile();let E=r?r.getTile(e):w?w[e.key]:new e8(e,m,f.zoom,i),A=_?r2(M,u,h,i,0,a.scope,o,c,{tileID:e,tileSize:m}):r1(M,u,h,s.toRenderColor(l?null:a.lut));i.uploadCommonUniforms(d,T,S);let{tileBoundsBuffer:I,tileBoundsIndexBuffer:C,tileBoundsSegments:P}=i.getTileBoundsBuffers(E);T.draw(i,p.TRIANGLES,x,y,v,t2.disabled,A,a.id,I,C,P)}},sky:function(i,r,a){let n=i._atmosphere?e.ae(i.transform.zoom):1,o=a.paint.get("sky-opacity")*n;if(0===o)return;let s=i.context,l=a.paint.get("sky-type"),h=new t0(s.gl.LEQUAL,t0.ReadOnly,[0,1]),u=i.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===i.renderPass?a.needsSkyboxCapture(i)&&(function(i,r,a,n){let o=i.context,s=o.gl,l=r.skyboxFbo;if(!l){l=r.skyboxFbo=o.createFramebuffer(32,32,!0,null),r.skyboxGeometry=new aI(o),r.skyboxTexture=o.gl.createTexture(),s.bindTexture(s.TEXTURE_CUBE_MAP,r.skyboxTexture),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,s.LINEAR);for(let e=0;e<6;++e)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,s.RGBA,32,32,0,s.RGBA,s.UNSIGNED_BYTE,null)}o.bindFramebuffer.set(l.framebuffer),o.viewport.set([0,0,32,32]);let h=r.getCenter(i,!0),u=i.getOrCreateProgram("skyboxCapture"),c=new Float64Array(16);e.ab.mat4.identity(c),e.ab.mat4.rotateY(c,c,-(.5*Math.PI)),aC(i,r,u,c,h,0),e.ab.mat4.identity(c),e.ab.mat4.rotateY(c,c,.5*
98Math.PI),aC(i,r,u,c,h,1),e.ab.mat4.identity(c),e.ab.mat4.rotateX(c,c,-(.5*Math.PI)),aC(i,r,u,c,h,2),e.ab.mat4.identity(c),e.ab.mat4.rotateX(c,c,.5*Math.PI),aC(i,r,u,c,h,3),e.ab.mat4.identity(c),aC(i,r,u,c,h,4),e.ab.mat4.identity(c),e.ab.mat4.rotateY(c,c,Math.PI),aC(i,r,u,c,h,5),o.viewport.set([0,0,i.width,i.height])}(i,a),a.markSkyboxValid(i)):"sky"===i.renderPass&&function(e,i,r,a,n){let o=e.context,s=o.gl,l=e.transform,h=e.getOrCreateProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture);let u={u_matrix:l.skyboxMatrix,u_sun_direction:i.getCenter(e,!1),u_cubemap:0,u_opacity:a,u_temporal_offset:n};e.uploadCommonUniforms(o,h),h.draw(e,s.TRIANGLES,r,t1.disabled,e.colorModeForRenderPass(),t2.backCW,u,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(i,a,h,o,u):"gradient"===l&&"sky"===i.renderPass&&function(i,r,a,n,o){let s,l,h;let u=i.context,c=u.gl,d=i.transform,p=i.getOrCreateProgram("skyboxGradient");r.skyboxGeometry||(r.skyboxGeometry=new aI(u)),u.activeTexture.set(c.TEXTURE0);let f=r.colorRampTexture;f||(f=r.colorRampTexture=new e.T(u,r.colorRamp,c.RGBA8)),f.bind(c.LINEAR,c.CLAMP_TO_EDGE);let m=(s=d.skyboxMatrix,l=r.getCenter(i,!1),h=r.paint.get("sky-gradient-radius"),{u_matrix:s,u_color_ramp:0,u_center_direction:l,u_radius:e.ai(h),u_opacity:n,u_temporal_offset:o});i.uploadCommonUniforms(u,p),p.draw(i,c.TRIANGLES,a,t1.disabled,i.colorModeForRenderPass(),t2.backCW,m,"skyboxGradient",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}(i,a,h,o,u)},debug:function(i,r,a,n,o,s){for(let l=0;l<a.length;l++)if(o){let o=new e.aj(.8*n.r,.8*n.g,.8*n.b,1);aw(i,r,a[l],n,-1,-1,s),aw(i,r,a[l],n,-1,1,s),aw(i,r,a[l],n,1,1,s),aw(i,r,a[l],n,1,-1,s),aw(i,r,a[l],o,0,0,s)}else aw(i,r,a[l],n,0,0,s)},custom:function(i,r,a,n){let o=i.context,s=a.implementation;if(!i.transform.projection.unsupportedLayers||!i.transform.projection.unsupportedLayers.includes("custom")||i.terrain&&(i.terrain.renderingToTexture||"offscreen"===i.renderPass)&&a.isDraped(r)){if("offscreen"===i.renderPass){let r=s.prerender;if(r){if(i.setCustomLayerDefaults(),o.setColorMode(i.colorModeForRenderPass()),"globe"===i.transform.projection.name){let a=i.transform.pointMerc;r.call(s,o.gl,i.transform.customLayerMatrix(),i.transform.getProjection(),i.transform.globeToMercatorMatrix(),e.ae(i.transform.zoom),[a.x,a.y],i.transform.pixelsPerMeterRatio)}else r.call(s,o.gl,i.transform.customLayerMatrix());o.setDirty(),i.setBaseState()}}else if("translucent"===i.renderPass){if(i.terrain&&i.terrain.renderingToTexture){let r=s.renderToTile;if(r){let a=n[0].canonical,l=new e.aa(a.x+n[0].wrap*(1<<a.z),a.y,a.z);o.setDepthMode(t0.disabled),o.setStencilMode(t1.disabled),o.setColorMode(i.colorModeForRenderPass()),i.setCustomLayerDefaults(),r.call(s,o.gl,l),o.setDirty(),i.setBaseState()}return}i.setCustomLayerDefaults(),o.setColorMode(i.colorModeForRenderPass()),o.setStencilMode(t1.disabled);let r="3d"===s.renderingMode?new t0(i.context.gl.LEQUAL,t0.ReadWrite,i.depthRangeFor3D):i.depthModeForSublayer(0,t0.ReadOnly);if(o.setDepthMode(r),"globe"===i.transform.projection.name){let r=i.transform.pointMerc;s.render(o.gl,i.transform.customLayerMatrix(),i.transform.getProjection(),i.transform.globeToMercatorMatrix(),e.ae(i.transform.zoom),[r.x,r.y],i.transform.pixelsPerMeterRatio)}else s.render(o.gl,i.transform.customLayerMatrix());o.setDirty(),i.setBaseState(),o.bindFramebuffer.set(null)}}else e.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(i,r,a,n){if("opaque"===i.renderPass)return;let o=a.paint.get("model-opacity").constantOr(1);if(0===o)return;let s=a.paint.get("model-cast-shadows");if("shadow"===i.renderPass&&(!s||i.terrain&&o<.65&&a._transitionablePaint._values["model-opacity"].value.expression instanceof e.a9))return;let l=i.shadowRenderer,h=a.paint.get("model-receive-shadows");l&&(l.useNormalOffset=!0,h||(l.enabled=!1));let u=()=>{l&&(l.useNormalOffset=!0,h||(l.enabled=!0))},c=r.getSource();if("light-beam"===i.renderPass&&"batched-model"!==c.type)return;if("vector"===c.type||"geojson"===c.type)return function(i,r,a,n,o){let s=i.transform;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D models for ${s.projection.name} projection is not yet implemented`);let l=s.getFreeCameraOptions().position;if(!i.modelManager)return;let h=i.modelManager;a.modelManager=h;let u=i.shadowRenderer;if(!a._unevaluatedLayout._values.hasOwnProperty("model-id"))return;let c=a._unevaluatedLayout._values["model-id"],d={...a.layout.get("model-id").parameters},p=i.style.order.indexOf(a.fqid);for(let f of n){let n=r.getTile(f).getBucket(a);if(!n||n.projection.name!==s.projection.name)continue;let m=n.getModelUris();m&&!n.modelsRequested&&(h.addModelsFromBucket(m,o),n.modelsRequested=!0);let _=function(i,r){let a=1<<i.canonical.z,n=r.getFreeCameraOptions().position,o=r.elevation,s=i.canonical.x/a,l=(i.canonical.x+1)/a,h=i.canonical.y/a,u=(i.canonical.y+1)/a,c=r._centerAltitude;if(o){let e=o.getMinMaxForTile(i);e&&e.max>c&&(c=e.max)}let d=e.aw(n.x,s,l)-n.x,p=e.aw(n.y,h,u)-n.y,f=e.bH(c,r.center.lat)-n.z;return r._zoomFromMercatorZ(Math.sqrt(d*d+p*p+f*f))}(f,s);d.zoom=_;let g=c.possiblyEvaluate(d);if(function(i,r,a){let n=r.updateZoomBasedPaintProperties(),o=function(i,r,a){let n,o,s,l=i.terrain?i.terrain.exaggeration():0;if(i.terrain&&l>0){let r=i.terrain,o=r.findDEMTileFor(a);o&&o.dem?n=e.dn.create(r,a,o):l=0}if(0===l&&(r.terrainElevationMin=0,r.terrainElevationMax=0),l===r.validForExaggeration&&(0===l||n&&n._demTile&&n._demTile.tileID===r.validForDEMTile.id&&n._dem._timestamp===r.validForDEMTile.timestamp))return!1;for(let e in r.instancesPerModel){let i=r.instancesPerModel[e];for(let e=0;e<i.instancedDataArray.length;++e){let a=(n?l*n.getElevationAt(0|i.instancedDataArray.float32[16*e],0|i.instancedDataArray.float32[16*e+1],!0,!0):0)+i.instancesEvaluatedElevation[e];i.instancedDataArray.float32[16*e+6]=a,o=o?Math.min(r.terrainElevationMin,a):a,s=s?Math.max(r.terrainElevationMax,a):a}}return r.terrainElevationMin=o||0,r.terrainElevationMax=s||0,r.validForExaggeration=l,r.validForDEMTile=n&&n._demTile?{id:n._demTile.tileID,timestamp:n._dem._timestamp}:{id:void 0,timestamp:0},!0}(i,r,a);(n||o)&&(r.uploaded=!1,r.upload(i.context))}(i,n,f),aN.shadowUniformsInitialized=!1,aN.useSingleShadowCascade=!!u&&0===u.getMaxCascadeForTile(f.toUnwrapped()),"shadow"===i.renderPass&&u){if(1===i.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;let r=s.calculatePosMatrix(f.toUnwrapped(),s.worldSize);if(aN.tileMatrix.set(r),aN.shadowTileMatrix=Float32Array.from(u.calculateShadowPassMatrixFromMatr
98ix(r)),aN.aabb.min.fill(0),aN.aabb.max[0]=aN.aabb.max[1]=e.ag,aN.aabb.max[2]=0,function(i,r,a,n){if(!a.modelManager)return!0;let o=a.modelManager;if(!a.shadowRenderer)return!0;let s=a.shadowRenderer,l=r.aabb,h=!0,u=i.maxHeight;if(0===u){let e=0;for(let r in i.instancesPerModel){let i=o.getModel(r,n);i?e=Math.max(e,Math.max(Math.max(i.aabb.max[0],i.aabb.max[1]),i.aabb.max[2])):h=!1}u=i.maxScale*e*1.41+i.maxVerticalOffset,h&&(i.maxHeight=u)}l.max[2]=u,l.min[2]+=i.terrainElevationMin,l.max[2]+=i.terrainElevationMax,e.ab.vec3.transformMat4(l.min,l.min,r.tileMatrix),e.ab.vec3.transformMat4(l.max,l.max,r.tileMatrix);let c=l.intersects(s.getCurrentCascadeFrustum());return 0===a.currentShadowCascade&&(i.isInsideFirstShadowMapFrustum=2===c),0===c}(n,aN,i,a.scope))continue}let y=1<<f.canonical.z,x=[((l.x-f.wrap)*y-f.canonical.x)*e.ag,(l.y*y-f.canonical.y)*e.ag,l.z*y*e.ag];for(let e in i.conflationActive&&Object.keys(n.instancesPerModel).length>0&&i.style.isLayerClipped(a,r.getSource())&&n.updateReplacement(f,i.replacementSource,p,o)&&(n.uploaded=!1,n.upload(i.context)),n.instancesPerModel){let r=n.instancesPerModel[e];r.features.length>0&&(e=g.evaluate(r.features[0].feature,{}));let s=h.getModel(e,o);if(s&&s.uploaded)for(let e of s.nodes)(function e(i,r,a,n,o,s,l){let h=i.context,u="shadow"===i.renderPass,c=i.shadowRenderer,d=u&&c?c.getShadowPassDepthMode():new t0(h.gl.LEQUAL,t0.ReadWrite,i.depthRangeFor3D),p=i.isTileAffectedByFog(s);if(a.meshes)for(let e of a.meshes){let f,m,_;let g=["MODEL_POSITION_ON_GPU"],y=[];n.instancedDataArray.length>20&&g.push("INSTANCED_ARRAYS");let x=ir(i,r.paint.get("model-cutoff-fade-range"));if(x.shouldRenderCutoff&&g.push("RENDER_CUTOFF"),u&&c)f=i.getOrCreateProgram("modelDepth",{defines:g}),m=r5(l.shadowTileMatrix,l.shadowTileMatrix,Float32Array.from(a.matrix)),_=c.getShadowPassColorMode();else{ak(g,y,e,i,"none"===r.paint.get("model-color-use-theme").constantOr("default")?null:r.lut),f=i.getOrCreateProgram("model",{defines:g,overrideFog:p});let n=e.material,u=n.pbrMetallicRoughness,d=r.paint.get("model-opacity").constantOr(1),v=r.paint.get("model-emissive-strength").constantOr(0);m=r4(s.expandedProjMatrix,Float32Array.from(a.matrix),new Float32Array(16),null,i,d,u.baseColorFactor.toRenderColor(null),n.emissiveFactor,u.metallicFactor,u.roughnessFactor,n,v,r,o),c&&(l.shadowUniformsInitialized?f.setShadowUniformValues(h,c.getShadowUniformValues()):(c.setupShadows(s.toUnwrapped(),f,"model-tile",s.overscaledZ),l.shadowUniformsInitialized=!0)),_=x.shouldRenderCutoff||d<1||"OPAQUE"!==n.alphaMode?tQ.alphaBlended:tQ.unblended}i.uploadCommonUniforms(h,f,s.toUnwrapped(),null,x);let v=e.material.doubleSided?t2.disabled:t2.backCCW;if(n.instancedDataArray.length>20)y.push(n.instancedDataBuffer),f.draw(i,h.gl.TRIANGLES,d,t1.disabled,_,v,m,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,y,n.instancedDataArray.length);else{let a=u?"u_instance":"u_normal_matrix";for(let o=0;o<n.instancedDataArray.length;++o)m[a]=new Float32Array(n.instancedDataArray.arrayBuffer,64*o,16),f.draw(i,h.gl.TRIANGLES,d,t1.disabled,_,v,m,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,y)}}if(a.children)for(let h of a.children)e(i,r,h,n,o,s,l)})(i,a,e,r,x,f,aN)}}}(i,r,a,n,"vector"===c.type?a.scope:""),void u();if(!c.loaded())return;if("batched-model"===c.type)return function(i,r,a,n){a.resetLayerRenderingStats(i);let o=i.context,s=i.transform,l=i.style.fog,h=i.shadowRenderer;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);let u=i.transform.getFreeCameraOptions().position,c=e.ab.vec3.scale([],[u.x,u.y,u.z],i.transform.worldSize),d=e.ab.vec3.negate([],c),p=e.ab.mat4.identity([]),f=e.dj(s.center.lat,s.zoom),m=e.ab.mat4.fromScaling([],[1,1,1/f]);e.ab.mat4.translate(p,p,d);let _=a.paint.get("model-opacity").constantOr(1),g=new t0(o.gl.LEQUAL,t0.ReadWrite,i.depthRangeFor3D),y=new t0(o.gl.LEQUAL,t0.ReadOnly,i.depthRangeFor3D),x=new e.cd([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),v="shadow"===i.renderPass,b=v&&h?h.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),w=a.paint.get("model-front-cutoff"),T=w[2]<1,S=ir(i,a.paint.get("model-cutoff-fade-range")),M=a.getLayerRenderingStats();(function(e,i,r,a){let n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(let s of a){let a=i.getTile(s).getBucket(r);a&&(e.conflationActive&&a.updateReplacement(s,e.replacementSource),a.evaluateScale(e,r),e.terrain&&n>0&&a.elevationUpdate(e.terrain,n,s,r.source),a.needsReEvaluation(e,o,r)&&a.evaluate(r))}})(i,r,a,n),function(){let u,d,E;T?(u=n.length-1,d=-1,E=-1):(u=0,d=n.length,E=1);let A=new Float64Array(16),I=e.ab.vec3.create(),C=new e.P(0,0);for(let P=u;P!==d;P+=E){let u=n[P],d=r.getTile(u).getBucket(a);if(!d||!d.uploaded)continue;let E=!1;h&&(E=0===h.getMaxCascadeForTile(u.toUnwrapped()));let z=s.calculatePosMatrix(u.toUnwrapped(),s.worldSize),D=d.modelTraits;!v&&T&&(e.ab.mat4.invert(A,z),e.ab.vec3.transformMat4(I,c,A),C.x=I[0],C.y=I[1]);let R=[];
98for(let r of d.getNodesInfo()){if(r.hiddenByReplacement||!r.node.meshes)continue;let a=r.node,n=0;i.terrain&&a.elevation&&(n=a.elevation*i.terrain.exaggeration());let o=(()=>{let i=r.aabb;return x.min=[...i.min],x.max=[...i.max],x.min[2]+=n,x.max[2]+=n,e.ab.vec3.transformMat4(x.min,x.min,z),e.ab.vec3.transformMat4(x.max,x.max,z),x})(),l=r.evaluatedScale;if(l[0]<=1&&l[1]<=1&&l[2]<=1&&0===o.intersects(b))continue;if(!v&&T){let i=1/6;r.cameraCollisionOpacity=c[0]>o.min[0]&&c[0]<o.max[0]&&c[1]>o.min[1]&&c[1]<o.max[1]&&c[2]*f<o.max[2]&&a.footprint&&e.bA(C,a.footprint)?Math.max(r.cameraCollisionOpacity-i,0):Math.min(1,r.cameraCollisionOpacity+i)}let h=[...z],u=a.anchor?a.anchor[0]:0,d=a.anchor?a.anchor[1]:0;e.ab.mat4.translate(h,h,[u*(l[0]-1),d*(l[1]-1),n]),e.ab.vec3.exactEquals(l,e.dm)||e.ab.mat4.scale(h,h,l);let p=e.ab.mat4.multiply([],h,a.matrix),m=e.ab.mat4.multiply([],s.expandedFarZProjMatrix,p),g=e.ab.mat4.multiply([],s.expandedFarZProjMatrix,h),y=e.ab.vec4.transformMat4([],[u,d,n,1],m)[2];a.hidden=!1;let M=_;v||(T&&(M*=r.cameraCollisionOpacity*function(i,r,a,n){let o,s;if(r.pitch<20)return 1;let l=r.getWorldToCameraMatrix();e.ab.mat4.multiply(l,l,i);let h=e.ab.vec4.fromValues(a.min[0],a.min[1],a.min[2],1),u=e.ab.vec4.transformMat4(e.ab.vec4.create(),h,l),c=u,d=u;h[1]=a.max[1],c=(u=e.ab.vec4.transformMat4(e.ab.vec4.create(),h,l))[1]<c[1]?u:c,d=u[1]>d[1]?u:d,h[0]=a.max[0],c=(u=e.ab.vec4.transformMat4(e.ab.vec4.create(),h,l))[1]<c[1]?u:c,d=u[1]>d[1]?u:d,h[1]=a.min[1],c=(u=e.ab.vec4.transformMat4(e.ab.vec4.create(),h,l))[1]<c[1]?u:c,d=u[1]>d[1]?u:d;let p=e.aw(n[0],0,1),f=100*r.pixelsPerMeter*e.aw(n[1],0,1),m=e.aw(n[2],0,1),_=e.ab.vec4.lerp(e.ab.vec4.create(),c,d,p),g=Math.tan(.5*r.fovX),y=-_[2]*g;if(0===f)return _[1]<-Math.abs(y)?m:1;let x=(-Math.abs(y)-_[1])/f;return o=e.aw((1-x)*1+x*m,m,1),(1-(s=e.aw((r.pitch-20)/20,0,1)))*1+s*o}(h,s,r.aabb,w)),M*=function(i,r){let a=i.uniformValues.u_cutoff_params[0],n=i.uniformValues.u_cutoff_params[1],o=i.uniformValues.u_cutoff_params[2],s=i.uniformValues.u_cutoff_params[3];return n===a||s===o?1:e.aw(((r-a)/(n-a)-o)/(s-o),0,1)}(S,y)),0!==M?R.push({nodeInfo:r,depth:y,opacity:M,wvpForNode:m,wvpForTile:g,nodeModelMatrix:p,tileModelMatrix:h}):a.hidden=!0}for(let r of(v||R.sort((e,i)=>T&&(1!==e.opacity||1!==i.opacity)?1===e.opacity?-1:1===i.opacity?1:e.depth>i.depth?-1:1:e.depth<i.depth?-1:1),R)){let n=r.nodeInfo,u=n.node,c=e.ab.mat4.multiply([],m,r.tileModelMatrix);e.ab.mat4.multiply(c,p,c);let d=e.ab.mat4.invert([],c);e.ab.mat4.transpose(d,d),e.ab.mat4.scale(d,d,aV),c=e.ab.mat4.multiply(c,c,u.matrix);let f="light-beam"===i.renderPass,_="none"===a.paint.get("model-color-use-theme").constantOr("default"),x=D&e.dp.HasMapboxMeshFeatures,b=x?0:n.evaluatedRMEA[0][2];for(let e=0;e<u.meshes.length;++e){let p;let m=u.meshes[e],w=e===u.lightMeshIndex,T=r.wvpForNode;if(w){if(!f&&!i.terrain&&i.shadowRenderer){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);continue}T=r.wvpForTile}else if(f)continue;let S={defines:[]},A=[];if(!v&&h&&(h.useNormalOffset=!!m.normalBuffer),ak(S.defines,A,m,i,_?null:a.lut),x||S.defines.push("DIFFUSE_SHADED"),E&&S.defines.push("SHADOWS_SINGLE_CASCADE"),M&&(v?M.numRenderedVerticesInShadowPass+=m.vertexArray.length:M.numRenderedVerticesInTransparentPass+=m.vertexArray.length),v){aB(m,r.nodeModelMatrix,i,a);continue}let I=null;if(l){let e=aO(r.nodeModelMatrix,i.transform);if(I=new Float32Array(e),"globe"!==s.projection.name){let i=m.aabb.min,r=m.aabb.max,[a,n]=l.getOpacityForBounds(e,i[0],i[1],r[0],r[1]);S.overrideFog=a>=.05||n>=.05}}let C=m.material;C.occlusionTexture&&C.occlusionTexture.offsetScale&&(p=C.occlusionTexture.offsetScale,S.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));let P=i.getOrCreateProgram("model",S);!v&&h&&h.setupShadowsFromMatrix(r.tileModelMatrix,P,h.useNormalOffset),i.uploadCommonUniforms(o,P,null,I);let z=C.pbrMetallicRoughness;z.metallicFactor=.9,z.roughnessFactor=.5;let D=r4(new Float32Array(T),new Float32Array(c),new Float32Array(d),new Float32Array(u.matrix),i,r.opacity,z.baseColorFactor.toRenderColor(null),C.emissiveFactor,z.metallicFactor,z.roughnessFactor,C,b,a,[0,0,0],p);!w&&(n.hasTranslucentParts||r.opacity<1)&&P.draw(i,o.gl.TRIANGLES,g,t1.disabled,tQ.disabled,t2.backCCW,D,a.id,m.vertexBuffer,m.indexBuffer,m.segments,a.paint,i.transform.zoom,void 0,A),P.draw(i,o.gl.TRIANGLES,w?y:g,t1.disabled,w||r.opacity<1||n.hasTranslucentParts?tQ.alphaBlended:tQ.unblended,t2.backCCW,D,a.id,m.vertexBuffer,m.indexBuffer,m.segments,a.paint,i.transform.zoom,void 0,A)}}}}()}(i,r,a,n),void u();if("model"!==c.type)return;let d=c.getModels(),p=[],f=i.transform.getFreeCameraOptions().position,m=e.ab.vec3.scale([],[f.x,f.y,f.z],i.transform.worldSize);e.ab.vec3.negate(m,m);let _=[],g=[],y=0;for(let r of d){let n=a.paint.get("model-rotation").constantOr(null),o=a.paint.get("model-scale").constantOr(null),s=a.paint.get("model-translation").constantOr(null);r.computeModelMatrix(i,n,o,s,!0,!0,!1);let l=e.ab.mat4.identity([]),h=e.dj(r.position.lat,i.transform.zoom),u=e.ab.mat4.fromScaling([],[1,1,1/h]);for(let a of(e.ab.mat4.translate(l,l,m),p.push({zScaleMatrix:u,negCameraPosMatrix:l}),r.nodes))!function i(r,a,n,o,s,l,h){let u;u="globe"===r.projection.name?e.dl(n,r):[...n],e.ab.mat4.multiply(u,u,a.matrix
98);let c=e.ab.mat4.multiply([],o,u);if(a.meshes)for(let i of a.meshes){if("BLEND"!==i.material.alphaMode){h.push({mesh:i,depth:0,modelIndex:s,worldViewProjection:c,nodeModelMatrix:u});continue}let r=e.ab.vec3.transformMat4([],i.centroid,c);r[2]>0&&l.push({mesh:i,depth:r[2],modelIndex:s,worldViewProjection:c,nodeModelMatrix:u})}if(a.children)for(let e of a.children)i(r,e,n,o,s,l,h)}(i.transform,a,r.matrix,i.transform.expandedFarZProjMatrix,y,_,g);y++}if(_.sort((e,i)=>i.depth-e.depth),"shadow"!==i.renderPass){if(1===o)for(let e of g)aF(e,i,a,p[e.modelIndex],t1.disabled,i.colorModeForRenderPass());else{for(let e of g)aF(e,i,a,p[e.modelIndex],t1.disabled,tQ.disabled);for(let e of g)aF(e,i,a,p[e.modelIndex],i.stencilModeFor3D(),i.colorModeForRenderPass());i.resetStencilClippingMasks()}for(let e of _)aF(e,i,a,p[e.modelIndex],t1.disabled,i.colorModeForRenderPass());u()}else{for(let e of g)aB(e.mesh,e.nodeModelMatrix,i,a);for(let e of _)aB(e.mesh,e.nodeModelMatrix,i,a);u()}}},a4={model:function(e,i,r){let a=i.getSource();if(a.loaded()){if("vector"===a.type||"geojson"===a.type)return void(r.modelManager&&r.modelManager.upload(r,"vector"===a.type?e.scope:""));if("batched-model"!==a.type&&"model"===a.type)for(let e of a.getModels())e.upload(r.context)}},raster:function(e,i,r){let a=i.getSource();if(!(a instanceof eY&&a.loaded()))return;let n=e.sourceLayer||a.rasterLayerIds&&a.rasterLayerIds[0];if(!n)return;let o=e.paint.get("raster-array-band")||a.getInitialBand(n);if(null!=o)for(let e of i.getIds().map(e=>i.getTileByID(e)))e.updateNeeded(n,o)&&a.prepareTile(e,n,o)},"raster-particle":function(e,i,r){let a=i.getSource();if(!(a instanceof eY&&a.loaded()))return;let n=e.sourceLayer||a.rasterLayerIds&&a.rasterLayerIds[0];if(!n)return;let o=e.paint.get("raster-particle-array-band")||a.getInitialBand(n);if(null!=o)for(let e of i.getIds().map(e=>i.getTileByID(e)))e.updateNeeded(n,o)&&a.prepareTile(e,n,o)}};class a5{constructor(i,r,a,n,o){this.context=new at(i,r),this.transform=a,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=o,this._timeStamp=e.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};let s=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(let e of s)this._debugParams.enabledLayers[e]=!0;for(let e of(o.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),o.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),o.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),o.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200}),s))o.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new aG(o),this.setup(),this.numSublayers=tt.maxUnderzooming+tt.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.dv,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new il(this),this._wireframeDebugCache=new aj,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];let l=new e.r({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new e.T(this.context,l,i.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=n}updateTerrain(e,i){let r=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(r||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new rC(this,e));let a=this._terrain;this.transform.elevation=r?a:null,a.update(e,this.transform,i),this.transform.elevation&&!a.enabled&&(this.transform.elevation=null)}_updateFog(e){let i=e.fog;if(!i||"globe"===this.transform.projection.name||1>i.getOpacity(this.transform.pitch)||.03>i.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[r,a]=i.getFovAdjustedRange(this.transform._fov);if(r>a)return void(this.transform.fogCullDistSq=null);let n=r+.78*(a-r);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new rC(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(i,r){if(this.width=i*e.q.devicePixelRatio,this.height=r*e.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style.order)this.style._mergedLayers[e].resize()}setup(){let i=this.context,r=new e.b4;r.emplaceBack(0,0),r.emplaceBack(e.ag,0),r.emplaceBack(0,e.ag),r.emplaceBack(e.ag,e.ag),this.tileExtentBuffer=i.createVertexBuffer(r,e.b6.members),this.tileExtentSegments=e.b7.simpleSegment(0,0,4,2);let a=new e.b4;a.emplaceBack(0,0),a.emplaceBack(e.ag,0),a.emplaceBack(0,e.ag),a.emplaceBack(e.ag,e.ag),this.debugBuffer=i.createVertexBuffer(a,e.b6.members),this.debugSegments=e.b7.simpleSegment(0,0,4,5);let n=new e.b4;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(n,e.b6.members),this.viewportSegments=e.b7.simpleSegment(0,0,4,2);let o=new e.aT;o.emplaceBack(0,0,0,0),o.emplaceBack(e.ag,0,e.ag,0),o.emplaceBack(0,e.ag,0,e.ag),o.emplaceBack(e.ag,e.ag,e.ag,e.ag),this.mercatorBoundsBuffer=i.createVertexBuffer(o,e.b9.members),this.mercatorBoundsSegments=e.b7.simpleSegment(0,0,4,2);let s=new e.aU;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(s);let l=new e.b5;for(let e of[0,1,3,2,0])l.emplaceBack(e);this.debugIndexBuffer=i.createIndexBuffer(l),this.emptyTexture=new e.T(i,new e.r({width:1,height:1},Uint8Array.of(0,0,0,0)),i.gl.RGBA8),this.identityMat=e.ab.mat4.create();let h=this.context.gl;this.stencilClearMode=new t1({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){let e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,t0.disabled,this.stencilClearMode,tQ.disabled,t2.disabled,rS(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,i,r){if(!i||this.currentStencilSource===i.id||!e.isTileClipped()||!r||0===r.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(let i of r)if(void 0===this._tileClippingMaskIDs[i.key]){e=!0;break}if(!e)return}this.currentStencilSource=i.id;let a=this.context,n=a.gl;this.nextStencilID+r.length>256&&this.clearStencil(),a.setColorMode(tQ.disabled),a.setDepthMode(t0.disabled);let o=this.getOrCreateProgram("clippingMask");for(let e of(this._tileClippingMaskIDs={},r)){let r=i.getTile(e),a=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:s,tileBoundsIndexBuffer:l,tileBoundsSegments:h}=this.getTileBoundsBuffers(r);o.draw(this,n.TRIANGLES,t0.disabled,new t1({func:n.ALWAYS,mask:0},a,255,n.KEEP,n.KEEP,n.REPLACE),tQ.disabled,t2.disabled,rS(e.projMatrix),"$clipping",s,l,h)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,i=this.context.gl;return new t1({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);let i=this.context.gl;return new t1({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(e){let i=this.context.gl,r=e.sort((e,i)=>
98i.overscaledZ-e.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let e={};for(let r=0;r<n;r++)e[r+a]=new t1({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[a]:t1.disabled},r]}colorModeForRenderPass(){let i=this.context.gl;if(this._showOverdrawInspector){let r=1/8;return new tQ([i.CONSTANT_COLOR,i.ONE,i.CONSTANT_COLOR,i.ONE],new e.aj(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?tQ.unblended:tQ.alphaBlended}colorModeForDrapableLayerRenderPass(i){let r=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&"translucent"===this.renderPass?new tQ([r.ONE,r.ONE_MINUS_SRC_ALPHA,r.CONSTANT_ALPHA,r.ONE_MINUS_SRC_ALPHA],new e.aj(0,0,0,void 0===i?0:i),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,i,r,a=!1){if(this.depthOcclusion)return new t0(this.context.gl.GREATER,t0.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!a)return t0.disabled;let n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new t0(r||this.context.gl.LEQUAL,i,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){let i=this.context.gl,r=Math.ceil(this.width),a=Math.ceil(this.height),n=this.context.bindFramebuffer.get(),o=i.getParameter(i.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===r&&this.depthFBO.height===a||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==r&&0!==a&&(this.depthFBO=new ae(this.context,r,a,!1,"texture"),this.depthTexture=new e.T(this.context,{width:r,height:a,data:null},i.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(n),i.bindTexture(i.TEXTURE_2D,o),this.depthFBO&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),i.blitFramebuffer(0,0,r,a,0,0,r,a,i.DEPTH_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(0===this._dt?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((e,i)=>e+i/this._fpsHistory.length,0))}render(i,r){let a=e.q.now();this._dt=a-this._timeStamp,this._timeStamp=a,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=i.map.repaint,this.style=i,this.options=r;let n=this.style._mergedLayers,o=this.style._getOrder(!(!this.terrain||!this.terrain.enabled)).filter(e=>{let i=n[e];return!(i.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[i.type]}),s=!1,l=!1;for(let e of o){let i=n[e];"circle"===i.type&&(s=!0),"symbol"===i.type&&(i.hasInitialOcclusionOpacityProperties?l=!0:s=!0)}let h=o.map(e=>n[e]),u=this.style._mergedSourceCaches;this.imageManager=i.imageManager,this.modelManager=i.modelManager,this.symbolFadeChange=i.placement.symbolFadeChange(e.q.now()),this.imageManager.beginFrame();let c=0,d=!1;for(let e in u){let i=u[e];i.used&&(i.prepare(this.context),i.getSource().usedInConflation&&++c)}let p=!1;for(let e of h)e.isHidden(this.transform.zoom)||("clip"===e.type&&(p=!0),this.prepareLayer(e));let f={},m={},_={},g={},y={};for(let e in u){let i=u[e];f[e]=i.getVisibleCoordinates(),m[e]=f[e].slice().reverse(),_[e]=i.getVisibleCoordinates(!0).reverse(),g[e]=i.getShadowCasterCoordinates(),y[e]=i.sortCoordinatesByDistance(f[e])}let x=e=>{let i=this.style.getLayerSourceCache(e);return i&&i.used?i.getSource():null};if(c||p||this._clippingActiveLastFrame){let i=[],r=[],a=0;for(let e of h)this.isSourceForClippingOrConflation(e,x(e))&&(i.push(e),r.push(a)),a++;if(i&&(p||i.length>1)||this._clippingActiveLastFrame){p=!1;let a=[];for(let n=0;n<i.length;n++){let o=i[n],s=r[n],l=this.style.getLayerSourceCache(o);if(!l||!l.used||!l.getSource().usedInConflation&&"clip"!==o.type)continue;let h=e.dx,u=e.by.None,c=[],d=!0;
98if("clip"===o.type){for(let i of(h=s,o.layout.get("clip-layer-types")))u|="model"===i?e.by.Model:"symbol"===i?e.by.Symbol:e.by.FillExtrusion;for(let e of o.layout.get("clip-layer-scope"))c.push(e);o.isHidden(this.transform.zoom)?d=!1:p=!0}d&&a.push({layer:o.fqid,cache:l,order:h,clipMask:u,clipScope:c})}this.replacementSource.setSources(a),d=!0}}this._clippingActiveLastFrame=p,d||this.replacementSource.clear(),this.conflationActive=d,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let e=0;e<h.length;e++){let i=h[e],r=i.cutoffRange();if(this.longestCutoffRange=Math.max(r,this.longestCutoffRange),r>0){let e=x(i);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),i.minzoom&&(this.minCutoffZoom=Math.max(i.minzoom,this.minCutoffZoom))}i.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}let v=this.style&&this.style.fog;v?(this._fogVisible=0!==v.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=v.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(_),this.opaquePassCutoff=0);let b=this._shadowRenderer;if(b)for(let e in b.updateShadowParameters(this.transform,this.style.directionalLight),u)for(let i of f[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(i)||e),b.addShadowReceiver(i.toUnwrapped(),e.min,e.max)}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.dw(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new aL(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let w=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),T=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(w&&!this._snow&&(this._snow=new a2(this)),!w&&this._snow&&(this._snow.destroy(),delete this._snow),T&&!this._rain&&(this._rain=new a0(this)),!T&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),!j.has(this.context.gl))return;for(let e of(this.renderPass="offscreen",h)){let r=i.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;let a=r?m[r.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||a&&a.length)&&this.renderLayer(this,r,e,a)}this.depthRangeFor3D=[0,1-(h.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,g)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);let S="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),M=(()=>{if(r.showOverdrawInspector)return e.aj.black;let i=this.style.fog;if(i&&this.transform.projection.supportsFog){let r=this.style.getLut(i.scope);if(!S){let a="none"===i.properties.get("color-use-theme"),n=i.properties.get("color").toRenderColor(a?null:r).toArray01();return new e.aj(...n)}if(S){let a="none"===i.properties.get("space-color-use-theme"),n=i.properties.get("space-color").toRenderColor(a?null:r).toArray01();return new e.aj(...n)}}return e.aj.transparent})();if(this.context.clear({color:M,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&S&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){let e=h[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())continue;let a=r?(e.is3D()?y:m)[r.id]:void 0;this._renderTileClippingMasks(e,r,a),this.renderLayer(this,r,e,a)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&S&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.ae(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isH
98orizonVisible()))for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){let e=h[this.currentLayer],r=i.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,r,e,r?m[r.id]:void 0)}function E(e,i){let r;return i&&(r=("symbol"===e.type?_:e.is3D()?y:m)[i.id]),r}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<o.length;){let e=h[this.currentLayer];if("raster"===e.type||"raster-particle"===e.type){let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,E(e,r))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let A=0;b&&(A=b.getShadowCastingLayerCount());let I=!1,C=-1;for(let e=0;e<o.length;++e){let i=h[e];i.isHidden(this.transform.zoom)||i.is3D()&&(C=e)}for(l&&-1===C&&(s=!0);this.currentLayer<o.length;){let e=h[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(e)){if(e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(s&&!I&&this.terrain&&!this.transform.isOrthographic&&(I=!0,this.blitDepth()),l&&-1!==C&&this.currentLayer===C+1&&!this.transform.isOrthographic&&this.blitDepth(),e.is3D()||this.terrain||this._renderTileClippingMasks(e,r,r?f[r.id]:void 0),this.renderLayer(this,r,e,E(e,r)),!this.terrain&&b&&A>0&&e.hasShadowPass()&&0==--A&&(b.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){let e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){let e=h[this.currentLayer];if(!e.hasLightBeamPass())continue;let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,r?m[r.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){let e=this.currentLayer;for(let e of(this.depthOcclusion=!0,this.layersWithOcclusionOpacity)){this.currentLayer=e;let r=h[this.currentLayer],a=i.getLayerSourceCache(r),n=a?m[a.id]:void 0;r.is3D()||this.terrain||this._renderTileClippingMasks(r,a,a?f[a.id]:void 0),this.renderLayer(this,a,r,n)}this.depthOcclusion=!1,this.currentLayer=e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let r=null;h.forEach(e=>{let a=i.getLayerSourceCache(e);a&&!e.isHidden(this.transform.zoom)&&a.getVisibleCoordinates().length&&(!r||r.getSource().maxzoom<a.getSource().maxzoom)&&(r=a)}),r&&this.options.showTileBoundaries&&a3.debug(this,r,r.getVisibleCoordinates(),e.aj.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&a3.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.aj(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(e){var i,r;let a=e.transform.padding;aT(e,e.transform.height-(a.top||0),3,ag),aT(e,a.bottom||0,3,ay),aS(e,a.left||0,3,ax),aS(e,e.transform.width-(a.right||0),3,av);let n=e.transform.centerPoint;i=n.x,r=e.transform.height-n.y,aM(e,i-1,r-10,2,20,ab),aM(e,i-10,r-1,20,2,ab)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
98anvasCopy()),d||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);let{unsupportedLayers:i}=this.transform.projection,r=!i||!i.includes(e.type);if(a4[e.type]&&(r||this.terrain&&"custom"===e.type)){let i=this.style.getLayerSourceCache(e);a4[e.type](e,i,this)}this.gpuTimingEnd()}renderLayer(e,i,r,a){r.isHidden(this.transform.zoom)||("background"===r.type||"sky"===r.type||"custom"===r.type||"model"===r.type||"raster"===r.type||"raster-particle"===r.type||a&&a.length)&&(this.id=r.id,this.gpuTimingStart(r),e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes(r.type)&&(!e.terrain||"custom"!==r.type)||"clip"===r.type||a3[r.type](e,i,r,a,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;let i=this.context.extTimerQuery,r=this.context.gl,a=this.gpuTimers[e.id];a||(a=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:r.createQuery()}),a.calls++,r.beginQuery(i.TIME_ELAPSED_EXT,a.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let e=this.context.extTimerQuery,i=this.context.gl,r=i.createQuery();this.deferredRenderGpuTimeQueries.push(r),i.beginQuery(e.TIME_ELAPSED_EXT,r)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){let e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){let e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){let i={};for(let r in e){let a=e[r],n=this.context.extTimerQuery,o=n.getQueryParameter(a.query,this.context.gl.QUERY_RESULT)/1e6;n.deleteQueryEXT(a.query),i[r]=o}return i}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;let i=this.context.gl,r=0;for(let a of e)r+=i.getQueryParameter(a,i.QUERY_RESULT)/1e6,i.deleteQuery(a);return r}translatePosMatrix(i,r,a,n,o){if(!a[0]&&!a[1])return i;let s=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(s){let e=Math.sin(s),i=Math.cos(s);a=[a[0]*i-a[1]*e,a[0]*e+a[1]*i]}let l=[o?a[0]:e.ar(r,a[0],this.transform.zoom),o?a[1]:e.ar(r,a[1],this.transform.zoom),0],h=new Float32Array(16);return e.ab.mat4.translate(h,i,l),h}saveTileTexture(e){let i=e.size[0],r=this._tileTextures[i];r?r.push(e):this._tileTextures[i]=[e]}getTileTexture(e){let i=this._tileTextures[e];return i&&i.length>0?i.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,i,r){let a=void 0===r?this.terrain&&this.terrain.renderingToTexture:r,n=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(n.push("LIGHTING_3D_MODE"),n.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):a||n.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass&&(this._shadowMapDebug||n.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(n.push("TERRAIN"),this.linearFloatFilteringSupported()&&n.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&n.push("GLOBE"),this._fogVisible&&!a&&(void 0===i||i)&&n.push("FOG","FOG_DITHERING"),a&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}getOrCreateProgram(e,i){this.cache=this.cache||{};let r=i&&i.defines||[],a=i&&i.config,n=this.currentGlobalDefines(e,i&&i.overrideFog,i&&i.overrideRtt).concat(r),o=rD.cacheKey(iV[e],e,n,a);return this.cache[o]||(this.cache[o]=new rD(this.context,e,iV[e],a,r6[e],n)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
98stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(i,r){if(this.style.enable3dLights()){let a=this.style.directionalLight,n=this.style.ambientLight;if(a&&n){let o=((i,r,a)=>{let n=i.properties.get("direction"),o="none"===i.properties.get("color-use-theme"),s=i.properties.get("color").toRenderColor(o?null:a.getLut(i.scope)).toArray01(),l=i.properties.get("intensity"),h="none"===r.properties.get("color-use-theme"),u=r.properties.get("color").toRenderColor(h?null:a.getLut(r.scope)).toArray01(),c=r.properties.get("intensity"),d=[n.x,n.y,n.z],p=e.cM(u,c),f=e.cM(s,l);return{u_lighting_ambient_color:p,u_lighting_directional_dir:d,u_lighting_directional_color:f,u_ground_radiance:function(i,r,a){let n=function(i,r,a){let n,o,s;let l=e.ab.vec3.dot(r,i),h=(n=1-.3*Math.min(e.ab.vec3.dot(a,[.2126,.7152,.0722]),1),(1-(o=Math.min(l+1,1)))*n+1*o);return((1-(s=Math.asin(e.aw(r[2],-1,1))/Math.PI+.5))*.92+1*s)*h}(i,[0,0,1],r),o=[0,0,0];e.ab.vec3.scale(o,a.slice(0,3),n);let s=[0,0,0];e.ab.vec3.scale(s,r.slice(0,3),i[2]);let l=[0,0,0];return e.ab.vec3.add(l,o,s),e.cf(l)}(d,f,p)}})(a,n,this.style);r.setLightsUniformValues(i,o)}}}uploadCommonUniforms(i,r,a,n,o){if(this.uploadCommonLightUniforms(i,r),this.terrain&&this.terrain.renderingToTexture)return;let s=this.style.fog;if(s){let o=s.getOpacity(this.transform.pitch),l=((i,r,a,n,o,s,l,h,u,c,d,p)=>{let f=i.transform,m="none"===r.properties.get("color-use-theme"),_=r.properties.get("color").toRenderColor(m?null:i.style.getLut(r.scope)).toArray01();_[3]=n;let g=i.frameCounter/1e3%1,[y,x]=r.properties.get("vertical-range");return{u_fog_matrix:a?f.calculateFogTileMatrix(a):p||i.identityMat,u_fog_range:r.getFovAdjustedRange(f._fov),u_fog_color:_,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(y,x),x],u_fog_temporal_offset:g,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:l,u_frustum_bl:h,u_globe_pos:u,u_globe_radius:c,u_viewport:d,u_globe_transition:e.ae(f.zoom),u_is_globe:+("globe"===f.projection.name)}})(this,s,a,o,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.q.devicePixelRatio,this.transform.height*e.q.devicePixelRatio],n);r.setFogUniformValues(i,l)}o&&r.setCutoffUniformValues(i,o.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){let e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){let e=this.context.gl,i=e.createTexture();return e.bindTexture(e.TEXTURE_2D,i),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),i}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){let e=this._backgroundTiles,i=this._backgroundTiles={};for(let r of this.transform.coveringTiles({tileSize:512}))i[r.key]=e[r.key]||new e8(r,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,i){return!(!e.is3D()||"clip"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer)&&(!i||"batched-model"!==i.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let i=this._cachedTileFogOpacities[e.key];return i||(this._cachedTileFogOpacities[e.key]=i=this.style.fog.getOpacityForTile(e)),i[0]>=.05||i[1]>=.05}setupDepthForOcclusion(e,i,r){var a;let n=this.context,o=n.gl,s=!!r;r||(r={u_dem:2,u_dem_prev:4,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_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-.0001,u_exaggeration:0}),n.activeTexture.set(o.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),r.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],r.u_depth_range_unpack=[2/((a=this.depthRangeFor3D)[1]-a[0]),-1-2*a[0]/(a[1]-a[0])],r.u_occluder_half_size=.5*this.occlusionParams.occluderSize,r.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
98DepthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE0),s||i.setTerrainUniformValues(n,r)}}function a6(e,i){let r=!1,a=null,n=()=>{a=null,r&&(e(),a=setTimeout(n,i),r=!1)};return()=>(r=!0,a||n(),a)}class a8{constructor(i){this._hashName=i&&encodeURIComponent(i),e.aP(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=a6(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map&&(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0),this}getHashString(){let e=this._map;if(!e)return"";let i=a9(e);if(this._hashName){let e=this._hashName,r=!1,a=location.hash.slice(1).split("&").map(a=>{let n=a.split("=")[0];return n===e?(r=!0,`${n}=${i}`):a}).filter(e=>e);return r||a.push(`${e}=${i}`),`#${a.join("&")}`}return`#${i}`}_getCurrentHash(){let e=location.hash.replace("#","");if(this._hashName){let i;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(i=e)}),(i&&i[1]||"").split("/")}return e.split("/")}_onHashChange(){let e=this._map;if(!e)return!1;let i=this._getCurrentHash();if(i.length>=3&&!i.some(e=>isNaN(e))){let r=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(i[3]||0):e.getBearing();return e.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function a9(e,i){let r=e.getCenter(),a=Math.round(100*e.getZoom())/100,n=Math.pow(10,Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10)),o=Math.round(r.lng*n)/n,s=Math.round(r.lat*n)/n,l=e.getBearing(),h=e.getPitch(),u=i?`/${o}/${s}/${a}`:`${a}/${s}/${o}`;return(l||h)&&(u+="/"+Math.round(10*l)/10),h&&(u+=`/${Math.round(h)}`),u}let a7={linearity:.3,easing:e.dy(0,0,.3,1)},ne=e.l({deceleration:2500,maxSpeed:1400},a7),nt=e.l({deceleration:20,maxSpeed:1400},a7),ni=e.l({deceleration:1e3,maxSpeed:360},a7),nr=e.l({deceleration:1e3,maxSpeed:90},a7);class na{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.q.now(),settings:i})}_drainInertiaBuffer(){let i=this._inertiaBuffer,r=e.q.now();for(;i.length>0&&r-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;let r={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)r.zoom+=e.zoomDelta||0,r.bearing+=e.bearingDelta||0,r.pitch+=e.pitchDelta||0,e.panDelta&&r.pan._add(e.panDelta),e.around&&(r.around=e.around),e.pinchAround&&(r.pinchAround=e.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){let o=no(r.pan.mag(),a,e.l({},ne,i||{}));n.offset=r.pan.mult(o.amount/r.pan.mag()),n.center=this._map.transform.center,nn(n,o)}if(r.zoom){let e=no(r.zoom,a,nt);n.zoom=this._map.transform.zoom+e.amount,nn(n,e)}if(r.bearing){let i=no(r.bearing,a,ni);n.bearing=this._map.transform.bearing+e.aw(i.amount,-179,179),nn(n,i)}if(r.pitch){let e=no(r.pitch,a,nr);n.pitch=this._map.transform.pitch+e.amount,nn(n,e)}if(n.zoom||n.bearing){let e=void 0===r.pinchAround?r.around:r.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function nn(e,i){(!e.duration||e.duration<i.duration)&&(e.duration=i.duration,e.easing=i.easing)}function no(i,r,a){let{maxSpeed:n,linearity:o,deceleration:s}=a,l=e.aw(i*o/(r/1e3),-n,n),h=Math.abs(l)/(s*o);return{easing:a.easing,duration:1e3*h,amount:h/2*l}}class ns extends e.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){let o=v(r.getCanvasContainer(),a);super(i,e.l({point:o,lngLat:r.unproject(o),originalEvent:a},n)),this._defaultPrevented=!1,this.target=r}}class nl extends e.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a){let n="touchend"===i?a.changedTouches:a.touches,o=b(r.getCanvasContainer(),n),s=o.map(e=>r.unproject(e)),l=o.reduce((e,i,r,a)=>e.add(i.div(a.length)),new e.P(0,0));super(i,{points:o,point:l,lngLats:s,lngLat:r.unproject(l),originalEvent:a}),this._defaultPrevented=!1}}class nh extends e.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i){super("wheel",{originalEvent:i}),this._defaultPrevented=!1}}class nu{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new nh(this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new ns(e.type,this._map,e))}mouseup(e){this._map.fire(new ns(e.type,this._map,e))}preclick(i){let r=e.l({},i);r.type="preclick",this._map.fire(new ns(r.type,this._map,r))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||(this.preclick(e),this._map.fire(new ns(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new ns(e.type,this._map,e))}mouseover(e){this._map.fire(new ns(e.type,this._map,e))}mouseout(e){this._map.fire(new ns(e.type,this._map,e))}touchstart(e){return this._firePreventable(new nl(e.type,this._map,e))}touchmove(e){this._map.fire(new nl(e.type,this._map,e))}touchend(e){this._map.fire(new nl(e.type,this._map,e))}touchcancel(e){this._map.fire(new nl(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nc{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new ns(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ns("c
98ontextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new ns(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nd{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&0===e.button&&(_(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;let r=this._startPos,a=this._lastPos;if(!r||!a||a.equals(i)||!this._box&&i.dist(r)<this._clickTolerance)return;this._lastPos=i,this._box||(this._box=d("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(r.x,i.x),o=Math.max(r.x,i.x),s=Math.min(r.y,i.y),l=Math.max(r.y,i.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${n}px,${s}px)`,this._box.style.width=o-n+"px",this._box.style.height=l-s+"px")})}mouseupWindow(i,r){if(!this._active)return;let a=this._startPos;if(a&&0===i.button){if(this.reset(),x(),a.x!==r.x||a.y!==r.y)return this._map.fire(new e.z("boxzoomend",{originalEvent:i})),{cameraAnimation:e=>e.fitScreenCoordinates(a,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",i)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),g(),delete this._startPos,delete this._lastPos}_fireEvent(i,r){return this._map.fire(new e.z(i,{originalEvent:r}))}}function np(e,i){let r={};for(let a=0;a<e.length;a++)r[e[a].identifier]=i[a];return r}class nf{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(i,r,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=i.timeStamp),a.length===this.numTouches&&(this.centroid=function(i){let r=new e.P(0,0);for(let e of i)r._add(e);return r.div(i.length)}(r),this.touches=np(a,r)))}touchmove(e,i,r){if(this.aborted||!this.centroid)return;let a=np(r,i);for(let e in this.touches){let i=a[e];(!i||i.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,i,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class nm{constructor(e){this.singleTap=new nf(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,i,r){this.singleTap.touchstart(e,i,r)}touchmove(e,i,r){this.singleTap.touchmove(e,i,r)}touchend(e,i,r){let a=this.singleTap.touchend(e,i,r);if(a){let i=e.timeStamp-this.lastTime<500,r=!this.lastTap||30>this.lastTap.dist(a);if(i&&r||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class n_{constructor(){this._zoomIn=new nm({numTouches:1,numTaps:2}),this._zoomOut=new nm({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,r){this._zoomIn.touchstart(e,i,r),this._zoomOut.touchstart(e,i,r)}touchmove(e,i,r){this._zoomIn.touchmove(e,i,r),this._zoomOut.touchmove(e,i,r)}touchend(e,i,r){let a=this._zoomIn.touchend(e,i,r),n=this._zoomOut.touchend(e,i,r);return a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:i.getZoom()+1,around:i.unproject(a)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:i.getZoom()-1,around:i.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let ng={0:1,2:2};class ny{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,i){return!1}_move(e,i){return{}}mousedown(e,i){if(this._lastPoint)return;let r=w(e);this._correctButton(e,r)&&(this._lastPoint=i,this._eventButton=r)}mousemoveWindow(e,i){let r=this._lastPoint;if(r){if(e.preventDefault(),null!=this._eventButton&&function(e,i){let r=ng[i];return void 0===e.buttons||(e.buttons&r)!==r}(e,this._eventButton))this.reset();else if(this._moved||!(i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}}mouseupWindow(e){this._lastPoint&&w(e)===this._eventButton&&(this._moved&&x(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nx extends ny{mousedown(e,i){super.mousedown(e,i),this._lastPoint&&(this._active=!0)}_correctButton(e,i){return 0===i&&!e.ctrlKey}_move(e,i){return{around:i,panDelta:i.sub(e)}}}class nv extends ny{_correctButton(e,i){return 0===i&&e.ctrlKey||2===i}_move(e,i){let r=.8*(i.x-e.x);if(r)return this._active=!0,{bearingDelta:r}}contextmenu(e){e.preventDefault()}}class nb extends ny{_correctButton(e,i){return 0===i&&e.ctrlKey||2===i}_move(e,i){let r=-.5*(i.y-e.y);if(r)return this._active=!0,{pitchDelta:r}}contextmenu(e){e.preventDefault()}}class nw{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),e.aP(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}touchstart(e,i,r){return this._calculateTransform(e,i,r)}touchmove(i,r,a){if(this._active&&!(a.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===a.length&&!e.dz())return void this._showTouchPanBlockerAlert();
98"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return i.cancelable&&i.preventDefault(),this._calculateTransform(i,r,a)}}touchend(e,i,r){this._calculateTransform(e,i,r),this._active&&r.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,r,a){a.length>0&&(this._active=!0);let n=np(a,r),o=new e.P(0,0),s=new e.P(0,0),l=0;for(let e in n){let i=n[e],r=this._touches[e];r&&(o._add(i),s._add(i.sub(r)),l++,n[e]=i)}if(this._touches=n,l<this._minTouches||!s.mag())return;let h=s.div(l);return this._sum._add(h),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(l),panDelta:h}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=d("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class nT{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,i,r){return{}}touchstart(e,i,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,r){let a=this._firstTwoTouches;if(!a)return;e.preventDefault();let[n,o]=a,s=nS(r,i,n),l=nS(r,i,o);if(!s||!l)return;let h=this._aroundCenter?null:s.add(l).div(2);return this._move([s,l],h,e)}touchend(e,i,r){if(!this._firstTwoTouches)return;let[a,n]=this._firstTwoTouches,o=nS(r,i,a),s=nS(r,i,n);o&&s||(this._active&&x(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function nS(e,i,r){for(let a=0;a<e.length;a++)if(e[a].identifier===r)return i[a]}function nM(e,i){return Math.log(e/i)/Math.LN2}class nE extends nT{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){let r=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(.1>Math.abs(nM(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:nM(this._distance,r),pinchAround:i}}}function nA(e,i){return 180*e.angleWith(i)/Math.PI}class nI extends nT{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),r&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:nA(this._vector,r),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let i=25/(Math.PI*this._minDiameter)*360,r=this._startVector;return!!r&&Math.abs(nA(e,r))<i}}function nC(e){return Math.abs(e.y)>Math.abs(e.x)}class nP extends nT{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,nC(e[0].sub(e[1]))&&(this._valid=!1)}_move(i,r,a){let n=this._lastPoints;if(!n)return;let o=i[0].sub(n[0]),s=i[1].sub(n[1]);return this._map._cooperativeGestures&&!e.dz()&&a.touches.length<3||(this._val
98id=this.gestureBeginsVertically(o,s,a.timeStamp),!this._valid)?void 0:(this._lastPoints=i,this._active=!0,{pitchDelta:-((o.y+s.y)/2*.5)})}gestureBeginsVertically(e,i,r){if(void 0!==this._valid)return this._valid;let a=e.mag()>=2,n=i.mag()>=2;if(!a&&!n)return;if(!a||!n)return null==this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let o=e.y>0==i.y>0;return nC(e)&&nC(i)&&o}}class nz{constructor(){this._panStep=100,this._bearingStep=15,this._pitchStep=10,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,r=0,a=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?a=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?a=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,a=0),{cameraAnimation:s=>{let l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:nD,zoom:i?Math.round(l)+i*(e.shiftKey?2:1):l,bearing:s.getBearing()+r*this._bearingStep,pitch:s.getPitch()+a*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}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 nD(e){return e*(2-e)}let nR=1/450;class nL{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._handler=r,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=nR,e.aP(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(i.ctrlKey||i.metaKey||this.isZooming()||e.dz()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let r=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY,a=e.q.now(),n=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&4>Math.abs(r)?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=window.setTimeout(this._onTimeout,40,i)):this._type||(this._type=200>Math.abs(n*r)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),i.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=i,this._delta-=r,this._active||this._start(i)),i.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){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);let i=v(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:i,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let i=this._map.transform;"wheel"===this._type&&i.projection.wrap&&(i._center.lng>=180||i._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);let r=()=>i._terrainEnabled()&&this._aroundCoord?i.computeZoomRelativeTo(this._aroundCoord):i.zoom;if(0!==this._delta){let e="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==a&&(a=1/a);let n=r(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(s*a))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}let a="number"==typeof this._targetZoom?this._targetZoom:r(),n=this._startZoom,o=this._easing,s,l=!1;if("wheel"===this._type&&n&&o){let i=Math.min((e.q.now()-this._lastWheelEventTime)/200,1),r=o(i);s=e.af(n,a,r),i<1?this._frameId||(this._frameId=!0):l=!0}else s=a,l=!0;this._active=!0,l&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>
98{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let h=s-r();return h*this._lastDelta<0&&(h=0),{noInertia:!0,needsRenderFrame:!l,zoomDelta:h,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let r=e.dA;if(this._prevEase){let i=this._prevEase,a=(e.q.now()-i.start)/i.duration,n=i.easing(a+.01)-i.easing(a),o=.27/Math.sqrt(n*n+1e-4)*.01;r=e.dy(o,Math.sqrt(.0729-o*o),.25,1)}return this._prevEase={start:e.q.now(),duration:i,easing:r},r}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=d("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class nO{constructor(e,i){this._clickZoom=e,this._tapZoom=i}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 nk{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,i){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:r.getZoom()+(e.shiftKey?-1:1),around:r.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nF{constructor(){this._tap=new nm({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,i,r){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=i[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(e,i,r))}touchmove(e,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let a=i[0],n=a.y-this._swipePoint.y;return this._swipePoint=a,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,i,r)}touchend(e,i,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(e,i,r)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nB{constructor(e,i,r){this._el=e,this._mousePan=i,this._touchPan=r}enable(e){this._inertiaOptions=e||{},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 nN{constructor(e,i,r){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}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 nV{constructor(e,i,r,a){this._el=e,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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()}}let nU=e=>e.zoom||e.drag||e.pitch||e.rotate;class nj extends e.z{}class nG{constructor(){this.constants=[1,1,.01],this.radius=0}setup(i,r){let a=e.ab.vec3.sub([],r,i);this.radius=e.ab.vec3.length(a[2]<0?e.ab.vec3.div([],a,this.constants):[a[0],a[1],0])}projectRay(i){e.ab.vec3.div(i,i,this.constants),e.ab.vec3.normalize(i,i),e.ab.vec3.mul(i,i,this.constants);let r=e.ab.vec3.scale([],i,this.radius);if(r[2]>0){let i=e.ab.vec3.scale([],[0,0,1],e.ab.vec3.dot(r,[0,0,1])),a=e.ab.vec3.scale([],e.ab.vec3.normalize([],[r[0],r[1],0]),this.radius),n=e.ab.vec3.add([],r,e.ab.vec3.scale([],e.ab.vec3.sub([],e.ab.vec3.add([],a,i),r),2));r[0]=n[0],r[1]=n[1]}return r}}function nq(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class nZ{constructor(i,r){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new na(i),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new nG,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),e.aP(["handleEvent","handleWindowEvent"],this);let a=this._el;for(let[e,i,r]of(this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]],this._listeners)){let a=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(i,a,r)}}destroy(){for(let[e,i,r]of this._listeners){let a=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(i,a,r)}}_addDefaultHandlers(e){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new nu(i,e));let a=i.boxZoom=new nd(i,e);this._add("boxZoom",a);let n=new n_,o=new nk;i.doubleClickZoom=new nO(o,n),this._add("tapZoom",n),this._add("clickZoom",o);let s=new nF;this._add("tapDragZoom",s);let l=i.touchPitch=new nP(i);this._add("touchPitch",l);let h=new nv(e),u=new nb(e);i.dragRotate=new nN(e,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);let c=new nx(e),d=new nw(i,e);i.dragPan=new nB(r,c,d),this._add("mousePan",c),this._add("touchPan",d,["touchZoom","touchRotate"]);let p=new nI,f=new nE;i.touchZoomRotate=new nV(r,f,p,s),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),this._add("blockableMapEvent",new nc(i));let m=i.scrollZoom=new nL(i,this);this._add("scrollZoom",m,["mousePan"]);let _=i.keyboard=new nz;for(let r of(this._add("keyboard",_),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))e.interactive&&e[r]&&i[r].enable(e[r])}_add(e,i,r){this._handlers.push({handlerName:e,handler:i,allowed:r}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!nU(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,i,r){for(let a in e)if(a!==r&&(!i||0>i.indexOf(a)))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let i=[];for(let r of e)this._el.contains(r.target)&&i.push(r);return i}handleEvent(e,i){this._updatingCamera=!0;let r="renderFrame"===e.type,a=r?void 0:e,n={needsRenderFrame:!1},o={},s={},l=e.touches?this._getMapTouches(e.touches):void 0,h=l?b(this._el,l):r?void 0:v(this._el,e);for(let{handlerName:r,handler:u,allowed:c}of this._handlers){let d;u.isEnabled()&&(this._blockedByActive(s,c,r)?u.reset():u[i||e.type]&&(d=u[i||e.type](e,h,l),this.mergeHandlerResult(n,o,d,r,a),d&&d.needsRenderFrame&&this._triggerRe
98nderFrame()),(d||u.isActive())&&(s[r]=u))}let u={};for(let e in this._previousActiveHandlers)s[e]||(u[e]=a);this._previousActiveHandlers=s,(Object.keys(u).length||nq(n))&&(this._changes.push([n,o,u]),this._triggerRenderFrame()),(Object.keys(s).length||nq(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))}mergeHandlerResult(i,r,a,n,o){if(!a)return;e.l(i,a);let s={handlerName:n,originalEvent:a.originalEvent||o};void 0!==a.zoomDelta&&(r.zoom=s),void 0!==a.panDelta&&(r.drag=s),void 0!==a.pitchDelta&&(r.pitch=s),void 0!==a.bearingDelta&&(r.rotate=s)}_applyChanges(){let i={},r={},a={};for(let[n,o,s]of this._changes)n.panDelta&&(i.panDelta=(i.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(i.around=n.around),void 0!==n.aroundCoord&&(i.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(i.pinchAround=n.pinchAround),n.noInertia&&(i.noInertia=n.noInertia),e.l(r,o),e.l(a,s);this._updateMapTransform(i,r,a),this._changes=[]}_updateMapTransform(i,r,a){let n;let o=this._map,s=o.transform,l=e=>[e.x,e.y,e.z];if((e=>{let i=this._eventsInProgress.drag;return i&&!this._handlersById[i.handlerName].isActive()})()&&!nq(i)){let e=s.zoom;s.cameraElevationReference="sea",null!=this._originalZoom&&s._orthographicProjectionAtLowPitch&&"globe"!==s.projection.name&&0===s.pitch?(s.cameraElevationReference="ground",s.zoom=this._originalZoom):(s.recenterOnTerrain(),s.cameraElevationReference="ground"),e!==s.zoom&&this._map._update(!0)}if(s._isCameraConstrained&&o._stop(!0),!nq(i))return void this._fireEvents(r,a,!0);let{panDelta:h,zoomDelta:u,bearingDelta:c,pitchDelta:d,around:p,aroundCoord:f,pinchAround:m}=i;s._isCameraConstrained&&(u>0&&(u=0),s._isCameraConstrained=!1),void 0!==m&&(p=m),(u||r[n="drag"]&&!this._eventsInProgress[n])&&p&&(this._dragOrigin=l(s.pointCoordinate3D(p)),this._originalZoom=s.zoom,this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",o._stop(!0),p=p||o.transform.centerPoint,c&&(s.bearing+=c),d&&(s.pitch+=d),s._updateCameraState();let _=[0,0,0];if(h){if("mercator"===s.projection.name){let e=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p).dir),i=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p.sub(h)).dir);_[0]=i[0]-e[0],_[1]=i[1]-e[1]}else{let i=s.pointCoordinate(p);if("globe"===s.projection.name){h=h.rotate(-s.angle);let r=s._pixelsPerMercatorPixel/s.worldSize;_[0]=-h.x*e.dB(e.aS(i.y))*r,_[1]=-h.y*e.dB(s.center.lat)*r}else{let e=s.pointCoordinate(p.sub(h));i&&e&&(_[0]=e.x-i.x,_[1]=e.y-i.y)}}}let g=s.zoom,y=[0,0,0];if(u){let i=l(f||s.pointCoordinate3D(p)),r={dir:e.ab.vec3.normalize([],e.ab.vec3.sub([],i,s._camera.position))};if(r.dir[2]<0){let a=s.zoomDeltaToMovement(i,u);e.ab.vec3.scale(y,r.dir,a)}}let x=e.ab.vec3.add(_,_,y);s._translateCameraConstrained(x),u&&Math.abs(s.zoom-g)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(r,a,!0)}_fireEvents(i,r,a){let n;let o=nU(this._eventsInProgress),s=nU(i),l={};for(let e in i){let{originalEvent:r}=i[e];this._eventsInProgress[e]||(l[`${e}start`]=r),this._eventsInProgress[e]=i[e]}for(let e in!o&&s&&this._fireEvent("movestart",s.originalEvent),l)this._fireEvent(e,l[e]);for(let e in s&&this._fireEvent("move",s.originalEvent),i){let{originalEvent:r}=i[e];this._fireEvent(e,r)}let h={};for(let e in this._eventsInProgress){let{handlerName:i,originalEvent:a}=this._eventsInProgress[e];this._handlersById[i].isActive()||(delete this._eventsInProgress[e],n=r[i]||a,h[`${e}end`]=n)}for(let e in h)this._fireEvent(e,h[e]);let u=nU(this._eventsInProgress);if(a&&(o||s)&&!u){let i,r;this._updatingCamera=!0;let a=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);a?(0!==(i=a.bearing||this._map.getBearing())&&-this._bearingSnap<i&&i<this._bearingSnap&&(a.bearing=0),this._map.easeTo(a,{originalEvent:n})):(this._map.fire(new e.z("moveend",{originalEvent:n})),0!==(r=this._map.getBearing())&&-this._bearingSnap<r&&r<this._bearingSnap&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,r){this._map.fire(new e.z(i,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{this._frameId=void 0,this.handleEvent(new nj("renderFrame",{timeStamp:e})),this._applyChanges()})}
98_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let nH="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class n$ extends e.E{constructor(i,r){super(),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=r.bearingSnap,this._respectPrefersReducedMotion=!1!==r.respectPrefersReducedMotion,e.aP(["_renderFrameCallback"],this)}getCenter(){return new e.bO(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}panBy(i,r,a){return i=e.P.convert(i).mult(-1),this.panTo(this.transform.center,e.l({offset:i},r),a)}panTo(i,r,a){return this.easeTo(e.l({center:i},r),a)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(i,r,a){return this.easeTo(e.l({zoom:i},r),a)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(i,r,a){return this.easeTo(e.l({bearing:i},r),a)}resetNorth(i,r){return this.rotateTo(0,e.l({duration:1e3},i),r),this}resetNorthPitch(i,r){return this.easeTo(e.l({bearing:0,pitch:0,duration:1e3},i),r),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}cameraForBounds(i,r){i=e.az.convert(i);let a=r&&r.bearing||0,n=r&&r.pitch||0,o=i.getNorthWest(),s=i.getSouthEast();return this._cameraForBounds(this.transform,o,s,a,n,r)}_extendPadding(i){let r={top:0,right:0,bottom:0,left:0};return null==i?e.l({},r,this.transform.padding):"number"==typeof i?{top:i,bottom:i,right:i,left:i}:e.l({},r,i)}_extendCameraOptions(i){return(i=e.l({offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding=this._extendPadding(i.padding),i}_minimumAABBFrustumDistance(e,i){let r=i.max[0]-i.min[0],a=i.max[1]-i.min[1];return r/a>e.aspect?r/(2*Math.tan(.5*e.fovX)*e.aspect):a/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(i,r,a,n,o,s){let l=i.clone(),h=this._extendCameraOptions(s);l.bearing=n,l.pitch=o;let u=e.bO.convert(r),c=e.bO.convert(a),d=.5*(u.lat+c.lat),p=.5*(u.lng+c.lng),f=e.dC(d,p),m=e.ab.vec3.normalize([],f),_=e.ab.vec3.normalize([],e.ab.vec3.cross([],m,[0,1,0])),g=e.ab.vec3.cross([],_,m),y=[_[0],_[1],_[2],0,g[0],g[1],g[2],0,m[0],m[1],m[2],0,0,0,0,1],x=[f,e.dC(u.lat,u.lng),e.dC(c.lat,u.lng),e.dC(c.lat,c.lng),e.dC(u.lat,c.lng),e.dC(d,u.lng),e.dC(d,c.lng),e.dC(u.lat,p),e.dC(c.lat,p)],v=e.cd.fromPoints(x.map(i=>[e.ab.vec3.dot(_,i),e.ab.vec3.dot(g,i),e.ab.vec3.dot(m,i)])),b=e.ab.vec3.transformMat4([],v.center,y);0===e.ab.vec3.squaredLength(b)&&e.ab.vec3.set(b,0,0,1),e.ab.vec3.normalize(b,b),e.ab.vec3.scale(b,b,e.ax),l.center=e.dD(b);let w=l.getWorldToCameraMatrix(),T=e.ab.mat4.invert(new Float64Array(16),w);v=e.cd.applyTransform(v,e.ab.mat4.multiply([],w,y));let S=this._extendAABB(v,l,h,n);if(!S)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=S,e.ab.vec3.transformMat4(b,b,w);let M=.5*(v.max[2]-v.min[2]),E=this._minimumAABBFrustumDistance(l,v),A=e.ab.vec3.scale([],[0,0,1],M),I=e.ab.vec3.add(A,b,A),C=E+(0===l.pitch?0:e.ab.vec3.distance(b,I)),P=l.globeCenterInViewSpace,z=e.ab.vec3.sub([],b,[P[0],P[1],P[2]]);e.ab.vec3.normalize(z,z),e.ab.vec3.scale(z,z,C);let D=e.ab.vec3.add([],b,z);e.ab.vec3.transformMat4(D,D,T);let R=e.ds/e.ax,L=e.ab.vec3.length(D),O=e.bH(Math.max(L*R-e.ds,Number.EPSILON),0),k=Math.min(l.zoomFromMercatorZAdjusted(O),h.maxZoom);return k>.5*(e.c6+e.bY)?(l.setProjection({name:"mercator"}),l.zoom=k,this._cameraForBounds(l,r,a,n,o,s)):{center:l.center,zoom:k,bearing:n,pitch:o}}_extendAABB(i,r,a,n){let o=.5*((a.padding.left||0)+(a.padding.right||0)),s=.5*((a.padding.top||0)+(a.padding.bottom||0)),l=r.width-(o+o),h=r.height-(s+s),u=e.ab.vec3.sub([],i.max,i.min),c=Math.min(l/u[0],h/u[1]),d=Math.min(r.scaleZoom(r.scale*c),a.maxZoom);if(isNaN(d))return null;let p=r.scale/r.zoomScale(d),f=new e.cd([i.min[0]-o*p,i.min[1]-s*p,i.min[2]],[i.max[0]+o*p,i.max[1]+s*p,i.max[2]]),m=("number"==typeof a.offset.x&&"number"==typeof a.offset.y?new e.P(a.offset.x,a.offset.y):e.P.convert(a.offset)).rotate(-e.ai(n));return f.center[0]-=m.x*p,f.center[1]+=m.y*p,f}queryTerrainElevation(i,r){let a=this.transform.elevation;return a?(r=e.l({},{exaggerated:!0},r),a.getAtPoint(e.aa.fromLngLat(i),null,r.exaggerated)):null}
98_cameraForBounds(i,r,a,n,o,s){if("globe"===i.projection.name)return this._cameraForBoundsOnGlobe(i,r,a,n,o,s);let l=i.clone(),h=this._extendCameraOptions(s);l.bearing=n,l.pitch=o;let u=e.bO.convert(r),c=e.bO.convert(a),d=new e.bO(u.lng,c.lat),p=new e.bO(c.lng,u.lat),f=l.project(u),m=l.project(c),_=this.queryTerrainElevation(u),g=this.queryTerrainElevation(c),y=this.queryTerrainElevation(d),x=this.queryTerrainElevation(p),v=[[f.x,f.y,Math.min(_||0,g||0,y||0,x||0)],[m.x,m.y,Math.max(_||0,g||0,y||0,x||0)]],b=e.cd.fromPoints(v),w=l.getWorldToCameraMatrix(),T=e.ab.mat4.invert(new Float64Array(16),w);b=e.cd.applyTransform(b,w);let S=this._extendAABB(b,l,h,n);if(!S)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");b=S;let M=.5*e.ab.vec3.sub([],b.max,b.min)[2],E=this._minimumAABBFrustumDistance(l,b),A=[0,0,1,0];e.ab.vec4.transformMat4(A,A,w),e.ab.vec4.normalize(A,A);let I=e.ab.vec3.scale([],A,E+M),C=e.ab.vec3.add([],b.center,I);e.ab.vec3.transformMat4(b.center,b.center,T),e.ab.vec3.transformMat4(C,C,T);let P=l.unproject(new e.P(b.center[0],b.center[1])),z=Math.pow(2,e.dE(l.projection,P)),D=Math.min(l._zoomFromMercatorZ(C[2]*l.pixelsPerMeter*z/l.worldSize),h.maxZoom);return l.mercatorFromTransition&&D<.5*(e.c6+e.bY)?(l.setProjection({name:"globe"}),l.zoom=D,this._cameraForBounds(l,r,a,n,o,s)):{center:P,zoom:D,bearing:n,pitch:o}}fitBounds(e,i,r){let a=this.cameraForBounds(e,i);return this._fitInternal(a,i,r)}fitScreenCoordinates(i,r,a,n,o){let s=e.P.convert(i),l=e.P.convert(r),h=new e.P(Math.min(s.x,l.x),Math.min(s.y,l.y)),u=new e.P(Math.max(s.x,l.x),Math.max(s.y,l.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,l))return this;let c=this.transform.pointLocation3D(h),d=this.transform.pointLocation3D(u),p=this.transform.pointLocation3D(new e.P(h.x,u.y)),f=this.transform.pointLocation3D(new e.P(u.x,h.y)),m=[Math.min(c.lng,d.lng,p.lng,f.lng),Math.min(c.lat,d.lat,p.lat,f.lat)],_=[Math.max(c.lng,d.lng,p.lng,f.lng),Math.max(c.lat,d.lat,p.lat,f.lat)],g=n&&n.pitch?n.pitch:this.getPitch(),y=this._cameraForBounds(this.transform,m,_,a,g,n);return this._fitInternal(y,n,o)}_fitInternal(i,r,a){return i?(r=e.l(i,r)).linear?this.easeTo(r,a):this.flyTo(r,a):this}jumpTo(i,r){this.stop();let a=i.preloadOnly?this.transform.clone():this.transform,n=!1,o=!1,s=!1;"zoom"in i&&a.zoom!==+i.zoom&&(n=!0,a.zoom=+i.zoom),void 0!==i.center&&(a.center=e.bO.convert(i.center)),"bearing"in i&&a.bearing!==+i.bearing&&(o=!0,a.bearing=+i.bearing),"pitch"in i&&a.pitch!==+i.pitch&&(s=!0,a.pitch=+i.pitch);let l="number"==typeof i.padding?this._extendPadding(i.padding):i.padding;if(null!=i.padding&&!a.isPaddingEqual(l)){if(!1===i.retainPadding){let e=a.clone();e.padding=l,a.setLocationAtPoint(a.center,e.centerPoint)}else a.padding=l}return i.preloadOnly?(this._preloadTiles(a),this):(this.fire(new e.z("movestart",r)).fire(new e.z("move",r)),n&&this.fire(new e.z("zoomstart",r)).fire(new e.z("zoom",r)).fire(new e.z("zoomend",r)),o&&this.fire(new e.z("rotatestart",r)).fire(new e.z("rotate",r)).fire(new e.z("rotateend",r)),s&&this.fire(new e.z("pitchstart",r)).fire(new e.z("pitch",r)).fire(new e.z("pitchend",r)),this.fire(new e.z("moveend",r)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(nH),this.transform.getFreeCameraOptions()}setFreeCameraOptions(i,r){let a=this.transform;if(!a.projection.supportsFreeCamera)return e.w(nH),this;this.stop();let n=a.zoom,o=a.pitch,s=a.bearing;a.setFreeCameraOptions(i);let l=n!==a.zoom,h=o!==a.pitch,u=s!==a.bearing;return this.fire(new e.z("movestart",r)).fire(new e.z("move",r)),l&&this.fire(new e.z("zoomstart",r)).fire(new e.z("zoom",r)).fire(new e.z("zoomend",r)),u&&this.fire(new e.z("rotatestart",r)).fire(new e.z("rotate",r)).fire(new e.z("rotateend",r)),h&&this.fire(new e.z("pitchstart",r)).fire(new e.z("pitch",r)).fire(new e.z("pitchend",r)),this.fire(new e.z("moveend",r)),this}easeTo(i,r){let a,n,o,s,l;this._stop(!1,i.easeId),(!1===(i=e.l({offset:[0,0],duration:500,easing:e.dA},i)).animate||this._prefersReducedMotion(i))&&(i.duration=0);let h=this.transform,u=this.getZoom(),c=this.getBearing(),d=this.getPitch(),p=this.getPadding(),f="zoom"in i?+i.zoom:u,m="bearing"in i?this._normalizeBearing(i.bearing,c):c,_="pitch"in i?+i.pitch:d,g=this._extendPadding(i.padding),y=e.P.convert(i.offset);if("globe"===h.projection.name){let r=e.aa.fromLngLat(h.center),s=y.rotate(-h.angle);r.x+=s.x/h.worldSize,r.y+=s.y/h.worldSize;let l=r.toLngLat(),u=e.bO.convert(i.center||l);this._normalizeCenter(u),a=h.centerPoint.add(s),n=new e.P(r.x,r.y).mult(h.worldSize),o=new e.P(e.at(u.lng),e.aA(u.lat)).mult(h.worldSize).sub(n)}else{a=h.centerPoint.add(y);let r=h.pointLocation(a),s=e.bO.convert(i.center||r);this._normalizeCenter(s),n=h.project(r),o=h.project(s).sub(n)}let x=h.zoomScale(f-u);i.around&&(s=e.bO.convert(i.around),l=h.locationPoint(s));let v=this._zooming||f!==u,b=this._rotating||c!==m,w=this._pitching||_!==d,T=!h.isPaddingEqual(g),S=!1===i.retainPadding?h.clone():h,M=h=>M=>{if(v&&(h.zoom=e.af(u,f,M)),b&&(h.bearing=e.af(c,m,M)),w&&(h.pitch=e.af(d,_,M)),T&&(S.interpolatePadding(p,g,M),a=S.centerPoint.add(y)),s)h.setLocationAtPoint(s,l);else{let e=h.zoomScale(h.zoom-u),i=Math.pow(f>u?Math.min(2,x):Math.max(.5,x),1-M),r=h.unproject(n.add(o.mult(M*i)).mult(e));h.setLocationAtPoint(h.renderWorldCopies?r.wrap():r,a)}return i.preloadOnly||this._fireMoveEvents(r),h};if(i.preloadOnly){let e=this._emulate(M,i.duration,h);return this._preloadTiles(e),this}let E={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=v,this._rotating=b,this._pitching=w,this._padding=T,this._easeId=i.easeId,this._prepareEase(r,i.noMoveStart,E),this._ease(M(h),e=>{"sea"===h.cameraElevationReference&&h.recenterOnTerrain(),this._afterEase(r,e)},i),this}_prepareEase(i,r,a={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),r||a.mov
98ing||this.fire(new e.z("movestart",i)),this._zooming&&!a.zooming&&this.fire(new e.z("zoomstart",i)),this._rotating&&!a.rotating&&this.fire(new e.z("rotatestart",i)),this._pitching&&!a.pitching&&this.fire(new e.z("pitchstart",i))}_fireMoveEvents(i){this.fire(new e.z("move",i)),this._zooming&&this.fire(new e.z("zoom",i)),this._rotating&&this.fire(new e.z("rotate",i)),this._pitching&&this.fire(new e.z("pitch",i))}_afterEase(i,r){if(this._easeId&&r&&this._easeId===r)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let a=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new e.z("zoomend",i)),n&&this.fire(new e.z("rotateend",i)),o&&this.fire(new e.z("pitchend",i)),this.fire(new e.z("moveend",i))}flyTo(i,r){if(this._prefersReducedMotion(i)){let a=e.ay(i,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(a,r)}this.stop(),i=e.l({offset:[0,0],speed:1.2,curve:1.42,easing:e.dA},i);let a=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),l=this.getPadding(),h="zoom"in i?e.aw(+i.zoom,a.minZoom,a.maxZoom):n,u="bearing"in i?this._normalizeBearing(i.bearing,o):o,c="pitch"in i?+i.pitch:s,d=this._extendPadding(i.padding),p=a.zoomScale(h-n),f=e.P.convert(i.offset),m=a.centerPoint.add(f),_=a.pointLocation(m),g=e.bO.convert(i.center||_);this._normalizeCenter(g);let y=a.project(_),x=a.project(g).sub(y),v=i.curve,b=Math.max(a.width,a.height),w=b/p,T=x.mag();if("minZoom"in i){let r=e.aw(Math.min(i.minZoom,n,h),a.minZoom,a.maxZoom);v=Math.sqrt(b/a.zoomScale(r-n)/T*2)}let S=v*v;function M(e){let i=(w*w-b*b+(e?-1:1)*S*S*T*T)/(2*(e?w:b)*S*T);return Math.log(Math.sqrt(i*i+1)-i)}function E(e){return(Math.exp(e)-Math.exp(-e))/2}function A(e){return(Math.exp(e)+Math.exp(-e))/2}let I=M(0),C=function(e){return A(I)/A(I+v*e)},P=function(e){var i;return(A(I)*(E(i=I+v*e)/A(i))-E(I))/S*b/T},z=(M(1)-I)/v;if(1e-6>Math.abs(T)||!isFinite(z)){if(1e-6>Math.abs(b-w))return this.easeTo(i,r);let e=w<b?-1:1;z=Math.abs(Math.log(w/b))/v,P=function(){return 0},C=function(i){return Math.exp(e*v*i)}}i.duration="duration"in i?+i.duration:1e3*z/("screenSpeed"in i?+i.screenSpeed/v:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0);let D=o!==u,R=c!==s,L=!a.isPaddingEqual(d),O=!1===i.retainPadding?a.clone():a,k=a=>p=>{let _=p*z,v=1/C(_);a.zoom=1===p?h:n+a.scaleZoom(v),D&&(a.bearing=e.af(o,u,p)),R&&(a.pitch=e.af(s,c,p)),L&&(O.interpolatePadding(l,d,p),m=O.centerPoint.add(f));let b=1===p?g:a.unproject(y.add(x.mult(P(_))).mult(v));return a.setLocationAtPoint(a.renderWorldCopies?b.wrap():b,m),a._updateCameraOnTerrain(),i.preloadOnly||this._fireMoveEvents(r),a};if(i.preloadOnly){let e=this._emulate(k,i.duration,a);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=D,this._pitching=R,this._padding=L,this._prepareEase(r,!1),this._ease(k(a),()=>this._afterEase(r),i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,i)}if(!e){let e=this.handlers;e&&e.stop(!1)}return this}_ease(i,r,a){!1===a.animate||0===a.duration?(i(1),r()):(this._easeStart=e.q.now(),this._easeOptions=a,this._onEaseFrame=i,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let i=Math.min((e.q.now()-this._easeStart)/this._easeOptions.duration,1),r=this._onEaseFrame;r&&r(this._easeOptions.easing(i)),i<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(i,r){let a=Math.abs((i=e.bF(i,-180,180))-r);return Math.abs(i-360-r)<a&&(i-=360),Math.abs(i+360-r)<a&&(i+=360),i}_normalizeCenter(e){let i=this.transform;if(i.maxBounds||"globe"!==i.projection.name&&!i.renderWorldCopies)return;let r=e.lng-i.center.lng;e.lng+=r>180?-360:r<-180?360:0}_prefersReducedMotion(i){return this._respectPrefersReducedMotion&&e.q.prefersReducedMotion&&!(i&&i.essential)}_emulate(e,i,r){let a=Math.ceil(15*i/1e3),n=[],o=e(r.clone());for(let e=0;e<=a;e++){let i=o(e/a);n.push(i.clone())}return n}_preloadTiles(e,i){}}class nW{constructor(i={}){this.options=i,e.aP(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){let i=this.options&&this.options.compact,r=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=d("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=d("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",r);let a=d("span","mapboxgl-ctrl-icon",this._compactButton);return a.setAttribute("aria-hidden","true"),a.setAttribute("title",r),this._innerContainer=d("div","mapboxgl-ctrl-attrib-inner",this._container),i&&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===i&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),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}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
98se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let i=this._editLink;i||(i=this._editLink=this._container.querySelector(".mapbox-improve-map"));let r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.e.ACCESS_TOKEN}];if(i){let a=r.reduce((e,i,a)=>(i.value&&(e+=`${i.key}=${i.value}${a<r.length-1?"&":""}`),e),"?");i.href=`${e.e.FEEDBACK_URL}/${a}#${a9(this._map,!0)}`,i.rel="noopener nofollow"}}_updateData(e){e&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType||"style"===e.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let i=this._map.style._mergedSourceCaches;for(let r in i){let a=i[r];if(a.used){let i=a.getSource();i.attribution&&0>e.indexOf(i.attribution)&&e.push(i.attribution)}}e.sort((e,i)=>e.length-i.length),e=e.filter((i,r)=>{for(let a=r+1;a<e.length;a++)if(e[a].indexOf(i)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=r,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 nX{constructor(){e.aP(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=d("div","mapboxgl-ctrl");let i=d("a","mapboxgl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://www.mapbox.com/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(let i in e){let r=e[i].getSource();if(r.hasOwnProperty("mapbox_logo")&&!r.mapbox_logo)return!1}return!0}_updateCompact(){let e=this._container.children;if(e.length){let i=e[0];this._map.getCanvasContainer().offsetWidth<250?i.classList.add("mapboxgl-compact"):i.classList.remove("mapboxgl-compact")}}}class nY{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){let i=this._currentlyRunning;for(let r of i?this._queue.concat(i):this._queue)if(r.id===e)return void(r.cancelled=!0)}run(e=0){let i=this._currentlyRunning=this._queue;for(let r of(this._queue=[],i))if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class nK{constructor(e){this.jumpTo(e)}getValue(i){if(i<=this._startTime)return this._start;if(i>=this._endTime)return this._end;let r=e.cB((i-this._startTime)/(this._endTime-this._startTime));return this._start*(1-r)+this._end*r}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,i,r){this._start=this.getValue(i),this._end=e,this._startTime=i,this._endTime=i+r}}let nJ={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},nQ=["mouseenter","mouseover","mouseleave","mouseout"];class n0 extends e.z{constructor(e,i,r,a){let{point:n,lngLat:o,originalEvent:s,target:l}=e;super(e.type,{point:n,lngLat:o,originalEvent:s,target:l}),this.preventDefault=()=>{e.preventDefault()},this.id=i,this.interaction=r,this.feature=a}}class n1{constructor(e){this.map=e,this.interactionsByType=new Map,this.typeById=new Map,this.filters=new Map,this.delegatedHandlers=new Map,this.handleType=this.handleType.bind(this)}
98add(i,r){if(this.typeById.has(i))throw Error(`Interaction id "${i}" already exists.`);let{type:a,filter:n}=r;n&&this.filters.set(i,e.aZ(n));let o=this.interactionsByType.get(a)||new Map;if(0===o.size){if(nQ.includes(a)){let{mousemove:e,mouseout:a}=this._createDelegatedHandlers(i,r);this.map.on("mousemove",e),this.map.on("mouseout",a),this.delegatedHandlers.set(i,{mousemove:e,mouseout:a})}else this.map.on(a,this.handleType);this.interactionsByType.set(a,o)}o.set(i,r),this.typeById.set(i,a)}get(e){let i=this.typeById.get(e);if(!i)return;let r=this.interactionsByType.get(i);return r?r.get(e):void 0}remove(e){let i=this.typeById.get(e);if(!i)return;this.typeById.delete(e),this.filters.delete(e);let r=this.interactionsByType.get(i);if(r){if(r.delete(e),this.delegatedHandlers.has(e)){let{mousemove:i,mouseout:r}=this.delegatedHandlers.get(e);this.map.off("mousemove",i),this.map.off("mouseout",r),this.delegatedHandlers.delete(e)}0===r.size&&this.map.off(i,this.handleType)}}queryTargets(e,i){let r=[];for(let[e,a]of i)a.target&&r.push({targetId:e,target:a.target,filter:this.filters.get(e)});return this.map.style.queryRenderedTargets(e,r,this.map.transform)}handleType(i,r){let a=Array.from(this.interactionsByType.get(i.type)).reverse();r=r||this.queryTargets(i.point,a);let n=!1;for(let o of r){for(let[r,s]of a){if(!s.target)continue;let a=o.variants?o.variants[r]:null;if(a){for(let l of a){let a=new e.cw(o,l);if(!1!==s.handler(new n0(i,r,s,a))){n=!0;break}}if(n)break}}if(n)break}if(!n)for(let[e,r]of a){let{handler:a,target:n}=r;if(!n&&!1!==a(new n0(i,e,r,null)))break}}_createDelegatedHandlers(e,i){switch(i.type){case"mouseenter":case"mouseover":{let r=!1,a=new Set;return{mousemove:n=>{let o=this.queryTargets(n.point,[[e,i]]),s=new Set;if(!o.length)return r=!1,void a.clear();let l=[];for(let e of o)a.has(e.id)||(s.add(e.id),l.push(e));r&&!l.length||(r=!0,a=s,n.type=i.type,this.handleType(n,l))},mouseout:()=>{r=!1,a.clear()}}}case"mouseleave":case"mouseout":{let r=[];return{mousemove:a=>{let n=this.queryTargets(a.point,[[e,i]]);if(!n.length)return a.type=i.type,this.handleType(a,r),void(r=n);let o=[],s=new Set(n.map(e=>e.id));for(let e of r)s.has(e.id)||o.push(e);o.length&&(a.type=i.type,this.handleType(a,o)),r=n},mouseout:e=>{r.length&&(e.type=i.type,this.handleType(e,r),r=[])}}}}}}let n2={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,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},n3={showCompass:!0,showZoom:!0,visualizePitch:!1};class n4{constructor(i,r,a=!1){this._clickTolerance=10,this.element=r,this.mouseRotate=new nv({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,a&&(this.mousePitch=new nb({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),e.aP(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchmove",this.touchmove),r.addEventListener("touchend",this.touchend),r.addEventListener("touchcancel",this.reset)}down(e,i){this.mouseRotate.mousedown(e,i),this.mousePitch&&this.mousePitch.mousedown(e,i),_()}move(e,i){let r=this.map,a=this.mouseRotate.mousemoveWindow(e,i),n=a&&a.bearingDelta;if(n&&r.setBearing(r.getBearing()+n),this.mousePitch){let a=this.mousePitch.mousemoveWindow(e,i),n=a&&a.pitchDelta;n&&r.setPitch(r.getPitch()+n)}}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){g(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(e.l({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),v(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,v(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=b(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=b(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function n5(i,r,a){if(i=new e.bO(i.lng,i.lat),r){let n=new e.bO(i.lng-360,i.lat),o=new e.bO(i.lng+360,i.lat),s=360*Math.ceil(Math.abs(i.lng-a.center.lng)/360),l=a.locationPoint(i).distSqr(r),h=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint(n).distSqr(r)<l&&(h||Math.abs(n.lng-a.center.lng)<s)?i=n:a.locationPoint(o).distSqr(r)<l&&(h||Math.abs(o.lng-a.center.lng)<s)&&(i=o)}for(;Math.abs(i.lng-a.center.lng)>180;){let e=a.locationPoint(i);if(e.x>=0&&e.y>=0&&e.x<=a.width&&e.y<=a.height)break;
98i.lng>a.center.lng?i.lng-=360:i.lng+=360}return i}let n6={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%)"};class n8 extends e.E{constructor(i,r){if(super(),(i instanceof HTMLElement||r)&&(i=e.l({element:i},r)),e.aP(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=i&&i.occludedOpacity||.2,i&&i.element)this._element=i.element,this._offset=e.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=d("div");let r=p("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),a=p("radialGradient",{id:"shadowGradient"},p("defs",{},r));p("stop",{offset:"10%","stop-opacity":.4},a),p("stop",{offset:"100%","stop-opacity":.05},a),p("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r),p("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},r),p("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},r),p("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),this._offset=e.P.convert(i&&i.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()});let a=this._element.classList;for(let e in n6)a.remove(`mapboxgl-marker-anchor-${e}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`);let n=i&&i.className?i.className.trim().split(/\s+/):[];a.add(...n),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){let e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=e.bO.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let i=Math.sqrt(91.125);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
980,-38.1],"bottom-left":[i,-1*(24.6+i)],"bottom-right":[-i,-1*(24.6+i)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){let i=e.code,r=e.charCode||e.keyCode;"Space"!==i&&"Enter"!==i&&32!==r&&13!==r||this.togglePopup()}_onMapClick(e){let i=e.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e&&(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_behindTerrain(){let e=this._map,i=this._pos;if(!e||!i)return!1;let r=e.unproject(i),a=e.getFreeCameraOptions();if(!a.position)return!1;let n=a.position.toLngLat();return n.distanceTo(r)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){let i;let r=this._map;if(!r)return;let a=this._pos;if(!a||a.x<0||a.x>r.transform.width||a.y<0||a.y>r.transform.height)return void this._clearFadeTimer();let n=r.unproject(a);r._showingGlobe()&&e.dH(r.transform,this._lngLat)?i=0:(i=1-r._queryFogOpacity(n),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(i*=this._occludedOpacity)),this._element.style.opacity=`${i}`,this._element.style.pointerEvents=i>0?"auto":"none",this._popup&&this._popup._setOpacity(i),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let e=this._pos;if(!e||!this._map)return;let i=this._offset.mult(this._scale);this._element.style.transform=`
99            translate(${e.x}px,${e.y}px)
100            ${n6[this._anchor]}
101            ${this._calculateXYTransform()} ${this._calculateZTransform()}
102            translate(${i.x}px,${i.y}px)
103        `}_calculateXYTransform(){let i=this._pos,r=this._map,a=this.getPitchAlignment();if(!r||!i||"map"!==a)return"";if(!r._showingGlobe()){let e=r.getPitch();return e?`rotateX(${e}deg)`:""}let n=e.c4(e.dI(r.transform,this._lngLat)),o=i.sub(e.dJ(r.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";let l=n/s;return`rotateX(${-o.y*l}deg) rotateY(${o.x*l}deg)`}_calculateZTransform(){let i=this._pos,r=this._map;if(!r||!i)return"";let a=0,n=this.getRotationAlignment();if("map"===n){if(r._showingGlobe()){let i=r.project(new e.bO(this._lngLat.lng,this._lngLat.lat+.001)),n=r.project(new e.bO(this._lngLat.lng,this._lngLat.lat-.001)).sub(i);a=e.c4(Math.atan2(n.y,n.x))-90}else a=-r.getBearing()}else if("horizon"===n){let n=e.ac(4,6,r.getZoom()),o=e.dJ(r.transform);o.y+=n*r.transform.height;let s=i.sub(o),l=e.c4(Math.atan2(s.y,s.x));a=(l>90?l-270:l+90)*(1-n)}return(a+=this._rotation)?`rotateZ(${a}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);let i=this._map;
103i&&(i.transform.renderWorldCopies&&(this._lngLat=n5(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),!0===e?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),i._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(i._showingGlobe()||i.getTerrain()||i.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(i){return this._offset=e.P.convert(i),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(i){let r=this._map;if(!r)return;let a=this._pointerdownPos,n=this._positionDelta;if(a&&n){if(!this._isDragging){let e=this._clickTolerance||r._clickTolerance;if(i.point.dist(a)<e)return;this._isDragging=!0}this._pos=i.point.sub(n),this._lngLat=r.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.z("dragstart"))),this.fire(new e.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let i=this._map;i&&(i.off("mousemove",this._onMove),i.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.z("dragend")),this._state="inactive"}_addDragHandler(e){let i=this._map,r=this._pos;i&&r&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(r),this._pointerdownPos=e.point,this._state="pending",i.on("mousemove",this._onMove),i.on("touchmove",this._onMove),i.once("mouseup",this._onUp),i.once("touchend",this._onUp))}setDraggable(e){this._draggable=!!e;let i=this._map;return i&&(e?(i.on("mousedown",this._addDragHandler),i.on("touchstart",this._addDragHandler)):(i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let n9={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},n7={maxWidth:100,unit:"metric"},oe={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},ot={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"};function oi(i=new e.P(0,0),r="bottom"){if("number"==typeof i){let a=Math.round(Math.sqrt(.5*Math.pow(i,2)));switch(r){case"top":return new e.P(0,i);case"top-left":return new e.P(a,a);case"top-right":return new e.P(-a,a);case"bottom":return new e.P(0,-i);case"bottom-left":return new e.P(a,-a);case"bottom-right":return new e.P(-a,-a);case"left":return new e.P(i,0);case"right":return new e.P(-i,0)}return new e.P(0,0)}return i instanceof e.P||Array.isArray(i)?e.P.convert(i):e.P.convert(i[r]||[0,0])}return{version:n,supported:c.supported,setRTLTextPlugin:e.dK,getRTLTextPluginStatus:e.dL,Map:class extends n${constructor(i){s.mark(o.create);let r=i;if(null!=(i=e.l({},n2,i)).minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=i.minPitch&&i.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=i.maxPitch&&i.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(i.antialias&&e.dF(window)&&(i.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new ii(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),i),this._repaint=!!i.repaint,this._interactive=i.interactive,this._minTileCacheSize=i.minTileCacheSize,this._maxTileC
103acheSize=i.maxTileCacheSize,this._failIfMajorPerformanceCaveat=i.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=i.preserveDrawingBuffer,this._antialias=i.antialias,this._trackResize=i.trackResize,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=i.crossSourceCollisions,this._collectResourceTiming=i.collectResourceTiming,this._language=this._parseLanguage(i.language),this._worldview=i.worldview,this._renderTaskQueue=new nY,this._domRenderTaskQueue=new nY,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aV(),this._locale=e.l({},nJ,i.locale),this._clickTolerance=i.clickTolerance,this._cooperativeGestures=i.cooperativeGestures,this._performanceMetricsCollection=i.performanceMetricsCollection,this._tessellationStep=i.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=i.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new nK(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=i.scaleFactor,this._requestManager=new M(i.transformRequest,i.accessToken,i.testMode),this._silenceAuthErrors=!!i.testMode,this._contextCreateOptions=i.contextCreateOptions?{...i.contextCreateOptions}:{},"string"==typeof i.container){let e=document.getElementById(i.container);if(!e)throw Error(`Container '${i.container.toString()}' not found.`);this._container=e}else{if(!(i.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(this._container.childNodes.length>0&&e.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),i.maxBounds&&this.setMaxBounds(i.maxBounds),this._spriteFormat=i.spriteFormat,e.aP(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new aZ),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new nZ(this,i),this._localFontFamily=i.localFontFamily,this._localIdeographFontFamily=i.localIdeographFontFamily,(i.style||!i.testMode)&&this.setStyle(i.style||e.e.DEFAULT_STYLE,{config:i.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),i.projection&&this.setProjection(i.projection),this.indoor=new ig(this),i.hash&&(this._hash=new a8("string"==typeof i.hash&&i.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==r.center&&null==r.zoom||(this.transform._unmodified=!1),this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch});let a=i.bounds;a&&(this.resize(),this.fitBounds(a,e.l({},i.fitBoundsOptions,{duration:0})))}this.resize(),i.attributionControl&&this.addControl(new nW({customAttribution:i.customAttribution}
103)),this._logoControl=new nX,this.addControl(this._logoControl,i.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",i=>{this._update("style"===i.dataType),this.fire(new e.z(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new e.z(`${i.dataType}dataloading`,i))}),this._interactions=new n1(this)}_getMapId(){return this._mapId}addControl(i,r){if(void 0===r&&(r=i.getDefaultPosition?i.getDefaultPosition():"top-right"),!i||!i.onAdd)return this.fire(new e.y(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let a=i.onAdd(this);this._controls.push(i);let n=this._controlPositions[r];return -1!==r.indexOf("bottom")?n.insertBefore(a,n.firstChild):n.appendChild(a),this}removeControl(i){if(!i||!i.onRemove)return this.fire(new e.y(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(i);return r>-1&&this._controls.splice(r,1),i.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(i){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));let r=!this._moving;return r&&this.fire(new e.z("movestart",i)).fire(new e.z("move",i)),this.fire(new e.z("resize",i)),r&&this.fire(new e.z("moveend",i)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(i){return this.transform.setMaxBounds(e.az.convert(i)),this._update()}setMinZoom(i){if((i=i??-2)>=-2&&i<=this.transform.maxZoom)return this.transform.minZoom=i,this._update(),this.getZoom()<i?this.setZoom(i):this.fire(new e.z("zoomstart")).fire(new e.z("zoom")).fire(new e.z("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(i){if((i=i??22)>=this.transform.minZoom)return this.transform.maxZoom=i,this._update(),this.getZoom()>i?this.setZoom(i):this.fire(new e.z("zoomstart")).fire(new e.z("zoom")).fire(new e.z("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(i){if((i=i??0)<0)throw Error("minPitch must be greater than or equal to 0");if(i>=0&&i<=this.transform.maxPitch)return this.transform.minPitch=i,this._update(),this.getPitch()<i?this.setPitch(i):this.fire(new e.z("pitchstart")).fire(new e.z("pitch")).fire(new e.z("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(i){if((i=i??85)>85)throw Error("maxPitch must be less than or equal to 85");if(i>=this.transform.minPitch)return this.transform.maxPitch=i,this._update(),this.getPitch()>i?this.setPitch(i):this.fire(new e.z("pitchstart")).fire(new e.z("pitch")).fire(new e.z("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(e=>"symbol"===e.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map(e=>"auto"===e?navigator.language:e):e}setLanguage(e){let i=this._parseLanguage(e);if(!this.style||i===this._language)return this;for(let e of(this._language=i,this.style.reloadSources(),this._controls))e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview&&(this._worldview=e,this.style.reloadSources()),this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){let i;if("globe"!==this.getProjection().name)return;let r=this.transform,a=r.projection.name;"globe"===a&&r.zoom>=e.bY?(r.setMercatorFromTransition(),i=!0):"mercator"===a&&r.zoom<e.bY&&(r.setProjection({name:"globe"}),i=!0),i&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
103Update())}_prioritizeAndUpdateProjection(e,i){return this._updateProjection(e||i||{name:"mercator"})}_updateProjection(i){let r;return r="globe"===i.name&&this.transform.zoom>=e.bY?this.transform.setMercatorFromTransition():this.transform.setProjection(i),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(i){return this.transform.locationPoint3D(e.bO.convert(i))}unproject(i){return this.transform.pointLocation3D(e.P.convert(i))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,i,r){let a=e=>{let r=[];if(Array.isArray(i)){let a=i.filter(e=>this.getLayer(e));r=a.length?this.queryRenderedFeatures(e,{layers:a}):[]}else r=this.queryRenderedFeatures(e,{target:i});return r};if("mouseenter"===e||"mouseover"===e){let n=!1;return{listener:r,targets:i,delegates:{mousemove:i=>{let o=a(i.point);o.length?n||(n=!0,r.call(this,new ns(e,this,i.originalEvent,{features:o}))):n=!1},mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;return{listener:r,targets:i,delegates:{mousemove:i=>{a(i.point).length?n=!0:n&&(n=!1,r.call(this,new ns(e,this,i.originalEvent)))},mouseout:i=>{n&&(n=!1,r.call(this,new ns(e,this,i.originalEvent)))}}}}return{listener:r,targets:i,delegates:{[e]:e=>{let i=a(e.point);i.length&&(e.features=i,r.call(this,e),delete e.features)}}}}on(e,i,r){if("function"==typeof i||void 0===r)return super.on(e,i);if("string"==typeof i&&(i=[i]),!this._areTargetsValid(i))return this;let a=this._createDelegatedListener(e,i,r);for(let i in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(a),a.delegates)this.on(i,a.delegates[i]);return this}once(e,i,r){if("function"==typeof i||void 0===r)return super.once(e,i);if("string"==typeof i&&(i=[i]),!this._areTargetsValid(i))return this;let a=this._createDelegatedListener(e,i,r);for(let e in a.delegates)this.once(e,a.delegates[e]);return this}off(i,r,a){if("function"==typeof r||void 0===a)return super.off(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._delegatedListeners?this._delegatedListeners[i]:void 0;return n&&(i=>{for(let n=0;n<i.length;n++){let o=i[n];if(o.listener===a&&function(i,r){if(Array.isArray(i)&&Array.isArray(r)){let e=new Set(i),a=new Set(r);return e.size===a.size&&i.every(e=>a.has(e))}return e.bn(i,r)}(o.targets,r)){for(let e in o.delegates)this.off(e,o.delegates[e]);return i.splice(n,1),this}}})(n),this}queryRenderedFeatures(i,r){if(!this.style)return[];if(void 0===i||i instanceof e.P||Array.isArray(i)||void 0!==r||(r=i,i=void 0),i=i||[[0,0],[this.transform.width,this.transform.height]],!r){let e=this.style.queryRenderedFeatures(i,void 0,this.transform),r=this.style.queryRenderedFeatureset(i,void 0,this.transform);return e.concat(r)}let a=!0;if(r.target&&(a=this._isTargetValid(r.target))&&!r.layers)return this.style.queryRenderedFeatureset(i,r,this.transform);let n=!0;if(r.layers&&Array.isArray(r.layers)){for(let e of r.layers)if(!this._isValidId(e)){n=!1;break}if(n&&!r.target)return this.style.queryRenderedFeatures(i,r,this.transform)}let o=[];return n&&(o=o.concat(this.style.queryRenderedFeatures(i,r,this.transform))),a&&(o=o.concat(this.style.queryRenderedFeatureset(i,r,this.transform))),o}querySourceFeatures(e,i){return e&&("string"!=typeof e||this._isValidId(e))?this.style.querySourceFeatures(e,i):[]}isPointOnSurface(i){let{name:r}=this.transform.projection;return"globe"!==r&&"mercator"!==r&&e.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(e.P.convert(i))}addInteraction(e,i){return this._interactions.add(e,i),this}removeInteraction(e){return this._interactions.remove(e),this}setStyle(i,r){return r=e.l({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},r),this.style&&i&&!1!==r.diff&&r.localFontFamily===this._localFontFamily&&r.localIdeographFontFamily===this._localIdeographFontFamily&&!r.config?(this.style._diffStyle(i,(a,n)=>{a?(e.w(`Unable to perform style diff: ${String(a.message||a.error||a)}. Rebuilding the style from scratch.`),this._updateStyle(i,r)):n&&this._update(!0)},()=>{this._postStyleLoadEvent()}),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(i,r))}_getUIString(e){let i=this._locale[e];if(null==i)throw Error(`Missing UI string '${e}'`);return i}_updateStyle(i,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),i){let a=e.l({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new iS(this,a).load(i),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new iS(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(i){return null==i?(this.fire(new e.y(Error("IDs can't be empty."))),!1):!e.cr(i)||(this.fire(new e.y(Error(`IDs can't 
103contain special symbols: "${i}".`))),!1)}_isTargetValid(e){return"featuresetId"in e?this._isValidId("importId"in e?e.importId:e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(let i of e)if(!this._isValidId(i))return!1;return!0}return this._isTargetValid(e)}addSource(e,i){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,i),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,i,r){this._lazyInitEmptyStyle(),this.style.addSourceType(e,i,r)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(i,r,{pixelRatio:a=1,sdf:n=!1,stretchX:o,stretchY:s,content:l}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){let{width:h,height:u,data:c}=e.q.getImageData(r);this.style.addImage(i,{data:new e.r({width:h,height:u},c),pixelRatio:a,stretchX:o,stretchY:s,content:l,sdf:n,version:0,usvg:!1})}else if(void 0===r.width||void 0===r.height)this.fire(new e.y(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`")));else{let{width:h,height:u}=r;this.style.addImage(i,{data:new e.r({width:h,height:u},new Uint8Array(r.data)),pixelRatio:a,stretchX:o,stretchY:s,content:l,sdf:n,usvg:!1,version:0,userImage:r}),r.onAdd&&r.onAdd(this,i)}}updateImage(i,r){this._lazyInitEmptyStyle();let a=this.style.getImage(i);if(!a)return void this.fire(new e.y(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:o,data:s}=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?e.q.getImageData(r):r;if(void 0===n||void 0===o)return void this.fire(new e.y(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`")));if(n!==(a.usvg?a.icon.usvg_tree.width:a.data.width)||o!==(a.usvg?a.icon.usvg_tree.height:a.data.height))return void this.fire(new e.y(Error(`The width and height of the updated image (${n}, ${o})
104                must be that same as the previous version of the image
105                (${a.data.width}, ${a.data.height})`)));let l=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap),h=!1;a.usvg?(a.data=new e.r({width:n,height:o},new Uint8Array(s)),a.usvg=!1,a.icon=void 0,h=!0):a.data.replace(s,l),this.style.updateImage(i,a,h)}hasImage(i){return i?!!this.style&&!!this.style.getImage(i):(this.fire(new e.y(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(i,r){e.o(this._requestManager.transformRequest(i,e.R.Image),(i,a)=>{r(i,a instanceof HTMLImageElement?e.q.getImageData(a):a)})}listImages(){return this.style.listImages()}addModel(e,i){this._lazyInitEmptyStyle(),this.style.addModel(e,i)}hasModel(i){return i?this.style.hasModel(i):(this.fire(new e.y(Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,i){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,i),this._update(!0)):this}getSlot(e){let i=this.getLayer(e);return i&&i.slot||null}setSlot(e,i){return this.style.setSlot(e,i),this.style.mergeLayers(),this._update(!0)}addImport(e,i){return this.style.addImport(e,i),this}updateImport(e,i){return"string"!=typeof i&&i.id!==e?(this.removeImport(e),this.addImport(i)):(this.style.updateImport(e,i),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,i){return this.style.moveImport(e,i),this._update(!0)}moveLayer(e,i){return this._isValidId(e)?(this.style.moveLayer(e,i),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;let i=this.style.getOwnLayer(e);return i?"custom"===i.type?i.implementation:i.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,i,r){return this._isValidId(e)?(this.style.setLayerZoomRange(e,i,r),this._update(!0)):this}setFilter(e,i,r={}){return this._isValidId(e)?(this.style.setFilter(e,i,r),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,i,r,a={}){return this._isValidId(e)?(this.style.setPaintProperty(e,i,r,a),this._update(!0)):this}getPaintProperty(e,i){return this._isValidId(e)?this.style.getPaintProperty(e,i):null}setLayoutProperty(e,i,r,a={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,i,r,a),this._update(!0)):this}getLayoutProperty(e,i){return this._isValidId(e)?this.style.getLayoutProperty(e,i):null}getSchema(e){return this.style.getSchema(e)}setSchema(e,i){return this.style.setSchema(e,i),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,i){return this.style.setConfig(e,i),this._update(!0)}getConfigProperty(e,i){return this.style.getConfigProperty(e,i)}setConfigProperty(e,i,r){return this.style.setConfigProperty(e,i,r),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){let i=e[0];i.properties?this.style.setFlatLight(i.properties,i.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){let e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,i={}
105){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(e){return this._lazyInitEmptyStyle(),this.style.setSnow(e),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(e){return this._lazyInitEmptyStyle(),this.style.setRain(e),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setImportColorTheme(e,i){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(e,i),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(i){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.bO.convert(i),this.transform):0}setFeatureState(e,i){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,i),this._update())}removeFeatureState(e,i){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,i),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;let e=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300,r,a,n,o=this._container;for(;o&&(!a||!n);){let e=window.getComputedStyle(o).transform;e&&"none"!==e&&((r=e.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==r[0]&&"1"!==r[0]&&(a=r[0]),r[3]&&"0"!==r[3]&&"1"!==r[3]&&(n=r[3])),o=o.parentElement}this._containerWidth=a?Math.abs(e/a):e,this._containerHeight=n?Math.abs(i/n):i}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("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(){let e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=d("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();let i=this._canvasContainer=d("div","mapboxgl-canvas-container",e);this._canvas=d("canvas","mapboxgl-canvas",i),this._interactive&&(i.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);let r=this._controlContainer=d("div","mapboxgl-control-container",e),a=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(e=>{a[e]=d("div",`mapboxgl-ctrl-${e}`,r)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(i,r){let a=e.q.devicePixelRatio||1;this._canvas.width=a*Math.ceil(i),this._canvas.height=a*Math.ceil(r),this._canvas.style.width=`${i}px`,this._canvas.style.height=`${r}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){let i=this._markers.indexOf(e);-1!==i&&this._markers.splice(i,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){let i=this._popups.indexOf(e);-1!==i&&this._popups.splice(i,1)}_setupPainter(){let i=e.l({},c.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",i);r?(G(r,!0),this.painter=new a5(r,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp),this.on("data",e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)}),e.m.testSupport(r)):this.fire(new e.y(Error("Failed to initialize WebGL")))}_contextLost(i){i.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.z("webglcontextlost",{originalEvent:i}))}_contextRestored(i){this._setupPainter(),this.resize(),this._update(),this.fire(new e.z("webglcontextrestored",{originalEvent:i}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style&&(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(i){let r;this.fire(new e.z("renderstart")),++this._frameId;let a=this.painter.context.extTimerQuery,n=e.q.now(),l=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=l.createQuery(),l.beginQuery(a.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
105(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(i),this._domRenderTaskQueue.run(i),this._removed)return;this._updateProjectionTransition();let h=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let i=this.transform.zoom,r=this.transform.pitch,a=e.q.now(),n=new e.a8(i,{now:a,fadeDuration:h,pitch:r,transition:this.style.transition});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let u=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),u=this._updateAverageElevation(n),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):u=this._updateAverageElevation(n);let c=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,h,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),c&&(this._placementDirty=c.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:h,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.mark(o.load),this.fire(new e.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){let i=e.q.now()-n;l.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{let a=l.getQueryParameter(r,l.QUERY_RESULT)/1e6;l.deleteQuery(r),this.fire(new e.z("gpu-timing-frame",{cpuTime:i,gpuTime:a}))},50)}if(this.listens("gpu-timing-layer")){let i=this.painter.collectGpuTimers();setTimeout(()=>{let r=this.painter.queryGpuTimers(i);this.fire(new e.z("gpu-timing-layer",{layerTimes:r}))},50)}if(this.listens("gpu-timing-deferred-render")){let i=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let r=this.painter.queryGpuTimeDeferredRender(i);this.fire(new e.z("gpu-timing-deferred-render",{gpuTime:r}))},50)}let d=this._sourcesDirty||this._styleDirty||this._placementDirty||u;if(d||this._repaint)this.triggerRepaint();else{let i=this.idle();if(i&&(u=this._updateAverageElevation(n,!0)),u)this.triggerRepaint();else if(this._triggerFrame(!1),i&&(this.fire(new e.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let i=this._calculateSpeedIndex();this.fire(new e.z("speedindexcompleted",{speedIndex:i})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,s.mark(o.fullLoad),this._performanceMetricsCollection&&N(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(let i of this._markers)e&&!this.getRenderWorldCopies()&&(i._lngLat=i._lngLat.wrap()),i._update();for(let i of this._popups)!e||this.getRenderWorldCopies()||i._trackPointer||(i._lngLat=i._lngLat.wrap()),i._update()}_updateAverageElevation(e,i=!1){let r=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&r(0);let a=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(a||(i||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){let i=this.transform.averageElevation,n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;let o=Math.abs(i-n);if(o>1){if(this._isInitialLoad||a)return this._averageElevation.jumpTo(n),r(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),r(n)}return!!this._averageElevation.isEasing(e)&&r(this._averageElevation.getValue(e))}_authenticate(){U(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,i=>{if(i&&(i.message===S||401===i.status)){let i=this.painter.context.gl;G(i,!1),this._logoControl instanceof nX&&this._logoControl._updateLogo(),i&&i.clear(i.DEPTH_BUFFER_BIT|i.COLOR_BUFFER_BIT|i.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.y(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/")))}}),O(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&F(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){let e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){let e=this.painter.canvasCopy(),i=this.painter.getCanvasCopiesAndTimestamps();i.timeStamps.push(performance.now());let r=this.painter.context.gl,a=r.createFramebuffer();function n(e){r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);let i=new Uint8Array(r.drawingBufferWidth*r.drawingBufferHeight*4);return r.readPixels(0,0,r.drawingBufferWidth,r.drawingBufferHeight,r.RGBA,r.UNSIGNED_BYTE,i),i}return r.bindFramebuffer(r.FRAMEBUFFER,a),this._canvasPixelComparison(n(e),i.canvasCopies.map(n),i.timeStamps)}_canvasPixelComparison(e,i,r){let a=r[1]-r[0],n=e.length/4;for(let o=0;o<i.length;o++){let s=i[o],l=0;for(let i=0;i<s.length;
105i+=4)s[i]===e[i]&&s[i+1]===e[i+1]&&s[i+2]===e[i+2]&&s[i+3]===e[i+3]&&(l+=1);a+=(r[o+2]-r[o+1])*(1-l/n)}return a}remove(){for(let e of(this._hash&&this._hash.remove(),this._controls))e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);let i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),j.delete(this.painter.context.gl),V.remove(),L.remove(),this._removed=!0,this.fire(new e.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(i){this._renderNextFrame=this._renderNextFrame||i,this.style&&!this._frame&&(this._frame=e.q.frame(e=>{let i=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,i&&this._render(e)}))}_preloadTiles(i){let r=this.style?this.style.getSourceCaches():[];return e.bl(r,(e,r)=>e._preloadTiles(i,r),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update())}_setCacheLimits(i,r){e.dG(i,r)}get version(){return n}},NavigationControl:class{constructor(i={}){this.options=e.l({},n3,i),this._container=d("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.aP(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",e=>{this._map&&this._map.zoomIn({},{originalEvent:e})}),d("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",e=>{this._map&&this._map.zoomOut({},{originalEvent:e})}),d("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aP(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",e=>{let i=this._map;i&&(this.options.visualizePitch?i.resetNorthPitch({},{originalEvent:e}):i.resetNorth({},{originalEvent:e}))}),this._compassIcon=d("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let e=this._map;if(!e)return;
105let i=e.getZoom(),r=i===e.getMaxZoom(),a=i===e.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())}_rotateCompassArrow(){let e=this._map;if(!e)return;let i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=i)})}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new n4(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){let e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,i){let r=d("button",e,this._container);return r.type="button",r.addEventListener("click",i),r}_setButtonTitle(e,i){if(!this._map)return;let r=this._map._getUIString(`NavigationControl.${i}`);e.setAttribute("aria-label",r),e.firstElementChild&&e.firstElementChild.setAttribute("title",r)}},GeolocateControl:class extends e.E{constructor(i={}){super();let r=navigator.geolocation;this.options=e.l({geolocation:r},n9,i),e.aP(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=a6(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=d("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){let i=(i=!!this.options.geolocation)=>{this._supportsGeolocation=i,e(i)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(e=>i("denied"!==e.state)).catch(()=>i()):i()}_isOutOfMapMaxBounds(e){let i=this._map.getMaxBounds(),r=e.coords;return!!i&&(r.longitude<i.getWest()||r.longitude>i.getEast()||r.latitude<i.getSouth()||r.latitude>i.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(i){if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new e.z("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
105RROR":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(i),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(i),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.z("geolocate",i)),this._finish()}}_updateCamera(i){let r=new e.bO(i.coords.longitude,i.coords.latitude),a=i.coords.accuracy,n=this._map.getBearing(),o=e.l({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(a),o,{geolocateSource:!0})}_updateMarker(i){if(i){let r=new e.bO(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=i.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let i=this._map.transform,r=e.bH(1,i._center.lat)*i.worldSize,a=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(i){if(this._map){if(this.options.trackUserLocation){if(1===i.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;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===i.code&&this._noTimeout)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.z("error",i)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(i){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=d("button","mapboxgl-ctrl-geolocate",this._container),d("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===i){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
105se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=d("div","mapboxgl-user-location"),this._dotElement.appendChild(d("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(d("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new n8({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=d("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new n8({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",i=>{i.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i.originalEvent&&"resize"===i.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.z("trackuserlocationend")))})}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("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 e.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!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 e.z("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 e.z("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"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){let e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&e()}).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
105se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:nW,ScaleControl:class{constructor(i={}){this.options=e.l({},n7,i),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aP(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let e=this.options.maxWidth||100,i=this._map,r=i._containerHeight/2,a=i._containerWidth/2-e/2,n=i.unproject([a,r]),o=i.unproject([a+e,r]),s=n.distanceTo(o);if("imperial"===this.options.unit){let i=3.2808*s;i>5280?this._setScale(e,i/5280,"mile"):this._setScale(e,i,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,i,r){this._map._requestDomTask(()=>{let a=function(e){let i=Math.pow(10,`${Math.floor(e)}`.length-1),r=e/i;return i*(r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(e){let i=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*i)/i}(r))}(i),n=a/i;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==r?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:r}).format(a):`${a}&nbsp;${oe[r]}`,this._container.style.width=e*n+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=d("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(i={}){this._fullscreen=!1,i&&i.container&&(i.container instanceof HTMLElement?this._container=i.container:e.w("Full screen control 'container' must be a DOM element.")),e.aP(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(i){return this._map=i,this._container||(this._container=this._map.getContainer()),this._controlContainer=d("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){let e=this._fullscreenButton=d("button","mapboxgl-ctrl-fullscreen",this._controlContainer);d("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||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()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.E{constructor(i){super(),this.options=e.l(Object.create(ot),i),e.aP(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(i&&i.className?i.className.trim().split(/\s+/):[])}addTo(i){return this._map&&this.remove(),this._map=i,this.options.closeOnClick&&i.on("preclick",this._onClose),this.options.closeOnMove&&i.on("move",this._onClose),i.on("remove",this.remove),this._update(),i._addPopup(this),this._focusFirstElement(),this._trackPointer?(i.on("mousemove",this._onMouseEvent),i.on("mouseup",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")):i.on("move",this._update),this.fire(new e.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let i=this._map;return i&&(i.off("move",this._update),i.off("move",this._onClose),i.off("preclick",this._onClose),i.off("click",this._onClose),i.off("remove",this.remove),i.off("mousemove",this._onMouseEvent),i.off("mouseup",this._onMouseEvent),i.off("drag",this._onMouseEvent),i._canvasContainer&&i._canvasContainer.classList.remove("mapboxgl-track-pointer"),i._removePopup(this),this._map=void 0),this.fire(new e.z("close")),this}getLngLat(){return this._lngLat}setLngLat(i){this._lngLat=e.bO.convert(i),this._pos=null,this._trackPointer=!1,this._update();let r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let i;let r=document.createDocumentFragment(),a=document.createElement("body");for(a.innerHTML=e;i=a.firstChild;)r.appendChild(i);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let i=this._content;if(i)for(;i.hasChildNodes();)i.firstChild&&i.removeChild(i.firstChild);else i=this._content=d("div","mapboxgl-popup-content",this._container||void 0);if(i.appendChild(e),this.options.closeButton){let e=this._closeButton=d("button","mapboxgl-popup-close-button",i);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="&#215;",e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let i;return this._classList.delete(e)?i=!1:(this._classList.add(e),i=!0),this._updateClassList(),i}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;let i=this._map,r=this._container,a=this._pos;if(!i||!r||!a)return"bottom";let n=r.offsetWidth,o=r.offsetHeight,s=a.x<n/2,l=a.x>i.transform.width-n/2;if(a.y+e<o)return s?"top-left":l?"top-right":"top";if(a.y>i.transform.height-o){if(s)return"bottom-left";if(l)return"bottom-right"}return s?"left":l?"right":"bottom"}_updateClassList(){let e=this._container;if(!e)return;let i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),e.className=i.join(" ")}_update(i){let r=this._map,a=this._content;if(!r||!this._lngLat&&!this._trackPointer||!a)return;let n=this._container;if(n||(n=this._container=d("div","mapboxgl-popup",r.getContainer()),this._tip=d("div","mapboxgl-popup-tip",n),n.appendChild(a)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=n5(this._lngLat,this._pos,r.transform)),!this._trackPointer||i){let a=this._pos=this._trackPointer&&i instanceof e.P?i:r.project(this._lngLat),n=oi(this.options.offset),o=this._anchor=this._getAnchor(n.y),s=oi(this.options.offset,o),l=a.add(s).round();r._requestDomTask(()=>{this._container&&o&&(this._container.style.transform=`${n6[o]} translate(${l.x}px,${l.y}px)`)})}if(!this._marker&&r._showingGlobe()){let i=e.dH(r.transform,this._lngLat)?0:1;this._setOpacity(i)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;
105let e=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:n8,Style:iS,LngLat:e.bO,LngLatBounds:e.az,Point:e.P,MercatorCoordinate:e.aa,FreeCameraOptions:t6,Evented:e.E,config:e.e,prewarm:e.dM,clearPrewarmedResources:e.dN,get accessToken(){return e.e.ACCESS_TOKEN},set accessToken(t){e.e.ACCESS_TOKEN=t},get baseApiUrl(){return e.e.API_URL},set baseApiUrl(t){e.e.API_URL=t},get workerCount(){return e.dO.workerCount},set workerCount(t){e.dO.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(i){e.dP(i)},get workerUrl(){return e.dQ.workerUrl},set workerUrl(t){e.dQ.workerUrl=t},get workerClass(){return e.dQ.workerClass},set workerClass(t){e.dQ.workerClass=t},get workerParams(){return e.dQ.workerParams},set workerParams(t){e.dQ.workerParams=t},get dracoUrl(){return e.dR()},set dracoUrl(t){e.dS(t)},get meshoptUrl(){return e.dT()},set meshoptUrl(t){e.dU(t)},setNow:e.q.setNow,restoreNow:e.q.restoreNow}}),r},e.exports=i()}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.