var t=1e-6,e="undefined"!=typeof Float32Array?Float32Array:Array;function r(){var t=new e(4);return e!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function n(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r*s-i*n;return a?(t[0]=s*(a=1/a),t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null}function i(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+s*o,t[1]=i*l+a*o,t[2]=n*-o+s*l,t[3]=i*-o+a*l,t}function s(){var t=new e(9);return e!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function o(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=c*a-o*u,p=-c*s+o*l,d=u*s-a*l,f=r*h+n*p+i*d;return f?(t[0]=h*(f=1/f),t[1]=(-c*n+i*u)*f,t[2]=(o*n-i*a)*f,t[3]=p*f,t[4]=(c*r-i*l)*f,t[5]=(-o*r+i*s)*f,t[6]=d*f,t[7]=(-u*r+n*l)*f,t[8]=(a*r-n*s)*f,t):null}function l(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8];return t[0]=a*c-o*u,t[1]=i*u-n*c,t[2]=n*o-i*a,t[3]=o*l-s*c,t[4]=r*c-i*l,t[5]=i*s-r*o,t[6]=s*u-a*l,t[7]=n*l-r*u,t[8]=r*a-n*s,t}function u(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=r[0],d=r[1],f=r[2],m=r[3],y=r[4],g=r[5],x=r[6],v=r[7],b=r[8];return t[0]=p*n+d*a+f*u,t[1]=p*i+d*o+f*c,t[2]=p*s+d*l+f*h,t[3]=m*n+y*a+g*u,t[4]=m*i+y*o+g*c,t[5]=m*s+y*l+g*h,t[6]=x*n+v*a+b*u,t[7]=x*i+v*o+b*c,t[8]=x*s+v*l+b*h,t}function c(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function h(){var t=new e(16);return e!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function p(t){var r=new e(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function d(t,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y){var g=new e(16);return g[0]=t,g[1]=r,g[2]=n,g[3]=i,g[4]=s,g[5]=a,g[6]=o,g[7]=l,g[8]=u,g[9]=c,g[10]=h,g[11]=p,g[12]=d,g[13]=f,g[14]=m,g[15]=y,g}function f(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function m(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],s=e[6],a=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=s,t[11]=e[14],t[12]=i,t[13]=a,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function y(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],y=e[14],g=e[15],x=r*o-n*a,v=r*l-i*a,b=r*u-s*a,w=n*l-i*o,_=n*u-s*o,A=i*u-s*l,I=c*m-h*f,M=c*y-p*f,S=c*g-d*f,P=h*y-p*m,k=h*g-d*m,B=p*g-d*y,z=x*B-v*k+b*P+w*S-_*M+A*I;return z?(t[0]=(o*B-l*k+u*P)*(z=1/z),t[1]=(i*k-n*B-s*P)*z,t[2]=(m*A-y*_+g*w)*z,t[3]=(p*_-h*A-d*w)*z,t[4]=(l*S-a*B-u*M)*z,t[5]=(r*B-i*S+s*M)*z,t[6]=(y*b-f*A-g*v)*z,t[7]=(c*A-p*b+d*v)*z,t[8]=(a*k-o*S+u*I)*z,t[9]=(n*S-r*k-s*I)*z,t[10]=(f*_-m*b+g*x)*z,t[11]=(h*b-c*_-d*x)*z,t[12]=(o*M-a*P-l*I)*z,t[13]=(r*P-n*M+i*I)*z,t[14]=(m*v-f*w-y*x)*z,t[15]=(c*w-h*v+p*x)*z,t):null}function g(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],y=e[13],g=e[14],x=e[15],v=r[0],b=r[1],w=r[2],_=r[3];return t[0]=v*n+b*o+w*h+_*m,t[1]=v*i+b*l+w*p+_*y,t[2]=v*s+b*u+w*d+_*g,t[3]=v*a+b*c+w*f+_*x,t[4]=(v=r[4])*n+(b=r[5])*o+(w=r[6])*h+(_=r[7])*m,t[5]=v*i+b*l+w*p+_*y,t[6]=v*s+b*u+w*d+_*g,t[7]=v*a+b*c+w*f+_*x,t[8]=(v=r[8])*n+(b=r[9])*o+(w=r[10])*h+(_=r[11])*m,t[9]=v*i+b*l+w*p+_*y,t[10]=v*s+b*u+w*d+_*g,t[11]=v*a+b*c+w*f+_*x,t[12]=(v=r[12])*n+(b=r[13])*o+(w=r[14])*h+(_=r[15])*m,t[13]=v*i+b*l+w*p+_*y,t[14]=v*s+b*u+w*d+_*g,t[15]=v*a+b*c+w*f+_*x,t}function x(t,e,r){var n,i,s,a,o,l,u,c,h,p,d,f,m=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*m+e[4]*y+e[8]*g+e[12],t[13]=e[1]*m+e[5]*y+e[9]*g+e[13],t[14]=e[2]*m+e[6]*y+e[10]*g+e[14],t[15]=e[3]*m+e[7]*y+e[11]*g+e[15]):(i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=n=e[0],t[1]=i,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=n*m+o*y+h*g+e[12],t[13]=i*m+l*y+p*g+e[13],t[14]=s*m+u*y+d*g+e[14],t[15]=a*m+c*y+f*g+e[15]),t}function v(t,e,r){var n=r[0],i=r[1],s=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function b(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+u*n,t[5]=a*i+c*n,t[6]=o*i+h*n,t[7]=l*i+p*n,t[8]=u*i-s*n,t[9]=c*i-a*n,t[10]=h*i-o*n,t[11]=p*i-l*n,t}function w(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-u*n,t[1]=a*i-c*n,t[2]=o*i-h*n,t[3]=l*i-p*n,t[8]=s*n+u*i,t[9]=a*n+c*i,t[10]=o*n+h*i,t[11]=l*n+p*i,t}function _(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+u*n,t[1]=a*i+c*n,t[2]=o*i+h*n,t[3]=l*i+p*n,t[4]=u*i-s*n,t[5]=c*i-a*n,t[6]=h*i-o*n,t[7]=p*i-l*n,t}function A(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function I(e,r,n){var i,s,a,o=n[0],l=n[1],u=n[2],c=Math.sqrt(o*o+l*l+u*u);return c0?(g=2*Math.sqrt(y+1),t[3]=.25*g,t[0]=(p-f)/g,t[1]=(d-u)/g,t[2]=(l-c)/g):o>h&&o>m?(g=2*Math.sqrt(1+o-h-m),t[3]=(p-f)/g,t[0]=.25*g,t[1]=(l+c)/g,t[2]=(d+u)/g):h>m?(g=2*Math.sqrt(1+h-o-m),t[3]=(d-u)/g,t[0]=(l+c)/g,t[1]=.25*g,t[2]=(p+f)/g):(g=2*Math.sqrt(1+m-o-h),t[3]=(l-c)/g,t[0]=(d+u)/g,t[1]=(p+f)/g,t[2]=.25*g),t}function P(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r+r,o=n+n,l=i+i,u=r*a,c=n*a,h=n*o,p=i*a,d=i*o,f=i*l,m=s*a,y=s*o,g=s*l;return t[0]=1-h-f,t[1]=c+g,t[2]=p-y,t[3]=0,t[4]=c-g,t[5]=1-u-f,t[6]=d+m,t[7]=0,t[8]=p+y,t[9]=d-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}var k=function(t,e,r,n,i){var s=1/Math.tan(e/2);if(t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){var a=1/(n-i);t[10]=(i+n)*a,t[14]=2*i*n*a}else t[10]=-1,t[14]=-2*n;return t},B=function(t,e,r,n,i,s,a){var o=1/(e-r),l=1/(n-i),u=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*o,t[13]=(i+n)*l,t[14]=(a+s)*u,t[15]=1,t},z=g;function T(){var t=new e(3);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function E(t){var r=new e(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function V(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function F(t,r,n){var i=new e(3);return i[0]=t,i[1]=r,i[2]=n,i}function C(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function D(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function R(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function L(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function O(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function U(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function N(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function j(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function $(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)}function G(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}function q(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function H(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function X(t,e){var r=e[0],n=e[1],i=e[2],s=r*r+n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function Z(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function W(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[0],o=r[1],l=r[2];return t[0]=i*l-s*o,t[1]=s*a-n*l,t[2]=n*o-i*a,t}function Y(t,e,r,n){var i=e[0],s=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=s+n*(r[1]-s),t[2]=a+n*(r[2]-a),t}function K(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[3]*n+r[7]*i+r[11]*s+r[15];return t[0]=(r[0]*n+r[4]*i+r[8]*s+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*i+r[9]*s+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*s+r[14])/a,t}function J(t,e,r){var n=e[0],i=e[1],s=e[2];return t[0]=n*r[0]+i*r[3]+s*r[6],t[1]=n*r[1]+i*r[4]+s*r[7],t[2]=n*r[2]+i*r[5]+s*r[8],t}function Q(t,e,r){var n=r[0],i=r[1],s=r[2],a=r[3],o=e[0],l=e[1],u=e[2],c=i*u-s*l,h=s*o-n*u,p=n*l-i*o;return t[0]=o+a*(c+=c)+i*(p+=p)-s*(h+=h),t[1]=l+a*h+s*c-n*p,t[2]=u+a*p+n*h-i*c,t}function tt(t){return t[0]=0,t[1]=0,t[2]=0,t}function et(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}var rt=R,nt=L,it=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},st=V;function at(){var t=new e(4);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function ot(t,r,n,i){var s=new e(4);return s[0]=t,s[1]=r,s[2]=n,s[3]=i,s}function lt(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function ut(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function ct(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function ht(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r*r+n*n+i*i+s*s;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=s*a,t}function pt(t,e,r,n){var i=e[0],s=e[1],a=e[2],o=e[3];return t[0]=i+n*(r[0]-i),t[1]=s+n*(r[1]-s),t[2]=a+n*(r[2]-a),t[3]=o+n*(r[3]-o),t}function dt(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t}function ft(){var t=new e(4);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function mt(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function yt(e,r){var n=2*Math.acos(r[3]),i=Math.sin(n/2);return i>t?(e[0]=r[0]/i,e[1]=r[1]/i,e[2]=r[2]/i):(e[0]=1,e[1]=0,e[2]=0),n}function gt(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*o,t[1]=i*l+s*o,t[2]=s*l-i*o,t[3]=a*l-n*o,t}function xt(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l-s*o,t[1]=i*l+a*o,t[2]=s*l+n*o,t[3]=a*l-i*o,t}function vt(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*o,t[1]=i*l-n*o,t[2]=s*l+a*o,t[3]=a*l-s*o,t}function bt(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}T(),at();var wt,_t,At,It=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},Mt=ht,St=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},Pt=(wt=T(),_t=F(1,0,0),At=F(0,1,0),function(t,e,r){var n=Z(e,r);return n<-.999999?(W(wt,_t,e),st(wt)<1e-6&&W(wt,At,e),X(wt,wt),function(t,e,r){r*=.5;var n=Math.sin(r);t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r)}(t,wt,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(W(wt,e,r),t[0]=wt[0],t[1]=wt[1],t[2]=wt[2],t[3]=1+n,Mt(t,t))});function kt(){var t=new e(2);return e!=Float32Array&&(t[0]=0,t[1]=0),t}function Bt(t,r){var n=new e(2);return n[0]=t,n[1]=r,n}function zt(t,e,r){return t[0]=e,t[1]=r,t}function Tt(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function Et(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function Vt(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function Ft(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)}function Ct(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function Dt(t,e){return t[0]*e[0]+t[1]*e[1]}ft(),ft(),s();var Rt,Lt,Ot=Et;function Ut(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}kt();var Nt=function(){if(Lt)return Rt;function t(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}return Lt=1,Rt=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Rt}();const jt=Ut(Nt);function $t(t,e){this.x=t,this.y=e}function Gt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Jt(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return{min:new $t(e,r),max:new $t(n,i)}}function Qt(t,e,r){let n=0;for(let r=0;r<2;++r){const i=0;t[r]>i&&(n+=(t[r]-i)*(t[r]-i)),e[r]{e(t,((t,e)=>{t&&(s=t),i[a]=e,0==--n&&r(s,i)}))}))}function le(t,e){const r=[];for(const n in t)n in e||r.push(n);return r}function ue(t,e){const r={};for(let n=0;n>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function de(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log2(t)))}function fe(t){return t<=1?1:Math.pow(2,Math.floor(Math.log2(t)))}function me(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function ye(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function ge(t,e,r){const n={};for(const r in t)n[r]=e.call(this,t[r],r,t);return n}function xe(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}function ve(t){return Array.isArray(t)?t.map(ve):"object"==typeof t&&t?ge(t,ve):t}function be(t,e,r,n,i){return ie((t-e)/(r-e)*(i-n)+n,n,i)}function we(t,e){for(let r=0;r=0)return!0;return!1}const _e={};function Ae(t){_e[t]||("undefined"!=typeof console&&console.warn(t),_e[t]=!0)}function Ie(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Me(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i0?Math.acos(r/n)*Ht:0;let s=0!==t||0!==e?Math.atan2(-e,-t)*Ht+90:0;return s<0&&(s+=360),[n,s,i]}function ke(t){return("undefined"!=typeof self||void 0!==t)&&"undefined"!=typeof WorkerGlobalScope&&(void 0!==t?t:self)instanceof WorkerGlobalScope}function Be(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}function ze(t){return t?{cacheControl:t.get("Cache-Control"),expires:t.get("Expires")}:{cacheControl:void 0,expires:void 0}}let Te=null;function Ee(t){const e=t.navigator?t.navigator.userAgent:null;return!!function(t){if(null==Te){const e=t.navigator?t.navigator.userAgent:null;Te=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Te}(t)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))}function Ve(){return!!document.fullscreenElement||!!document.webkitFullscreenElement}function Fe(t){try{const e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}function Ce(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number("0x"+e)))))}function De(t){return decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join(""))}function Re(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function Le(t,e,r){t[4*e+0]=r[0],t[4*e+1]=r[1],t[4*e+2]=r[2],t[4*e+3]=r[3]}function Oe(t,e){return[Math.pow(t[0],2.2)*e,Math.pow(t[1],2.2)*e,Math.pow(t[2],2.2)*e]}function Ue(t){return[Math.pow(t[0],1/2.2),Math.pow(t[1],1/2.2),Math.pow(t[2],1/2.2)]}function Ne(t,e,r,n){for(;e>1;t[i]>1;t[i]<=n?e=i+1:r=i}return e}function $e(t){return t>0?1/(1.001-t):1+t}function Ge(t){return t>0?1-1/(1.001-t):-t}function qe(t,e,r){return(t-e.min)*(r.max-r.min)/(e.max-e.min)+r.min}function He(t){return t*t*t*t*t}const Xe={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(!Xe.API_URL)return null;try{const t=new URL(Xe.API_URL);return"api.mapbox.cn"===t.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===t.hostname?"https://events.mapbox.com/events/v2":null}catch(t){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",MESHOPT_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",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Ze(t){return Xe.API_URL_REGEX.test(t)}function We(t){return 0===t.indexOf("mapbox:")}function Ye(t){return Xe.API_CDN_URL_REGEX.test(t)}function Ke(t){return Xe.API_SPRITE_REGEX.test(t)}function Je(t){return Xe.API_STYLE_REGEX.test(t)&&!Ke(t)}function Qe(t){return Xe.API_TILEJSON_REGEX.test(t)}function tr(t){return Xe.API_FONTS_REGEX.test(t)}let er,rr,nr,ir,sr,ar;function or(){return null==er&&(er=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),er}const lr={now:()=>void 0!==ir?ir:performance.now(),setNow(t){ir=t},restoreNow(){ir=void 0},frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:r,height:n}=t;sr||(sr=document.createElement("canvas"));const i=sr.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return(r>sr.width||n>sr.height)&&(sr.width=r,sr.height=n),i.clearRect(-e,-e,r+2*e,n+2*e),i.drawImage(t,0,0,r,n),i.getImageData(-e,-e,r+2*e,n+2*e)},resolveURL:t=>(rr||(rr=document.createElement("a")),rr.href=t,rr.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==nr&&(nr=window.matchMedia("(prefers-reduced-motion: reduce)")),nr.matches)},hasCanvasFingerprintNoise(){if(void 0!==ar)return ar;if(!or())return ar=!1,!1;const t=new OffscreenCanvas(85,1),e=t.getContext("2d",{willReadFrequently:!0});let r=0;for(let n=0;n0?`?${s}`:""}`}const hr="mapbox-tiles";let pr=500,dr=50;const fr=["language","worldview","jobid"];let mr,yr;function gr(){try{return caches}catch(t){}}function xr(){const t=gr();t&&null==mr&&(mr=t.open(hr))}let vr=1/0;function br(t){vr++,vr>dr&&(t.getActor().send("enforceCacheSizeLimit",pr),vr=0)}function wr(t){xr(),null!=mr&&mr.then((e=>{e.keys().then((r=>{for(let n=0;nAe(t.message)))})).catch((t=>Ae(t.message)))})).catch((t=>Ae(t.message)))}function _r(t){const e=gr();if(!e)return;const r=e.delete(hr);t&&r.then((()=>t())).catch(t)}function Ar(t,e){pr=t,dr=e}const Ir={supported:!1,testSupport:function(t){!Pr&&Sr&&(kr?zr(t):Mr=t)}};let Mr,Sr,Pr=!1,kr=!1;const Br="undefined"!=typeof self?self:{};function zr(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,Sr),t.isContextLost())return;Ir.supported=!0}catch(t){}t.deleteTexture(e),Pr=!0}Br.document&&(Sr=Br.document.createElement("img"),Sr.onload=function(){Mr&&zr(Mr),Mr=null,kr=!0},Sr.onerror=function(){Pr=!0,Mr=null},Sr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Tr={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(Tr);class Er extends Error{constructor(t,e,r){401===e&&Ze(r)&&(t+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(t),this.status=e,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Vr=ke()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href;const Fr=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(Vr())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:Vr(),referrerPolicy:t.referrerPolicy,signal:r.signal});let i=!1,s=!1;const a=(o=n.url).indexOf("sku=")>0&&Ze(o);var o;"json"===t.type&&n.headers.set("Accept","application/json");const l=(r,i,o)=>{if(s)return;if(r&&"SecurityError"!==r.message&&Ae(r.toString()),i&&o)return u(i);const l=Date.now();fetch(n).then((r=>{if(r.ok){const t=a?r.clone():null;return u(r,t,l)}return e(new Er(r.statusText,r.status,t.url))})).catch((r=>{"AbortError"!==r.name&&e(new Error(`${r.message} ${t.url}`))}))},u=(r,a,o)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{s||(a&&o&&function(t,e,r){if(xr(),null==mr)return;const n=Be(e.headers.get("Cache-Control")||"");if(n["no-store"])return;const i={status:e.status,statusText:e.statusText,headers:new Headers};e.headers.forEach(((t,e)=>i.headers.set(e,t))),n["max-age"]&&i.headers.set("Expires",new Date(r+1e3*n["max-age"]).toUTCString());const s=i.headers.get("Expires");if(!s)return;if(new Date(s).getTime()-r<42e4)return;let a=cr(t.url,{persistentParams:fr});if(206===e.status){const e=t.headers.get("Range");if(!e)return;i.status=200,a=ur(a,{range:e})}!function(t,e){if(void 0===yr)try{new Response(new ReadableStream),yr=!0}catch(t){yr=!1}yr?e(t.body):t.blob().then(e).catch((t=>Ae(t.message)))}(e,(t=>{const r=new Response(200!==(n=e.status)&&404!==n&&[101,103,204,205,304].includes(n)?null:t,i);var n;xr(),null!=mr&&mr.then((t=>t.put(a,r))).catch((t=>Ae(t.message)))}))}(n,a,o),i=!0,e(null,t,r.headers))})).catch((t=>{s||e(new Error(t.message))}))};return a?function(t,e){if(xr(),null==mr)return e(null);mr.then((r=>{let n=cr(t.url,{persistentParams:fr});const i=t.headers.get("Range");i&&(n=ur(n,{range:i})),r.match(n).then((t=>{const i=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),r=Be(t.headers.get("Cache-Control")||"");return Number(e)>Date.now()&&!r["no-cache"]}(t);r.delete(n).catch(e),i&&r.put(n,t.clone()).catch(e),e(null,t,i)})).catch(e)})).catch(e)}(n,l):l(null,null),{cancel:()=>{s=!0,i||r.abort()}}}(t,e);if(ke(self)&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}const i=new Headers;r.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{const e=t.split(": "),r=e.shift(),n=e.join(": ");i.append(r,n)})),e(null,n,i)}else e(new Er(r.statusText,r.status,t.url))},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},Cr=function(t,e){return Fr(Object.assign(t,{type:"json"}),e)},Dr=function(t,e){return Fr(Object.assign(t,{type:"arrayBuffer"}),e)},Rr=function(t,e){return Fr(Object.assign(t,{method:"POST"}),e)},Lr=function(t,e){return Fr(Object.assign(t,{method:"GET"}),e)};function Or(t){const e=document.createElement("a");return e.href=t,e.protocol===location.protocol&&e.host===location.host}const Ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Nr,jr;Nr=[],jr=0;const $r=function(t,e){if(Ir.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),jr>=Xe.MAX_PARALLEL_IMAGE_REQUESTS){const r={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Nr.push(r),r}jr++;let r=!1;const n=()=>{if(!r)for(r=!0,jr--;Nr.length&&jr{n(),t?e(t):r&&(self.createImageBitmap?function(t,e){const r=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(r).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(r,((t,r)=>e(t,r,i))):function(t,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame((()=>{r.src=Ur}))},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(t)],{type:"image/png"});r.src=t.byteLength?URL.createObjectURL(n):Ur}(r,((t,r)=>e(t,r,i))))}));return{cancel:()=>{i.cancel(),n()}}},Gr=function(t,e){const r=document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let e=0;e{}}};var qr,Hr,Xr,Zr={exports:{}},Wr={exports:{}},Yr={exports:{}},Kr=function(){if(Xr)return Zr.exports;Xr=1;var t=(qr||(qr=1,Wr.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),Wr.exports),e=(Hr||(Hr=1,Yr.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),Yr.exports);return Zr.exports=t,Zr.exports.murmur3=t,Zr.exports.murmur2=e,Zr.exports}();const Jr=Ut(Kr);class Qr{constructor(t,...e){Object.assign(this,e[0]||{}),this.type=t}}class tn extends Qr{constructor(t,e={}){super("error",Object.assign({error:t},e))}}function en(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function rn(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}class nn{on(t,e){return this._listeners=this._listeners||{},en(t,e,this._listeners),this}off(t,e){return rn(t,e,this._listeners),rn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},en(t,e,this._oneTimeListeners),this):new Promise((e=>{this.once(t,e)}))}fire(t,e){const r="string"==typeof t?new Qr(t,e):t,n=r.type;if(this.listens(n)){r.target=this;const t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const e of t)e.call(this,r);const e=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const t of e)rn(n,t,this._oneTimeListeners),t.call(this,r);const i=this._eventedParent;if(i){const t="function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData;Object.assign(r,t),i.fire(r)}}else r instanceof tn&&console.error(r.error);return this}listens(t){return!!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}class sn{constructor(t){"string"==typeof t?this.name=t:(this.name=t.name,this.iconsetId=t.iconsetId)}static from(t){return new sn(t)}static toString(t){return t.iconsetId?`${t.name}${t.iconsetId}`:t.name}static parse(t){const[e,r]=t.split("");return new sn({name:e,iconsetId:r})}static isEqual(t,e){return t.name===e.name&&t.iconsetId===e.iconsetId}toString(){return sn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var an,on={},ln=function(){if(an)return on;an=1;var t={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 e(t){return(t=Math.round(t))<0?0:t>255?255:t}function r(t){return e("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function n(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function i(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{on.parseCSSColor=function(s){var a,o=s.replace(/ /g,"").toLowerCase();if(o in t)return t[o].slice();if("#"===o[0])return 4===o.length?(a=parseInt(o.substr(1),16))>=0&&a<=4095?[(3840&a)>>4|(3840&a)>>8,240&a|(240&a)>>4,15&a|(15&a)<<4,1]:null:7===o.length&&(a=parseInt(o.substr(1),16))>=0&&a<=16777215?[(16711680&a)>>16,(65280&a)>>8,255&a,1]:null;var l=o.indexOf("("),u=o.indexOf(")");if(-1!==l&&u+1===o.length){var c=o.substr(0,l),h=o.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=n(h.pop());case"rgb":return 3!==h.length?null:[r(h[0]),r(h[1]),r(h[2]),p];case"hsla":if(4!==h.length)return null;p=n(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,f=n(h[1]),m=n(h[2]),y=m<=.5?m*(f+1):m+f-m*f,g=2*m-y;return[e(255*i(g,y,d+1/3)),e(255*i(g,y,d)),e(255*i(g,y,d-1/3)),p];default:return null}}return null}}catch(t){}return on}();class un{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n}static parse(t){if(!t)return;if(t instanceof un)return t;if("string"!=typeof t)return;const e=ln.parseCSSColor(t);return e?new un(e[0]/255,e[1]/255,e[2]/255,e[3]):void 0}toString(){const[t,e,r,n]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*t)},${Math.round(255*e)},${Math.round(255*r)},${n})`}toNonPremultipliedRenderColor(t){const{r:e,g:r,b:n,a:i}=this;return new hn(t,e,r,n,i)}toPremultipliedRenderColor(t){const{r:e,g:r,b:n,a:i}=this;return new pn(t,e*i,r*i,n*i,i)}clone(){return new un(this.r,this.g,this.b,this.a)}}class cn{constructor(t,e,r,n,i,s=!1){if(this.premultiplied=!1,this.premultiplied=s,t){const s=t.image.height,a=s*s;this.premultiplied?(e=0===i?0:e/i*(s-1),r=0===i?0:r/i*(s-1),n=0===i?0:n/i*(s-1)):(e*=s-1,r*=s-1,n*=s-1);const o=Math.floor(e),l=Math.floor(r),u=Math.floor(n),c=Math.ceil(e),h=Math.ceil(r),p=Math.ceil(n),d=e-o,f=r-l,m=n-u,y=t.image.data,g=4*(o+l*a+u*s),x=4*(o+l*a+p*s),v=4*(o+h*a+u*s),b=4*(o+h*a+p*s),w=4*(c+l*a+u*s),_=4*(c+l*a+p*s),A=4*(c+h*a+u*s),I=4*(c+h*a+p*s);if(g<0||I>=y.length)throw new Error("out of range");this.r=dn(dn(dn(y[g],y[x],m),dn(y[v],y[b],m),f),dn(dn(y[w],y[_],m),dn(y[A],y[I],m),f),d)/255*(this.premultiplied?i:1),this.g=dn(dn(dn(y[g+1],y[x+1],m),dn(y[v+1],y[b+1],m),f),dn(dn(y[w+1],y[_+1],m),dn(y[A+1],y[I+1],m),f),d)/255*(this.premultiplied?i:1),this.b=dn(dn(dn(y[g+2],y[x+2],m),dn(y[v+2],y[b+2],m),f),dn(dn(y[w+2],y[_+2],m),dn(y[A+2],y[I+2],m),f),d)/255*(this.premultiplied?i:1),this.a=i}else this.r=e,this.g=r,this.b=n,this.a=i}toArray(){const{r:t,g:e,b:r,a:n}=this;return[255*t,255*e,255*r,n]}toHslaArray(){let{r:t,g:e,b:r,a:n}=this;if(this.premultiplied){if(0===n)return[0,0,0,0];const i=1/n;t*=i,e*=i,r*=i}const i=Math.min(Math.max(t,0),1),s=Math.min(Math.max(e,0),1),a=Math.min(Math.max(r,0),1),o=Math.min(i,s,a),l=Math.max(i,s,a),u=l-o,c=.5*(o+l);if(0===u)return[0,0,100*c,n];const h=c>.5?u/(2-l-o):u/(l+o);let p;switch(l){case i:p=60*((s-a)/u+(sdn(t,e[n],r)))}un.black=new un(0,0,0,1),un.white=new un(1,1,1,1),un.transparent=new un(0,0,0,0),un.red=new un(1,0,0,1),un.blue=new un(0,0,1,1);const mn=Object.freeze(Object.defineProperty({__proto__:null,array:fn,color:function(t,e,r){return new un(dn(t.r,e.r,r),dn(t.g,e.g,r),dn(t.b,e.b,r),dn(t.a,e.a,r))},number:dn},Symbol.toStringTag,{value:"Module"}));class yn extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class gn{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new gn(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const xn={kind:"null"},vn={kind:"number"},bn={kind:"string"},wn={kind:"boolean"},_n={kind:"color"},An={kind:"object"},In={kind:"value"},Mn={kind:"collator"},Sn={kind:"formatted"},Pn={kind:"resolvedImage"};function kn(t,e){return{kind:"array",itemType:t,N:e}}function Bn(t){if("array"===t.kind){const e=Bn(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const zn=[xn,vn,bn,wn,_n,Sn,An,kn(In),Pn];function Tn(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Tn(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of zn)if(!Tn(t,e))return null}return`Expected ${Bn(t)} but found ${Bn(e)} instead.`}function En(t,e){return e.some((e=>e.kind===t.kind))}function Vn(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function Fn(t,e){return"array"===t.kind&&"array"===e.kind?t.N===e.N&&Fn(t.itemType,e.itemType):t.kind===e.kind}class Cn{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Dn{constructor(t,e,r,n,i){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i}}class Rn{constructor(t){this.sections=t}static fromString(t){return new Rn([new Dn(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||!!t.image&&t.image.hasPrimary()))}static factory(t){return t instanceof Rn?t:Rn.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){const r=e.image.getPrimary().id.toString();t.push(["image",r]);continue}t.push(e.text);const r={};e.fontStack&&(r["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(r["font-scale"]=e.scale),e.textColor&&(r["text-color"]=["rgba"].concat(e.textColor.toNonPremultipliedRenderColor(null).toArray())),t.push(r)}return t}}class Ln{constructor(t,e={}){this.id=sn.from(t),this.params=e.params,this.sx=e.sx||1,this.sy=e.sy||1}toString(){return JSON.stringify(this)}static parse(t){let e,r,n,i;try{({id:e,params:r,sx:n,sy:i}=JSON.parse(t)||{})}catch(t){return null}return e?new Ln(e,{params:r,sx:n,sy:i}):null}scaleSelf(t,e=t){return this.sx*=t,this.sy*=e,this}}class On{constructor(t,e,r,n,i=!1){this.primaryId=sn.from(t),this.primaryOptions=e,r&&(this.secondaryId=sn.from(r)),this.secondaryOptions=n,this.available=i}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Ln(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Ln(this.secondaryId,this.secondaryOptions):null}static from(t){return"string"==typeof t?On.build({name:t}):t}static build(t,e,r,n){return!t||"object"==typeof t&&!("name"in t)?null:new On(t,r,e,n)}}function Un(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Nn(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof un)return!0;if(t instanceof Cn)return!0;if(t instanceof Rn)return!0;if(t instanceof On)return!0;if(Array.isArray(t)){for(const e of t)if(!Nn(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Nn(t[e]))return!1;return!0}return!1}function jn(t){if(null===t)return xn;if("string"==typeof t)return bn;if("boolean"==typeof t)return wn;if("number"==typeof t)return vn;if(t instanceof un)return _n;if(t instanceof Cn)return Mn;if(t instanceof Rn)return Sn;if(t instanceof On)return Pn;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=jn(e);if(r){if(r===t)continue;r=In;break}r=t}return kn(r||In,e)}return An}function $n(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Rn||t instanceof On||t instanceof un?t.toString():JSON.stringify(t)}class Gn{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Nn(t[1]))return e.error("invalid value");const r=t[1];let n=jn(r);const i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new Gn(n,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 un?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Rn?this.value.serialize():this.value}}class qn{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Hn={string:bn,number:vn,boolean:wn,object:An};class Xn{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in Hn)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=Hn[r],n++}else i=In;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=kn(i,s)}else r=Hn[i];const s=[];for(;nt.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}class Zn{constructor(t){this.type=Sn,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parseObjectValue(s["font-scale"],r,"font-scale",vn),!t))return null;let a=null;if(s["text-font"]&&(a=e.parseObjectValue(s["text-font"],r,"text-font",kn(bn)),!a))return null;let o=null;if(s["text-color"]&&(o=e.parseObjectValue(s["text-color"],r,"text-color",_n),!o))return null;const l=n[n.length-1];l.scale=t,l.font=a,l.textColor=o}else{const s=e.parse(t[r],r,In);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new Zn(n)}evaluate(t){return new Rn(this.sections.map((e=>{const r=e.content.evaluate(t);return Fn(jn(r),Pn)?new Dn("",r,null,null,null):new Dn($n(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const r={};e.scale&&(r["font-scale"]=e.scale.serialize()),e.font&&(r["text-font"]=e.font.serialize()),e.textColor&&(r["text-color"]=e.textColor.serialize()),t.push(r)}return t}}class Wn{constructor(t,e,r,n){this._imageWarnHistory={},this.type=Pn,this.namePrimary=t,this.nameSecondary=e,r&&(this.paramsPrimary=r.params,this.iconsetIdPrimary=r.iconset?r.iconset.id:void 0),n&&(this.paramsSecondary=n.params,this.iconsetIdSecondary=n.iconset?n.iconset.id:void 0)}static parse(t,e){if(t.length<2)return e.error("Expected two or more arguments.");let r=1;const n=[];function i(){if(rsn.isEqual(t,e))),n.available){const e=n.getSecondary()?n.getSecondary().id:null;e&&(n.available=t.availableImages.some((t=>sn.isEqual(t,e))))}}return n}eachChild(t){if(t(this.namePrimary),this.paramsPrimary)for(const e in this.paramsPrimary)this.paramsPrimary[e]&&t(this.paramsPrimary[e]);if(this.nameSecondary&&(t(this.nameSecondary),this.paramsSecondary))for(const e in this.paramsSecondary)this.paramsSecondary[e]&&t(this.paramsSecondary[e])}outputDefined(){return!1}serializeOptions(t,e){const r={};if(e&&(r.iconset={id:e}),t){r.params={};for(const e in t)t[e]&&(r.params[e]=t[e].serialize())}return Object.keys(r).length>0?r:void 0}serialize(){const t=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const e=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);e&&t.push(e)}if(this.nameSecondary&&(t.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const e=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);e&&t.push(e)}return t}}function Yn(t){return Jn(t)?"string":Qn(t)?"number":ti(t)?"boolean":Array.isArray(t)?"array":null===t?"null":Kn(t)?"object":typeof t}function Kn(t){return null!=t&&!Array.isArray(t)&&"function"!=typeof t&&!(t instanceof String||t instanceof Number||t instanceof Boolean)&&"object"==typeof t}function Jn(t){return"string"==typeof t||t instanceof String}function Qn(t){return"number"==typeof t||t instanceof Number}function ti(t){return"boolean"==typeof t||t instanceof Boolean}const ei={"to-boolean":wn,"to-color":_n,"to-number":vn,"to-string":bn};class ri{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0],n=[];let i=xn;if("to-array"===r){if(!Array.isArray(t[1]))return null;const r=t[1].length;if(e.expectedType){if("array"!==e.expectedType.kind)return e.error(`Expected ${e.expectedType.kind} but found array.`);i=kn(e.expectedType.itemType,r)}else{if(!(r>0&&Nn(t[1][0])))return null;i=kn(jn(t[1][0]),r)}for(let s=0;s4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Un(e[0],e[1],e[2],e[3]),!r))return new un(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new qn(r||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new qn(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Rn.fromString($n(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?On.build($n(this.args[0].evaluate(t))):"array"===this.type.kind?this.args.map((e=>e.evaluate(t))):$n(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Zn([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Wn(this.args[0]).serialize();const t="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}const ni=["Unknown","Point","LineString","Polygon"];class ii{constructor(t,e,r){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=t,this.options=e,this.iconImageUseTheme=r}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ni[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(t){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:r,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*e-t[0])+this.featureDistanceData.bearing[1]*(n*e-t[1])}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=un.parse(t)),e}getConfig(t){return this.options?this.options.get(t):null}}class si{constructor(t,e,r,n,i){this.name=t,this.type=e,this._evaluate=r,this.args=n,this._overloadIndex=i}evaluate(t){if(!this._evaluate){const t=si.definitions[this.name];this._evaluate=Array.isArray(t)?t[2]:t.overloads[this._overloadIndex][1]}return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const r=t[0],n=si.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=[];let o=null,l=-1;for(const[n,u]of s){if(Array.isArray(n)&&n.length!==t.length-1)continue;a.push(n),l++,o=new Ms(e.registry,e.path,null,e.scope,void 0,e._scope,e.options,e.iconImageUseTheme);const s=[];let c=!1;for(let e=1;et))).map(ai).join(" | "),n=[];for(let r=1;rr;){if(n-r>600){const s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);li(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i)}const s=t[e];let a=r,o=n;for(ui(t,r,e),i(t[n],s)>0&&ui(t,r,n);a0;)o--}0===i(t[r],s)?ui(t,r,o):(o++,ui(t,o,n)),o<=e&&(r=o+1),e<=o&&(n=o-1)}}function ui(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function ci(t,e){return te?1:0}function hi(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i=e[2]||t[1]<=e[1]||t[3]>=e[3])}function fi(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function mi(t,e,r=!1){let n=!1;for(let o=0,l=e.length;o(i=t)[1]!=(a=c)[1]>i[1]&&i[0]<(a[0]-s[0])*(i[1]-s[1])/(a[1]-s[1])+s[0]&&(n=!n)}}var i,s,a;return n}function yi(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function gi(t,e,r,n){return 0!=(i=[n[0]-r[0],n[1]-r[1]])[0]*(s=[e[0]-t[0],e[1]-t[1]])[1]-i[1]*s[0]&&!(!yi(t,e,r,n)||!yi(r,n,t,e));var i,s}function xi(t){const e=new $t(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new $t(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of t[0])e.x>n.x&&(e.x=n.x),e.y>n.y&&(e.y=n.y),r.xr[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}pi(e,t)}function ki(t,e,r,n){const i=Math.pow(2,n.z)*vi,s=[n.x*vi,n.y*vi],a=[];if(!t)return a;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Pi(n,e,r,i),a.push(n)}return a}function Bi(t,e,r,n){const i=Math.pow(2,n.z)*vi,s=[n.x*vi,n.y*vi],a=[];if(!t)return a;for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];pi(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)Pi(n,e,r,i)}var o;return a}class zi{constructor(t,e){this.type=wn,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Nn(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;te)return Ri(i,s,(e-(r-a))/a)}return t[t.length-1]}pointToSegmentDistance(t,e,r){let[n,i]=e,s=Li(r[0]-n)*this.kx,a=(r[1]-i)*this.ky;if(0!==s||0!==a){const e=(Li(t[0]-n)*this.kx*s+(t[1]-i)*this.ky*a)/(s*s+a*a);e>1?(n=r[0],i=r[1]):e>0&&(n+=s/this.kx*e,i+=a/this.ky*e)}return s=Li(t[0]-n)*this.kx,a=(t[1]-i)*this.ky,Math.sqrt(s*s+a*a)}pointOnLine(t,e){let r=1/0,n=t[0][0],i=t[0][1],s=0,a=0;for(let o=0;o1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=c/this.kx*p,u+=h/this.ky*p)),c=Li(e[0]-l)*this.kx,h=(e[1]-u)*this.ky;const d=c*c+h*h;di.index||n.index===i.index&&n.t>i.t){const t=n;n=i,i=t}const s=[n.point],a=n.index+1,o=i.index;!Di(r[a],s[0])&&a<=o&&s.push(r[a]);for(let t=a+1;t<=o;t++)s.push(r[t]);return Di(r[o],i.point)||s.push(i.point),s}lineSliceAlong(t,e,r){let n=0;const i=[];for(let s=0;st&&0===i.length&&i.push(Ri(a,o,(t-(n-l))/l)),n>=e)return i.push(Ri(a,o,(e-(n-l))/l)),i;n>t&&i.push(o)}return i}bufferPoint(t,e){const r=e/this.ky,n=e/this.kx;return[t[0]-n,t[1]-r,t[0]+n,t[1]+r]}bufferBBox(t,e){const r=e/this.ky,n=e/this.kx;return[t[0]-n,t[1]-r,t[2]+n,t[3]+r]}insideBBox(t,e){return Li(t[0]-e[0])>=0&&Li(t[0]-e[2])<=0&&t[1]>=e[1]&&t[1]<=e[3]}}function Di(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ri(t,e,r){const n=Li(e[0]-t[0]);return[t[0]+n*r,t[1]+(e[1]-t[1])*r]}function Li(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}class Oi{constructor(t=[],e=((t,e)=>te?1:0)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t=0)break;e[t]=e[n],t=n}e[t]=i}}const Ui=8192;function Ni(t,e){return e.dist-t.dist}const ji=100,$i=50;function Gi(t){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==t.length)return!1;for(let r=0;r=t[0]&&t[1]t[1])return[null,null];const r=qi(t);if(e){if(2===r)return[t,null];const e=Math.floor(r/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}{if(1===r)return[t,null];const e=Math.floor(r/2)-1;return[[t[0],t[0]+e],[t[0]+e+1,t[1]]]}}function Zi(t,e){const r=[1/0,1/0,-1/0,-1/0];if(!Hi(e,t.length))return r;for(let n=e[0];n<=e[1];++n)pi(r,t[n]);return r}function Wi(t){const e=[1/0,1/0,-1/0,-1/0];for(let r=0;re[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]=n)return n;if(di(i,s)){if(ls(t,e))return 0}else if(ls(e,t))return 0;let a=n;for(const n of t)for(let t=0,i=n.length,s=i-1;t=s)continue;const u=i.range1;if(qi(u)<=o){if(!Hi(u,t.length))return NaN;if(e){const e=os(t,u,r,n);if(0===(s=Math.min(s,e)))return s}else for(let e=u[0];e<=u[1];++e){const i=as(t[e],r,n);if(0===(s=Math.min(s,i)))return s}}else{const r=Xi(u,e);if(null!==r[0]){const e=Yi(Zi(t,r[0]),l,n);e=a)continue;const c=s.range1,h=s.range2;if(qi(c)<=l&&qi(h)<=u){if(!Hi(c,t.length)||!Hi(h,r.length))return NaN;if(e&&n?a=Math.min(a,is(t,c,r,h,i)):e||n?e&&!n?a=Math.min(a,rs(r,h,t,c,i)):!e&&n&&(a=Math.min(a,rs(t,c,r,h,i))):a=Math.min(a,ss(t,c,r,h,i)),0===a)return a}else{const s=Xi(c,e),l=Xi(h,n);cs(o,a,i,t,r,s[0],l[0]),cs(o,a,i,t,r,s[0],l[1]),cs(o,a,i,t,r,s[1],l[0]),cs(o,a,i,t,r,s[1],l[1])}}return a}function ds(t,e,r,n,i=1/0){let s=i;const a=Zi(t,[0,t.length-1]);for(const i of r)if(!(s!==1/0&&Yi(a,Zi(i,[0,i.length-1]),n)>=s)&&(s=Math.min(s,ps(t,e,i,!0,n,s)),0===s))return s;return s}function fs(t,e,r,n,i=1/0){let s=i;const a=Zi(t,[0,t.length-1]);for(const i of r){if(s!==1/0&&Yi(a,Wi(i),n)>=s)continue;const r=hs(t,e,i,n,s);if(isNaN(r))return r;if(0===(s=Math.min(s,r)))return s}return s}function ms(t){return"Point"===t||"MultiPoint"===t||"LineString"===t||"MultiLineString"===t||"Polygon"===t||"MultiPolygon"===t}class ys{constructor(t,e){this.type=vn,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires either one argument, but found ' ${t.length-1} instead.`);if(Nn(t[1])){const e=t[1];if("FeatureCollection"===e.type){for(let t=0;t{e&&!gs(t)&&(e=!1)})),e}function xs(t){if(t instanceof si&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!xs(t)&&(e=!1)})),e}function vs(t,e){if(t instanceof si&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!vs(t,e)&&(r=!1)})),r}function bs(t,e,r){return[t,e,r].filter(Boolean).join("")}function ws(t,e){switch(t){case"string":return $n(e);case"number":return+e;case"boolean":return!!e;case"color":return un.parse(e);case"formatted":return Rn.fromString($n(e));case"resolvedImage":return On.build($n(e))}return e}function _s(t,e,r,n){return void 0!==n&&(t=n*Math.round(t/n)),void 0!==e&&tr&&(t=r),t}class As{constructor(t,e,r,n=!1){this.type=t,this.key=e,this.scope=r,this.featureConstant=n}static parse(t,e){let r=e.expectedType;if(null==r&&(r=In),t.length<2||t.length>3)return e.error("Invalid number of arguments for 'config' expression.");const n=e.parse(t[1],1);if(!(n instanceof Gn))return e.error("Key name of 'config' expression must be a string literal.");let i,s=!0;const a=$n(n.value);if(t.length>=3){const r=e.parse(t[2],2);if(!(r instanceof Gn))return e.error("Scope of 'config' expression must be a string literal.");i=$n(r.value)}if(e.options){const t=bs(a,i,e._scope),r=e.options.get(t);r&&(s=gs(r.value||r.default))}return new As(r,a,i,s)}evaluate(t){const e=bs(this.key,this.scope,t.scope),r=t.getConfig(e);if(!r)return null;const{type:n,value:i,values:s,minValue:a,maxValue:o,stepValue:l}=r,u=r.default.evaluate(t);let c=u;if(i){const e=t.scope;t.scope=(e||"").split("").slice(1).join(""),c=i.evaluate(t),t.scope=e}return n&&(c=ws(n,c)),void 0===c||void 0===a&&void 0===o&&void 0===l||("number"==typeof c?c=_s(c,a,o,l):Array.isArray(c)&&(c=c.map((t=>"number"==typeof t?_s(t,a,o,l):t)))),void 0!==i&&void 0!==c&&s&&!s.includes(c)&&(c=u,n&&(c=ws(n,c))),(n&&n!==this.type||void 0!==c&&!Fn(jn(c),this.type))&&(c=ws(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){const t=["config",this.key];return this.scope&&t.concat(this.scope),t}}class Is{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new Is(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ms{constructor(t,e=[],r,n=new gn,i=[],s,a,o){this.registry=t,this.path=e,this.key=e.map((t=>"string"==typeof t?`['${t}']`:`[${t}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r,this._scope=s,this.options=a,this.iconImageUseTheme=o}parse(t,e,r,n,i={}){return e||r?this.concat(e,null,r,n)._parse(t,i):this._parse(t,i)}parseObjectValue(t,e,r,n,i,s={}){return this.concat(e,r,n,i)._parse(t,s)}_parse(t,e){function r(t,e,r){return"assert"===r?new Xn(e,[t]):"coerce"===r?new ri(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n="string"==typeof t[0]?this.registry[t[0]]:void 0;if(n){let i=n.parse(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,n=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(t,n))return null}else i=r(i,t,e.typeAnnotation||"coerce");else i=r(i,t,e.typeAnnotation||"assert")}if(!(i instanceof Gn)&&"resolvedImage"!==i.type.kind&&Ss(i)){const t=new ii(this._scope,this.options,this.iconImageUseTheme);try{i=new Gn(i.type,i.evaluate(t))}catch(t){return this.error(t.message),null}}return i}return ri.parse(["to-array",t],this)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r,n){let i="number"==typeof t?this.path.concat(t):this.path;i="string"==typeof e?i.concat(e):i;const s=n?this.scope.concat(n):this.scope;return new Ms(this.registry,i,r||null,s,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new yn(r,t))}checkSubtype(t,e){const r=Tn(t,e);return r&&this.error(r),r}}function Ss(t){if(t instanceof Is)return Ss(t.boundExpression);if(t instanceof si&&"error"===t.name)return!1;if(t instanceof oi)return!1;if(t instanceof zi)return!1;if(t instanceof ys)return!1;if(t instanceof As)return!1;const e=t instanceof ri||t instanceof Xn;let r=!0;return t.eachChild((t=>{r=e?r&&Ss(t):r&&t instanceof Gn})),!!r&&gs(t)&&vs(t,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Ps(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||ee))throw new qn("Input is not a number.");a=o-1}return 0}class ks{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,vn);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new ks(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ps(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}const Bs=.95047,zs=1.08883,Ts=4/29,Es=6/29,Vs=3*Es*Es,Fs=Es*Es*Es,Cs=Math.PI/180,Ds=180/Math.PI;function Rs(t){return t>Fs?Math.pow(t,1/3):t/Vs+Ts}function Ls(t){return t>Es?t*t*t:Vs*(t-Ts)}function Os(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Us(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ns(t){const e=Us(t.r),r=Us(t.g),n=Us(t.b),i=Rs((.4124564*e+.3575761*r+.1804375*n)/Bs),s=Rs((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Rs((.0193339*e+.119192*r+.9503041*n)/zs)),alpha:t.a}}function js(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Ls(e),r=Bs*Ls(r),n=zs*Ls(n),new un(Os(3.2404542*r-1.5371385*e-.4985314*n),Os(-.969266*r+1.8760108*e+.041556*n),Os(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function $s(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const Gs={forward:Ns,reverse:js,interpolate:function(t,e,r){return{l:dn(t.l,e.l,r),a:dn(t.a,e.a,r),b:dn(t.b,e.b,r),alpha:dn(t.alpha,e.alpha,r)}}},qs={forward:function(t){const{l:e,a:r,b:n}=Ns(t),i=Math.atan2(n,r)*Ds;return{h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Cs,r=t.c;return js({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:$s(t.h,e.h,r),c:dn(t.c,e.c,r),l:dn(t.l,e.l,r),alpha:dn(t.alpha,e.alpha,r)}}},Hs=Object.freeze(Object.defineProperty({__proto__:null,hcl:qs,lab:Gs},Symbol.toStringTag,{value:"Module"}));class Xs{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,r,n){let i=0;if("exponential"===t.name)i=Zs(e,t.base,r,n);else if("linear"===t.name)i=Zs(e,1,r,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new jt(s[0],s[1],s[2],s[3]).solve(Zs(e,1,r,n))}return i}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length-1>3&&(t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,vn),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=_n:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u])}return"number"===o.kind||"color"===o.kind||"array"===o.kind&&"number"===o.itemType.kind&&"number"==typeof o.N?new Xs(o,r,n,i,a):e.error(`Type ${Bn(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Ps(e,n),a=Xs.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);return"interpolate"===this.operator?mn[this.type.kind.toLowerCase()](o,l,a):"interpolate-hcl"===this.operator?qs.reverse(qs.interpolate(qs.forward(o),qs.forward(l),a)):Gs.reverse(Gs.interpolate(Gs.forward(o),Gs.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const e=[this.operator,t,this.input.serialize()];for(let t=0;tTn(n,t.type)));return new Ws(s?In:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(t),r&&r instanceof On&&!r.available&&(e||(e=r),r=null,n===this.args.length))return e;if(null!==r)break}return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class Ys{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n=r.length)throw new qn("Array index out of bounds: index exceeds array size");if(e!==Math.floor(e))throw new qn("Array index must be an integer. Use at-interpolated for fractional indices");return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Js{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,vn),n=e.parse(t[2],2,kn(e.expectedType||In));return r&&n?new Js(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new qn(`Array index out of bounds: ${e} < 0.`);if(e>r.length-1)throw new qn(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e===Math.floor(e))return r[e];const n=Math.floor(e),i=Math.ceil(e),s=r[n],a=r[i];if("number"!=typeof s||"number"!=typeof a)throw new qn(`Cannot interpolate between non-number values at index ${e}.`);const o=e-n;return s*(1-o)+a*o}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Qs{constructor(t,e){this.type=wn,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,In),n=e.parse(t[2],2,In);return r&&n?En(r.type,[wn,bn,vn,xn,In])?new Qs(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Bn(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(null==r)return!1;if(!Vn(e,["boolean","string","number","null"]))throw new qn(`Expected first argument to be of type boolean, string, number or null, but found ${Bn(jn(e))} instead.`);if(!Vn(r,["string","array"]))throw new qn(`Expected second argument to be of type array or string, but found ${Bn(jn(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class ta{constructor(t,e,r){this.type=vn,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,In),n=e.parse(t[2],2,In);if(!r||!n)return null;if(!En(r.type,[wn,bn,vn,xn,In]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Bn(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,vn);return i?new ta(r,n,i):null}return new ta(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Vn(e,["boolean","string","number","null"]))throw new qn(`Expected first argument to be of type boolean, string, number or null, but found ${Bn(jn(e))} instead.`);if(!Vn(r,["string","array"]))throw new qn(`Expected second argument to be of type array or string, but found ${Bn(jn(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class ea{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;aNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,jn(t)))return null}else r=jn(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c)}const a=e.parse(t[1],1,In);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new ea(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return(Fn(jn(e),this.inputType)&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),r=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=r.length,r.push([this.cases[t],[t]])):r[e][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of r)t.push(1===n.length?i(n[0]):n.map(i)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class ra{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;ie.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class na{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,In),n=e.parse(t[2],2,vn);if(!r||!n)return null;if(!En(r.type,[kn(In),bn,In]))return e.error(`Expected first argument to be of type array or string, but found ${Bn(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,vn);return i?new na(r.type,r,n,i):null}return new na(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Vn(e,["string","array"]))throw new qn(`Expected first argument to be of type array or string, but found ${Bn(jn(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class ia{constructor(t,e){this.type=kn(bn),this.str=t,this.delimiter=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,bn),n=e.parse(t[2],2,bn);return r&&n?new ia(r,n):void 0}evaluate(t){const e=this.str.evaluate(t),r=this.delimiter.evaluate(t);return e.split(r)}eachChild(t){t(this.str),t(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function sa(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function aa(t,e,r,n){return 0===n.compare(e,r)}function oa(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=wn,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,In);if(!s)return null;if(!sa(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${Bn(s.type)}'.`);let a=e.parse(t[2],2,In);if(!a)return null;if(!sa(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${Bn(a.type)}'.`);if(s.type.kind!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${Bn(s.type)}' and '${Bn(a.type)}'.`);n&&("value"===s.type.kind&&"value"!==a.type.kind?s=new Xn(a.type,[s]):"value"!==s.type.kind&&"value"===a.type.kind&&(a=new Xn(s.type,[a])));let o=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(o=e.parse(t[3],3,Mn),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=jn(s),r=jn(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new qn(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=jn(s),r=jn(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const la=oa("==",(function(t,e,r){return e===r}),aa),ua=oa("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!aa(0,e,r,n)})),ca=oa("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),pa=oa("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),da=oa(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class fa{constructor(t,e,r,n,i,s){this.type=bn,this.number=t,this.locale=e,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,vn);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parseObjectValue(n.locale,2,"locale",bn),!i))return null;let s=null;if(n.currency&&(s=e.parseObjectValue(n.currency,2,"currency",bn),!s))return null;let a=null;if(n.unit&&(a=e.parseObjectValue(n.unit,2,"unit",bn),!a))return null;let o=null;if(n["min-fraction-digits"]&&(o=e.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",vn),!o))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",vn),!l)?null:new fa(r,i,s,a,o,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class ma{constructor(t){this.type=vn,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${Bn(r.type)} instead.`):new ma(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new qn(`Expected value to be of type string or array, but found ${Bn(jn(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}function ya(t){return function(){t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const ga={"==":la,"!=":ua,">":ha,"<":ca,">=":da,"<=":pa,array:Xn,at:Ks,"at-interpolated":Js,boolean:Xn,case:ra,coalesce:Ws,collator:oi,format:Zn,image:Wn,in:Qs,"index-of":ta,interpolate:Xs,"interpolate-hcl":Xs,"interpolate-lab":Xs,length:ma,let:Ys,literal:Gn,match:ea,number:Xn,"number-format":fa,object:Xn,slice:na,step:ks,string:Xn,"to-boolean":ri,"to-color":ri,"to-number":ri,"to-string":ri,var:Is,within:zi,distance:ys,config:As,split:ia};function xa(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=Un(e,r,n,s);if(a)throw new qn(a);return new un(e/255,r/255,n/255,s)}function va(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=function(t,e,r,n){return"number"==typeof t&&t>=0&&t<=360?"number"==typeof e&&e>=0&&e<=100&&"number"==typeof r&&r>=0&&r<=100?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid hsla value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'h' must be between 0 and 360.`}(e,r,n,s);if(a)throw new qn(a);const o=`hsla(${e}, ${r}%, ${n}%, ${s})`,l=un.parse(o);if(!l)throw new qn(`Failed to parse HSLA color: ${o}`);return l}function ba(t,e){return t in e}function wa(t,e){const r=e[t];return void 0===r?null:r}function _a(t){return{type:t}}function Aa(t){if(t instanceof As)return new Set([t.key]);let e=new Set;return t.eachChild((t=>{e=new Set([...e,...Aa(t)])})),e}function Ia(t){if(t instanceof si&&"is-active-floor"===t.name)return!0;let e=!1;return t.eachChild((t=>{!e&&Ia(t)&&(e=!0)})),e}function Ma(t){return{result:"success",value:t}}function Sa(t){return{result:"error",value:t}}function Pa(t,e){return!!t&&!!t.parameters&&t.parameters.indexOf(e)>-1}function ka(t){return"data-driven"===t["property-type"]}function Ba(t){return Pa(t.expression,"measure-light")}function za(t){return Pa(t.expression,"zoom")}function Ta(t){return!!t.expression&&t.expression.interpolated}function Ea(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Va(t){return t}function Fa(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Ta(e)?"exponential":"interval");if(r&&((t=Object.assign({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],un.parse(t[1])]))),t.default=un.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Hs[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,o,l;if("exponential"===s)a=La;else if("interval"===s)a=Ra;else if("categorical"===s){a=Da,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=Oa}if(n){const r={},n=[];for(let e=0;et[0])),evaluate:({zoom:r},n)=>La({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:Xs.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(t,e,r,o,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Ca(t.default,e.default):a(t,e,i,o,l)}}}function Ca(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Da(t,e,r,n,i){return Ca(typeof r===i?n[r]:void 0,t.default,e.default)}function Ra(t,e,r){if(!Qn(r))return Ca(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Ps(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function La(t,e,r){const n=void 0!==t.base?t.base:1;if(!Qn(r))return Ca(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=Ps(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1];let u=mn[e.type]||Va;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Hs[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),a))}return"function"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,a)}}:u(o,l,a)}function Oa(t,e,r){return"color"===e.type?r=un.parse(r):"formatted"===e.type?r=Rn.fromString(r.toString()):"resolvedImage"===e.type?r=On.build(r.toString()):Yn(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Ca(r,t.default,e.default)}si.register(ga,{error:[{kind:"error"},[bn],(t,[e])=>{throw new qn(e.evaluate(t))}],typeof:[bn,[In],(t,[e])=>Bn(jn(e.evaluate(t)))],"to-rgba":[kn(vn,4),[_n],(t,[e])=>e.evaluate(t).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[kn(vn,4),[_n],(t,[e])=>e.evaluate(t).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[_n,[vn,vn,vn],xa],rgba:[_n,[vn,vn,vn,vn],xa],hsl:[_n,[vn,vn,vn],va],hsla:[_n,[vn,vn,vn,vn],va],has:{type:wn,overloads:[[[bn],(t,[e])=>ba(e.evaluate(t),t.properties())],[[bn,An],(t,[e,r])=>ba(e.evaluate(t),r.evaluate(t))]]},get:{type:In,overloads:[[[bn],(t,[e])=>wa(e.evaluate(t),t.properties())],[[bn,An],(t,[e,r])=>wa(e.evaluate(t),r.evaluate(t))]]},"feature-state":[In,[bn],(t,[e])=>wa(e.evaluate(t),t.featureState||{})],properties:[An,[],t=>t.properties()],"geometry-type":[bn,[],t=>t.geometryType()],worldview:[bn,[],t=>t.globals.worldview||""],"is-active-floor":[wn,_a(bn),(t,e)=>{if(!(t.globals.activeFloors&&t.globals.activeFloors.size>0))return!1;const r=t.globals.activeFloors;return e.some((e=>{const n=e.evaluate(t);return r.has(n)}))}],id:[In,[],t=>t.id()],zoom:[vn,[],t=>t.globals.zoom],pitch:[vn,[],t=>t.globals.pitch||0],"distance-from-center":[vn,[],t=>t.distanceFromCenter()],"measure-light":[vn,[bn],(t,[e])=>t.measureLight(e.evaluate(t))],"heatmap-density":[vn,[],t=>t.globals.heatmapDensity||0],"line-progress":[vn,[],t=>t.globals.lineProgress||0],"raster-value":[vn,[],t=>t.globals.rasterValue||0],"raster-particle-speed":[vn,[],t=>t.globals.rasterParticleSpeed||0],"sky-radial-progress":[vn,[],t=>t.globals.skyRadialProgress||0],accumulated:[In,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[vn,_a(vn),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[vn,_a(vn),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:vn,overloads:[[[vn,vn],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[vn],(t,[e])=>-e.evaluate(t)]]},"/":[vn,[vn,vn],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[vn,[vn,vn],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[vn,[],()=>Math.LN2],pi:[vn,[],()=>Math.PI],e:[vn,[],()=>Math.E],"^":[vn,[vn,vn],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[vn,[vn],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[vn,[vn],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[vn,[vn],(t,[e])=>Math.log(e.evaluate(t))],log2:[vn,[vn],(t,[e])=>Math.log2(e.evaluate(t))],sin:[vn,[vn],(t,[e])=>Math.sin(e.evaluate(t))],cos:[vn,[vn],(t,[e])=>Math.cos(e.evaluate(t))],tan:[vn,[vn],(t,[e])=>Math.tan(e.evaluate(t))],asin:[vn,[vn],(t,[e])=>Math.asin(e.evaluate(t))],acos:[vn,[vn],(t,[e])=>Math.acos(e.evaluate(t))],atan:[vn,[vn],(t,[e])=>Math.atan(e.evaluate(t))],min:[vn,_a(vn),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[vn,_a(vn),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[vn,[vn],(t,[e])=>Math.abs(e.evaluate(t))],round:[vn,[vn],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[vn,[vn],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[vn,[vn],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[wn,[bn,In],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[wn,[In],(t,[e])=>t.id()===e.value],"filter-type-==":[wn,[bn],(t,[e])=>t.geometryType()===e.value],"filter-<":[wn,[bn,In],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n{const r=t.id(),n=e.value;return typeof r==typeof n&&r":[wn,[bn,In],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[wn,[In],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[wn,[bn,In],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[wn,[In],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[wn,[bn,In],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[wn,[In],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[wn,[In],(t,[e])=>e.value in t.properties()],"filter-has-id":[wn,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[wn,[kn(bn)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[wn,[kn(In)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[wn,[bn,kn(In)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[wn,[bn,kn(In)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:wn,overloads:[[[wn,wn],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[_a(wn),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:wn,overloads:[[[wn,wn],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[_a(wn),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[wn,[wn],(t,[e])=>!e.evaluate(t)],"is-supported-script":[wn,[bn],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[bn,[bn],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[bn,[bn],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[bn,_a(In),(t,e)=>e.map((e=>$n(e.evaluate(t)))).join("")],"resolved-locale":[bn,[Mn],(t,[e])=>e.evaluate(t).resolvedLocale()],random:[vn,[vn,vn,In],(t,e)=>{const[r,n,i]=e.map((e=>e.evaluate(t)));if(r>n)return r;if(r===n)return r;let s;if("string"==typeof i)s=function(t){let e=0;if(0===t.length)return e;for(let r=0;rJSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){const e=t;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 Na(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in ga}function ja(t,e,r,n,i){const s=new Ms(ga,[],e?function(t){const e={color:_n,string:bn,number:vn,enum:bn,boolean:wn,formatted:Sn,resolvedImage:Pn};return"array"===t.type?kn(e[t.value]||In,t.length):e[t.type]}(e):void 0,void 0,void 0,r,n,i),a=s.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return a?Ma(new Ua(a,e,r,n,i)):Sa(s.errors)}class $a{constructor(t,e,r,n){this.kind=t,this._styleExpression=e,this.isLightConstant=r,this.isLineProgressConstant=n,this.isStateDependent="constant"!==t&&!xs(e.expression),this.configDependencies=Aa(e.expression),this.isIndoorDependent=Ia(e.expression)}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s,a){return this._styleExpression.evaluate(t,e,r,n,i,s,void 0,void 0,a)}}class Ga{constructor(t,e,r,n,i,s){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!xs(e.expression),this.isIndoorDependent=Ia(e.expression),this.isLightConstant=i,this.isLineProgressConstant=s,this.configDependencies=Aa(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?Xs.interpolationFactor(this.interpolationType,t,e,r):0}}function qa(t,e,r,n,i){if("error"===(t=ja(t,e,r,n,i)).result)return t;const s=t.value.expression,a=gs(s);if(!a&&!ka(e))return Sa([new yn("","data expressions not supported")]);const o=vs(s,["zoom","pitch","distance-from-center"]);if(!o&&!za(e))return Sa([new yn("","zoom expressions not supported")]);const l=vs(s,["measure-light"]);if(!l&&!Ba(e))return Sa([new yn("","measure-light expression not supported")]);const u=vs(s,["line-progress"]);if(!u&&!function(t){return Pa(t.expression,"line-progress")}(e))return Sa([new yn("","line-progress expression not supported")]);const c=e.expression&&e.expression.relaxZoomRestriction,h=Xa(s);return h||o||c?h instanceof yn?Sa([h]):h instanceof Xs&&!Ta(e)?Sa([new yn("",'"interpolate" expressions cannot be used with this property')]):Ma(h?new Ga(a&&u?"camera":"composite",t.value,h.labels,h instanceof Xs?h.interpolation:void 0,l,u):new $a(a&&u?"constant":"source",t.value,l,u)):Sa([new yn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Ha{constructor(t,e){this._parameters=t,this._specification=e,Object.assign(this,Fa(this._parameters,this._specification))}static deserialize(t){return new Ha(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xa(t){let e=null;if(t instanceof Ys)e=Xa(t.result);else if(t instanceof Ws){for(const r of t.args)if(e=Xa(r),e)break}else(t instanceof ks||t instanceof Xs)&&t.input instanceof si&&"zoom"===t.input.name&&(e=t);return e instanceof yn||t.eachChild((t=>{const r=Xa(t);r instanceof yn?e=r:e&&r&&e!==r&&(e=new yn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}var Za,Wa,Ya=function(){if(Wa)return Za;Wa=1,Za=e;var t=3;function e(e,r,n){var i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var s=new Int32Array(this.arrayBuffer);e=s[0],this.d=(r=s[1])+2*(n=s[2]);for(var a=0;a=c[d+0]&&n>=c[d+1])?(a[p]=!0,s.push(u[p])):a[p]=!1}}},e.prototype._forEachCell=function(t,e,r,n,i,s,a,o){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=l;p<=c;p++)for(var d=u;d<=h;d++){var f=this.d*d+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&i.call(this,t,e,r,n,f,s,a,o))return}},e.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},e.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,r=t+this.cells.length+1+1,n=0,i=0;i=0||(i[r]=eo(t[r],e)));t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function ro(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||to(t)||t instanceof ImageBitmap||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(ro);if("object"==typeof t){const e=t.$name||"Object";if("Map"===e){const e=t.entries||[],r=new Map;for(let t=0;tt>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519,Osage:t=>t>=66736&&t<=66815,"CJK Unified Ideographs Extension B":t=>t>=131072&&t<=173791};function io(t){for(const e of t)if(oo(e.charCodeAt(0)))return!0;return!1}function so(t){for(const e of t)if(!ao(e.charCodeAt(0)))return!1;return!0}function ao(t){return!(no.Arabic(t)||no["Arabic Supplement"](t)||no["Arabic Extended-A"](t)||no["Arabic Presentation Forms-A"](t)||no["Arabic Presentation Forms-B"](t))}function oo(t){return!(746!==t&&747!==t&&(t<4352||!(no["Bopomofo Extended"](t)||no.Bopomofo(t)||no["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||no["CJK Compatibility Ideographs"](t)||no["CJK Compatibility"](t)||no["CJK Radicals Supplement"](t)||no["CJK Strokes"](t)||!(!no["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||no["CJK Unified Ideographs Extension A"](t)||no["CJK Unified Ideographs"](t)||no["Enclosed CJK Letters and Months"](t)||no["Hangul Compatibility Jamo"](t)||no["Hangul Jamo Extended-A"](t)||no["Hangul Jamo Extended-B"](t)||no["Hangul Jamo"](t)||no["Hangul Syllables"](t)||no.Hiragana(t)||no["Ideographic Description Characters"](t)||no.Kanbun(t)||no["Kangxi Radicals"](t)||no["Katakana Phonetic Extensions"](t)||no.Katakana(t)&&12540!==t||!(!no["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!no["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||no["Unified Canadian Aboriginal Syllabics"](t)||no["Unified Canadian Aboriginal Syllabics Extended"](t)||no["Vertical Forms"](t)||no["Yijing Hexagram Symbols"](t)||no["Yi Syllables"](t)||no["Yi Radicals"](t))))}function lo(t){return!(oo(t)||function(t){return!!(no["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||no["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||no["Letterlike Symbols"](t)||no["Number Forms"](t)||no["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||no["Control Pictures"](t)&&9251!==t||no["Optical Character Recognition"](t)||no["Enclosed Alphanumerics"](t)||no["Geometric Shapes"](t)||no["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||no["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||no["CJK Symbols and Punctuation"](t)||no.Katakana(t)||no["Private Use Area"](t)||no["CJK Compatibility Forms"](t)||no["Small Form Variants"](t)||no["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function uo(t){return no.Arabic(t)||no["Arabic Supplement"](t)||no["Arabic Extended-A"](t)||no["Arabic Presentation Forms-A"](t)||no["Arabic Presentation Forms-B"](t)}function co(t){return t>=1424&&t<=2303||no["Arabic Presentation Forms-A"](t)||no["Arabic Presentation Forms-B"](t)}function ho(t,e){return!(!e&&co(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||no.Khmer(t))}function po(t){for(const e of t)if(co(e.charCodeAt(0)))return!0;return!1}const fo={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let mo=null,yo=fo.unavailable,go=null;const xo=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(yo=fo.error),mo&&mo(t)};function vo(){bo.fire(new Qr("pluginStateChange",{pluginStatus:yo,pluginURL:go}))}const bo=new nn,wo=function(){return yo},_o=function(t){return t({pluginStatus:yo,pluginURL:go}),bo.on("pluginStateChange",t),t},Ao=function(t,e,r=!1){if(yo===fo.deferred||yo===fo.loading||yo===fo.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");go=lr.resolveURL(t),yo=fo.deferred,mo=e,vo(),r||Io()},Io=function(){if(yo!==fo.deferred||!go)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");yo=fo.loading,vo(),go&&Dr({url:go},(t=>{t?xo(t):(yo=fo.loaded,vo())}))},Mo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>yo===fo.loaded||null!=Mo.applyArabicShaping,isLoading:()=>yo===fo.loading,setState(t){yo=t.pluginStatus,go=t.pluginURL},isParsing:()=>yo===fo.parsing,isParsed:()=>yo===fo.parsed,getPluginURL:()=>go},So=function(){Mo.isLoading()||Mo.isLoaded()||"deferred"!==wo()||Io()};class Po{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.transition=e.transition,this.pitch=e.pitch,this.brightness=e.brightness,this.worldview=e.worldview,this.activeFloors=e.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(t){return function(t,e){for(const r of t)if(!ho(r.charCodeAt(0),e))return!1;return!0}(t,Mo.isLoaded())}}class ko{constructor(t,e,r,n,i){this.property=t,this.value=e,this.expression=function(t,e,r,n,i){if(Ea(t))return new Ha(t,e);if(Na(t)||Array.isArray(t)&&t.length>0){const s=qa(t,e,r,n,i);if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return s.value}{let r=t;return"string"==typeof t&&"color"===e.type&&(r=un.parse(t)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification,r,n,i)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r,n){return this.property.possiblyEvaluate(this,t,e,r,n)}}class Bo{constructor(t,e,r,n){this.property=t,this.value=new ko(t,void 0,e,r,n)}transitioned(t,e){return new To(this.property,this.value,e,Object.assign({},t.transition,this.transition),t.now)}untransitioned(){return new To(this.property,this.value,null,{},0)}}class zo{constructor(t,e,r,n){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._scope=e,this._options=r,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(t){return ve(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Bo(this._values[t].property,this._scope,this._options,this._iconImageUseTheme)),this._values[t].value=new ko(this._values[t].property,null===e?void 0:ve(e),this._scope,this._options,this._iconImageUseTheme),this._values[t].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[t].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[t].value.isIndoorDependent())}setTransitionOrValue(t,e){e&&(this._options=e);const r=this._properties.properties;if(t)for(const e in t){const n=t[e];if(e.endsWith("-transition")){const t=e.slice(0,-11);r[t]&&this.setTransition(t,n)}else r.hasOwnProperty(e)&&this.setValue(e,n)}}getTransition(t){return ve(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Bo(this._values[t].property)),this._values[t].transition=ve(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const r=new Eo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Eo(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}isIndoorDependent(){return this._isIndoorDependent}}class To{constructor(t,e,r,n,i){const s=n.delay||0,a=n.duration||0;i=i||0,this.property=t,this.value=e,this.begin=i+s,this.end=this.begin+a,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n":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":"*"}},"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","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","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","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","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"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","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"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","transition":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","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"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"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","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"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","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_building","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"]}},"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","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"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"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","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"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"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"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"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","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","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","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","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"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,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"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","use-theme":true,"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"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"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"},"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-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"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}},"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","use-theme":true,"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"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"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","use-theme":true,"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"]}}},"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"]}},"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"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"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","use-theme":true,"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)","use-theme":true,"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"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"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","use-theme":true,"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)","use-theme":true,"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"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":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"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"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"]},"use-theme":true,"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"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"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":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function $o(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Go(t){if(Array.isArray(t))return t.map(Go);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=Go(t[r]);return e}return $o(t)}function qo(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!qo(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function Ho(t,e="",r=null,n="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};qo(t)||(t=Qo(t));const i=t;let s=!0;try{s=function(t){if(!Wo(t))return t;let e=Go(t);return Zo(e),e=Xo(e),e}(i)}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}let a=null,o=null;if("background"!==n&&"sky"!==n&&"slot"!==n){o=jo[`filter_${n}`];const t=ja(s,o,e,r);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(e,r,n)=>t.value.evaluate(e,r,{},n)}let l=null,u=null;if(s!==i){const t=ja(i,o,e,r);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));l=(e,r,n,i,s)=>t.value.evaluate(e,r,{},n,void 0,void 0,i,s),u=!gs(t.value.expression)}return{filter:a,dynamicFilter:l||void 0,needGeometry:Jo(s),needFeature:!!u}}function Xo(t){if(!Array.isArray(t))return t;const e=function(t){if(Yo.has(t[0]))for(let e=1;eXo(t)))}function Zo(t){let e=!1;const r=[];if("case"===t[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function Ko(t,e){return te?1:0}function Jo(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?tl(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Qo))):"all"===e?["all"].concat(t.slice(1).map(Qo)):"none"===e?["all"].concat(t.slice(1).map(Qo).map(nl)):"in"===e?el(t[1],t.slice(2)):"!in"===e?nl(el(t[1],t.slice(2))):"has"===e?rl(t[1]):"!has"!==e||nl(rl(t[1]));var r}function tl(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function el(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Ko)]]:["filter-in-small",t,["literal",e]]}}function rl(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function nl(t){return["!",t]}const il="";function sl(t){return t.indexOf(il)>=0}function al(t,e){return e?`${t}${il}${e}`:t}function ol(t){const e=t.indexOf(il);return e>=0?t.slice(0,e):t}function ll(t){const e=t.lastIndexOf(il);return e>=0?t.slice(e+1):""}function ul(t){const e=t.indexOf(il);return e>=0?t.slice(e+1):""}let cl;const hl=()=>cl||(cl=new No({"icon-size":new Ro(jo.layout_symbol["icon-size"]),"icon-image":new Ro(jo.layout_symbol["icon-image"]),"icon-rotate":new Ro(jo.layout_symbol["icon-rotate"]),"icon-offset":new Ro(jo.layout_symbol["icon-offset"]),"text-size":new Ro(jo.layout_symbol["text-size"]),"text-rotate":new Ro(jo.layout_symbol["text-rotate"]),"text-offset":new Ro(jo.layout_symbol["text-offset"])}));class pl{constructor(t,e,r,n,i,s){const a=ja(t,jo.appearance.condition);if("success"===a.result&&(this.condition=a.value),this.name=e,r){this.properties=new Co(hl()),this.unevaluatedLayout=new Vo(hl(),n,i,s);for(const t in r)this.unevaluatedLayout.setValue(t,r[t])}}isActive(t){return!(this.condition||!t.isHidden||"hidden"!==this.name)||this.condition.evaluate(t.globals,t.feature,t.featureState,t.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(t){return this.properties.get(t)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(t){return this.unevaluatedLayout._values[t]}recalculate(t,e,r){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(t,void 0,e,r))}serialize(){const t={};return t.condition=this.condition.expression.serialize(),this.name&&(t.name=this.name),this.unevaluatedLayout&&(t.properties=this.unevaluatedLayout.serialize()),t}hasIconProperties(){const t=this.hasProperty("icon-image"),e=this.hasProperty("icon-size"),r=this.hasProperty("icon-offset"),n=this.hasProperty("icon-rotate");return t||e||r||n}hasTextProperties(){const t=this.hasProperty("text-size"),e=this.hasProperty("text-offset"),r=this.hasProperty("text-rotate");return t||e||r}hasProperty(t){return void 0!==this.getUnevaluatedProperty(t).value}}const dl="-transition",fl=new Set(["fill","line","background","hillshade","raster"]);class ml extends nn{constructor(t,e,r,n,i,s){if(super(),this.id=t.id,this.fqid=al(this.id,r),this.type=t.type,this.scope=r,this.lut=n,this.options=i,this.iconImageUseTheme=s,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},"custom"!==t.type){if(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type&&"background"!==t.type&&"sky"!==t.type&&"slot"!==t.type){this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter;const e=ja(this.filter,jo[`filter_${t.type}`]);"error"!==e.result&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...e.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||e.value.isIndoorDependent)}if(t.slot&&(this.slot=t.slot),t.appearances&&this.setAppearances(t.appearances),e.layout&&(this._unevaluatedLayout=new Vo(e.layout,this.scope,i,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),e.paint){this._transitionablePaint=new zo(e.paint,this.scope,i);for(const e in t.paint)this.setPaintProperty(e,t.paint[e]);for(const e in t.layout)this.setLayoutProperty(e,t.layout[e]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Co(e.paint)}}}onAdd(t){}onRemove(t){}isDraped(t){return!this.is3D(!0)&&fl.has(this.type)}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e){if("custom"===this.type&&"visibility"===t)return void(this.visibility=e);const r=this._unevaluatedLayout;r._properties.properties[t]&&(r.setValue(t,e),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),"visibility"===t&&this.possiblyEvaluateVisibility())}setAppearances(t){this.appearances=[],t.forEach((t=>{this.appearances.push(new pl(t.condition,t.name,t.properties,this.scope,this.options,this.iconImageUseTheme))}))}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(t){return t.endsWith(dl)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}isPaintProperty(t){return!!this._transitionablePaint._properties.properties[t]}setPaintProperty(t,e){const r=this._transitionablePaint,n=r._properties.properties;if(t.endsWith(dl)){const i=t.slice(0,-11);return n[i]&&r.setTransition(i,e||void 0),!1}if(!n[t])return!1;const i=r._values[t],s=i.value.isDataDriven(),a=i.value;r.setValue(t,e),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(t);const o=r._values[t].value,l=o.isDataDriven(),u=t.endsWith("pattern")||"line-dasharray"===t;return l||s||u||this._handleOverridablePaintPropertyUpdate(t,a,o)}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getDefaultProgramParams(t,e,r){return null}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={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()};return 0!==this.appearances.length&&(t.appearances=this.appearances.map((t=>t.serialize()))),xe(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}is3D(t){return!1}hasElevation(){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(){}_clear(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Fo&&ka(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}for(const t of this.appearances)if(!xs(t.condition.expression))return!0;return!1}compileFilter(t){this._filterCompiled||(this._featureFilter=Ho(this.filter,this.scope,t),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(t){this._stats&&("shadow"===t.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(t,e,r){return{}}queryRadius(t){}queryIntersectsFeature(t,e,r,n,i,s,a,o,l){}}const yl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class gl{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const xl=new ArrayBuffer(0);class vl{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(t,e){return t._trim(),e&&t.arrayBuffer&&e.add(t.arrayBuffer),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,t.arrayBuffer?e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement:(e.capacity=0,e.arrayBuffer=xl),e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this._reallocCount++,this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}reserveForAdditional(t){this.reserve(this.length+t)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...t){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...t){throw new 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 bl(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=yl[t.type].BYTES_PER_ELEMENT,s=r=wl(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:wl(r,Math.max(n,e)),alignment:e}}function wl(t,e){return Math.ceil(t/e)*e}class _l extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}_l.prototype.bytesPerElement=4,Qa(_l,"StructArrayLayout2i4");class Al extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Al.prototype.bytesPerElement=6,Qa(Al,"StructArrayLayout3i6");class Il extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}Il.prototype.bytesPerElement=8,Qa(Il,"StructArrayLayout4i8");class Ml extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Ml.prototype.bytesPerElement=4,Qa(Ml,"StructArrayLayout1f4");class Sl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t,s=2*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.float32[s+1]=n,t}}Sl.prototype.bytesPerElement=8,Qa(Sl,"StructArrayLayout2i1f8");class Pl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Pl.prototype.bytesPerElement=8,Qa(Pl,"StructArrayLayout3i8");class kl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=5*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,this.int16[a+4]=s,t}}kl.prototype.bytesPerElement=10,Qa(kl,"StructArrayLayout5i10");class Bl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=6*t,u=12*t,c=3*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=s,this.uint8[u+7]=a,this.float32[c+2]=o,t}}Bl.prototype.bytesPerElement=12,Qa(Bl,"StructArrayLayout2i4ub1f12");class zl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}zl.prototype.bytesPerElement=12,Qa(zl,"StructArrayLayout3f12");class Tl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=6*t,o=3*t;return this.uint16[a+0]=e,this.uint16[a+1]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,this.float32[o+2]=s,t}}Tl.prototype.bytesPerElement=12,Qa(Tl,"StructArrayLayout4ui1f12");class El extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.uint16[s+0]=e,this.uint16[s+1]=r,this.uint16[s+2]=n,this.uint16[s+3]=i,t}}El.prototype.bytesPerElement=8,Qa(El,"StructArrayLayout4ui8");class Vl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}Vl.prototype.bytesPerElement=12,Qa(Vl,"StructArrayLayout6i12");class Fl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.uint16[d+4]=s,this.uint16[d+5]=a,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,t}}Fl.prototype.bytesPerElement=24,Qa(Fl,"StructArrayLayout4i4ui4i24");class Cl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=10*t,l=5*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=a,t}}Cl.prototype.bytesPerElement=20,Qa(Cl,"StructArrayLayout3i3f20");class Dl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}Dl.prototype.bytesPerElement=16,Qa(Dl,"StructArrayLayout4f16");class Rl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Rl.prototype.bytesPerElement=4,Qa(Rl,"StructArrayLayout1ul4");class Ll extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Ll.prototype.bytesPerElement=4,Qa(Ll,"StructArrayLayout2ui4");class Ol extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,r,n,i,s,a,o,l,u,c,h,p)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const f=20*t,m=10*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.int16[f+4]=s,this.float32[m+3]=a,this.float32[m+4]=o,this.float32[m+5]=l,this.float32[m+6]=u,this.int16[f+14]=c,this.uint32[m+8]=h,this.uint16[f+18]=p,this.uint16[f+19]=d,t}}Ol.prototype.bytesPerElement=40,Qa(Ol,"StructArrayLayout5i4f1i1ul2ui40");class Ul extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=8*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.int16[l+2]=n,this.int16[l+4]=i,this.int16[l+5]=s,this.int16[l+6]=a,this.int16[l+7]=o,t}}Ul.prototype.bytesPerElement=16,Qa(Ul,"StructArrayLayout3i2i2i16");class Nl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}Nl.prototype.bytesPerElement=16,Qa(Nl,"StructArrayLayout2f1f2i16");class jl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=20*t,l=5*t;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=a,t}}jl.prototype.bytesPerElement=20,Qa(jl,"StructArrayLayout2ub4f20");class $l extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}$l.prototype.bytesPerElement=6,Qa($l,"StructArrayLayout3ui6");class Gl extends vl{_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(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w){const _=30*t,A=15*t,I=60*t;return this.int16[_+0]=e,this.int16[_+1]=r,this.int16[_+2]=n,this.float32[A+2]=i,this.float32[A+3]=s,this.uint16[_+8]=a,this.uint16[_+9]=o,this.uint32[A+5]=l,this.uint32[A+6]=u,this.uint32[A+7]=c,this.uint16[_+16]=h,this.uint16[_+17]=p,this.uint16[_+18]=d,this.float32[A+10]=f,this.float32[A+11]=m,this.uint8[I+48]=y,this.uint8[I+49]=g,this.uint8[I+50]=x,this.uint32[A+13]=v,this.int16[_+28]=b,this.uint8[I+58]=w,t}}Gl.prototype.bytesPerElement=60,Qa(Gl,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class ql extends vl{_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(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,I,M,S,P,k,B,z,T,E){const V=this.length;return this.resize(V+1),this.emplace(V,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,I,M,S,P,k,B,z,T,E)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,I,M,S,P,k,B,z,T,E,V){const F=20*t,C=40*t,D=80*t;return this.float32[F+0]=e,this.float32[F+1]=r,this.int16[C+4]=n,this.int16[C+5]=i,this.int16[C+6]=s,this.int16[C+7]=a,this.int16[C+8]=o,this.int16[C+9]=l,this.int16[C+10]=u,this.int16[C+11]=c,this.int16[C+12]=h,this.uint16[C+13]=p,this.uint16[C+14]=d,this.uint16[C+15]=f,this.uint16[C+16]=m,this.uint16[C+17]=y,this.uint16[C+18]=g,this.uint16[C+19]=x,this.uint16[C+20]=v,this.uint16[C+21]=b,this.uint16[C+22]=w,this.uint16[C+23]=_,this.uint16[C+24]=A,this.uint16[C+25]=I,this.uint16[C+26]=M,this.uint16[C+27]=S,this.uint32[F+14]=P,this.float32[F+15]=k,this.float32[F+16]=B,this.float32[F+17]=z,this.float32[F+18]=T,this.uint8[D+76]=E,this.uint16[C+39]=V,t}}ql.prototype.bytesPerElement=80,Qa(ql,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Hl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,this.float32[o+4]=s,this.float32[o+5]=a,t}}Hl.prototype.bytesPerElement=24,Qa(Hl,"StructArrayLayout6f24");class Xl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=5*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,this.float32[a+4]=s,t}}Xl.prototype.bytesPerElement=20,Qa(Xl,"StructArrayLayout5f20");class Zl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=7*t;return this.float32[l+0]=e,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=i,this.float32[l+4]=s,this.float32[l+5]=a,this.float32[l+6]=o,t}}Zl.prototype.bytesPerElement=28,Qa(Zl,"StructArrayLayout7f28");class Wl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,s,a,o,l,u,c)}emplace(t,e,r,n,i,s,a,o,l,u,c,h){const p=11*t;return this.float32[p+0]=e,this.float32[p+1]=r,this.float32[p+2]=n,this.float32[p+3]=i,this.float32[p+4]=s,this.float32[p+5]=a,this.float32[p+6]=o,this.float32[p+7]=l,this.float32[p+8]=u,this.float32[p+9]=c,this.float32[p+10]=h,t}}Wl.prototype.bytesPerElement=44,Qa(Wl,"StructArrayLayout11f44");class Yl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,a,o,l)}emplace(t,e,r,n,i,s,a,o,l,u){const c=9*t;return this.float32[c+0]=e,this.float32[c+1]=r,this.float32[c+2]=n,this.float32[c+3]=i,this.float32[c+4]=s,this.float32[c+5]=a,this.float32[c+6]=o,this.float32[c+7]=l,this.float32[c+8]=u,t}}Yl.prototype.bytesPerElement=36,Qa(Yl,"StructArrayLayout9f36");class Kl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}Kl.prototype.bytesPerElement=8,Qa(Kl,"StructArrayLayout2f8");class Jl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=6*t;return this.uint32[3*t+0]=e,this.uint16[s+2]=r,this.uint16[s+3]=n,this.uint16[s+4]=i,t}}Jl.prototype.bytesPerElement=12,Qa(Jl,"StructArrayLayout1ul3ui12");class Ql extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Ql.prototype.bytesPerElement=2,Qa(Ql,"StructArrayLayout1ui2");class tu extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m){const y=this.length;return this.resize(y+1),this.emplace(y,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y){const g=16*t;return this.float32[g+0]=e,this.float32[g+1]=r,this.float32[g+2]=n,this.float32[g+3]=i,this.float32[g+4]=s,this.float32[g+5]=a,this.float32[g+6]=o,this.float32[g+7]=l,this.float32[g+8]=u,this.float32[g+9]=c,this.float32[g+10]=h,this.float32[g+11]=p,this.float32[g+12]=d,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=y,t}}tu.prototype.bytesPerElement=64,Qa(tu,"StructArrayLayout16f64");class eu extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=10*t,u=5*t;return this.uint16[l+0]=e,this.uint16[l+1]=r,this.uint16[l+2]=n,this.uint16[l+3]=i,this.float32[u+2]=s,this.float32[u+3]=a,this.float32[u+4]=o,t}}eu.prototype.bytesPerElement=20,Qa(eu,"StructArrayLayout4ui3f20");class ru extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.int16[1*t+0]=e,t}}ru.prototype.bytesPerElement=2,Qa(ru,"StructArrayLayout1i2");class nu extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint8[1*t+0]=e,t}}nu.prototype.bytesPerElement=1,Qa(nu,"StructArrayLayout1ub1");class iu extends gl{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]}}iu.prototype.size=40;class su extends Ol{get(t){return new iu(this,t)}}Qa(su,"CollisionBoxArray");class au extends gl{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]}get 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(t){this._structArray.uint8[this._pos1+49]=t}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(t){this._structArray.uint8[this._pos1+50]=t}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(t){this._structArray.uint32[this._pos4+13]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(t){this._structArray.uint8[this._pos1+58]=t}}au.prototype.size=60;class ou extends Gl{get(t){return new au(this,t)}}Qa(ou,"PlacedSymbolArray");class lu extends gl{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(t){this._structArray.uint32[this._pos4+14]=t}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(t){this._structArray.float32[this._pos4+18]=t}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}lu.prototype.size=80;class uu extends ql{get(t){return new lu(this,t)}}Qa(uu,"SymbolInstanceArray");class cu extends Ml{getoffsetX(t){return this.float32[1*t+0]}}Qa(cu,"GlyphOffsetArray");class hu extends _l{getx(t){return this.int16[2*t+0]}gety(t){return this.int16[2*t+1]}}Qa(hu,"SymbolLineVertexArray");class pu extends gl{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]}}pu.prototype.size=12;class du extends Jl{get(t){return new pu(this,t)}}Qa(du,"FeatureIndexArray");class fu extends Ll{geta_centroid_pos0(t){return this.uint16[2*t+0]}geta_centroid_pos1(t){return this.uint16[2*t+1]}}Qa(fu,"FillExtrusionCentroidArray");class mu extends gl{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]}}mu.prototype.size=6;class yu extends Al{get(t){return new mu(this,t)}}Qa(yu,"FillExtrusionWallArray");const gu=bl([{name:"a_pos",components:2,type:"Int16"}],4),xu=bl([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),vu=bl([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class bu{constructor(t=[]){this.segments=t}_prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>bu.MAX_VERTEX_ARRAY_LENGTH&&Ae(`Max vertices per segment is ${bu.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>bu.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}prepareSegment(t,e,r,n){return this._prepareSegment(t,e.length,r.length,n)}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,n){return new bu([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function wu(t,e){return 256*(t=ie(Math.floor(t),0,255))+ie(Math.floor(e),0,255)}bu.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qa(bu,"SegmentVector");const _u=bl([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Au=bl([{name:"a_pattern_b",components:4,type:"Uint16"}]),Iu=bl([{name:"a_dash",components:4,type:"Uint16"}]);class Mu{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(Su(t)),this.positions.push(e,r,n)}eachPosition(t,e){const r=Su(t);let n=0,i=this.ids.length-1;for(;n>1;this.ids[t]>=r?i=t:n=t+1}for(;this.ids[n]===r;)e(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Pu(r,n,0,r.length-1),e&&(e.add(r.buffer),e.add(n.buffer)),{ids:r,positions:n}}static deserialize(t){const e=new Mu;let r;e.ids=t.ids,e.positions=t.positions;for(const t of e.ids)t!==r&&e.uniqueIds.push(t),r=t;return e.indexed=!0,e}}function Su(t){const e=+t;return Number.isSafeInteger(e)?e:Jr(String(t))}function Pu(t,e,r,n){for(;r>1];let s=r-1,a=n+1;for(;;){do{s++}while(t[s]i);if(s>=a)break;ku(t,s,a),ku(e,3*s,3*a),ku(e,3*s+1,3*a+1),ku(e,3*s+2,3*a+2)}a-r`u_${t}`)),this.type=r,this.context=n}setUniform(t,e,r,n,i){const s=n.constantOr(this.value);e.set(t,i,s instanceof un?s.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):s)}getBinding(t,e){return"color"===this.type?new Cu(t):new Tu(t)}}class qu{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(t,e){this.pixelRatio=t.pixelRatio||1,this.pattern=t.tl.concat(t.br),this.patternTransition=e?e.tl.concat(e.br):this.pattern}setUniform(t,e,r,n,i){let s=null;"u_pattern"!==i&&"u_dash"!==i||(s=this.pattern),"u_pattern_b"===i&&(s=this.patternTransition),"u_pixel_ratio"===i&&(s=this.pixelRatio),s&&e.set(t,i,s)}getBinding(t,e){return"u_pattern"===e||"u_pattern_b"===e||"u_dash"===e?new Fu(t):new Tu(t)}}class Hu{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,r,n,i,s,a,o){const l=this.paintVertexArray.length,u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new Po(0,{brightness:s,worldview:o}),e,{},i,n,a):"constant"===this.expression.kind&&this.expression.value,c=$u(this.lutExpression,e,{},n,i,s,a,o);this.paintVertexArray.resize(t),this._setPaintValue(l,t,u,c?null:this.context.lut)}updatePaintArray(t,e,r,n,i,s,a,o){const l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:a,worldview:o},r,n,void 0,i):"constant"===this.expression.kind&&this.expression.value,u=$u(this.lutExpression,r,n,i,void 0,a,void 0,o);this._setPaintValue(t,e,l,u?null:this.context.lut)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=ju(r.toPremultipliedRenderColor(n));for(let r=t;r`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.context=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,r,n,i,s,a,o){const l=this.expression.evaluate(new Po(this.context.zoom,{brightness:s,worldview:o}),e,{},i,n,a),u=this.expression.evaluate(new Po(this.context.zoom+1,{brightness:s,worldview:o}),e,{},i,n,a),c=$u(this.lutExpression,e,{},n,i,s,a,o),h=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(h,t,l,u,c?null:this.context.lut)}updatePaintArray(t,e,r,n,i,s,a,o){const l=this.expression.evaluate({zoom:this.context.zoom,brightness:a,worldview:o},r,n,void 0,i),u=this.expression.evaluate({zoom:this.context.zoom+1,brightness:a,worldview:o},r,n,void 0,i),c=$u(this.lutExpression,r,n,i,void 0,a,void 0,o);this._setPaintValue(t,e,l,u,c?null:this.context.lut)}_setPaintValue(t,e,r,n,i){if("color"===this.type){const n=ju(r.toPremultipliedRenderColor(i)),s=ju(r.toPremultipliedRenderColor(i));for(let r=t;r!0)){this.binders={},this._buffers=[],this.context=e;const n=[];for(const i in t.paint._values){const s=t.paint.get(i);if(i.endsWith("-use-theme"))continue;if(!r(i))continue;if(!(s instanceof Fo&&ka(s.property.specification)))continue;const a=Ju(i,t.type),o=s.value,l=s.property.specification.type,u=!!s.property.useIntegerZoom,c="line-dasharray"===i||i.endsWith("pattern"),h=t.paint.get(`${i}-use-theme`),p="line-dasharray"===i&&"constant"!==t.layout.get("line-cap").value.kind||h&&"constant"!==h.value.kind;if("constant"!==o.kind||p)if("source"===o.kind||p||c){const e=ec(i,l,"source");this.binders[i]=c?new Zu(o,a,l,e,t.id):new Hu(o,a,l,e),n.push(`/a_${i}`)}else{const t=ec(i,l,"composite");this.binders[i]=new Xu(o,a,l,u,e,t),n.push(`/z_${i}`)}else this.binders[i]=c?new qu(o.value,a):new Gu(o.value,a,l,e),n.push(`/u_${i}`);h&&(this.binders[i].lutExpression=h.value)}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Hu||e instanceof Xu?e.maxValue:0}populatePaintArrays(t,e,r,n,i,s,a,o){for(const l in this.binders){const u=this.binders[l];u.context=this.context,(u instanceof Hu||u instanceof Xu||u instanceof Zu)&&u.populatePaintArray(t,e,r,n,i,s,a,o)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof qu&&n.setConstantPatternPositions(t,e)}}getPatternTransitionVertexBuffer(t){const e=this.binders[t];return e instanceof Zu?e.paintTransitionVertexBuffer:null}updatePaintArrays(t,e,r,n,i,s,a,o,l,u){let c=!1;const h=Object.keys(t),p=0!==h.length&&!o,d=p?h:e.uniqueIds;this.context.lut=i.lut;for(const o in this.binders){const h=this.binders[o];if(h.context=this.context,(h instanceof Hu||h instanceof Xu||h instanceof Zu)&&h.expression&&h.expression.kind&&"constant"!==h.expression.kind&&(!0===h.expression.isStateDependent||!1===h.expression.isLightConstant)){const f=i.paint.get(o);h.expression=f.value;for(const r of d){const i=t[r.toString()];e.eachPosition(r,((t,e,r)=>{const o=n.feature(t);h.updatePaintArray(e,r,o,i,s,a,l,u)}))}if(!p)for(const e of r.uniqueIds){const i=t[e.toString()];r.eachPosition(e,((t,e,r)=>{const o=n.feature(t);h.updatePaintArray(e,r,o,i,s,a,l,u)}))}c=!0}}return c}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof Gu||r instanceof qu)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof Gu||n instanceof qu||n instanceof Xu)for(const i of n.uniformNames)e.push({name:i,property:r,binding:n.getBinding(t,i)})}return e}setUniforms(t,e,r,n,i){for(const{name:e,property:s,binding:a}of r)this.binders[s].setUniform(t,a,i,n.get(s),e)}updatePaintBuffers(){this._buffers=[];for(const t in this.binders){const e=this.binders[t];(e instanceof Hu||e instanceof Xu||e instanceof Zu)&&e.paintVertexBuffer&&this._buffers.push(e.paintVertexBuffer),e instanceof Zu&&e.paintTransitionVertexBuffer&&this._buffers.push(e.paintTransitionVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof Hu||r instanceof Xu||r instanceof Zu)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Hu||e instanceof Xu||e instanceof Zu)&&e.destroy()}}}class Yu{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Wu(n,e,r);this.needsUpload=!1,this._featureMap=new Mu,this._featureMapWithoutIds=new Mu,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(t,e,r,n,i,s,a,o,l){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s,a,o,l);void 0!==e.id?this._featureMap.add(e.id,r,this._bufferOffset,t):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,t),this._idlessCounter+=1),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,n,i,s,a,o){for(const l of r)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(t,this._featureMap,this._featureMapWithoutIds,e,l,n,i,s,a||0,o)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}const Ku={"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":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function Ju(t,e){return Ku[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const Qu={"line-pattern":{source:Tl,composite:Tl},"fill-pattern":{source:Tl,composite:Tl},"fill-extrusion-pattern":{source:Tl,composite:Tl},"line-dasharray":{source:El,composite:El}},tc={color:{source:Kl,composite:Dl},number:{source:Ml,composite:Kl}};function ec(t,e,r){const n=Qu[t];return n&&n[r]||tc[e][r]}Qa(Gu,"ConstantBinder"),Qa(qu,"PatternConstantBinder"),Qa(Hu,"SourceExpressionBinder"),Qa(Zu,"PatternCompositeBinder"),Qa(Xu,"CompositeExpressionBinder"),Qa(Wu,"ProgramConfiguration",{omit:["_buffers"]}),Qa(Yu,"ProgramConfigurationSet");const rc=Ui/Math.PI/2,nc=5,ic=6,sc=45,ac=16383,oc=64,lc=[oc,32,16],uc=-rc,cc=rc;function hc(t,e,r,n=rc){return r=Xt(r),[t*Math.sin(r)*n,-e*n,t*Math.cos(r)*n]}function pc([t,e,r]){const n=Math.hypot(t,e,r),i=Math.atan2(t,r),s=.5*Math.PI-Math.acos(-e/n);return new yc(Zt(i),Zt(s))}function dc(t,e,r){return hc(Math.cos(Xt(t)),Math.sin(Xt(t)),e,r)}const fc=6371008.8,mc=2*Math.PI*fc;class yc{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new yc(ae(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return fc*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new gc({lng:this.lng-r,lat:this.lat-e},{lng:this.lng+r,lat:this.lat+e})}toEcef(t){return dc(this.lat,this.lng,rc+t*rc/fc)}static convert(t){if(t instanceof yc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new yc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new yc(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class gc{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof yc?new yc(t.lng,t.lat):yc.convert(t),this}setSouthWest(t){return this._sw=t instanceof yc?new yc(t.lng,t.lat):yc.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof yc)n=t,i=t;else{if(!(t instanceof gc))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(gc.convert(t)):this.extend(yc.convert(t)):"object"==typeof t&&null!==t&&t.hasOwnProperty("lat")&&(t.hasOwnProperty("lon")||t.hasOwnProperty("lng"))?this.extend(yc.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new yc(n.lng,n.lat),this._ne=new yc(i.lng,i.lat)),this}getCenter(){return new yc((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 yc(this.getWest(),this.getNorth())}getSouthEast(){return new yc(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(t){const{lng:e,lat:r}=yc.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){if(t)return t instanceof gc?t:new gc(t)}}const xc=0,vc=25.5;function bc(t){return mc*Math.cos(t*Math.PI/180)}function wc(t){return(180+t)/360}function _c(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Ac(t,e){return t/bc(e)}function Ic(t){return 360*t-180}function Mc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Sc(t,e){return t*bc(Mc(e))}const Pc=85.051129;function kc(t){return Math.cos(Xt(ie(t,-Pc,Pc)))}function Bc(t,e){const r=ie(e,xc,vc),n=Math.pow(2,r);return kc(t)*mc/(512*n)}function zc(t){return 1/Math.cos(t*Math.PI/180)}function Tc(t,e=0){const r=Math.exp(Math.PI*(1-(t.y+e/Ui)/(1<=l?(Vc(t,e,r,u,c,s,h,o,l),Vc(t,u,c,n,i,h,a,o,l)):t.push(a)}function Fc(t,e,r){let n=t[0],i=n.x,s=n.y;e(n);const a=[n];for(let o=1;ot.x+1||nt.y+1)&&Ae("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Uc(t,e,r){const n=t.loadGeometry(),i=t.extent,s=Ui/i;if(e&&r&&r.projection.isReprojectedInTileSpace){const s=1<{const r=Ic((e.x+t.x/i)/s),n=Mc((e.y+t.y/i)/s),c=u.project(r,n);t.x=(c.x*a-o)*i,t.y=(c.y*a-l)*i};for(let e=0;e=i||r.y<0||r.y>=i||(c(r),t.push(r));n[e]=t}}for(const t of n)for(const e of t)Oc(e,s);return n}function Nc(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Uc(t):[]}}class jc{constructor(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields($c,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos,r=[];let n,i=1,s=0,a=0,o=0;for(;t.pos>3}if(s--,1===i||2===i)a+=t.readSVarint(),o+=t.readSVarint(),1===i&&(n&&r.push(n),n=[]),n&&n.push(new $t(a,o));else{if(7!==i)throw new Error(`unknown command ${i}`);n&&n.push(n[0].clone())}}return n&&r.push(n),r}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),s+=t.readSVarint(),io&&(o=i),su&&(u=s);else if(7!==r)throw new Error(`unknown command ${r}`)}return[a,l,o,u]}toGeoJSON(t,e,r){const n=this.extent*Math.pow(2,r),i=this.extent*t,s=this.extent*e,a=this.loadGeometry();function o(t){return[360*(t.x+i)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+s)/n)*Math.PI))-90]}function l(t){return t.map(o)}let u;if(1===this.type){const t=[];for(const e of a)t.push(e[0]);const e=l(t);u=1===t.length?{type:"Point",coordinates:e[0]}:{type:"MultiPoint",coordinates:e}}else if(2===this.type){const t=a.map(l);u=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw new Error("unknown feature type");{const t=function(t){const e=t.length;if(e<=1)return[t];const r=[];let n,i;for(let s=0;s=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new jc(this._pbf,e,this.extent,this._keys,this._values)}}function Hc(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){let e=null;const r=t.readVarint()+t.pos;for(;t.pos>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}if(null==e)throw new Error("unknown feature value");return e}(r))}class Xc{constructor(t,e){this.layers=t.readFields(Zc,{},e)}}function Zc(t,e,r){if(3===t){const t=new qc(r,r.readVarint()+r.pos);t.length&&(e[t.name]=t)}}const Wc="3d_elevation_id",Yc="level",Kc="hd_road_elevation";class Jc{constructor(){this._valid=!1}reset(t){return this.feature=t,this._valid=!0,this._geometry=t.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(t,e){return this._valid&&t(e(this._geometry)),this}require(t,e,r){return this.get(t,!0,e,r)}optional(t,e,r){return this.get(t,!1,e,r)}success(){return this._valid}get(t,e,r,n){const i=this.feature.properties.hasOwnProperty(t)?+this.feature.properties[t]:void 0;return this._valid&&void 0!==i&&!Number.isNaN(i)?r(n?n(i):i):e&&(this._valid=!1),this}}class Qc{constructor(t,e){this.featureFunc=t,this.vertexFunc=e}parseFeature(t,e,r){return this.featureFunc(t,e,r)}parseVertex(t,e,r){return this.vertexFunc(t,e,r)}}const th=new Qc(((t,e,r)=>t.reset(e).require(Wc,(t=>{r.id=t})).optional("fixed_height_relative",(t=>{r.constantHeight=t}),rh.decodeRelativeHeight).geometry((t=>{r.bounds=t}),xi).success()),((t,e,r)=>t.reset(e).require(Wc,(t=>{r.id=t})).require("elevation_idx",(t=>{r.idx=t})).require("extent",(t=>{r.extent=t})).require("height_relative",(t=>{r.height=t}),rh.decodeRelativeHeight).geometry((t=>{r.position=t}),rh.getPoint).success())),eh=new Qc(((t,e,r)=>t.reset(e).require(Wc,(t=>{r.id=t})).optional("fixed_height",(t=>{r.constantHeight=t}),rh.decodeMetricHeight).geometry((t=>{r.bounds=t}),xi).success()),((t,e,r)=>t.reset(e).require(Wc,(t=>{r.id=t})).require("elevation_idx",(t=>{r.idx=t})).require("extent",(t=>{r.extent=t})).require("height",(t=>{r.height=t}),rh.decodeMetricHeight).geometry((t=>{r.position=t}),rh.getPoint).success()));class rh{static getPoint(t){return Bt(t[0][0].x,t[0][0].y)}static decodeRelativeHeight(t){return 1e-4*t*5}static decodeMetricHeight(t){return 1e-4*t}static getVersionSchema(t){return t?"1.0.1"===t?eh:void 0:th}static parse(t){const e=[],r=[],n=t.length,i=new Jc;for(let s=0;s=0);if(0===s)return 0;s!==e.length&&(r=!1)}return r?2:1}function lh(t,e){for(const r of t.projections){const n=ah(e,t.points[0],r.axis);if(r.projection[1]n[1])return 0}return 1}const uh=2,ch=3,hh=6,ph=7;function dh(t,e){let r=0;const n=[0,0,0,0];for(let a=0;a=0&&r++;var i,s;return r}class fh{constructor(t,e){this.points=t||new Array(8).fill([0,0,0]),this.planes=e||new Array(6).fill([0,0,0,0]),this.bounds=mh.fromPoints(this.points),this.projections=[],this.frustumEdges=[rt([],this.points[2],this.points[3]),rt([],this.points[0],this.points[3]),rt([],this.points[4],this.points[0]),rt([],this.points[5],this.points[1]),rt([],this.points[6],this.points[2]),rt([],this.points[7],this.points[3])];for(const t of this.frustumEdges){const e=[0,-t[2],t[1]],r=[t[2],0,-t[0]];this.projections.push({axis:e,projection:ah(this.points,this.points[0],e)}),this.projections.push({axis:r,projection:ah(this.points,this.points[0],r)})}}static fromInvProjectionMatrix(t,e,r,n){const i=Math.pow(2,r),s=[[-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=>{const s=dt([],r,t),a=1/s[3]/e*i;return(o=s)[0]=(l=s)[0]*(u=[a,a,n?1/s[3]:a,a])[0],o[1]=l[1]*u[1],o[2]=l[2]*u[2],o[3]=l[3]*u[3],o;var o,l,u})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=X([],W([],rt([],s[t[0]],s[t[1]]),rt([],s[t[2]],s[t[1]]))),r=-Z(e,s[t[1]]);return e.concat(r)})),o=[];for(let t=0;ta[1]||a[0]>s[1])return 0}return 1}containsPoint(t){for(const e of this.planes){const r=e[3];if(Z([e[0],e[1],e[2]],t)+r<0)return!1}return!0}}class mh{static fromPoints(t){const e=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(const n of t)O(e,e,n),U(r,r,n);return new mh(e,r)}static fromTileIdAndHeight(t,e,r){const n=1<t.max[e]||t.min[e]>this.max[e])return!1;return!0}intersectsAabbXY(t){return!(this.min[0]>t.max[0]||t.min[0]>this.max[0]||this.min[1]>t.max[1]||t.min[1]>this.max[1])}encapsulate(t){for(let e=0;e<3;e++)this.min[e]=Math.min(this.min[e],t.min[e]),this.max[e]=Math.max(this.max[e],t.max[e])}encapsulatePoint(t){for(let e=0;e<3;e++)this.min[e]=Math.min(this.min[e],t[e]),this.max[e]=Math.max(this.max[e],t[e])}closestPoint(t){return[Math.max(Math.min(this.max[0],t[0]),this.min[0]),Math.max(Math.min(this.max[1],t[1]),this.min[1]),Math.max(Math.min(this.max[2],t[2]),this.min[2])]}}Qa(mh,"Aabb");class yh{constructor(t,e){this.feature=t,this.metersToTile=e,this.index=0}get(){const t=this.feature.vertices[this.index],e=this.feature.vertexProps[this.index].dir,r=e[1],n=-e[0],i=(t.extent+1)*this.metersToTile;return[new $t(Math.trunc(t.position[0]+r*i),Math.trunc(t.position[1]+n*i)),new $t(Math.trunc(t.position[0]-r*i),Math.trunc(t.position[1]-n*i))]}next(){this.index++}valid(){return this.index{return t.a0?N(o,o,1/l):C(o,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(t){if(0===this.edges.length)return;let e=0,r=Number.POSITIVE_INFINITY,n=0;const[i,s,a,o,l,u,c]=this._tmpVec2;zt(c,t.x,t.y);const h=new nh(c,null);for(let t=0;t0?Dt(o,a)/x:0,b=ie(v,0,1),w=Math.abs((v-b)*this.edgeProps[t].len);Et(l,c,f),zt(u,d[1],-d[0]);const _=w+Math.abs(Dt(l,u));_=0;--s){const a=this.edges[s].a,o=this.edges[s].b,{position:l,height:u,extent:c}=this.vertices[a],{position:h,height:p,extent:d}=this.vertices[o],f=this.vertexProps[a].dir,m=this.vertexProps[o].dir;if(C(e,l[0]/t,l[1]/t,u),C(r,h[0]/t,h[1]/t,p),C(n,f[1],-f[0],0),N(n,n,c),C(i,m[1],-m[0],0),N(i,i,d),this.distSqLines(F(e[0]+.5*n[0],e[1]+.5*n[1],e[2]+.5*n[2]),F(r[0]-.5*i[0],r[1]-.5*i[1],r[2]-.5*i[2]),F(e[0]-.5*n[0],e[1]-.5*n[1],e[2]-.5*n[2]),F(r[0]+.5*i[0],r[1]+.5*i[1],r[2]+.5*i[2]))<=.0025000000000000005)continue;const y=this.vertices.length,g=Tt(kt(),l,h);this.vertices.push({position:Vt(g,g,.5),height:.5*(u+p),extent:.5*(c+d)});const x=Tt(kt(),f,m);this.vertexProps.push({dir:Ct(x,x)}),this.edges.splice(s,1),this.edgeProps.splice(s,1),this.edges.push({a,b:y}),this.edges.push({a:y,b:o});const v=Et(kt(),this.vertices[y].position,l),b=Ft(v),w={vec:v,dir:Vt(kt(),v,1/b),len:b};this.edgeProps.push(w),this.edgeProps.push(w)}}distSqLines(t,e,r,n){const i=R(T(),e,t),s=R(T(),n,r),a=R(T(),t,r),o=Z(i,i),l=Z(i,s),u=Z(i,a),c=Z(s,s),h=Z(s,a),p=o*c-l*l;if(0===p)return G(Y(i,r,n,Z(a,s)/Z(s,s)),t);const d=(o*h-l*u)/p;return G(Y(i,t,e,(l*h-u*c)/p),Y(s,r,n,d))}}class xh{static parseFrom(t,e){const r=rh.parse(t);if(!r)return[];let{vertices:n,features:i}=r;const s=1/Tc(e);i.sort(((t,e)=>t.id-e.id)),n.sort(((t,e)=>t.id-e.id||t.idx-e.idx)),n=n.filter(((t,e,r)=>e===r.findIndex((e=>e.id===t.id&&e.idx===t.idx))));const a=new Array;let o=0;const l=n.length;for(const t of i){if(t.constantHeight){a.push(new gh(t.id,t.bounds,t.constantHeight));continue}for(;o!==l&&n[o].idt.id===r))}}class vh{constructor(t,e){this.zScale=1,this.xOffset=0,this.yOffset=0,t.equals(e)||(this.zScale=Math.pow(2,e.z-t.z),this.xOffset=(t.x*this.zScale-e.x)*Ui,this.yOffset=(t.y*this.zScale-e.y)*Ui)}constantElevation(t,e){if(null!=t.constantHeight)return this.computeBiasedHeight(t.constantHeight,e)}pointElevation(t,e,r){const n=this.constantElevation(e,r);return null!=n?n:(t.x=t.x*this.zScale+this.xOffset,t.y=t.y*this.zScale+this.yOffset,this.computeBiasedHeight(e.pointElevation(t),r))}computeBiasedHeight(t,e){return e<=0?t:t+e*se(0,e,t>=0?t:Math.abs(.5*t))}}Qa(gh,"ElevationFeature");class bh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.projection=t.projection,this.layoutVertexArray=new _l,this.indexArray=new $l,this.segments=new bu,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut}),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new Ml),this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){const i=this.layers[0],s=[];let a=null;"circle"===i.type&&(a=i.layout.get("circle-sort-key"));for(const{feature:i,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Nc(i,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),c,r))continue;const h=a?a.evaluate(c,{},r):void 0,p={id:o,properties:i.properties,type:i.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Uc(i,r,n),patterns:{},sortKey:h};s.push(p)}a&&s.sort(((t,e)=>t.sortKey-e.sortKey));let o=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new Vl,o=n.projection);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n,l=t[s].feature;this.addFeature(n,i,s,e.availableImages,r,o,e.brightness,e.elevationFeatures),e.featureIndex.insert(l,i,s,a,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(t,e,r,n,i,s,a){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gu.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,vu.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=t.createVertexBuffer(this.elevatedLayoutVertexArray,xu.members))),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(t,e,r,n,i,s,a,o){let l;"none"!==this.elevationMode&&(l=xh.getElevationFeature(t,o));for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=Ui||n<0||n>=Ui)continue;if(s){const t=s.projectTilePoint(r,n,i),e=s.upVector(i,r,n);this.addGlobeExtVertex(t,e),this.addGlobeExtVertex(t,e),this.addGlobeExtVertex(t,e),this.addGlobeExtVertex(t,e)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=a.vertexLength;if(this.addCircleVertex(r,n,-1,-1),this.addCircleVertex(r,n,1,-1),this.addCircleVertex(r,n,1,1),this.addCircleVertex(r,n,-1,1),"none"!==this.elevationMode){const t=l?l.pointElevation(new $t(r,n)):0;this.hasElevation=this.hasElevation||0!==t;for(let e=0;e<4;e++)this.elevatedLayoutVertexArray.emplaceBack(t)}this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+2,o+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n,i,a,void 0,this.worldview)}addCircleVertex(t,e,r,n){this.layoutVertexArray.emplaceBack(2*t+(r+1)/2,2*e+(n+1)/2)}addGlobeExtVertex(t,e){const r=16384;this.globeExtVertexArray.emplaceBack(t.x,t.y,t.z,e[0]*r,e[1]*r,e[2]*r)}}function wh(t,e){for(let r=0;r1){if(Mh(t,e))return!0;for(let n=0;n1?r:r.sub(e)._mult(i)._add(e))}function Th(t,e){let r,n,i,s=!1;for(let a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Eh(t,e){let r=!1;for(let n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function Vh(t,e,r,n,i){for(const s of t)if(e<=s.x&&r<=s.y&&n>=s.x&&i>=s.y)return!0;const s=[new $t(e,r),new $t(e,i),new $t(n,i),new $t(n,r)];if(t.length>2)for(const e of s)if(Eh(t,e))return!0;for(let e=0;ei.x&&e.x>i.x||t.yi.y&&e.y>i.y)return!1;const s=Ie(t,e,r[0]);return s!==Ie(t,e,r[1])||s!==Ie(t,e,r[2])||s!==Ie(t,e,r[3])}function Ch(t,e,r,n,i,s){let a=e.y-t.y,o=t.x-e.x;if(s=s||0){const t=a*a+o*o;if(0===t)return!0;const e=Math.sqrt(t);a/=e,o/=e}return!((r.x-t.x)*a+(r.y-t.y)*o-s<0||(n.x-t.x)*a+(n.y-t.y)*o-s<0||(i.x-t.x)*a+(i.y-t.y)*o-s<0)}function Dh(t,e,r,n,i,s,a){return!(Ch(t,e,n,i,s,a)||Ch(e,r,n,i,s,a)||Ch(r,t,n,i,s,a)||Ch(n,i,t,e,r,a)||Ch(i,s,t,e,r,a)||Ch(s,n,t,e,r,a))}function Rh(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Lh(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Oh(t,e,r,n,i){if(!e[0]&&!e[1])return t;const s=$t.convert(e)._mult(i);"viewport"===r&&s._rotate(-n);const a=[];for(let e=0;e>e&&t.y===this.y>>e}url(t,e){const r=function(t,e,r){var n=$h(256*t,256*(e=Math.pow(2,r)-e-1),r),i=$h(256*(t+1),256*(e+1),r);return n[0]+","+n[1]+","+i[0]+","+i[1]}(this.x,this.y,this.z),n=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<this.canonical.z?new Hh(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hh(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e=!0){if(this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return Xh(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-t;return Xh(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Hh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Hh(e,this.wrap,e,r,n),new Hh(e,this.wrap,e,r+1,n),new Hh(e,this.wrap,e,r,n+1),new Hh(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y{let e=t.canonical.x-1,r=t.wrap;return e<0&&(e=(1<{let e=t.canonical.x+1,r=t.wrap;return e===1<new Hh(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<new Hh(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<1?null:function(t,e,r,n){const i=Math.sin(r);return t*(Math.sin((1-n)*r)/i)+e*(Math.sin(n*r)/i)}(t.a[e],t.b[e],t.angle,ie(r,0,1))+t.center[e]}function ip(t){if(t.z<=1)return tp[t.z+2*t.y+t.x];const e=cp(up(t));return mh.fromPoints(e)}function sp(t,e,r){return N(t,t,1-r),j(t,t,e,r)}function ap(t,e){const r=Ap(e.zoom);if(0===r)return ip(t);const n=up(t),i=cp(n),s=wc(n.getWest())*e.worldSize,a=wc(n.getEast())*e.worldSize,o=_c(n.getNorth())*e.worldSize,l=_c(n.getSouth())*e.worldSize,u=[s,o,0],c=[a,o,0],h=[s,l,0],p=[a,l,0],d=y([],e.globeMatrix);return K(u,u,d),K(c,c,d),K(h,h,d),K(p,p,d),i[0]=sp(i[0],h,r),i[1]=sp(i[1],p,r),i[2]=sp(i[2],c,r),i[3]=sp(i[3],u,r),mh.fromPoints(i)}function op(t,e,r){for(const n of t)K(n,n,e),N(n,n,r)}function lp(t,e,r,n){const i=e/t.worldSize,s=t.globeMatrix;if(r.z<=1){const t=ip(r).getCorners();return op(t,s,i),mh.fromPoints(t)}const a=up(r,n),o=cp(a,rc+Qh(t._tileCoverLift));op(o,s,i);const l=Number.MAX_VALUE,u=[-l,-l,-l],c=[l,l,l];if(a.contains(t.center)){for(const t of o)O(c,c,t),U(u,u,t);u[2]=0;const e=t.point,r=[e.x*i,e.y*i,0];return O(c,c,r),U(u,u,r),new mh(c,u)}if(t._tileCoverLift>0){for(const t of o)O(c,c,t),U(u,u,t);return new mh(c,u)}const h=[s[12]*i,s[13]*i,s[14]*i],p=a.getCenter(),d=ie(t.center.lat,-Pc,Pc),f=ie(p.lat,-Pc,Pc),m=wc(t.center.lng),y=_c(d);let g=m-wc(p.lng);const x=y-_c(f);g>.5?g-=1:g<-.5&&(g+=1);let v=0;Math.abs(g)>Math.abs(x)?v=g>=0?1:3:(v=x>=0?0:2,j(h,h,[s[4]*i,s[5]*i,s[6]*i],-Math.sin(Xt(x>=0?a.getSouth():a.getNorth()))*rc));const b=o[v],w=o[(v+1)%4],_=new rp(b,w,h),A=[np(_,0)||b[0],np(_,1)||b[1],np(_,2)||b[2]],I=Ap(t.zoom);if(I>0){const n=function({x:t,y:e,z:r},n,i,s,a){const o=1/(1<.5?p=-1:d<-.5&&(p=1),l=((l+p)*n-(s*=n))*i+s,u=((u+p)*n-s)*i+s,c=(c*n-(a*=n))*i+a,h=(h*n-a)*i+a,[[l,h,0],[u,h,0],[u,c,0],[l,c,0]]}(r,e,t._pixelsPerMercatorPixel,m,y);for(let t=0;t0;return 0===n&&!i&&!s}function Sp(t,e,r,n){const i=e.getNorth(),s=e.getSouth(),a=e.getWest(),o=e.getEast(),l=1<0){const t=180/n;u(f,f,[t/c+1,0,0,0,t/h+1,0,-.5*t/p,.5*t/d,1])}return f[2]=l,f[5]=t.x,f[8]=t.y,f}function Pp(t){const e=Pc-5;t=ie(t,-e,e)/e*90;const r=Math.pow(Math.abs(Math.sin(Xt(t))),3);return Math.round(r*(lc.length-1))}function kp(t){const e=[0,0,0],r=f(new Float64Array(16));return g(r,t.pixelMatrix,t.globeMatrix),K(e,e,r),new $t(e[0],e[1])}function Bp(t,e){const r=dc(e.lat,e.lng),n=function(t){const e=dc(t._center.lat,t._center.lng);let r=W([],F(0,1,0),e);const n=I([],-t.angle,e);r=K(r,r,n),I(n,-t._pitch,r);const i=X([],e);return N(i,i,Qh(t.cameraToCenterDistance/t.pixelsPerMeter)),K(i,i,n),D([],e,i)}(t);return a=(i=R([],n,r))[0],o=i[1],l=i[2],u=(s=r)[0],c=s[1],h=s[2],d=(p=Math.sqrt((a*a+o*o+l*l)*(u*u+c*c+h*h)))&&Z(i,s)/p,Math.acos(Math.min(Math.max(d,-1),1));var i,s,a,o,l,u,c,h,p,d}function zp(t,e){return Bp(t,e)>Math.PI/2*1.01}function Tp(t){const e=f(new Float64Array(16));g(e,t.pixelMatrix,t.globeMatrix);const r=[0,uc,0],n=[0,cc,0];return K(r,r,e),K(n,n,e),[r[0]>0&&r[0]<=t.width&&r[1]>0&&r[1]<=t.height&&!zp(t,new yc(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!zp(t,new yc(t.center.lat,-90))]}const Ep=Xt(85),Vp=Math.cos(Ep),Fp=Math.sin(Ep);class Cp{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy()}_fillGridMeshWithLods(t,e){const r=new _l,n=new $l,i=[],s=t+1+2,a=e[0]+1,o=e[0]+1+(1+e.length),l=(t,e,r)=>{let n=t===s-1?t-2:0===t?t:t-1;return n+=r?24575:0,[n,e]};for(let t=0;t({u_camera_to_center_distance:new Tu(t),u_extrude_scale:new Nu(t),u_device_pixel_ratio:new Tu(t),u_matrix:new Ru(t),u_inv_rot_matrix:new Ru(t),u_merc_center:new Eu(t),u_tile_id:new Vu(t),u_zoom_transition:new Tu(t),u_up_dir:new Vu(t),u_emissive_strength:new Tu(t)}),Rp=h(),Lp=(t,e,r,n,i,s)=>{const a=t.transform,o="globe"===a.projection.name;let l;if("map"===s.paint.get("circle-pitch-alignment"))if(o){const t=xp(a.zoom,e.canonical)*a._pixelsPerMercatorPixel;l=Float32Array.from([t,0,0,t])}else l=a.calculatePixelsToTileUnitsMatrix(r);else l=new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1]]);const u={u_camera_to_center_distance:t.transform.getCameraToCenterDistance(a.projection),u_matrix:t.translatePosMatrix(e.projMatrix,r,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:lr.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:Rp,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get("circle-emissive-strength")};if(o){u.u_inv_rot_matrix=n,u.u_merc_center=i,u.u_tile_id=[e.canonical.x,e.canonical.y,1<{const e=[];return"map"===t.paint.get("circle-pitch-alignment")&&e.push("PITCH_WITH_MAP"),"map"===t.paint.get("circle-pitch-scale")&&e.push("SCALE_WITH_MAP"),e};function Up(t,e,r,n,i,s,a,o,l){if(s&&t.queryGeometry.isAboveHorizon)return!1;s&&(l*=t.pixelToTileUnitsFactor);const u=t.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(const h of e)for(const e of h){const h=e.add(o),p=i&&r.elevation?r.elevation.exaggeration()*i.getElevationAt(h.x,h.y,!0):0,d=r.projection.projectTilePoint(h.x,h.y,u);if(p>0){const t=r.projection.upVector(u,h.x,h.y);d.x+=t[0]*c*p,d.y+=t[1]*c*p,d.z+=t[2]*c*p}const f=s?h:Np(d.x,d.y,d.z,n),m=s?t.tilespaceRays.map((t=>Gp(t,p))):t.queryGeometry.screenGeometry,y=dt([],[d.x,d.y,d.z,1],n);if(!a&&s?l*=y[3]/r.cameraToCenterDistance:a&&!s&&(l*=r.cameraToCenterDistance/y[3]),s){const t=Mc((e.y/Ui+u.y)/(1<t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const l=t.data,u=e.data,c=4===s&&o;for(let o=0;o{e[t.evaluationKey]=s;const a=t.expression.evaluate(e),o=a?a.toNonPremultipliedRenderColor(null):null;o&&(i.data[r+n+0]=Math.floor(255*o.r),i.data[r+n+1]=Math.floor(255*o.g),i.data[r+n+2]=Math.floor(255*o.b),i.data[r+n+3]=Math.floor(255*o.a))};if(t.clips)for(let e=0,i=0;e80*r){o=t[0],l=t[1];let e=o,n=l;for(let s=r;se&&(e=r),i>n&&(n=i)}u=Math.max(e-o,n-l),u=0!==u?32767/u:0}return cd(s,a,r,o,l,u,0),a}function ld(t,e,r,n,i){let s;if(i===function(t,e,r,n){let i=0;for(let s=e,a=r-n;s0)for(let i=e;i=e;i-=n)s=zd(i/n|0,t[i],t[i+1],s);return s&&Id(s,s.next)&&(Td(s),s=s.next),s}function ud(t,e){if(!t)return t;e||(e=t);let r,n=t;do{if(r=!1,n.steiner||!Id(n,n.next)&&0!==Ad(n.prev,n,n.next))n=n.next;else{if(Td(n),n=e=n.prev,n===n.next)break;r=!0}}while(r||n!==e);return e}function cd(t,e,r,n,i,s,a){if(!t)return;!a&&s&&function(t,e,r,n){let i=t;do{0===i.z&&(i.z=xd(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,r=1;do{let n,i=t;t=null;let s=null;for(e=0;i;){e++;let a=i,o=0;for(let t=0;t0||l>0&&a;)0!==o&&(0===l||!a||i.z<=a.z)?(n=i,i=i.nextZ,o--):(n=a,a=a.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=a}s.nextZ=null,r*=2}while(e>1)}(i)}(t,n,i,s);let o=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(s?pd(t,n,i,s):hd(t))e.push(l.i,t.i,u.i),Td(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?cd(t=dd(ud(t),e),e,r,n,i,s,2):2===a&&fd(t,e,r,n,i,s):cd(ud(t),e,r,n,i,s,1);break}}}function hd(t){const e=t.prev,r=t,n=t.next;if(Ad(e,r,n)>=0)return!1;const i=e.x,s=r.x,a=n.x,o=e.y,l=r.y,u=n.y,c=Math.min(i,s,a),h=Math.min(o,l,u),p=Math.max(i,s,a),d=Math.max(o,l,u);let f=n.next;for(;f!==e;){if(f.x>=c&&f.x<=p&&f.y>=h&&f.y<=d&&wd(i,o,s,l,a,u,f.x,f.y)&&Ad(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function pd(t,e,r,n){const i=t.prev,s=t,a=t.next;if(Ad(i,s,a)>=0)return!1;const o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,p=a.y,d=Math.min(o,l,u),f=Math.min(c,h,p),m=Math.max(o,l,u),y=Math.max(c,h,p),g=xd(d,f,e,r,n),x=xd(m,y,e,r,n);let v=t.prevZ,b=t.nextZ;for(;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==i&&v!==a&&wd(o,c,l,h,u,p,v.x,v.y)&&Ad(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=d&&b.x<=m&&b.y>=f&&b.y<=y&&b!==i&&b!==a&&wd(o,c,l,h,u,p,b.x,b.y)&&Ad(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==i&&v!==a&&wd(o,c,l,h,u,p,v.x,v.y)&&Ad(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=d&&b.x<=m&&b.y>=f&&b.y<=y&&b!==i&&b!==a&&wd(o,c,l,h,u,p,b.x,b.y)&&Ad(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function dd(t,e){let r=t;do{const n=r.prev,i=r.next.next;!Id(n,i)&&Md(n,r,r.next,i)&&kd(n,i)&&kd(i,n)&&(e.push(n.i,r.i,i.i),Td(r),Td(r.next),r=t=i),r=r.next}while(r!==t);return ud(r)}function fd(t,e,r,n,i,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&_d(a,t)){let o=Bd(a,t);return a=ud(a,a.next),o=ud(o,o.next),cd(a,e,r,n,i,s,0),void cd(o,e,r,n,i,s,0)}t=t.next}a=a.next}while(a!==t)}function md(t,e){let r=t.x-e.x;return 0===r&&(r=t.y-e.y,0===r)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),r}function yd(t,e){const r=function(t,e){let r=e;const n=t.x,i=t.y;let s,a=-1/0;if(Id(t,r))return r;do{if(Id(t,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const t=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=n&&t>a&&(a=t,s=r.x=r.x&&r.x>=l&&n!==r.x&&bd(is.x||r.x===s.x&&gd(s,r)))&&(s=r,c=e)}r=r.next}while(r!==o);return s}(t,e);if(!r)return e;const n=Bd(r,t);return ud(n,n.next),ud(r,r.next)}function gd(t,e){return Ad(t.prev,t,e.prev)<0&&Ad(e.next,t,t.next)<0}function xd(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vd(t){let e=t,r=t;do{(e.x=(t-a)*(s-o)&&(t-a)*(n-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(i-a)*(n-o)}function wd(t,e,r,n,i,s,a,o){return!(t===a&&e===o)&&bd(t,e,r,n,i,s,a,o)}function _d(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Md(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(kd(t,e)&&kd(e,t)&&function(t,e){let r=t,n=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ad(t.prev,t,e.prev)||Ad(t,e.prev,e))||Id(t,e)&&Ad(t.prev,t,t.next)>0&&Ad(e.prev,e,e.next)>0)}function Ad(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Id(t,e){return t.x===e.x&&t.y===e.y}function Md(t,e,r,n){const i=Pd(Ad(t,e,r)),s=Pd(Ad(t,e,n)),a=Pd(Ad(r,n,t)),o=Pd(Ad(r,n,e));return i!==s&&a!==o||!(0!==i||!Sd(t,r,e))||!(0!==s||!Sd(t,n,e))||!(0!==a||!Sd(r,t,n))||!(0!==o||!Sd(r,e,n))}function Sd(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Pd(t){return t>0?1:t<0?-1:0}function kd(t,e){return Ad(t.prev,t,t.next)<0?Ad(t,e,t.next)>=0&&Ad(t,t.prev,e)>=0:Ad(t,e,t.prev)<0||Ad(t,t.next,e)<0}function Bd(t,e){const r=Ed(t.i,t.x,t.y),n=Ed(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function zd(t,e,r,n){const i=Ed(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Td(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ed(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Vd(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e1)for(let t=0;t=Ui&&e>=Ui}static evaluate(t){if(0===t.length)return new Od;let e=[];for(const r of t)e.push(...r.portals);if(0===e.length)return new Od;for(const t of e){const e=t.va,r=t.vb;(Od.isOnBorder(e.x,r.x)||Od.isOnBorder(e.y,r.y))&&(t.type="border")}const r=e.filter((t=>"unevaluated"!==t.type)),n=e.filter((t=>"unevaluated"===t.type));if(0===n.length)return new Od;n.sort(((t,e)=>t.hash===e.hash?t.isTunnel===e.isTunnel?0:t.isTunnel?-1:1:t.hasht.hash"fill-tunnel-structure-color"!==t)),this.tunnelProgramConfigurations=new Yu(e,{zoom:r,lut:n},(t=>"fill-bridge-guard-rail-color"!==t))}addVertices(t,e){const r=this.unevalVertices.length;for(let r=0;r=i.min.x&&u.x<=i.max.x&&u.y>=i.min.y&&u.y<=i.max.y||c.x>=i.min.x&&c.x<=i.max.x&&c.y>=i.min.y&&c.y<=i.max.y||Fh(u,c,a)))continue;if(this.isOnBorder(u.x,c.x)||this.isOnBorder(u.y,c.y))continue;const h=Nd.computeEdgeHash(this.unevalVertices[r],this.unevalVertices[l]);let p,d=this.vertexHashLookup.get(Nd.computePosHash(u));null!=d?p=d.next:(d=this.vertexHashLookup.get(Nd.computePosHash(c)),p=null!=d?d.prev:h),this.unevalEdges.push({polygonIdx:t,a:r,b:l,hash:h,portalHash:p,isTunnel:n,type:"unevaluated",featureInfo:s})}}addPortalCandidates(t,e,r,n,i){if(0===e.length)return;this.portalPolygons.add(t,{geometry:e,zLevel:i});const s=e[0];this.vertexHashLookup.clear();let a=Nd.computeEdgeHash(s[s.length-2],s[s.length-1]);for(let e=0;e({vertexOffset:0,primitiveOffset:this.indexArray.length}),r=t=>{t.primitiveLength=this.indexArray.length-t.primitiveOffset},n=new Ud(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(t.portals,this.unevalEdges);const i=e(),s=e(),a=e(),o=(t,e)=>{t.sort(((t,r)=>t.type===e&&r.type!==e?-1:t.type!==e&&r.type===e?1:0));const r=t.findIndex((t=>t.type!==e));return r>=0?r:t.length};let l=0;this.unevalEdges.length>0&&(l=o(this.unevalEdges,"none"),this.constructBridgeStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters)),r(a);const u=e(),c=e();if(this.unevalEdges.length>0){const t=this.unevalEdges.splice(l),e=o(t,"tunnel")+l;this.unevalEdges.push(...t),this.constructTunnelStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:e})}r(u),n.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),r(c),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),r(s),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),r(i),this.maskSegments=bu.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.depthSegments=bu.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=bu.simpleSegment(0,a.primitiveOffset,0,a.primitiveLength),this.renderableTunnelSegments=bu.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.shadowCasterSegments=bu.simpleSegment(0,i.primitiveOffset,0,i.primitiveLength)}update(t,e,r,n,i,s,a,o){this.bridgeProgramConfigurations.updatePaintArrays(t,e,i,r,n,s,a,o),this.tunnelProgramConfigurations.updatePaintArrays(t,e,i,r,n,s,a,o)}upload(t){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=t.createVertexBuffer(this.vertexPositions,sd.members),this.vertexBufferNormal=t.createVertexBuffer(this.vertexNormals,ad.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(t),this.tunnelProgramConfigurations.upload(t))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(t,e,r,n,i){const s=(s,a)=>{for(let o=0;oC(t,e[n].x,e[n].y,r[n]*o),c=T(),h=T(),p=T(),d=T(),f=T(),m=(t,r)=>{const n=a.get(Nd.computePosHash(e[r])),i=n.from,s=n.to;if(!i||!s)return;u(c,i),u(h,r),u(p,s),tt(d),et(c,h)||(rt(f,h,c),X(d,f)),et(p,h)||(rt(f,p,h),D(d,d,X(f,f)));const o=st(d);return o>0?N(t,d,1/o):void 0};let y=Number.POSITIVE_INFINITY;this.sortSubarray(n,i.min,i.max,((t,e)=>t.featureInfo.featureIndex-e.featureInfo.featureIndex));const g=T(),x=T(),v=T(),b=T(),w=T(),_=T(),A=T(),I=T(),M=T(),S=[T(),T(),T(),T()],P=[T(),T(),T(),T()],k=[{coord:new $t(0,0),height:0},{coord:new $t(0,0),height:0}],B=(t,e)=>t>e;for(let u=i.min;ut.featureInfo.featureIndex-e.featureInfo.featureIndex;this.sortSubarray(n,i.min,i.max,o),this.sortSubarray(n,s.min,s.max,o);const l=t=>X(t,t),u=[{coord:new $t(0,0),height:0},{coord:new $t(0,0),height:0}],c=(t,e)=>tt.hash===e.hash?e.polygonIdx-t.polygonIdx:e.hash>t.hash?1:-1));let r=0,n=0,i=0,s=e[r].polygonIdx;do{n++,(n===e.length||e[r].hash!==e[n].hash)&&((1==n-r||e[n-1].polygonIdx!==s)&&(it.portalHashs.hash?r++:s.hash>i.portalHash?n++:(i.type=s.type,r++)}}}isOnBorder(t,e){return t<=0&&e<=0||t>=Ui&&e>=Ui}addFeatureSection(t,e,r,n){return t!==e&&(e=t,r.push({featureIndex:t,vertexStart:n.getVertexCount()}),n.clearVertexLookup()),e}sortSubarray(t,e,r,n){const i=t.slice(e,r);i.sort(n),t.splice(e,i.length,...i)}static computeEdgeHash(t,e){return(t.y===e.y&&t.x>e.x||t.y>e.y)&&([t,e]=[e,t]),BigInt(Nd.computePosHash(t))<<32n|BigInt(Nd.computePosHash(e))}static computePosHash(t){return((65535&t.x)<<16|65535&t.y)>>>0}}var jd,$d={exports:{}},Gd=(jd||(jd=1,function(t){function e(t,e){return t>e?1:t0){var o=n+Math.floor(a/2),l={key:e[o],data:r[o],parent:t};return l.left=i(l,e,r,n,o),l.right=i(l,e,r,o+1,s),l}return null}function s(t,e,r,n,i){if(!(r>=n)){for(var a=t[r+n>>1],o=r-1,l=n+1;;){do{o++}while(i(t[o],a)<0);do{l--}while(i(t[l],a)>0);if(o>=l)break;var u=t[o];t[o]=t[l],t[l]=u,u=e[o],e[o]=e[l],e[l]=u}s(t,e,r,l,i),s(t,e,l+1,n,i)}}r.prototype.rotateLeft=function(t){var e=t.right;e&&(t.right=e.left,e.left&&(e.left.parent=t),e.parent=t.parent),t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.left=t),t.parent=e},r.prototype.rotateRight=function(t){var e=t.left;e&&(t.left=e.right,e.right&&(e.right.parent=t),e.parent=t.parent),t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.right=t),t.parent=e},r.prototype._splay=function(t){for(;t.parent;){var e=t.parent;e.parent?e.left===t&&e.parent.left===e?(this.rotateRight(e.parent),this.rotateRight(e)):e.right===t&&e.parent.right===e?(this.rotateLeft(e.parent),this.rotateLeft(e)):e.left===t&&e.parent.right===e?(this.rotateRight(e),this.rotateLeft(e)):(this.rotateLeft(e),this.rotateRight(e)):e.left===t?this.rotateRight(e):this.rotateLeft(e)}},r.prototype.splay=function(t){for(var e,r,n,i,s;t.parent;)(r=(e=t.parent).parent)&&r.parent?((n=r.parent).left===r?n.left=t:n.right=t,t.parent=n):(t.parent=null,this._root=t),i=t.left,s=t.right,t===e.left?(r&&(r.left===e?(e.right?(r.left=e.right,r.left.parent=r):r.left=null,e.right=r,r.parent=e):(i?(r.right=i,i.parent=r):r.right=null,t.left=r,r.parent=t)),s?(e.left=s,s.parent=e):e.left=null,t.right=e,e.parent=t):(r&&(r.right===e?(e.left?(r.right=e.left,r.right.parent=r):r.right=null,e.left=r,r.parent=e):(s?(r.left=s,s.parent=r):r.left=null,t.right=r,r.parent=t)),i?(e.right=i,i.parent=e):e.right=null,t.left=e,e.parent=t)},r.prototype.replace=function(t,e){t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.parent=t.parent)},r.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},r.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},r.prototype.insert=function(t,e){var r=this._root,n=null,i=this._compare;if(this._noDuplicates)for(;r;){if(n=r,0===i(r.key,t))return;r=i(r.key,t)<0?r.right:r.left}else for(;r;)n=r,r=i(r.key,t)<0?r.right:r.left;return r={key:t,data:e,left:null,right:null,parent:n},n?i(n.key,r.key)<0?n.right=r:n.left=r:this._root=r,this.splay(r),this._size++,r},r.prototype.find=function(t){for(var e=this._root,r=this._compare;e;){var n=r(e.key,t);if(n<0)e=e.right;else{if(!(n>0))return e;e=e.left}}return null},r.prototype.contains=function(t){for(var e=this._root,r=this._compare;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},r.prototype.remove=function(t){var e=this.find(t);if(!e)return!1;if(this.splay(e),e.left)if(e.right){var r=this.minNode(e.right);r.parent!==e&&(this.replace(r,r.right),r.right=e.right,r.right.parent=r),this.replace(e,r),r.left=e.left,r.left.parent=r}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0},r.prototype.removeNode=function(t){if(!t)return!1;if(this.splay(t),t.left)if(t.right){var e=this.minNode(t.right);e.parent!==t&&(this.replace(e,e.right),e.right=t.right,e.right.parent=e),this.replace(t,e),e.left=t.left,e.left.parent=e}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0},r.prototype.erase=function(t){var e=this.find(t);if(e){this.splay(e);var r=e.left,n=e.right,i=null;r&&(r.parent=null,i=this.maxNode(r),this.splay(i),this._root=i),n&&(r?i.right=n:this._root=n,n.parent=i),this._size--}},r.prototype.pop=function(){var t=this._root,e=null;if(t){for(;t.left;)t=t.left;e={key:t.key,data:t.data},this.remove(t.key)}return e},r.prototype.next=function(t){var e=t;if(e)if(e.right)for(e=e.right;e&&e.left;)e=e.left;else for(e=t.parent;e&&e.right===t;)t=e,e=e.parent;return e},r.prototype.prev=function(t){var e=t;if(e)if(e.left)for(e=e.left;e&&e.right;)e=e.right;else for(e=t.parent;e&&e.left===t;)t=e,e=e.parent;return e},r.prototype.forEach=function(t){for(var e=this._root,r=[],n=!1,i=0;!n;)e?(r.push(e),e=e.left):r.length>0?(t(e=r.pop(),i++),e=e.right):n=!0;return this},r.prototype.range=function(t,e,r,n){for(var i=[],s=this._compare,a=this._root;0!==i.length||a;)if(a)i.push(a),a=a.left;else{if(s((a=i.pop()).key,e)>0)break;if(s(a.key,t)>=0&&r.call(n,a))return this;a=a.right}return this},r.prototype.keys=function(){for(var t=this._root,e=[],r=[],n=!1;!n;)t?(e.push(t),t=t.left):e.length>0?(t=e.pop(),r.push(t.key),t=t.right):n=!0;return r},r.prototype.values=function(){for(var t=this._root,e=[],r=[],n=!1;!n;)t?(e.push(t),t=t.left):e.length>0?(t=e.pop(),r.push(t.data),t=t.right):n=!0;return r},r.prototype.at=function(t){for(var e=this._root,r=[],n=!1,i=0;!n;)if(e)r.push(e),e=e.left;else if(r.length>0){if(e=r.pop(),i===t)return e;i++,e=e.right}else n=!0;return null},r.prototype.load=function(t,e,r){if(void 0===t&&(t=[]),void 0===e&&(e=[]),void 0===r&&(r=!1),0!==this._size)throw new Error("bulk-load: tree is not empty");var n=t.length;return r&&s(t,e,0,n-1,this._compare),this._root=i(null,t,e,0,n),this._size=n,this},r.prototype.min=function(){var t=this.minNode(this._root);return t?t.key:null},r.prototype.max=function(){var t=this.maxNode(this._root);return t?t.key:null},r.prototype.isEmpty=function(){return null===this._root},n.size.get=function(){return this._size},r.createTree=function(t,e,n,i,s){return new r(n,s).load(t,e,i)},Object.defineProperties(r.prototype,n);var a=0,o=1,l=2,u=3,c=0,h=1,p=2,d=3;function f(t,e,r){null===e?(t.inOut=!1,t.otherInOut=!0):(t.isSubject===e.isSubject?(t.inOut=!e.inOut,t.otherInOut=e.otherInOut):(t.inOut=!e.otherInOut,t.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(t.prevInResult=!m(e,r)||e.isVertical()?e.prevInResult:e));var n=m(t,r);t.resultTransition=n?function(t,e){var r,n=!t.inOut,i=!t.otherInOut;switch(e){case c:r=n&&i;break;case h:r=n||i;break;case d:r=n^i;break;case p:r=t.isSubject?n&&!i:i&&!n}return r?1:-1}(t,r):0}function m(t,e){switch(t.type){case a:switch(e){case c:return!t.otherInOut;case h:return t.otherInOut;case p:return t.isSubject&&t.otherInOut||!t.isSubject&&!t.otherInOut;case d:return!0}break;case l:return e===c||e===h;case u:return e===p;case o:return!1}return!1}var y=function(t,e,r,n,i){this.left=e,this.point=t,this.otherEvent=r,this.isSubject=n,this.type=i||a,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},g={inResult:{configurable:!0}};function x(t,e){return t[0]===e[0]&&t[1]===e[1]}y.prototype.isBelow=function(t){var e=this.point,r=this.otherEvent.point;return this.left?(e[0]-t[0])*(r[1]-t[1])-(r[0]-t[0])*(e[1]-t[1])>0:(r[0]-t[0])*(e[1]-t[1])-(e[0]-t[0])*(r[1]-t[1])>0},y.prototype.isAbove=function(t){return!this.isBelow(t)},y.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},g.inResult.get=function(){return 0!==this.resultTransition},y.prototype.clone=function(){var t=new y(this.point,this.left,this.otherEvent,this.isSubject,this.type);return t.contourId=this.contourId,t.resultTransition=this.resultTransition,t.prevInResult=this.prevInResult,t.isExteriorRing=this.isExteriorRing,t.inOut=this.inOut,t.otherInOut=this.otherInOut,t},Object.defineProperties(y.prototype,g);var v=11102230246251565e-32,b=134217729,w=(3+8*v)*v;function _(t,e,r,n,i){var s,a,o,l,u=e[0],c=n[0],h=0,p=0;c>u==c>-u?(s=u,u=e[++h]):(s=c,c=n[++p]);var d=0;if(hu==c>-u?(o=s-((a=u+s)-u),u=e[++h]):(o=s-((a=c+s)-c),c=n[++p]),s=a,0!==o&&(i[d++]=o);hu==c>-u?(o=s-((a=s+u)-(l=a-s))+(u-l),u=e[++h]):(o=s-((a=s+c)-(l=a-s))+(c-l),c=n[++p]),s=a,0!==o&&(i[d++]=o);for(;h0!=o>0)return l;var u=Math.abs(a+o);return Math.abs(l)>=I*u?l:-function(t,e,r,n,i,s,a){var o,l,u,c,h,p,d,f,m,y,g,x,v,A,I,E,V,F,C=t-i,D=r-i,R=e-s,L=n-s;P[0]=(I=(f=C-(d=(p=b*C)-(p-C)))*(y=L-(m=(p=b*L)-(p-L)))-((A=C*L)-d*m-f*m-d*y))-((g=I-(V=(f=R-(d=(p=b*R)-(p-R)))*(y=D-(m=(p=b*D)-(p-D)))-((E=R*D)-d*m-f*m-d*y)))+(h=I-g))+(h-V),P[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),P[2]=x-((F=x+g)-(h=F-x))+(g-h),P[3]=F;var O=function(t,e){for(var r=e[0],n=1;n<4;n++)r+=e[n];return r}(0,P),U=M*a;if(O>=U||-O>=U)return O;if(o=t-(C+(h=t-C))+(h-i),u=r-(D+(h=r-D))+(h-i),l=e-(R+(h=e-R))+(h-s),c=n-(L+(h=n-L))+(h-s),0===o&&0===l&&0===u&&0===c)return O;if(U=S*a+w*Math.abs(O),(O+=C*c+L*o-(R*u+D*l))>=U||-O>=U)return O;T[0]=(I=(f=o-(d=(p=b*o)-(p-o)))*(y=L-(m=(p=b*L)-(p-L)))-((A=o*L)-d*m-f*m-d*y))-((g=I-(V=(f=l-(d=(p=b*l)-(p-l)))*(y=D-(m=(p=b*D)-(p-D)))-((E=l*D)-d*m-f*m-d*y)))+(h=I-g))+(h-V),T[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),T[2]=x-((F=x+g)-(h=F-x))+(g-h),T[3]=F;var N=_(4,P,4,T,k);T[0]=(I=(f=C-(d=(p=b*C)-(p-C)))*(y=c-(m=(p=b*c)-(p-c)))-((A=C*c)-d*m-f*m-d*y))-((g=I-(V=(f=R-(d=(p=b*R)-(p-R)))*(y=u-(m=(p=b*u)-(p-u)))-((E=R*u)-d*m-f*m-d*y)))+(h=I-g))+(h-V),T[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),T[2]=x-((F=x+g)-(h=F-x))+(g-h),T[3]=F;var j=_(N,k,4,T,B);T[0]=(I=(f=o-(d=(p=b*o)-(p-o)))*(y=c-(m=(p=b*c)-(p-c)))-((A=o*c)-d*m-f*m-d*y))-((g=I-(V=(f=l-(d=(p=b*l)-(p-l)))*(y=u-(m=(p=b*u)-(p-u)))-((E=l*u)-d*m-f*m-d*y)))+(h=I-g))+(h-V),T[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),T[2]=x-((F=x+g)-(h=F-x))+(g-h),T[3]=F;var $=_(j,B,4,T,z);return z[$-1]}(t,e,r,n,i,s,u)}(t[0],t[1],e[0],e[1],r[0],r[1]);return n>0?-1:n<0?1:0}function V(t,e){var r=t.point,n=e.point;return r[0]>n[0]?1:r[0]n[1]?1:-1:function(t,e,r,n){return t.left!==e.left?t.left?1:-1:0!==E(r,t.otherEvent.point,e.otherEvent.point)?t.isBelow(e.otherEvent.point)?-1:1:!t.isSubject&&e.isSubject?1:-1}(t,e,r)}function F(t,e,r){var n=new y(e,!1,t,t.isSubject),i=new y(e,!0,t.otherEvent,t.isSubject);return x(t.point,t.otherEvent.point)&&console.warn("what is that, a collapsed segment?",t),n.contourId=i.contourId=t.contourId,V(i,t.otherEvent)>0&&(t.otherEvent.left=!0,i.left=!1),t.otherEvent.otherEvent=i,t.otherEvent=n,r.push(i),r.push(n),r}function C(t,e){return t[0]*e[1]-t[1]*e[0]}function D(t,e){return t[0]*e[0]+t[1]*e[1]}function R(t,e,r){var n=function(t,e,r,n,i){var s=[e[0]-t[0],e[1]-t[1]],a=[n[0]-r[0],n[1]-r[1]];function o(t,e,r){return[t[0]+e*r[0],t[1]+e*r[1]]}var l=[r[0]-t[0],r[1]-t[1]],u=C(s,a),c=u*u,h=D(s,s);if(c>0){var p=C(l,a)/u;if(p<0||p>1)return null;var d=C(l,s)/u;return d<0||d>1?null:0===p||1===p?[o(t,p,s)]:0===d||1===d?[o(r,d,a)]:[o(t,p,s)]}if((c=(u=C(l,s))*u)>0)return null;var f=D(s,l)/h,m=f+D(s,a)/h,y=Math.min(f,m),g=Math.max(f,m);return y<=1&&g>=0?1===y?[o(t,y>0?y:0,s)]:0===g?[o(t,g<1?g:1,s)]:[o(t,y>0?y:0,s),o(t,g<1?g:1,s)]:null}(t.point,t.otherEvent.point,e.point,e.otherEvent.point),i=n?n.length:0;if(0===i)return 0;if(1===i&&(x(t.point,e.point)||x(t.otherEvent.point,e.otherEvent.point)))return 0;if(2===i&&t.isSubject===e.isSubject)return 0;if(1===i)return x(t.point,n[0])||x(t.otherEvent.point,n[0])||F(t,n[0],r),x(e.point,n[0])||x(e.otherEvent.point,n[0])||F(e,n[0],r),1;var s=[],a=!1,c=!1;return x(t.point,e.point)?a=!0:1===V(t,e)?s.push(e,t):s.push(t,e),x(t.otherEvent.point,e.otherEvent.point)?c=!0:1===V(t.otherEvent,e.otherEvent)?s.push(e.otherEvent,t.otherEvent):s.push(t.otherEvent,e.otherEvent),a&&c||a?(e.type=o,t.type=e.inOut===t.inOut?l:u,a&&!c&&F(s[1].otherEvent,s[0].point,r),2):c?(F(s[0],s[1].point,r),3):s[0]!==s[3].otherEvent?(F(s[0],s[1].point,r),F(s[1],s[2].point,r),3):(F(s[0],s[1].point,r),F(s[3].otherEvent,s[2].point,r),3)}function L(t,e){if(t===e)return 0;if(0!==E(t.point,t.otherEvent.point,e.point)||0!==E(t.point,t.otherEvent.point,e.otherEvent.point))return x(t.point,e.point)?t.isBelow(e.otherEvent.point)?-1:1:t.point[0]===e.point[0]?t.point[1]e.contourId?1:-1:1===V(t,e)?1:-1}var O=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function U(t,e,r,n){var i,s=t+1,a=e[t].point,o=e.length;for(sn;)s--;return s}O.prototype.isExterior=function(){return null==this.holeOf};var N=$,j=$;function $(t,e){if(!(this instanceof $))return new $(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||G,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}function G(t,e){return te?1:0}$.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=o,t=s}e[t]=i}},N.default=j;var q=Math.max,H=Math.min,X=0;function Z(t,e,r,n,i,s){var a,o,l,u,c,h;for(a=0,o=t.length-1;a0?h.left=!0:c.left=!0;var p=l[0],d=l[1];i[0]=H(i[0],p),i[1]=H(i[1],d),i[2]=q(i[2],p),i[3]=q(i[3],d),n.push(c),n.push(h)}}var W=[];function Y(t,e,n){"number"==typeof t[0][0][0]&&(t=[t]),"number"==typeof e[0][0][0]&&(e=[e]);var i=function(t,e,r){var n=null;return t.length*e.length==0&&(r===c?n=W:r===p?n=t:r!==h&&r!==d||(n=0===t.length?e:t)),n}(t,e,n);if(i)return i===W?null:i;var s=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],o=function(t,e,r,n,i){var s,a,o,l,u,c,h=new N(null,V);for(o=0,l=t.length;on[2]||n[0]>r[2]||r[1]>n[3]||n[1]>r[3])&&(i===c?s=W:i===p?s=t:i!==h&&i!==d||(s=t.concat(e))),s}(t,e,s,a,n))return i===W?null:i;for(var l=function(t){var e,r,n=function(t){var e,r,n,i,s=[];for(r=0,n=t.length;r0){var a=e[s];if(null!=a.holeOf){var o=a.holeOf;e[o].holeIds.push(r),n.holeOf=o,n.depth=e[s].depth}else e[s].holeIds.push(r),n.holeOf=s,n.depth=e[s].depth+1}else n.holeOf=null,n.depth=e[s].depth}else n.holeOf=null,n.depth=0;return n}(n[e],s,t),a=function(e){i[e]=!0,e=n.length)&&n[o];);s.push(r)}};for(e=0,r=n.length;em||a===p&&y.point[0]>i[2])break;if(y.left){l=o=h.insert(y),o=o!==(u=h.minNode())?h.prev(o):null,l=h.next(l);var g=o?o.key:null;if(f(y,g,a),l&&2===R(y,l.key,t)&&(f(y,g,a),f(l.key,y,a)),o&&2===R(o.key,y,t)){var x=o;f(g,(x=x!==u?h.prev(x):null)?x.key:null,a),f(y,g,a)}}else l=o=h.find(y=y.otherEvent),o&&l&&(o=o!==u?h.prev(o):null,l=h.next(l),h.remove(y),l&&o&&R(o.key,l.key,t))}return d}(o,0,0,s,a,n)),u=[],m=0;m * @license MIT * @preserve */function qd(t,e,r,n){const i=[],s=0===n?(t,e,r,n,i,s)=>{t.push(new $t(s,r+(s-e)/(n-e)*(i-r)))}:(t,e,r,n,i,s)=>{t.push(new $t(e+(s-r)/(i-r)*(n-e),s))};for(const a of t){const t=[];for(const i of a){if(i.length<=2)continue;const a=[];for(let t=0;te&&s(a,o,l,u,c,e):h>r?p=e&&s(a,o,l,u,c,e),p>r&&h<=r&&s(a,o,l,u,c,r)}let o=i[i.length-1];const l=0===n?o.x:o.y;l>=e&&l<=r&&a.push(o),a.length&&(o=a[a.length-1],a[0].x===o.x&&a[0].y===o.y||a.push(a[0]),t.push(a))}t.length&&i.push(t)}return i}function Hd(t,e){const r=Zd(t),n=Zd([e]),i=Gd.intersection(r,n);return null==i?[]:Wd(i)}function Xd(t,e){const r=65536;let n=Zd(t,r);const i=[];for(;e.valid();e.next()){const[t,n]=e.get(),s=t.x*r,a=t.y*r,o=n.x*r,l=n.y*r,u=o-s,c=l-a,h=Math.hypot(u,c);if(0===h)continue;const p=Math.trunc(c/h*3),d=-Math.trunc(u/h*3);i.push([[[s,a],[o,l],[o+p,l+d],[s+p,a+d],[s,a]]])}return i.length>0&&(n=Gd.diff(n,i)),Wd(n,1/r)}function Zd(t,e=1){return[t.map((t=>t.map((t=>[t.x*e,t.y*e]))))]}function Wd(t,e=1){return t.map((t=>t.map(((t,r)=>{const n=t.map((t=>new $t(t[0]*e,t[1]*e).round()));return r>0&&n.reverse(),n}))))}class Yd{constructor(t,e){this.layoutVertexArray=new _l,this.indexArray=new $l,this.lineIndexArray=new Ll,this.triangleSegments=new bu,this.lineSegments=new bu,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut}),this.uploaded=!1,e&&(this.elevatedLayoutVertexArray=new Ml)}update(t,e,r,n,i,s,a,o){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,o)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,nd.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.lineIndexBuffer=t.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=t.createVertexBuffer(this.elevatedLayoutVertexArray,id.members))),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(t,e,r,n,i,s,a){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,e,r,n,i,s,void 0,a)}}class Kd{constructor(t){this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=t.lut,this.bufferData=new Yd(t,!1),this.elevationBufferData=new Yd(t,!0),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.projection=t.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=t.sourceLayerIndex,this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){this.hasPattern=Dd("fill",this.layers,this.pixelRatio,e);const i=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Nc(a,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),c,r))continue;const h=i?i.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Uc(a,r,n),patterns:{},sortKey:h};s.push(p)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Rd("fill",this.layers,n,this.zoom,this.pixelRatio,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{},e.availableImages,e.brightness,e.elevationFeatures);e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r,n,i,s,a){this.bufferData.update(t,e,r,n,i,s,a,this.worldview),this.elevationBufferData.update(t,e,r,n,i,s,a,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(t,e,r,n,i,s,a,this.worldview)}addFeatures(t,e,r,n,i,s){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,n,s,t.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(t){this.bufferData.upload(t),this.elevationBufferData.upload(t),this.elevatedStructures&&this.elevatedStructures.upload(t)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(t,e,r,n,i,s=[],a,o){const l=Vd(e,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(t,l,n,r,o):this.addGeometry(l,this.bufferData),this.bufferData.populatePaintArrays(t,r,i,s,n,a,this.worldview),this.elevationBufferData.populatePaintArrays(t,r,i,s,n,a,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(t,e,r,n,i){this.elevatedStructures&&(this.elevatedStructures.construct(t),this.elevatedStructures.populatePaintArrays(e,r,n,i,this.worldview))}addElevatedRoadFeature(t,e,r,n,i){const s=new Array,a=xh.getElevationFeature(t,i);if(!a)return void this.addGeometry(e,this.bufferData);{const t=this.clipPolygonsToTile(e,1);t.length>0&&s.push({polygons:t,elevationFeature:a,elevationTileID:r})}const o={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(t,{},r),featureIndex:n};for(const e of s)if(e.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new Nd(e.elevationTileID,this.layers,this.zoom,this.lut));const r=e.elevationFeature.isTunnel();let n=0;t.properties.hasOwnProperty(Yc)&&(n=+t.properties[Yc]);for(const t of e.polygons)this.elevatedStructures.addPortalCandidates(e.elevationFeature.id,t,r,e.elevationFeature,n)}null==e.elevationFeature.constantHeight&&(e.polygons=this.prepareElevatedPolygons(e.polygons,e.elevationFeature,e.elevationTileID));const i=new vh(r,e.elevationTileID);this.addElevatedGeometry(e.polygons,i,e.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,n,o)}}addElevatedGeometry(t,e,r,n,i,s){const a={elevation:r,elevationSampler:e,bias:n,index:i,featureInfo:s},[o,l]=this.addGeometry(t,this.elevationBufferData,a);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:o,max:l}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,o),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,l))}addGeometry(t,e,r){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=null;r&&(s=r.elevationSampler.constantElevation(r.elevation,r.bias),null!=s&&(n=s,i=s));const a=(t,a,o)=>{if(null!=r)if(a.push(t),null!=s)e.elevatedLayoutVertexArray.emplaceBack(s),o.push(s);else{const s=r.elevationSampler.pointElevation(t,r.elevation,r.bias);e.elevatedLayoutVertexArray.emplaceBack(s),o.push(s),n=Math.min(n,s),i=Math.max(i,s)}};for(const n of t){let t=0;for(const e of n)t+=e.length;const i=e.triangleSegments.prepareSegment(t,e.layoutVertexArray,e.indexArray),s=i.vertexLength,o=[],l=[],u=[],c=[],h=[],p=e.layoutVertexArray.length;for(const t of n){if(0===t.length)continue;t!==n[0]&&l.push(o.length/2);const i=e.lineSegments.prepareSegment(t.length,e.layoutVertexArray,e.lineIndexArray),s=i.vertexLength;r&&h.push(e.layoutVertexArray.length-p),a(t[0],u,c),e.layoutVertexArray.emplaceBack(t[0].x,t[0].y),e.lineIndexArray.emplaceBack(s+t.length-1,s),o.push(t[0].x),o.push(t[0].y);for(let r=1;r0&&r&&"hd-road-base"===this.elevationMode){const t=r.elevation.isTunnel(),e=r.elevation.safeArea,n=this.elevatedStructures.addVertices(u,c);this.elevatedStructures.addTriangles(d,n,t);const i=h.length;if(i>0){for(let s=0;s=r&&u.max.x<=i&&u.min.y>=n&&u.max.y<=s?o:l).push(e)}if(o.length===t.length)return t;const u=[new $t(r,n),new $t(i,n),new $t(i,s),new $t(r,s),new $t(r,n)],c=o;for(const t of l)c.push(...Hd(t,u));return c}}let Jd,Qd,tf,ef;Qa(Kd,"FillBucket",{omit:["layers","patternFeatures"]}),Qa(Yd,"FillBufferData"),Qa(Nd,"ElevatedStructures");class rf{constructor(t,e,r,n){if(this.triangleCount=e.length/3,this.min=new $t(0,0),this.max=new $t(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===t.length)return;const[i,s]=[t[0].clone(),t[0].clone()];for(let e=1;et.cellIdx-e.cellIdx||t.triIdx-e.triIdx));let u=0;for(;uthis.max.x||this.min.x>t.x||t.y>this.max.y||this.min.y>t.y)return;const r=nf(t.x-this.min.x,this.xScale,this.cellsX),n=nf(t.y-this.min.y,this.yScale,this.cellsY),i=this.cells[n*this.cellsX+r];if(i){this._lazyInitLookup();for(let t=0;tthis.max.x||this.min.x>e.x)return;if(t.y>this.max.y||this.min.y>e.y)return;this._lazyInitLookup();const n=nf(t.x-this.min.x,this.xScale,this.cellsX),i=nf(e.x-this.min.x,this.xScale,this.cellsX),s=nf(t.y-this.min.y,this.yScale,this.cellsY),a=nf(e.y-this.min.y,this.yScale,this.cellsY);for(let t=s;t<=a;t++)for(let e=n;e<=i;e++){const n=this.cells[t*this.cellsX+e];if(n)for(let t=0;tt.fqid)),this.index=t.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.footprints=[],this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){for(const r of this.footprints)e.push({footprint:r,id:t})}updateAppearances(t,e,r,n){}populate(t,e,r,n){const i=[];for(const{feature:s,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Nc(s,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),u,r))continue;const c={id:a,properties:s.properties,type:s.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Uc(s,r,n),patterns:{}};i.push(c)}for(const n of i){const{geometry:i,index:s,sourceLayerIndex:a}=n;this.addFeature(n,i,s,r,{},e.availableImages,e.brightness),e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(t){}update(t,e,r,n,i,s,a){}destroy(){}addFeature(t,e,r,n,i,s=[],a){for(const t of Vd(e,2)){const e=[],r=[],n=[],i=new $t(1/0,1/0),s=new $t(-1/0,-1/0);for(const a of t)if(0!==a.length){a!==t[0]&&n.push(r.length/2);for(let t=0;te===t))}(n,t.clipScope)}class gf{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new $t(1/0,1/0),max:new $t(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t,e=!1){const r=_f(new $t(0,0),new $t(Ui,Ui),t),n=[];if(e&&!bf(r,this._globalClipBounds))return n;for(const e of this._activeRegions){if(e.hiddenByOverlap)continue;if(!bf(r,e))continue;const i=Af(e.min,e.max,t);n.push({min:i.min,max:i.max,sourceId:this._sourceIds[e.priority],footprint:e.footprint,footprintTileId:e.tileId,order:e.order,clipMask:e.clipMask,clipScope:e.clipScope})}return n}setSources(t){this._setSources(t.map((t=>({getSourceId:()=>t.cache.id,getFootprints:()=>{const e=[];for(const r of t.cache.getVisibleCoordinates()){const n=t.cache.getTile(r).buckets[t.layer];n&&n.updateFootprints(r.toUnwrapped(),e)}return e},getOrder:()=>t.order,getClipMask:()=>t.clipMask,getClipScope:()=>t.clipScope}))))}_addSource(t){const e=t.getFootprints();if(0===e.length)return;const r=t.getOrder(),n=t.getClipMask(),i=t.getClipScope();for(const t of e){if(!t.footprint)continue;const e=_f(t.footprint.min,t.footprint.max,t.id);this._activeRegions.push({min:e.min,max:e.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:t.id,footprint:t.footprint,order:r,clipMask:n,clipScope:i})}this._sourceIds.push(t.getSourceId())}_computeReplacement(){this._activeRegions.sort(((t,e)=>t.priority-e.priority||xf(t.min,e.min)||xf(t.max,e.max)||t.order-e.order||t.clipMask-e.clipMask||function(t,e){const r=(t,e)=>t+e;return t.length-e.length||t.reduce(r,"").localeCompare(e.reduce(r,""))}(t.clipScope,e.clipScope)));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let e=0;for(;!t&&e!==this._activeRegions.length;){const r=this._activeRegions[e],n=this._prevRegions[e];t=r.priority!==n.priority||!vf(r,n)||r.order!==n.order||r.clipMask!==n.clipMask||!Gt(r.clipScope,n.clipScope),this._activeRegions[e].hiddenByOverlap=n.hiddenByOverlap,++e}}if(t){++this._updateTime;for(const t of this._activeRegions)t.order!==ff&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,t.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,t.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,t.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,t.max.y));const t=t=>{const e=this._activeRegions;if(t>=e.length)return t;const r=e[t].priority;for(;t1){let e=0,r=t(e);for(;e!==r;){let n=e;const i=e;for(;n!==r;){const t=this._activeRegions[n];t.hiddenByOverlap=!1;for(let e=0;e=0;e--)this._addSource(t[e]);this._computeReplacement()}}function xf(t,e){return t.x-e.x||t.y-e.y}function vf(t,e){return 0===xf(t.min,e.min)&&0===xf(t.max,e.max)}function bf(t,e){return!(t.min.x>e.max.x||t.max.xe.max.y||t.max.ynew $t((t.x+s.x*Ui)*o-a.x*Ui,(t.y+s.y*Ui)*o-a.y*Ui)))}return If(r,i,t.indices,0,t.indices.length,0,0)}function Sf(t,e,r,n){const i=Math.pow(2,n.z-r.z);return new $t((t+r.x*Ui)*i-n.x*Ui,(e+r.y*Ui)*i-n.y*Ui)}function Pf(t,e){const r=[];e.grid.queryPoint(t,r);const n=e.indices,i=e.vertices;for(let e=0;e0&&(n.length>1&&r.push(n),n=[])}return n.length>1&&r.push(n),r}const zf=jc.types,Tf=["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"],Ef=["fill-extrusion-flood-light-ground-radius"],Vf=Math.pow(2,13),Ff=Math.pow(2,15)-1,Cf=new $t(0,1),Df=2147483648,Rf=7,Lf=450;function Of(t,e,r,n,i,s,a,o){t.emplaceBack((e<<1)+a,(r<<1)+s,(Math.floor(n*Vf)<<1)+i,Math.round(o))}function Uf(t,e,r){t.emplaceBack(e.x*Ui,e.y*Ui,r?1:0)}function Nf(t,e,r,n,i,s){t.emplaceBack(e.x,e.y,(r.x<<1)+n,(r.y<<1)+i,s)}function jf(t,e,r){const n=16384;t.emplaceBack(e.x,e.y,e.z,r[0]*n,r[1]*n,r[2]*n)}class $f{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Gf{constructor(){this.centroidXY=new $t(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 $t(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new $t(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new $t(this.max.x-this.min.x,this.max.y-this.min.y)}}class qf{constructor(){this.acc=new $t(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(t,e){t.min.x===Number.MAX_VALUE&&(t.min.x=t.max.x=e.x,t.min.y=t.max.y=e.y)}appendEdge(t,e,r){this.accCount++,this.acc._add(e);let n=!!this.borders;e.xt.max.x&&(t.max.x=e.x,n=!0),e.yt.max.y&&(t.max.y=e.y,n=!0),((0===e.x||e.x===Ui)&&e.x===r.x)!=((0===e.y||e.y===Ui)&&e.y===r.y)&&this.processBorderOverlap(e,r),n&&this.checkBorderIntersection(e,r)}checkBorderIntersection(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,dn(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>Ui!=t.x>Ui&&this.addBorderIntersection(1,dn(e.y,t.y,(Ui-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,dn(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>Ui!=t.y>Ui&&this.addBorderIntersection(3,dn(e.x,t.x,(Ui-e.y)/(t.y-e.y)))}addBorderIntersection(t,e){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[t];er[1]&&(r[1]=e)}processBorderOverlap(t,e){if(t.x===e.x){if(t.y===e.y)return;const r=0===t.x?0:1;this.addBorderIntersection(r,e.y),this.addBorderIntersection(r,t.y)}else{const r=0===t.y?2:3;this.addBorderIntersection(r,e.x),this.addBorderIntersection(r,t.x)}}centroid(){return 0===this.accCount?new $t(0,0):new $t(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(((t,e)=>t+ +(e[0]!==Number.MAX_VALUE)),0):0}}function Hf(t,e){const r=t.add(e)._unit(),n=ie(t.x*r.x+t.y*r.y,-1,1);var i,s,a;return i=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(i)))/4*Ff*((s=t).x*(a=e).y-s.y*a.x<0?-1:1)}const Xf=[t=>t.x<0,t=>t.x>Ui,t=>t.y<0,t=>t.y>Ui];function Zf(t,e,r,n){const i=[4];if(0===n)return i;r._mult(n);const s=t.sub(r),a=e.sub(r),o=[t,e,s,a];for(let t=0;t<4;t++)for(const e of o)if(Xf[t](e)){i.push(t);break}return i}class Wf{constructor(t){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new kl,this.indexArray=new $l,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut},(t=>Ef.includes(t))),this._segments=new bu,this.hiddenByLandmarkVertexArray=new nu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new bu}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(t,e,r,n=!1){const i=t.length;if(i>2){let s=Math.max(0,this._segments.get().length-1);const a=this._segments._prepareSegment(4*i,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);let o;s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{const e=t[0],r=t[1];o=Hf(e.sub(t[i-1])._perp()._unit(),r.sub(e)._perp()._unit())}for(let l=0;lt.region-e.region));for(let r=0;rt+e),0);let s=0;for(let t=0;t<=4;t++){const e=i[t];if(0!==e){let r=this.regionSegments[t];r||(r=this.regionSegments[t]=new bu);const i={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:e};r.get().push(i)}s+=e}for(let t=0;t0?this.hiddenByLandmarkVertexBuffer=t.createVertexBuffer(this.hiddenByLandmarkVertexArray,hf.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.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let t=0;t<=4;t++){const e=this.regionSegments[t];e&&e.destroy()}}}}class Yf{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.pixelRatio=t.pixelRatio,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new $l,this.footprintVertices=new _l,this.footprintSegments=[],this.layoutVertexArray=new Il,this.centroidVertexArray=new fu,this.wallVertexArray=new yu,this.indexArray=new $l,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut},(t=>Tf.includes(t))),this.segments=new bu,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.groundEffect=new Wf(t),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){this.features=[],this.hasPattern=Dd("fill-extrusion",this.layers,this.pixelRatio,e),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=Tc(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);for(const{feature:i,id:s,index:a,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,l=Nc(i,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),l,r))continue;const u={id:s,sourceLayerIndex:o,index:a,geometry:t?l.geometry:Uc(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length,h="Polygon"===zf[u.type];if(this.hasPattern)this.features.push({featureId:i.id,feature:Rd("fill-extrusion",this.layers,u,this.zoom,this.pixelRatio,e)});else if(this.wallMode)for(const t of u.geometry)for(const s of Bf(t,h))this.addFeature(i.id,u,[s],a,r,{},e.availableImages,n,e.brightness);else this.addFeature(i.id,u,u.geometry,a,r,{},e.availableImages,n,e.brightness);e.featureIndex.insert(i,u.geometry,a,o,this.index,c)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(t,e,r,n,i,s){for(const{featureId:t,feature:a}of this.features){const o="Polygon"===zf[a.type],{geometry:l}=a;if(this.wallMode)for(const u of l)for(const l of Bf(u,o))this.addFeature(t,a,[l],a.index,e,r,n,i,s);else this.addFeature(t,a,l,a.index,e,r,n,i,s)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(t,e,r,n,i,s,a){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,this.worldview),this.groundEffect.update(t,e,i,r,n,s,a,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,df),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.wallVertexBuffer=t.createVertexBuffer(this.wallVertexArray,cf.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=t.createVertexBuffer(this.layoutVertexExtArray,pf.members,!0)),this.groundEffect.upload(t)),this.groundEffect.uploadPaintProperties(t),this.programConfigurations.upload(t),this.uploaded=!0}uploadCentroid(t){this.groundEffect.uploadHiddenByLandmark(t),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,uf.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(t,e,r,n,i,s,a,o,l){const u=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,c=[new $t(0,0),new $t(Ui,Ui)],h=o.projection,p="globe"===h.name,d=this.wallMode||"Polygon"===zf[e.type],f=new qf;f.centroidDataIndex=this.centroidData.length;const m=new Gf;m.buildingId=t,e.properties&&e.properties.hasOwnProperty("building_id")&&(m.buildingId=e.properties.building_id);const y=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},i)<=0,g=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},i);let x;if(m.height=g,m.vertexArrayOffset=this.layoutVertexArray.length,m.groundVertexArrayOffset=this.groundEffect.vertexArray.length,p&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Vl),this.wallMode){if(p)return void Ae("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==r.length)return;x=function(t){const e=t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y,r=function(t){let e=0;const r=t.length;for(let n=0;n=0}(t);r||(t=t.reverse());const n={geometry:[],joinNormals:[],indices:[]},i=[],s=[],a=[];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;if(o<(e?3:2))return n;let l,u,c,h,p,d=0;for(;d0;let g="miter";const x=2;"miter"===g&&m>x&&(g="bevel"),"bevel"===g&&(m>100&&(g="flipbevel"),m{const o=new $t(t.x,t.y),l=new $t(t.x,t.y);o.x+=e.x*n,o.y+=e.y*n,l.x-=e.x*Math.max(r,1),l.y-=e.y*Math.max(r,1),a.push(e),i.push(o),s.push(l)};if("miter"===g)n._mult(m),v(l,n,0,0);else if("flipbevel"===g)n=p.mult(-1),v(l,n,0,0),v(l,n.mult(-1),0,0);else{const t=-Math.sqrt(m*m-1),e=y?t:0,r=y?0:t;u&&v(l,h,e,r),c&&v(l,p,e,r)}}n.geometry=[...i,...s.reverse(),i[0]],n.joinNormals=[...a,...a.reverse(),a[a.length-1]];const f=n.geometry.length-1;for(let t=0;tt<(e.length-1)/2||t===e.length-1,b=this.wallMode?[r]:Vd(r,500);for(let t=b.length-1;t>=0;t--){const e=b[t];(0===e.length||(w=e[0]).every((t=>t.x<=0))||w.every((t=>t.x>=Ui))||w.every((t=>t.y<=0))||w.every((t=>t.y>=Ui)))&&b.splice(t,1)}var w;let _;if(p)_=sm(b,c,i);else{_=[];for(const t of b)_.push({polygon:t,bounds:c})}const A=d?this.edgeRadius:0,I=A>0&&this.zoom<17,M=(t,e)=>{if(0===t.length)return!1;const r=t[t.length-1];return e.x===r.x&&e.y===r.y};for(const{polygon:t,bounds:e}of _){let r=0,n=0;for(const e of t)d&&!e[0].equals(e[e.length-1])&&e.push(e[0]),n+=d?e.length-1:e.length;const s=this.segments.prepareSegment((d?5:4)*n,this.layoutVertexArray,this.indexArray);m.footprintSegIdx<0&&(m.footprintSegIdx=this.footprintSegments.length),m.polygonSegIdx<0&&(m.polygonSegIdx=this.polygonSegments.length);const a={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},o=new $f;if(o.vertexOffset=this.footprintVertices.length,o.indexOffset=3*this.footprintIndices.length,o.ringIndices=[],d){const n=[],a=[];r=s.vertexLength;for(let r=0;r4&&rm(a[a.length-2],a[0],a[1]),l=A?Jf(a[a.length-2],a[0],a[1],A):0;const c=[];let g,b,w;b=a[1].sub(a[0])._perp()._unit();let _=!0;for(let t=1,n=0;t0?1:0,B=u.dist(d);if(n+B>32768&&(n=0),A){w=I.sub(d)._perp()._unit();let t=Qf(u,d,I,Kf(b,w),A);isNaN(t)&&(t=0);const e=d.sub(u)._unit();u=u.add(e.mult(l))._round(),d=d.add(e.mult(-t))._round(),l=t,b=w,y&&this.zoom>=17&&(M(c,u)||c.push(u),M(c,d)||c.push(d))}const z=s.vertexLength,T=a.length>4&&rm(u,d,I);let E=nm(n,o,_);if(Of(this.layoutVertexArray,u.x,u.y,P,k,0,0,E),Of(this.layoutVertexArray,u.x,u.y,P,k,0,1,E),this.wallMode){const e=v(t-1,a),r=x.joinNormals[t-1];Uf(this.wallVertexArray,r,e),Uf(this.wallVertexArray,r,e)}if(n+=B,E=nm(n,T,!_),o=T,Of(this.layoutVertexArray,d.x,d.y,P,k,0,0,E),Of(this.layoutVertexArray,d.x,d.y,P,k,0,1,E),this.wallMode){const e=v(t,a),r=x.joinNormals[t];Uf(this.wallVertexArray,r,e),Uf(this.wallVertexArray,r,e)}if(s.vertexLength+=4,this.indexArray.emplaceBack(z+0,z+1,z+2),this.indexArray.emplaceBack(z+1,z+3,z+2),s.primitiveLength+=2,A){const n=r+(1===t?a.length-2:t-2),i=1===t?r:n+1;if(this.indexArray.emplaceBack(z+1,n,z+3),this.indexArray.emplaceBack(n,i,z+3),s.primitiveLength+=2,void 0===g&&(g=z),!tm(I,a[t],e)){const e=t===a.length-1?g:s.vertexLength;this.indexArray.emplaceBack(z+2,z+3,e),this.indexArray.emplaceBack(z+3,e+1,e),this.indexArray.emplaceBack(z+3,i,e+1),s.primitiveLength+=3}_=!_}if(p){const t=this.layoutVertexExtArray,e=h.projectTilePoint(u.x,u.y,i),r=h.projectTilePoint(d.x,d.y,i),n=h.upVector(i,u.x,u.y),s=h.upVector(i,d.x,d.y);jf(t,e,n),jf(t,e,n),jf(t,r,s),jf(t,r,s)}}d&&(r+=a.length-1),y&&A&&this.zoom>=17&&(0!==c.length&&M(c,c[0])&&c.pop(),this.groundEffect.addData(c,e,u,A>0))}this.footprintSegments.push(o),a.triangleCount=this.indexArray.length-a.triangleArrayOffset,this.polygonSegments.push(a),++m.footprintSegLen,++m.polygonSegLen}if(m.vertexCount=this.layoutVertexArray.length-m.vertexArrayOffset,m.groundVertexCount=this.groundEffect.vertexArray.length-m.groundVertexArrayOffset,0!==m.vertexCount){if(m.centroidXY=f.borders?Cf:this.encodeCentroid(f,m),this.centroidData.push(m),f.borders){this.featuresOnBorder.push(f);const t=this.featuresOnBorder.length-1;for(let e=0;ethis.featuresOnBorder[e].borders[t][0]-this.featuresOnBorder[r].borders[t][0]))}splitToSubtiles(){const t=[];for(let e=0;eUi),i=2*n+(+(r.min.x+r.max.x>Ui)^n);for(let n=0;nt.triangleSegmentIdx===e.triangleSegmentIdx?t.subtile-e.subtile:t.triangleSegmentIdx-e.triangleSegmentIdx));let r=0,n=0,i=0;for(const e of t){if(e.triangleSegmentIdx!==r)break;i++}const s=t.length;for(;n!==t.length;){r=t[n].triangleSegmentIdx;let a=0,o=n,l=n;for(let e=o;e0&&this.triangleSubSegments.push({segment:c,min:s,max:u}),o=l;for(let e=o;e[t[0]*(1-r[0])+e[0]*r[0],t[1]*(1-r[1])+e[1]*r[1]],p=[],d=[];for(const t of this.triangleSubSegments){p[0]=t.min.x/Ui,p[1]=t.min.y/Ui,d[0]=t.max.x/Ui,d[1]=t.max.y/Ui;const e=h(u,c,p),a=h(u,c,d);if(0===new mh([e[0],e[1],i],[a[0],a[1],s]).intersectsPrecise(r)){l&&(n.segments.push(l),l=void 0);continue}const o=t.segment;l&&l.vertexOffset!==o.vertexOffset&&(n.segments.push(l),l=void 0),l?(l.vertexLength+=o.vertexLength,l.primitiveLength+=o.primitiveLength):l={vertexOffset:o.vertexOffset,primitiveLength:o.primitiveLength,vertexLength:o.vertexLength,primitiveOffset:o.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&n.segments.push(l),n}encodeCentroid(t,e){const r=t.centroid(),n=e.span(),i=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(7,Math.round(n.y*this.tileToMeter/10));return new $t(ie(r.x,1,Ui-1)<<3|i,ie(r.y,1,Ui-1)<<3|s)}encodeBorderCentroid(t){if(!t.borders)return new $t(0,0);const e=t.borders,r=Number.MAX_VALUE;if(e[0][0]!==r||e[1][0]!==r){const t=e[0][0]!==r?0:1;return new $t(6|(e[0][0]!==r?0:65528),(e[t][0]+e[t][1])/2<<3|6)}{const t=e[2][0]!==r?2:3;return new $t((e[t][0]+e[t][1])/2<<3|6,6|(e[2][0]!==r?0:65528))}}showCentroid(t){const e=this.centroidData[t.centroidDataIndex];e.flags&=2147483647,e.centroidXY.x=0,e.centroidXY.y=0,this.writeCentroidToBuffer(e)}writeCentroidToBuffer(t){this.groundEffect.updateHiddenByLandmark(t);const e=t.vertexArrayOffset,r=t.vertexCount+t.vertexArrayOffset,n=t.flags&Df?Cf:t.centroidXY,i=this.centroidVertexArray.geta_centroid_pos0(e);if(this.centroidVertexArray.geta_centroid_pos1(e)!==n.y||i!==n.x){for(let t=e;tt.max.x||t.min.x>e.max.x||e.min.y>t.max.y||t.min.y>e.max.y||e.footprint.buildingIds.has(t.buildingId)&&(t.flags|=Df);else for(const r of this.centroidData)if(!(r.flags&Df||e.min.x>r.max.x||r.min.x>e.max.x||e.min.y>r.max.y||r.min.y>e.max.y))for(let s=0;se!=l>e&&t<(this.footprintVertices.int16[2*(o+s.vertexOffset)+0]-r)*(e-a)/(l-a)+r&&(n=!n)}a=r}}return n}getHeightAtTileCoord(t,e){let r=Number.NEGATIVE_INFINITY,n=!0;const i=4*(t+Ui)*Ui+(e+Ui);if(this.partLookup.hasOwnProperty(i)){const t=this.partLookup[i];return t?{height:t.height,hidden:!!(t.flags&Df)}:void 0}for(const s of this.centroidData)t>s.max.x||s.min.x>t||e>s.max.y||s.min.y>e||s.height<=r||this.footprintContainsPoint(t,e,s)&&(r=s.height,this.partLookup[i]=s,n=!!(s.flags&Df));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:n};this.partLookup[i]=void 0}}function Kf(t,e){const r=t.add(e)._unit();return t.x*r.x+t.y*r.y}function Jf(t,e,r,n){const i=e.sub(t)._perp()._unit(),s=r.sub(e)._perp()._unit();return Qf(t,e,r,Kf(i,s),n)}function Qf(t,e,r,n,i){const s=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(r)/3,i*s/n)}function tm(t,e,r){return t.xr[1].x&&e.x>r[1].x||t.yr[1].y&&e.y>r[1].y}function em(t,e){return t.xe[1].x||t.ye[1].y}function rm(t,e,r){if(t.x<0||t.x>=Ui||e.x<0||e.x>=Ui||r.x<0||r.x>=Ui)return!1;const n=r.sub(e),i=n.perp(),s=t.sub(e);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&i.x*s.x+i.y*s.y<0}function nm(t,e,r){const n=e?2|t:-3&t;return r?1|n:-2&n}function im(){const t=Math.PI/32,e=Math.tan(t),r=fc;return r*Math.sqrt(1+2*e*e)-r}function sm(t,e,r){const n=1<{for(const r of t)a.push({polygon:r,bounds:e})},l=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(n)),c=l-u,h=[];for(let t=0;t0?0:1);for(let t=0;te+1?d.push({polygons:p,bounds:t,depth:e+1}):o(p,t)}if(f.length){const t=[new $t(0===r?c:n.x,1===r?c:n.y),a];h.length>e+1?d.push({polygons:f,bounds:t,depth:e+1}):o(f,t)}}return a}(t,e,Math.ceil((s-i)/11.25),Math.ceil((a-o)/11.25),1,((t,e,i)=>{if(0===t)return.5*(e+i);{const t=Mc((r.y+e/Ui)/n);return(_c(.5*(Mc((r.y+i/Ui)/n)+t))*n-r.y)*Ui}}))}function am(t,e,r,n,i,s){const a=Math.pow(2,n.z-i.z);for(let o=0;o=a[r]&&(n=e,a=t),n[r]i&&hm(n,a,r,i),n[r]s&&hm(a,n,r,s)}}function dm(t,e,r,n,i,s){const a=[];for(let o=0;o=n&&p.x>=n||(c.x>=n?c=new $t(n,c.y+(n-c.x)/(p.x-c.x)*(p.y-c.y))._round():p.x>=n&&(p=new $t(n,c.y+(n-c.x)/(p.x-c.x)*(p.y-c.y))._round()),c.y>=i&&p.y>=i||(c.y>=i?c=new $t(c.x+(i-c.y)/(p.y-c.y)*(p.x-c.x),i)._round():p.y>=i&&(p=new $t(c.x+(i-c.y)/(p.y-c.y)*(p.x-c.x),i)._round()),u&&c.equals(u[u.length-1])||(u=[c],a.push(u),s&&s.push({progress:{min:f+mm(m,y,c)*d,max:1},parentIndex:o,prevPoint:m,nextPoint:y})),u.push(p),s&&(s[s.length-1].progress.max=f+mm(m,y,p)*d,s[s.length-1].nextPoint=y)))))}if(s&&h>0)for(let t=c;tt.t-e.t));let a=0,o=0,l=[];for(n.push(l);a!==t.length;){if(o===s.length){for(;a!==t.length;)0!==l.length&&l[l.length-1].equals(t[a])||l.push(t[a]),a++;break}s[o].t<=a?(0!==l.length&&l[l.length-1].equals(s[o].point)||l.push(s[o].point),o++):(0!==l.length&&l[l.length-1].equals(t[a])||l.push(t[a]),a++)}}function mm(t,e,r){return t.x!==e.x?(r.x-t.x)/(e.x-t.x):t.y!==e.y?(r.y-t.y)/(e.y-t.y):0}function ym(t,e){return t.x*e.x+t.y*e.y}function gm(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r{t[0]=e,t[1]=r,t[2]=n,t[3]=1},g=im();r>0&&(r+=g),n+=g;for(const g of e){const e=[],x=[];for(const h of g){const p=h.x+i.x,g=h.y+i.y,v=t.projection.projectTilePoint(p,g,c),b=t.projection.upVector(c,h.x,h.y);let w=r,_=n;if(a){const t=bm(p,g,r,n,a,o,l,u);w+=t.base,_+=t.top}0!==r?y(f,v.x+b[0]*d*w,v.y+b[1]*d*w,v.z+b[2]*d*w):y(f,v.x,v.y,v.z),y(m,v.x+b[0]*d*_,v.y+b[1]*d*_,v.z+b[2]*d*_),K(f,f,s),K(m,m,s),e.push(new um(f[0],f[1],f[2])),x.push(new um(m[0],m[1],m[2]))}h.push(e),p.push(x)}return[h,p]}(t,e,r,n,i,s,a,o,l,u,c):a?function(t,e,r,n,i,s,a,o,l){const u=[],c=[],h=[0,0,0,1];for(const p of t){const t=[],d=[];for(const u of p){const c=u.x+n.x,p=u.y+n.y,f=bm(c,p,e,r,s,a,o,l);h[0]=c,h[1]=p,h[2]=f.base,h[3]=1,dt(h,h,i),h[3]=Math.max(h[3],1e-5);const m=new um(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=c,h[1]=p,h[2]=f.top,h[3]=1,dt(h,h,i),h[3]=Math.max(h[3],1e-5);const y=new um(h[0]/h[3],h[1]/h[3],h[2]/h[3]);t.push(m),d.push(y)}u.push(t),c.push(d)}return[u,c]}(e,r,n,i,s,a,o,l,u):function(t,e,r,n,i){const s=[],a=[],o=i[8]*e,l=i[9]*e,u=i[10]*e,c=i[11]*e,h=i[8]*r,p=i[9]*r,d=i[10]*r,f=i[11]*r;for(const e of t){const t=[],r=[];for(const s of e){const e=s.x+n.x,a=s.y+n.y,m=i[0]*e+i[4]*a+i[12],y=i[1]*e+i[5]*a+i[13],g=i[2]*e+i[6]*a+i[14],x=i[3]*e+i[7]*a+i[15],v=m+o,b=y+l,w=g+u,_=Math.max(x+c,1e-5),A=m+h,I=y+p,M=g+d,S=Math.max(x+f,1e-5);t.push(new um(v/_,b/_,w/_)),r.push(new um(A/S,I/S,M/S))}s.push(t),a.push(r)}return[s,a]}(e,r,n,i,s)}function bm(t,e,r,n,i,s,a,o){const l=a*i.getElevationAt(t,e,!0,!0),u=0!==s[0],c=u?0===s[1]?a*(s[0]/Rf-Lf):a*function(t,e,r){const n=Math.floor(e[0]/8),i=Math.floor(e[1]/8),s=10*(e[0]-8*n),a=10*(e[1]-8*i),o=t.getElevationAt(n,i,!0,!0),l=t.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(a*l-1)),h=t.tileCoordToPixel(n,i),p=2*u+1,d=2*c+1,f=function(t,e,r,n,i){return[t.getElevationAtPixel(e,r,!0),t.getElevationAtPixel(e+i,r,!0),t.getElevationAtPixel(e,r+i,!0),t.getElevationAtPixel(e+n,r+i,!0)]}(t,h.x-u,h.y-c,p,d),m=Math.abs(f[0]-f[1]),y=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),x=Math.min(.25,.5*l*(m+y)/p),v=Math.min(.25,.5*l*g/d);return o+Math.max(x*s,v*a)}(i,s,o):l;return{base:l+(0===r?-1:r),top:u?Math.max(c+n,l+r+2):l+n}}class wm{constructor(t){this._callback=t,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 _m{constructor(){this.tasks={},this.taskQueue=[],ye(["process"],this),this.invoker=new wm(this.process),this.nextId=0}add(t,e){const r=this.nextId++,n=function({type:t,isSymbolTile:e,zoom:r}){return r=r||0,"message"===t?0:"maybePrepare"!==t||e?"parseTile"!==t||e?"parseTile"===t&&e?300-r:"maybePrepare"===t&&e?400-r:500:200-r:100-r}(e);if(0===n){try{t()}finally{}return null}return this.tasks[r]={fn:t,metadata:e,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}}}process(){try{if(this.taskQueue=this.taskQueue.filter((t=>!!this.tasks[t])),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn()}finally{}}pick(){let t=null,e=1/0;for(let r=0;r{r&&delete this.callbacks[a],this.target.postMessage({id:a,type:"",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data;if(!e)return;const r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t.cancel()}else if(e.mustQueue||ke(self)){const t=this.callbacks[r],n=this.scheduler.add((()=>this.processTask(r,e)),t&&t.metadata||{type:"message"});n&&(this.cancelCallbacks[r]=n)}else this.processTask(r,e)}processTask(t,e){if(delete this.cancelCallbacks[t],""===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(ro(e.error)):r(null,ro(e.data)))}else{const r=new Set,n=e.hasCallback?(e,n)=>{this.target.postMessage({id:t,type:"",sourceMapId:this.mapId,error:e?eo(e):null,data:eo(n,r)},r)}:()=>{},i=ro(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,i,n);else if(this.parent.getWorkerSource){const t=e.type.split("."),{source:r,scope:s}=i;this.parent.getWorkerSource(e.sourceMapId,t[0],r,s)[t[1]](i,n)}else n(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}const Im={workerUrl:"",workerClass:null,workerParams:void 0};function Mm(){const t=Im.workerUrl?Im.workerUrl:new URL("worker.js",import.meta.url).href,e=new Blob([`import '${t}';`],{type:"application/javascript"});return new Worker(URL.createObjectURL(e),{type:"module"})}const Sm="mapboxgl_preloaded_worker_pool";class Pm{constructor(t){this.active={},this.name=t}acquire(t,e=Pm.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Sm]}numActive(){return Object.keys(this.active).length}}Pm.workerCount=2;class km{constructor(t,e,r="Worker",n=Pm.workerCount){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=he();const i=this.workerPool.acquire(this.id,n);for(let t=0;t{this.ready=!0}))}broadcast(t,e,r){oe(this.actors,((r,n)=>{r.send(t,e,n)}),r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((t=>{t.remove()})),this.actors=[],this.workerPool.release(this.id)}}let Bm,zm;function Tm(){return Bm||(Bm=new Pm),Bm}function Em(){return zm||(zm=new Pm("ImageRasterizer")),zm}function Vm(){Tm().acquire(Sm)}function Fm(){const t=Bm;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Sm),Bm=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()"))}km.Actor=Am;const Cm=4096;class Dm{constructor(t){this.module=t,this.memoryStack=this.module.malloc(Cm),this.memoryStackNextFree=this.memoryStack}createIntArray(t){const e=this.memoryStackNextFree;return this.memoryStackNextFree+=t.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Cm?-1:(new Int32Array(this.module.heap32.buffer,e,t.length).set(t),e)}createFloatArray(t){const e=this.memoryStackNextFree;return this.memoryStackNextFree+=t.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Cm?-1:(new Float32Array(this.module.heapF32.buffer,e,t.length).set(t),e)}readStringBuffer(t){let e="";for(;0!==this.module.heapU8[t];)e+=String.fromCharCode(this.module.heapU8[t]),++t;return e}setStyle(t){const e=t.normalScale;this.module.setStyle(e[0],e[1],e[2],t.tileToMeters)}setAOOptions(t,e){this.module.setAOOptions(t?1:0,e)}setMetricOptions(t,e){this.module.setMetricOptions(t?1:0,e)}setStructuralOptions(t){this.module.setStructuralOptions(t?1:0)}setFacadeOptions(t,e){this.module.setFacadeOptions(t,e?1:0)}setFauxFacadeOptions(t,e,r){this.module.setFauxFacadeOptions(t?1:0,e?1:0,r)}setFacadeClassifierOptions(t){this.module.setFacadeClassifierOptions(t)}generateMesh(t,e){this.memoryStackNextFree=this.memoryStack;for(const e of t){const t=this.createIntArray(e.ringIndices),r=this.createFloatArray(e.coordinates);if(-1===t||-1===r)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(e.id,e.sourceId,e.minHeight,e.height,e.roofType,r,t,e.ringIndices.length-1)}for(const t of e){let e;e=t.entrances?JSON.parse(t.entrances):[];const r=this.createFloatArray(e),n=this.createFloatArray(t.coordinates);if(-1===r||-1===n)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(t.sourceId,t.crossPerc,t.distanceToRoad,r,e.length,n,t.coordinates.length)}if(!this.module.generateMesh()){const t=this.module.getLastError();return this.readStringBuffer(t)}const r=this.module.getMeshCount(),n=new Array(r);for(let t=0;tt.arrayBuffer())).then((t=>{e.buffers[r]=t}))}function uy(t,e){const r=t.json.bufferViews[e];return new Uint8Array(t.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function cy(t,e,r,n){if(t.uri){const i=oy(t.uri,n);return fetch(i).then((t=>t.blob())).then((t=>createImageBitmap(t))).then((t=>{e.images[r]=t}))}if(void 0!==t.bufferView){const n=uy(e,t.bufferView),i=new Blob([n],{type:t.mimeType});return createImageBitmap(i).then((t=>{e.images[r]=t}))}}function hy(t,e=0,r){const n={json:null,images:[],buffers:[]};if(new Uint32Array(t,e,1)[0]===sy){const r=new Uint32Array(t,e);let i=2;const s=(r[i++]>>2)-3,a=r[i++]>>2;if(i++,n.json=JSON.parse(ay.decode(r.subarray(i,i+a))),i+=a,i{const t=[],e=o&&o.includes(ey),i=o&&o.includes(ny);if(e&&t.push(function(){if(!Om)return null!=Rm?Rm:(Rm=function(t){let e,r=null;function n(){e=new Uint8Array(r.buffer)}function i(){throw new Error("Unexpected Draco error.")}const s={a:{a:i,d:function(t,r,n){return e.copyWithin(t,r,r+n)},c:function(t){const i=e.length,s=Math.max(t>>>0,Math.ceil(1.2*i)),a=Math.ceil((s-i)/65536);try{return r.grow(a),n(),!0}catch(t){return!1}},b:i}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,s):t.then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,s)))).then((t=>{const{Rb:i,Qb:s,P:a,T:o,X:l,Ja:u,La:c,Qa:h,Va:p,Wa:d,eb:f,jb:m,f:y,e:g,yb:x,zb:v,Ab:b,Bb:w,Db:_,Gb:A}=t.instance.exports;r=g;const I=(()=>{let t=0,r=0,n=0,a=0;return o=>{n&&(i(a),i(t),r+=n,n=t=0),t||(r+=128,t=s(r));const l=o.length+7&-8;let u=t;l>=r&&(n=l,u=a=s(l));for(let t=0;t{Om=t,Rm=void 0})))}()),i&&t.push(function(){if(Nm)return;const t=function(t){let e;const r=WebAssembly.instantiateStreaming(t,{}).then((t=>{e=t.instance,e.exports.__wasm_call_ctors()})),n={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},i={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:r,supported:!0,decodeGltfBuffer(t,r,s,a,o,l){!function(t,e,r,n,i,s,a){const o=t.exports.sbrk,l=n+3&-4,u=o(l*i),c=o(s.length),h=new Uint8Array(t.exports.memory.buffer);h.set(s,c);const p=e(u,n,i,c,s.length);if(0===p&&a&&a(u,l,i),r.set(h.subarray(u,u+n*i)),o(u-o(0)),0!==p)throw new Error(`Malformed buffer data: ${p}`)}(e,e.exports[i[o]],t,r,s,a,e.exports[n[l]])}}}(fetch(Zm()));return t.ready.then((()=>{Nm=t}))}()),s)for(let e=0;e{if(e&&a)for(const{primitives:t}of a)for(const e of t)ry(e,n);if(i&&a&&l)for(const t of l)iy(t,n);return n}))}))}function py(t){return fetch(t).then((t=>t.arrayBuffer())).then((e=>hy(e,0,t)))}function dy(t){let e=0;if(new Uint32Array(t,0,1)[0]!==sy){const r=new Uint32Array(t,0,7),[,,n,i,s,a]=r;e=r.byteLength+i+s+a+s,(n!==t.byteLength||e>=t.byteLength)&&Ae("Invalid b3dm header information.")}return hy(t,e)}function fy(t){switch(t){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 my(t){switch(t){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 yy{constructor(t,e,r,n){this.context=t,this.format=r,this.useMipmap=n&&n.useMipmap,this.texture=t.gl.createTexture(),this.update(e,{premultiply:n&&n.premultiply})}update(t,e){const r=t&&t instanceof HTMLVideoElement&&0===t.width?t.videoWidth:t.width,n=t&&t instanceof HTMLVideoElement&&0===t.height?t.videoHeight:t.height,{context:i}=this,{gl:s}=i,{x:a,y:o}=e&&e.position?e.position:{x:0,y:0},l=a+r,u=o+n;!this.size||this.size[0]===l&&this.size[1]===u||(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),i.pixelStoreUnpackFlipY.set(!1),i.pixelStoreUnpack.set(1),i.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!e||!1!==e.premultiply));const c=t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ImageBitmap&&t instanceof ImageBitmap;if(!this.size&&l>0&&u>0){const t=this.useMipmap?Math.floor(Math.log2(Math.max(l,u)))+1:1;s.texStorage2D(s.TEXTURE_2D,t,this.format,l,u),this.size=[l,u]}this.size&&(c?s.texSubImage2D(s.TEXTURE_2D,0,a,o,fy(this.format),my(this.format),t):"data"in t&&t.data&&s.texSubImage2D(s.TEXTURE_2D,0,a,o,r,n,fy(this.format),my(this.format),t.data)),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(t,e,r=!1){const{context:n}=this,{gl:i}=n;i.bindTexture(i.TEXTURE_2D,this.texture),t!==this.minFilter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.useMipmap&&!r?t===i.NEAREST?i.NEAREST_MIPMAP_NEAREST:i.LINEAR_MIPMAP_LINEAR:t),this.minFilter=t),e!==this.wrapS&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,e),this.wrapS=e)}bindExtraParam(t,e,r,n,i){const{context:s}=this,{gl:a}=s;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.magFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),this.magFilter=e),t!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,this.useMipmap?t===a.NEAREST?a.NEAREST_MIPMAP_NEAREST:a.LINEAR_MIPMAP_LINEAR:t),this.minFilter=t),r!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,r),this.wrapS=r),n!==this.wrapT&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,n),this.wrapT=n),i!==this.compareMode&&(i?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_MODE,a.COMPARE_REF_TO_TEXTURE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_FUNC,i)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_MODE,a.NONE),this.compareMode=i)}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class gy{constructor(t,e,r,n){this.context=t,this.format=n,this.size=r,this.texture=t.gl.createTexture();const[i,s,a]=this.size,{gl:o}=t;o.bindTexture(o.TEXTURE_3D,this.texture),t.pixelStoreUnpackFlipY.set(!1),t.pixelStoreUnpack.set(1),t.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&o.texImage3D(o.TEXTURE_3D,0,this.format,i,s,a,0,fy(this.format),my(this.format),e.data)}bind(t,e){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_3D,this.texture),t!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class xy{constructor(t,e){this.context=t,this.texture=e}bind(t,e){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),t!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}}const vy=bl([{name:"a_pos_3f",components:3,type:"Float32"}]),by=bl([{name:"a_color_3f",components:3,type:"Float32"}]),wy=bl([{name:"a_color_4f",components:4,type:"Float32"}]),_y=bl([{name:"a_uv_2f",components:2,type:"Float32"}]),Ay=bl([{name:"a_normal_3f",components:3,type:"Float32"}]),Iy=bl([{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"}]),My=bl([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Sy(t,e){const r=By(t.projection,t.zoom,t.width,t.height),n=function(t,e,r,n,i){const s=new yc(r.lng-180*zy,r.lat),a=new yc(r.lng+180*zy,r.lat),o=t.project(s.lng,s.lat),l=t.project(a.lng,a.lat),u=-Math.atan2(l.y-o.y,l.x-o.x),c=Ec.fromLngLat(r);c.y=ie(c.y,-1+zy,1-zy);const h=c.toLngLat(),p=t.project(h.lng,h.lat),d=Ec.fromLngLat(h);d.x+=zy;const m=d.toLngLat(),y=t.project(m.lng,m.lat),x=Ey(y.x-p.x,y.y-p.y,u),b=Ec.fromLngLat(h);b.y+=zy;const w=b.toLngLat(),A=t.project(w.lng,w.lat),I=Ey(A.x-p.x,A.y-p.y,u),M=Math.abs(x.x)/Math.abs(I.y),S=f([]);_(S,S,-u*(1-(i?0:n)));const P=f([]);return v(P,P,[1,1-(1-M)*n,1]),P[4]=-I.x/I.y*n,_(P,P,u),g(P,S,P),P}(t.projection,0,t.center,r,e),i=Py(t);return v(n,n,[i,i,1]),n}function Py(t){const e=t.projection,r=By(t.projection,t.zoom,t.width,t.height),n=Ty(e,t.center),i=Ty(e,yc.convert(e.center));return Math.pow(2,n*r+(1-r)*i)}function ky(t){const e=Sy(t,!0);return n([],[e[0],e[1],e[4],e[5]])}function By(t,e,r,n,i=1/0){const s=t.range;if(!s)return 0;const a=Math.min(i,Math.max(r,n)),o=Math.log2(a/1024);return se(s[0]+o,s[1]+o,e)}const zy=1/4e4;function Ty(t,e){const r=ie(e.lat,-Pc,Pc),n=new yc(e.lng-180*zy,r),i=new yc(e.lng+180*zy,r),s=t.project(n.lng,r),a=t.project(i.lng,r),o=Ec.fromLngLat(n),l=Ec.fromLngLat(i),u=a.x-s.x,c=a.y-s.y,h=l.x-o.x,p=l.y-o.y,d=Math.sqrt((h*h+p*p)/(u*u+c*c));return Math.log2(d)}function Ey(t,e,r){const n=Math.cos(r),i=Math.sin(r);return{x:t*n-e*i,y:t*i+e*n}}function Vy(t,e,r){f(t),_(t,t,Xt(e[2])),b(t,t,Xt(e[0])),w(t,t,Xt(e[1])),v(t,t,r),g(t,t,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Fy(t,e,r,n,i,s,a,o){const l=[r[0]-e[0],r[1]-e[1],0],u=[n[0]-e[0],n[1]-e[1],0];if(V(l)<1e-12||V(u)<1e-12)return mt(t);const c=W([],l,u);X(c,c),R(u,n,e),l[2]=(s-i)*o,u[2]=(a-i)*o;const h=l;return W(h,l,u),X(h,h),Pt(t,c,h)}function Cy(t,e,r=!1){const n=Ap(e.zoom),i=function(t,e,r){const n=e.worldSize,i=[t[12],t[13],t[14]],s=Mc(i[1]/n),a=Ic(i[0]/n),o=f([]),l=Ac(1,s)*n,u=Ac(1,0)*n*Bc(s,e.zoom),c=1/gp(n);let h=u*c;if(r){const t=By(e.projection,e.zoom,e.width,e.height,1024);h=c*e.projection.pixelSpaceConversion(e.center.lat,n,t)}const p=dc(s,a);D(p,p,N([],X([],p),l*h*i[2]));const d=function(t){const e=[t[0],t[1],t[2]];let r=[0,1,0];const n=W([],r,e);return W(r,e,n),0===q(r)&&(r=[0,1,0],W(n,e,r)),X(n,n),X(r,r),X(e,e),[n[0],n[1],n[2],0,r[0],r[1],r[2],0,e[0],e[1],e[2],0,t[0],t[1],t[2],1]}(p);v(o,o,[h,h,h*l]),x(o,o,[-i[0],-i[1],-i[2]]);const m=g([],e.globeMatrix,d);return g(m,m,o),g(m,m,t),m}(t,e,r);if(n>0){const r=function(t,e){const r=e.worldSize,n=Ac(1,0)*r*Bc(e.center.lat,e.zoom)/gp(r),i=Ac(1,e.center.lat)*r,s=f([]);w(s,s,Xt(e.center.lng)),b(s,s,Xt(e.center.lat)),x(s,s,[0,0,rc]),v(s,s,[n,n,n*i]);const a=e.point;return x(s,s,[-a.x,-a.y,0]),g(s,s,t),g(s,e.globeMatrix,s)}(t,e);return function(t,e,r){const n=(t,e,r)=>{const n=V(t),i=V(e),s=sp(t,e,r);return N(s,s,1/V(s)*dn(n,i,r))},i=n([t[0],t[1],t[2]],[e[0],e[1],e[2]],r),s=n([t[4],t[5],t[6]],[e[4],e[5],e[6]],r),a=n([t[8],t[9],t[10]],[e[8],e[9],e[10]],r),o=sp([t[12],t[13],t[14]],[e[12],e[13],e[14]],r);return[i[0],i[1],i[2],0,s[0],s[1],s[2],0,a[0],a[1],a[2],0,o[0],o[1],o[2],1]}(i,r,n)}return i}function Dy(t,e,r,n){const i=mh.projectAabbCorners(n,r);let s=Number.MAX_VALUE;for(let t=0;t0||0===a&&r[0]*s[0]+r[1]*s[1]>=0&&r[0]*r[0]+r[1]*r[1]>s[0]*s[0]+s[1]*s[1])&&(n=e)}i=n}while(i!==r);return e.length>0&&e.push(e[0]),e}(i);if(wh(t,a))return s}const Ry=64,Ly={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8},Oy=[1,1,1];function Uy(t,e,r,n,i,s,a,o,l,u=!1){const c=r.zoom,h=r.project(n),p=Bc(n.lat,c),d=1/p;f(t),x(t,t,[h.x+a[0]*d,h.y+a[1]*d,a[2]]);let m=1,y=1;const b=r.worldSize;if(u){if("mercator"===r.projection.name){let t=0;r.elevation&&(t=r.elevation.getAtPointOrZero(new Ec(h.x/b,h.y/b),0));const e=dt([],[h.x,h.y,t,1],r.projMatrix)[3]/r.cameraToCenterDistance;m=e,y=e*Bc(r.center.lat,c)}else if("globe"===r.projection.name){const e=Cy(t,r),i=[0,0,0,1];dt(i,i,g([],r.projMatrix,e));const s=i[3]/r.cameraToCenterDistance,a=Ap(c),o=r.projection.pixelsPerMeter(n.lat,b)*Bc(n.lat,c),l=r.projection.pixelsPerMeter(r.center.lat,b)*Bc(r.center.lat,c);m=s/dn(o,kc(r.center.lat),a),y=s*p/o,m*=l,y*=l}}else m=d;v(t,t,[m,m,y]);const w=[...t],_=e.orientation,A=[];if(Vy(A,[_[0]+(i?i[0]:0),_[1]+(i?i[1]:0),_[2]+(i?i[2]:0)],s),g(t,w,A),o&&r.elevation){let i=0;const s=[];if(l&&r.elevation){i=function(t,e,r,n,i){const s=e.elevation;if(!s)return 0;const a=mh.projectAabbCorners(r,n),o=Ac(1,i.lat)*e.worldSize,l=function(t,e){const r=[0,0,1],n=[{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(const i of n){const n=t[i.corners[0]],s=t[i.corners[1]],a=t[i.corners[2]],o=[s[0]-n[0],s[1]-n[1],e*(s[2]-n[2])],l=W(o,o,[a[0]-n[0],a[1]-n[1],e*(a[2]-n[2])]);X(l,l),i.dotProductWithUp=Z(l,r)}return n.sort(((t,e)=>t.dotProductWithUp-e.dotProductWithUp)),n[0].corners}(a,o),u=a[l[0]],c=a[l[1]],h=a[l[2]],p=a[l[3]],d=s.getAtPointOrZero(new Ec(u[0]/e.worldSize,u[1]/e.worldSize),0),f=s.getAtPointOrZero(new Ec(c[0]/e.worldSize,c[1]/e.worldSize),0),m=s.getAtPointOrZero(new Ec(h[0]/e.worldSize,h[1]/e.worldSize),0),y=s.getAtPointOrZero(new Ec(p[0]/e.worldSize,p[1]/e.worldSize),0),g=(d+y)/2,x=(f+m)/2;return g>x?f=e.gl.NEAREST_MIPMAP_NEAREST}),t.uploaded=!0,t.image=null)}function $y(t,e,r){t.indexBuffer=e.createIndexBuffer(t.indexArray,!1,!0),t.vertexBuffer=e.createVertexBuffer(t.vertexArray,vy.members,!1,!0),t.normalArray&&(t.normalBuffer=e.createVertexBuffer(t.normalArray,Ay.members,!1,!0)),t.texcoordArray&&(t.texcoordBuffer=e.createVertexBuffer(t.texcoordArray,_y.members,!1,!0)),t.colorArray&&(t.colorBuffer=e.createVertexBuffer(t.colorArray,(12===t.colorArray.bytesPerElement?by:wy).members,!1,!0)),t.featureArray&&(t.pbrBuffer=e.createVertexBuffer(t.featureArray,My.members,!0)),t.segments=bu.simpleSegment(0,0,t.vertexArray.length,t.indexArray.length);const n=t.material;n.pbrMetallicRoughness.baseColorTexture&&jy(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&jy(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&jy(n.normalTexture,e),n.occlusionTexture&&jy(n.occlusionTexture,e,r),n.emissionTexture&&jy(n.emissionTexture,e)}function Gy(t,e,r){if(t.meshes)for(const n of t.meshes)$y(n,e,r);if(t.children)for(const n of t.children)Gy(n,e,r)}function qy(t){if(t.meshes)for(const e of t.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(t.children)for(const e of t.children)qy(e)}function Hy(t){if(t.meshes)for(const r of t.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.normalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((e=r.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(t.children)for(const e of t.children)Hy(e)}function Xy(t,e){const r=t.json.bufferViews[e.bufferView],n=Km[e.componentType];return new n(t.buffers[r.buffer],(e.byteOffset||0)+(r.byteOffset||0),e.count*(r.byteStride&&r.byteStride!==Qm[e.type]*n.BYTES_PER_ELEMENT?r.byteStride/n.BYTES_PER_ELEMENT:Qm[e.type]))}function Zy(t,e,r,n){const i=Km[e.componentType],s=function(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(i),a=t.json.bufferViews[e.bufferView],o=a.byteStride?a.byteStride/i.BYTES_PER_ELEMENT:Qm[e.type],l=r.float32,u=l.length/r.capacity;for(let t=0,r=0;t0){for(let i=0;i0){s.texcoordArray=new Kl;const t=e.json.accessors[i.TEXCOORD_0];s.texcoordArray.resize(t.count);const r=Xy(e,t);Zy(e,t,s.texcoordArray,r)}if(void 0!==i._FEATURE_ID_RGBA4444){const t=e.json.accessors[i._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=Xy(e,t))}void 0!==i._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(Xy(e,e.json.accessors[i._FEATURE_RGBA4444]).buffer));const h=t.material;return s.material=function(t,e){const{emissiveFactor:r=[0,0,0],alphaMode:n="OPAQUE",alphaCutoff:i=.5,normalTexture:s,occlusionTexture:a,emissiveTexture:o,doubleSided:l,name:u}=t,{baseColorFactor:c=[1,1,1,1],metallicFactor:h=1,roughnessFactor:p=1,baseColorTexture:d,metallicRoughnessTexture:f}=t.pbrMetallicRoughness||{},m=a?e[a.index]:void 0;if(a&&a.extensions&&a.extensions.KHR_texture_transform&&m){const t=a.extensions.KHR_texture_transform;m.offsetScale=[t.offset[0],t.offset[1],t.scale[0],t.scale[1]]}return{name:u,pbrMetallicRoughness:{baseColorFactor:new un(...c),metallicFactor:h,roughnessFactor:p,baseColorTexture:d?e[d.index]:void 0,metallicRoughnessTexture:f?e[f.index]:void 0},doubleSided:l,emissiveFactor:new un(...r),alphaMode:n,alphaCutoff:i,normalTexture:s?e[s.index]:void 0,occlusionTexture:m,emissionTexture:o?e[o.index]:void 0,defined:void 0===t.defined}}(void 0!==h?e.json.materials[h]:{defined:!1},r),s}function Yy(t,e,r){const{matrix:n,rotation:i,translation:s,scale:a,mesh:o,extras:l,children:u,name:c}=t,h={};if(h.name=c,h.localMatrix=n||function(t,e,r,n){var i=e[0],s=e[1],a=e[2],o=e[3],l=i+i,u=s+s,c=a+a,h=i*l,p=i*u,d=i*c,f=s*u,m=s*c,y=a*c,g=o*l,x=o*u,v=o*c,b=n[0],w=n[1],_=n[2];return t[0]=(1-(f+y))*b,t[1]=(p+v)*b,t[2]=(d-x)*b,t[3]=0,t[4]=(p-v)*w,t[5]=(1-(h+y))*w,t[6]=(m+g)*w,t[7]=0,t[8]=(d+x)*_,t[9]=(m-g)*_,t[10]=(1-(h+f))*_,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}([],i||[0,0,0,1],s||[0,0,0],a||[1,1,1]),h.globalMatrix=p(h.localMatrix),void 0!==o){h.meshes=r[o];const t=h.anchor=[0,0];for(const e of h.meshes){const{min:r,max:n}=e.aabb;t[0]+=r[0]+n[0],t[1]+=r[1]+n[1]}t[0]=Math.floor(t[0]/h.meshes.length/2),t[1]=Math.floor(t[1]/h.meshes.length/2)}if(l&&(l.id&&(h.id=l.id),l.lights&&(h.lights=function(t){if(!t.length)return[];const e=function(t){const e=atob(t),r=new Uint8Array(e.length);for(let t=0;t1&&n[n.length-1].equals(n[0])&&n.pop();let i=0;for(let t=0;t0&&n.reverse();const s=od(n.flatMap((t=>[t.x,t.y])),[]);return 0===s.length?null:{vertices:n,indices:s}}function Qy(t,e){const r=[],n=[];let i=0;const s=[];for(const a of t){i=r.length;const t=a.vertexArray.float32,o=a.indexArray.uint16;for(let n=0;n0&&([n[t+1],n[t+2]]=[n[t+2],n[t+1]])}return{vertices:r,indices:n}}function tg(t){const e=function(t,e){const r=[],n=WebGL2RenderingContext;if(t.json.textures)for(const i of t.json.textures){const s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==i.sampler&&Object.assign(s,t.json.samplers[i.sampler]),r.push({image:e[i.source],sampler:s,uploaded:!1})}return r}(t,t.images),r=function(t,e){const r=[];for(const n of t.json.meshes){const i=[];for(const r of n.primitives)i.push(Wy(r,t,e));r.push(i)}return r}(t,e),{scenes:n,scene:i,nodes:s}=t.json,a=n?n[i||0].nodes:[...s.keys()],o=[];for(const e of a)o.push(Yy(s[e],t,r));return function(t,e,r){const n={},i=new Set;for(let s=0;s0){const e=Array.from(i.values()).sort(((t,e)=>t-e));for(let r=e.length-1;r>=0;r--)t.splice(e[r],1)}}(o,a,t.json.nodes),o}function eg(t,e){const r=tg(t);for(const t of r){for(const e of t.meshes)rg(e);t.lights&&(t.lightMeshIndex=t.meshes.length,t.meshes.push(ig(t.lights,e)))}return r}function rg(t){t.heightmap=new Float32Array(Ry*Ry),t.heightmap.fill(-1);const e=t.vertexArray.float32,r=t.aabb.min[0]-1,n=t.aabb.min[1]-1,i=Ry/(t.aabb.max[0]-r+2),s=Ry/(t.aabb.max[1]-n+2);for(let a=0;at.heightmap[u*Ry+l]&&(t.heightmap[u*Ry+l]=o)}}function ng(t,e,r,n,i){r.reserve(r.length+4*t.length),n.reserve(n.length+10*t.length),i.reserve(i.length+10*t.length);let s=n.length;for(const a of t){const t=Math.min(10,Math.max(4,1.3*a.height))*e,o=[-a.normal[1],a.normal[0],0],l=Math.min(.29,.1*a.width/a.depth),u=a.width-2*a.depth*e*(l+.01),c=j([],a.pos,o,u/2),h=j([],a.pos,o,-u/2),p=[c[0],c[1],c[2]+a.height],d=[h[0],h[1],h[2]+a.height],f=j([],a.normal,o,l);N(f,f,t);const m=j([],a.normal,o,-l);N(m,m,t),D(f,c,f),D(m,h,m),c[2]+=.1,h[2]+=.1,n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]),n.emplaceBack(c[0],c[1],c[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(c[0],c[1],c[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]);const y=u/t/2;i.emplaceBack(-y-l,-1,y,.8),i.emplaceBack(y+l,-1,y,.8),i.emplaceBack(-y,0,y,1.3),i.emplaceBack(y,0,y,1.3),i.emplaceBack(y+l,-.8,y,.7),i.emplaceBack(y+l,-.8,y,.7),i.emplaceBack(0,0,y,1.3),i.emplaceBack(0,0,y,1.3),i.emplaceBack(y+l,-1.2,y,.8),i.emplaceBack(y+l,-1.2,y,.8),r.emplaceBack(6+s,4+s,8+s),r.emplaceBack(7+s,9+s,5+s),r.emplaceBack(0+s,1+s,2+s),r.emplaceBack(1+s,3+s,2+s),s+=10}}function ig(t,e){const r={};r.indexArray=new $l,r.vertexArray=new zl,r.colorArray=new Dl,ng(t,e,r.indexArray,r.vertexArray,r.colorArray);const n={defined:!0};n.emissiveFactor=un.black;const i={};return i.baseColorFactor=un.white,n.pbrMetallicRoughness=i,r.material=n,r.aabb=new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}const sg=bl([{name:"a_pos_3f",components:3,type:"Float32"}]),ag=bl([{name:"a_normal_3",components:3,type:"Int16"}]),og=bl([{name:"a_centroid_3",components:3,type:"Int16"}]),lg=bl([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),ug=bl([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),cg=bl([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),hg=bl([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),pg=bl([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),dg=bl([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),fg=jc.types,mg=2,yg=32767;function gg(t,e){const r=Ui+e;for(const n of t)for(const t of n)if(t.x<-e||t.x>r||t.y<-e||t.y>r)return!1;return!0}function xg(t){switch(t){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${t}`)}}class vg{constructor(){this.layoutVertexArray=new zl,this.layoutAttenuationArray=new Dl,this.layoutColorArray=new Ll,this.indexArray=new $l,this.indexArrayForConflation=new $l,this.segmentsBucket=new bu}}class bg{constructor(t){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new bu,this.entranceBloom=new vg;const e=66560;this.layoutVertexArray=new zl,this.layoutVertexArray.reserve(e),this.layoutNormalArray=new Al,this.layoutNormalArray.reserve(e),this.layoutCentroidArray=new Al,this.layoutCentroidArray.reserve(e),this.layoutColorArray=new Ll,this.layoutColorArray.reserve(e),this.layoutFloodLightDataArray=new Ql,this.layoutFloodLightDataArray.reserve(e),this.layoutAOArray=new nu,this.layoutAOArray.reserve(e),this.indexArray=new $l,this.indexArray.reserve(66560),this.indexArrayForConflation=new $l,this.segmentsBucket=new bu,this.entranceBloom=new vg,t&&(this.layoutFacadePaintArray=new Ll,this.layoutFacadeDataArray=new El,this.layoutFacadeVerticalRangeArray=new Ll)}reserve(t,e,r){this.layoutVertexArray.reserveForAdditional(t),this.layoutCentroidArray.reserveForAdditional(t),this.layoutFloodLightDataArray.reserveForAdditional(t),this.layoutNormalArray.reserveForAdditional(t),this.layoutAOArray.reserveForAdditional(t),this.layoutColorArray.reserveForAdditional(t),this.indexArray.reserveForAdditional(e),r&&(this.layoutFacadePaintArray.reserveForAdditional(t),this.layoutFacadeDataArray.reserveForAdditional(t),this.layoutFacadeVerticalRangeArray.reserveForAdditional(t))}}class wg{constructor(t){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Kl,this.footprintsIndices=new Ql,this.footprintsMin=new $t(1/0,1/0),this.footprintsMax=new $t(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new bg(!1),this.buildingWithFacade=new bg(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=t.zoom,this.canonical=t.canonical,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.worldview=t.worldview,this.lut=t.lut,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut}),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.projection=t.projection,this.groundEffect=new Wf(t),this.groundEffect.groundRadiusArray=new Ml,this.hasAppearances=null}updateFootprints(t,e){const r=new rf([],[],1),n={vertices:[],indices:new Uint32Array(0),grid:r,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};e.push({footprint:n,id:t})}updateAppearances(t,e,r,n){}prepare(){return function(){if(null!=qm||null!=Gm)return null;if(null!=$m)return $m;const t=fetch(Xe.BUILDING_GEN_URL);return $m=function(t){let e,r,n,i,s;function a(){e=new Uint8Array(s.buffer),r=new Int16Array(s.buffer),n=new Int32Array(s.buffer),i=new Float32Array(s.buffer)}function o(){throw new Error("Unexpected BuildingGen error.")}const l=()=>{},u={a:{a:o,f:function(t){const r=e.length,n=Math.max(t>>>0,Math.ceil(1.2*r)),i=Math.ceil((n-r)/65536);try{return s.grow(i),a(),!0}catch(t){return!1}},g:o,b:l,c:l,d:l,e:l}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,u):t.then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,u)))).then((t=>{const o=t.instance.exports;return(0,o.g)(),s=o.f,a(),new Dm({setStyle:o.h,setAOOptions:o.i,setMetricOptions:o.j,setStructuralOptions:o.k,setFacadeOptions:o.l,setFauxFacadeOptions:o.m,setFacadeClassifierOptions:o.n,addFeature:o.o,addFacade:o.p,generateMesh:o.q,getLastError:o.r,getOuterRingLength:o.s,getMeshCount:o.t,getPositionsPtr:o.u,getPositionsLength:o.v,getNormalsPtr:o.w,getNormalsLength:o.x,getAOPtr:o.y,getAOLength:o.z,getUVPtr:o.A,getUVLength:o.B,getFauxFacadePtr:o.C,getFauxFacadeLength:o.D,getIndicesPtr:o.E,getIndicesLength:o.F,getBuildingPart:o.G,getRingCount:o.H,getRingPtr:o.I,getRingLength:o.J,malloc:o.K,free:o.L,heapU8:e,heap16:r,heap32:n,heapF32:i})}))}(t).then((t=>($m=null,qm=t,qm))).catch((t=>{Ae("Could not load building-gen"),$m=null,Gm=t})),$m}()}populate(t,e,r,n){const i=Ym();if(!i)return;const s=Tc(r);this.tileToMeter=s,this.brightness=e.brightness,i.setStyle({normalScale:[1,-1,s],tileToMeters:s}),i.setAOOptions(!1,.3),i.setMetricOptions(!1,16),i.setStructuralOptions(!0),i.setFacadeClassifierOptions(3);const a=new Map,o=new Map;let l=0;for(const{feature:e}of t){if("LineString"!==fg[e.type]){a.set(e.id,e.properties.source_id);continue}const t=this.layers[0]._featureFilter.needGeometry;if(t&&!this.layers[0]._featureFilter.filter(new Po(this.zoom),e,r))continue;const i=Nc(e,t);if(!t&&!this.layers[0]._featureFilter.filter(new Po(this.zoom),i,r))continue;const s=t?i.geometry:Uc(e,r,n),u=[];for(const t of s)for(const e of t)u.push(e.x),u.push(e.y);const c={coordinates:u,crossPerc:e.properties.cross_perc,distanceToRoad:e.properties.distance_to_road,entrances:e.properties.entrances,sourceId:0},h=e.properties.source_id;let p=o.get(h);p||(p=[],o.set(h,p)),p.push(c),++l}this.maxHeight=0;const u=new Array,c=new Set,h=t=>{null!=t&&c.add(t)},p=(t,e)=>{null!=t&&u.push({buildingId:t,footprintIndex:e})},d=64*(t.length-l),f=d/2;this.buildingWithFacade.reserve(d,f,!0),this.buildingWithoutFacade.reserve(2*d,2*f,!1),this.footprintsIndices.reserve(16*(t.length-l)),this.footprintsVertices.reserve(8*(t.length-l));for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of t){if("LineString"===fg[l.type])continue;const t=this.layers[0]._featureFilter.needGeometry;if(t&&!this.layers[0]._featureFilter.filter(new Po(this.zoom),l,r))continue;let m=null;if(l.properties&&l.properties.hasOwnProperty("building_id")&&(m=l.properties.building_id,c.has(m)))continue;const y=Nc(l,t);if(!t&&!this.layers[0]._featureFilter.filter(new Po(this.zoom),y,r))continue;const g=t?y.geometry:Uc(l,r,n),x=Vd(g,500);let v=!1;for(const t of x)if(1!==t.length){v=!0;break}if(v){h(m);continue}if(!gg(g,163)){h(m);continue}const b=this.layers[0],w=xg(b.layout.get("building-roof-shape").evaluate(l,{},r)),_=b.layout.get("building-base").evaluate(l,{},r),A=b.layout.get("building-height").evaluate(l,{},r),I=b.layout.get("building-flood-light-ground-radius").evaluate(l,{},r),M=b.paint.get("building-ambient-occlusion-intensity"),S=I/this.tileToMeter;l.properties["building-part"]="roof";const P=b.paint.get("building-color").evaluate(l,{},this.canonical).toPremultipliedRenderColor(this.lut),k=b.paint.get("building-emissive-strength").evaluate(l,{},this.canonical);l.properties["building-part"]="wall";const B=b.paint.get("building-color").evaluate(l,{},this.canonical).toPremultipliedRenderColor(this.lut),z=b.paint.get("building-emissive-strength").evaluate(l,{},this.canonical);l.properties["building-part"]="window";const T=b.paint.get("building-color").evaluate(l,{},this.canonical).toPremultipliedRenderColor(this.lut),E=b.paint.get("building-emissive-strength").evaluate(l,{},this.canonical);l.properties["building-part"]="door";const V=b.paint.get("building-color").evaluate(l,{},this.canonical).toPremultipliedRenderColor(this.lut),F=b.paint.get("building-emissive-strength").evaluate(l,{},this.canonical);let C=b.layout.get("building-flood-light-wall-radius").evaluate(l,{},r);C=ie(C,0,2048);const D=C/2048*yg,R=a.get(u),L=o.get(R)||[],O=0!==L.length&&b.layout.get("building-facade").evaluate(l,{},r);i.setFacadeOptions(4,!0),i.setFauxFacadeOptions(O,!1,1);let U=0,N=0,j=0,$=0,G=0,q=0,H=0,X=0,Z=0,W=0,Y=0;if(O){let t=Math.round(b.layout.get("building-facade-floors").evaluate(l,{},r));if(0===_){t=Math.max(1,t-(L.length>0?1:0));let e=4;if(A>100){const t=[10,13,15];e=t[l.id?l.id%t.length:0]}else A<=10&&(e=3);i.setFacadeOptions(e,!0),G=(A<15?1.3:1.61803)*e/s}else G=_/s;q=A/s,G=Math.min(G,q),j=b.layout.get("building-facade-unit-width").evaluate(l,{},r)/s,$=(q-G)/t,i.setFauxFacadeOptions(!0,!0,j);const e=b.layout.get("building-facade-window").evaluate(l,{},r);U=e[0],N=e[1],H=Math.floor(65535*Math.min(1,G/Ui)),X=Math.floor(65535*Math.min(1,q/Ui)),Z=Math.floor(255*U)<<8|Math.floor(255*N),W=Math.floor(65535*Math.min(1,j/Ui)),Y=Math.floor(65535*Math.min(1,$/Ui))}const K=Array(x.length),J={x:1/0,y:1/0},Q={x:-1/0,y:-1/0},tt={x:0,y:0};let et=0;for(let t=0;t0){const r=[],n=Array(e.length+1);n[0]=0;for(let t=0;tUi||J.y<0||Q.y>Ui)&&this.featuresOnBorder.push({featureId:l.id,footprintIndex:this.footprints.length});{const t=od(xt,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+t.length),this.footprintsIndices.uint16.set(t,yt),this.buildingIds.add(null!=m?m:l.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,vt.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,vt.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,bt.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,bt.y);const e={footprintVertexOffset:gt,footprintVertexLength:this.footprintsVertices.length-gt,footprintIndexOffset:yt,footprintIndexLength:this.footprintsIndices.length-yt,min:vt,max:bt,hiddenFlags:0,indicesOffset:pt,indicesLength:mt,bloomIndicesOffset:lt,bloomIndicesLength:ut,groundEffectVertexOffset:wt,groundEffectVertexLength:_t,hasFauxFacade:O,height:dt,promoteId:u,feature:y,parts:at,buildingBloom:ot},r=this.footprints.length;void 0!==l.id&&this.featureFootprintLookup.set(l.id,r),p(m,r),this.footprints.push(e)}this.programConfigurations.populatePaintArrays(nt.layoutVertexArray.length,l,d,{},e.availableImages,r,e.brightness),this.groundEffect.addPaintPropertiesData(l,d,{},e.availableImages,r,e.brightness),e.featureIndex.insert(l,g,d,f,this.index,ct)}u.forEach((({buildingId:t,footprintIndex:e})=>{c.has(t)&&(this.footprints[e].hiddenFlags|=4)}));const m=new Set;this.buildingIds.forEach(((t,e,r)=>{c.has(t)||m.add(t)})),this.buildingIds=m,this.groundEffect.prepareBorderSegments()}update(t,e,r,n,i,s,a){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a),this.groundEffect.update(t,e,i,r,n,s,a),this.evaluate(this.layers[0],t),this.colorBufferUploaded=!1}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(t){const e=e=>{e.layoutVertexBuffer=t.createVertexBuffer(e.layoutVertexArray,sg.members),e.layoutNormalBuffer=t.createVertexBuffer(e.layoutNormalArray,ag.members),e.layoutCentroidBuffer=t.createVertexBuffer(e.layoutCentroidArray,og.members),e.layoutFloodLightDataBuffer=t.createVertexBuffer(e.layoutFloodLightDataArray,dg.members),e.layoutFacadeDataArray&&e.layoutFacadeDataArray.length&&(e.layoutFacadeDataBuffer=t.createVertexBuffer(e.layoutFacadeDataArray,cg.members)),e.layoutFacadeVerticalRangeArray&&e.layoutFacadeVerticalRangeArray.length&&(e.layoutFacadeVerticalRangeBuffer=t.createVertexBuffer(e.layoutFacadeVerticalRangeArray,hg.members)),e.entranceBloom.layoutVertexArray.length&&(e.entranceBloom.layoutVertexBuffer=t.createVertexBuffer(e.entranceBloom.layoutVertexArray,sg.members),e.entranceBloom.layoutAttenuationBuffer=t.createVertexBuffer(e.entranceBloom.layoutAttenuationArray,pg.members)),this.uploadUpdatedColorBuffer(t),this.uploadUpdatedIndexBuffer(t)};this.uploaded||(e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.upload(t)),this.groundEffect.uploadPaintProperties(t),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){const t=t=>{t.layoutVertexBuffer&&(t.layoutVertexBuffer.destroy(),t.layoutNormalBuffer.destroy(),t.layoutColorBuffer.destroy(),t.segmentsBucket.destroy(),t.indexBuffer&&t.indexBuffer.destroy(),t.entranceBloom.layoutVertexBuffer&&(t.entranceBloom.layoutVertexBuffer.destroy(),t.entranceBloom.layoutColorBuffer.destroy(),t.entranceBloom.layoutAttenuationBuffer.destroy(),t.entranceBloom.indexBuffer.destroy(),t.entranceBloom.segmentsBucket.destroy()))};t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(t,e,r=!0){let n=!1;const i=r?e:0,s=0|(r?-1:~e);0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of t){const t=this.footprints[e],r=t.hiddenFlags&s|i;t.hiddenFlags!==r&&(t.hiddenFlags=r,n=!0,this.groundEffect.updateHiddenByLandmarkRange(t.groundEffectVertexOffset,t.groundEffectVertexLength,0!==t.hiddenFlags))}return n&&(this.indexArrayForConflationUploaded=!1),n}uploadUpdatedIndexBuffer(t){if(this.groundEffect.uploadHiddenByLandmark(t),this.indexArrayForConflationUploaded)return;const e=t=>{0!==t.indexArray.length&&(t.indexArrayForConflation.resize(t.indexArray.length),t.indexArrayForConflation.uint16.set(t.indexArray.uint16),t.entranceBloom.indexArrayForConflation.resize(t.entranceBloom.indexArray.length),t.entranceBloom.indexArrayForConflation.uint16.set(t.entranceBloom.indexArray.uint16))};e(this.buildingWithoutFacade),e(this.buildingWithFacade);for(const t of this.footprints){const e=t.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,r=t.indicesOffset+t.indicesLength;if(0!==t.hiddenFlags){for(let n=t.indicesOffset;n{0!==e.indexArray.length&&(e.indexBuffer?e.indexBuffer.updateData(e.indexArrayForConflation):e.indexBuffer=t.createIndexBuffer(e.indexArrayForConflation,!0),e.entranceBloom.indexBuffer?e.entranceBloom.indexBuffer.updateData(e.entranceBloom.indexArrayForConflation):e.entranceBloom.indexBuffer=t.createIndexBuffer(e.entranceBloom.indexArrayForConflation,!0))};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(t){const e=e=>{e.layoutColorBuffer?e.layoutColorBuffer.updateData(e.layoutColorArray):e.layoutColorBuffer=t.createVertexBuffer(e.layoutColorArray,lg.members,!0),e.layoutFacadePaintArray&&(e.layoutFacadePaintBuffer?e.layoutFacadePaintBuffer.updateData(e.layoutFacadePaintArray):e.layoutFacadePaintBuffer=t.createVertexBuffer(e.layoutFacadePaintArray,ug.members,!0)),e.entranceBloom.layoutColorBuffer?e.entranceBloom.layoutColorBuffer.updateData(e.entranceBloom.layoutColorArray):e.entranceBloom.layoutColorBuffer=t.createVertexBuffer(e.entranceBloom.layoutColorArray,lg.members,!0)};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(t,e){const r=t.paint.get("building-ambient-occlusion-intensity");for(const n of this.footprints){if(4&n.hiddenFlags)continue;const i=e[n.promoteId],s=n.feature;s.properties["building-part"]="roof";const a=t.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),o=t.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="wall";const l=t.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),u=t.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="window";const c=t.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),h=t.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="door";const p=t.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),d=t.paint.get("building-emissive-strength").evaluate(s,i,this.canonical),f=n.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const t of n.parts){let e,i=a;1===t.part?(i=a,e=o):0===t.part?(i=l,e=u):2===t.part?(i=c,e=h):3===t.part&&(i=p,e=d),e=ie(e,0,1);for(let s=0;se.max.x||n.max.xe.max.y||n.max.ya.max.x||a.min.x>t||e>a.max.y||a.min.y>e||a.height<=r||_g(s,this.footprintsVertices.float32.subarray(2*a.footprintVertexOffset,2*(a.footprintVertexOffset+a.footprintVertexLength)),this.footprintsIndices.uint16.subarray(a.footprintIndexOffset,a.footprintIndexOffset+a.footprintIndexLength))&&(r=a.height,this.footprintLookup[i]=a,n=0!==a.hiddenFlags);if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:n};this.footprintLookup[i]=void 0}}function _g(t,e,r){for(let n=0;n1&&(a=t[++s]);const l=Math.abs(o-a.left),u=Math.abs(o-a.right),c=Math.min(l,u);let h;const p=e/r*(n+1);if(a.isDash){const t=n-Math.abs(p);h=Math.sqrt(c*c+t*t)}else h=n-Math.sqrt(c*c+p*p);this.image.data[i+o]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t,e){for(let e=t.length-1;e>=0;--e){const r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}const r=t[0],n=t[t.length-1];r.isDash===n.isDash&&(r.left=n.left-this.width,n.right=r.right+this.width);const i=this.width*this.nextRow;let s=0,a=t[s];for(let r=0;r1&&(a=t[++s]);const n=Math.abs(r-a.left),o=Math.abs(r-a.right),l=Math.min(n,o);this.image.data[i+r]=Math.max(0,Math.min(255,(a.isDash?l:-l)+e+128))}}addDash(t,e){const r=this.getKey(t,e);if(this.positions[r])return this.positions[r];const n="round"===e,i=n?7:0,s=2*i+1;if(this.nextRow+s>this.height)return Ae("LineAtlas out of space"),null;0===t.length&&t.push(1);let a=0;for(let e=0;et.fqid)),this.index=t.index,this.projection=t.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Bl,this.layoutVertexArray2=new zl,this.patternVertexArray=new zl,this.indexArray=new $l,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut}),this.segments=new bu,this.maxLineLength=0,this.zOffsetVertexArray=new zl,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.tessellationStep=t.tessellationStep?t.tessellationStep:Ui/64,this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){this.hasPattern=Dd("line",this.layers,this.pixelRatio,e);const i=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Tc(r);const s=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===s)this.elevationType="road";else{const t=this.layers[0].layout.get("line-z-offset"),e=t.isConstant()&&!t.constantOr(0);this.elevationType="sea"!==s&&"ground"!==s&&e?"none":"offset","offset"===this.elevationType&&"none"===s&&Ae(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const a=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==a;const o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Nc(s,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),c,r))continue;const h=i?i.evaluate(c,{},r):void 0,p={id:a,properties:s.properties,type:s.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Uc(s,r,n),patterns:{},sortKey:h};o.push(p)}i&&o.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:l,featureIndex:u}=e,c=this.addConstantDashes(l);for(const n of o){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(c&&this.addFeatureDashes(n,l),this.hasPattern){const t=Rd("line",this.layers,n,this.zoom,this.pixelRatio,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,l.positions,e.availableImages,e.brightness,e.elevationFeatures);u.insert(t[s].feature,i,s,a,this.index)}}addConstantDashes(t){let e=!1;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,i=r.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==i.kind)e=!0;else{const e=i.value,r=n.value;if(!r)continue;t.addDash(r,e)}}return e}addFeatureDashes(t,e){const r=this.zoom;for(const n of this.layers){const i=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"===i.kind&&"constant"===s.kind)continue;let a,o;if("constant"===i.kind){if(a=i.value,!a)continue}else a=i.evaluate({zoom:r},t);o="constant"===s.kind?s.value:s.evaluate({zoom:r},t),e.addDash(a,o),t.patterns[n.id]=[e.getKey(a,o)]}}update(t,e,r,n,i,s,a,o){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,o)}addFeatures(t,e,r,n,i,s){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,n,s,t.elevationFeatures)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,zg)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=t.createVertexBuffer(this.patternVertexArray,Eg)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=t.createVertexBuffer(this.zOffsetVertexArray,Pg.members,!0)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,kg),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t,e){let r,n;if(e&&e>0?(r=`mapbox_clip_start_${e}`,n=`mapbox_clip_end_${e}`):(r="mapbox_clip_start",n="mapbox_clip_end"),t.properties&&t.properties.hasOwnProperty(r)&&t.properties.hasOwnProperty(n))return{start:+t.properties[r],end:+t.properties[n]}}addFeature(t,e,r,n,i,s,a,o){const l=this.layers[0].layout,u=l.get("line-join").evaluate(t,{}),c=l.get("line-cap").evaluate(t,{}),h=l.get("line-miter-limit"),p=l.get("line-round-limit");this.lineClips=this.lineFeatureClips(t),this.lineFeature=t;const d=!(!t.properties||!t.properties.hasOwnProperty("mapbox_line_metrics"))&&t.properties.mapbox_line_metrics;this.zOffsetValue=l.get("line-z-offset").value;const f=this.layers[0].paint.get("line-width").value;if("constant"!==f.kind&&!1===f.isLineProgressConstant&&(this.variableWidthValue=f),"road"===this.elevationType){const r=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(t,e,n,o,u,c,h,p)){const[i,s]=this.clipRuntimeLinesToTile(e,1);for(let e=0;e0?a.parentIndex:null)}this.fillNonElevatedRoadSegment(r)}}else for(let r=0;r0?r:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n,a,void 0,this.worldview)}computeSegNextDir(t,e){return t.nextPoint.sub(e.at(-2)).unit()}computeSegPrevDir(t,e){return e[1].sub(t.prevPoint).unit()}clipLinesToTile(t,e){return dm(t,-e,-e,Ui+e,Ui+e)}clipRuntimeLinesToTile(t,e){const r=[];return[dm(t,-e,-e,Ui+e,Ui+e,r),r]}addElevatedRoadFeature(t,e,r,n,i,s,a,o){const l=[],u=xh.getElevationFeature(t,n);if(u){const t=this.clipLinesToTile(e,1),n=this.prepareElevatedLines(t,u,r);for(const t of n)l.push({geometry:t,elevation:u,elevationTileID:r,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(0===l.length)return!1;for(const e of l){const n=this.layoutVertexArray.length;this.addLine(e.geometry,t,r,i,s,a,o);const l=new vh(r,e.elevationTileID);if(e.elevation)for(let t=n;t>1,this.layoutVertexArray.int16[6*t+1]>>1),n=l.pointElevation(r,e.elevation,.05);this.updateHeightRange(n),this.zOffsetVertexArray.emplaceBack(n,0,0)}else this.fillNonElevatedRoadSegment(n)}return!0}prepareElevatedLines(t,e,r){if(null!=e.constantHeight)return t;const n=[],i=1/Tc(r);for(const r of t)fm(r,new yh(e,i),0,n);return n}fillNonElevatedRoadSegment(t){for(let e=t;e0,h=o&&o.progress.max<1;if(this.lineClips){let r={min:this.lineClips.start,max:this.lineClips.end},n=1;if(o){const t=this.lineClips.end-this.lineClips.start;r=function(t,e,r){return{min:qe(t.min,e,r),max:qe(t.max,e,r)}}(o.progress,{min:0,max:1},r),t>0&&(n=(r.max-r.min)/t)}const i=+e.properties.mapbox_clip_feature_len,s=+e.properties.mapbox_clip_seg_len;if(Number.isNaN(i)||Number.isNaN(s)){for(let e=0;e=2&&t[d-1].equals(t[d-2]);)d--;let f=0;for(;f0,z=this.overscaling<=16?15*Ui/(512*this.overscaling):0;if(r&&"round"===o)if(Ss&&(o="bevel"),"bevel"===o&&(S>2&&(o="flipbevel"),S2*z){const e=y.sub(y.sub(g)._mult(z/t)._round());this.updateDistance(g,e),this.addCurrentVertex(e,v,0,0,m,A),g=e}this.updateDistance(g,y),I._mult(S),this.addCurrentVertex(y,I,0,0,m,A);const e=y.dist(x);if(e>2*z){const t=y.add(x.sub(y)._mult(z/e)._round());this.updateDistance(y,t),this.addCurrentVertex(t,b,0,0,m,A),y=t}}else I._mult(S),this.addCurrentVertex(y,I,0,0,m,A);else if("flipbevel"===o){if(S>100)I=b.mult(-1);else{const t=S*v.add(b).mag()/v.sub(b).mag();I._perp()._mult(t*(B?-1:1))}this.addCurrentVertex(y,I,0,0,m,A),this.addCurrentVertex(y,I.mult(-1),0,0,m,A)}else if("bevel"===o||"fakeround"===o){null!=A&&g&&this.addCurrentVertex(y,_||v,-1,-1,m,A);const t=y.dist(g)<=2*z&&"bevel"!==o,e=I.mult(B?1:-1);e._mult(S);const r=b.mult(B?-1:1),n=v.mult(B?-1:1),i=this.evaluateLineProgressFeatures(this.distance);if(null==A&&(this.addHalfVertex(y,e.x,e.y,!1,!B,0,m,i),t||this.addHalfVertex(y,e.x+2*n.x,e.y+2*n.y,!1,B,0,m,i)),"fakeround"===o){const t=Math.round(180*P/Math.PI/20);this.addHalfVertex(y,n.x,n.y,!1,B,0,m,i);for(let e=0;e1){this.lineSoFar=t.w;const p=(e.x-t.x)/c,d=(e.y-t.y)/c,f=(e.z-t.z)/c,m=(e.w-t.w)/c;for(let e=1;e=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),s?this.e2=u:this.e1=u,null!=l&&this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(t,e){this.prevDistance=this.distance,this.distance+=t.dist(e),this.updateScaledDistance()}}function Lg(t,e,r){return t.xr||t.yr}let Og,Ug;function Ng(t,e,r){return e*(Ui/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function jg(t,e){const{scale:r}=t.tileTransform,n=r*Ui/(t.tileSize*Math.pow(2,e.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return function(t,e,r){var n=e[1],i=e[2],s=e[3],a=r[0],o=r[1];return t[0]=e[0]*a,t[1]=n*a,t[2]=i*o,t[3]=s*o,t}(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])}Qa(Rg,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const $g=t=>({u_matrix:new Ru(t),u_pixels_to_tile_units:new Nu(t),u_device_pixel_ratio:new Tu(t),u_width_scale:new Tu(t),u_floor_width_scale:new Tu(t),u_units_to_pixels:new Eu(t),u_dash_image:new zu(t),u_gradient_image:new zu(t),u_image_height:new Tu(t),u_texsize:new Eu(t),u_tile_units_to_pixels:new Tu(t),u_alpha_discard_threshold:new Tu(t),u_trim_offset:new Eu(t),u_trim_fade_range:new Eu(t),u_trim_color:new Fu(t),u_zbias_factor:new Tu(t),u_tile_to_meter:new Tu(t),u_ground_shadow_factor:new Vu(t)}),Gg=t=>({u_matrix:new Ru(t),u_texsize:new Eu(t),u_pixels_to_tile_units:new Nu(t),u_device_pixel_ratio:new Tu(t),u_width_scale:new Tu(t),u_floor_width_scale:new Tu(t),u_image:new zu(t),u_units_to_pixels:new Eu(t),u_tile_units_to_pixels:new Tu(t),u_alpha_discard_threshold:new Tu(t),u_trim_offset:new Eu(t),u_trim_fade_range:new Eu(t),u_trim_color:new Fu(t),u_zbias_factor:new Tu(t),u_tile_to_meter:new Tu(t),u_ground_shadow_factor:new Vu(t),u_pattern_transition:new Tu(t)}),qg=(t,e,r)=>(1-r)*t+r*e,Hg=(t,e,r,n,i,s,a,o,l,u)=>{const c=t.transform,h=c.calculatePixelsToTileUnitsMatrix(e),p="none"===r.paint.get("line-trim-color-use-theme").constantOr("default"),d=c.pitch<15?qg(.07,.7,ie((14-c.zoom)/5,0,1)):.07;return{u_matrix:Wg(t,e,r,n),u_pixels_to_tile_units:h,u_device_pixel_ratio:s,u_width_scale:a,u_floor_width_scale:o,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:i,u_texsize:Kg(r)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Zg(e,t.transform),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").toPremultipliedRenderColor(p?null:r.lut).toArray01(),u_zbias_factor:d,u_tile_to_meter:Tc(e.tileID.canonical,0),u_ground_shadow_factor:u}},Xg=(t,e,r,n,i,s,a,o,l,u)=>{const c=t.transform,h=c.pitch<15?qg(.07,.7,ie((14-c.zoom)/5,0,1)):.07,p="none"===r.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:Wg(t,e,r,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:c.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:i,u_width_scale:s,u_floor_width_scale:a,u_image:0,u_tile_units_to_pixels:Zg(e,c),u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:o,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toPremultipliedRenderColor(p?null:r.lut).toArray01(),u_zbias_factor:h,u_tile_to_meter:Tc(e.tileID.canonical,0),u_ground_shadow_factor:l,u_pattern_transition:u}};function Zg(t,e){return 1/Ng(t,1,e.tileZoom)}function Wg(t,e,r,n){return t.translatePosMatrix(n||e.tileID.projMatrix,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const Yg=t=>{const e=[];Kg(t)&&e.push("RENDER_LINE_DASH"),t.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const r=t.paint.get("line-trim-offset");0===r[0]&&0===r[1]||e.push("RENDER_LINE_TRIM_OFFSET"),0!==t.paint.get("line-border-width").constantOr(1)&&e.push("RENDER_LINE_BORDER");const n="none"===t.layout.get("line-join").constantOr("miter"),i=!!t.paint.get("line-pattern").constantOr(1);return n&&i&&e.push("LINE_JOIN_NONE"),e};function Kg(t){const e=t.paint.get("line-dasharray").value;return"constant"!==e.kind||e.value}let Jg;const Qg=()=>Jg||(Jg={layout:Og||(Og=new No({"line-cap":new Ro(jo.layout_line["line-cap"]),"line-join":new Ro(jo.layout_line["line-join"]),"line-miter-limit":new Do(jo.layout_line["line-miter-limit"]),"line-round-limit":new Do(jo.layout_line["line-round-limit"]),"line-sort-key":new Ro(jo.layout_line["line-sort-key"]),"line-z-offset":new Ro(jo.layout_line["line-z-offset"]),"line-elevation-reference":new Do(jo.layout_line["line-elevation-reference"]),"line-cross-slope":new Do(jo.layout_line["line-cross-slope"]),visibility:new Do(jo.layout_line.visibility),"line-width-unit":new Do(jo.layout_line["line-width-unit"])})),paint:Ug||(Ug=new No({"line-opacity":new Ro(jo.paint_line["line-opacity"]),"line-color":new Ro(jo.paint_line["line-color"]),"line-translate":new Do(jo.paint_line["line-translate"]),"line-translate-anchor":new Do(jo.paint_line["line-translate-anchor"]),"line-width":new Ro(jo.paint_line["line-width"]),"line-gap-width":new Ro(jo.paint_line["line-gap-width"]),"line-offset":new Ro(jo.paint_line["line-offset"]),"line-blur":new Ro(jo.paint_line["line-blur"]),"line-dasharray":new Ro(jo.paint_line["line-dasharray"]),"line-pattern":new Ro(jo.paint_line["line-pattern"]),"line-pattern-cross-fade":new Do(jo.paint_line["line-pattern-cross-fade"]),"line-gradient":new Lo(jo.paint_line["line-gradient"]),"line-trim-offset":new Do(jo.paint_line["line-trim-offset"]),"line-trim-fade-range":new Do(jo.paint_line["line-trim-fade-range"]),"line-trim-color":new Do(jo.paint_line["line-trim-color"]),"line-emissive-strength":new Ro(jo.paint_line["line-emissive-strength"]),"line-border-width":new Ro(jo.paint_line["line-border-width"]),"line-border-color":new Ro(jo.paint_line["line-border-color"]),"line-occlusion-opacity":new Do(jo.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},Jg);class tx extends Ro{possiblyEvaluate(t,e){return e=new Po(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,transition:e.transition,worldview:e.worldview}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=Object.assign({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}let ex;function rx(t,e){return e>0?e+2*t:t}const nx=bl([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),ix=bl([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),sx=bl([{name:"a_projected_pos",components:4,type:"Float32"}],4);bl([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ax=bl([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),ox=bl([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),lx=bl([{name:"a_texb",components:2,type:"Uint16"}]),ux=bl([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),cx=bl([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);bl([{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"}]);const hx=bl([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),px=bl([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);bl([{name:"triangle",components:3,type:"Uint16"}]),bl([{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"}]),bl([{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"},{type:"Uint16",name:"elevationFeatureIndex"}]),bl([{type:"Float32",name:"offsetX"}]),bl([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const dx=24;function fx(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Mo.applyArabicShaping&&(t=Mo.applyArabicShaping(t)),t}(t.text,e,r)})),t}const mx={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function yx(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||"`"===t||" ̄"===t||"︑"===t||"︒"===t}function gx(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}const xx=4294967296,vx=1/xx,bx="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");let wx=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,r=this.length){for(;this.pos>3,i=this.pos;this.type=7&r,t(n,e,this),this.pos===i&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*xx;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*xx;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let r,n;return n=e[this.pos++],r=127&n,n<128?r:(n=e[this.pos++],r|=(127&n)<<7,n<128?r:(n=e[this.pos++],r|=(127&n)<<14,n<128?r:(n=e[this.pos++],r|=(127&n)<<21,n<128?r:(n=e[this.pos],r|=(15&n)<<28,function(t,e,r){const n=r.buf;let i,s;if(s=n[r.pos++],i=(112&s)>>4,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(127&s)<<3,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(127&s)<<10,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(127&s)<<17,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(127&s)<<24,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(1&s)<<31,s<128)return _x(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(r,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&bx?bx.decode(this.buf.subarray(e,t)):function(t,e,r){let n="",i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+u>r)break;1===u?e<128&&(l=e):2===u?(s=t[i+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===u?(s=t[i+1],a=t[i+2],128==(192&s)&&128==(192&a)&&(l=(15&e)<<12|(63&s)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(s=t[i+1],a=t[i+2],o=t[i+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(l=(15&e)<<18|(63&s)<<12|(63&a)<<6|63&o,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=u}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const r=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),4294967295^r?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){const r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,r){for(let n,i,s=0;s55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);const r=this.pos-e;r>=128&&Ax(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let r=0;r=128&&Ax(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Ix,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Mx,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,kx,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Sx,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Px,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Bx,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,zx,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Tx,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Ex,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function _x(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ax(t,e,r){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(let e=r.pos-1;e>=t;e--)r.buf[e+n]=r.buf[e]}function Ix(t,e){for(let r=0;r=0&&r>=t&&$x[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new Nx;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Ux.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function jx(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m=1){const y=Nx.fromFeature(t,i,m);h===Lx.vertical&&y.verticalizePunctuation(p);let g=[];const x=function(t,e,r,n,i,s){if(!t)return[];const a=[],o=function(t,e,r,n,i,s){let a=0;for(let r=0;r=0;let u=0;for(let r=0;r0&&s>w&&(w=s)}else{const t=r[o.fontStack];if(!t)continue;t[m]&&(I=t[m]);const n=e[o.fontStack];if(!n)continue;const s=n.glyphs[m];if(!s)continue;if(v=s.metrics,S=8203!==m?dx:0,y){const t=void 0!==n.ascender?Math.abs(n.ascender):0,e=void 0!==n.descender?Math.abs(n.descender):0,r=(t+e)*g;_-r/2;){if(a--,a<0)return!1;o-=t[a].dist(s),s=t[a]}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;on;)u-=l.shift().angleDelta;if(u>i)return!1;a++,o+=e.dist(r)}return!0}function cv(t){let e=0;for(let r=0;ru){const c=(u-l)/s,h=dn(n.x,i.x,c),p=dn(n.y,i.y,c),d=new lv(h,p,0,i.angleTo(n),r);return!a||uv(t,d,o,a,e)?d:void 0}l+=s}}function fv(t,e,r,n,i,s,a,o,l){const u=hv(n,s,a),c=pv(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&g=0&&x=0&&p+u<=c){const r=new lv(g,x,0,m,e);n&&!uv(t,r,s,n,i)||d.push(r)}}h+=f}return o||d.length||a||(d=mv(t,h/2,r,n,i,s,a,!0,l)),d}function yv(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();e&&t1?a-1:a,td.copy(n.data,l,{x:0,y:0},{x:o,y:u},n.data,r),td.copy(n.data,l,{x:0,y:h-a},{x:o,y:u-a},{width:c,height:a},r),td.copy(n.data,l,{x:0,y:0},{x:o,y:u+h},{width:c,height:a},r),td.copy(n.data,l,{x:c-a,y:0},{x:o-a,y:u},{width:a,height:h},r),td.copy(n.data,l,{x:0,y:0},{x:o+c,y:u},{width:a,height:h},r),td.copy(n.data,l,{x:c-a,y:h-a},{x:o-a,y:u-a},{width:a,height:a},r),td.copy(n.data,l,{x:0,y:h-a},{x:o+c,y:u-a},{width:a,height:a},r),td.copy(n.data,l,{x:0,y:0},{x:o+c,y:u+h},{width:a,height:a},r),td.copy(n.data,l,{x:c-a,y:0},{x:o-a,y:u+h},{width:a,height:a},r)}this.lut=r,this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(t,e,r,n){for(const[i,s]of t.entries()){const{bin:t,imagePosition:a,imageVariant:o}=bv(i,s,r);e.set(i,a),n.push(t),s.hasRenderCallback&&this.haveRenderCallbacks.push(o.id)}}patchUpdatedImages(t,e,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((e=>t.hasImage(e,r))),t.dispatchRenderCallbacks(this.haveRenderCallbacks,r);for(const n of t.getUpdatedImages(r)){for(const i of this.iconPositions.keys()){const s=Ln.parse(i);if(sn.isEqual(s.id,n)){const s=t.getImage(n,r);this.patchUpdatedImage(this.iconPositions.get(i),s,e,null)}}for(const i of this.patternPositions.keys()){const s=Ln.parse(i);if(sn.isEqual(s.id,n)){const s=t.getImage(n,r);this.patchUpdatedImage(this.patternPositions.get(i),s,e,this.lut)}}}}patchUpdatedImage(t,e,r,n=null){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[i,s]=t.tl,a=t.sdf;if(this.lut||a){const t={width:e.data.width,height:e.data.height},o=new td(t);td.copy(e.data,o,{x:0,y:0},{x:0,y:0},t,n,a),r.update(o,{position:{x:i,y:s}})}else r.update(e.data,{position:{x:i,y:s}})}}Qa(vv,"ImagePosition"),Qa(wv,"ImageAtlas");const _v=1e20;function Av(t,e,r,n,i,s,a,o,l){for(let u=e;u-1);l++,s[l]=o,a[l]=u,a[l+1]=_v}for(let o=0,l=0;o{let i=this.entries[t];i||(i=this.entries[t]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=i.glyphs[e];if(void 0!==s)return void r(null,{stack:t,id:e,glyph:s});if(s=this._tinySDF(i,t,e),s)return i.glyphs[e]=s,void r(null,{stack:t,id:e,glyph:s});const a=Math.floor(e/256);if(256*a>65535)return Ae("glyphs > 65535 not supported"),void r(null,{stack:t,id:e,glyph:s});if(i.ranges[a])return void r(null,{stack:t,id:e,glyph:s});let o=i.requests[a];o||(o=i.requests[a]=[],Pv.loadGlyphRange(t,a,n,this.requestManager,((t,e)=>{if(e){i.ascender=e.ascender,i.descender=e.descender;for(const t in e.glyphs)this._doesCharSupportLocalGlyph(+t)||(i.glyphs[+t]=e.glyphs[+t]);i.ranges[a]=!0}for(const r of o)r(t,e);delete i.requests[a]}))),o.push(((n,i)=>{n?r(n):i&&r(null,{stack:t,id:e,glyph:i.glyphs[e]||null})}))}),((t,r)=>{if(t)e(t);else if(r){const t={};for(const{stack:e,id:n,glyph:i}of r)void 0===t[e]&&(t[e]={}),void 0===t[e].glyphs&&(t[e].glyphs={}),t[e].glyphs[n]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics},t[e].ascender=this.entries[e].ascender,t[e].descender=this.entries[e].descender;e(null,t)}}))}_doesCharSupportLocalGlyph(t){return this.localGlyphMode!==Sv.none&&(this.localGlyphMode===Sv.all?!!this.localFontFamily:!!this.localFontFamily&&(no["CJK Unified Ideographs"](t)||no["Hangul Syllables"](t)||no.Hiragana(t)||no.Katakana(t)||no["CJK Symbols and Punctuation"](t)||no["CJK Unified Ideographs Extension A"](t)||no["CJK Unified Ideographs Extension B"](t)||no.Osage(t)))}_tinySDF(t,e,r){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(r))return;let i=t.tinySDF;if(!i){let r="400";/bold/i.test(e)?r="900":/medium/i.test(e)?r="500":/light/i.test(e)&&(r="200"),i=t.tinySDF=new Pv.TinySDF({fontFamily:n,fontWeight:r,fontSize:24*Mv,buffer:3*Mv,radius:8*Mv}),i.fontWeight=r}if(this.localGlyphs[i.fontWeight][r])return this.localGlyphs[i.fontWeight][r];const s=String.fromCodePoint(r),{data:a,width:o,height:l,glyphWidth:u,glyphHeight:c,glyphLeft:h,glyphTop:p,glyphAdvance:d}=i.draw(s);return this.localGlyphs[i.fontWeight][r]={id:r,bitmap:new Qp({width:o,height:l},a),metrics:{width:u/Mv,height:c/Mv,left:h/Mv,top:p/Mv-27,advance:d/Mv,localGlyph:!0}}}}Pv.loadGlyphRange=function(t,e,r,n,i){const s=256*e,a=s+255,o=n.transformRequest(n.normalizeGlyphsURL(r).replace("{fontstack}",t).replace("{range}",`${s}-${a}`),Tr.Glyphs);Dr(o,((t,e)=>{if(t)i(t);else if(e){const t={},r=function(t){return new wx(t).readFields(Fx,{})}(e);for(const e of r.glyphs)t[e.id]=e;i(null,{glyphs:t,ascender:r.ascender,descender:r.descender})}}))},Pv.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:r=8,cutoff:n=.25,fontFamily:i="sans-serif",fontWeight:s="normal",fontStyle:a="normal",lang:o=null}={}){this.buffer=e,this.cutoff=n,this.radius=r,this.lang=o;const l=this.size=t+4*e,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${s} ${t}px ${i}`,c.textBaseline="alphabetic",c.textAlign="left",c.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(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:r,actualBoundingBoxDescent:n,actualBoundingBoxLeft:i,actualBoundingBoxRight:s}=this.ctx.measureText(t),a=Math.ceil(r),o=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-i))),l=Math.min(this.size-this.buffer,a+Math.ceil(n)),u=o+2*this.buffer,c=l+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),d={data:p,width:u,height:c,glyphWidth:o,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===o||0===l)return d;const{ctx:f,buffer:m,gridInner:y,gridOuter:g}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,o,l),f.fillText(t,m,m+a);const x=f.getImageData(m,m,o,l);g.fill(_v,0,h),y.fill(0,0,h);for(let t=0;t0?t*t:0,y[n]=t<0?t*t:0}}Av(g,0,0,u,c,u,this.f,this.v,this.z),Av(y,m,m,o,l,u,this.f,this.v,this.z);for(let t=0;t{const p=Cv(n.stretch-x,v,c,t.left*i),d=Dv(n.fixed-_,A,n.stretch,f),y=Cv(s.stretch-b,w,h,t.top*i),g=Dv(s.fixed-I,M,s.stretch,m),S=Cv(l.stretch-x,v,c,t.left*i),P=Dv(l.fixed-_,A,l.stretch,f),k=Cv(u.stretch-b,w,h,t.top*i),B=Dv(u.fixed-I,M,u.stretch,m),z=new $t(p,y),T=new $t(S,y),E=new $t(S,k),V=new $t(p,k),F=new $t(d/o,g/o),C=new $t(P/o,B/o),D=e*Math.PI/180;if(D){const t=Math.sin(D),e=Math.cos(D),r=[e,-t,t,e];z._matMult(r),T._matMult(r),V._matMult(r),E._matMult(r)}const R=n.stretch+n.fixed,L=l.stretch+l.fixed,O=s.stretch+s.fixed,U=u.stretch+u.fixed,N=t.imageSecondary;return{tl:z,tr:T,bl:V,br:E,texPrimary:{x:a.paddedRect.x+kv+R,y:a.paddedRect.y+kv+O,w:L-R,h:U-O},texSecondary:N?{x:N.paddedRect.x+kv+R,y:N.paddedRect.y+kv+O,w:L-R,h:U-O}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:C,minFontScaleX:A/o/c,minFontScaleY:M/o/h,isSDF:r}};if(n&&(a.stretchX||a.stretchY)){const t=Vv(p,y,f),e=Vv(d,g,m);for(let r=0;rs)&&(s=e.x),(!t||e.y>a)&&(a=e.y)}const l=Math.min(s-n,a-i);let u=l/2;const c=new Oi([],Ov);if(0===l)return new $t(n,i);for(let e=n;eh.d||!h.d)&&(h=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new Uv(n.p.x-u,n.p.y-u,u,t)),c.push(new Uv(n.p.x+u,n.p.y-u,u,t)),c.push(new Uv(n.p.x-u,n.p.y+u,u,t)),c.push(new Uv(n.p.x+u,n.p.y+u,u,t)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function Ov(t,e){return e.max-t.max}class Uv{constructor(t,e,r,n){this.p=new $t(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;it.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,zh(t,i,o))}}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}const Nv=Object.keys,jv=7,$v=Number.POSITIVE_INFINITY,Gv=Math.sqrt(2),qv={MAX_GLYPHS:65535};function Hv(t,e,r,n,i){const s=Jx(t)&&t.collisionPadding?t.collisionPadding:[0,0,0,0],a={top:t.top-s[1],bottom:t.bottom+s[3],left:t.left-s[0],right:t.right+s[2],scaled:!1};return void 0!==n&&function(t,e){t.top*=e,t.bottom*=e,t.left*=e,t.right*=e,t.scaled=!0}(a,n),r&&function(t,e){if(!e)return;const r=Xt(e),n=new $t(t.left,t.top),i=new $t(t.right,t.top),s=new $t(t.left,t.bottom),a=new $t(t.right,t.bottom),o=new $t(0,0);n._rotateAround(r,o),i._rotateAround(r,o),s._rotateAround(r,o),a._rotateAround(r,o),t.left=Math.min(n.x,i.x,s.x,a.x),t.right=Math.max(n.x,i.x,s.x,a.x),t.top=Math.min(n.y,i.y,s.y,a.y),t.bottom=Math.max(n.y,i.y,s.y,a.y)}(a,r),i&&(a.left+=i[0],a.right+=i[0],a.top+=i[1],a.bottom+=i[1]),e?{top:Math.min(e.top,a.top),bottom:Math.max(e.bottom,a.bottom),left:Math.min(e.left,a.left),right:Math.max(e.right,a.right),scaled:e.scaled||a.scaled}:a}function Xv(t,[e,r]){let n=0,i=0;if(r===$v){e<0&&(e=0);const r=e/Gv;switch(t){case"top-right":case"top-left":i=r-jv;break;case"bottom-right":case"bottom-left":i=-r+jv;break;case"bottom":i=-e+jv;break;case"top":i=e-jv}switch(t){case"top-right":case"bottom-right":n=-r;break;case"top-left":case"bottom-left":n=r;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-jv;break;case"bottom-right":case"bottom-left":case"bottom":i=-r+jv}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,i]}function Zv(t,e,r,n,i,s,a,o=1,l,u,c){t.createArrays(),t.tilePixelRatio=Ui/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const h=t.layers[0].layout,p=t.layers[0]._unevaluatedLayout._values,d={};d.scaleFactor=o,d.textSizeScaleRange=h.get("text-size-scale-range"),d.iconSizeScaleRange=h.get("icon-size-scale-range");const[f,m]=d.textSizeScaleRange,[y,g]=d.iconSizeScaleRange;d.textScaleFactor=ie(d.scaleFactor,f,m),d.iconScaleFactor=ie(d.scaleFactor,y,g);const x=p["text-size"],v=p["icon-size"];if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.textSizeData;d.compositeTextSizes=[x.possiblyEvaluate(new Po(e,{worldview:c}),s),x.possiblyEvaluate(new Po(r,{worldview:c}),s)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;d.compositeIconSizes=[v.possiblyEvaluate(new Po(e,{worldview:c}),s),v.possiblyEvaluate(new Po(r,{worldview:c}),s)]}d.layoutTextSize=x.possiblyEvaluate(new Po(a+1,{worldview:c}),s),d.layoutIconSize=v.possiblyEvaluate(new Po(a+1,{worldview:c}),s),d.textMaxSize=x.possiblyEvaluate(new Po(18,{worldview:c}),s);const b=h.get("symbol-placement"),w="map"===h.get("text-rotation-alignment")&&"point"!==b,_=h.get("text-size");let A=!1;const I=[];for(const a of t.features){const o=h.get("text-font").evaluate(a,{},s).join(","),f=_.evaluate(a,{},s)*d.textScaleFactor,m=d.layoutTextSize.evaluate(a,{},s)*d.textScaleFactor,y=d.layoutIconSize.evaluate(a,{},s)*d.iconScaleFactor,g={horizontal:{},vertical:void 0},x=a.text;let v,M=[0,0];if(x){const n=x.toString(),u=h.get("text-letter-spacing").evaluate(a,{},s)*dx,c=h.get("text-line-height").evaluate(a,{},s)*dx,p=so(n)?u:0,d=h.get("text-anchor").evaluate(a,{},s),y=h.get("text-variable-anchor");if(!y){const t=h.get("text-radial-offset").evaluate(a,{},s);if(t)M=Xv(d,[t*dx,$v]);else{const t=h.get("text-offset").evaluate(a,{},s);M=[t[0]*dx,t[1]*dx]}}let v=w?"center":h.get("text-justify").evaluate(a,{},s);const _="point"===b,A=_?h.get("text-max-width").evaluate(a,{},s)*dx:1/0,I=s=>{t.allowVerticalPlacement&&io(n)&&(g.vertical=jx(x,e,r,i,o,A,c,d,s,p,M,Lx.vertical,!0,m,f,l))};if(!w&&y){const t="auto"===v?y.map((t=>ab(t))):[v];let n=!1;for(let s=0;s=0||!io(n)){const t=jx(x,e,r,i,o,A,c,d,v,p,M,Lx.horizontal,!1,m,f,l);t&&(g.horizontal[v]=t)}I(_?"left":v)}}let S,P,k,B,z,T,E=!1;const V=h.get("icon-text-fit").evaluate(a,{},s);if(a.icon&&a.icon.hasPrimary()){const e=tb(a.icon,t.iconSizeData,p["icon-size"],s,t.zoom,a,l,d.iconScaleFactor,c);S=e.iconPrimary,k=e.iconSecondary;const r=S.toString();if(P=n.get(r),P&&(z=h.get("icon-offset").evaluate(a,{},s),T=h.get("icon-anchor").evaluate(a,{},s),v=Qx(i.get(r),k?i.get(k.toString()):void 0,z,T),E=P.sdf,void 0===t.sdfIcons?t.sdfIcons=P.sdf:t.sdfIcons!==P.sdf&&Ae("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(P.pixelRatio!==t.pixelRatio||0!==h.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0)),k){const t=k.toString();B=n.get(t)}}A=A||!(!a.icon||!a.icon.hasSecondary());const F=pb(g.horizontal)||g.vertical;t.iconsInText||(t.iconsInText=!!F&&F.iconsInText);const C=m*d.textScaleFactor/dx,{defaultShapedIcon:D,verticallyShapedIcon:R}=ob(t,v,h,a,s,g,C,z,V);"none"!==V&&v&&(ev(v)||rv(v))&&(Jv(0,P,S,v,D,V,u,n,i),Jv(0,B,k,v,D,V,u,n,i),R&&(Jv(0,P,S,v,R,V,u,n,i),Jv(0,B,k,v,R,V,u,n,i))),v=D;const{iconBBox:L,iconVerticalBBox:O,textBBox:U,textVerticalBBox:N}=Wv(t,v,R,h,a,s,y,z,d,i,T,g,m,M);I.push({feature:a,shapedTextOrientations:g,shapedText:F,shapedIcon:v,iconPrimary:S,iconSecondary:k,iconOffset:z,iconAnchor:T,verticallyShapedIcon:R,layoutTextSize:m,layoutIconSize:y,textOffset:M,isSDFIcon:E,iconTextFit:V,iconCollisionBounds:L,iconVerticalCollisionBounds:O,textCollisionBounds:U,textVerticalCollisionBounds:N})}return{featureData:I,sizes:d,hasAnySecondaryIcon:A,textAlongLine:w,symbolPlacement:b}}function Wv(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const f=t.layers[0],m=f.appearances;if(0===m.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const y={iconBBox:null,iconVerticalBBox:null},g={textBBox:null,textVerticalBBox:null},{baseIconRotate:x,baseTextRotate:v,iconScaleFactor:b}=function(t,e,r){const n=t.get("icon-rotate").evaluate(e,{},r),i=t.get("text-rotate").evaluate(e,{},r),[s,a]=t.get("icon-size-scale-range");return{baseIconRotate:n,baseTextRotate:i,iconScaleFactor:ie(1,s,a)}}(n,i,s);e&&(y.iconBBox=Hv(e,y.iconBBox,x,a),r)&&(y.iconVerticalBBox=Hv(r,y.iconVerticalBBox,x+90,a));const w=pb(h.horizontal);w&&(g.textBBox=Hv(w,g.textBBox,v,1,d)),h.vertical&&(g.textVerticalBBox=Hv(h.vertical,g.textVerticalBBox,v+90,1,d));for(const r of m)r.hasIconProperties()&&Yv(y,t,f,r,i,s,o,x,a,l,e,u,b,c),r.hasTextProperties()&&Kv(g,f,r,i,s,d,v,p,w,h.vertical);return{iconBBox:y.iconBBox,iconVerticalBBox:y.iconVerticalBBox,textBBox:g.textBBox,textVerticalBBox:g.textVerticalBBox}}function Yv(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const{appearanceIconOffset:f,appearanceIconRotate:m,appearanceIconSize:y}=function(t,e,r,n,i,s,a,o){const l=t.hasProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(t,"icon-offset",r,n,[]):null,u=l&&Array.isArray(l)?l:i,c=t.hasProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(t,"icon-rotate",r,n,[]):null,h="number"==typeof c?c:s,p=t.hasProperty("icon-size")?e.getAppearanceValueAndResolveTokens(t,"icon-size",r,n,[]):null;return{appearanceIconOffset:u,appearanceIconRotate:h,appearanceIconSize:"number"==typeof p?p*o.iconScaleFactor:a}}(n,r,i,s,a,o,l,u);let g=null,x=null,v=null;n.hasProperty("icon-image")?v=function(t,e,r,n,i,s,a){let o=null;const l=e.getAppearanceValueAndResolveTokens(r,"icon-image",n,i,[]);if(l){const e=t.getResolvedImageFromTokens(l),u=r.getUnevaluatedProperty("icon-size"),c=tb(e,sv(t.zoom,u,t.worldview),u,i,t.zoom,n,t.pixelRatio,a,t.worldview);o=s.get(c.iconPrimary.toString())}return o}(e,r,n,i,s,h,p):c&&(v=c.imagePrimary),v&&(g=Qx(v,null,f,d),e.allowVerticalPlacement&&(x=Qx(v,null,f,d))),g&&(t.iconBBox=Hv(g,t.iconBBox,m,y)),x&&(t.iconVerticalBBox=Hv(x,t.iconVerticalBBox,m+90,y))}function Kv(t,e,r,n,i,s,a,o,l,u){const{appearanceTextOffset:c,appearanceTextRotate:h,appearanceTextSize:p}=function(t,e,r,n,i,s,a){const o=t.hasProperty("text-offset")?e.getAppearanceValueAndResolveTokens(t,"text-offset",r,n,[]):null,l=o&&Array.isArray(o)?[o[0]*dx,o[1]*dx]:i,u=t.hasProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(t,"text-rotate",r,n,[]):null,c="number"==typeof u?u:s,h=t.hasProperty("text-size")?e.getAppearanceValueAndResolveTokens(t,"text-size",r,n,[]):null;return{appearanceTextOffset:l,appearanceTextRotate:c,appearanceTextSize:"number"==typeof h?h:a}}(r,e,n,i,s,a,o),d=p/o;l&&(t.textBBox=Hv(l,t.textBBox,h,d,c)),u&&(t.textVerticalBBox=Hv(u,t.textVerticalBBox,h+90,d,c))}function Jv(t,e,r,n,i,s,a,o,l){if(!e||!e.usvg)return;const u=nv(n),c=nv(i),h="both"!==s&&"width"!==s||!ev(n)?1:c.width/u.width,p="both"!==s&&"height"!==s||!rv(n)?1:c.height/u.height;r.scaleSelf(h,p);const d=r.toString();a.set(d,r),o.set(d,e);const{imagePosition:f}=bv(d,e,gv);l.set(d,f)}function Qv(t,e,r,n,i,s,a,o,l){if(!t)return;const u=function(t,e,r,n,i,s){if("camera"===t.kind)return t.maxSize;if("composite"===t.kind){const n=e.possiblyEvaluate(new Po(t.maxZoom,{worldview:s}),r).evaluate(i,{},r),a=e.possiblyEvaluate(new Po(t.minZoom,{worldview:s}),r).evaluate(i,{},r);return Math.max(n,a)}return e.possiblyEvaluate(new Po(n,{worldview:s})).evaluate(i,{},r)}(e,r,n,i,s,l);return t.scaleSelf(u*o*a)}function tb(t,e,r,n,i,s,a,o,l){return{iconPrimary:Qv(t.getPrimary(),e,r,n,i,s,a,o,l),iconSecondary:Qv(t.getSecondary(),e,r,n,i,s,a,o,l)}}function eb(t,e,r){if(!e)return;const n=r.get(t.toString()),i=r.get(e.toString());n&&i&&(n.paddedRect.w===i.paddedRect.w&&n.paddedRect.h===i.paddedRect.h||Ae(`Mismatch in icon variant sizes: ${t.toString()} and ${e.toString()}`),n.usvg!==i.usvg&&Ae(`Mismatch in icon variant image types: ${t.id} and ${e.id}`))}function rb(t,e,r,n,i,s,a,o,l,u){t.iconAtlasPositions=u.iconPositions;const{featureData:c,hasAnySecondaryIcon:h,sizes:p,textAlongLine:d,symbolPlacement:f}=e;for(const e of c){const{shapedIcon:r,verticallyShapedIcon:s,feature:c,shapedTextOrientations:m,shapedText:y,layoutTextSize:g,textOffset:x,isSDFIcon:v,iconPrimary:b,iconSecondary:w,iconTextFit:_,iconOffset:A,iconCollisionBounds:I,iconVerticalCollisionBounds:M,textCollisionBounds:S}=e;nb(r,u.iconPositions,b,w),nb(s,u.iconPositions,b,w),ib(m,u.iconPositions),eb(b,w,u.iconPositions),(y||r)&&lb(t,c,m,r,s,l,p,g,0,x,v,n,i,a,o,h,_,A,d,f,I,M,S)}r&&t.generateCollisionDebugBuffers(s,t.collisionBoxArray,p.textScaleFactor)}function nb(t,e,r,n){if(!t)return;const i=e.get(r.toString());if(t.imagePrimary=i,n){const r=e.get(n.toString());t.imageSecondary=r}}function ib(t,e){for(const r in t.horizontal)sb(t.horizontal[r],e);sb(t.vertical,e)}function sb(t,e){if(t)for(const r of t.positionedLines)for(const t of r.positionedGlyphs)if(null!==t.image){const r=t.image.toString();t.rect=e.get(r).paddedRect}}function ab(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function ob(t,e,r,n,i,s,a,o,l){const u=pb(s.horizontal)||s.vertical,c=r.get("icon-text-fit-padding").evaluate(n,{},i);let h,p=e;return e&&"none"!==l&&(t.allowVerticalPlacement&&s.vertical&&(h=tv(e,s.vertical,l,c,o,a)),u&&(p=tv(e,u,l,c,o,a))),{defaultShapedIcon:p,verticallyShapedIcon:h}}function lb(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A){let I=a.textMaxSize.evaluate(e,{},p);void 0===I?I=o*a.textScaleFactor:I*=a.textScaleFactor;const M=t.layers[0].layout,S=dx,P=o*a.textScaleFactor/S,k=pb(r.horizontal)||r.vertical;if("none"!==y&&t.appearanceFeatureData&&e.index18&&R>2&&(R>>=1),Math.max(Ui/(512*R),1)*M.get("symbol-spacing")),E=M.get("text-padding")*t.tilePixelRatio,V=M.get("icon-padding")*t.tilePixelRatio,F=Xt(M.get("text-max-angle")),C="map"===M.get("icon-rotation-alignment")&&"point"!==v,D=T/2;var R;!1===t.hasAnyIconTextFit&&"none"!==y&&(t.hasAnyIconTextFit=!0);const L=e.properties?+e.properties[Wc]:null,O=L&&t.elevationFeatureIdToIndex?t.elevationFeatureIdToIndex.get(L):65535,U=(o,l,v)=>{if(l.x<0||l.x>=Ui||l.y<0||l.y>=Ui)return;let A=null;if(B){const{x:t,y:e,z:r}=d.projectTilePoint(l.x,l.y,v);A={anchor:new lv(t,e,r,0,void 0),up:d.upVector(v,l.x,l.y)}}!function(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,I,M,S,P,k,B,z,T,E){const V=t.addToLineVertexArray(e,n);let F,C,D,R,L,O,U,N=0,j=0,$=0,G=0,q=-1,H=-1;const X={};let Z=Jr("");const W=r?r.anchor:e,Y="none"!==P;let K=0,J=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")){const t=l.layout.get("text-offset").evaluate(b,{},I);K=t[0]*dx,J=t[1]*dx}else K=l.layout.get("text-radial-offset").evaluate(b,{},I)*dx,J=$v;if(t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(f)O=fb(t),o&&(U=fb(o));else{const r=l.layout.get("text-rotate").evaluate(b,{},I)+90;D=db(u,W,e,c,h,p,t,d,r,m,T),o&&(R=db(u,W,e,c,h,p,o,g,r,null,z))}}if(s){const n=t.iconSizeData,i=l.layout.get("icon-rotate").evaluate(b,{},I),a=zv(s,i,_,Y,w.iconScaleFactor),d=o?zv(o,i,_,Y,w.iconScaleFactor):void 0;C=db(u,W,e,c,h,p,s,g,i,null,B);const f=function(t,e,r,n,i,s,a,o){const l=t.layers[0],u=l.appearances;let c=e.length;if(r&&(c=Math.max(c,r.length)),0===u.length)return c;const[h,p]=n.get("icon-size-scale-range"),d=ie(1,h,p);for(const e of u){const r=e.getUnevaluatedProperties();if(void 0!==r._values["icon-image"].value){const n=l.getAppearanceValueAndResolveTokens(e,"icon-image",i,s,[]);if(n){const e=t.getResolvedImageFromTokens(n);if(e){const n=r._values["icon-size"],l=tb(e,sv(t.zoom,n,t.worldview),n,s,t.zoom,i,t.pixelRatio,d,t.worldview),u=a.get(l.iconPrimary.toString());c=Math.max(c,Tv(u,o))}}}}return c}(t,a,d,l.layout,b,I,t.iconAtlasPositions,Y);N=4*f;let m=null;"source"===n.kind?(m=[iv*l.layout.get("icon-size").evaluate(b,{},I)*w.iconScaleFactor],m[0]>cb&&Ae(`${t.layerIds[0]}: Value for "icon-size" is >= ${ub}. Reduce your "icon-size".`)):"composite"===n.kind&&(m=[iv*w.compositeIconSizes[0].evaluate(b,{},I)*w.iconScaleFactor,iv*w.compositeIconSizes[1].evaluate(b,{},I)*w.iconScaleFactor],(m[0]>cb||m[1]>cb)&&Ae(`${t.layerIds[0]}: Value for "icon-size" is >= ${ub}. Reduce your "icon-size".`)),t.addSymbols(t.icon,a,m,v,x,b,void 0,r,e,V.lineStartIndex,V.lineLength,-1,A,I,M,S,t.symbolInstances.length,f),q=t.icon.placedSymbolArray.length-1,d&&(j=4*f,t.addSymbols(t.icon,d,m,v,x,b,Lx.vertical,r,e,V.lineStartIndex,V.lineLength,-1,A,I,M,S,t.symbolInstances.length,f),H=t.icon.placedSymbolArray.length-1)}for(const n in i.horizontal){const s=n,o=i.horizontal[s];F||(Z=Jr(o.text),f?L=fb(o):F=db(u,W,e,c,h,p,o,d,l.layout.get("text-rotate").evaluate(b,{},I),m,T));const y=1===o.positionedLines.length;if($+=hb(t,r,e,o,a,l,f,b,m,V,i.vertical?Lx.horizontal:Lx.horizontalOnly,y?Nv(i.horizontal):[s],X,q,w,A,I,t.symbolInstances.length,M),y)break}i.vertical&&(G+=hb(t,r,e,i.vertical,a,l,f,b,m,V,Lx.vertical,["vertical"],X,H,w,A,I,t.symbolInstances.length,M));let Q=-1;const tt=(t,e)=>t?Math.max(t,e):e;Q=tt(L,Q),Q=tt(O,Q),Q=tt(U,Q);const et=Q>-1?1:0;t.glyphOffsetArray.length>=qv.MAX_GLYPHS&&Ae("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,W.x,W.y,W.z,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical>=0?X.vertical:-1,q,H,Z,void 0!==F?F:t.collisionBoxArray.length,void 0!==F?F+1:t.collisionBoxArray.length,void 0!==D?D:t.collisionBoxArray.length,void 0!==D?D+1:t.collisionBoxArray.length,void 0!==C?C:t.collisionBoxArray.length,void 0!==C?C+1:t.collisionBoxArray.length,R||t.collisionBoxArray.length,R?R+1:t.collisionBoxArray.length,c,$,G,N,j,et,0,K,J,Q,0,Y?1:0,k)}(t,l,A,o,r,n,s,i,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,E,x,u,0,V,C,g,e,a,c,h,p,f,m,y,O,b,w,_)};if("line"===v)for(const i of dm(e.geometry,0,0,Ui,Ui)){const e=fv(i,T,F,r.vertical||k,n,S,z,t.overscaling,Ui);for(const r of e)k&&mb(t,k.text,D,r)||U(i,r,p)}else if("line-center"===v){for(const t of e.geometry)if(t.length>1){const e=dv(t,F,r.vertical||k,n,S,z);e&&U(t,e,p)}}else if("Polygon"===e.type)for(const t of Vd(e.geometry,0)){const e=Lv(t,16);U(t[0],new lv(e.x,e.y,0,0,void 0),p)}else if("LineString"===e.type)for(const t of e.geometry)U(t,new lv(t[0].x,t[0].y,0,0,void 0),p);else if("Point"===e.type)for(const t of e.geometry)for(const e of t)U([e],new lv(e.x,e.y,0,0,void 0),p)}const ub=255,cb=ub*iv;function hb(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x){const v=function(t,e,r,n,i,s,a,o){const l=[];if(0===e.positionedLines.length)return l;const u=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,c=function(t){const e=t[0],r=t[1],n=e*r;return n>0?[e,-r]:n<0?[-e,r]:0===e?[r,e]:[r,-e]}(r);let h=Math.abs(e.top-e.bottom);for(const t of e.positionedLines)h-=t.lineOffset;const p=e.positionedLines.length,d=h/p;let f=e.top-r[1];for(let t=0;tcb&&Ae(`${t.layerIds[0]}: Value for "text-size" is >= ${ub}. Reduce your "text-size".`)):"composite"===b.kind&&(w=[iv*f.compositeTextSizes[0].evaluate(o,{},y)*f.textScaleFactor,iv*f.compositeTextSizes[1].evaluate(o,{},y)*f.textScaleFactor],(w[0]>cb||w[1]>cb)&&Ae(`${t.layerIds[0]}: Value for "text-size" is >= ${ub}. Reduce your "text-size".`)),t.addSymbols(t.text,v,w,l,a,o,c,e,r,u.lineStartIndex,u.lineLength,d,m,y,x,!1,g,v.length);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*v.length}function pb(t){for(const e in t)return t[e];return null}function db(t,e,r,n,i,s,a,o,l,u,c){let h,p,d,f;if(h=c?c.top:a.top,p=c?c.bottom:a.bottom,d=c?c.left:a.left,f=c?c.right:a.right,Jx(a)&&a.collisionPadding){const t=a.collisionPadding;d-=t[0],h-=t[1],f+=t[2],p+=t[3]}if(l){const t=new $t(d,h),e=new $t(f,h),r=new $t(d,p),n=new $t(f,p),i=Xt(l);let s=new $t(0,0);u&&(s=new $t(u[0],u[1])),t._rotateAround(i,s),e._rotateAround(i,s),r._rotateAround(i,s),n._rotateAround(i,s),d=Math.min(t.x,e.x,r.x,n.x),f=Math.max(t.x,e.x,r.x,n.x),h=Math.min(t.y,e.y,r.y,n.y),p=Math.max(t.y,e.y,r.y,n.y)}return t.emplaceBack(e.x,e.y,e.z,r.x,r.y,d,h,f,p,o,n,i,s),t.length-1}function fb(t){Jx(t)&&t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function mb(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])v&&(b(t,u,n,i,o,l),b(u,r,o,l,s,a))}b(h,p,n,s,i,s),b(p,d,i,s,i,a),b(d,f,i,a,n,a),b(f,h,n,a,n,s),m-=v,y-=v,g+=v,x+=v;const w=1/Math.max(g-m,x-y);return{scale:w,x:m*w,y:y*w,x2:g*w,y2:x*w,projection:e}}function xb(t,e,r,n,i,s,a,o,l){if("globe"===l.name)return lp(t,e,new Gh(r,n,i),!1);const u=gb({z:r,x:n,y:i},l);return new mh([(s+u.x/u.scale)*e,e*(u.y/u.scale),a],[(s+u.x2/u.scale)*e,e*(u.y2/u.scale),o])}function vb(t,{x:e,y:r},n=0){return new $t(((e-n)*t.scale-t.x)*Ui,(r*t.scale-t.y)*Ui)}function bb(t,e,r=0){return F(((e.x-r)*t.scale-t.x)*Ui,(e.y*t.scale-t.y)*Ui,Sc(e.z,e.y))}const wb=f(new Float32Array(16));class _b{constructor(t){this.spec=t,this.name=t.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(t,e){return{x:0,y:0,z:0}}unproject(t,e){return new yc(0,0)}projectTilePoint(t,e,r){return{x:t,y:e,z:0}}locationPoint(t,e,r,n=!0){return t._coordinatePoint(t.locationCoordinate(e,r),n)}pixelsPerMeter(t,e){return Ac(1,t)*e}pixelSpaceConversion(t,e,r){return 1}farthestPixelDistance(t){return yb(t,t.pixelsPerMeter)}pointCoordinate(t,e,r,n){const i=t.horizonLineFromTop(!1),s=new $t(e,Math.max(i,r));return t.rayIntersectionCoordinate(t.pointRayIntersection(s,n))}pointCoordinate3D(t,e,r){const n=new $t(e,r);if(t.elevation)return t.elevation.pointCoordinate(n);{const e=this.pointCoordinate(t,n.x,n.y,0);return[e.x,e.y,e.z]}}isPointAboveHorizon(t,e){if(t.elevation&&t.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(t,e.x,e.y);const r=t.horizonLineFromTop();return e.y0?e<-Tb+r&&(e=-Tb+r):e>Tb-r&&(e=Tb-r);const s=i/Math.pow(Eb(e),n);let a=s*Math.sin(n*t),o=i-s*Math.cos(n*t);return a=.5*(a/Math.PI+.5),o=.5*(o/Math.PI+.5),{x:a,y:this.southernCenter?o:1-o,z:0}}unproject(t,e){t=(2*t-.5)*Math.PI,this.southernCenter&&(e=1-e),e=(2*(1-e)-.5)*Math.PI;const{n:r,f:n}=this,i=n-e,s=Math.sign(i),a=Math.sign(r)*Math.sqrt(t*t+i*i);let o=Math.atan2(t,Math.abs(i))*s;i*r<0&&(o-=Math.PI*Math.sign(t)*s);const l=ie(Zt(o/r)+this.center[0],-180,180),u=ie(Zt(2*Math.atan(Math.pow(n/a,1/r))-Tb),-Pc,Pc);return new yc(l,this.southernCenter?-u:u)}}class Fb extends _b{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(t,e){return{x:wc(t),y:_c(e),z:0}}unproject(t,e){const r=Ic(t),n=Mc(e);return new yc(r,n)}}const Cb=Xt(Pc);class Db extends _b{project(t,e){const r=(e=Xt(e))*e,n=r*r;return{x:.5*((t=Xt(t))*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=25,i=0,s=r*r;do{s=r*r;const t=s*s;i=(r*(1.007226+s*(.015085+t*(.028874*s-.044475-.005916*t)))-e)/(1.007226+s*(.045255+t*(.259866*s-.311325-.005916*11*t))),r=ie(r-i,-Cb,Cb)}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const a=ie(Zt(t/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),o=Zt(r);return new yc(a,o)}}const Rb=Xt(Pc);class Lb extends _b{project(t,e){e=Xt(e),t=Xt(t);const r=Math.cos(e),n=2/Math.PI,i=Math.acos(r*Math.cos(t/2)),s=Math.sin(i)/i,a=.5*(t*n+2*r*Math.sin(t/2)/s)||0,o=.5*(e+Math.sin(e)/s)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(o/Math.PI+1),z:0}}unproject(t,e){let r=t=(2*t-.5)*Math.PI,n=e=(2*(1-e)-1)*Math.PI,i=25;const s=1e-6;let a=0,o=0;do{const i=Math.cos(n),s=Math.sin(n),l=2*s*i,u=s*s,c=i*i,h=Math.cos(r/2),p=Math.sin(r/2),d=2*h*p,f=p*p,m=1-c*h*h,y=m?1/m:0,g=m?Math.acos(i*h)*Math.sqrt(1/m):0,x=.5*(2*g*i*p+2*r/Math.PI)-t,v=.5*(g*s+n)-e,b=.5*y*(c*f+g*i*h*u)+1/Math.PI,w=y*(d*l/4-g*s*p),_=.125*y*(l*p-g*s*c*d),A=.5*y*(u*h+g*f*i)+.5,I=w*_-A*b;a=(v*w-x*A)/I,o=(x*_-v*b)/I,r=ie(r-a,-Math.PI,Math.PI),n=ie(n-o,-Rb,Rb)}while((Math.abs(a)>s||Math.abs(o)>s)&&--i>0);return new yc(Zt(r),Zt(n))}}class Ob extends _b{constructor(t){super(t),this.center=t.center||[0,0],this.parallels=t.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Xt(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){const{scale:r,cosPhi:n}=this;return{x:Xt(t)*n*r+.5,y:-Math.sin(Xt(e))/n*r+.5,z:0}}unproject(t,e){const{scale:r,cosPhi:n}=this,i=-(e-.5)/r,s=ie(Zt((t-.5)/r)/n,-180,180),a=Math.asin(ie(i*n,-1,1)),o=ie(Zt(a),-Pc,Pc);return new yc(s,o)}}class Ub extends Fb{constructor(t){super(t),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(t,e,r){const n=hp(t,e,r);return K(n,n,mp(ip(r))),{x:n[0],y:n[1],z:n[2]}}locationPoint(t,e,r){const n=dc(e.lat,e.lng),i=X([],n),s=r?t._centerAltitude+r:t.elevation?t.elevation.getAtPointOrZero(t.locationCoordinate(e),t._centerAltitude):t._centerAltitude;j(n,n,i,Ac(1,0)*Ui*s);const a=f(new Float64Array(16));return g(a,t.pixelMatrix,t.globeMatrix),K(n,n,a),new $t(n[0],n[1])}pixelsPerMeter(t,e){return Ac(1,0)*e}pixelSpaceConversion(t,e,r){const n=Ac(1,t)*e,i=dn(Ac(1,45)*e,n,r);return this.pixelsPerMeter(t,e)/i}createTileMatrix(t,e,r){const n=yp(ip(r.canonical));return g(new Float64Array(16),t.globeMatrix,n)}createInversionMatrix(t,e){const{center:r}=t,n=mp(ip(e));return w(n,n,Xt(r.lng)),b(n,n,Xt(r.lat)),v(n,n,[t._pixelsPerMercatorPixel,t._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(t,e,r,n){return ep(t,e,r,!0)||new Ec(0,0)}pointCoordinate3D(t,e,r){const n=this.pointCoordinate(t,e,r,0);return[n.x,n.y,n.z]}isPointAboveHorizon(t,e){return!ep(t,e.x,e.y,!1)}farthestPixelDistance(t){const e=function(t,e){const r=t.cameraToCenterDistance,n=t._centerAltitude*e,i=t._camera,s=t._camera.forward(),a=D([],N([],s,-r),[0,0,n]),o=t.worldSize/(2*Math.PI),l=[0,0,-o],u=t.width/t.height,c=Math.tan(t.fovAboveCenter),h=N([],i.up(),c),p=N([],i.right(),c*u),d=X([],D([],D([],s,h),p)),f=[];let m;if(new ih(a,d).closestPointOnSphere(l,o,f)){const e=D([],f,l),r=rt([],e,a);m=Math.cos(t.fovAboveCenter)*V(r)}else{const t=rt([],a,l),e=rt([],l,a);X(e,e);const r=V(t)-o;m=Math.sqrt(r*(r+2*o));const n=Math.acos(m/(o+r))-Math.acos(Z(s,e));m*=Math.cos(n)}return 1.01*m}(t,this.pixelsPerMeter(t.center.lat,t.worldSize)),r=Ap(t.zoom);if(r>0){const n=yb(t,Ac(1,t.center.lat)*t.worldSize),i=t.worldSize/(2*Math.PI),s=Math.max(t.width,t.height)/t.worldSize*Math.PI;return dn(e,n+i*(1-Math.cos(s)),Math.pow(r,10))}return e}upVector(t,e,r){return hp(e,r,t,1)}upVectorScale(t){return{metersToTile:Qh(dp(ip(t)))}}}function Nb(t){const e=t.parallels,r=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new Fb(t);case"equirectangular":return new zb(t);case"naturalEarth":return new Db(t);case"equalEarth":return new Bb(t);case"winkelTripel":return new Lb(t);case"albers":return r?new Ob(t):new Ab(t);case"lambertConformalConic":return r?new Ob(t):new Vb(t);case"globe":return new Ub(t)}throw new Error(`Invalid projection name: ${t.name}`)}const jb=jc.types,$b=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gb(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=o?Math.min(cb,Math.round(o[0])):0,f=o?Math.min(cb,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(d<<1)+(l?1:0),0+(f<<1),16*u,16*c,256*h,256*p)}function qb(t,e,r){t.emplaceBack(e,r)}function Hb(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,a)}function Xb(t,e,r,n,i){const s=5*e+2;t.float32[s+0]=r,t.float32[s+1]=n,t.float32[s+2]=i}const Zb=(t,e,r,n)=>{for(let i=0;i0&&(this.iconTransitioningVertexBuffer=t.createVertexBuffer(this.iconTransitioningVertexArray,lx.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,ix.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||i)&&(this.zOffsetVertexBuffer=t.createVertexBuffer(this.zOffsetVertexArray,ax.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=t.createVertexBuffer(this.orientationVertexArray,ox.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))}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(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}Qa(Kb,"SymbolBuffers");class Jb{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new bu,this.collisionVertexArray=new jl,this.collisionVertexArrayExt=new Dl}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,ux.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,cx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Qa(Jb,"CollisionBuffers");class Qb{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=f([]),this.placementViewportMatrix=f([]);const e=this.layers[0]._unevaluatedLayout._values;this.worldview=t.worldview,this.localizable=t.localizable,this.textSizeData=sv(this.zoom,e["text-size"],this.worldview),this.iconSizeData=sv(this.zoom,e["icon-size"],this.worldview);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.lut=t.lut,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"!==i&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map((t=>Lx[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID,this.projection=t.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(t){const e=this.layers[0].getAppearances();return!(!e||0===e.length)&&e.some((e=>null!=e.getProperty(t)))}createArrays(){this.text=new Kb(new Yu(this.layers,{zoom:this.zoom,lut:this.lut},(t=>t.startsWith("text")||t.startsWith("symbol")))),this.icon=new Kb(new Yu(this.layers,{zoom:this.zoom,lut:this.lut},(t=>t.startsWith("icon")||t.startsWith("symbol")))),this.glyphOffsetArray=new cu,this.lineVertexArray=new hu,this.symbolInstances=new uu}calculateGlyphDependencies(t,e,r,n,i){for(const r of t){const t=r.codePointAt(0);if(void 0===t)break;if(e[t]=!0,n&&i&&t<=65535){const t=mx[r];t&&(e[t.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(t,e,r,n,i,s){let a=1;const o=t.getUnevaluatedProperties()._values["icon-size"],l=sv(this.zoom,o,this.worldview),u=ov(l,e);if("constant"!==l.kind&&"camera"!==l.kind||(a=u.uSize),"composite"===l.kind){const{minZoom:t,maxZoom:e}=l,s=o.possiblyEvaluate(new Po(t,{worldview:this.worldview}),n),c=o.possiblyEvaluate(new Po(e,{worldview:this.worldview}),n),h=s.evaluate(r,{},n,i);a=h+(c.evaluate(r,{},n,i)-h)*u.uSizeT}return"source"===l.kind&&(a=o.possiblyEvaluate(new Po(this.zoom,{worldview:this.worldview}),n).evaluate(r,{},n,i)),a*s}updateFootprints(t,e){}updateReplacement(t,e){if(e.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=e.updateTime;const r=e.getReplacementRegionsForTile(t.toUnwrapped(),!0);return!wf(this.activeReplacements,r)&&(this.activeReplacements=r,!0)}getResolvedImageFromTokens(t){return"string"==typeof t?On.build(t):t}populate(t,e,r,n){const i=this.layers[0],s=i.layout,a="globe"===this.projection.name,o=s.get("text-font"),l=s.get("text-field"),u=s.get("icon-image"),[c,h]=s.get("icon-size-scale-range"),p=ie(e.scaleFactor||1,c,h),d=("constant"!==l.value.kind||l.value.value instanceof Rn&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),f="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,m=this.hasAnyAppearanceProperty("icon-image"),y=s.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!d&&!f&&!m)return;const g=e.iconDependencies,x=e.glyphDependencies,v=e.availableImages,b=new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),w=t=>{const e=t.id.toString();g.has(e)?g.get(e).push(t):g.set(e,[t])};for(const e of t){const{feature:t,id:l,index:u,sourceLayerIndex:c}=e,h=i._featureFilter.needGeometry,_=Nc(t,h);if(!i._featureFilter.filter(b,_,r))continue;if(h||(_.geometry=Uc(t,r,n)),a&&1!==t.type&&r.z<=5){const t=_.geometry,e=.98078528056,n=(t,n)=>Z(hp(t.x,t.y,r,1),hp(n.x,n.y,r,1)){if(!t.getProperty("icon-image"))return;const e=this.getCombinedIconPrimary(t,M,_,r,v,k,p);e&&w(e)})),A){const t=o.evaluate(_,{},r).join(","),e="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Lx.vertical)>=0;for(const r of A.sections)if(r.image){const t=r.image.getPrimary().scaleSelf(this.pixelRatio),e=t.id.toString(),n=g.get(e)||[];n.push(t),g.set(e,n)}else{const n=io(A.toString()),i=r.fontStack||t,s=x[i]=x[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n)}}}if("line"===s.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;ut.geometry))}(this.features)),"hd-road-markup"===s.get("symbol-elevation-reference")){if(this.elevationType="road",e.elevationFeatures){!this.elevationFeatures&&e.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const t of e.elevationFeatures)this.elevationFeatureIdToIndex.set(t.id,this.elevationFeatures.length),this.elevationFeatures.push(t)}}else s.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}getCombinedIconPrimary(t,e,r,n,i,s,a){let o,l;const u=t.getUnevaluatedProperties();if(void 0!==u._values["icon-image"].value){const s=e.getAppearanceValueAndResolveTokens(t,"icon-image",r,n,i);o=this.getResolvedImageFromTokens(s)}else{const t=e.getValueAndResolveTokens("icon-image",r,n,i);o=this.getResolvedImageFromTokens(t)}if(o){const t=u._values["icon-size"]||e._unevaluatedLayout._values["icon-size"];l=tb(o,sv(this.zoom,t,this.worldview),t,n,this.zoom,s,this.pixelRatio,a,this.worldview).iconPrimary}return l}updateAppearanceBasedIconTextures(t,e,r,n){if(!this.appearanceFeatureData)return!1;if(!this.icon.layoutVertexArray||0===this.icon.layoutVertexArray.length)return!1;const i=this.layers[0];let s=!1,a=0;const o=i.layout,[l,u]=o.get("icon-size-scale-range"),c=ie(1,l,u);for(let o=0;o=0){const o=h.id,u=e&&void 0!==o?e[String(o)]:void 0,p={type:"Point",id:h.id,properties:h.properties,geometry:[]},d=this.layers[0].appearances&&this.layers[0].appearances.find((e=>e.isActive({globals:n,feature:p,canonical:t,featureState:u})));if(h.activeAppearance===d){a+=l.numIconVertices;continue}if(d){h.activeAppearance=d;const e=this.getCombinedIconPrimary(d,i,p,t,r,{sortKey:void 0,text:void 0,icon:null,index:l.featureIndex,sourceLayerIndex:l.featureIndex,geometry:[],properties:h.properties,type:"Point",id:h.id},c);if(!e)continue;const o=e.toString(),u=this.iconAtlasPositions&&this.iconAtlasPositions.get(o);if(u){const e=i.getAppearanceValueAndResolveTokens(d,"icon-offset",p,t,r),o=e&&Array.isArray(e)?e:[0,0];let f=Qx(u,void 0,o,i.layout.get("icon-anchor").evaluate(p,{},t));const m=i.getAppearanceValueAndResolveTokens(d,"icon-rotate",p,t,r),y="number"==typeof m?m:0,g=u.sdf,x=i.layout.get("icon-text-fit").constantOr("none");"none"!==x&&h.textShaping&&h.iconTextFitPadding&&h.fontScale&&(f=tv(f,h.textShaping,x,h.iconTextFitPadding,o,h.fontScale));const v=this.calculateEffectiveAppearanceIconSize(d,n.zoom,p,t,r,c),b=0,w=1+(Math.min(cb,Math.round(v*iv))<<1),_=zv(f,y,g,"none"!==x,c);h.isUsingAppearanceVertexData||(h.isUsingAppearanceVertexData=!0,h.layoutBasedVertexData=this.icon.getIconVertexData(a,l.numIconVertices));for(let t=0;t<_.length;++t){const e=_[t],r=h.layoutBasedVertexData[0]||l.tileAnchorX,n=h.layoutBasedVertexData[1]||l.tileAnchorY,i=16*e.pixelOffsetTL.x,s=16*e.pixelOffsetTL.y,o=16*e.pixelOffsetBR.x,u=16*e.pixelOffsetBR.y,c=16*e.minFontScaleX,p=16*e.minFontScaleY;this.icon.updateIconVertexData(a,r,n,Math.round(32*e.tl.x),Math.round(32*e.tl.y),e.texPrimary.x,e.texPrimary.y,b,w,i,s,c,p),this.icon.updateIconVertexData(a+1,r,n,Math.round(32*e.tr.x),Math.round(32*e.tr.y),e.texPrimary.x+e.texPrimary.w,e.texPrimary.y,b,w,o,s,c,p),this.icon.updateIconVertexData(a+2,r,n,Math.round(32*e.bl.x),Math.round(32*e.bl.y),e.texPrimary.x,e.texPrimary.y+e.texPrimary.h,b,w,i,u,c,p),this.icon.updateIconVertexData(a+3,r,n,Math.round(32*e.br.x),Math.round(32*e.br.y),e.texPrimary.x+e.texPrimary.w,e.texPrimary.y+e.texPrimary.h,b,w,o,u,c,p),a+=4}const A=l.numIconVertices-4*_.length;for(let t=0;t0&&(this.icon.updateIconVertexData(a,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(a+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(a+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(a+3,0,0,0,0,0,0,0,0,0,0,0,0),s=!0),a+=l.numIconVertices,h.activeAppearance=null;else if(h.isUsingAppearanceVertexData){const t=12,e=h.layoutBasedVertexData.length/t;for(let r=0;r0||c>0,f=h>0,m=this.elevationFeatures[a.elevationFeatureIndex];if(m){const t=new $t(a.tileAnchorX,a.tileAnchorY),u=.075+m.pointElevation(t);a.zOffset!==u&&(e=!0,a.zOffset=u),0!==u&&(this.hasAnyZOffset=!0);const c=m.computeSlopeNormal(t,n),h=Pt(ft(),F(0,0,1),c);Q(o,o,h),Q(l,l,h),o[2]*=r,l[2]*=r,1===o[0]&&0===o[1]&&0===o[2]&&0===l[0]&&1===l[1]&&0===l[2]||(i=i||d,s=s||f)}if(d&&(Zb(this.text.orientationVertexArray,u,o,l),Zb(this.text.orientationVertexArray,c,o,l)),f){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:e}=a;t>=0&&Zb(this.icon.orientationVertexArray,h,o,l),e>=0&&Zb(this.icon.orientationVertexArray,p,o,l)}}i||(this.text.orientationVertexArray=void 0),s||(this.icon.orientationVertexArray=void 0),e&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const t=(t,e,n)=>{r+=e,r>t.length&&t.resize(r);for(let i=-e;i<0;i++)t.emplace(i+r,n)},e=(t,e,r)=>{n+=e,n>t.length&&t.resize(n);for(let i=-e;i<0;i++)t.emplace(i+n,r)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,n=0;for(let r=0;r0;if((i>0||s>0)&&(t(this.text.zOffsetVertexArray,i,o),t(this.text.zOffsetVertexArray,s,o)),l){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:r}=n;t>=0&&e(this.icon.zOffsetVertexArray,a,o),r>=0&&e(this.icon.zOffsetVertexArray,n.numVerticalIconVertices,o)}}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(t,e,r,n,i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),null===this.hasAppearances&&(this.hasAppearances=this.layers.some((t=>t.appearances&&t.appearances.length>0))),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(t,e,r,n){return!!(t&&e&&r)&&!(!this.icon.layoutVertexArray||0===this.icon.layoutVertexArray.length)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(t,e,r,n)&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Nb(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment)for(const{x:t,y:r}of e)this.lineVertexArray.emplaceBack(t,r);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g){const x=t.indexArray,v=t.layoutVertexArray,b=t.globeExtVertexArray,w=t.segments.prepareSegment(4*g,v,x,this.canOverlap?s.sortKey:void 0),_=this.glyphOffsetArray.length,A=w.vertexLength,I=this.allowVerticalPlacement&&a===Lx.vertical?Math.PI/2:0,M=s.text&&s.text.sections;for(let n=0;n=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:n),s=av(this.textSizeData,t,i)/dx;return this.tilePixelRatio*s}getSymbolInstanceIconSize(t,e,r){const n=this.icon.placedSymbolArray.get(r),i=av(this.iconSizeData,t,n);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(t,e,r,n){t.emplaceBack(e,-r,-r,n),t.emplaceBack(e,r,-r,n),t.emplaceBack(e,r,r,n),t.emplaceBack(e,-r,r,n)}_updateTextDebugCollisionBoxes(t,e,r,n,i,s,a){for(let a=n;a0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;en[t]-n[e]||i[e]-i[t])),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let t=0;tthis.symbolInstances.get(e).zOffset-this.symbolInstances.get(t).zOffset))}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex);const{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:i,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:o}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),i>=0&&i!==n&&i!==r&&this.addIndicesForPlacedSymbol(this.text,i),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a),o>=0&&this.addIndicesForPlacedSymbol(this.icon,o)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(t){const e=this.symbolInstances.get(this.text.symbolInstanceIndices[t]).elevationFeatureIndex;let r;return this.elevationFeatures&&er in t?String(t[r]):""))}let ew,rw,nw;Qa(Qb,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),Qb.addDynamicAttributes=Wb;class iw{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:xn,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Qa(iw,"FormatSectionOverride",{omit:["defaultValue"]});const sw=()=>nw||(nw={layout:ew||(ew=new No({"symbol-placement":new Do(jo.layout_symbol["symbol-placement"]),"symbol-spacing":new Do(jo.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Do(jo.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ro(jo.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Do(jo.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Do(jo.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Do(jo.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Do(jo.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Do(jo.layout_symbol["icon-ignore-placement"]),"icon-optional":new Do(jo.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Do(jo.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ro(jo.layout_symbol["icon-size"]),"icon-size-scale-range":new Do(jo.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ro(jo.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ro(jo.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ro(jo.layout_symbol["icon-image"]),"icon-image-use-theme":new Do({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ro(jo.layout_symbol["icon-rotate"]),"icon-padding":new Do(jo.layout_symbol["icon-padding"]),"icon-keep-upright":new Do(jo.layout_symbol["icon-keep-upright"]),"icon-offset":new Ro(jo.layout_symbol["icon-offset"]),"icon-anchor":new Ro(jo.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Do(jo.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Do(jo.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Do(jo.layout_symbol["text-rotation-alignment"]),"text-field":new Ro(jo.layout_symbol["text-field"]),"text-font":new Ro(jo.layout_symbol["text-font"]),"text-size":new Ro(jo.layout_symbol["text-size"]),"text-size-scale-range":new Do(jo.layout_symbol["text-size-scale-range"]),"text-max-width":new Ro(jo.layout_symbol["text-max-width"]),"text-line-height":new Ro(jo.layout_symbol["text-line-height"]),"text-letter-spacing":new Ro(jo.layout_symbol["text-letter-spacing"]),"text-justify":new Ro(jo.layout_symbol["text-justify"]),"text-radial-offset":new Ro(jo.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Do(jo.layout_symbol["text-variable-anchor"]),"text-anchor":new Ro(jo.layout_symbol["text-anchor"]),"text-max-angle":new Do(jo.layout_symbol["text-max-angle"]),"text-writing-mode":new Do(jo.layout_symbol["text-writing-mode"]),"text-rotate":new Ro(jo.layout_symbol["text-rotate"]),"text-padding":new Do(jo.layout_symbol["text-padding"]),"text-keep-upright":new Do(jo.layout_symbol["text-keep-upright"]),"text-transform":new Ro(jo.layout_symbol["text-transform"]),"text-offset":new Ro(jo.layout_symbol["text-offset"]),"text-allow-overlap":new Do(jo.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Do(jo.layout_symbol["text-ignore-placement"]),"text-optional":new Do(jo.layout_symbol["text-optional"]),visibility:new Do(jo.layout_symbol.visibility)})),paint:rw||(rw=new No({"icon-opacity":new Ro(jo.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ro(jo.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ro(jo.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ro(jo.paint_symbol["text-emissive-strength"]),"icon-color":new Ro(jo.paint_symbol["icon-color"]),"icon-halo-color":new Ro(jo.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ro(jo.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ro(jo.paint_symbol["icon-halo-blur"]),"icon-translate":new Do(jo.paint_symbol["icon-translate"]),"icon-translate-anchor":new Do(jo.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Do(jo.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ro(jo.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ro(jo.paint_symbol["text-occlusion-opacity"]),"text-color":new Ro(jo.paint_symbol["text-color"],{runtimeType:_n,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Ro(jo.paint_symbol["text-halo-color"]),"text-halo-width":new Ro(jo.paint_symbol["text-halo-width"]),"text-halo-blur":new Ro(jo.paint_symbol["text-halo-blur"]),"text-translate":new Do(jo.paint_symbol["text-translate"]),"text-translate-anchor":new Do(jo.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Do(jo.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Do(jo.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Do(jo.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Do(jo.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ro(jo.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},nw);class aw extends ml{constructor(t,e,r,n){super(t,sw(),e,r,n,t.layout?t.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=f([]),this.hasOcclusionOpacityProperties=void 0!==t.paint&&("icon-occlusion-opacity"in t.paint||"text-occlusion-opacity"in t.paint)}_handleSpecialPaintPropertyUpdate(t){"icon-occlusion-opacity"!==t&&"text-occlusion-opacity"!==t||(this.hasOcclusionOpacityProperties=!0)}recalculate(t,e){super.recalculate(t,e),this.appearances&&this.appearances.forEach((r=>{r.recalculate(t,e,this.iconImageUseTheme)})),"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"));const r=this.layout.get("text-writing-mode");if(r){const t=[];for(const e of r)t.indexOf(e)<0&&t.push(e);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(t,e,r,n){return this._saturation===t&&this._contrast===e&&this._brightnessMin===r&&this._brightnessMax===n||(this._colorAdjustmentMatrix=function(t,e,r,n){t=Ge(t),e=$e(e);const i=h(),s=t/3,a=1-2*s,o=[a,s,s,0,s,a,s,0,s,s,a,0,0,0,0,1],l=.5-.5*e,u=n-r;return g(i,[u,0,0,0,0,u,0,0,0,0,u,0,r,r,r,1],[e,0,0,0,0,e,0,0,0,0,e,0,l,l,l,1]),g(i,i,o),i}(t,e,r,n),this._saturation=t,this._contrast=e,this._brightnessMin=r,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||Na(s.value)||!i?i:tw(e.properties,i)}getAppearanceValueAndResolveTokens(t,e,r,n,i){const s=t.getProperty(e);if(!s)return;const a=s.evaluate(r,{},n,i),o=t.getUnevaluatedProperties()._values[e];return o.isDataDriven()||Na(o.value)||!a||"string"!=typeof a?a:tw(r.properties,a)}createBucket(t){return new Qb(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of sw().paint.overridableProperties){if(!aw.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new iw(e),n=new Ua(r,e.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new $a("source",n):new Ga("composite",n,e.value.zoomStops,e.value.interpolationType),this.paint._values[t]=new Fo(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&aw.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=sw().paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof Rn)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof Gn&&jn(e.value)===Sn?s(e.value.sections):e instanceof Zn?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}getProgramIds(){return["symbol"]}getDefaultProgramParams(t,e,r){return{config:new Wu(this,{zoom:e,lut:r}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}}let ow,lw,uw,cw;const hw=bl([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function pw(t,e,r,n,i,s,a,o){const c=[t,e,1,r,n,1,i,s,1],h=[a,o,1],p=l([],c),[d,f,m]=J(h,h,p);return u(c,c,[d,0,0,0,f,0,0,0,m])}function dw(t,e,r,n,i,s,a,o){const c=function(t,e,r,n,i,s,a,o){const c=pw(0,0,1,0,1,1,0,1),h=pw(t,e,r,n,i,s,a,o);return u(h,h,l([],c))}(t,e,r,n,i,s,a,o);return[c[2]/c[8]/Ui,c[5]/c[8]/Ui]}function fw(t){return[t[0],Math.min(Math.max(t[1],-Pc),Pc)]}class mw extends nn{constructor(t,e,r,n){super(),this.id=t,this.dispatcher=r,this.coordinates=e.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(n),this.options=e,this._dirty=!1}load(t,e){if(this._loaded=e||!1,this.fire(new Qr("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return t&&(this.coordinates=t),this._loaded=!0,void this._finishLoading();this._imageRequest=$r(this.map._requestManager.transformRequest(this.url,Tr.Image),((e,r)=>{this._imageRequest=null,this._loaded=!0,e?this.fire(new tn(e)):r&&(this.image=r instanceof HTMLImageElement?lr.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading())}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._imageRequest&&t.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=t.url,this.load(t.coordinates,this._loaded),this):this}setTexture(t){if(!(t.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new xy(this.map.painter.context,t.handle),this.width=t.dimensions[0],this.height=t.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Qr("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(t){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof xy||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(t){if(this.coordinates=t,this._boundsArray=void 0,this._unsupportedCoords=!1,!t.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let e=t[0][1],r=t[0][1];for(const n of t)n[1]>r&&(r=n[1]),n[1]Pc?this.onNorthPole=!0:n<-Pc&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const e=t.map(Ec.fromLngLat);this.tileID=function(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);const s=Math.max(n-e,i-r),a=Math.max(0,Math.floor(-Math.log2(s))),o=Math.pow(2,a);let l=Math.floor((e+n)/2*o);return l>1&&(l-=1),new Gh(a,l,Math.floor((r+i)/2*o))}(e),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Qr("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof xy||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(t){for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const e=gb(new Gh(0,0,0),this.map.transform.projection),r=[e.projection.project(this.coordinates[0][0],this.coordinates[0][1]),e.projection.project(this.coordinates[1][0],this.coordinates[1][1]),e.projection.project(this.coordinates[2][0],this.coordinates[2][1]),e.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(t){const e=t[1].x-t[0].x,r=t[1].y-t[0].y,n=t[2].x-t[1].x,i=t[2].y-t[1].y,s=t[3].x-t[2].x,a=t[3].y-t[2].y,o=t[0].x-t[3].x,l=t[0].y-t[3].y,u=e*i-n*r,c=n*a-s*i,h=s*l-o*a,p=o*r-e*l;return u>0&&c>0&&h>0&&p>0||u<0&&c<0&&h<0&&p<0}(r))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const n=gb(this.tileID,this.map.transform.projection),[i,s,a,o]=this.coordinates.map((t=>{const e=n.projection.project(t[0],t[1]);return vb(n,e)._round()}));this.perspectiveTransform=dw(i.x,i.y,s.x,s.y,a.x,a.y,o.x,o.y);const c=this._boundsArray=new Il;c.emplaceBack(i.x,i.y,0,0),c.emplaceBack(s.x,s.y,Ui,0),c.emplaceBack(o.x,o.y,0,Ui),c.emplaceBack(a.x,a.y,Ui,Ui),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=t.createVertexBuffer(c,hw.members),this.boundsSegments=bu.simpleSegment(0,0,4,2);const h=[],p=[fw((d=this.coordinates)[0]),fw(d[1]),fw(d[2]),fw(d[3])];var d;const[f,m,y,g]=function(t){let e=t[0][0],r=e,n=t[0][1],i=n;for(let s=1;sr&&(r=t[s][0]),t[s][1]i&&(i=t[s][1]);return[e,n,r-e,i-n]}(p);{const n=new Il,[i,s,a,o]=function(t){let e=t[0].x,r=e,n=t[0].y,i=n;for(let s=1;sr&&(r=t[s].x),t[s].yi&&(i=t[s].y);return[e,n,r-e,i-n]}(r),c=t=>[(t.x-i)/a,(t.y-s)/o],[p,d,x,v]=r.map(c),b=function(t,e,r,n,i,s,a,o){const c=pw(0,0,1,0,1,1,0,1);return u(c,c,l([],pw(t,e,r,n,i,s,a,o)))}(p[0],p[1],d[0],d[1],x[0],x[1],v[0],v[1]);this.elevatedGlobePerspectiveTransform=dw(p[0],p[1],d[0],d[1],x[0],x[1],v[0],v[1]);const w=(t,e)=>{h.push(t.lng);const r=Math.round((t.lng-f)/y*Ui),i=Math.round((t.lat-m)/g*Ui),s=c(e),a=J([],[s[0],s[1],1],b),o=Math.round(a[0]/a[2]*Ui),l=Math.round(a[1]/a[2]*Ui);n.emplaceBack(r,i,o,l)},_=r[3].x-r[0].x,A=r[3].y-r[0].y,I=r[2].x-r[1].x,M=r[2].y-r[1].y;for(let t=0;t<65;t++){const n=t/64,i=[r[0].x+n*_,r[0].y+n*A],s=[r[1].x+n*I,r[1].y+n*M],a=s[0]-i[0],o=s[1]-i[1];for(let t=0;t<65;t++){const r=t/64,n={x:i[0]+a*r,y:i[1]+o*r};w(e.projection.unproject(n.x,n.y),n)}}this.elevatedGlobeVertexBuffer=t.createVertexBuffer(n,hw.members)}{this.maxLongitudeTriangleSize=0;let e=[],r=new $l;const n=(t,n,i)=>{r.emplaceBack(t,n,i);const s=h[t],a=h[n],o=h[i],l=Math.min(Math.min(s,a),o),u=Math.max(Math.max(s,a),o)-l;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),e.push(l+u/2)};for(let t=0;t<64;t++)for(let e=0;e<64;e++){const r=65*t+e,i=r+1,s=r+65,a=s+1;n(r,s,i),n(i,s,a)}[e,r]=function(t,e){const r=Array.from({length:t.length},((t,e)=>e));r.sort(((e,r)=>t[e]-t[r]));const n=[],i=new $l;for(let s=0;s{s.segments.push({vertexOffset:0,primitiveOffset:t,vertexLength:e.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}})},o=.51*this.maxLongitudeTriangleSize;if(Math.abs(r[0]-n)<=o){const t=je(r,0,r.length,n+o);return t===r.length||a(t,Ne(r,t+1,r.length,n+360-o)-t),s}nUi?n-Ui:n,new $t(Math.trunc(n),Math.trunc(r[e+1]))}translationForInstance(t){const e=16*t,r=this.instancedDataArray.float32;return[r[e+4],r[e+5],r[e+6]]}rotationScaleForInstance(t){const e=16*t,r=this.instancedDataArray.float32;return[r[e+7],r[e+8],r[e+9],r[e+10],r[e+11],r[e+12],r[e+13],r[e+14],r[e+15]]}transformForInstance(t){const e=16*t,r=this.instancedDataArray.float32;return[r[e+7],r[e+8],r[e+9],r[e+4],r[e+10],r[e+11],r[e+12],r[e+5],r[e+13],r[e+14],r[e+15],r[e+6],0,0,0,1]}}class Dw{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaledZ=this.canonical.z+Math.log2(t.overscaling),this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.projection=t.projection,this.index=t.index,this.worldview=t.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.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+1?0: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,this.styleDefinedModelURLs=t.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){this.tileToMeter=Tc(r);const i=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:s,id:a,index:o,sourceLayerIndex:l}of t){const t=null!=a?a:s.properties&&s.properties.hasOwnProperty("id")?s.properties.id:void 0,u=Nc(s,i);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),u,r))continue;const c={id:t,sourceLayerIndex:l,index:o,geometry:i?u.geometry:Uc(s,r,n),properties:s.properties,type:s.type,patterns:{}},h=this.addFeature(c,c.geometry,u);h&&e.featureIndex.insert(s,c.geometry,o,l,this.index,this.instancesPerModel[h].instancedDataArray.length,Ui/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const t=this.layers[0].modelManager,e=this.layers[0].scope;let r=0;for(const n of this.modelUris){const i=t.getModel(n,e);if(!i)continue;const s=this.instancesPerModel[n];if(s){const t=.5*$(i.aabb.max,i.aabb.min)*s.maxScale+s.maxXYTranslationDistance,e=Math.min(Ui,Math.max(t/this.tileToMeter,Ui/32));r=Math.max(e,r)}}return r}update(t,e,r,n){for(const e in this.instancesPerModel){const r=this.instancesPerModel[e];for(const e in t)r.idToFeaturesIndex.hasOwnProperty(e)&&(this.evaluate(r.features[r.idToFeaturesIndex[e]],t[e],r,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let t=!1;for(const e in this.instancesPerModel){const r=this.instancesPerModel[e];for(const e of r.features){const n=this.layers[0],i=e.feature,s=this.canonical,a=n.paint.get("model-rotation").evaluate(i,{},s),o=n.paint.get("model-scale").evaluate(i,{},s),l=n.paint.get("model-translation").evaluate(i,{},s);et(e.rotation,a)&&et(e.scale,o)&&et(e.translation,l)||(this.evaluate(e,e.featureStates,r,!0),t=!0)}}return t}updateReplacement(t,e,r,n){if(e.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=e.updateTime;const i=e.getReplacementRegionsForTile(t.toUnwrapped(),!0);if(wf(this.activeReplacements,i))return!1;this.activeReplacements=i;let s=!1;for(const e in this.instancesPerModel){const i=this.instancesPerModel[e],a=i.instancedDataArray;for(const e of i.features){const i=e.instancedDataOffset,o=e.instancedDataCount;for(let e=0;eUi;l=u?l-Ui:l;const c=Math.floor(l),h=Math.floor(a.float32[o+1]);let p=!1;for(const e of this.activeReplacements)if(!yf(e,r,Bw.Model,n)&&!(e.min.x>c||c>e.max.x||e.min.y>h||h>e.max.y)&&(p=Pf(Sf(c,h,t.canonical,e.footprintTileId.canonical),e.footprint),p))break;a.float32[o]=p?l+Ui:l,s=s||p!==u}}}return s}isEmpty(){for(const t in this.instancesPerModel)if(0!==this.instancesPerModel[t].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(t){if(!this.uploaded)for(const e in this.instancesPerModel){const r=this.instancesPerModel[e];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=t.createVertexBuffer(r.instancedDataArray,Iy.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(t){for(const t in this.instancesPerModel){const e=this.instancesPerModel[t];0!==e.instancedDataArray.length&&e.instancedDataBuffer&&e.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(t&&e&&this.modelUris&&this.modelsRequested)for(const t of this.modelUris)e.removeModel(t,"",!0)}addFeature(t,e,r){const n=this.layers[0],i=n.layout.get("model-id").evaluate(r,{},this.canonical);if(!i)return Ae(`modelId is not evaluated for layer ${n.id} and it is not going to get rendered.`),i;(Ew(i,!1)||void 0!==this.styleDefinedModelURLs[i])&&(this.modelUris.includes(i)||this.modelUris.push(i)),this.instancesPerModel[i]||(this.instancesPerModel[i]=new Cw);const s=this.instancesPerModel[i],a=s.instancedDataArray,o=new Fw(r,a.length);for(const t of e)for(const e of t){if(e.x<0||e.x>=Ui||e.y<0||e.y>=Ui)continue;if(0!==this.lookupDim){const t=(this.lookupDim-1)/Ui,r=this.lookupDim*(e.y*t|0)+e.x*t|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}}this.instanceCount++;const t=a.length;a.resize(t+1),s.instancesEvaluatedElevation.push(0),a.float32[16*t]=e.x,a.float32[16*t+1]=e.y}return o.instancedDataCount=s.instancedDataArray.length-o.instancedDataOffset,o.instancedDataCount>0&&(t.id&&(s.idToFeaturesIndex[t.id]=s.features.length),s.features.push(o),this.evaluate(o,{},s,!1)),i}getModelUris(){return this.modelUris}evaluate(t,e,r,n){const i=this.layers[0],s=t.feature,a=this.canonical,o=t.rotation=i.paint.get("model-rotation").evaluate(s,e,a),l=t.scale=i.paint.get("model-scale").evaluate(s,e,a),u=t.translation=i.paint.get("model-translation").evaluate(s,e,a),c=Object.assign({},i.paint.get("model-color").evaluate(s,e,a));c.a=i.paint.get("model-color-mix-intensity").evaluate(s,e,a);const h=[];this.maxVerticalOffset0?Math.sqrt(p):0;r.maxScale=Math.max(Math.max(r.maxScale,l[0]),Math.max(l[1],l[2])),r.maxXYTranslationDistance=Math.max(r.maxXYTranslationDistance,d),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),Vy(h,o,l);const f=Math.round(100*c.a)+c.b/1.05;for(let e=0;e10?this.tileToMeter:Tc(a,p)),o[s+4]=u[0],o[s+5]=u[1],o[s+6]=u[2]+l,o[s+7]=h[0],o[s+8]=h[1],o[s+9]=h[2],o[s+10]=h[4],o[s+11]=h[5],o[s+12]=h[6],o[s+13]=h[8],o[s+14]=h[9],o[s+15]=h[10],r.instancesEvaluatedElevation[i]=u[2]}}}let Rw,Lw;Qa(Dw,"ModelBucket",{omit:["layers"]}),Qa(Cw,"PerModelAttributes"),Qa(Fw,"ModelFeature");class Ow{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return!1;const r=e.getSource().maxzoom,n=1<1)return e;const i=n.getSource().maxzoom,s=1<{const o=this.getAtTileOffset(t,i,s,a),l=n.upVector(t.canonical,i.x,i.y);return N(l,l,o*n.upVectorScale(t.canonical,e,r).metersToTile),l}}getForTilePoints(t,e,r,n){if(this.isUsingMockSource())return!1;const i=Uw.create(this,t,n);return!!i&&(e.forEach((t=>{t[2]=this.exaggeration()*i.getElevationAt(t[0],t[1],r)})),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const r=e.dem.tree,n=e.tileID,i=1<t.fqid)),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.modelTraits|=Ly.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=Ly.HasMapboxMeshFeatures),i&&(this.modelTraits|=Ly.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=s,this.worldview=o,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const t of e)this.nodesInfo.push(new Hw(t)),Gw(t,a.featureIndexArray.length,a.grid),a.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,a.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(t,e){for(const r of this.getNodesInfo()){const n=r.node;n.footprint&&e.push({footprint:n.footprint,id:t})}}updateAppearances(t,e,r,n){}update(t){const e=0!==Object.keys(t).length;if(e&&!this.stateDependentLayers.length)return;const r=e?this.stateDependentLayers:this.layers;if(!Gt(t,this.states))for(const e of r)this.evaluate(e,t);this.states=structuredClone(t)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(t){if(!this.needsUpload)return;const e=this.getNodesInfo();for(const r of e){const e=r.node;this.uploaded?this.updatePbrBuffer(e):Gy(e,t,!0)}for(const t of e)qy(t.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(t){let e=!1;if(!t.meshes)return e;for(const r of t.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),e=!0);return e}needsReEvaluation(t,e,r){const n=t.transform.projectionOptions,i=t.style.getBrightness(),s=this.brightness!==i;if(!this.uploaded||this.dirty||n.name!==this.projection.name||Zw(r.paint.get("model-color").value,s)||Zw(r.paint.get("model-color-mix-intensity").value,s)||Zw(r.paint.get("model-roughness").value,s)||Zw(r.paint.get("model-emissive-strength").value,s)||Zw(r.paint.get("model-height-based-emissive-strength-multiplier").value,s)){this.projection=n,this.brightness=i;const t=this.getNodesInfo();for(const e of t)e.state=null;return!0}return!1}evaluateTransform(t,e){if(t.transform.zoom===this.zoom)return;this.zoom=t.transform.zoom;const r=this.getNodesInfo(),n=this.id.canonical;for(const t of r){const r=t.feature;t.evaluatedTranslation=e.paint.get("model-translation").evaluate(r,{},n),t.evaluatedScale=e.paint.get("model-scale").evaluate(r,{},n)}}evaluate(t,e){const r=this.getNodesInfo();for(const n of r){if(!n.node.meshes)continue;const r=n.feature,i=e&&e[r.id];if(Gt(i,n.state))continue;n.state=structuredClone(i);const s=n.node.meshes&&n.node.meshes[0].featureData,a=n.evaluatedColor[2],o=n.evaluatedRMEA[2],l=this.id.canonical;if(n.hasTranslucentParts=!1,s){for(let e=0;e=t)continue;const h=Nw[u],p=Math.abs(h);p>o&&(a=h,o=p,l=i,c=e)}if(o>.1){const s=1-(t+.5*Math.abs(l*c))/u;let o=e._dem.get(n,r)+a*s;const h=e._dem.get(n+l,r+c),p=e._dem.get(n-l,r-c,!0);(o-h)*(o-p)>0&&(o=(h+p)/2),Nw[i]=e._dem.set(n,r,o),jw[i]=t}}}}}a&&(e._demTile.needsDEMTextureUpload=!0,e._dem._timestamp=lr.now())}setFilter(t){this.filter=t?Ho(t):null}getNodesInfo(){return this.filter?this.nodesInfo.filter((t=>this.filter.filter(new Po(this.id.overscaledZ,{worldview:this.worldview}),t.feature,this.id.canonical))):this.nodesInfo}destroy(){const t=this.getNodesInfo();for(const e of t)qy(e.node),Hy(e.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(t,e){if(e.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=e.updateTime;const r=e.getReplacementRegionsForTile(t.toUnwrapped());for(const t of this.getNodesInfo()){const e=t.node.footprint;t.hiddenByReplacement=!!e&&!r.find((t=>t.footprint===e))}}getHeightAtTileCoord(t,e){const r=[],n=[0,0,0],i=f([]);for(const s of this.getNodesInfo()){const a=s.node.meshes[0],o=a.transformedAabb;if(to.max[0]||e>o.max[1])continue;if(!0===s.node.hidden)return{height:1/0,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]};y(i,s.node.globalMatrix),n[0]=t,n[1]=e,K(n,n,i);const l=(n[0]-a.aabb.min[0])/(a.aabb.max[0]-a.aabb.min[0])*Ry|0,u=Math.min(Ry-1,(n[1]-a.aabb.min[1])/(a.aabb.max[1]-a.aabb.min[1])*Ry|0)*Ry+Math.min(Ry-1,l),c=a.heightmap[u];if(!(c<0&&s.node.footprint)){if(s.hiddenByReplacement)return;return{height:c,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]}}if(s.node.footprint.grid.query(new $t(t,e),new $t(t,e),r),r.length>0)return{height:void 0,maxHeight:s.feature.properties.height,hidden:s.hiddenByReplacement,verticalScale:s.evaluatedScale[2]}}}}function Zw(t,e){return t instanceof $a&&!t.isLightConstant&&e}function Ww(t,e,r,n,i,s,a,o){let l=(61440&e|(61440&e)>>4)>>8,u=(3840&e|(3840&e)>>4)>>4,c=240&e|(240&e)>>4;r[3]>0&&(l=dn(l,255*r[0],r[3]),u=dn(u,255*r[1],r[3]),c=dn(c,255*r[2],r[3]));const h=l<<8|u,p=c<<8|Math.floor(255*n[3]),d=function(t){const e=ie(t,0,2);return Math.min(Math.round(.5*e*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],f=ie(i[0],0,1),m=ie(i[1],0,1),y=ie(i[2],0,1),g=ie(i[3],0,1);let x,v,b,w;if(f!==m&&a!==s&&m!==f){const t=a-s;v=1/(t*(m-f)),b=-(s+t*f)/(t*(m-f));const e=ie(i[4],-1,1);w=Math.pow(10,e),x=255*y<<8|255*g}else x=65535,v=0,b=1,w=1;if(t.emplaceBack(h,p,d,x,v,b,w),o){const t=o.length;o.clear();for(let e=0;e>16&65535,o=s?e>>16&65535:65535&e,l=(15&o)<8?15&o:0,u=t.evaluatedRMEA[l],c=t.evaluatedColor[l],h=t.emissionHeightBasedParams[l];let p;if(a&&2===l&&n.lights&&(p=new eu,p.resize(10*n.lights.length)),Ww(r.featureArray,i,c,u,h,r.aabb.min[2],r.aabb.max[2],p),p&&a){a=!1;const t=n.meshes[n.lightMeshIndex];t.featureArray=p,t.featureArray._trim()}}r.featureArray._trim(),i++}}Qa(Xw,"Tiled3dModelBucket",{omit:["layers"]}),Qa(Hw,"Tiled3dModelFeature");const Kw=["id","tile","layer","source","sourceLayer","state"];class Jw{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,this._z=e,this._x=r,this._y=n,this.properties=t?t.properties:{},this.id=i}clone(){const t=new Jw(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(t.state=Object.assign({},this.state)),this.layer&&(t.layer=Object.assign({},this.layer)),this.source&&(t.source=this.source),this.sourceLayer&&(t.sourceLayer=this.sourceLayer),t}get geometry(){return void 0===this._geometry&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const e of Kw)void 0!==this[e]&&(t[e]=this[e]);return t}}class Qw extends Jw{constructor(t,e){super(t._vectorTileFeature,t._z,t._x,t._y,t.id),t.state&&(this.state=Object.assign({},t.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=t.source,this.sourceLayer=t.sourceLayer,this.layer=t.layer)}toJSON(){const t=super.toJSON();return t.target=this.target,t.namespace=this.namespace,t}}class t_ extends nn{constructor(t,e,r,n){super(),this.id=t,this.type="model",this.models=[],this._loaded=!1,this._options=e,this._modelsInfo=new Map}load(){const t=[];for(const e in this._options.models){const r=this._options.models[e],n=this._modelsInfo.get(e);if(n){const t=n.model;t.position=null!=r.position?new yc(r.position[0],r.position[1]):new yc(0,0),t.orientation=null!=r.orientation?r.orientation:[0,0,0],n.modelSpec=r,t_.applyModelSpecification(t,r),t.computeBoundsAndApplyParent(),this.models.push(t)}else{const n=py(this.map._requestManager.transformRequest(r.uri,Tr.Model).url).then((t=>{if(!t)return;const n=tg(t),i=new Ny(e,r.uri,r.position,r.orientation,n);t_.applyModelSpecification(i,r),i.computeBoundsAndApplyParent(),this.models.push(i),this._modelsInfo.set(e,{modelSpec:r,model:i})})).catch((t=>{this.fire(new tn(new Error(`Could not load model ${e} from ${r.uri}: ${t.message}`)))}));t.push(n)}}Promise.allSettled(t).then((()=>{this._loaded=!0,this.fire(new Qr("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((t=>{this._loaded=!0,this.fire(new tn(new Error(`Could not load models: ${t.message}`)))}))}static applyModelSpecification(t,e){e.nodeOverrides&&t_.convertNodeOverrides(t,e.nodeOverrides),e.materialOverrides&&t_.convertMaterialOverrides(t,e.materialOverrides),e.nodeOverrideNames&&(t.nodeOverrideNames=[...e.nodeOverrideNames]),e.materialOverrideNames&&(t.materialOverrideNames=[...e.materialOverrideNames]),e.featureProperties&&(t.featureProperties=e.featureProperties)}static convertNodeOverrides(t,e){if(Array.isArray(e)&&e.every((t=>"string"==typeof t))){t.nodeOverrideNames=[];for(const r of e)t.nodeOverrideNames.push(r)}else Object.entries(e).forEach((([e,r])=>{const n={orientation:[0,0,0]};if(r.hasOwnProperty("orientation")){const t=r.orientation;t&&(n.orientation=t)}t.nodeOverrides.set(e,n)}))}static convertMaterialOverrides(t,e){if(Array.isArray(e)&&e.every((t=>"string"==typeof t))){t.materialOverrideNames=[];for(const r of e)t.materialOverrideNames.push(r)}else Object.entries(e).forEach((([e,r])=>{const n={color:new un(1,1,1),colorMix:0,emissionStrength:0,opacity:1},i=r["model-color"];void 0!==i&&(n.color.r=i[0],n.color.g=i[1],n.color.b=i[2]);const s=r["model-color-mix-intensity"];void 0!==s&&(n.colorMix=s);const a=r["model-emissive-strength"];void 0!==a&&(n.emissionStrength=a);const o=r["model-opacity"];void 0!==o&&(n.opacity=o),t.materialOverrides.set(e,n)}))}onAdd(t){this.map=t,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(t,e){}serialize(){return this._options}setProperty(t,e){return!1}reload(){const t=al(this.id,this.scope);this.map.style.clearSource(t),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(t){this.models=[];const e=new Map;for(const r in t){const n=t[r];if(this._modelsInfo.has(r)){const t=this._modelsInfo.get(r);t&&t.modelSpec.uri===n.uri&&e.set(r,t)}}this._modelsInfo=e,this._options.models=t,this._loaded=!1,this.load()}}function e_(t,e,r,n){const i=1<t.polygon)).flat());const y=d?o:null,[g,x]=vm(s,n,h,c,u,a,y,p,f,s.center.lat,t.tileID.canonical),v=t.queryGeometry;return xm(g,x,v.isPointQuery()?v.screenBounds:v.screenGeometry)}},building:class extends ml{constructor(t,e,r,n){super(t,{layout:Ig||(Ig=new No({visibility:new Do(jo.layout_building.visibility),"building-facade":new Ro(jo.layout_building["building-facade"]),"building-facade-floors":new Ro(jo.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ro(jo.layout_building["building-facade-unit-width"]),"building-facade-window":new Ro(jo.layout_building["building-facade-window"]),"building-roof-shape":new Ro(jo.layout_building["building-roof-shape"]),"building-height":new Ro(jo.layout_building["building-height"]),"building-base":new Ro(jo.layout_building["building-base"]),"building-flood-light-wall-radius":new Ro(jo.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ro(jo.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ro(jo.layout_building["building-flip-roof-orientation"])})),paint:Mg||(Mg=new No({"building-opacity":new Do(jo.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Do(jo.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Do(jo.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Do(jo.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Do(jo.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Do(jo.paint_building["building-vertical-scale"]),"building-cast-shadows":new Do(jo.paint_building["building-cast-shadows"]),"building-color":new Ro(jo.paint_building["building-color"]),"building-emissive-strength":new Ro(jo.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Do(jo.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Do(jo.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Do(jo.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Do(jo.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Do(jo.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new wg(t)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(t){return!0}queryRadius(t){return 0}queryIntersectsFeature(t,e,r,n,i,s,a,o,l){let u=this.layout.get("building-height").evaluate(e,r);const c=this.layout.get("building-base").evaluate(e,r),h=t.tile.getBucket(this).getFootprint(e);if(h){if(0!==h.hiddenFlags)return!1;u=h.height}const[p,d]=vm(s,n,c,u,new $t(0,0),a,null,[0,0],1,s.center.lat,t.tileID.canonical),f=t.queryGeometry;return xm(p,d,f.isPointQuery()?f.screenBounds:f.screenGeometry)}},line:class extends ml{constructor(t,e,r,n){const i=Qg();super(t,i,e,r,n),i.layout&&(this.layout=new Co(i.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=t._styleExpression&&t._styleExpression.expression instanceof ks,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}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=(()=>{if(ex)return ex;const t=Qg();return ex=new tx(t.paint.properties["line-width"].specification),ex.useIntegerZoom=!0,ex})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Rg(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(t,e,r){const n=Yg(this);return{config:new Wu(this,{zoom:e,lut:r}),defines:n,overrideFog:!1}}queryRadius(t){const e=t,r=rx(Rh("line-width",this,e),Rh("line-gap-width",this,e)),n=Rh("line-offset",this,e);return r/2+Math.abs(n)+Lh(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,r,n,i,s){if(t.queryGeometry.isAboveHorizon)return!1;const a=Oh(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),o=t.pixelToTileUnitsFactor/2*rx(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(n=function(t,e){const r=[],n=new $t(0,0);for(let i=0;i=3)for(let e=0;e>16&255)/255,(t>>8&255)/255,(255&t)/255,1)}function B_(t,e,r){1===t?(e.rgb_color=k_(r.readVarint()),e.paint="rgb_color"):2===t?(e.linear_gradient_idx=r.readVarint(),e.paint="linear_gradient_idx"):3===t?(e.radial_gradient_idx=r.readVarint(),e.paint="radial_gradient_idx"):5===t?r.readPackedFloat(e.dasharray):6===t?e.dashoffset=r.readFloat():7===t?e.miterlimit=r.readFloat():8===t?e.opacity=r.readVarint():9===t?e.width=r.readFloat():10===t?e.linecap=r.readVarint():11===t&&(e.linejoin=r.readVarint())}function z_(t,e,r){1===t?e.transform=I_(r,r.readVarint()+r.pos):2===t?e.spread_method=r.readVarint():3===t?e.stops.push(T_(r,r.readVarint()+r.pos)):4===t?e.x1=r.readFloat():5===t?e.y1=r.readFloat():6===t?e.x2=r.readFloat():7===t&&(e.y2=r.readFloat())}function T_(t,e){return t.readFields(E_,{offset:0,opacity:255,rgb_color:s_},e)}function E_(t,e,r){1===t?e.offset=r.readFloat():2===t?e.opacity=r.readVarint():3===t&&(e.rgb_color=k_(r.readVarint()))}function V_(t,e,r){1===t?e.transform=I_(r,r.readVarint()+r.pos):2===t?e.spread_method=r.readVarint():3===t?e.stops.push(T_(r,r.readVarint()+r.pos)):4===t?e.cx=r.readFloat():5===t?e.cy=r.readFloat():6===t?e.r=r.readFloat():7===t?e.fx=r.readFloat():8===t?e.fy=r.readFloat():9===t&&(e.fr=r.readFloat())}function F_(t,e,r){1===t?e.transform=I_(r,r.readVarint()+r.pos):2===t?e.clip_path_idx=r.readVarint():3===t&&e.children.push(w_(r,r.readVarint()+r.pos))}function C_(t,e,r){1===t?e.left=e.top=r.readFloat():2===t?e.width=e.height=r.readFloat():3===t?e.top=r.readFloat():4===t?e.height=r.readFloat():5===t?e.mask_type=r.readVarint():6===t?e.mask_idx=r.readVarint():7===t&&e.children.push(w_(r,r.readVarint()+r.pos))}class D_{static calculate(t={},e=[]){const r=new Map,n=new Map;if(0===Object.keys(t).length)return r;e.forEach((t=>{n.set(t.name,t.rgb_color||new un(0,0,0))}));for(const[e,i]of Object.entries(t))n.has(e)?r.set(n.get(e).toString(),i):console.warn(`Ignoring unknown image variable "${e}"`);return r}}function R_(t,e=255,r){const n=e/255,i=t.toString(),s=r.has(i)?r.get(i).clone():t.clone();return s.a*=n,s.toString()}function L_(t,e){if(!or()){const r=document.createElement("canvas");return r.width=t,r.height=e,r}return new OffscreenCanvas(t,e)}let O_,U_=null;function N_(t,e,r,n,i){for(const s of n.children)j_(t,e,r,s,i)}function j_(t,e,r,n,i){n.group?(t.save(),function(t,e,r,n,i){const s=null!=n.mask_idx?r.masks[n.mask_idx]:null,a=null!=n.clip_path_idx?r.clip_paths[n.clip_path_idx]:null;if(n.transform&&(e=K_(n.transform).preMultiplySelf(e)),!function(t,e,r){return 255!==t.opacity||e||r}(n,null!=a,null!=s))return void N_(t,e,r,n,i);const o=L_(t.canvas.width,t.canvas.height),l=o.getContext("2d");N_(l,e,r,n,i),a&&W_(l,e,r,a),s&&Y_(l,e,r,s,i),t.globalAlpha=n.opacity/255,t.drawImage(o,0,0)}(t,e,r,n.group,i),t.restore()):n.path&&(t.save(),function(t,e,r,n,i){t.setTransform(e),n.paint_order===u_.PAINT_ORDER_FILL_AND_STROKE?($_(t,r,n,i),q_(t,r,n,i)):(q_(t,r,n,i),$_(t,r,n,i))}(t,e,r,n.path,i),t.restore())}function $_(t,e,r,n){const i=r.fill;if(!i)return;const s=i.opacity/255;switch(t.save(),t.beginPath(),J_(r,t),i.paint){case"rgb_color":t.fillStyle=R_(i.rgb_color,i.opacity,n);break;case"linear_gradient_idx":{const r=e.linear_gradients[i.linear_gradient_idx];r.transform&&t.setTransform(K_(r.transform).preMultiplySelf(t.getTransform())),t.fillStyle=H_(t,r,s,n);break}case"radial_gradient_idx":{const r=e.radial_gradients[i.radial_gradient_idx];r.transform&&t.setTransform(K_(r.transform).preMultiplySelf(t.getTransform())),t.fillStyle=X_(t,r,s,n)}}t.fill(G_(r)),t.restore()}function G_(t){return t.rule===a_.PATH_RULE_NON_ZERO?"nonzero":t.rule===a_.PATH_RULE_EVEN_ODD?"evenodd":void 0}function q_(t,e,r,n){const i=r.stroke;if(!i)return;const s=Q_(r);t.lineWidth=i.width,t.miterLimit=i.miterlimit,t.setLineDash(i.dasharray),t.lineDashOffset=i.dashoffset;const a=i.opacity/255;switch(i.paint){case"rgb_color":t.strokeStyle=R_(i.rgb_color,i.opacity,n);break;case"linear_gradient_idx":t.strokeStyle=H_(t,e.linear_gradients[i.linear_gradient_idx],a,n,!0);break;case"radial_gradient_idx":t.strokeStyle=X_(t,e.radial_gradients[i.radial_gradient_idx],a,n,!0)}switch(i.linejoin){case l_.LINE_JOIN_MITER_CLIP:case l_.LINE_JOIN_MITER:t.lineJoin="miter";break;case l_.LINE_JOIN_ROUND:t.lineJoin="round";break;case l_.LINE_JOIN_BEVEL:t.lineJoin="bevel"}switch(i.linecap){case o_.LINE_CAP_BUTT:t.lineCap="butt";break;case o_.LINE_CAP_ROUND:t.lineCap="round";break;case o_.LINE_CAP_SQUARE:t.lineCap="square"}t.stroke(s)}function H_(t,e,r,n,i=!1){if(1===e.stops.length){const t=e.stops[0];return R_(t.rgb_color,t.opacity*r,n)}const{x1:s,y1:a,x2:o,y2:l}=e;let u=new DOMPoint(s,a),c=new DOMPoint(o,l);if(i){const t=K_(e.transform);u=t.transformPoint(u),c=t.transformPoint(c)}const h=t.createLinearGradient(u.x,u.y,c.x,c.y);for(const t of e.stops)h.addColorStop(t.offset,R_(t.rgb_color,t.opacity*r,n));return h}function X_(t,e,r,n,i=!1){if(1===e.stops.length){const t=e.stops[0];return R_(t.rgb_color,t.opacity*r,n)}const s=K_(e.transform),{fx:a,fy:o,fr:l,cx:u,cy:c,r:h}=e;let p=new DOMPoint(a,o),d=new DOMPoint(u,c),f=l,m=h;if(i){p=s.transformPoint(p),d=s.transformPoint(d);const t=(s.a+s.d)/2;f=l*t,m=e.r*t}const y=t.createRadialGradient(p.x,p.y,f,d.x,d.y,m);for(const t of e.stops)y.addColorStop(t.offset,R_(t.rgb_color,t.opacity*r,n));return y}function Z_(t,e,r,n){const i=n.transform?K_(n.transform).preMultiplySelf(e):e,s=L_(t.canvas.width,t.canvas.height),a=s.getContext("2d");for(const t of n.children)if(t.group)Z_(a,i,r,t.group);else if(t.path){const e=t.path,r=new Path2D;r.addPath(Q_(e),i),a.fill(r,G_(e))}const o=null!=n.clip_path_idx?r.clip_paths[n.clip_path_idx]:null;o&&W_(a,i,r,o),t.globalCompositeOperation="source-over",t.drawImage(s,0,0)}function W_(t,e,r,n){const i=L_(t.canvas.width,t.canvas.height);Z_(i.getContext("2d"),e,r,n),t.globalCompositeOperation="destination-in",t.drawImage(i,0,0)}function Y_(t,e,r,n,i){if(0===n.children.length)return;const s=null!=n.mask_idx?r.masks[n.mask_idx]:null;s&&Y_(t,e,r,s,i);const a=t.canvas.width,o=t.canvas.height,l=L_(a,o),u=l.getContext("2d"),c=n.width,h=n.height,p=n.left,d=n.top,f=new Path2D,m=new Path2D;m.rect(p,d,c,h),f.addPath(m,e),u.clip(f);for(const t of n.children)j_(u,e,r,t,i);const y=u.getImageData(0,0,a,o),g=y.data;if(n.mask_type===h_.MASK_TYPE_LUMINANCE)for(let t=0;t{n(t,r)}),e):n(t,r),()=>{}}return i.callbacks.push(n),i.cancel||(i.cancel=r(((r,n)=>{i.result=[r,n];for(const t of i.callbacks)this.scheduler?this.scheduler.add((()=>{t(r,n)}),e):t(r,n);setTimeout((()=>delete this.entries[t]),3e3)}))),()=>{i.result||(i.callbacks=i.callbacks.filter((t=>t!==n)),i.callbacks.length||(i.cancel(),delete this.entries[t]))}}}function nA(t,e,r){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(e=>{const n=Dr(t.request,((t,n,i)=>{t?e(t):n&&e(null,{rawData:n,vectorTile:r?void 0:new Xc(new wx(n)),responseHeaders:new Map(i.entries())})}));return()=>{n.cancel(),e()}}),e)}class iA{constructor(t){this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(t,e){const r=this.toIdx(t,e);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(t,e){return this.leaves[this.toIdx(t,e)]}toIdx(t,e){return e*this.size+t}}function sA(t,e,r,n){let i=0,s=Number.MAX_VALUE;for(let a=0;a<3;a++)if(Math.abs(n[a])<1e-15){if(r[a]e[a])return null}else{const o=1/n[a];let l=(t[a]-r[a])*o,u=(e[a]-r[a])*o;if(l>u){const t=l;l=u,u=t}if(l>i&&(i=l),us)return null}return i}function aA(t,e,r,n,i,s,a,o,l,u,c){const h=n-t,p=i-e,d=s-r,f=a-t,m=o-e,y=l-r,g=c[1]*y-c[2]*m,x=c[2]*f-c[0]*y,v=c[0]*m-c[1]*f,b=h*g+p*x+d*v;if(Math.abs(b)<1e-15)return null;const w=1/b,_=u[0]-t,A=u[1]-e,I=u[2]-r,M=(_*g+A*x+I*v)*w;if(M<0||M>1)return null;const S=A*d-I*p,P=I*h-_*d,k=_*p-A*h,B=(c[0]*S+c[1]*P+c[2]*k)*w;return B<0||M+B>1?null:(f*S+m*P+y*k)*w}function oA(t,e,r){return(t-e)/(r-e)}function lA(t,e,r,n,i,s,a,o,l){const u=1<{const s=n?1:0,a=(t+1)*r-s,o=e*r,l=(e+1)*r-s;i[0]=t*r,i[1]=o,i[2]=a,i[3]=l};let a=new iA(n);const o=[];for(let e=0;e=1;n/=2){const t=r[r.length-1];a=new iA(n);for(let e=0;e0;){const{idx:o,t:d,nodex:f,nodey:m,depth:y}=p.pop();if(this.leaves[o]){lA(f,m,y,t,e,r,n,c,h);const o=1<=t[2])return d}continue}let g=0;for(let p=0;p=l[u[r]]&&(u.splice(r,0,p),e=!0);e||(u[g]=p),g++}}for(let t=0;t=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}static pack(t,e){const r=[0,0,0,0],n=mA.getUnpackVector(e);let i=Math.floor((t+n[3])/n[2]);return r[2]=i%256,i=Math.floor(i/256),r[1]=i%256,i=Math.floor(i/256),r[0]=i,r}getPixels(){return new ed({width:this.stride,height:this.stride},this.pixels)}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=a-1;break;case 1:a=s+1}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e=1;n--){const i=1===n?1:0,s=2===n?1:0;for(let n=0;n>>1^-(1&t[e]);return t}function SA(t,e){switch(e){case"uint32":return t;case"uint16":for(let e=0;e>4|(61440&r)>>8|(240&n)<<4|61440&n,t[e+1]=15&r|(3840&r)>>4|(15&n)<<8|(3840&n)<<4}return t;case"uint8":for(let e=0;e>6|(192&n)>>4|(192&i)>>2|192&s,t[e+1]=(48&r)>>4|(48&n)>>2|48&i|(48&s)<<2,t[e+2]=(12&r)>>2|12&n|(12&i)<<2|(12&s)<<4,t[e+3]=3&r|(3&n)<<2|(3&i)<<4|(3&s)<<6}return t;default:throw new Error(`Invalid pixel format, "${e}"`)}}Qa(mA,"DEMData"),Qa(uA,"DemMinMaxQuadTree",{omit:["dem"]});var PA=Uint8Array,kA=Uint16Array,BA=Int32Array,zA=new PA([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]),TA=new PA([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]),EA=new PA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),VA=function(t,e){for(var r=new kA(31),n=0;n<31;++n)r[n]=e+=1<>1|(21845&OA)<<1;LA[OA]=((65280&(UA=(61680&(UA=(52428&UA)>>2|(13107&UA)<<2))>>4|(3855&UA)<<4))>>8|(255&UA)<<8)>>1}var NA=function(t,e,r){for(var n=t.length,i=0,s=new kA(e);i>l]=u;return a},jA=new PA(288);for(OA=0;OA<144;++OA)jA[OA]=8;for(OA=144;OA<256;++OA)jA[OA]=9;for(OA=256;OA<280;++OA)jA[OA]=7;for(OA=280;OA<288;++OA)jA[OA]=8;var $A=new PA(32);for(OA=0;OA<32;++OA)$A[OA]=5;var GA=NA(jA,9),qA=NA($A,5),HA=function(t){for(var e=t[0],r=1;re&&(e=t[r]);return e},XA=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&r},ZA=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},WA=["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"],YA=function(t,e,r){var n=new Error(e||WA[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,YA),!r)throw n;return n},KA=new PA(0),JA="undefined"!=typeof TextDecoder&&new TextDecoder;try{JA.decode(KA,{stream:!0})}catch(t){}const QA={gzip_data:"gzip"};class tI extends Error{constructor(t){super(t),this.name="MRTError"}}const eI={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},rI={uint32:1,uint16:2,uint8:4},nI={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let iI;class sI{constructor(t=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=t}getLayer(t){const e=this.layers[t];if(!e)throw new tI(`Layer '${t}' not found`);return e}getHeaderLength(t){const e=new Uint8Array(t),r=new DataView(t);if(13!==e[0])throw new tI("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(t){const e=new Uint8Array(t),r=this.getHeaderLength(t);if(e.length= ${r} but got buffer of length ${e.length}`);const n=new iI(e.subarray(0,r)).readFields(yA,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new tI(`Invalid attempt to parse header ${n.z}/${n.x}/${n.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=n.x,this.y=n.y,this.z=n.z;for(const t of n.layers)this.layers[t.name]=new aI(t,{cacheSize:this._cacheSize});return this}createDecodingTask(t){const e=[],r=this.getLayer(t.layerName);for(let n of t.blockIndices){const i=r.dataIndex[n],s=i.firstByte-t.firstByte,a=i.lastByte-t.firstByte;if(r._blocksInProgress.has(n))continue;const o={layerName:r.name,firstByte:s,lastByte:a,pixelFormat:r.pixelFormat,blockIndex:n,blockShape:[i.bands.length].concat(r.bandShape),buffer:r.buffer,codec:i.codec.codec,filters:i.filters.map((t=>t.filter))};r._blocksInProgress.add(n),e.push(o)}return new oI(e,(()=>{e.forEach((t=>r._blocksInProgress.delete(t.blockIndex)))}),((t,n)=>{if(e.forEach((t=>r._blocksInProgress.delete(t.blockIndex))),t)throw t;n.forEach((t=>{this.getLayer(t.layerName).processDecodedData(t)}))}))}}class aI{constructor({version:t,name:e,units:r,tileSize:n,pixelFormat:i,buffer:s,dataIndex:a},o){if(this.version=t,1!==this.version)throw new tI(`Cannot parse raster layer encoded with MRT version ${t}`);this.name=e,this.units=r,this.tileSize=n,this.buffer=s,this.pixelFormat=eI[i],this.dataIndex=a,this.bandShape=[n+2*s,n+2*s,rI[this.pixelFormat]],this._decodedBlocks=new tA(o?o.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return rI[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map((({bands:t})=>t)).flat()}processDecodedData(t){const e=t.blockIndex.toString();this._decodedBlocks.get(e)||this._decodedBlocks.put(e,t.data)}getBlockForBand(t){let e=0;switch(typeof t){case"string":for(const[r,n]of this.dataIndex.entries()){for(const[i,s]of n.bands.entries())if(s===t)return{bandIndex:e+i,blockIndex:r,blockBandIndex:i};e+=n.bands.length}break;case"number":for(const[r,n]of this.dataIndex.entries()){if(t>=e&&tthis.cacheSize)throw new tI(`Number of blocks to decode (${i.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:e,lastByte:r,blockIndices:n}}hasBand(t){const{blockIndex:e}=this.getBlockForBand(t);return e>=0}hasDataForBand(t){const{blockIndex:e}=this.getBlockForBand(t);return e>=0&&!!this._decodedBlocks.get(e.toString())}getBandView(t){const{blockIndex:e,blockBandIndex:r}=this.getBlockForBand(t);if(e<0)throw new tI(`Band not found: ${JSON.stringify(t)}`);const n=this._decodedBlocks.get(e.toString());if(!n)throw new tI(`Data for band ${JSON.stringify(t)} of layer "${this.name}" not decoded.`);const i=this.dataIndex[e],s=this.bandShape.reduce(((t,e)=>t*e),1),a=r*s,o=n.subarray(a,a+s);return{data:o,bytes:new Uint8Array(o.buffer).subarray(o.byteOffset,o.byteOffset+o.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:i.offset,scale:i.scale}}}sI.setPbf=function(t){iI=t};class oI{constructor(t,e,r){this.tasks=t,this._onCancel=e,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(t,e){this._finalized||(this._onComplete(t,e),this._finalized=!0)}}sI.performDecoding=function(t,e){const r=new Uint8Array(t);return Promise.all(e.tasks.map((t=>{const{layerName:e,firstByte:n,lastByte:i,pixelFormat:s,blockShape:a,blockIndex:o,filters:l,codec:u}=t,c=r.subarray(n,i+1),h=new Uint32Array(a[0]*a[1]*a[2]);let p;if("gzip_data"!==u)throw new tI(`Unhandled codec: ${u}`);return p=function(t,e){if(!globalThis.DecompressionStream&&"gzip_data"===e)return Promise.resolve(((s=function(t){31==t[0]&&139==t[1]&&8==t[2]||YA(6,"invalid gzip data");var e=t[3],r=10;4&e&&(r+=2+(t[10]|t[11]<<8));for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[r++]);return r+(2&e)}(i=t))+8>i.length&&YA(6,"invalid gzip data"),function(t,e,r,n){var i=t.length;if(!i||e.f&&!e.l)return r||new PA(0);var s=!r,a=s||2!=e.i;s&&(r=new PA(3*i));var o,l,u=function(t){var e=r.length;if(t>e){var n=new PA(Math.max(2*e,t));n.set(r),r=n}},c=e.f||0,h=e.p||0,p=e.b||0,d=e.l,f=e.d,m=e.m,y=e.n,g=8*i;do{if(!d){c=XA(t,h,1);var x=XA(t,h+1,3);if(h+=3,!x){var v=t[(z=4+((h+7)/8|0))-4]|t[z-3]<<8,b=z+v;if(b>i){YA(0);break}a&&u(p+v),r.set(t.subarray(z,b),p),e.b=p+=v,e.p=h=8*b,e.f=c;continue}if(1==x)d=GA,f=qA,m=9,y=5;else if(2==x){var w=XA(t,h,31)+257,_=XA(t,h+10,15)+4,A=w+XA(t,h+5,31)+1;h+=14;for(var I=new PA(A),M=new PA(19),S=0;S<_;++S)M[EA[S]]=XA(t,h+3*S,7);h+=3*_;var P=HA(M),k=(1<>4)<16)I[S++]=z;else{var E=0,V=0;for(16==z?(V=3+XA(t,h,3),h+=2,E=I[S-1]):17==z?(V=3+XA(t,h,7),h+=3):18==z&&(V=11+XA(t,h,127),h+=7);V--;)I[S++]=E}}var F=I.subarray(0,w),C=I.subarray(w);m=HA(F),y=HA(C),d=NA(F,m),f=NA(C,y)}else YA(1);if(h>g){YA(0);break}}a&&u(p+131072);for(var D=(1<>4;if((h+=15&E)>g){YA(0);break}if(E||YA(2),O<256)r[p++]=O;else{if(256==O){L=h,d=null;break}var U=O-254;O>264&&(U=XA(t,h,(1<<($=zA[S=O-257]))-1)+CA[S],h+=$);var N=f[ZA(t,h)&R],j=N>>4;if(N||YA(3),h+=15&N,C=RA[j],j>3){var $=TA[j];C+=ZA(t,h)&(1<<$)-1,h+=$}if(h>g){YA(0);break}a&&u(p+131072);var G=p+U;if(po.length)&&(l=o.length),new PA(o.subarray(0,l))):r.subarray(0,p)}(i.subarray(s,-8),{i:2},new PA(((r=i)[(n=r.length)-4]|r[n-3]<<8|r[n-2]<<16|r[n-1]<<24)>>>0))));var r,n,i,s;const a=QA[e];if(!a)throw new Error(`Unhandled codec: ${e}`);const o=new globalThis.DecompressionStream(a);return new Response(new Blob([t]).stream().pipeThrough(o)).arrayBuffer().then((t=>new Uint8Array(t)))}(c,u).then((t=>(function(t,e){t.readFields(_A,e)}(new iI(t),h),new(0,nI[s])(h.buffer)))),p.then((t=>{for(let e=l.length-1;e>=0;e--)switch(l[e]){case"delta_filter":IA(t,a);break;case"zigzag_filter":MA(t);break;case"bitshuffle_filter":SA(t,s);break;default:throw new tI(`Unhandled filter "${l[e]}"`)}return{layerName:e,blockIndex:o,data:t}})).catch((t=>{throw t}))})))},Qa(oI,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Qa(sI,"MapboxRasterTile"),Qa(aI,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class lI{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e=0&&n[3]>=0&&l.insert(o,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Xc(new wx(this.rawTileData)).layers,this.sourceLayerCoder=new lI(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const t in this.vtLayers)this.vtFeatures[t]=[]}return this.vtLayers}query(t,e){const{tilespaceGeometry:r,transform:n,tileTransform:i,pixelPosMatrix:s,availableImages:a,worldview:o}=e;this.loadVTLayers(),this.serializedLayersCache.clear();const l=e.queryRadius?e.queryRadius:0,u=r.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,((t,e,n,i)=>Vh(r.bufferedTilespaceGeometry,t-l,e-l,n+l,i+l)));c.sort(hI);let h=null;n.elevation&&c.length>0&&(h=Uw.create(n.elevation,this.tileID));const p={};let d;for(let e=0;e(f||(f=Uc(t,this.tileID.canonical,i)),e.queryIntersectsFeature(r,t,a,f,this.z,n,s,h,o))))}return p}loadMatchingFeature(t,e,r,n,i,s){const{featureIndex:a,bucketIndex:o,sourceLayerIndex:l,layoutVertexArrayOffset:u}=e,c=this.bucketLayerIDs[o],h=r.layers,p=Object.keys(h);if(p.length&&!we(p,c))return;const d=r.sourceCache,f=this.sourceLayerCoder.decode(l),m=this.vtLayers[f].feature(a),y=this.getId(m,f);for(let e=0;e`${t.key}: ${t.message}`)).join(", ");return void Ae(`Failed to create expression for promoteId: ${e}`)}this.promoteIdExpression=t.value}r=this.promoteIdExpression.evaluate({zoom:0},t)}else r=t.properties[n];"boolean"==typeof r&&(r=Number(r))}return r}}function cI(t,e,r,n,i){return ge(t,((t,s)=>{const a=e instanceof Co?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,void 0,i):a}))}function hI(t,e){return e-t}Qa(uI,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const pI=["type","source","source-layer","minzoom","maxzoom","filter","layout"],dI=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class fI{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const n=r>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const i=dI[15&r];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new fI(a,s,i,t)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=dI.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+a+o),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return mI(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:a}=this,o=[0,i.length-1,0],l=[];for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=a){for(let a=h;a<=c;a++){const o=s[2*a],u=s[2*a+1];o>=t&&o<=r&&u>=e&&u<=n&&l.push(i[a])}continue}const p=h+c>>1,d=s[2*p],f=s[2*p+1];d>=t&&d<=r&&f>=e&&f<=n&&l.push(i[p]),(0===u?t<=d:e<=f)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?r>=d:n>=f)&&(o.push(p+1),o.push(c),o.push(1-u))}return l}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:i,nodeSize:s}=this,a=[0,n.length-1,0],o=[],l=r*r;for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=s){for(let r=h;r<=c;r++)vI(i[2*r],i[2*r+1],t,e)<=l&&o.push(n[r]);continue}const p=h+c>>1,d=i[2*p],f=i[2*p+1];vI(d,f,t,e)<=l&&o.push(n[p]),(0===u?t-r<=d:e-r<=f)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?t+r>=d:e+r>=f)&&(a.push(p+1),a.push(c),a.push(1-u))}return o}}function mI(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;yI(t,e,a,n,i,s),mI(t,e,r,n,a-1,1-s),mI(t,e,r,a+1,i,1-s)}function yI(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);yI(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s)}const a=e[2*r+s];let o=n,l=i;for(gI(t,e,n,r),e[2*i+s]>a&&gI(t,e,n,i);oa;)l--}e[2*n+s]===a?gI(t,e,n,l):(l++,gI(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function gI(t,e,r,n){xI(t,r,n),xI(e,2*r,2*n),xI(e,2*r+1,2*n+1)}function xI(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function vI(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}export{ti as $,Ln as A,al as B,vv as C,km as D,nn as E,xv as F,yv as G,Kn as H,sn as I,$o as J,Yn as K,Qn as L,Ta as M,ka as N,za as O,$t as P,Na as Q,Tr as R,Go as S,yy as T,ja as U,zw as V,qa as W,vs as X,gs as Y,xs as Z,si as _,Ye as a,Mc as a$,Jn as a0,ln as a1,qo as a2,Tw as a3,Ea as a4,Ba as a5,jo as a6,Vw as a7,zo as a8,No as a9,ie as aA,g as aB,dt as aC,rc as aD,Eh as aE,Fc as aF,wc as aG,ue as aH,gc as aI,_c as aJ,rA as aK,nA as aL,ze as aM,Er as aN,br as aO,Hh as aP,fe as aQ,xw as aR,_w as aS,yc as aT,mw as aU,Gr as aV,xy as aW,t_ as aX,ye as aY,gb as aZ,Ic as a_,Do as aa,Uo as ab,Po as ac,Ga as ad,Ec as ae,K as af,se as ag,V as ah,Co as ai,Ap as aj,dn as ak,fn as al,Ui as am,un as an,Xt as ao,Oo as ap,te as aq,ee as ar,vb as as,Vh as at,bb as au,rt as av,X as aw,ih as ax,Jt as ay,Ng as az,tr as b,Pf as b$,$l as b0,Il as b1,he as b2,su as b3,Qb as b4,So as b5,Ho as b6,Nc as b7,Jw as b8,Be as b9,f as bA,_ as bB,h as bC,wp as bD,n as bE,tt as bF,$ as bG,j as bH,W as bI,ov as bJ,Lx as bK,Xb as bL,Wb as bM,av as bN,Z as bO,Bt as bP,Vt as bQ,Tt as bR,Ot as bS,ae as bT,ot as bU,Ow as bV,dm as bW,wh as bX,dx as bY,yf as bZ,Bw as b_,Rg as ba,Kd as bb,Uc as bc,_l as bd,Ql as be,Jh as bf,bu as bg,od as bh,hw as bi,ap as bj,mp as bk,y as bl,hp as bm,sp as bn,Al as bo,Kh as bp,A as bq,x as br,sI as bs,wx as bt,Dr as bu,le as bv,oe as bw,pI as bx,Gt as by,p as bz,Ke as c,Yt as c$,Sf as c0,Yx as c1,Xv as c2,ab as c3,fI as c4,N as c5,st as c6,mt as c7,vt as c8,gt as c9,Py as cA,Gh as cB,lp as cC,xb as cD,lt as cE,ut as cF,ct as cG,ic as cH,Tp as cI,Pc as cJ,jg as cK,By as cL,z as cM,Sy as cN,ky as cO,v as cP,sh as cQ,b as cR,bp as cS,L as cT,Zt as cU,Xh as cV,Fh as cW,ch as cX,uh as cY,nc as cZ,Qt as c_,Re as ca,bt as cb,P as cc,k as cd,B as ce,Ac as cf,Le as cg,zu as ch,Vu as ci,Tu as cj,Eu as ck,Ru as cl,Nb as cm,r as cn,i as co,St as cp,et as cq,It as cr,Mt as cs,Q as ct,qh as cu,ph as cv,hh as cw,Y as cx,T as cy,fh as cz,Qe as d,gy as d$,He as d0,bc as d1,sc as d2,Fu as d3,F as d4,Se as d5,Tc as d6,D as d7,mh as d8,R as d9,_o as dA,Cu as dB,Ou as dC,Mp as dD,_p as dE,Kt as dF,up as dG,Pp as dH,Sp as dI,ip as dJ,Ip as dK,ed as dL,Qh as dM,Oe as dN,s as dO,c as dP,J as dQ,xp as dR,$e as dS,Ge as dT,yw as dU,pp as dV,Gg as dW,$g as dX,Dp as dY,Nl as dZ,px as d_,Ue as da,Pe as db,py as dc,tg as dd,Ny as de,Ew as df,p_ as dg,Tm as dh,Pv as di,Sv as dj,Vr as dk,xo as dl,cr as dm,Jr as dn,ve as dp,ol as dq,sl as dr,ll as ds,Aw as dt,i_ as du,xe as dv,ul as dw,Qw as dx,bo as dy,Fr as dz,Xe as e,C as e$,Op as e0,Lp as e1,Yg as e2,On as e3,Xg as e4,Hg as e5,rd as e6,de as e7,Sc as e8,Zh as e9,yt as eA,e_ as eB,Uy as eC,Cy as eD,Oy as eE,Uw as eF,at as eG,pt as eH,Ly as eI,Ll as eJ,Kl as eK,d as eL,fc as eM,Yl as eN,Wl as eO,gf as eP,Cp as eQ,ff as eR,mf as eS,re as eT,Ve as eU,ne as eV,zc as eW,it as eX,nt as eY,dc as eZ,q as e_,Yf as ea,Df as eb,Lf as ec,Rf as ed,im as ee,m as ef,Bc as eg,gw as eh,bl as ei,ru as ej,ww as ek,yp as el,zl as em,w as en,a as eo,Xl as ep,ya as eq,Zl as er,be as es,xt as et,o as eu,mg as ev,H as ew,ft as ex,M as ey,S as ez,Ce as f,pc as f0,ht as f1,Ty as f2,Ee as f3,Ar as f4,zp as f5,Bp as f6,kp as f7,Fm as f8,Vm as f9,mA as fA,jc as fB,dy as fC,eg as fD,Xw as fE,ke as fF,Am as fG,Mo as fH,wr as fI,fo as fJ,wo as fa,Ao as fb,Wm as fc,Zm as fd,Xm as fe,Hm as ff,Im as fg,_r as fh,Pm as fi,Qa as fj,Qp as fk,Mv as fl,lI as fm,uI as fn,Vg as fo,Wc as fp,Kc as fq,xh as fr,ge as fs,Od as ft,bv as fu,gv as fv,Zv as fw,wv as fx,rb as fy,Xc as fz,Lr as g,We as h,Je as i,Ze as j,Ir as k,De as l,Cr as m,$r as n,lr as o,Rr as p,td as q,or as r,Fe as s,Em as t,pe as u,me as v,Ae as w,eA as x,tn as y,Qr as z};//# sourceMappingURL=shared.js.map